var _U=Object.defineProperty,SU=Object.defineProperties;var EU=Object.getOwnPropertyDescriptors;var qd=Object.getOwnPropertySymbols;var IS=Object.prototype.hasOwnProperty,CS=Object.prototype.propertyIsEnumerable;var MS=(r,e,t)=>e in r?_U(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,On=(r,e)=>{for(var t in e||(e={}))IS.call(e,t)&&MS(r,t,e[t]);if(qd)for(var t of qd(e))CS.call(e,t)&&MS(r,t,e[t]);return r},kl=(r,e)=>SU(r,EU(e));var Lm=(r,e)=>{var t={};for(var n in r)IS.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&qd)for(var n of qd(r))e.indexOf(n)<0&&CS.call(r,n)&&(t[n]=r[n]);return t};function AU(r,e){return e.forEach(function(t){t&&typeof t!="string"&&!Array.isArray(t)&&Object.keys(t).forEach(function(n){if(n!=="default"&&!(n in r)){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}})}),Object.freeze(r)}var Nm=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",get Base(){return Ga},get Circle(){return nK},get Ellipse(){return aK},get Image(){return sK},get Line(){return lK},get Marker(){return hK},get Path(){return J1},get Polygon(){return TK},get Polyline(){return CK},get Rect(){return LK},get Text(){return OK}}),Om=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",get Base(){return pa},get Circle(){return GK},get Dom(){return $K},get Ellipse(){return jK},get Image(){return XK},get Line(){return HK},get Marker(){return KK},get Path(){return QK},get Polygon(){return eZ},get Polyline(){return rZ},get Rect(){return aZ},get Text(){return cZ}}),sf=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function TU(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function IU(r){if(r.__esModule)return r;var e=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(r).forEach(function(t){var n=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:function(){return r[t]}})}),e}function kS(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var DS={exports:{}},qr={};/** @license React v16.13.1
 * react-is.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Jn=typeof Symbol=="function"&&Symbol.for,Pm=Jn?Symbol.for("react.element"):60103,Rm=Jn?Symbol.for("react.portal"):60106,Kd=Jn?Symbol.for("react.fragment"):60107,Zd=Jn?Symbol.for("react.strict_mode"):60108,Qd=Jn?Symbol.for("react.profiler"):60114,Jd=Jn?Symbol.for("react.provider"):60109,ev=Jn?Symbol.for("react.context"):60110,Bm=Jn?Symbol.for("react.async_mode"):60111,tv=Jn?Symbol.for("react.concurrent_mode"):60111,rv=Jn?Symbol.for("react.forward_ref"):60112,nv=Jn?Symbol.for("react.suspense"):60113,CU=Jn?Symbol.for("react.suspense_list"):60120,iv=Jn?Symbol.for("react.memo"):60115,av=Jn?Symbol.for("react.lazy"):60116,MU=Jn?Symbol.for("react.block"):60121,kU=Jn?Symbol.for("react.fundamental"):60117,DU=Jn?Symbol.for("react.responder"):60118,LU=Jn?Symbol.for("react.scope"):60119;function Wi(r){if(typeof r=="object"&&r!==null){var e=r.$$typeof;switch(e){case Pm:switch(r=r.type,r){case Bm:case tv:case Kd:case Qd:case Zd:case nv:return r;default:switch(r=r&&r.$$typeof,r){case ev:case rv:case av:case iv:case Jd:return r;default:return e}}case Rm:return e}}}function LS(r){return Wi(r)===tv}qr.AsyncMode=Bm;qr.ConcurrentMode=tv;qr.ContextConsumer=ev;qr.ContextProvider=Jd;qr.Element=Pm;qr.ForwardRef=rv;qr.Fragment=Kd;qr.Lazy=av;qr.Memo=iv;qr.Portal=Rm;qr.Profiler=Qd;qr.StrictMode=Zd;qr.Suspense=nv;qr.isAsyncMode=function(r){return LS(r)||Wi(r)===Bm};qr.isConcurrentMode=LS;qr.isContextConsumer=function(r){return Wi(r)===ev};qr.isContextProvider=function(r){return Wi(r)===Jd};qr.isElement=function(r){return typeof r=="object"&&r!==null&&r.$$typeof===Pm};qr.isForwardRef=function(r){return Wi(r)===rv};qr.isFragment=function(r){return Wi(r)===Kd};qr.isLazy=function(r){return Wi(r)===av};qr.isMemo=function(r){return Wi(r)===iv};qr.isPortal=function(r){return Wi(r)===Rm};qr.isProfiler=function(r){return Wi(r)===Qd};qr.isStrictMode=function(r){return Wi(r)===Zd};qr.isSuspense=function(r){return Wi(r)===nv};qr.isValidElementType=function(r){return typeof r=="string"||typeof r=="function"||r===Kd||r===tv||r===Qd||r===Zd||r===nv||r===CU||typeof r=="object"&&r!==null&&(r.$$typeof===av||r.$$typeof===iv||r.$$typeof===Jd||r.$$typeof===ev||r.$$typeof===rv||r.$$typeof===kU||r.$$typeof===DU||r.$$typeof===LU||r.$$typeof===MU)};qr.typeOf=Wi;DS.exports=qr;var NS=DS.exports,NU={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},OU={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},OS={};OS[NS.ForwardRef]=NU;OS[NS.Memo]=OU;var PS={exports:{}},Kr={};/*
object-assign
(c) Sindre Sorhus
@license MIT
*/var RS=Object.getOwnPropertySymbols,PU=Object.prototype.hasOwnProperty,RU=Object.prototype.propertyIsEnumerable;function BU(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function FU(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de",Object.getOwnPropertyNames(r)[0]==="5")return!1;for(var e={},t=0;t<10;t++)e["_"+String.fromCharCode(t)]=t;var n=Object.getOwnPropertyNames(e).map(function(a){return e[a]});if(n.join("")!=="0123456789")return!1;var i={};return"abcdefghijklmnopqrst".split("").forEach(function(a){i[a]=a}),Object.keys(Object.assign({},i)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}var UU=FU()?Object.assign:function(r,e){for(var t,n=BU(r),i,a=1;a<arguments.length;a++){t=Object(arguments[a]);for(var o in t)PU.call(t,o)&&(n[o]=t[o]);if(RS){i=RS(t);for(var s=0;s<i.length;s++)RU.call(t,i[s])&&(n[i[s]]=t[i[s]])}}return n};/** @license React v16.14.0
 * react.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Fm=UU,Aa=typeof Symbol=="function"&&Symbol.for,uf=Aa?Symbol.for("react.element"):60103,GU=Aa?Symbol.for("react.portal"):60106,zU=Aa?Symbol.for("react.fragment"):60107,$U=Aa?Symbol.for("react.strict_mode"):60108,VU=Aa?Symbol.for("react.profiler"):60114,jU=Aa?Symbol.for("react.provider"):60109,WU=Aa?Symbol.for("react.context"):60110,XU=Aa?Symbol.for("react.forward_ref"):60112,YU=Aa?Symbol.for("react.suspense"):60113,HU=Aa?Symbol.for("react.memo"):60115,qU=Aa?Symbol.for("react.lazy"):60116,BS=typeof Symbol=="function"&&Symbol.iterator;function lf(r){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+r,t=1;t<arguments.length;t++)e+="&args[]="+encodeURIComponent(arguments[t]);return"Minified React error #"+r+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var FS={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},US={};function Dl(r,e,t){this.props=r,this.context=e,this.refs=US,this.updater=t||FS}Dl.prototype.isReactComponent={};Dl.prototype.setState=function(r,e){if(typeof r!="object"&&typeof r!="function"&&r!=null)throw Error(lf(85));this.updater.enqueueSetState(this,r,e,"setState")};Dl.prototype.forceUpdate=function(r){this.updater.enqueueForceUpdate(this,r,"forceUpdate")};function GS(){}GS.prototype=Dl.prototype;function Um(r,e,t){this.props=r,this.context=e,this.refs=US,this.updater=t||FS}var Gm=Um.prototype=new GS;Gm.constructor=Um;Fm(Gm,Dl.prototype);Gm.isPureReactComponent=!0;var zm={current:null},zS=Object.prototype.hasOwnProperty,$S={key:!0,ref:!0,__self:!0,__source:!0};function VS(r,e,t){var n,i={},a=null,o=null;if(e!=null)for(n in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(a=""+e.key),e)zS.call(e,n)&&!$S.hasOwnProperty(n)&&(i[n]=e[n]);var s=arguments.length-2;if(s===1)i.children=t;else if(1<s){for(var u=Array(s),l=0;l<s;l++)u[l]=arguments[l+2];i.children=u}if(r&&r.defaultProps)for(n in s=r.defaultProps,s)i[n]===void 0&&(i[n]=s[n]);return{$$typeof:uf,type:r,key:a,ref:o,props:i,_owner:zm.current}}function KU(r,e){return{$$typeof:uf,type:r.type,key:e,ref:r.ref,props:r.props,_owner:r._owner}}function $m(r){return typeof r=="object"&&r!==null&&r.$$typeof===uf}function ZU(r){var e={"=":"=0",":":"=2"};return"$"+(""+r).replace(/[=:]/g,function(t){return e[t]})}var jS=/\/+/g,ov=[];function WS(r,e,t,n){if(ov.length){var i=ov.pop();return i.result=r,i.keyPrefix=e,i.func=t,i.context=n,i.count=0,i}return{result:r,keyPrefix:e,func:t,context:n,count:0}}function XS(r){r.result=null,r.keyPrefix=null,r.func=null,r.context=null,r.count=0,10>ov.length&&ov.push(r)}function Vm(r,e,t,n){var i=typeof r;(i==="undefined"||i==="boolean")&&(r=null);var a=!1;if(r===null)a=!0;else switch(i){case"string":case"number":a=!0;break;case"object":switch(r.$$typeof){case uf:case GU:a=!0}}if(a)return t(n,r,e===""?"."+Wm(r,0):e),1;if(a=0,e=e===""?".":e+":",Array.isArray(r))for(var o=0;o<r.length;o++){i=r[o];var s=e+Wm(i,o);a+=Vm(i,s,t,n)}else if(r===null||typeof r!="object"?s=null:(s=BS&&r[BS]||r["@@iterator"],s=typeof s=="function"?s:null),typeof s=="function")for(r=s.call(r),o=0;!(i=r.next()).done;)i=i.value,s=e+Wm(i,o++),a+=Vm(i,s,t,n);else if(i==="object")throw t=""+r,Error(lf(31,t==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":t,""));return a}function jm(r,e,t){return r==null?0:Vm(r,"",e,t)}function Wm(r,e){return typeof r=="object"&&r!==null&&r.key!=null?ZU(r.key):e.toString(36)}function QU(r,e){r.func.call(r.context,e,r.count++)}function JU(r,e,t){var n=r.result,i=r.keyPrefix;r=r.func.call(r.context,e,r.count++),Array.isArray(r)?Xm(r,n,t,function(a){return a}):r!=null&&($m(r)&&(r=KU(r,i+(!r.key||e&&e.key===r.key?"":(""+r.key).replace(jS,"$&/")+"/")+t)),n.push(r))}function Xm(r,e,t,n,i){var a="";t!=null&&(a=(""+t).replace(jS,"$&/")+"/"),e=WS(e,a,n,i),jm(r,JU,e),XS(e)}var YS={current:null};function Do(){var r=YS.current;if(r===null)throw Error(lf(321));return r}var eG={ReactCurrentDispatcher:YS,ReactCurrentBatchConfig:{suspense:null},ReactCurrentOwner:zm,IsSomeRendererActing:{current:!1},assign:Fm};Kr.Children={map:function(r,e,t){if(r==null)return r;var n=[];return Xm(r,n,null,e,t),n},forEach:function(r,e,t){if(r==null)return r;e=WS(null,null,e,t),jm(r,QU,e),XS(e)},count:function(r){return jm(r,function(){return null},null)},toArray:function(r){var e=[];return Xm(r,e,null,function(t){return t}),e},only:function(r){if(!$m(r))throw Error(lf(143));return r}};Kr.Component=Dl;Kr.Fragment=zU;Kr.Profiler=VU;Kr.PureComponent=Um;Kr.StrictMode=$U;Kr.Suspense=YU;Kr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=eG;Kr.cloneElement=function(r,e,t){if(r==null)throw Error(lf(267,r));var n=Fm({},r.props),i=r.key,a=r.ref,o=r._owner;if(e!=null){if(e.ref!==void 0&&(a=e.ref,o=zm.current),e.key!==void 0&&(i=""+e.key),r.type&&r.type.defaultProps)var s=r.type.defaultProps;for(u in e)zS.call(e,u)&&!$S.hasOwnProperty(u)&&(n[u]=e[u]===void 0&&s!==void 0?s[u]:e[u])}var u=arguments.length-2;if(u===1)n.children=t;else if(1<u){s=Array(u);for(var l=0;l<u;l++)s[l]=arguments[l+2];n.children=s}return{$$typeof:uf,type:r.type,key:i,ref:a,props:n,_owner:o}};Kr.createContext=function(r,e){return e===void 0&&(e=null),r={$$typeof:WU,_calculateChangedBits:e,_currentValue:r,_currentValue2:r,_threadCount:0,Provider:null,Consumer:null},r.Provider={$$typeof:jU,_context:r},r.Consumer=r};Kr.createElement=VS;Kr.createFactory=function(r){var e=VS.bind(null,r);return e.type=r,e};Kr.createRef=function(){return{current:null}};Kr.forwardRef=function(r){return{$$typeof:XU,render:r}};Kr.isValidElement=$m;Kr.lazy=function(r){return{$$typeof:qU,_ctor:r,_status:-1,_result:null}};Kr.memo=function(r,e){return{$$typeof:HU,type:r,compare:e===void 0?null:e}};Kr.useCallback=function(r,e){return Do().useCallback(r,e)};Kr.useContext=function(r,e){return Do().useContext(r,e)};Kr.useDebugValue=function(){};Kr.useEffect=function(r,e){return Do().useEffect(r,e)};Kr.useImperativeHandle=function(r,e,t){return Do().useImperativeHandle(r,e,t)};Kr.useLayoutEffect=function(r,e){return Do().useLayoutEffect(r,e)};Kr.useMemo=function(r,e){return Do().useMemo(r,e)};Kr.useReducer=function(r,e,t){return Do().useReducer(r,e,t)};Kr.useRef=function(r){return Do().useRef(r)};Kr.useState=function(r){return Do().useState(r)};Kr.version="16.14.0";PS.exports=Kr;var tG=PS.exports;const HS=new WeakMap,Ym=new WeakMap;function an(r){const e=HS.get(r);return console.assert(e!=null,"'this' is expected an Event object, but got",r),e}function qS(r){if(r.passiveListener!=null){typeof console!="undefined"&&typeof console.error=="function"&&console.error("Unable to preventDefault inside passive event listener invocation.",r.passiveListener);return}!r.event.cancelable||(r.canceled=!0,typeof r.event.preventDefault=="function"&&r.event.preventDefault())}function Ll(r,e){HS.set(this,{eventTarget:r,event:e,eventPhase:2,currentTarget:r,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:e.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});const t=Object.keys(e);for(let n=0;n<t.length;++n){const i=t[n];i in this||Object.defineProperty(this,i,KS(i))}}Ll.prototype={get type(){return an(this).event.type},get target(){return an(this).eventTarget},get currentTarget(){return an(this).currentTarget},composedPath(){const r=an(this).currentTarget;return r==null?[]:[r]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return an(this).eventPhase},stopPropagation(){const r=an(this);r.stopped=!0,typeof r.event.stopPropagation=="function"&&r.event.stopPropagation()},stopImmediatePropagation(){const r=an(this);r.stopped=!0,r.immediateStopped=!0,typeof r.event.stopImmediatePropagation=="function"&&r.event.stopImmediatePropagation()},get bubbles(){return Boolean(an(this).event.bubbles)},get cancelable(){return Boolean(an(this).event.cancelable)},preventDefault(){qS(an(this))},get defaultPrevented(){return an(this).canceled},get composed(){return Boolean(an(this).event.composed)},get timeStamp(){return an(this).timeStamp},get srcElement(){return an(this).eventTarget},get cancelBubble(){return an(this).stopped},set cancelBubble(r){if(!r)return;const e=an(this);e.stopped=!0,typeof e.event.cancelBubble=="boolean"&&(e.event.cancelBubble=!0)},get returnValue(){return!an(this).canceled},set returnValue(r){r||qS(an(this))},initEvent(){}};Object.defineProperty(Ll.prototype,"constructor",{value:Ll,configurable:!0,writable:!0});typeof window!="undefined"&&typeof window.Event!="undefined"&&(Object.setPrototypeOf(Ll.prototype,window.Event.prototype),Ym.set(window.Event.prototype,Ll));function KS(r){return{get(){return an(this).event[r]},set(e){an(this).event[r]=e},configurable:!0,enumerable:!0}}function rG(r){return{value(){const e=an(this).event;return e[r].apply(e,arguments)},configurable:!0,enumerable:!0}}function nG(r,e){const t=Object.keys(e);if(t.length===0)return r;function n(i,a){r.call(this,i,a)}n.prototype=Object.create(r.prototype,{constructor:{value:n,configurable:!0,writable:!0}});for(let i=0;i<t.length;++i){const a=t[i];if(!(a in r.prototype)){const s=typeof Object.getOwnPropertyDescriptor(e,a).value=="function";Object.defineProperty(n.prototype,a,s?rG(a):KS(a))}}return n}function ZS(r){if(r==null||r===Object.prototype)return Ll;let e=Ym.get(r);return e==null&&(e=nG(ZS(Object.getPrototypeOf(r)),r),Ym.set(r,e)),e}function iG(r,e){const t=ZS(Object.getPrototypeOf(e));return new t(r,e)}function aG(r){return an(r).immediateStopped}function oG(r,e){an(r).eventPhase=e}function sG(r,e){an(r).currentTarget=e}function QS(r,e){an(r).passiveListener=e}const JS=new WeakMap,eE=1,tE=2,sv=3;function uv(r){return r!==null&&typeof r=="object"}function cf(r){const e=JS.get(r);if(e==null)throw new TypeError("'this' is expected an EventTarget object, but got another value.");return e}function uG(r){return{get(){let t=cf(this).get(r);for(;t!=null;){if(t.listenerType===sv)return t.listener;t=t.next}return null},set(e){typeof e!="function"&&!uv(e)&&(e=null);const t=cf(this);let n=null,i=t.get(r);for(;i!=null;)i.listenerType===sv?n!==null?n.next=i.next:i.next!==null?t.set(r,i.next):t.delete(r):n=i,i=i.next;if(e!==null){const a={listener:e,listenerType:sv,passive:!1,once:!1,next:null};n===null?t.set(r,a):n.next=a}},configurable:!0,enumerable:!0}}function lG(r,e){Object.defineProperty(r,`on${e}`,uG(e))}function rE(r){function e(){vs.call(this)}e.prototype=Object.create(vs.prototype,{constructor:{value:e,configurable:!0,writable:!0}});for(let t=0;t<r.length;++t)lG(e.prototype,r[t]);return e}function vs(){if(this instanceof vs){JS.set(this,new Map);return}if(arguments.length===1&&Array.isArray(arguments[0]))return rE(arguments[0]);if(arguments.length>0){const r=new Array(arguments.length);for(let e=0;e<arguments.length;++e)r[e]=arguments[e];return rE(r)}throw new TypeError("Cannot call a class as a function")}vs.prototype={addEventListener(r,e,t){if(e==null)return;if(typeof e!="function"&&!uv(e))throw new TypeError("'listener' should be a function or an object.");const n=cf(this),i=uv(t),o=Boolean(i?t.capture:t)?eE:tE,s={listener:e,listenerType:o,passive:i&&Boolean(t.passive),once:i&&Boolean(t.once),next:null};let u=n.get(r);if(u===void 0){n.set(r,s);return}let l=null;for(;u!=null;){if(u.listener===e&&u.listenerType===o)return;l=u,u=u.next}l.next=s},removeEventListener(r,e,t){if(e==null)return;const n=cf(this),a=(uv(t)?Boolean(t.capture):Boolean(t))?eE:tE;let o=null,s=n.get(r);for(;s!=null;){if(s.listener===e&&s.listenerType===a){o!==null?o.next=s.next:s.next!==null?n.set(r,s.next):n.delete(r);return}o=s,s=s.next}},dispatchEvent(r){if(r==null||typeof r.type!="string")throw new TypeError('"event.type" should be a string.');const e=cf(this),t=r.type;let n=e.get(t);if(n==null)return!0;const i=iG(this,r);let a=null;for(;n!=null;){if(n.once?a!==null?a.next=n.next:n.next!==null?e.set(t,n.next):e.delete(t):a=n,QS(i,n.passive?n.listener:null),typeof n.listener=="function")try{n.listener.call(this,i)}catch(o){typeof console!="undefined"&&typeof console.error=="function"&&console.error(o)}else n.listenerType!==sv&&typeof n.listener.handleEvent=="function"&&n.listener.handleEvent(i);if(aG(i))break;n=n.next}return QS(i,null),oG(i,0),sG(i,null),!i.defaultPrevented}};Object.defineProperty(vs.prototype,"constructor",{value:vs,configurable:!0,writable:!0});typeof window!="undefined"&&typeof window.EventTarget!="undefined"&&Object.setPrototypeOf(vs.prototype,window.EventTarget.prototype);var Ee={};Ee.SIZEOF_SHORT=2;Ee.SIZEOF_INT=4;Ee.FILE_IDENTIFIER_LENGTH=4;Ee.Encoding={UTF8_BYTES:1,UTF16_STRING:2};Ee.int32=new Int32Array(2);Ee.float32=new Float32Array(Ee.int32.buffer);Ee.float64=new Float64Array(Ee.int32.buffer);Ee.isLittleEndian=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;Ee.Long=function(r,e){this.low=r|0,this.high=e|0};Ee.Long.create=function(r,e){return r==0&&e==0?Ee.Long.ZERO:new Ee.Long(r,e)};Ee.Long.prototype.toFloat64=function(){return(this.low>>>0)+this.high*4294967296};Ee.Long.prototype.equals=function(r){return this.low==r.low&&this.high==r.high};Ee.Long.ZERO=new Ee.Long(0,0);Ee.Builder=function(r){if(r)var e=r;else var e=1024;this.bb=Ee.ByteBuffer.allocate(e),this.space=e,this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1};Ee.Builder.prototype.clear=function(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1};Ee.Builder.prototype.forceDefaults=function(r){this.force_defaults=r};Ee.Builder.prototype.dataBuffer=function(){return this.bb};Ee.Builder.prototype.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())};Ee.Builder.prototype.prep=function(r,e){r>this.minalign&&(this.minalign=r);for(var t=~(this.bb.capacity()-this.space+e)+1&r-1;this.space<t+r+e;){var n=this.bb.capacity();this.bb=Ee.Builder.growByteBuffer(this.bb),this.space+=this.bb.capacity()-n}this.pad(t)};Ee.Builder.prototype.pad=function(r){for(var e=0;e<r;e++)this.bb.writeInt8(--this.space,0)};Ee.Builder.prototype.writeInt8=function(r){this.bb.writeInt8(this.space-=1,r)};Ee.Builder.prototype.writeInt16=function(r){this.bb.writeInt16(this.space-=2,r)};Ee.Builder.prototype.writeInt32=function(r){this.bb.writeInt32(this.space-=4,r)};Ee.Builder.prototype.writeInt64=function(r){this.bb.writeInt64(this.space-=8,r)};Ee.Builder.prototype.writeFloat32=function(r){this.bb.writeFloat32(this.space-=4,r)};Ee.Builder.prototype.writeFloat64=function(r){this.bb.writeFloat64(this.space-=8,r)};Ee.Builder.prototype.addInt8=function(r){this.prep(1,0),this.writeInt8(r)};Ee.Builder.prototype.addInt16=function(r){this.prep(2,0),this.writeInt16(r)};Ee.Builder.prototype.addInt32=function(r){this.prep(4,0),this.writeInt32(r)};Ee.Builder.prototype.addInt64=function(r){this.prep(8,0),this.writeInt64(r)};Ee.Builder.prototype.addFloat32=function(r){this.prep(4,0),this.writeFloat32(r)};Ee.Builder.prototype.addFloat64=function(r){this.prep(8,0),this.writeFloat64(r)};Ee.Builder.prototype.addFieldInt8=function(r,e,t){(this.force_defaults||e!=t)&&(this.addInt8(e),this.slot(r))};Ee.Builder.prototype.addFieldInt16=function(r,e,t){(this.force_defaults||e!=t)&&(this.addInt16(e),this.slot(r))};Ee.Builder.prototype.addFieldInt32=function(r,e,t){(this.force_defaults||e!=t)&&(this.addInt32(e),this.slot(r))};Ee.Builder.prototype.addFieldInt64=function(r,e,t){(this.force_defaults||!e.equals(t))&&(this.addInt64(e),this.slot(r))};Ee.Builder.prototype.addFieldFloat32=function(r,e,t){(this.force_defaults||e!=t)&&(this.addFloat32(e),this.slot(r))};Ee.Builder.prototype.addFieldFloat64=function(r,e,t){(this.force_defaults||e!=t)&&(this.addFloat64(e),this.slot(r))};Ee.Builder.prototype.addFieldOffset=function(r,e,t){(this.force_defaults||e!=t)&&(this.addOffset(e),this.slot(r))};Ee.Builder.prototype.addFieldStruct=function(r,e,t){e!=t&&(this.nested(e),this.slot(r))};Ee.Builder.prototype.nested=function(r){if(r!=this.offset())throw new Error("FlatBuffers: struct must be serialized inline.")};Ee.Builder.prototype.notNested=function(){if(this.isNested)throw new Error("FlatBuffers: object serialization must not be nested.")};Ee.Builder.prototype.slot=function(r){this.vtable[r]=this.offset()};Ee.Builder.prototype.offset=function(){return this.bb.capacity()-this.space};Ee.Builder.growByteBuffer=function(r){var e=r.capacity();if(e&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");var t=e<<1,n=Ee.ByteBuffer.allocate(t);return n.setPosition(t-e),n.bytes().set(r.bytes(),t-e),n};Ee.Builder.prototype.addOffset=function(r){this.prep(Ee.SIZEOF_INT,0),this.writeInt32(this.offset()-r+Ee.SIZEOF_INT)};Ee.Builder.prototype.startObject=function(r){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=r;for(var e=0;e<r;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()};Ee.Builder.prototype.endObject=function(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);for(var r=this.offset(),e=this.vtable_in_use-1;e>=0&&this.vtable[e]==0;e--);for(var t=e+1;e>=0;e--)this.addInt16(this.vtable[e]!=0?r-this.vtable[e]:0);var n=2;this.addInt16(r-this.object_start);var i=(t+n)*Ee.SIZEOF_SHORT;this.addInt16(i);var a=0,o=this.space;e:for(e=0;e<this.vtables.length;e++){var s=this.bb.capacity()-this.vtables[e];if(i==this.bb.readInt16(s)){for(var u=Ee.SIZEOF_SHORT;u<i;u+=Ee.SIZEOF_SHORT)if(this.bb.readInt16(o+u)!=this.bb.readInt16(s+u))continue e;a=this.vtables[e];break}}return a?(this.space=this.bb.capacity()-r,this.bb.writeInt32(this.space,a-r)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-r,this.offset()-r)),this.isNested=!1,r};Ee.Builder.prototype.finish=function(r,e){if(e){var t=e;if(this.prep(this.minalign,Ee.SIZEOF_INT+Ee.FILE_IDENTIFIER_LENGTH),t.length!=Ee.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+Ee.FILE_IDENTIFIER_LENGTH);for(var n=Ee.FILE_IDENTIFIER_LENGTH-1;n>=0;n--)this.writeInt8(t.charCodeAt(n))}this.prep(this.minalign,Ee.SIZEOF_INT),this.addOffset(r),this.bb.setPosition(this.space)};Ee.Builder.prototype.requiredField=function(r,e){var t=this.bb.capacity()-r,n=t-this.bb.readInt32(t),i=this.bb.readInt16(n+e)!=0;if(!i)throw new Error("FlatBuffers: field "+e+" must be set")};Ee.Builder.prototype.startVector=function(r,e,t){this.notNested(),this.vector_num_elems=e,this.prep(Ee.SIZEOF_INT,r*e),this.prep(t,r*e)};Ee.Builder.prototype.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()};Ee.Builder.prototype.createString=function(r){if(r instanceof Uint8Array)var e=r;else for(var e=[],t=0;t<r.length;){var n,i=r.charCodeAt(t++);if(i<55296||i>=56320)n=i;else{var a=r.charCodeAt(t++);n=(i<<10)+a+(65536-(55296<<10)-56320)}n<128?e.push(n):(n<2048?e.push(n>>6&31|192):(n<65536?e.push(n>>12&15|224):e.push(n>>18&7|240,n>>12&63|128),e.push(n>>6&63|128)),e.push(n&63|128))}this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length);for(var t=0,o=this.space,s=this.bb.bytes();t<e.length;t++)s[o++]=e[t];return this.endVector()};Ee.Builder.prototype.createLong=function(r,e){return Ee.Long.create(r,e)};Ee.ByteBuffer=function(r){this.bytes_=r,this.position_=0};Ee.ByteBuffer.allocate=function(r){return new Ee.ByteBuffer(new Uint8Array(r))};Ee.ByteBuffer.prototype.clear=function(){this.position_=0};Ee.ByteBuffer.prototype.bytes=function(){return this.bytes_};Ee.ByteBuffer.prototype.position=function(){return this.position_};Ee.ByteBuffer.prototype.setPosition=function(r){this.position_=r};Ee.ByteBuffer.prototype.capacity=function(){return this.bytes_.length};Ee.ByteBuffer.prototype.readInt8=function(r){return this.readUint8(r)<<24>>24};Ee.ByteBuffer.prototype.readUint8=function(r){return this.bytes_[r]};Ee.ByteBuffer.prototype.readInt16=function(r){return this.readUint16(r)<<16>>16};Ee.ByteBuffer.prototype.readUint16=function(r){return this.bytes_[r]|this.bytes_[r+1]<<8};Ee.ByteBuffer.prototype.readInt32=function(r){return this.bytes_[r]|this.bytes_[r+1]<<8|this.bytes_[r+2]<<16|this.bytes_[r+3]<<24};Ee.ByteBuffer.prototype.readUint32=function(r){return this.readInt32(r)>>>0};Ee.ByteBuffer.prototype.readInt64=function(r){return new Ee.Long(this.readInt32(r),this.readInt32(r+4))};Ee.ByteBuffer.prototype.readUint64=function(r){return new Ee.Long(this.readUint32(r),this.readUint32(r+4))};Ee.ByteBuffer.prototype.readFloat32=function(r){return Ee.int32[0]=this.readInt32(r),Ee.float32[0]};Ee.ByteBuffer.prototype.readFloat64=function(r){return Ee.int32[Ee.isLittleEndian?0:1]=this.readInt32(r),Ee.int32[Ee.isLittleEndian?1:0]=this.readInt32(r+4),Ee.float64[0]};Ee.ByteBuffer.prototype.writeInt8=function(r,e){this.bytes_[r]=e};Ee.ByteBuffer.prototype.writeUint8=function(r,e){this.bytes_[r]=e};Ee.ByteBuffer.prototype.writeInt16=function(r,e){this.bytes_[r]=e,this.bytes_[r+1]=e>>8};Ee.ByteBuffer.prototype.writeUint16=function(r,e){this.bytes_[r]=e,this.bytes_[r+1]=e>>8};Ee.ByteBuffer.prototype.writeInt32=function(r,e){this.bytes_[r]=e,this.bytes_[r+1]=e>>8,this.bytes_[r+2]=e>>16,this.bytes_[r+3]=e>>24};Ee.ByteBuffer.prototype.writeUint32=function(r,e){this.bytes_[r]=e,this.bytes_[r+1]=e>>8,this.bytes_[r+2]=e>>16,this.bytes_[r+3]=e>>24};Ee.ByteBuffer.prototype.writeInt64=function(r,e){this.writeInt32(r,e.low),this.writeInt32(r+4,e.high)};Ee.ByteBuffer.prototype.writeUint64=function(r,e){this.writeUint32(r,e.low),this.writeUint32(r+4,e.high)};Ee.ByteBuffer.prototype.writeFloat32=function(r,e){Ee.float32[0]=e,this.writeInt32(r,Ee.int32[0])};Ee.ByteBuffer.prototype.writeFloat64=function(r,e){Ee.float64[0]=e,this.writeInt32(r,Ee.int32[Ee.isLittleEndian?0:1]),this.writeInt32(r+4,Ee.int32[Ee.isLittleEndian?1:0])};Ee.ByteBuffer.prototype.getBufferIdentifier=function(){if(this.bytes_.length<this.position_+Ee.SIZEOF_INT+Ee.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");for(var r="",e=0;e<Ee.FILE_IDENTIFIER_LENGTH;e++)r+=String.fromCharCode(this.readInt8(this.position_+Ee.SIZEOF_INT+e));return r};Ee.ByteBuffer.prototype.__offset=function(r,e){var t=r-this.readInt32(r);return e<this.readInt16(t)?this.readInt16(t+e):0};Ee.ByteBuffer.prototype.__union=function(r,e){return r.bb_pos=e+this.readInt32(e),r.bb=this,r};Ee.ByteBuffer.prototype.__string=function(r,e){r+=this.readInt32(r);var t=this.readInt32(r),n="",i=0;if(r+=Ee.SIZEOF_INT,e===Ee.Encoding.UTF8_BYTES)return this.bytes_.subarray(r,r+t);for(;i<t;){var a,o=this.readUint8(r+i++);if(o<192)a=o;else{var s=this.readUint8(r+i++);if(o<224)a=(o&31)<<6|s&63;else{var u=this.readUint8(r+i++);if(o<240)a=(o&15)<<12|(s&63)<<6|u&63;else{var l=this.readUint8(r+i++);a=(o&7)<<18|(s&63)<<12|(u&63)<<6|l&63}}}a<65536?n+=String.fromCharCode(a):(a-=65536,n+=String.fromCharCode((a>>10)+55296,(a&(1<<10)-1)+56320))}return n};Ee.ByteBuffer.prototype.__indirect=function(r){return r+this.readInt32(r)};Ee.ByteBuffer.prototype.__vector=function(r){return r+this.readInt32(r)+Ee.SIZEOF_INT};Ee.ByteBuffer.prototype.__vector_len=function(r){return this.readInt32(r+this.readInt32(r))};Ee.ByteBuffer.prototype.__has_identifier=function(r){if(r.length!=Ee.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+Ee.FILE_IDENTIFIER_LENGTH);for(var e=0;e<Ee.FILE_IDENTIFIER_LENGTH;e++)if(r.charCodeAt(e)!=this.readInt8(this.position_+Ee.SIZEOF_INT+e))return!1;return!0};Ee.ByteBuffer.prototype.createLong=function(r,e){return Ee.Long.create(r,e)};function Lo(r,e,t){return e<=r&&r<=t}function lv(r){if(r===void 0)return{};if(r===Object(r))return r;throw TypeError("Could not convert argument to dictionary")}function cG(r){for(var e=String(r),t=e.length,n=0,i=[];n<t;){var a=e.charCodeAt(n);if(a<55296||a>57343)i.push(a);else if(56320<=a&&a<=57343)i.push(65533);else if(55296<=a&&a<=56319)if(n===t-1)i.push(65533);else{var o=r.charCodeAt(n+1);if(56320<=o&&o<=57343){var s=a&1023,u=o&1023;i.push(65536+(s<<10)+u),n+=1}else i.push(65533)}n+=1}return i}function fG(r){for(var e="",t=0;t<r.length;++t){var n=r[t];n<=65535?e+=String.fromCharCode(n):(n-=65536,e+=String.fromCharCode((n>>10)+55296,(n&1023)+56320))}return e}var cv=-1;function Hm(r){this.tokens=[].slice.call(r)}Hm.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():cv},prepend:function(r){if(Array.isArray(r))for(var e=r;e.length;)this.tokens.unshift(e.pop());else this.tokens.unshift(r)},push:function(r){if(Array.isArray(r))for(var e=r;e.length;)this.tokens.push(e.shift());else this.tokens.push(r)}};var Nl=-1;function qm(r,e){if(r)throw TypeError("Decoder error");return e||65533}var fv="utf-8";function hv(r,e){if(!(this instanceof hv))return new hv(r,e);if(r=r!==void 0?String(r).toLowerCase():fv,r!==fv)throw new Error("Encoding not supported. Only utf-8 is supported");e=lv(e),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=Boolean(e.fatal),this._ignoreBOM=Boolean(e.ignoreBOM),Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}hv.prototype={decode:function(e,t){var n;typeof e=="object"&&e instanceof ArrayBuffer?n=new Uint8Array(e):typeof e=="object"&&"buffer"in e&&e.buffer instanceof ArrayBuffer?n=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):n=new Uint8Array(0),t=lv(t),this._streaming||(this._decoder=new hG({fatal:this._fatal}),this._BOMseen=!1),this._streaming=Boolean(t.stream);for(var i=new Hm(n),a=[],o;!i.endOfStream()&&(o=this._decoder.handler(i,i.read()),o!==Nl);)o!==null&&(Array.isArray(o)?a.push.apply(a,o):a.push(o));if(!this._streaming){do{if(o=this._decoder.handler(i,i.read()),o===Nl)break;o!==null&&(Array.isArray(o)?a.push.apply(a,o):a.push(o))}while(!i.endOfStream());this._decoder=null}return a.length&&["utf-8"].indexOf(this.encoding)!==-1&&!this._ignoreBOM&&!this._BOMseen&&(a[0]===65279?(this._BOMseen=!0,a.shift()):this._BOMseen=!0),fG(a)}};function dv(r,e){if(!(this instanceof dv))return new dv(r,e);if(r=r!==void 0?String(r).toLowerCase():fv,r!==fv)throw new Error("Encoding not supported. Only utf-8 is supported");e=lv(e),this._streaming=!1,this._encoder=null,this._options={fatal:Boolean(e.fatal)},Object.defineProperty(this,"encoding",{value:"utf-8"})}dv.prototype={encode:function(e,t){e=e?String(e):"",t=lv(t),this._streaming||(this._encoder=new dG(this._options)),this._streaming=Boolean(t.stream);for(var n=[],i=new Hm(cG(e)),a;!i.endOfStream()&&(a=this._encoder.handler(i,i.read()),a!==Nl);)Array.isArray(a)?n.push.apply(n,a):n.push(a);if(!this._streaming){for(;a=this._encoder.handler(i,i.read()),a!==Nl;)Array.isArray(a)?n.push.apply(n,a):n.push(a);this._encoder=null}return new Uint8Array(n)}};function hG(r){var e=r.fatal,t=0,n=0,i=0,a=128,o=191;this.handler=function(s,u){if(u===cv&&i!==0)return i=0,qm(e);if(u===cv)return Nl;if(i===0){if(Lo(u,0,127))return u;if(Lo(u,194,223))i=1,t=u-192;else if(Lo(u,224,239))u===224&&(a=160),u===237&&(o=159),i=2,t=u-224;else if(Lo(u,240,244))u===240&&(a=144),u===244&&(o=143),i=3,t=u-240;else return qm(e);return t=t<<6*i,null}if(!Lo(u,a,o))return t=i=n=0,a=128,o=191,s.prepend(u),qm(e);if(a=128,o=191,n+=1,t+=u-128<<6*(i-n),n!==i)return null;var l=t;return t=i=n=0,l}}function dG(r){r.fatal,this.handler=function(e,t){if(t===cv)return Nl;if(Lo(t,0,127))return t;var n,i;Lo(t,128,2047)?(n=1,i=192):Lo(t,2048,65535)?(n=2,i=224):Lo(t,65536,1114111)&&(n=3,i=240);for(var a=[(t>>6*n)+i];n>0;){var o=t>>6*(n-1);a.push(128|o&63),n-=1}return a}}const vv=typeof Buffer=="function"?Buffer:null,nE=typeof TextDecoder=="function"&&typeof TextEncoder=="function",Km=(r=>{if(nE||!vv){const e=new r("utf-8");return t=>e.decode(t)}return e=>{const{buffer:t,byteOffset:n,length:i}=Dr(e);return vv.from(t,n,i).toString()}})(typeof TextDecoder!="undefined"?TextDecoder:hv),pv=(r=>{if(nE||!vv){const e=new r;return t=>e.encode(t)}return(e="")=>Dr(vv.from(e,"utf8"))})(typeof TextEncoder!="undefined"?TextEncoder:dv),mn=Object.freeze({done:!0,value:void 0});class iE{constructor(e){this._json=e}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}}class wu{tee(){return this._getDOMStream().tee()}pipe(e,t){return this._getNodeStream().pipe(e,t)}pipeTo(e,t){return this._getDOMStream().pipeTo(e,t)}pipeThrough(e,t){return this._getDOMStream().pipeThrough(e,t)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}}class vG extends wu{constructor(){super();this._values=[],this.resolvers=[],this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}get closed(){return this._closedPromise}async cancel(e){await this.return(e)}write(e){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(e):this.resolvers.shift().resolve({done:!1,value:e}))}abort(e){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:e}:this.resolvers.shift().reject({done:!0,value:e}))}close(){if(this._closedPromiseResolve){const{resolvers:e}=this;for(;e.length>0;)e.shift().resolve(mn);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(e){return Yi.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,e)}toNodeStream(e){return Yi.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,e)}async throw(e){return await this.abort(e),mn}async return(e){return await this.close(),mn}async read(e){return(await this.next(e,"read")).value}async peek(e){return(await this.next(e,"peek")).value}next(...e){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((t,n)=>{this.resolvers.push({resolve:t,reject:n})}):Promise.resolve(mn)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error(`${this} is closed`)}}const[pG,gv]=(()=>{const r=()=>{throw new Error("BigInt is not available in this environment")};function e(){throw r()}return e.asIntN=()=>{throw r()},e.asUintN=()=>{throw r()},typeof BigInt!="undefined"?[BigInt,!0]:[e,!1]})(),[Ol,Yve]=(()=>{const r=()=>{throw new Error("BigInt64Array is not available in this environment")};class e{static get BYTES_PER_ELEMENT(){return 8}static of(){throw r()}static from(){throw r()}constructor(){throw r()}}return typeof BigInt64Array!="undefined"?[BigInt64Array,!0]:[e,!1]})(),[ff,Hve]=(()=>{const r=()=>{throw new Error("BigUint64Array is not available in this environment")};class e{static get BYTES_PER_ELEMENT(){return 8}static of(){throw r()}static from(){throw r()}constructor(){throw r()}}return typeof BigUint64Array!="undefined"?[BigUint64Array,!0]:[e,!1]})(),gG=r=>typeof r=="number",aE=r=>typeof r=="boolean",ua=r=>typeof r=="function",Xi=r=>r!=null&&Object(r)===r,ps=r=>Xi(r)&&ua(r.then),Ta=r=>Xi(r)&&ua(r[Symbol.iterator]),No=r=>Xi(r)&&ua(r[Symbol.asyncIterator]),Zm=r=>Xi(r)&&Xi(r.schema),oE=r=>Xi(r)&&"done"in r&&"value"in r,sE=r=>Xi(r)&&ua(r.stat)&&gG(r.fd),uE=r=>Xi(r)&&Qm(r.body),yG=r=>Xi(r)&&ua(r.abort)&&ua(r.getWriter)&&!(r instanceof wu),Qm=r=>Xi(r)&&ua(r.cancel)&&ua(r.getReader)&&!(r instanceof wu),mG=r=>Xi(r)&&ua(r.end)&&ua(r.write)&&aE(r.writable)&&!(r instanceof wu),lE=r=>Xi(r)&&ua(r.read)&&ua(r.pipe)&&aE(r.readable)&&!(r instanceof wu);var bG=Ee.ByteBuffer;const Jm=typeof SharedArrayBuffer!="undefined"?SharedArrayBuffer:ArrayBuffer;function wG(r){let e=r[0]?[r[0]]:[],t,n,i,a;for(let o,s,u=0,l=0,c=r.length;++u<c;){if(o=e[l],s=r[u],!o||!s||o.buffer!==s.buffer||s.byteOffset<o.byteOffset){s&&(e[++l]=s);continue}if({byteOffset:t,byteLength:i}=o,{byteOffset:n,byteLength:a}=s,t+i<n||n+a<t){s&&(e[++l]=s);continue}e[l]=new Uint8Array(o.buffer,t,n-t+a)}return e}function hf(r,e,t=0,n=e.byteLength){const i=r.byteLength,a=new Uint8Array(r.buffer,r.byteOffset,i),o=new Uint8Array(e.buffer,e.byteOffset,Math.min(n,i));return a.set(o,t),r}function Ia(r,e){let t=wG(r),n=t.reduce((c,f)=>c+f.byteLength,0),i,a,o,s=0,u=-1,l=Math.min(e||1/0,n);for(let c=t.length;++u<c;){if(i=t[u],a=i.subarray(0,Math.min(i.length,l-s)),l<=s+a.length){a.length<i.length?t[u]=i.subarray(a.length):a.length===i.length&&u++,o?hf(o,a,s):o=a;break}hf(o||(o=new Uint8Array(l)),a,s),s+=a.length}return[o||new Uint8Array(0),t.slice(u),n-(o?o.byteLength:0)]}function Tr(r,e){let t=oE(e)?e.value:e;return t instanceof r?r===Uint8Array?new r(t.buffer,t.byteOffset,t.byteLength):t:t?(typeof t=="string"&&(t=pv(t)),t instanceof ArrayBuffer?new r(t):t instanceof Jm?new r(t):t instanceof bG?Tr(r,t.bytes()):ArrayBuffer.isView(t)?t.byteLength<=0?new r(0):new r(t.buffer,t.byteOffset,t.byteLength/r.BYTES_PER_ELEMENT):r.from(t)):new r(0)}const xG=r=>Tr(Int8Array,r),_G=r=>Tr(Int16Array,r),Pl=r=>Tr(Int32Array,r),cE=r=>Tr(Ol,r),Dr=r=>Tr(Uint8Array,r),SG=r=>Tr(Uint16Array,r),EG=r=>Tr(Uint32Array,r),fE=r=>Tr(ff,r),AG=r=>Tr(Float32Array,r),TG=r=>Tr(Float64Array,r),IG=r=>Tr(Uint8ClampedArray,r),e0=r=>(r.next(),r);function*Ka(r,e){const t=function*(i){yield i},n=typeof e=="string"||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof Jm?t(e):Ta(e)?e:t(e);yield*e0(function*(i){let a=null;do a=i.next(yield Tr(r,a));while(!a.done)}(n[Symbol.iterator]()))}const CG=r=>Ka(Int8Array,r),MG=r=>Ka(Int16Array,r),kG=r=>Ka(Int32Array,r),hE=r=>Ka(Uint8Array,r),DG=r=>Ka(Uint16Array,r),LG=r=>Ka(Uint32Array,r),NG=r=>Ka(Float32Array,r),OG=r=>Ka(Float64Array,r),PG=r=>Ka(Uint8ClampedArray,r);async function*Ca(r,e){if(ps(e))return yield*Ca(r,await e);const t=async function*(a){yield await a},n=async function*(a){yield*e0(function*(o){let s=null;do s=o.next(yield s&&s.value);while(!s.done)}(a[Symbol.iterator]()))},i=typeof e=="string"||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof Jm?t(e):Ta(e)?n(e):No(e)?e:t(e);yield*e0(async function*(a){let o=null;do o=await a.next(yield Tr(r,o));while(!o.done)}(i[Symbol.asyncIterator]()))}const RG=r=>Ca(Int8Array,r),BG=r=>Ca(Int16Array,r),FG=r=>Ca(Int32Array,r),dE=r=>Ca(Uint8Array,r),UG=r=>Ca(Uint16Array,r),GG=r=>Ca(Uint32Array,r),zG=r=>Ca(Float32Array,r),$G=r=>Ca(Float64Array,r),VG=r=>Ca(Uint8ClampedArray,r);function yv(r,e,t){if(r!==0){t=t.slice(0,e+1);for(let n=-1;++n<=e;)t[n]+=r}return t}function vE(r,e){let t=0,n=r.length;if(n!==e.length)return!1;if(n>0)do if(r[t]!==e[t])return!1;while(++t<n);return!0}var jG=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",memcpy:hf,joinUint8Arrays:Ia,toArrayBufferView:Tr,toInt8Array:xG,toInt16Array:_G,toInt32Array:Pl,toBigInt64Array:cE,toUint8Array:Dr,toUint16Array:SG,toUint32Array:EG,toBigUint64Array:fE,toFloat32Array:AG,toFloat64Array:TG,toUint8ClampedArray:IG,toArrayBufferViewIterator:Ka,toInt8ArrayIterator:CG,toInt16ArrayIterator:MG,toInt32ArrayIterator:kG,toUint8ArrayIterator:hE,toUint16ArrayIterator:DG,toUint32ArrayIterator:LG,toFloat32ArrayIterator:NG,toFloat64ArrayIterator:OG,toUint8ClampedArrayIterator:PG,toArrayBufferViewAsyncIterator:Ca,toInt8ArrayAsyncIterator:RG,toInt16ArrayAsyncIterator:BG,toInt32ArrayAsyncIterator:FG,toUint8ArrayAsyncIterator:dE,toUint16ArrayAsyncIterator:UG,toUint32ArrayAsyncIterator:GG,toFloat32ArrayAsyncIterator:zG,toFloat64ArrayAsyncIterator:$G,toUint8ClampedArrayAsyncIterator:VG,rebaseValueOffsets:yv,compareArrayLike:vE}),Yi={fromIterable(r){return mv(WG(r))},fromAsyncIterable(r){return mv(XG(r))},fromDOMStream(r){return mv(YG(r))},fromNodeStream(r){return mv(qG(r))},toDOMStream(r,e){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(r,e){throw new Error('"toNodeStream" not available in this environment')}};const mv=r=>(r.next(),r);function*WG(r){let e,t=!1,n=[],i,a,o,s=0;function u(){return a==="peek"?Ia(n,o)[0]:([i,n,s]=Ia(n,o),i)}({cmd:a,size:o}=yield null);let l=hE(r)[Symbol.iterator]();try{do if({done:e,value:i}=isNaN(o-s)?l.next(void 0):l.next(o-s),!e&&i.byteLength>0&&(n.push(i),s+=i.byteLength),e||o<=s)do({cmd:a,size:o}=yield u());while(o<s);while(!e)}catch(c){(t=!0)&&typeof l.throw=="function"&&l.throw(c)}finally{t===!1&&typeof l.return=="function"&&l.return()}}async function*XG(r){let e,t=!1,n=[],i,a,o,s=0;function u(){return a==="peek"?Ia(n,o)[0]:([i,n,s]=Ia(n,o),i)}({cmd:a,size:o}=yield null);let l=dE(r)[Symbol.asyncIterator]();try{do if({done:e,value:i}=isNaN(o-s)?await l.next(void 0):await l.next(o-s),!e&&i.byteLength>0&&(n.push(i),s+=i.byteLength),e||o<=s)do({cmd:a,size:o}=yield u());while(o<s);while(!e)}catch(c){(t=!0)&&typeof l.throw=="function"&&await l.throw(c)}finally{t===!1&&typeof l.return=="function"&&await l.return()}}async function*YG(r){let e=!1,t=!1,n=[],i,a,o,s=0;function u(){return a==="peek"?Ia(n,o)[0]:([i,n,s]=Ia(n,o),i)}({cmd:a,size:o}=yield null);let l=new HG(r);try{do if({done:e,value:i}=isNaN(o-s)?await l.read(void 0):await l.read(o-s),!e&&i.byteLength>0&&(n.push(Dr(i)),s+=i.byteLength),e||o<=s)do({cmd:a,size:o}=yield u());while(o<s);while(!e)}catch(c){(t=!0)&&await l.cancel(c)}finally{t===!1?await l.cancel():r.locked&&l.releaseLock()}}class HG{constructor(e){this.source=e,this.byobReader=null,this.defaultReader=null;try{this.supportsBYOB=!!(this.reader=this.getBYOBReader())}catch{this.supportsBYOB=!(this.reader=this.getDefaultReader())}}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=this.byobReader=this.defaultReader=null}async cancel(e){const{reader:t,source:n}=this;t&&await t.cancel(e).catch(()=>{}),n&&n.locked&&this.releaseLock()}async read(e){if(e===0)return{done:this.reader==null,value:new Uint8Array(0)};const t=!this.supportsBYOB||typeof e!="number"?await this.getDefaultReader().read():await this.readFromBYOBReader(e);return!t.done&&(t.value=Dr(t)),t}getDefaultReader(){return this.byobReader&&this.releaseLock(),this.defaultReader||(this.defaultReader=this.source.getReader(),this.defaultReader.closed.catch(()=>{})),this.reader=this.defaultReader}getBYOBReader(){return this.defaultReader&&this.releaseLock(),this.byobReader||(this.byobReader=this.source.getReader({mode:"byob"}),this.byobReader.closed.catch(()=>{})),this.reader=this.byobReader}async readFromBYOBReader(e){return await pE(this.getBYOBReader(),new ArrayBuffer(e),0,e)}}async function pE(r,e,t,n){if(t>=n)return{done:!1,value:new Uint8Array(e,0,n)};const{done:i,value:a}=await r.read(new Uint8Array(e,t,n-t));return(t+=a.byteLength)<n&&!i?await pE(r,a.buffer,t,n):{done:i,value:new Uint8Array(a.buffer,0,t)}}const t0=(r,e)=>{let t=i=>n([e,i]),n;return[e,t,new Promise(i=>(n=i)&&r.once(e,t))]};async function*qG(r){let e=[],t="error",n=!1,i=null,a,o,s=0,u=[],l;function c(){return a==="peek"?Ia(u,o)[0]:([l,u,s]=Ia(u,o),l)}if({cmd:a,size:o}=yield null,r.isTTY)return yield new Uint8Array(0);try{e[0]=t0(r,"end"),e[1]=t0(r,"error");do{if(e[2]=t0(r,"readable"),[t,i]=await Promise.race(e.map(d=>d[2])),t==="error")break;if((n=t==="end")||(isFinite(o-s)?(l=Dr(r.read(o-s)),l.byteLength<o-s&&(l=Dr(r.read(void 0)))):l=Dr(r.read(void 0)),l.byteLength>0&&(u.push(l),s+=l.byteLength)),n||o<=s)do({cmd:a,size:o}=yield c());while(o<s)}while(!n)}finally{await f(e,t==="error"?i:null)}function f(d,h){return l=u=null,new Promise(async(v,p)=>{for(const[g,y]of d)r.off(g,y);try{const g=r.destroy;g&&g.call(r,h),h=void 0}catch(g){h=g||h}finally{h!=null?p(h):v()}})}}class Br{}var Fe;(function(r){(function(e){(function(t){(function(n){(function(i){i[i.V1=0]="V1",i[i.V2=1]="V2",i[i.V3=2]="V3",i[i.V4=3]="V4"})(n.MetadataVersion||(n.MetadataVersion={}))})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(Fe||(Fe={}));(function(r){(function(e){(function(t){(function(n){(function(i){i[i.Sparse=0]="Sparse",i[i.Dense=1]="Dense"})(n.UnionMode||(n.UnionMode={}))})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(Fe||(Fe={}));(function(r){(function(e){(function(t){(function(n){(function(i){i[i.HALF=0]="HALF",i[i.SINGLE=1]="SINGLE",i[i.DOUBLE=2]="DOUBLE"})(n.Precision||(n.Precision={}))})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(Fe||(Fe={}));(function(r){(function(e){(function(t){(function(n){(function(i){i[i.DAY=0]="DAY",i[i.MILLISECOND=1]="MILLISECOND"})(n.DateUnit||(n.DateUnit={}))})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(Fe||(Fe={}));(function(r){(function(e){(function(t){(function(n){(function(i){i[i.SECOND=0]="SECOND",i[i.MILLISECOND=1]="MILLISECOND",i[i.MICROSECOND=2]="MICROSECOND",i[i.NANOSECOND=3]="NANOSECOND"})(n.TimeUnit||(n.TimeUnit={}))})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(Fe||(Fe={}));(function(r){(function(e){(function(t){(function(n){(function(i){i[i.YEAR_MONTH=0]="YEAR_MONTH",i[i.DAY_TIME=1]="DAY_TIME"})(n.IntervalUnit||(n.IntervalUnit={}))})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(Fe||(Fe={}));(function(r){(function(e){(function(t){(function(n){(function(i){i[i.NONE=0]="NONE",i[i.Null=1]="Null",i[i.Int=2]="Int",i[i.FloatingPoint=3]="FloatingPoint",i[i.Binary=4]="Binary",i[i.Utf8=5]="Utf8",i[i.Bool=6]="Bool",i[i.Decimal=7]="Decimal",i[i.Date=8]="Date",i[i.Time=9]="Time",i[i.Timestamp=10]="Timestamp",i[i.Interval=11]="Interval",i[i.List=12]="List",i[i.Struct_=13]="Struct_",i[i.Union=14]="Union",i[i.FixedSizeBinary=15]="FixedSizeBinary",i[i.FixedSizeList=16]="FixedSizeList",i[i.Map=17]="Map",i[i.Duration=18]="Duration",i[i.LargeBinary=19]="LargeBinary",i[i.LargeUtf8=20]="LargeUtf8",i[i.LargeList=21]="LargeList"})(n.Type||(n.Type={}))})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(Fe||(Fe={}));(function(r){(function(e){(function(t){(function(n){(function(i){i[i.Little=0]="Little",i[i.Big=1]="Big"})(n.Endianness||(n.Endianness={}))})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(Fe||(Fe={}));(function(r){(function(e){(function(t){(function(n){class i{constructor(){this.bb=null,this.bb_pos=0}__init(o,s){return this.bb_pos=o,this.bb=s,this}static getRootAsNull(o,s){return(s||new i).__init(o.readInt32(o.position())+o.position(),o)}static startNull(o){o.startObject(0)}static endNull(o){return o.endObject()}static createNull(o){return i.startNull(o),i.endNull(o)}}n.Null=i})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(Fe||(Fe={}));(function(r){(function(e){(function(t){(function(n){class i{constructor(){this.bb=null,this.bb_pos=0}__init(o,s){return this.bb_pos=o,this.bb=s,this}static getRootAsStruct_(o,s){return(s||new i).__init(o.readInt32(o.position())+o.position(),o)}static startStruct_(o){o.startObject(0)}static endStruct_(o){return o.endObject()}static createStruct_(o){return i.startStruct_(o),i.endStruct_(o)}}n.Struct_=i})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(Fe||(Fe={}));(function(r){(function(e){(function(t){(function(n){class i{constructor(){this.bb=null,this.bb_pos=0}__init(o,s){return this.bb_pos=o,this.bb=s,this}static getRootAsList(o,s){return(s||new i).__init(o.readInt32(o.position())+o.position(),o)}static startList(o){o.startObject(0)}static endList(o){return o.endObject()}static createList(o){return i.startList(o),i.endList(o)}}n.List=i})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(Fe||(Fe={}));(function(r){(function(e){(function(t){(function(n){class i{constructor(){this.bb=null,this.bb_pos=0}__init(o,s){return this.bb_pos=o,this.bb=s,this}static getRootAsLargeList(o,s){return(s||new i).__init(o.readInt32(o.position())+o.position(),o)}static startLargeList(o){o.startObject(0)}static endLargeList(o){return o.endObject()}static createLargeList(o){return i.startLargeList(o),i.endLargeList(o)}}n.LargeList=i})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(Fe||(Fe={}));(function(r){(function(e){(function(t){(function(n){class i{constructor(){this.bb=null,this.bb_pos=0}__init(o,s){return this.bb_pos=o,this.bb=s,this}static getRootAsFixedSizeList(o,s){return(s||new i).__init(o.readInt32(o.position())+o.position(),o)}listSize(){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.readInt32(this.bb_pos+o):0}static startFixedSizeList(o){o.startObject(1)}static addListSize(o,s){o.addFieldInt32(0,s,0)}static endFixedSizeList(o){return o.endObject()}static createFixedSizeList(o,s){return i.startFixedSizeList(o),i.addListSize(o,s),i.endFixedSizeList(o)}}n.FixedSizeList=i})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(Fe||(Fe={}));(function(r){(function(e){(function(t){(function(n){class i{constructor(){this.bb=null,this.bb_pos=0}__init(o,s){return this.bb_pos=o,this.bb=s,this}static getRootAsMap(o,s){return(s||new i).__init(o.readInt32(o.position())+o.position(),o)}keysSorted(){let o=this.bb.__offset(this.bb_pos,4);return o?!!this.bb.readInt8(this.bb_pos+o):!1}static startMap(o){o.startObject(1)}static addKeysSorted(o,s){o.addFieldInt8(0,+s,0)}static endMap(o){return o.endObject()}static createMap(o,s){return i.startMap(o),i.addKeysSorted(o,s),i.endMap(o)}}n.Map=i})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(Fe||(Fe={}));(function(r){(function(e){(function(t){(function(n){class i{constructor(){this.bb=null,this.bb_pos=0}__init(o,s){return this.bb_pos=o,this.bb=s,this}static getRootAsUnion(o,s){return(s||new i).__init(o.readInt32(o.position())+o.position(),o)}mode(){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.readInt16(this.bb_pos+o):r.apache.arrow.flatbuf.UnionMode.Sparse}typeIds(o){let s=this.bb.__offset(this.bb_pos,6);return s?this.bb.readInt32(this.bb.__vector(this.bb_pos+s)+o*4):0}typeIdsLength(){let o=this.bb.__offset(this.bb_pos,6);return o?this.bb.__vector_len(this.bb_pos+o):0}typeIdsArray(){let o=this.bb.__offset(this.bb_pos,6);return o?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+o),this.bb.__vector_len(this.bb_pos+o)):null}static startUnion(o){o.startObject(2)}static addMode(o,s){o.addFieldInt16(0,s,r.apache.arrow.flatbuf.UnionMode.Sparse)}static addTypeIds(o,s){o.addFieldOffset(1,s,0)}static createTypeIdsVector(o,s){o.startVector(4,s.length,4);for(let u=s.length-1;u>=0;u--)o.addInt32(s[u]);return o.endVector()}static startTypeIdsVector(o,s){o.startVector(4,s,4)}static endUnion(o){return o.endObject()}static createUnion(o,s,u){return i.startUnion(o),i.addMode(o,s),i.addTypeIds(o,u),i.endUnion(o)}}n.Union=i})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(Fe||(Fe={}));(function(r){(function(e){(function(t){(function(n){class i{constructor(){this.bb=null,this.bb_pos=0}__init(o,s){return this.bb_pos=o,this.bb=s,this}static getRootAsInt(o,s){return(s||new i).__init(o.readInt32(o.position())+o.position(),o)}bitWidth(){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.readInt32(this.bb_pos+o):0}isSigned(){let o=this.bb.__offset(this.bb_pos,6);return o?!!this.bb.readInt8(this.bb_pos+o):!1}static startInt(o){o.startObject(2)}static addBitWidth(o,s){o.addFieldInt32(0,s,0)}static addIsSigned(o,s){o.addFieldInt8(1,+s,0)}static endInt(o){return o.endObject()}static createInt(o,s,u){return i.startInt(o),i.addBitWidth(o,s),i.addIsSigned(o,u),i.endInt(o)}}n.Int=i})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(Fe||(Fe={}));(function(r){(function(e){(function(t){(function(n){class i{constructor(){this.bb=null,this.bb_pos=0}__init(o,s){return this.bb_pos=o,this.bb=s,this}static getRootAsFloatingPoint(o,s){return(s||new i).__init(o.readInt32(o.position())+o.position(),o)}precision(){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.readInt16(this.bb_pos+o):r.apache.arrow.flatbuf.Precision.HALF}static startFloatingPoint(o){o.startObject(1)}static addPrecision(o,s){o.addFieldInt16(0,s,r.apache.arrow.flatbuf.Precision.HALF)}static endFloatingPoint(o){return o.endObject()}static createFloatingPoint(o,s){return i.startFloatingPoint(o),i.addPrecision(o,s),i.endFloatingPoint(o)}}n.FloatingPoint=i})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(Fe||(Fe={}));(function(r){(function(e){(function(t){(function(n){class i{constructor(){this.bb=null,this.bb_pos=0}__init(o,s){return this.bb_pos=o,this.bb=s,this}static getRootAsUtf8(o,s){return(s||new i).__init(o.readInt32(o.position())+o.position(),o)}static startUtf8(o){o.startObject(0)}static endUtf8(o){return o.endObject()}static createUtf8(o){return i.startUtf8(o),i.endUtf8(o)}}n.Utf8=i})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(Fe||(Fe={}));(function(r){(function(e){(function(t){(function(n){class i{constructor(){this.bb=null,this.bb_pos=0}__init(o,s){return this.bb_pos=o,this.bb=s,this}static getRootAsBinary(o,s){return(s||new i).__init(o.readInt32(o.position())+o.position(),o)}static startBinary(o){o.startObject(0)}static endBinary(o){return o.endObject()}static createBinary(o){return i.startBinary(o),i.endBinary(o)}}n.Binary=i})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(Fe||(Fe={}));(function(r){(function(e){(function(t){(function(n){class i{constructor(){this.bb=null,this.bb_pos=0}__init(o,s){return this.bb_pos=o,this.bb=s,this}static getRootAsLargeUtf8(o,s){return(s||new i).__init(o.readInt32(o.position())+o.position(),o)}static startLargeUtf8(o){o.startObject(0)}static endLargeUtf8(o){return o.endObject()}static createLargeUtf8(o){return i.startLargeUtf8(o),i.endLargeUtf8(o)}}n.LargeUtf8=i})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(Fe||(Fe={}));(function(r){(function(e){(function(t){(function(n){class i{constructor(){this.bb=null,this.bb_pos=0}__init(o,s){return this.bb_pos=o,this.bb=s,this}static getRootAsLargeBinary(o,s){return(s||new i).__init(o.readInt32(o.position())+o.position(),o)}static startLargeBinary(o){o.startObject(0)}static endLargeBinary(o){return o.endObject()}static createLargeBinary(o){return i.startLargeBinary(o),i.endLargeBinary(o)}}n.LargeBinary=i})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(Fe||(Fe={}));(function(r){(function(e){(function(t){(function(n){class i{constructor(){this.bb=null,this.bb_pos=0}__init(o,s){return this.bb_pos=o,this.bb=s,this}static getRootAsFixedSizeBinary(o,s){return(s||new i).__init(o.readInt32(o.position())+o.position(),o)}byteWidth(){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.readInt32(this.bb_pos+o):0}static startFixedSizeBinary(o){o.startObject(1)}static addByteWidth(o,s){o.addFieldInt32(0,s,0)}static endFixedSizeBinary(o){return o.endObject()}static createFixedSizeBinary(o,s){return i.startFixedSizeBinary(o),i.addByteWidth(o,s),i.endFixedSizeBinary(o)}}n.FixedSizeBinary=i})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(Fe||(Fe={}));(function(r){(function(e){(function(t){(function(n){class i{constructor(){this.bb=null,this.bb_pos=0}__init(o,s){return this.bb_pos=o,this.bb=s,this}static getRootAsBool(o,s){return(s||new i).__init(o.readInt32(o.position())+o.position(),o)}static startBool(o){o.startObject(0)}static endBool(o){return o.endObject()}static createBool(o){return i.startBool(o),i.endBool(o)}}n.Bool=i})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(Fe||(Fe={}));(function(r){(function(e){(function(t){(function(n){class i{constructor(){this.bb=null,this.bb_pos=0}__init(o,s){return this.bb_pos=o,this.bb=s,this}static getRootAsDecimal(o,s){return(s||new i).__init(o.readInt32(o.position())+o.position(),o)}precision(){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.readInt32(this.bb_pos+o):0}scale(){let o=this.bb.__offset(this.bb_pos,6);return o?this.bb.readInt32(this.bb_pos+o):0}static startDecimal(o){o.startObject(2)}static addPrecision(o,s){o.addFieldInt32(0,s,0)}static addScale(o,s){o.addFieldInt32(1,s,0)}static endDecimal(o){return o.endObject()}static createDecimal(o,s,u){return i.startDecimal(o),i.addPrecision(o,s),i.addScale(o,u),i.endDecimal(o)}}n.Decimal=i})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(Fe||(Fe={}));(function(r){(function(e){(function(t){(function(n){class i{constructor(){this.bb=null,this.bb_pos=0}__init(o,s){return this.bb_pos=o,this.bb=s,this}static getRootAsDate(o,s){return(s||new i).__init(o.readInt32(o.position())+o.position(),o)}unit(){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.readInt16(this.bb_pos+o):r.apache.arrow.flatbuf.DateUnit.MILLISECOND}static startDate(o){o.startObject(1)}static addUnit(o,s){o.addFieldInt16(0,s,r.apache.arrow.flatbuf.DateUnit.MILLISECOND)}static endDate(o){return o.endObject()}static createDate(o,s){return i.startDate(o),i.addUnit(o,s),i.endDate(o)}}n.Date=i})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(Fe||(Fe={}));(function(r){(function(e){(function(t){(function(n){class i{constructor(){this.bb=null,this.bb_pos=0}__init(o,s){return this.bb_pos=o,this.bb=s,this}static getRootAsTime(o,s){return(s||new i).__init(o.readInt32(o.position())+o.position(),o)}unit(){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.readInt16(this.bb_pos+o):r.apache.arrow.flatbuf.TimeUnit.MILLISECOND}bitWidth(){let o=this.bb.__offset(this.bb_pos,6);return o?this.bb.readInt32(this.bb_pos+o):32}static startTime(o){o.startObject(2)}static addUnit(o,s){o.addFieldInt16(0,s,r.apache.arrow.flatbuf.TimeUnit.MILLISECOND)}static addBitWidth(o,s){o.addFieldInt32(1,s,32)}static endTime(o){return o.endObject()}static createTime(o,s,u){return i.startTime(o),i.addUnit(o,s),i.addBitWidth(o,u),i.endTime(o)}}n.Time=i})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(Fe||(Fe={}));(function(r){(function(e){(function(t){(function(n){class i{constructor(){this.bb=null,this.bb_pos=0}__init(o,s){return this.bb_pos=o,this.bb=s,this}static getRootAsTimestamp(o,s){return(s||new i).__init(o.readInt32(o.position())+o.position(),o)}unit(){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.readInt16(this.bb_pos+o):r.apache.arrow.flatbuf.TimeUnit.SECOND}timezone(o){let s=this.bb.__offset(this.bb_pos,6);return s?this.bb.__string(this.bb_pos+s,o):null}static startTimestamp(o){o.startObject(2)}static addUnit(o,s){o.addFieldInt16(0,s,r.apache.arrow.flatbuf.TimeUnit.SECOND)}static addTimezone(o,s){o.addFieldOffset(1,s,0)}static endTimestamp(o){return o.endObject()}static createTimestamp(o,s,u){return i.startTimestamp(o),i.addUnit(o,s),i.addTimezone(o,u),i.endTimestamp(o)}}n.Timestamp=i})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(Fe||(Fe={}));(function(r){(function(e){(function(t){(function(n){class i{constructor(){this.bb=null,this.bb_pos=0}__init(o,s){return this.bb_pos=o,this.bb=s,this}static getRootAsInterval(o,s){return(s||new i).__init(o.readInt32(o.position())+o.position(),o)}unit(){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.readInt16(this.bb_pos+o):r.apache.arrow.flatbuf.IntervalUnit.YEAR_MONTH}static startInterval(o){o.startObject(1)}static addUnit(o,s){o.addFieldInt16(0,s,r.apache.arrow.flatbuf.IntervalUnit.YEAR_MONTH)}static endInterval(o){return o.endObject()}static createInterval(o,s){return i.startInterval(o),i.addUnit(o,s),i.endInterval(o)}}n.Interval=i})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(Fe||(Fe={}));(function(r){(function(e){(function(t){(function(n){class i{constructor(){this.bb=null,this.bb_pos=0}__init(o,s){return this.bb_pos=o,this.bb=s,this}static getRootAsDuration(o,s){return(s||new i).__init(o.readInt32(o.position())+o.position(),o)}unit(){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.readInt16(this.bb_pos+o):r.apache.arrow.flatbuf.TimeUnit.MILLISECOND}static startDuration(o){o.startObject(1)}static addUnit(o,s){o.addFieldInt16(0,s,r.apache.arrow.flatbuf.TimeUnit.MILLISECOND)}static endDuration(o){return o.endObject()}static createDuration(o,s){return i.startDuration(o),i.addUnit(o,s),i.endDuration(o)}}n.Duration=i})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(Fe||(Fe={}));(function(r){(function(e){(function(t){(function(n){class i{constructor(){this.bb=null,this.bb_pos=0}__init(o,s){return this.bb_pos=o,this.bb=s,this}static getRootAsKeyValue(o,s){return(s||new i).__init(o.readInt32(o.position())+o.position(),o)}key(o){let s=this.bb.__offset(this.bb_pos,4);return s?this.bb.__string(this.bb_pos+s,o):null}value(o){let s=this.bb.__offset(this.bb_pos,6);return s?this.bb.__string(this.bb_pos+s,o):null}static startKeyValue(o){o.startObject(2)}static addKey(o,s){o.addFieldOffset(0,s,0)}static addValue(o,s){o.addFieldOffset(1,s,0)}static endKeyValue(o){return o.endObject()}static createKeyValue(o,s,u){return i.startKeyValue(o),i.addKey(o,s),i.addValue(o,u),i.endKeyValue(o)}}n.KeyValue=i})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(Fe||(Fe={}));(function(r){(function(e){(function(t){(function(n){class i{constructor(){this.bb=null,this.bb_pos=0}__init(o,s){return this.bb_pos=o,this.bb=s,this}static getRootAsDictionaryEncoding(o,s){return(s||new i).__init(o.readInt32(o.position())+o.position(),o)}id(){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.readInt64(this.bb_pos+o):this.bb.createLong(0,0)}indexType(o){let s=this.bb.__offset(this.bb_pos,6);return s?(o||new r.apache.arrow.flatbuf.Int).__init(this.bb.__indirect(this.bb_pos+s),this.bb):null}isOrdered(){let o=this.bb.__offset(this.bb_pos,8);return o?!!this.bb.readInt8(this.bb_pos+o):!1}static startDictionaryEncoding(o){o.startObject(3)}static addId(o,s){o.addFieldInt64(0,s,o.createLong(0,0))}static addIndexType(o,s){o.addFieldOffset(1,s,0)}static addIsOrdered(o,s){o.addFieldInt8(2,+s,0)}static endDictionaryEncoding(o){return o.endObject()}static createDictionaryEncoding(o,s,u,l){return i.startDictionaryEncoding(o),i.addId(o,s),i.addIndexType(o,u),i.addIsOrdered(o,l),i.endDictionaryEncoding(o)}}n.DictionaryEncoding=i})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(Fe||(Fe={}));(function(r){(function(e){(function(t){(function(n){class i{constructor(){this.bb=null,this.bb_pos=0}__init(o,s){return this.bb_pos=o,this.bb=s,this}static getRootAsField(o,s){return(s||new i).__init(o.readInt32(o.position())+o.position(),o)}name(o){let s=this.bb.__offset(this.bb_pos,4);return s?this.bb.__string(this.bb_pos+s,o):null}nullable(){let o=this.bb.__offset(this.bb_pos,6);return o?!!this.bb.readInt8(this.bb_pos+o):!1}typeType(){let o=this.bb.__offset(this.bb_pos,8);return o?this.bb.readUint8(this.bb_pos+o):r.apache.arrow.flatbuf.Type.NONE}type(o){let s=this.bb.__offset(this.bb_pos,10);return s?this.bb.__union(o,this.bb_pos+s):null}dictionary(o){let s=this.bb.__offset(this.bb_pos,12);return s?(o||new r.apache.arrow.flatbuf.DictionaryEncoding).__init(this.bb.__indirect(this.bb_pos+s),this.bb):null}children(o,s){let u=this.bb.__offset(this.bb_pos,14);return u?(s||new r.apache.arrow.flatbuf.Field).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+u)+o*4),this.bb):null}childrenLength(){let o=this.bb.__offset(this.bb_pos,14);return o?this.bb.__vector_len(this.bb_pos+o):0}customMetadata(o,s){let u=this.bb.__offset(this.bb_pos,16);return u?(s||new r.apache.arrow.flatbuf.KeyValue).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+u)+o*4),this.bb):null}customMetadataLength(){let o=this.bb.__offset(this.bb_pos,16);return o?this.bb.__vector_len(this.bb_pos+o):0}static startField(o){o.startObject(7)}static addName(o,s){o.addFieldOffset(0,s,0)}static addNullable(o,s){o.addFieldInt8(1,+s,0)}static addTypeType(o,s){o.addFieldInt8(2,s,r.apache.arrow.flatbuf.Type.NONE)}static addType(o,s){o.addFieldOffset(3,s,0)}static addDictionary(o,s){o.addFieldOffset(4,s,0)}static addChildren(o,s){o.addFieldOffset(5,s,0)}static createChildrenVector(o,s){o.startVector(4,s.length,4);for(let u=s.length-1;u>=0;u--)o.addOffset(s[u]);return o.endVector()}static startChildrenVector(o,s){o.startVector(4,s,4)}static addCustomMetadata(o,s){o.addFieldOffset(6,s,0)}static createCustomMetadataVector(o,s){o.startVector(4,s.length,4);for(let u=s.length-1;u>=0;u--)o.addOffset(s[u]);return o.endVector()}static startCustomMetadataVector(o,s){o.startVector(4,s,4)}static endField(o){return o.endObject()}static createField(o,s,u,l,c,f,d,h){return i.startField(o),i.addName(o,s),i.addNullable(o,u),i.addTypeType(o,l),i.addType(o,c),i.addDictionary(o,f),i.addChildren(o,d),i.addCustomMetadata(o,h),i.endField(o)}}n.Field=i})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(Fe||(Fe={}));(function(r){(function(e){(function(t){(function(n){class i{constructor(){this.bb=null,this.bb_pos=0}__init(o,s){return this.bb_pos=o,this.bb=s,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static createBuffer(o,s,u){return o.prep(8,16),o.writeInt64(u),o.writeInt64(s),o.offset()}}n.Buffer=i})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(Fe||(Fe={}));(function(r){(function(e){(function(t){(function(n){class i{constructor(){this.bb=null,this.bb_pos=0}__init(o,s){return this.bb_pos=o,this.bb=s,this}static getRootAsSchema(o,s){return(s||new i).__init(o.readInt32(o.position())+o.position(),o)}endianness(){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.readInt16(this.bb_pos+o):r.apache.arrow.flatbuf.Endianness.Little}fields(o,s){let u=this.bb.__offset(this.bb_pos,6);return u?(s||new r.apache.arrow.flatbuf.Field).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+u)+o*4),this.bb):null}fieldsLength(){let o=this.bb.__offset(this.bb_pos,6);return o?this.bb.__vector_len(this.bb_pos+o):0}customMetadata(o,s){let u=this.bb.__offset(this.bb_pos,8);return u?(s||new r.apache.arrow.flatbuf.KeyValue).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+u)+o*4),this.bb):null}customMetadataLength(){let o=this.bb.__offset(this.bb_pos,8);return o?this.bb.__vector_len(this.bb_pos+o):0}static startSchema(o){o.startObject(3)}static addEndianness(o,s){o.addFieldInt16(0,s,r.apache.arrow.flatbuf.Endianness.Little)}static addFields(o,s){o.addFieldOffset(1,s,0)}static createFieldsVector(o,s){o.startVector(4,s.length,4);for(let u=s.length-1;u>=0;u--)o.addOffset(s[u]);return o.endVector()}static startFieldsVector(o,s){o.startVector(4,s,4)}static addCustomMetadata(o,s){o.addFieldOffset(2,s,0)}static createCustomMetadataVector(o,s){o.startVector(4,s.length,4);for(let u=s.length-1;u>=0;u--)o.addOffset(s[u]);return o.endVector()}static startCustomMetadataVector(o,s){o.startVector(4,s,4)}static endSchema(o){return o.endObject()}static finishSchemaBuffer(o,s){o.finish(s)}static createSchema(o,s,u,l){return i.startSchema(o),i.addEndianness(o,s),i.addFields(o,u),i.addCustomMetadata(o,l),i.endSchema(o)}}n.Schema=i})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(Fe||(Fe={}));var ai;(function(r){(function(e){(function(t){(function(n){n.Schema=Fe.apache.arrow.flatbuf.Schema})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(ai||(ai={}));(function(r){(function(e){(function(t){(function(n){(function(i){i[i.NONE=0]="NONE",i[i.Schema=1]="Schema",i[i.DictionaryBatch=2]="DictionaryBatch",i[i.RecordBatch=3]="RecordBatch",i[i.Tensor=4]="Tensor",i[i.SparseTensor=5]="SparseTensor"})(n.MessageHeader||(n.MessageHeader={}))})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(ai||(ai={}));(function(r){(function(e){(function(t){(function(n){class i{constructor(){this.bb=null,this.bb_pos=0}__init(o,s){return this.bb_pos=o,this.bb=s,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static createFieldNode(o,s,u){return o.prep(8,16),o.writeInt64(u),o.writeInt64(s),o.offset()}}n.FieldNode=i})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(ai||(ai={}));(function(r){(function(e){(function(t){(function(n){class i{constructor(){this.bb=null,this.bb_pos=0}__init(o,s){return this.bb_pos=o,this.bb=s,this}static getRootAsRecordBatch(o,s){return(s||new i).__init(o.readInt32(o.position())+o.position(),o)}length(){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.readInt64(this.bb_pos+o):this.bb.createLong(0,0)}nodes(o,s){let u=this.bb.__offset(this.bb_pos,6);return u?(s||new r.apache.arrow.flatbuf.FieldNode).__init(this.bb.__vector(this.bb_pos+u)+o*16,this.bb):null}nodesLength(){let o=this.bb.__offset(this.bb_pos,6);return o?this.bb.__vector_len(this.bb_pos+o):0}buffers(o,s){let u=this.bb.__offset(this.bb_pos,8);return u?(s||new Fe.apache.arrow.flatbuf.Buffer).__init(this.bb.__vector(this.bb_pos+u)+o*16,this.bb):null}buffersLength(){let o=this.bb.__offset(this.bb_pos,8);return o?this.bb.__vector_len(this.bb_pos+o):0}static startRecordBatch(o){o.startObject(3)}static addLength(o,s){o.addFieldInt64(0,s,o.createLong(0,0))}static addNodes(o,s){o.addFieldOffset(1,s,0)}static startNodesVector(o,s){o.startVector(16,s,8)}static addBuffers(o,s){o.addFieldOffset(2,s,0)}static startBuffersVector(o,s){o.startVector(16,s,8)}static endRecordBatch(o){return o.endObject()}static createRecordBatch(o,s,u,l){return i.startRecordBatch(o),i.addLength(o,s),i.addNodes(o,u),i.addBuffers(o,l),i.endRecordBatch(o)}}n.RecordBatch=i})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(ai||(ai={}));(function(r){(function(e){(function(t){(function(n){class i{constructor(){this.bb=null,this.bb_pos=0}__init(o,s){return this.bb_pos=o,this.bb=s,this}static getRootAsDictionaryBatch(o,s){return(s||new i).__init(o.readInt32(o.position())+o.position(),o)}id(){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.readInt64(this.bb_pos+o):this.bb.createLong(0,0)}data(o){let s=this.bb.__offset(this.bb_pos,6);return s?(o||new r.apache.arrow.flatbuf.RecordBatch).__init(this.bb.__indirect(this.bb_pos+s),this.bb):null}isDelta(){let o=this.bb.__offset(this.bb_pos,8);return o?!!this.bb.readInt8(this.bb_pos+o):!1}static startDictionaryBatch(o){o.startObject(3)}static addId(o,s){o.addFieldInt64(0,s,o.createLong(0,0))}static addData(o,s){o.addFieldOffset(1,s,0)}static addIsDelta(o,s){o.addFieldInt8(2,+s,0)}static endDictionaryBatch(o){return o.endObject()}static createDictionaryBatch(o,s,u,l){return i.startDictionaryBatch(o),i.addId(o,s),i.addData(o,u),i.addIsDelta(o,l),i.endDictionaryBatch(o)}}n.DictionaryBatch=i})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(ai||(ai={}));(function(r){(function(e){(function(t){(function(n){class i{constructor(){this.bb=null,this.bb_pos=0}__init(o,s){return this.bb_pos=o,this.bb=s,this}static getRootAsMessage(o,s){return(s||new i).__init(o.readInt32(o.position())+o.position(),o)}version(){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.readInt16(this.bb_pos+o):Fe.apache.arrow.flatbuf.MetadataVersion.V1}headerType(){let o=this.bb.__offset(this.bb_pos,6);return o?this.bb.readUint8(this.bb_pos+o):r.apache.arrow.flatbuf.MessageHeader.NONE}header(o){let s=this.bb.__offset(this.bb_pos,8);return s?this.bb.__union(o,this.bb_pos+s):null}bodyLength(){let o=this.bb.__offset(this.bb_pos,10);return o?this.bb.readInt64(this.bb_pos+o):this.bb.createLong(0,0)}customMetadata(o,s){let u=this.bb.__offset(this.bb_pos,12);return u?(s||new Fe.apache.arrow.flatbuf.KeyValue).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+u)+o*4),this.bb):null}customMetadataLength(){let o=this.bb.__offset(this.bb_pos,12);return o?this.bb.__vector_len(this.bb_pos+o):0}static startMessage(o){o.startObject(5)}static addVersion(o,s){o.addFieldInt16(0,s,Fe.apache.arrow.flatbuf.MetadataVersion.V1)}static addHeaderType(o,s){o.addFieldInt8(1,s,r.apache.arrow.flatbuf.MessageHeader.NONE)}static addHeader(o,s){o.addFieldOffset(2,s,0)}static addBodyLength(o,s){o.addFieldInt64(3,s,o.createLong(0,0))}static addCustomMetadata(o,s){o.addFieldOffset(4,s,0)}static createCustomMetadataVector(o,s){o.startVector(4,s.length,4);for(let u=s.length-1;u>=0;u--)o.addOffset(s[u]);return o.endVector()}static startCustomMetadataVector(o,s){o.startVector(4,s,4)}static endMessage(o){return o.endObject()}static finishMessageBuffer(o,s){o.finish(s)}static createMessage(o,s,u,l,c,f){return i.startMessage(o),i.addVersion(o,s),i.addHeaderType(o,u),i.addHeader(o,l),i.addBodyLength(o,c),i.addCustomMetadata(o,f),i.endMessage(o)}}n.Message=i})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(ai||(ai={}));Fe.apache.arrow.flatbuf.Type;var Za=Fe.apache.arrow.flatbuf.DateUnit,Zr=Fe.apache.arrow.flatbuf.TimeUnit,la=Fe.apache.arrow.flatbuf.Precision,Oo=Fe.apache.arrow.flatbuf.UnionMode,Rl=Fe.apache.arrow.flatbuf.IntervalUnit,en=ai.apache.arrow.flatbuf.MessageHeader,Ma=Fe.apache.arrow.flatbuf.MetadataVersion,ue;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.Float=3]="Float",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct=13]="Struct",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Dictionary=-1]="Dictionary",r[r.Int8=-2]="Int8",r[r.Int16=-3]="Int16",r[r.Int32=-4]="Int32",r[r.Int64=-5]="Int64",r[r.Uint8=-6]="Uint8",r[r.Uint16=-7]="Uint16",r[r.Uint32=-8]="Uint32",r[r.Uint64=-9]="Uint64",r[r.Float16=-10]="Float16",r[r.Float32=-11]="Float32",r[r.Float64=-12]="Float64",r[r.DateDay=-13]="DateDay",r[r.DateMillisecond=-14]="DateMillisecond",r[r.TimestampSecond=-15]="TimestampSecond",r[r.TimestampMillisecond=-16]="TimestampMillisecond",r[r.TimestampMicrosecond=-17]="TimestampMicrosecond",r[r.TimestampNanosecond=-18]="TimestampNanosecond",r[r.TimeSecond=-19]="TimeSecond",r[r.TimeMillisecond=-20]="TimeMillisecond",r[r.TimeMicrosecond=-21]="TimeMicrosecond",r[r.TimeNanosecond=-22]="TimeNanosecond",r[r.DenseUnion=-23]="DenseUnion",r[r.SparseUnion=-24]="SparseUnion",r[r.IntervalDayTime=-25]="IntervalDayTime",r[r.IntervalYearMonth=-26]="IntervalYearMonth"})(ue||(ue={}));var Yt;(function(r){r[r.OFFSET=0]="OFFSET",r[r.DATA=1]="DATA",r[r.VALIDITY=2]="VALIDITY",r[r.TYPE=3]="TYPE"})(Yt||(Yt={}));function r0(r,e,t,n){return(t&1<<n)!=0}function gE(r,e,t,n){return(t&1<<n)>>n}function yE(r,e,t){return t?!!(r[e>>3]|=1<<e%8)||!0:!(r[e>>3]&=~(1<<e%8))&&!1}function bv(r,e,t){const n=t.byteLength+7&~7;if(r>0||t.byteLength<n){const i=new Uint8Array(n);return i.set(r%8==0?t.subarray(r>>3):df(vf(t,r,e,null,r0)).subarray(0,n)),i}return t}function df(r){let e=[],t=0,n=0,i=0;for(const o of r)o&&(i|=1<<n),++n==8&&(e[t++]=i,i=n=0);(t===0||n>0)&&(e[t++]=i);let a=new Uint8Array(e.length+7&~7);return a.set(e),a}function*vf(r,e,t,n,i){let a=e%8,o=e>>3,s=0,u=t;for(;u>0;a=0){let l=r[o++];do yield i(n,s++,l,a);while(--u>0&&++a<8)}}function wv(r,e,t){if(t-e<=0)return 0;if(t-e<8){let a=0;for(const o of vf(r,e,t-e,r,gE))a+=o;return a}const n=t>>3<<3,i=e+(e%8==0?0:8-e%8);return wv(r,e,i)+wv(r,n,t)+mE(r,i>>3,n-i>>3)}function mE(r,e,t){let n=0,i=e|0;const a=new DataView(r.buffer,r.byteOffset,r.byteLength),o=t===void 0?r.byteLength:i+t;for(;o-i>=4;)n+=xv(a.getUint32(i)),i+=4;for(;o-i>=2;)n+=xv(a.getUint16(i)),i+=2;for(;o-i>=1;)n+=xv(a.getUint8(i)),i+=1;return n}function xv(r){let e=r|0;return e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),(e+(e>>>4)&252645135)*16843009>>>24}var KG=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",getBool:r0,getBit:gE,setBool:yE,truncateBitmap:bv,packBools:df,iterateBits:vf,popcnt_bit_range:wv,popcnt_array:mE,popcnt_uint32:xv});class Ir{visitMany(e,...t){return e.map((n,i)=>this.visit(n,...t.map(a=>a[i])))}visit(...e){return this.getVisitFn(e[0],!1).apply(this,e)}getVisitFn(e,t=!0){return ZG(this,e,t)}visitNull(e,...t){return null}visitBool(e,...t){return null}visitInt(e,...t){return null}visitFloat(e,...t){return null}visitUtf8(e,...t){return null}visitBinary(e,...t){return null}visitFixedSizeBinary(e,...t){return null}visitDate(e,...t){return null}visitTimestamp(e,...t){return null}visitTime(e,...t){return null}visitDecimal(e,...t){return null}visitList(e,...t){return null}visitStruct(e,...t){return null}visitUnion(e,...t){return null}visitDictionary(e,...t){return null}visitInterval(e,...t){return null}visitFixedSizeList(e,...t){return null}visitMap(e,...t){return null}}function ZG(r,e,t=!0){let n=null,i=ue.NONE;switch(e instanceof wt||e instanceof Br?i=n0(e.type):e instanceof yr?i=n0(e):typeof(i=e)!="number"&&(i=ue[e]),i){case ue.Null:n=r.visitNull;break;case ue.Bool:n=r.visitBool;break;case ue.Int:n=r.visitInt;break;case ue.Int8:n=r.visitInt8||r.visitInt;break;case ue.Int16:n=r.visitInt16||r.visitInt;break;case ue.Int32:n=r.visitInt32||r.visitInt;break;case ue.Int64:n=r.visitInt64||r.visitInt;break;case ue.Uint8:n=r.visitUint8||r.visitInt;break;case ue.Uint16:n=r.visitUint16||r.visitInt;break;case ue.Uint32:n=r.visitUint32||r.visitInt;break;case ue.Uint64:n=r.visitUint64||r.visitInt;break;case ue.Float:n=r.visitFloat;break;case ue.Float16:n=r.visitFloat16||r.visitFloat;break;case ue.Float32:n=r.visitFloat32||r.visitFloat;break;case ue.Float64:n=r.visitFloat64||r.visitFloat;break;case ue.Utf8:n=r.visitUtf8;break;case ue.Binary:n=r.visitBinary;break;case ue.FixedSizeBinary:n=r.visitFixedSizeBinary;break;case ue.Date:n=r.visitDate;break;case ue.DateDay:n=r.visitDateDay||r.visitDate;break;case ue.DateMillisecond:n=r.visitDateMillisecond||r.visitDate;break;case ue.Timestamp:n=r.visitTimestamp;break;case ue.TimestampSecond:n=r.visitTimestampSecond||r.visitTimestamp;break;case ue.TimestampMillisecond:n=r.visitTimestampMillisecond||r.visitTimestamp;break;case ue.TimestampMicrosecond:n=r.visitTimestampMicrosecond||r.visitTimestamp;break;case ue.TimestampNanosecond:n=r.visitTimestampNanosecond||r.visitTimestamp;break;case ue.Time:n=r.visitTime;break;case ue.TimeSecond:n=r.visitTimeSecond||r.visitTime;break;case ue.TimeMillisecond:n=r.visitTimeMillisecond||r.visitTime;break;case ue.TimeMicrosecond:n=r.visitTimeMicrosecond||r.visitTime;break;case ue.TimeNanosecond:n=r.visitTimeNanosecond||r.visitTime;break;case ue.Decimal:n=r.visitDecimal;break;case ue.List:n=r.visitList;break;case ue.Struct:n=r.visitStruct;break;case ue.Union:n=r.visitUnion;break;case ue.DenseUnion:n=r.visitDenseUnion||r.visitUnion;break;case ue.SparseUnion:n=r.visitSparseUnion||r.visitUnion;break;case ue.Dictionary:n=r.visitDictionary;break;case ue.Interval:n=r.visitInterval;break;case ue.IntervalDayTime:n=r.visitIntervalDayTime||r.visitInterval;break;case ue.IntervalYearMonth:n=r.visitIntervalYearMonth||r.visitInterval;break;case ue.FixedSizeList:n=r.visitFixedSizeList;break;case ue.Map:n=r.visitMap;break}if(typeof n=="function")return n;if(!t)return()=>null;throw new Error(`Unrecognized type '${ue[i]}'`)}function n0(r){switch(r.typeId){case ue.Null:return ue.Null;case ue.Int:const{bitWidth:e,isSigned:t}=r;switch(e){case 8:return t?ue.Int8:ue.Uint8;case 16:return t?ue.Int16:ue.Uint16;case 32:return t?ue.Int32:ue.Uint32;case 64:return t?ue.Int64:ue.Uint64}return ue.Int;case ue.Float:switch(r.precision){case la.HALF:return ue.Float16;case la.SINGLE:return ue.Float32;case la.DOUBLE:return ue.Float64}return ue.Float;case ue.Binary:return ue.Binary;case ue.Utf8:return ue.Utf8;case ue.Bool:return ue.Bool;case ue.Decimal:return ue.Decimal;case ue.Time:switch(r.unit){case Zr.SECOND:return ue.TimeSecond;case Zr.MILLISECOND:return ue.TimeMillisecond;case Zr.MICROSECOND:return ue.TimeMicrosecond;case Zr.NANOSECOND:return ue.TimeNanosecond}return ue.Time;case ue.Timestamp:switch(r.unit){case Zr.SECOND:return ue.TimestampSecond;case Zr.MILLISECOND:return ue.TimestampMillisecond;case Zr.MICROSECOND:return ue.TimestampMicrosecond;case Zr.NANOSECOND:return ue.TimestampNanosecond}return ue.Timestamp;case ue.Date:switch(r.unit){case Za.DAY:return ue.DateDay;case Za.MILLISECOND:return ue.DateMillisecond}return ue.Date;case ue.Interval:switch(r.unit){case Rl.DAY_TIME:return ue.IntervalDayTime;case Rl.YEAR_MONTH:return ue.IntervalYearMonth}return ue.Interval;case ue.Map:return ue.Map;case ue.List:return ue.List;case ue.Struct:return ue.Struct;case ue.Union:switch(r.mode){case Oo.Dense:return ue.DenseUnion;case Oo.Sparse:return ue.SparseUnion}return ue.Union;case ue.FixedSizeBinary:return ue.FixedSizeBinary;case ue.FixedSizeList:return ue.FixedSizeList;case ue.Dictionary:return ue.Dictionary}throw new Error(`Unrecognized type '${ue[r.typeId]}'`)}Ir.prototype.visitInt8=null;Ir.prototype.visitInt16=null;Ir.prototype.visitInt32=null;Ir.prototype.visitInt64=null;Ir.prototype.visitUint8=null;Ir.prototype.visitUint16=null;Ir.prototype.visitUint32=null;Ir.prototype.visitUint64=null;Ir.prototype.visitFloat16=null;Ir.prototype.visitFloat32=null;Ir.prototype.visitFloat64=null;Ir.prototype.visitDateDay=null;Ir.prototype.visitDateMillisecond=null;Ir.prototype.visitTimestampSecond=null;Ir.prototype.visitTimestampMillisecond=null;Ir.prototype.visitTimestampMicrosecond=null;Ir.prototype.visitTimestampNanosecond=null;Ir.prototype.visitTimeSecond=null;Ir.prototype.visitTimeMillisecond=null;Ir.prototype.visitTimeMicrosecond=null;Ir.prototype.visitTimeNanosecond=null;Ir.prototype.visitDenseUnion=null;Ir.prototype.visitSparseUnion=null;Ir.prototype.visitIntervalDayTime=null;Ir.prototype.visitIntervalYearMonth=null;class ar extends Ir{compareSchemas(e,t){return e===t||t instanceof e.constructor&&Hi.compareFields(e.fields,t.fields)}compareFields(e,t){return e===t||Array.isArray(e)&&Array.isArray(t)&&e.length===t.length&&e.every((n,i)=>Hi.compareField(n,t[i]))}compareField(e,t){return e===t||t instanceof e.constructor&&e.name===t.name&&e.nullable===t.nullable&&Hi.visit(e.type,t.type)}}function Oi(r,e){return e instanceof r.constructor}function pf(r,e){return r===e||Oi(r,e)}function Po(r,e){return r===e||Oi(r,e)&&r.bitWidth===e.bitWidth&&r.isSigned===e.isSigned}function _v(r,e){return r===e||Oi(r,e)&&r.precision===e.precision}function QG(r,e){return r===e||Oi(r,e)&&r.byteWidth===e.byteWidth}function i0(r,e){return r===e||Oi(r,e)&&r.unit===e.unit}function gf(r,e){return r===e||Oi(r,e)&&r.unit===e.unit&&r.timezone===e.timezone}function yf(r,e){return r===e||Oi(r,e)&&r.unit===e.unit&&r.bitWidth===e.bitWidth}function JG(r,e){return r===e||Oi(r,e)&&r.children.length===e.children.length&&Hi.compareFields(r.children,e.children)}function e6(r,e){return r===e||Oi(r,e)&&r.children.length===e.children.length&&Hi.compareFields(r.children,e.children)}function a0(r,e){return r===e||Oi(r,e)&&r.mode===e.mode&&r.typeIds.every((t,n)=>t===e.typeIds[n])&&Hi.compareFields(r.children,e.children)}function t6(r,e){return r===e||Oi(r,e)&&r.id===e.id&&r.isOrdered===e.isOrdered&&Hi.visit(r.indices,e.indices)&&Hi.visit(r.dictionary,e.dictionary)}function o0(r,e){return r===e||Oi(r,e)&&r.unit===e.unit}function r6(r,e){return r===e||Oi(r,e)&&r.listSize===e.listSize&&r.children.length===e.children.length&&Hi.compareFields(r.children,e.children)}function n6(r,e){return r===e||Oi(r,e)&&r.keysSorted===e.keysSorted&&r.children.length===e.children.length&&Hi.compareFields(r.children,e.children)}ar.prototype.visitNull=pf;ar.prototype.visitBool=pf;ar.prototype.visitInt=Po;ar.prototype.visitInt8=Po;ar.prototype.visitInt16=Po;ar.prototype.visitInt32=Po;ar.prototype.visitInt64=Po;ar.prototype.visitUint8=Po;ar.prototype.visitUint16=Po;ar.prototype.visitUint32=Po;ar.prototype.visitUint64=Po;ar.prototype.visitFloat=_v;ar.prototype.visitFloat16=_v;ar.prototype.visitFloat32=_v;ar.prototype.visitFloat64=_v;ar.prototype.visitUtf8=pf;ar.prototype.visitBinary=pf;ar.prototype.visitFixedSizeBinary=QG;ar.prototype.visitDate=i0;ar.prototype.visitDateDay=i0;ar.prototype.visitDateMillisecond=i0;ar.prototype.visitTimestamp=gf;ar.prototype.visitTimestampSecond=gf;ar.prototype.visitTimestampMillisecond=gf;ar.prototype.visitTimestampMicrosecond=gf;ar.prototype.visitTimestampNanosecond=gf;ar.prototype.visitTime=yf;ar.prototype.visitTimeSecond=yf;ar.prototype.visitTimeMillisecond=yf;ar.prototype.visitTimeMicrosecond=yf;ar.prototype.visitTimeNanosecond=yf;ar.prototype.visitDecimal=pf;ar.prototype.visitList=JG;ar.prototype.visitStruct=e6;ar.prototype.visitUnion=a0;ar.prototype.visitDenseUnion=a0;ar.prototype.visitSparseUnion=a0;ar.prototype.visitDictionary=t6;ar.prototype.visitInterval=o0;ar.prototype.visitIntervalDayTime=o0;ar.prototype.visitIntervalYearMonth=o0;ar.prototype.visitFixedSizeList=r6;ar.prototype.visitMap=n6;const Hi=new ar;class yr{static isNull(e){return e&&e.typeId===ue.Null}static isInt(e){return e&&e.typeId===ue.Int}static isFloat(e){return e&&e.typeId===ue.Float}static isBinary(e){return e&&e.typeId===ue.Binary}static isUtf8(e){return e&&e.typeId===ue.Utf8}static isBool(e){return e&&e.typeId===ue.Bool}static isDecimal(e){return e&&e.typeId===ue.Decimal}static isDate(e){return e&&e.typeId===ue.Date}static isTime(e){return e&&e.typeId===ue.Time}static isTimestamp(e){return e&&e.typeId===ue.Timestamp}static isInterval(e){return e&&e.typeId===ue.Interval}static isList(e){return e&&e.typeId===ue.List}static isStruct(e){return e&&e.typeId===ue.Struct}static isUnion(e){return e&&e.typeId===ue.Union}static isFixedSizeBinary(e){return e&&e.typeId===ue.FixedSizeBinary}static isFixedSizeList(e){return e&&e.typeId===ue.FixedSizeList}static isMap(e){return e&&e.typeId===ue.Map}static isDictionary(e){return e&&e.typeId===ue.Dictionary}get typeId(){return ue.NONE}compareTo(e){return Hi.visit(this,e)}}yr[Symbol.toStringTag]=(r=>(r.children=null,r.ArrayType=Array,r[Symbol.toStringTag]="DataType"))(yr.prototype);class Bl extends yr{toString(){return"Null"}get typeId(){return ue.Null}}Bl[Symbol.toStringTag]=(r=>r[Symbol.toStringTag]="Null")(Bl.prototype);class Pi extends yr{constructor(e,t){super();this.isSigned=e,this.bitWidth=t}get typeId(){return ue.Int}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?Int32Array:Uint32Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}Pi[Symbol.toStringTag]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(Pi.prototype);class s0 extends Pi{constructor(){super(!0,8)}}class u0 extends Pi{constructor(){super(!0,16)}}class xu extends Pi{constructor(){super(!0,32)}}class Fl extends Pi{constructor(){super(!0,64)}}class l0 extends Pi{constructor(){super(!1,8)}}class c0 extends Pi{constructor(){super(!1,16)}}class f0 extends Pi{constructor(){super(!1,32)}}class Ul extends Pi{constructor(){super(!1,64)}}Object.defineProperty(s0.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(u0.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(xu.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(Fl.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(l0.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(c0.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(f0.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Ul.prototype,"ArrayType",{value:Uint32Array});class _u extends yr{constructor(e){super();this.precision=e}get typeId(){return ue.Float}get ArrayType(){switch(this.precision){case la.HALF:return Uint16Array;case la.SINGLE:return Float32Array;case la.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}}_u[Symbol.toStringTag]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(_u.prototype);class Sv extends _u{constructor(){super(la.HALF)}}class h0 extends _u{constructor(){super(la.SINGLE)}}class d0 extends _u{constructor(){super(la.DOUBLE)}}Object.defineProperty(Sv.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(h0.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(d0.prototype,"ArrayType",{value:Float64Array});class mf extends yr{constructor(){super()}get typeId(){return ue.Binary}toString(){return"Binary"}}mf[Symbol.toStringTag]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(mf.prototype);class Gl extends yr{constructor(){super()}get typeId(){return ue.Utf8}toString(){return"Utf8"}}Gl[Symbol.toStringTag]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(Gl.prototype);class bf extends yr{constructor(){super()}get typeId(){return ue.Bool}toString(){return"Bool"}}bf[Symbol.toStringTag]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(bf.prototype);class Ev extends yr{constructor(e,t){super();this.scale=e,this.precision=t}get typeId(){return ue.Decimal}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}}Ev[Symbol.toStringTag]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(Ev.prototype);class zl extends yr{constructor(e){super();this.unit=e}get typeId(){return ue.Date}toString(){return`Date${(this.unit+1)*32}<${Za[this.unit]}>`}}zl[Symbol.toStringTag]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Date"))(zl.prototype);class i6 extends zl{constructor(){super(Za.DAY)}}class bE extends zl{constructor(){super(Za.MILLISECOND)}}class Av extends yr{constructor(e,t){super();this.unit=e,this.bitWidth=t}get typeId(){return ue.Time}toString(){return`Time${this.bitWidth}<${Zr[this.unit]}>`}}Av[Symbol.toStringTag]=(r=>(r.unit=null,r.bitWidth=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Time"))(Av.prototype);class Tv extends yr{constructor(e,t){super();this.unit=e,this.timezone=t}get typeId(){return ue.Timestamp}toString(){return`Timestamp<${Zr[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}Tv[Symbol.toStringTag]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Timestamp"))(Tv.prototype);class Iv extends yr{constructor(e){super();this.unit=e}get typeId(){return ue.Interval}toString(){return`Interval<${Rl[this.unit]}>`}}Iv[Symbol.toStringTag]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(Iv.prototype);class $l extends yr{constructor(e){super();this.children=[e]}get typeId(){return ue.List}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}}$l[Symbol.toStringTag]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))($l.prototype);class ka extends yr{constructor(e){super();this.children=e}get typeId(){return ue.Struct}toString(){return`Struct<{${this.children.map(e=>`${e.name}:${e.type}`).join(", ")}}>`}}ka[Symbol.toStringTag]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(ka.prototype);class wf extends yr{constructor(e,t,n){super();this.mode=e,this.children=n,this.typeIds=t=Int32Array.from(t),this.typeIdToChildIndex=t.reduce((i,a,o)=>(i[a]=o)&&i||i,Object.create(null))}get typeId(){return ue.Union}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(e=>`${e.type}`).join(" | ")}>`}}wf[Symbol.toStringTag]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))(wf.prototype);class Cv extends yr{constructor(e){super();this.byteWidth=e}get typeId(){return ue.FixedSizeBinary}toString(){return`FixedSizeBinary[${this.byteWidth}]`}}Cv[Symbol.toStringTag]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(Cv.prototype);class xf extends yr{constructor(e,t){super();this.listSize=e,this.children=[t]}get typeId(){return ue.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}}xf[Symbol.toStringTag]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(xf.prototype);class _f extends yr{constructor(e,t=!1){super();this.children=[e],this.keysSorted=t}get typeId(){return ue.Map}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}toString(){return`Map<{${this.children[0].type.children.map(e=>`${e.name}:${e.type}`).join(", ")}}>`}}_f[Symbol.toStringTag]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(_f.prototype);const a6=(r=>()=>++r)(-1);class gs extends yr{constructor(e,t,n,i){super();this.indices=t,this.dictionary=e,this.isOrdered=i||!1,this.id=n==null?a6():typeof n=="number"?n:n.low}get typeId(){return ue.Dictionary}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}}gs[Symbol.toStringTag]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(gs.prototype);function wE(r){let e=r;switch(r.typeId){case ue.Decimal:return 4;case ue.Timestamp:return 2;case ue.Date:return 1+e.unit;case ue.Interval:return 1+e.unit;case ue.Int:return 1+ +(e.bitWidth>32);case ue.Time:return 1+ +(e.bitWidth>32);case ue.FixedSizeList:return e.listSize;case ue.FixedSizeBinary:return e.byteWidth;default:return 1}}const o6=-1;class wt{constructor(e,t,n,i,a,o,s){this.type=e,this.dictionary=s,this.offset=Math.floor(Math.max(t||0,0)),this.length=Math.floor(Math.max(n||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1)),this.childData=(o||[]).map(l=>l instanceof wt?l:l.data);let u;a instanceof wt?(this.stride=a.stride,this.values=a.values,this.typeIds=a.typeIds,this.nullBitmap=a.nullBitmap,this.valueOffsets=a.valueOffsets):(this.stride=wE(e),a&&((u=a[0])&&(this.valueOffsets=u),(u=a[1])&&(this.values=u),(u=a[2])&&(this.nullBitmap=u),(u=a[3])&&(this.typeIds=u)))}get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get byteLength(){let e=0,{valueOffsets:t,values:n,nullBitmap:i,typeIds:a}=this;return t&&(e+=t.byteLength),n&&(e+=n.byteLength),i&&(e+=i.byteLength),a&&(e+=a.byteLength),this.childData.reduce((o,s)=>o+s.byteLength,e)}get nullCount(){let e=this._nullCount,t;return e<=o6&&(t=this.nullBitmap)&&(this._nullCount=e=this.length-wv(t,this.offset,this.offset+this.length)),e}clone(e,t=this.offset,n=this.length,i=this._nullCount,a=this,o=this.childData){return new wt(e,t,n,i,a,o,this.dictionary)}slice(e,t){const{stride:n,typeId:i,childData:a}=this,o=+(this._nullCount===0)-1,s=i===16?n:1,u=this._sliceBuffers(e,t,n,i);return this.clone(this.type,this.offset+e,t,o,u,!a.length||this.valueOffsets?a:this._sliceChildren(a,s*e,s*t))}_changeLengthAndBackfillNullBitmap(e){if(this.typeId===ue.Null)return this.clone(this.type,0,e,0);const{length:t,nullCount:n}=this,i=new Uint8Array((e+63&~63)>>3).fill(255,0,t>>3);i[t>>3]=(1<<t-(t&~7))-1,n>0&&i.set(bv(this.offset,t,this.nullBitmap),0);const a=this.buffers;return a[Yt.VALIDITY]=i,this.clone(this.type,0,e,n+(e-t),a)}_sliceBuffers(e,t,n,i){let a,{buffers:o}=this;return(a=o[Yt.TYPE])&&(o[Yt.TYPE]=a.subarray(e,e+t)),(a=o[Yt.OFFSET])&&(o[Yt.OFFSET]=a.subarray(e,e+t+1))||(a=o[Yt.DATA])&&(o[Yt.DATA]=i===6?a:a.subarray(n*e,n*(e+t))),o}_sliceChildren(e,t,n){return e.map(i=>i.slice(t,n))}static new(e,t,n,i,a,o,s){switch(a instanceof wt?a=a.buffers:a||(a=[]),e.typeId){case ue.Null:return wt.Null(e,t,n);case ue.Int:return wt.Int(e,t,n,i||0,a[Yt.VALIDITY],a[Yt.DATA]||[]);case ue.Dictionary:return wt.Dictionary(e,t,n,i||0,a[Yt.VALIDITY],a[Yt.DATA]||[],s);case ue.Float:return wt.Float(e,t,n,i||0,a[Yt.VALIDITY],a[Yt.DATA]||[]);case ue.Bool:return wt.Bool(e,t,n,i||0,a[Yt.VALIDITY],a[Yt.DATA]||[]);case ue.Decimal:return wt.Decimal(e,t,n,i||0,a[Yt.VALIDITY],a[Yt.DATA]||[]);case ue.Date:return wt.Date(e,t,n,i||0,a[Yt.VALIDITY],a[Yt.DATA]||[]);case ue.Time:return wt.Time(e,t,n,i||0,a[Yt.VALIDITY],a[Yt.DATA]||[]);case ue.Timestamp:return wt.Timestamp(e,t,n,i||0,a[Yt.VALIDITY],a[Yt.DATA]||[]);case ue.Interval:return wt.Interval(e,t,n,i||0,a[Yt.VALIDITY],a[Yt.DATA]||[]);case ue.FixedSizeBinary:return wt.FixedSizeBinary(e,t,n,i||0,a[Yt.VALIDITY],a[Yt.DATA]||[]);case ue.Binary:return wt.Binary(e,t,n,i||0,a[Yt.VALIDITY],a[Yt.OFFSET]||[],a[Yt.DATA]||[]);case ue.Utf8:return wt.Utf8(e,t,n,i||0,a[Yt.VALIDITY],a[Yt.OFFSET]||[],a[Yt.DATA]||[]);case ue.List:return wt.List(e,t,n,i||0,a[Yt.VALIDITY],a[Yt.OFFSET]||[],(o||[])[0]);case ue.FixedSizeList:return wt.FixedSizeList(e,t,n,i||0,a[Yt.VALIDITY],(o||[])[0]);case ue.Struct:return wt.Struct(e,t,n,i||0,a[Yt.VALIDITY],o||[]);case ue.Map:return wt.Map(e,t,n,i||0,a[Yt.VALIDITY],a[Yt.OFFSET]||[],(o||[])[0]);case ue.Union:return wt.Union(e,t,n,i||0,a[Yt.VALIDITY],a[Yt.TYPE]||[],a[Yt.OFFSET]||o,o)}throw new Error(`Unrecognized typeId ${e.typeId}`)}static Null(e,t,n){return new wt(e,t,n,0)}static Int(e,t,n,i,a,o){return new wt(e,t,n,i,[void 0,Tr(e.ArrayType,o),Dr(a)])}static Dictionary(e,t,n,i,a,o,s){return new wt(e,t,n,i,[void 0,Tr(e.indices.ArrayType,o),Dr(a)],[],s)}static Float(e,t,n,i,a,o){return new wt(e,t,n,i,[void 0,Tr(e.ArrayType,o),Dr(a)])}static Bool(e,t,n,i,a,o){return new wt(e,t,n,i,[void 0,Tr(e.ArrayType,o),Dr(a)])}static Decimal(e,t,n,i,a,o){return new wt(e,t,n,i,[void 0,Tr(e.ArrayType,o),Dr(a)])}static Date(e,t,n,i,a,o){return new wt(e,t,n,i,[void 0,Tr(e.ArrayType,o),Dr(a)])}static Time(e,t,n,i,a,o){return new wt(e,t,n,i,[void 0,Tr(e.ArrayType,o),Dr(a)])}static Timestamp(e,t,n,i,a,o){return new wt(e,t,n,i,[void 0,Tr(e.ArrayType,o),Dr(a)])}static Interval(e,t,n,i,a,o){return new wt(e,t,n,i,[void 0,Tr(e.ArrayType,o),Dr(a)])}static FixedSizeBinary(e,t,n,i,a,o){return new wt(e,t,n,i,[void 0,Tr(e.ArrayType,o),Dr(a)])}static Binary(e,t,n,i,a,o,s){return new wt(e,t,n,i,[Pl(o),Dr(s),Dr(a)])}static Utf8(e,t,n,i,a,o,s){return new wt(e,t,n,i,[Pl(o),Dr(s),Dr(a)])}static List(e,t,n,i,a,o,s){return new wt(e,t,n,i,[Pl(o),void 0,Dr(a)],[s])}static FixedSizeList(e,t,n,i,a,o){return new wt(e,t,n,i,[void 0,void 0,Dr(a)],[o])}static Struct(e,t,n,i,a,o){return new wt(e,t,n,i,[void 0,void 0,Dr(a)],o)}static Map(e,t,n,i,a,o,s){return new wt(e,t,n,i,[Pl(o),void 0,Dr(a)],[s])}static Union(e,t,n,i,a,o,s,u){const l=[void 0,void 0,Dr(a),Tr(e.ArrayType,o)];return e.mode===Oo.Sparse?new wt(e,t,n,i,l,s):(l[Yt.OFFSET]=Pl(s),new wt(e,t,n,i,l,u))}}wt.prototype.childData=Object.freeze([]);const s6=void 0;function Sf(r){if(r===null)return"null";if(r===s6)return"undefined";switch(typeof r){case"number":return`${r}`;case"bigint":return`${r}`;case"string":return`"${r}"`}return typeof r[Symbol.toPrimitive]=="function"?r[Symbol.toPrimitive]("string"):ArrayBuffer.isView(r)?`[${r}]`:JSON.stringify(r)}function u6(r){if(!r||r.length<=0)return function(i){return!0};let e="",t=r.filter(n=>n===n);return t.length>0&&(e=`
    switch (x) {${t.map(n=>`
        case ${l6(n)}:`).join("")}
            return false;
    }`),r.length!==t.length&&(e=`if (x !== x) return false;
${e}`),new Function("x",`${e}
return true;`)}function l6(r){return typeof r!="bigint"?Sf(r):gv?`${Sf(r)}n`:`"${Sf(r)}"`}const v0=(r,e)=>(r*e+63&~63||64)/e,c6=(r,e=0)=>r.length>=e?r.subarray(0,e):hf(new r.constructor(e),r,0);class Ef{constructor(e,t=1){this.buffer=e,this.stride=t,this.BYTES_PER_ELEMENT=e.BYTES_PER_ELEMENT,this.ArrayType=e.constructor,this._resize(this.length=e.length/t|0)}get byteLength(){return this.length*this.stride*this.BYTES_PER_ELEMENT|0}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(e,t){return this}append(e){return this.set(this.length,e)}reserve(e){if(e>0){this.length+=e;const t=this.stride,n=this.length*t,i=this.buffer.length;n>=i&&this._resize(i===0?v0(n*1,this.BYTES_PER_ELEMENT):v0(n*2,this.BYTES_PER_ELEMENT))}return this}flush(e=this.length){e=v0(e*this.stride,this.BYTES_PER_ELEMENT);const t=c6(this.buffer,e);return this.clear(),t}clear(){return this.length=0,this._resize(0),this}_resize(e){return this.buffer=hf(new this.ArrayType(e),this.buffer)}}Ef.prototype.offset=0;class Af extends Ef{last(){return this.get(this.length-1)}get(e){return this.buffer[e]}set(e,t){return this.reserve(e-this.length+1),this.buffer[e*this.stride]=t,this}}class xE extends Af{constructor(e=new Uint8Array(0)){super(e,1/8);this.numValid=0}get numInvalid(){return this.length-this.numValid}get(e){return this.buffer[e>>3]>>e%8&1}set(e,t){const{buffer:n}=this.reserve(e-this.length+1),i=e>>3,a=e%8,o=n[i]>>a&1;return t?o===0&&(n[i]|=1<<a,++this.numValid):o===1&&(n[i]&=~(1<<a),--this.numValid),this}clear(){return this.numValid=0,super.clear()}}class _E extends Af{constructor(e=new Int32Array(1)){super(e,1)}append(e){return this.set(this.length-1,e)}set(e,t){const n=this.length-1,i=this.reserve(e-n+1).buffer;return n<e++&&i.fill(i[n],n,e),i[e]=i[e-1]+t,this}flush(e=this.length-1){return e>this.length&&this.set(e-1,0),super.flush(e+1)}}class SE extends Ef{get ArrayType64(){return this._ArrayType64||(this._ArrayType64=this.buffer instanceof Int32Array?Ol:ff)}set(e,t){switch(this.reserve(e-this.length+1),typeof t){case"bigint":this.buffer64[e]=t;break;case"number":this.buffer[e*this.stride]=t;break;default:this.buffer.set(t,e*this.stride)}return this}_resize(e){const t=super._resize(e),n=t.byteLength/(this.BYTES_PER_ELEMENT*this.stride);return gv&&(this.buffer64=new this.ArrayType64(t.buffer,t.byteOffset,n)),t}}class bn{constructor({type:e,nullValues:t}){this.length=0,this.finished=!1,this.type=e,this.children=[],this.nullValues=t,this.stride=wE(e),this._nulls=new xE,t&&t.length>0&&(this._isValid=u6(t))}static new(e){}static throughNode(e){throw new Error('"throughNode" not available in this environment')}static throughDOM(e){throw new Error('"throughDOM" not available in this environment')}static throughIterable(e){return f6(e)}static throughAsyncIterable(e){return h6(e)}toVector(){return Br.new(this.flush())}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let e=0;return this._offsets&&(e+=this._offsets.byteLength),this._values&&(e+=this._values.byteLength),this._nulls&&(e+=this._nulls.byteLength),this._typeIds&&(e+=this._typeIds.byteLength),this.children.reduce((t,n)=>t+n.byteLength,e)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let e=0;return this._offsets&&(e+=this._offsets.reservedByteLength),this._values&&(e+=this._values.reservedByteLength),this._nulls&&(e+=this._nulls.reservedByteLength),this._typeIds&&(e+=this._typeIds.reservedByteLength),this.children.reduce((t,n)=>t+n.reservedByteLength,e)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(e){return this.set(this.length,e)}isValid(e){return this._isValid(e)}set(e,t){return this.setValid(e,this.isValid(t))&&this.setValue(e,t),this}setValue(e,t){this._setValue(this,e,t)}setValid(e,t){return this.length=this._nulls.set(e,+t).length,t}addChild(e,t=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(e){return this.children[e]||null}flush(){const e=[],t=this._values,n=this._offsets,i=this._typeIds,{length:a,nullCount:o}=this;i?(e[Yt.TYPE]=i.flush(a),n&&(e[Yt.OFFSET]=n.flush(a))):n?(t&&(e[Yt.DATA]=t.flush(n.last())),e[Yt.OFFSET]=n.flush(a)):t&&(e[Yt.DATA]=t.flush(a)),o>0&&(e[Yt.VALIDITY]=this._nulls.flush(a));const s=wt.new(this.type,0,a,o,e,this.children.map(u=>u.flush()));return this.clear(),s}finish(){return this.finished=!0,this.children.forEach(e=>e.finish()),this}clear(){return this.length=0,this._offsets&&this._offsets.clear(),this._values&&this._values.clear(),this._nulls&&this._nulls.clear(),this._typeIds&&this._typeIds.clear(),this.children.forEach(e=>e.clear()),this}}bn.prototype.length=1;bn.prototype.stride=1;bn.prototype.children=null;bn.prototype.finished=!1;bn.prototype.nullValues=null;bn.prototype._isValid=()=>!0;class ys extends bn{constructor(e){super(e);this._values=new Af(new this.ArrayType(0),this.stride)}setValue(e,t){const n=this._values;return n.reserve(e-n.length+1),super.setValue(e,t)}}class Mv extends bn{constructor(e){super(e);this._pendingLength=0,this._offsets=new _E}setValue(e,t){const n=this._pending||(this._pending=new Map),i=n.get(e);i&&(this._pendingLength-=i.length),this._pendingLength+=t.length,n.set(e,t)}setValid(e,t){return super.setValid(e,t)?!0:((this._pending||(this._pending=new Map)).set(e,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){const e=this._pending,t=this._pendingLength;return this._pendingLength=0,this._pending=void 0,e&&e.size>0&&this._flushPending(e,t),this}}function f6(r){const{["queueingStrategy"]:e="count"}=r,{["highWaterMark"]:t=e!=="bytes"?1e3:2**14}=r,n=e!=="bytes"?"length":"byteLength";return function*(i){let a=0,o=bn.new(r);for(const s of i)o.append(s)[n]>=t&&++a&&(yield o.toVector());(o.finish().length>0||a===0)&&(yield o.toVector())}}function h6(r){const{["queueingStrategy"]:e="count"}=r,{["highWaterMark"]:t=e!=="bytes"?1e3:2**14}=r,n=e!=="bytes"?"length":"byteLength";return async function*(i){let a=0,o=bn.new(r);for await(const s of i)o.append(s)[n]>=t&&++a&&(yield o.toVector());(o.finish().length>0||a===0)&&(yield o.toVector())}}class d6 extends bn{constructor(e){super(e);this._values=new xE}setValue(e,t){this._values.set(e,+t)}}class v6 extends bn{setValue(e,t){}setValid(e,t){return this.length=Math.max(e+1,this.length),t}}class p0 extends ys{}class p6 extends p0{}class g6 extends p0{}class y6 extends ys{}class m6 extends bn{constructor({type:e,nullValues:t,dictionaryHashFunction:n}){super({type:new gs(e.dictionary,e.indices,e.id,e.isOrdered)});this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=bn.new({type:this.type.indices,nullValues:t}),this.dictionary=bn.new({type:this.type.dictionary,nullValues:null}),typeof n=="function"&&(this.valueToKey=n)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(e){return this.indices.isValid(e)}setValid(e,t){const n=this.indices;return t=n.setValid(e,t),this.length=n.length,t}setValue(e,t){let n=this._keysToIndices,i=this.valueToKey(t),a=n[i];return a===void 0&&(n[i]=a=this._dictionaryOffset+this.dictionary.append(t).length-1),this.indices.setValue(e,a)}flush(){const e=this.type,t=this._dictionary,n=this.dictionary.toVector(),i=this.indices.flush().clone(e);return i.dictionary=t?t.concat(n):n,this.finished||(this._dictionaryOffset+=n.length),this._dictionary=i.dictionary,this.clear(),i}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(e){return typeof e=="string"?e:`${e}`}}class b6 extends ys{}const EE=new Float64Array(1),Vl=new Uint32Array(EE.buffer);function AE(r){let e=(r&31744)>>10,t=(r&1023)/1024,n=(-1)**((r&32768)>>15);switch(e){case 31:return n*(t?NaN:1/0);case 0:return n*(t?6103515625e-14*t:0)}return n*2**(e-15)*(1+t)}function g0(r){if(r!==r)return 32256;EE[0]=r;let e=(Vl[1]&2147483648)>>16&65535,t=Vl[1]&2146435072,n=0;return t>=1089470464?Vl[0]>0?t=31744:(t=(t&2080374784)>>16,n=(Vl[1]&1048575)>>10):t<=1056964608?(n=1048576+(Vl[1]&1048575),n=1048576+(n<<(t>>20)-998)>>21,t=0):(t=t-1056964608>>10,n=(Vl[1]&1048575)+512>>10),e|t|n&65535}var w6=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",uint16ToFloat64:AE,float64ToUint16:g0});class kv extends ys{}class x6 extends kv{setValue(e,t){this._values.set(e,g0(t))}}class _6 extends kv{setValue(e,t){this._values.set(e,t)}}class S6 extends kv{setValue(e,t){this._values.set(e,t)}}const TE=Symbol.for("isArrowBigNum");function Da(r,...e){return e.length===0?Object.setPrototypeOf(Tr(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...e),this.constructor.prototype)}Da.prototype[TE]=!0;Da.prototype.toJSON=function(){return`"${ms(this)}"`};Da.prototype.valueOf=function(){return IE(this)};Da.prototype.toString=function(){return ms(this)};Da.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return IE(this);case"string":return ms(this);case"default":return If(this)}return ms(this)};function jl(...r){return Da.apply(this,r)}function Wl(...r){return Da.apply(this,r)}function Tf(...r){return Da.apply(this,r)}Object.setPrototypeOf(jl.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(Wl.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Tf.prototype,Object.create(Uint32Array.prototype));Object.assign(jl.prototype,Da.prototype,{constructor:jl,signed:!0,TypedArray:Int32Array,BigIntArray:Ol});Object.assign(Wl.prototype,Da.prototype,{constructor:Wl,signed:!1,TypedArray:Uint32Array,BigIntArray:ff});Object.assign(Tf.prototype,Da.prototype,{constructor:Tf,signed:!0,TypedArray:Uint32Array,BigIntArray:ff});function IE(r){let{buffer:e,byteOffset:t,length:n,signed:i}=r,a=new Int32Array(e,t,n),o=0,s=0,u=a.length,l,c;for(;s<u;)c=a[s++],l=a[s++],i||(l=l>>>0),o+=(c>>>0)+l*s**32;return o}let ms,If;gv?(If=r=>r.byteLength===8?new r.BigIntArray(r.buffer,r.byteOffset,1)[0]:y0(r),ms=r=>r.byteLength===8?`${new r.BigIntArray(r.buffer,r.byteOffset,1)[0]}`:y0(r)):(ms=y0,If=ms);function y0(r){let e="",t=new Uint32Array(2),n=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2),i=new Uint32Array((n=new Uint16Array(n).reverse()).buffer),a=-1,o=n.length-1;do{for(t[0]=n[a=0];a<o;)n[a++]=t[1]=t[0]/10,t[0]=(t[0]-t[1]*10<<16)+n[a];n[a]=t[1]=t[0]/10,t[0]=t[0]-t[1]*10,e=`${t[0]}${e}`}while(i[0]||i[1]||i[2]||i[3]);return e||"0"}class Su{constructor(e,t){return Su.new(e,t)}static new(e,t){switch(t){case!0:return new jl(e);case!1:return new Wl(e)}switch(e.constructor){case Int8Array:case Int16Array:case Int32Array:case Ol:return new jl(e)}return e.byteLength===16?new Tf(e):new Wl(e)}static signed(e){return new jl(e)}static unsigned(e){return new Wl(e)}static decimal(e){return new Tf(e)}}var E6=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",isArrowBigNumSymbol:TE,get bignumToString(){return ms},get bignumToBigInt(){return If},BN:Su});class Ro extends ys{setValue(e,t){this._values.set(e,t)}}class A6 extends Ro{}class T6 extends Ro{}class I6 extends Ro{}class C6 extends Ro{constructor(e){e.nullValues&&(e.nullValues=e.nullValues.map(Dv));super(e);this._values=new SE(new Int32Array(0),2)}get values64(){return this._values.buffer64}isValid(e){return super.isValid(Dv(e))}}class M6 extends Ro{}class k6 extends Ro{}class D6 extends Ro{}class L6 extends Ro{constructor(e){e.nullValues&&(e.nullValues=e.nullValues.map(Dv));super(e);this._values=new SE(new Uint32Array(0),2)}get values64(){return this._values.buffer64}isValid(e){return super.isValid(Dv(e))}}const Dv=(r=>e=>(ArrayBuffer.isView(e)&&(r.buffer=e.buffer,r.byteOffset=e.byteOffset,r.byteLength=e.byteLength,e=If(r),r.buffer=null),e))({BigIntArray:Ol});class Cf extends ys{}class N6 extends Cf{}class O6 extends Cf{}class P6 extends Cf{}class R6 extends Cf{}class Mf extends ys{}class B6 extends Mf{}class F6 extends Mf{}class U6 extends Mf{}class G6 extends Mf{}class m0 extends ys{}class z6 extends m0{}class $6 extends m0{}class CE extends Mv{constructor(e){super(e);this._values=new Ef(new Uint8Array(0))}get byteLength(){let e=this._pendingLength+this.length*4;return this._offsets&&(e+=this._offsets.byteLength),this._values&&(e+=this._values.byteLength),this._nulls&&(e+=this._nulls.byteLength),e}setValue(e,t){return super.setValue(e,Dr(t))}_flushPending(e,t){const n=this._offsets,i=this._values.reserve(t).buffer;let a=0,o=0,s=0,u;for([a,u]of e)u===void 0?n.set(a,0):(o=u.length,i.set(u,s),n.set(a,o),s+=o)}}class b0 extends Mv{constructor(e){super(e);this._values=new Ef(new Uint8Array(0))}get byteLength(){let e=this._pendingLength+this.length*4;return this._offsets&&(e+=this._offsets.byteLength),this._values&&(e+=this._values.byteLength),this._nulls&&(e+=this._nulls.byteLength),e}setValue(e,t){return super.setValue(e,pv(t))}_flushPending(e,t){}}b0.prototype._flushPending=CE.prototype._flushPending;class ME{get length(){return this._values.length}get(e){return this._values[e]}clear(){return this._values=null,this}bind(e){return e instanceof Br?e:(this._values=e,this)}}const oi=Symbol.for("parent"),Xl=Symbol.for("rowIndex"),qi=Symbol.for("keyToIdx"),Ki=Symbol.for("idxToVal"),w0=Symbol.for("nodejs.util.inspect.custom");class Bo{constructor(e,t){this[oi]=e,this.size=t}entries(){return this[Symbol.iterator]()}has(e){return this.get(e)!==void 0}get(e){let t;if(e!=null){const n=this[qi]||(this[qi]=new Map);let i=n.get(e);if(i!==void 0){const a=this[Ki]||(this[Ki]=new Array(this.size));(t=a[i])!==void 0||(a[i]=t=this.getValue(i))}else if((i=this.getIndex(e))>-1){n.set(e,i);const a=this[Ki]||(this[Ki]=new Array(this.size));(t=a[i])!==void 0||(a[i]=t=this.getValue(i))}}return t}set(e,t){if(e!=null){const n=this[qi]||(this[qi]=new Map);let i=n.get(e);if(i===void 0&&n.set(e,i=this.getIndex(e)),i>-1){const a=this[Ki]||(this[Ki]=new Array(this.size));a[i]=this.setValue(i,t)}}return this}clear(){throw new Error(`Clearing ${this[Symbol.toStringTag]} not supported.`)}delete(e){throw new Error(`Deleting ${this[Symbol.toStringTag]} values not supported.`)}*[Symbol.iterator](){const e=this.keys(),t=this.values(),n=this[qi]||(this[qi]=new Map),i=this[Ki]||(this[Ki]=new Array(this.size));for(let a,o,s=0,u,l;!((u=e.next()).done||(l=t.next()).done);++s)a=u.value,o=l.value,i[s]=o,n.has(a)||n.set(a,s),yield[a,o]}forEach(e,t){const n=this.keys(),i=this.values(),a=t===void 0?e:(u,l,c)=>e.call(t,u,l,c),o=this[qi]||(this[qi]=new Map),s=this[Ki]||(this[Ki]=new Array(this.size));for(let u,l,c=0,f,d;!((f=n.next()).done||(d=i.next()).done);++c)u=f.value,l=d.value,s[c]=l,o.has(u)||o.set(u,c),a(l,u,this)}toArray(){return[...this.values()]}toJSON(){const e={};return this.forEach((t,n)=>e[n]=t),e}inspect(){return this.toString()}[w0](){return this.toString()}toString(){const e=[];return this.forEach((t,n)=>{n=Sf(n),t=Sf(t),e.push(`${n}: ${t}`)}),`{ ${e.join(", ")} }`}}Bo[Symbol.toStringTag]=(r=>(Object.defineProperties(r,{size:{writable:!0,enumerable:!1,configurable:!1,value:0},[oi]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Xl]:{writable:!0,enumerable:!1,configurable:!1,value:-1}}),r[Symbol.toStringTag]="Row"))(Bo.prototype);class kE extends Bo{constructor(e){super(e,e.length);return V6(this)}keys(){return this[oi].getChildAt(0)[Symbol.iterator]()}values(){return this[oi].getChildAt(1)[Symbol.iterator]()}getKey(e){return this[oi].getChildAt(0).get(e)}getIndex(e){return this[oi].getChildAt(0).indexOf(e)}getValue(e){return this[oi].getChildAt(1).get(e)}setValue(e,t){this[oi].getChildAt(1).set(e,t)}}class DE extends Bo{constructor(e){super(e,e.type.children.length);return LE(this)}*keys(){for(const e of this[oi].type.children)yield e.name}*values(){for(const e of this[oi].type.children)yield this[e.name]}getKey(e){return this[oi].type.children[e].name}getIndex(e){return this[oi].type.children.findIndex(t=>t.name===e)}getValue(e){return this[oi].getChildAt(e).get(this[Xl])}setValue(e,t){return this[oi].getChildAt(e).set(this[Xl],t)}}Object.setPrototypeOf(Bo.prototype,Map.prototype);const LE=(()=>{const r={enumerable:!0,configurable:!1,get:null,set:null};return e=>{let t=-1,n=e[qi]||(e[qi]=new Map);const i=o=>function(){return this.get(o)},a=o=>function(s){return this.set(o,s)};for(const o of e.keys())n.set(o,++t),r.get=i(o),r.set=a(o),e.hasOwnProperty(o)||(r.enumerable=!0,Object.defineProperty(e,o,r)),e.hasOwnProperty(t)||(r.enumerable=!1,Object.defineProperty(e,t,r));return r.get=r.set=null,e}})(),V6=(()=>{if(typeof Proxy=="undefined")return LE;const r=Bo.prototype.has,e=Bo.prototype.get,t=Bo.prototype.set,n=Bo.prototype.getKey,i={isExtensible(){return!1},deleteProperty(){return!1},preventExtensions(){return!0},ownKeys(a){return[...a.keys()].map(o=>`${o}`)},has(a,o){switch(o){case"getKey":case"getIndex":case"getValue":case"setValue":case"toArray":case"toJSON":case"inspect":case"constructor":case"isPrototypeOf":case"propertyIsEnumerable":case"toString":case"toLocaleString":case"valueOf":case"size":case"has":case"get":case"set":case"clear":case"delete":case"keys":case"values":case"entries":case"forEach":case"__proto__":case"__defineGetter__":case"__defineSetter__":case"hasOwnProperty":case"__lookupGetter__":case"__lookupSetter__":case Symbol.iterator:case Symbol.toStringTag:case oi:case Xl:case Ki:case qi:case w0:return!0}return typeof o=="number"&&!a.has(o)&&(o=a.getKey(o)),a.has(o)},get(a,o,s){switch(o){case"getKey":case"getIndex":case"getValue":case"setValue":case"toArray":case"toJSON":case"inspect":case"constructor":case"isPrototypeOf":case"propertyIsEnumerable":case"toString":case"toLocaleString":case"valueOf":case"size":case"has":case"get":case"set":case"clear":case"delete":case"keys":case"values":case"entries":case"forEach":case"__proto__":case"__defineGetter__":case"__defineSetter__":case"hasOwnProperty":case"__lookupGetter__":case"__lookupSetter__":case Symbol.iterator:case Symbol.toStringTag:case oi:case Xl:case Ki:case qi:case w0:return Reflect.get(a,o,s)}return typeof o=="number"&&!r.call(s,o)&&(o=n.call(s,o)),e.call(s,o)},set(a,o,s,u){switch(o){case oi:case Xl:case Ki:case qi:return Reflect.set(a,o,s,u);case"getKey":case"getIndex":case"getValue":case"setValue":case"toArray":case"toJSON":case"inspect":case"constructor":case"isPrototypeOf":case"propertyIsEnumerable":case"toString":case"toLocaleString":case"valueOf":case"size":case"has":case"get":case"set":case"clear":case"delete":case"keys":case"values":case"entries":case"forEach":case"__proto__":case"__defineGetter__":case"__defineSetter__":case"hasOwnProperty":case"__lookupGetter__":case"__lookupSetter__":case Symbol.iterator:case Symbol.toStringTag:return!1}return typeof o=="number"&&!r.call(u,o)&&(o=n.call(u,o)),r.call(u,o)?!!t.call(u,o,s):!1}};return a=>new Proxy(a,i)})();function j6(r,e,t){const n=r.length,i=e>-1?e:n+e%n;return t?t(r,i):i}let NE;function x0(r,e,t,n){let{length:i=0}=r,a=typeof e!="number"?0:e,o=typeof t!="number"?i:t;return a<0&&(a=(a%i+i)%i),o<0&&(o=(o%i+i)%i),o<a&&(NE=a,a=o,o=NE),o>i&&(o=i),n?n(r,a,o):[a,o]}const W6=gv?pG(0):0,OE=r=>r!==r;function Eu(r){let e=typeof r;if(e!=="object"||r===null)return OE(r)?OE:e!=="bigint"?t=>t===r:t=>W6+t===r;if(r instanceof Date){const t=r.valueOf();return n=>n instanceof Date?n.valueOf()===t:!1}return ArrayBuffer.isView(r)?t=>t?vE(r,t):!1:r instanceof Map?Y6(r):Array.isArray(r)?X6(r):r instanceof Br?H6(r):q6(r)}function X6(r){const e=[];for(let t=-1,n=r.length;++t<n;)e[t]=Eu(r[t]);return Lv(e)}function Y6(r){let e=-1;const t=[];return r.forEach(n=>t[++e]=Eu(n)),Lv(t)}function H6(r){const e=[];for(let t=-1,n=r.length;++t<n;)e[t]=Eu(r.get(t));return Lv(e)}function q6(r){const e=Object.keys(r);if(e.length===0)return()=>!1;const t=[];for(let n=-1,i=e.length;++n<i;)t[n]=Eu(r[e[n]]);return Lv(t,e)}function Lv(r,e){return t=>{if(!t||typeof t!="object")return!1;switch(t.constructor){case Array:return K6(r,t);case Map:case kE:case DE:return PE(r,t,t.keys());case Object:case void 0:return PE(r,t,e||Object.keys(t))}return t instanceof Br?Z6(r,t):!1}}function K6(r,e){const t=r.length;if(e.length!==t)return!1;for(let n=-1;++n<t;)if(!r[n](e[n]))return!1;return!0}function Z6(r,e){const t=r.length;if(e.length!==t)return!1;for(let n=-1;++n<t;)if(!r[n](e.get(n)))return!1;return!0}function PE(r,e,t){const n=t[Symbol.iterator](),i=e instanceof Map?e.keys():Object.keys(e)[Symbol.iterator](),a=e instanceof Map?e.values():Object.values(e)[Symbol.iterator]();let o=0,s=r.length,u=a.next(),l=n.next(),c=i.next();for(;o<s&&!l.done&&!c.done&&!u.done&&!(l.value!==c.value||!r[o](u.value));++o,l=n.next(),c=i.next(),u=a.next());return o===s&&l.done&&c.done&&u.done?!0:(n.return&&n.return(),i.return&&i.return(),a.return&&a.return(),!1)}var Q6=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",clampIndex:j6,clampRange:x0,createElementComparator:Eu});class si extends Br{constructor(e,t=[],n=J6(t)){super();this._nullCount=-1,this._type=e,this._chunks=t,this._chunkOffsets=n,this._length=n[n.length-1],this._numChildren=(this._type.children||[]).length}static flatten(...e){return nz(Br,e)}static concat(...e){const t=si.flatten(...e);return new si(t[0].type,t)}get type(){return this._type}get length(){return this._length}get chunks(){return this._chunks}get typeId(){return this._type.typeId}get VectorName(){return`Chunked<${this._type}>`}get data(){return this._chunks[0]?this._chunks[0].data:null}get ArrayType(){return this._type.ArrayType}get numChildren(){return this._numChildren}get stride(){return this._chunks[0]?this._chunks[0].stride:1}get byteLength(){return this._chunks.reduce((e,t)=>e+t.byteLength,0)}get nullCount(){let e=this._nullCount;return e<0&&(this._nullCount=e=this._chunks.reduce((t,{nullCount:n})=>t+n,0)),e}get indices(){if(yr.isDictionary(this._type)){if(!this._indices){const e=this._chunks;this._indices=e.length===1?e[0].indices:si.concat(...e.map(t=>t.indices))}return this._indices}return null}get dictionary(){return yr.isDictionary(this._type)?this._chunks[this._chunks.length-1].data.dictionary:null}*[Symbol.iterator](){for(const e of this._chunks)yield*e}clone(e=this._chunks){return new si(this._type,e)}concat(...e){return this.clone(si.flatten(this,...e))}slice(e,t){return x0(this,e,t,this._sliceInternal)}getChildAt(e){if(e<0||e>=this._numChildren)return null;let t=this._children||(this._children=[]),n,i,a;return(n=t[e])?n:(i=(this._type.children||[])[e])&&(a=this._chunks.map(o=>o.getChildAt(e)).filter(o=>o!=null),a.length>0)?t[e]=new si(i.type,a):null}search(e,t){let n=e,i=this._chunkOffsets,a=i.length-1;if(n<0||n>=i[a])return null;if(a<=1)return t?t(this,0,n):[0,n];let o=0,s=0,u=0;do{if(o+1===a)return t?t(this,o,n-s):[o,n-s];u=o+(a-o)/2|0,n>=i[u]?o=u:a=u}while(n<i[a]&&n>=(s=i[o]));return null}isValid(e){return!!this.search(e,this.isValidInternal)}get(e){return this.search(e,this.getInternal)}set(e,t){this.search(e,({chunks:n},i,a)=>n[i].set(a,t))}indexOf(e,t){return t&&typeof t=="number"?this.search(t,(n,i,a)=>this.indexOfInternal(n,i,a,e)):this.indexOfInternal(this,0,Math.max(0,t||0),e)}toArray(){const{chunks:e}=this,t=e.length;let n=this._type.ArrayType;if(t<=0)return new n(0);if(t<=1)return e[0].toArray();let i=0,a=new Array(t);for(let u=-1;++u<t;)i+=(a[u]=e[u].toArray()).length;n!==a[0].constructor&&(n=a[0].constructor);let o=new n(i),s=n===Array?tz:ez;for(let u=-1,l=0;++u<t;)l=s(a[u],o,l);return o}getInternal({_chunks:e},t,n){return e[t].get(n)}isValidInternal({_chunks:e},t,n){return e[t].isValid(n)}indexOfInternal({_chunks:e},t,n,i){let a=t-1,o=e.length,s=n,u=0,l=-1;for(;++a<o;){if(~(l=e[a].indexOf(i,s)))return u+l;s=0,u+=e[a].length}return-1}_sliceInternal(e,t,n){const i=[],{chunks:a,_chunkOffsets:o}=e;for(let s=-1,u=a.length;++s<u;){const l=a[s],c=l.length,f=o[s];if(f>=n)break;if(t>=f+c)continue;if(f>=t&&f+c<=n){i.push(l);continue}const d=Math.max(0,t-f),h=Math.min(n-f,c);i.push(l.slice(d,h))}return e.clone(i)}}function J6(r){let e=new Uint32Array((r||[]).length+1),t=e[0]=0,n=e.length;for(let i=0;++i<n;)e[i]=t+=r[i-1].length;return e}const ez=(r,e,t)=>(e.set(r,t),t+r.length),tz=(r,e,t)=>{let n=t;for(let i=-1,a=r.length;++i<a;)e[n++]=r[i];return n};class La extends si{constructor(e,t=[],n){t=si.flatten(...t);super(e.type,t,n);if(this._field=e,t.length===1&&!(this instanceof RE))return new RE(e,t[0],this._chunkOffsets)}static new(e,t,...n){const i=si.flatten(Array.isArray(t)?[...t,...n]:t instanceof Br?[t,...n]:[Br.new(t,...n)]);if(typeof e=="string"){const a=i[0].data.type;e=new Fr(e,a,!0)}else!e.nullable&&i.some(({nullCount:a})=>a>0)&&(e=e.clone({nullable:!0}));return new La(e,i)}get field(){return this._field}get name(){return this._field.name}get nullable(){return this._field.nullable}get metadata(){return this._field.metadata}clone(e=this._chunks){return new La(this._field,e)}getChildAt(e){if(e<0||e>=this.numChildren)return null;let t=this._children||(this._children=[]),n,i,a;return(n=t[e])?n:(i=(this.type.children||[])[e])&&(a=this._chunks.map(o=>o.getChildAt(e)).filter(o=>o!=null),a.length>0)?t[e]=new La(i,a):null}}class RE extends La{constructor(e,t,n){super(e,[t],n);this._chunk=t}search(e,t){return t?t(this,0,e):[0,e]}isValid(e){return this._chunk.isValid(e)}get(e){return this._chunk.get(e)}set(e,t){this._chunk.set(e,t)}indexOf(e,t){return this._chunk.indexOf(e,t)}}const Au=Array.isArray,BE=(r,e)=>_0(r,e,[],0),rz=r=>{const[e,t]=E0(r,[[],[]]);return t.map((n,i)=>n instanceof La?La.new(n.field.clone(e[i]),n):n instanceof Br?La.new(e[i],n):La.new(e[i],[]))},FE=r=>E0(r,[[],[]]),nz=(r,e)=>S0(r,e,[],0),iz=(r,e)=>UE(r,e,[],0);function _0(r,e,t,n){let i,a=n,o=-1,s=e.length;for(;++o<s;)Au(i=e[o])?a=_0(r,i,t,a).length:i instanceof r&&(t[a++]=i);return t}function S0(r,e,t,n){let i,a=n,o=-1,s=e.length;for(;++o<s;)Au(i=e[o])?a=S0(r,i,t,a).length:i instanceof si?a=S0(r,i.chunks,t,a).length:i instanceof r&&(t[a++]=i);return t}function UE(r,e,t,n){let i,a=n,o=-1,s=e.length;for(;++o<s;)Au(i=e[o])?a=UE(r,i,t,a).length:i instanceof r?a=_0(Br,i.schema.fields.map((u,l)=>i.getChildAt(l)),t,a).length:i instanceof Br&&(t[a++]=i);return t}const az=(r,[e,t],n)=>(r[0][n]=e,r[1][n]=t,r);function E0(r,e){let t,n;switch(n=r.length){case 0:return e;case 1:if(t=e[0],!r[0])return e;if(Au(r[0]))return E0(r[0],e);r[0]instanceof wt||r[0]instanceof Br||r[0]instanceof yr||([t,r]=Object.entries(r[0]).reduce(az,e));break;default:Au(t=r[n-1])?r=Au(r[0])?r[0]:r.slice(0,n-1):(r=Au(r[0])?r[0]:r,t=[])}let i=-1,a=-1,o=-1,s=r.length,u,l,[c,f]=e;for(;++o<s;)l=r[o],l instanceof La&&(f[++a]=l)?c[++i]=l.field.clone(t[o],l.type,!0):({[o]:u=o}=t,l instanceof yr&&(f[++a]=l)?c[++i]=Fr.new(u,l,!0):l&&l.type&&(f[++a]=l)&&(l instanceof wt&&(f[a]=l=Br.new(l)),c[++i]=Fr.new(u,l.type,!0)));return e}class Qr{constructor(e=[],t,n){this.fields=e||[],this.metadata=t||new Map,n||(n=A0(e)),this.dictionaries=n}static from(...e){return Qr.new(e[0],e[1])}static new(...e){return new Qr(FE(e)[0])}get[Symbol.toStringTag](){return"Schema"}toString(){return`Schema<{ ${this.fields.map((e,t)=>`${t}: ${e}`).join(", ")} }>`}compareTo(e){return Hi.compareSchemas(this,e)}select(...e){const t=e.reduce((n,i)=>(n[i]=!0)&&n,Object.create(null));return new Qr(this.fields.filter(n=>t[n.name]),this.metadata)}selectAt(...e){return new Qr(e.map(t=>this.fields[t]).filter(Boolean),this.metadata)}assign(...e){const t=e[0]instanceof Qr?e[0]:new Qr(BE(Fr,e)),n=[...this.fields],i=Nv(Nv(new Map,this.metadata),t.metadata),a=t.fields.filter(s=>{const u=n.findIndex(l=>l.name===s.name);return~u?(n[u]=s.clone({metadata:Nv(Nv(new Map,n[u].metadata),s.metadata)}))&&!1:!0}),o=A0(a,new Map);return new Qr([...n,...a],i,new Map([...this.dictionaries,...o]))}}class Fr{constructor(e,t,n=!1,i){this.name=e,this.type=t,this.nullable=n,this.metadata=i||new Map}static new(...e){let[t,n,i,a]=e;return e[0]&&typeof e[0]=="object"&&({name:t}=e[0],n===void 0&&(n=e[0].type),i===void 0&&(i=e[0].nullable),a===void 0&&(a=e[0].metadata)),new Fr(`${t}`,n,i,a)}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}compareTo(e){return Hi.compareField(this,e)}clone(...e){let[t,n,i,a]=e;return!e[0]||typeof e[0]!="object"?[t=this.name,n=this.type,i=this.nullable,a=this.metadata]=e:{name:t=this.name,type:n=this.type,nullable:i=this.nullable,metadata:a=this.metadata}=e[0],Fr.new(t,n,i,a)}}function Nv(r,e){return new Map([...r||new Map,...e||new Map])}function A0(r,e=new Map){for(let t=-1,n=r.length;++t<n;){const a=r[t].type;if(yr.isDictionary(a)){if(!e.has(a.id))e.set(a.id,a.dictionary);else if(e.get(a.id)!==a.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}a.children&&a.children.length>0&&A0(a.children,e)}return e}Qr.prototype.fields=null;Qr.prototype.metadata=null;Qr.prototype.dictionaries=null;Fr.prototype.type=null;Fr.prototype.name=null;Fr.prototype.nullable=null;Fr.prototype.metadata=null;class oz extends Mv{constructor(e){super(e);this._run=new ME,this._offsets=new _E}addChild(e,t="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=e,this.type=new $l(new Fr(t,e.type,!0)),this.numChildren-1}clear(){return this._run.clear(),super.clear()}_flushPending(e){const t=this._run,n=this._offsets,i=this._setValue;let a=0,o;for([a,o]of e)o===void 0?n.set(a,0):(n.set(a,o.length),i(this,a,t.bind(o)))}}class sz extends bn{constructor(){super(...arguments);this._run=new ME}setValue(e,t){super.setValue(e,this._run.bind(t))}addChild(e,t="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");const n=this.children.push(e);return this.type=new xf(this.type.listSize,new Fr(t,e.type,!0)),n}clear(){return this._run.clear(),super.clear()}}class uz extends Mv{set(e,t){return super.set(e,t)}setValue(e,t){t=t instanceof Map?t:new Map(Object.entries(t));const n=this._pending||(this._pending=new Map),i=n.get(e);i&&(this._pendingLength-=i.size),this._pendingLength+=t.size,n.set(e,t)}addChild(e,t=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=e,this.type=new _f(new Fr(t,e.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(e){const t=this._offsets,n=this._setValue;e.forEach((i,a)=>{i===void 0?t.set(a,0):(t.set(a,i.size),n(this,a,i))})}}class lz extends bn{addChild(e,t=`${this.numChildren}`){const n=this.children.push(e);return this.type=new ka([...this.type.children,new Fr(t,e.type,!0)]),n}}class T0 extends bn{constructor(e){super(e);this._typeIds=new Af(new Int8Array(0),1),typeof e.valueToChildTypeId=="function"&&(this._valueToChildTypeId=e.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(e,t){return this.set(this.length,e,t)}set(e,t,n){return n===void 0&&(n=this._valueToChildTypeId(this,t,e)),this.setValid(e,this.isValid(t))&&this.setValue(e,t,n),this}setValue(e,t,n){this._typeIds.set(e,n),super.setValue(e,t)}addChild(e,t=`${this.children.length}`){const n=this.children.push(e),{type:{children:i,mode:a,typeIds:o}}=this,s=[...i,new Fr(t,e.type)];return this.type=new wf(a,[...o,n],s),n}_valueToChildTypeId(e,t,n){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}}class cz extends T0{}class fz extends T0{constructor(e){super(e);this._offsets=new Af(new Int32Array(0))}setValue(e,t,n){const i=this.type.typeIdToChildIndex[n];return this._offsets.set(e,this.getChildAt(i).length),super.setValue(e,t,n)}}class fr extends Ir{}const hz=(r,e,t)=>{r[e]=t/864e5|0},I0=(r,e,t)=>{r[e]=t%4294967296|0,r[e+1]=t/4294967296|0},dz=(r,e,t)=>{r[e]=t*1e3%4294967296|0,r[e+1]=t*1e3/4294967296|0},vz=(r,e,t)=>{r[e]=t*1e6%4294967296|0,r[e+1]=t*1e6/4294967296|0},GE=(r,e,t,n)=>{const{[t]:i,[t+1]:a}=e;i!=null&&a!=null&&r.set(n.subarray(0,a-i),i)},pz=({offset:r,values:e},t,n)=>{const i=r+t;n?e[i>>3]|=1<<i%8:e[i>>3]&=~(1<<i%8)},zE=({values:r},e,t)=>{hz(r,e,t.valueOf())},$E=({values:r},e,t)=>{I0(r,e*2,t.valueOf())},Qa=({stride:r,values:e},t,n)=>{e[r*t]=n},VE=({stride:r,values:e},t,n)=>{e[r*t]=g0(n)},C0=(r,e,t)=>{switch(typeof t){case"bigint":r.values64[e]=t;break;case"number":r.values[e*r.stride]=t;break;default:const n=t,{stride:i,ArrayType:a}=r,o=Tr(a,n);r.values.set(o.subarray(0,i),i*e)}},gz=({stride:r,values:e},t,n)=>{e.set(n.subarray(0,r),r*t)},yz=({values:r,valueOffsets:e},t,n)=>GE(r,e,t,n),mz=({values:r,valueOffsets:e},t,n)=>{GE(r,e,t,pv(n))},bz=(r,e,t)=>{r.type.bitWidth<64?Qa(r,e,t):C0(r,e,t)},wz=(r,e,t)=>{r.type.precision!==la.HALF?Qa(r,e,t):VE(r,e,t)},xz=(r,e,t)=>{r.type.unit===Za.DAY?zE(r,e,t):$E(r,e,t)},jE=({values:r},e,t)=>I0(r,e*2,t/1e3),WE=({values:r},e,t)=>I0(r,e*2,t),XE=({values:r},e,t)=>dz(r,e*2,t),YE=({values:r},e,t)=>vz(r,e*2,t),_z=(r,e,t)=>{switch(r.type.unit){case Zr.SECOND:return jE(r,e,t);case Zr.MILLISECOND:return WE(r,e,t);case Zr.MICROSECOND:return XE(r,e,t);case Zr.NANOSECOND:return YE(r,e,t)}},HE=({values:r,stride:e},t,n)=>{r[e*t]=n},qE=({values:r,stride:e},t,n)=>{r[e*t]=n},KE=({values:r},e,t)=>{r.set(t.subarray(0,2),2*e)},ZE=({values:r},e,t)=>{r.set(t.subarray(0,2),2*e)},Sz=(r,e,t)=>{switch(r.type.unit){case Zr.SECOND:return HE(r,e,t);case Zr.MILLISECOND:return qE(r,e,t);case Zr.MICROSECOND:return KE(r,e,t);case Zr.NANOSECOND:return ZE(r,e,t)}},Ez=({values:r},e,t)=>{r.set(t.subarray(0,4),4*e)},Az=(r,e,t)=>{const n=r.getChildAt(0),i=r.valueOffsets;for(let a=-1,o=i[e],s=i[e+1];o<s;)n.set(o++,t.get(++a))},Tz=(r,e,t)=>{const n=r.getChildAt(0),i=r.valueOffsets,a=t instanceof Map?[...t]:Object.entries(t);for(let o=-1,s=i[e],u=i[e+1];s<u;)n.set(s++,a[++o])},Iz=(r,e)=>(t,n,i)=>t&&t.set(r,e[i]),Cz=(r,e)=>(t,n,i)=>t&&t.set(r,e.get(i)),Mz=(r,e)=>(t,n,i)=>t&&t.set(r,e.get(n.name)),kz=(r,e)=>(t,n,i)=>t&&t.set(r,e[n.name]),Dz=(r,e,t)=>{const n=t instanceof Map?Mz(e,t):t instanceof Br?Cz(e,t):Array.isArray(t)?Iz(e,t):kz(e,t);r.type.children.forEach((i,a)=>n(r.getChildAt(a),i,a))},Lz=(r,e,t)=>{r.type.mode===Oo.Dense?QE(r,e,t):JE(r,e,t)},QE=(r,e,t)=>{const n=r.typeIdToChildIndex[r.typeIds[e]],i=r.getChildAt(n);i&&i.set(r.valueOffsets[e],t)},JE=(r,e,t)=>{const n=r.typeIdToChildIndex[r.typeIds[e]],i=r.getChildAt(n);i&&i.set(e,t)},Nz=(r,e,t)=>{const n=r.getKey(e);n!==null&&r.setValue(n,t)},Oz=(r,e,t)=>{r.type.unit===Rl.DAY_TIME?e2(r,e,t):t2(r,e,t)},e2=({values:r},e,t)=>{r.set(t.subarray(0,2),2*e)},t2=({values:r},e,t)=>{r[e]=t[0]*12+t[1]%12},Pz=(r,e,t)=>{const n=r.getChildAt(0),{stride:i}=r;for(let a=-1,o=e*i;++a<i;)n.set(o+a,t.get(a))};fr.prototype.visitBool=pz;fr.prototype.visitInt=bz;fr.prototype.visitInt8=Qa;fr.prototype.visitInt16=Qa;fr.prototype.visitInt32=Qa;fr.prototype.visitInt64=C0;fr.prototype.visitUint8=Qa;fr.prototype.visitUint16=Qa;fr.prototype.visitUint32=Qa;fr.prototype.visitUint64=C0;fr.prototype.visitFloat=wz;fr.prototype.visitFloat16=VE;fr.prototype.visitFloat32=Qa;fr.prototype.visitFloat64=Qa;fr.prototype.visitUtf8=mz;fr.prototype.visitBinary=yz;fr.prototype.visitFixedSizeBinary=gz;fr.prototype.visitDate=xz;fr.prototype.visitDateDay=zE;fr.prototype.visitDateMillisecond=$E;fr.prototype.visitTimestamp=_z;fr.prototype.visitTimestampSecond=jE;fr.prototype.visitTimestampMillisecond=WE;fr.prototype.visitTimestampMicrosecond=XE;fr.prototype.visitTimestampNanosecond=YE;fr.prototype.visitTime=Sz;fr.prototype.visitTimeSecond=HE;fr.prototype.visitTimeMillisecond=qE;fr.prototype.visitTimeMicrosecond=KE;fr.prototype.visitTimeNanosecond=ZE;fr.prototype.visitDecimal=Ez;fr.prototype.visitList=Az;fr.prototype.visitStruct=Dz;fr.prototype.visitUnion=Lz;fr.prototype.visitDenseUnion=QE;fr.prototype.visitSparseUnion=JE;fr.prototype.visitDictionary=Nz;fr.prototype.visitInterval=Oz;fr.prototype.visitIntervalDayTime=e2;fr.prototype.visitIntervalYearMonth=t2;fr.prototype.visitFixedSizeList=Pz;fr.prototype.visitMap=Tz;const Ov=new fr;class Rz extends Ir{visitNull(){return v6}visitBool(){return d6}visitInt(){return Ro}visitInt8(){return A6}visitInt16(){return T6}visitInt32(){return I6}visitInt64(){return C6}visitUint8(){return M6}visitUint16(){return k6}visitUint32(){return D6}visitUint64(){return L6}visitFloat(){return kv}visitFloat16(){return x6}visitFloat32(){return _6}visitFloat64(){return S6}visitUtf8(){return b0}visitBinary(){return CE}visitFixedSizeBinary(){return b6}visitDate(){return p0}visitDateDay(){return p6}visitDateMillisecond(){return g6}visitTimestamp(){return Mf}visitTimestampSecond(){return B6}visitTimestampMillisecond(){return F6}visitTimestampMicrosecond(){return U6}visitTimestampNanosecond(){return G6}visitTime(){return Cf}visitTimeSecond(){return N6}visitTimeMillisecond(){return O6}visitTimeMicrosecond(){return P6}visitTimeNanosecond(){return R6}visitDecimal(){return y6}visitList(){return oz}visitStruct(){return lz}visitUnion(){return T0}visitDenseUnion(){return fz}visitSparseUnion(){return cz}visitDictionary(){return m6}visitInterval(){return m0}visitIntervalDayTime(){return z6}visitIntervalYearMonth(){return $6}visitFixedSizeList(){return sz}visitMap(){return uz}}const r2=new Rz;bn.new=n2;function n2(r){const e=r.type,t=new(r2.getVisitFn(e)())(r);if(e.children&&e.children.length>0){const n=r.children||[],i={nullValues:r.nullValues},a=Array.isArray(n)?(o,s)=>n[s]||i:({name:o})=>n[o]||i;e.children.forEach((o,s)=>{const{type:u}=o,l=a(o,s);t.children.push(n2(kl(On({},l),{type:u})))})}return t}Object.keys(ue).map(r=>ue[r]).filter(r=>typeof r=="number"&&r!==ue.NONE).forEach(r=>{const e=r2.visit(r);e.prototype._setValue=Ov.getVisitFn(r)});b0.prototype._setValue=Ov.visitBinary;var Yl;(function(r){(function(e){(function(t){(function(n){class i{constructor(){this.bb=null,this.bb_pos=0}__init(o,s){return this.bb_pos=o,this.bb=s,this}static getRootAsFooter(o,s){return(s||new i).__init(o.readInt32(o.position())+o.position(),o)}version(){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.readInt16(this.bb_pos+o):Fe.apache.arrow.flatbuf.MetadataVersion.V1}schema(o){let s=this.bb.__offset(this.bb_pos,6);return s?(o||new Fe.apache.arrow.flatbuf.Schema).__init(this.bb.__indirect(this.bb_pos+s),this.bb):null}dictionaries(o,s){let u=this.bb.__offset(this.bb_pos,8);return u?(s||new r.apache.arrow.flatbuf.Block).__init(this.bb.__vector(this.bb_pos+u)+o*24,this.bb):null}dictionariesLength(){let o=this.bb.__offset(this.bb_pos,8);return o?this.bb.__vector_len(this.bb_pos+o):0}recordBatches(o,s){let u=this.bb.__offset(this.bb_pos,10);return u?(s||new r.apache.arrow.flatbuf.Block).__init(this.bb.__vector(this.bb_pos+u)+o*24,this.bb):null}recordBatchesLength(){let o=this.bb.__offset(this.bb_pos,10);return o?this.bb.__vector_len(this.bb_pos+o):0}static startFooter(o){o.startObject(4)}static addVersion(o,s){o.addFieldInt16(0,s,Fe.apache.arrow.flatbuf.MetadataVersion.V1)}static addSchema(o,s){o.addFieldOffset(1,s,0)}static addDictionaries(o,s){o.addFieldOffset(2,s,0)}static startDictionariesVector(o,s){o.startVector(24,s,8)}static addRecordBatches(o,s){o.addFieldOffset(3,s,0)}static startRecordBatchesVector(o,s){o.startVector(24,s,8)}static endFooter(o){return o.endObject()}static finishFooterBuffer(o,s){o.finish(s)}static createFooter(o,s,u,l,c){return i.startFooter(o),i.addVersion(o,s),i.addSchema(o,u),i.addDictionaries(o,l),i.addRecordBatches(o,c),i.endFooter(o)}}n.Footer=i})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(Yl||(Yl={}));(function(r){(function(e){(function(t){(function(n){class i{constructor(){this.bb=null,this.bb_pos=0}__init(o,s){return this.bb_pos=o,this.bb=s,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static createBlock(o,s,u,l){return o.prep(8,24),o.writeInt64(l),o.pad(4),o.writeInt32(u),o.writeInt64(s),o.offset()}}n.Block=i})(t.flatbuf||(t.flatbuf={}))})(e.arrow||(e.arrow={}))})(r.apache||(r.apache={}))})(Yl||(Yl={}));var i2=Ee.Long,Bz=Ee.Builder,Fz=Ee.ByteBuffer,Uz=Yl.apache.arrow.flatbuf.Block,Ja=Yl.apache.arrow.flatbuf.Footer;class kf{constructor(e,t=Ma.V4,n,i){this.schema=e,this.version=t,n&&(this._recordBatches=n),i&&(this._dictionaryBatches=i)}static decode(e){e=new Fz(Dr(e));const t=Ja.getRootAsFooter(e),n=Qr.decode(t.schema());return new Gz(n,t)}static encode(e){const t=new Bz,n=Qr.encode(t,e.schema);Ja.startRecordBatchesVector(t,e.numRecordBatches),[...e.recordBatches()].slice().reverse().forEach(o=>bs.encode(t,o));const i=t.endVector();Ja.startDictionariesVector(t,e.numDictionaries),[...e.dictionaryBatches()].slice().reverse().forEach(o=>bs.encode(t,o));const a=t.endVector();return Ja.startFooter(t),Ja.addSchema(t,n),Ja.addVersion(t,Ma.V4),Ja.addRecordBatches(t,i),Ja.addDictionaries(t,a),Ja.finishFooterBuffer(t,Ja.endFooter(t)),t.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}*recordBatches(){for(let e,t=-1,n=this.numRecordBatches;++t<n;)(e=this.getRecordBatch(t))&&(yield e)}*dictionaryBatches(){for(let e,t=-1,n=this.numDictionaries;++t<n;)(e=this.getDictionaryBatch(t))&&(yield e)}getRecordBatch(e){return e>=0&&e<this.numRecordBatches&&this._recordBatches[e]||null}getDictionaryBatch(e){return e>=0&&e<this.numDictionaries&&this._dictionaryBatches[e]||null}}class Gz extends kf{constructor(e,t){super(e,t.version());this._footer=t}get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}getRecordBatch(e){if(e>=0&&e<this.numRecordBatches){const t=this._footer.recordBatches(e);if(t)return bs.decode(t)}return null}getDictionaryBatch(e){if(e>=0&&e<this.numDictionaries){const t=this._footer.dictionaries(e);if(t)return bs.decode(t)}return null}}class bs{static decode(e){return new bs(e.metaDataLength(),e.bodyLength(),e.offset())}static encode(e,t){const{metaDataLength:n}=t,i=new i2(t.offset,0),a=new i2(t.bodyLength,0);return Uz.createBlock(e,i,n,a)}constructor(e,t,n){this.metaDataLength=e,this.offset=typeof n=="number"?n:n.low,this.bodyLength=typeof t=="number"?t:t.low}}class Df extends vG{write(e){if((e=Dr(e)).byteLength>0)return super.write(e)}toString(e=!1){return e?Km(this.toUint8Array(!0)):this.toUint8Array(!1).then(Km)}toUint8Array(e=!1){return e?Ia(this._values)[0]:(async()=>{let t=[],n=0;for await(const i of this)t.push(i),n+=i.byteLength;return Ia(t,n)[0]})()}}class Pv{constructor(e){e&&(this.source=new zz(Yi.fromIterable(e)))}[Symbol.iterator](){return this}next(e){return this.source.next(e)}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}peek(e){return this.source.peek(e)}read(e){return this.source.read(e)}}class Tu{constructor(e){e instanceof Tu?this.source=e.source:e instanceof Df?this.source=new Iu(Yi.fromAsyncIterable(e)):lE(e)?this.source=new Iu(Yi.fromNodeStream(e)):Qm(e)?this.source=new Iu(Yi.fromDOMStream(e)):uE(e)?this.source=new Iu(Yi.fromDOMStream(e.body)):Ta(e)?this.source=new Iu(Yi.fromIterable(e)):ps(e)?this.source=new Iu(Yi.fromAsyncIterable(e)):No(e)&&(this.source=new Iu(Yi.fromAsyncIterable(e)))}[Symbol.asyncIterator](){return this}next(e){return this.source.next(e)}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}get closed(){return this.source.closed}cancel(e){return this.source.cancel(e)}peek(e){return this.source.peek(e)}read(e){return this.source.read(e)}}class zz{constructor(e){this.source=e}cancel(e){this.return(e)}peek(e){return this.next(e,"peek").value}read(e){return this.next(e,"read").value}next(e,t="read"){return this.source.next({cmd:t,size:e})}throw(e){return Object.create(this.source.throw&&this.source.throw(e)||mn)}return(e){return Object.create(this.source.return&&this.source.return(e)||mn)}}class Iu{constructor(e){this.source=e,this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}async cancel(e){await this.return(e)}get closed(){return this._closedPromise}async read(e){return(await this.next(e,"read")).value}async peek(e){return(await this.next(e,"peek")).value}async next(e,t="read"){return await this.source.next({cmd:t,size:e})}async throw(e){const t=this.source.throw&&await this.source.throw(e)||mn;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(t)}async return(e){const t=this.source.return&&await this.source.return(e)||mn;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(t)}}class a2 extends Pv{constructor(e,t){super();this.position=0,this.buffer=Dr(e),this.size=typeof t=="undefined"?this.buffer.byteLength:t}readInt32(e){const{buffer:t,byteOffset:n}=this.readAt(e,4);return new DataView(t,n).getInt32(0,!0)}seek(e){return this.position=Math.min(e,this.size),e<this.size}read(e){const{buffer:t,size:n,position:i}=this;return t&&i<n?(typeof e!="number"&&(e=1/0),this.position=Math.min(n,i+Math.min(n-i,e)),t.subarray(i,this.position)):null}readAt(e,t){const n=this.buffer,i=Math.min(this.size,e+t);return n?n.subarray(e,i):new Uint8Array(t)}close(){this.buffer&&(this.buffer=null)}throw(e){return this.close(),{done:!0,value:e}}return(e){return this.close(),{done:!0,value:e}}}class Rv extends Tu{constructor(e,t){super();this.position=0,this._handle=e,typeof t=="number"?this.size=t:this._pending=(async()=>{this.size=(await e.stat()).size,delete this._pending})()}async readInt32(e){const{buffer:t,byteOffset:n}=await this.readAt(e,4);return new DataView(t,n).getInt32(0,!0)}async seek(e){return this._pending&&await this._pending,this.position=Math.min(e,this.size),e<this.size}async read(e){this._pending&&await this._pending;const{_handle:t,size:n,position:i}=this;if(t&&i<n){typeof e!="number"&&(e=1/0);let a=i,o=0,s=0,u=Math.min(n,a+Math.min(n-a,e)),l=new Uint8Array(Math.max(0,(this.position=u)-a));for(;(a+=s)<u&&(o+=s)<l.byteLength;)({bytesRead:s}=await t.read(l,o,l.byteLength-o,a));return l}return null}async readAt(e,t){this._pending&&await this._pending;const{_handle:n,size:i}=this;if(n&&e+t<i){const a=Math.min(i,e+t),o=new Uint8Array(a-e);return(await n.read(o,0,t,e)).buffer}return new Uint8Array(t)}async close(){const e=this._handle;this._handle=null,e&&await e.close()}async throw(e){return await this.close(),{done:!0,value:e}}async return(e){return await this.close(),{done:!0,value:e}}}const $z=1<<16;function Hl(r){return r<0&&(r=4294967295+r+1),`0x${r.toString(16)}`}const ql=8,M0=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8];class k0{constructor(e){this.buffer=e}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(e){const t=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([e.buffer[1]>>>16,e.buffer[1]&65535,e.buffer[0]>>>16,e.buffer[0]&65535]);let i=t[3]*n[3];this.buffer[0]=i&65535;let a=i>>>16;return i=t[2]*n[3],a+=i,i=t[3]*n[2]>>>0,a+=i,this.buffer[0]+=a<<16,this.buffer[1]=a>>>0<i?$z:0,this.buffer[1]+=a>>>16,this.buffer[1]+=t[1]*n[3]+t[2]*n[2]+t[3]*n[1],this.buffer[1]+=t[0]*n[3]+t[1]*n[2]+t[2]*n[1]+t[3]*n[0]<<16,this}_plus(e){const t=this.buffer[0]+e.buffer[0]>>>0;this.buffer[1]+=e.buffer[1],t<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=t}lessThan(e){return this.buffer[1]<e.buffer[1]||this.buffer[1]===e.buffer[1]&&this.buffer[0]<e.buffer[0]}equals(e){return this.buffer[1]===e.buffer[1]&&this.buffer[0]==e.buffer[0]}greaterThan(e){return e.lessThan(this)}hex(){return`${Hl(this.buffer[1])} ${Hl(this.buffer[0])}`}}class Xr extends k0{times(e){return this._times(e),this}plus(e){return this._plus(e),this}static from(e,t=new Uint32Array(2)){return Xr.fromString(typeof e=="string"?e:e.toString(),t)}static fromNumber(e,t=new Uint32Array(2)){return Xr.fromString(e.toString(),t)}static fromString(e,t=new Uint32Array(2)){const n=e.length;let i=new Xr(t);for(let a=0;a<n;){const o=ql<n-a?ql:n-a,s=new Xr(new Uint32Array([parseInt(e.substr(a,o),10),0])),u=new Xr(new Uint32Array([M0[o],0]));i.times(u),i.plus(s),a+=o}return i}static convertArray(e){const t=new Uint32Array(e.length*2);for(let n=-1,i=e.length;++n<i;)Xr.from(e[n],new Uint32Array(t.buffer,t.byteOffset+2*n*4,2));return t}static multiply(e,t){return new Xr(new Uint32Array(e.buffer)).times(t)}static add(e,t){return new Xr(new Uint32Array(e.buffer)).plus(t)}}class Ei extends k0{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(e){return this._times(e),this}plus(e){return this._plus(e),this}lessThan(e){const t=this.buffer[1]<<0,n=e.buffer[1]<<0;return t<n||t===n&&this.buffer[0]<e.buffer[0]}static from(e,t=new Uint32Array(2)){return Ei.fromString(typeof e=="string"?e:e.toString(),t)}static fromNumber(e,t=new Uint32Array(2)){return Ei.fromString(e.toString(),t)}static fromString(e,t=new Uint32Array(2)){const n=e.startsWith("-"),i=e.length;let a=new Ei(t);for(let o=n?1:0;o<i;){const s=ql<i-o?ql:i-o,u=new Ei(new Uint32Array([parseInt(e.substr(o,s),10),0])),l=new Ei(new Uint32Array([M0[s],0]));a.times(l),a.plus(u),o+=s}return n?a.negate():a}static convertArray(e){const t=new Uint32Array(e.length*2);for(let n=-1,i=e.length;++n<i;)Ei.from(e[n],new Uint32Array(t.buffer,t.byteOffset+2*n*4,2));return t}static multiply(e,t){return new Ei(new Uint32Array(e.buffer)).times(t)}static add(e,t){return new Ei(new Uint32Array(e.buffer)).plus(t)}}class Na{constructor(e){this.buffer=e}high(){return new Ei(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new Ei(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(e){const t=new Xr(new Uint32Array([this.buffer[3],0])),n=new Xr(new Uint32Array([this.buffer[2],0])),i=new Xr(new Uint32Array([this.buffer[1],0])),a=new Xr(new Uint32Array([this.buffer[0],0])),o=new Xr(new Uint32Array([e.buffer[3],0])),s=new Xr(new Uint32Array([e.buffer[2],0])),u=new Xr(new Uint32Array([e.buffer[1],0])),l=new Xr(new Uint32Array([e.buffer[0],0]));let c=Xr.multiply(a,l);this.buffer[0]=c.low();let f=new Xr(new Uint32Array([c.high(),0]));return c=Xr.multiply(i,l),f.plus(c),c=Xr.multiply(a,u),f.plus(c),this.buffer[1]=f.low(),this.buffer[3]=f.lessThan(c)?1:0,this.buffer[2]=f.high(),new Xr(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(Xr.multiply(n,l)).plus(Xr.multiply(i,u)).plus(Xr.multiply(a,s)),this.buffer[3]+=Xr.multiply(t,l).plus(Xr.multiply(n,u)).plus(Xr.multiply(i,s)).plus(Xr.multiply(a,o)).low(),this}plus(e){let t=new Uint32Array(4);return t[3]=this.buffer[3]+e.buffer[3]>>>0,t[2]=this.buffer[2]+e.buffer[2]>>>0,t[1]=this.buffer[1]+e.buffer[1]>>>0,t[0]=this.buffer[0]+e.buffer[0]>>>0,t[0]<this.buffer[0]>>>0&&++t[1],t[1]<this.buffer[1]>>>0&&++t[2],t[2]<this.buffer[2]>>>0&&++t[3],this.buffer[3]=t[3],this.buffer[2]=t[2],this.buffer[1]=t[1],this.buffer[0]=t[0],this}hex(){return`${Hl(this.buffer[3])} ${Hl(this.buffer[2])} ${Hl(this.buffer[1])} ${Hl(this.buffer[0])}`}static multiply(e,t){return new Na(new Uint32Array(e.buffer)).times(t)}static add(e,t){return new Na(new Uint32Array(e.buffer)).plus(t)}static from(e,t=new Uint32Array(4)){return Na.fromString(typeof e=="string"?e:e.toString(),t)}static fromNumber(e,t=new Uint32Array(4)){return Na.fromString(e.toString(),t)}static fromString(e,t=new Uint32Array(4)){const n=e.startsWith("-"),i=e.length;let a=new Na(t);for(let o=n?1:0;o<i;){const s=ql<i-o?ql:i-o,u=new Na(new Uint32Array([parseInt(e.substr(o,s),10),0,0,0])),l=new Na(new Uint32Array([M0[s],0,0,0]));a.times(l),a.plus(u),o+=s}return n?a.negate():a}static convertArray(e){const t=new Uint32Array(e.length*4);for(let n=-1,i=e.length;++n<i;)Na.from(e[n],new Uint32Array(t.buffer,t.byteOffset+4*4*n,4));return t}}var Vz=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",BaseInt64:k0,Uint64:Xr,Int64:Ei,Int128:Na});class o2 extends Ir{constructor(e,t,n,i){super();this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=e,this.nodes=t,this.buffers=n,this.dictionaries=i}visit(e){return super.visit(e instanceof Fr?e.type:e)}visitNull(e,{length:t}=this.nextFieldNode()){return wt.Null(e,0,t)}visitBool(e,{length:t,nullCount:n}=this.nextFieldNode()){return wt.Bool(e,0,t,n,this.readNullBitmap(e,n),this.readData(e))}visitInt(e,{length:t,nullCount:n}=this.nextFieldNode()){return wt.Int(e,0,t,n,this.readNullBitmap(e,n),this.readData(e))}visitFloat(e,{length:t,nullCount:n}=this.nextFieldNode()){return wt.Float(e,0,t,n,this.readNullBitmap(e,n),this.readData(e))}visitUtf8(e,{length:t,nullCount:n}=this.nextFieldNode()){return wt.Utf8(e,0,t,n,this.readNullBitmap(e,n),this.readOffsets(e),this.readData(e))}visitBinary(e,{length:t,nullCount:n}=this.nextFieldNode()){return wt.Binary(e,0,t,n,this.readNullBitmap(e,n),this.readOffsets(e),this.readData(e))}visitFixedSizeBinary(e,{length:t,nullCount:n}=this.nextFieldNode()){return wt.FixedSizeBinary(e,0,t,n,this.readNullBitmap(e,n),this.readData(e))}visitDate(e,{length:t,nullCount:n}=this.nextFieldNode()){return wt.Date(e,0,t,n,this.readNullBitmap(e,n),this.readData(e))}visitTimestamp(e,{length:t,nullCount:n}=this.nextFieldNode()){return wt.Timestamp(e,0,t,n,this.readNullBitmap(e,n),this.readData(e))}visitTime(e,{length:t,nullCount:n}=this.nextFieldNode()){return wt.Time(e,0,t,n,this.readNullBitmap(e,n),this.readData(e))}visitDecimal(e,{length:t,nullCount:n}=this.nextFieldNode()){return wt.Decimal(e,0,t,n,this.readNullBitmap(e,n),this.readData(e))}visitList(e,{length:t,nullCount:n}=this.nextFieldNode()){return wt.List(e,0,t,n,this.readNullBitmap(e,n),this.readOffsets(e),this.visit(e.children[0]))}visitStruct(e,{length:t,nullCount:n}=this.nextFieldNode()){return wt.Struct(e,0,t,n,this.readNullBitmap(e,n),this.visitMany(e.children))}visitUnion(e){return e.mode===Oo.Sparse?this.visitSparseUnion(e):this.visitDenseUnion(e)}visitDenseUnion(e,{length:t,nullCount:n}=this.nextFieldNode()){return wt.Union(e,0,t,n,this.readNullBitmap(e,n),this.readTypeIds(e),this.readOffsets(e),this.visitMany(e.children))}visitSparseUnion(e,{length:t,nullCount:n}=this.nextFieldNode()){return wt.Union(e,0,t,n,this.readNullBitmap(e,n),this.readTypeIds(e),this.visitMany(e.children))}visitDictionary(e,{length:t,nullCount:n}=this.nextFieldNode()){return wt.Dictionary(e,0,t,n,this.readNullBitmap(e,n),this.readData(e.indices),this.readDictionary(e))}visitInterval(e,{length:t,nullCount:n}=this.nextFieldNode()){return wt.Interval(e,0,t,n,this.readNullBitmap(e,n),this.readData(e))}visitFixedSizeList(e,{length:t,nullCount:n}=this.nextFieldNode()){return wt.FixedSizeList(e,0,t,n,this.readNullBitmap(e,n),this.visit(e.children[0]))}visitMap(e,{length:t,nullCount:n}=this.nextFieldNode()){return wt.Map(e,0,t,n,this.readNullBitmap(e,n),this.readOffsets(e),this.visit(e.children[0]))}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(e,t,n=this.nextBufferRange()){return t>0&&this.readData(e,n)||new Uint8Array(0)}readOffsets(e,t){return this.readData(e,t)}readTypeIds(e,t){return this.readData(e,t)}readData(e,{length:t,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+t)}readDictionary(e){return this.dictionaries.get(e.id)}}class jz extends o2{constructor(e,t,n,i){super(new Uint8Array(0),t,n,i);this.sources=e}readNullBitmap(e,t,{offset:n}=this.nextBufferRange()){return t<=0?new Uint8Array(0):df(this.sources[n])}readOffsets(e,{offset:t}=this.nextBufferRange()){return Tr(Uint8Array,Tr(Int32Array,this.sources[t]))}readTypeIds(e,{offset:t}=this.nextBufferRange()){return Tr(Uint8Array,Tr(e.ArrayType,this.sources[t]))}readData(e,{offset:t}=this.nextBufferRange()){const{sources:n}=this;return yr.isTimestamp(e)||(yr.isInt(e)||yr.isTime(e))&&e.bitWidth===64||yr.isDate(e)&&e.unit===Za.MILLISECOND?Tr(Uint8Array,Ei.convertArray(n[t])):yr.isDecimal(e)?Tr(Uint8Array,Na.convertArray(n[t])):yr.isBinary(e)||yr.isFixedSizeBinary(e)?Wz(n[t]):yr.isBool(e)?df(n[t]):yr.isUtf8(e)?pv(n[t].join("")):Tr(Uint8Array,Tr(e.ArrayType,n[t].map(i=>+i)))}}function Wz(r){const e=r.join(""),t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)t[n>>1]=parseInt(e.substr(n,2),16);return t}var Xz=Ee.Long,s2=Fe.apache.arrow.flatbuf.Null,Bv=Fe.apache.arrow.flatbuf.Int,D0=Fe.apache.arrow.flatbuf.FloatingPoint,u2=Fe.apache.arrow.flatbuf.Binary,l2=Fe.apache.arrow.flatbuf.Bool,c2=Fe.apache.arrow.flatbuf.Utf8,Fv=Fe.apache.arrow.flatbuf.Decimal,L0=Fe.apache.arrow.flatbuf.Date,Uv=Fe.apache.arrow.flatbuf.Time,Gv=Fe.apache.arrow.flatbuf.Timestamp,N0=Fe.apache.arrow.flatbuf.Interval,f2=Fe.apache.arrow.flatbuf.List,h2=Fe.apache.arrow.flatbuf.Struct_,Kl=Fe.apache.arrow.flatbuf.Union,Lf=Fe.apache.arrow.flatbuf.DictionaryEncoding,O0=Fe.apache.arrow.flatbuf.FixedSizeBinary,P0=Fe.apache.arrow.flatbuf.FixedSizeList,R0=Fe.apache.arrow.flatbuf.Map;class Yz extends Ir{visit(e,t){return e==null||t==null?void 0:super.visit(e,t)}visitNull(e,t){return s2.startNull(t),s2.endNull(t)}visitInt(e,t){return Bv.startInt(t),Bv.addBitWidth(t,e.bitWidth),Bv.addIsSigned(t,e.isSigned),Bv.endInt(t)}visitFloat(e,t){return D0.startFloatingPoint(t),D0.addPrecision(t,e.precision),D0.endFloatingPoint(t)}visitBinary(e,t){return u2.startBinary(t),u2.endBinary(t)}visitBool(e,t){return l2.startBool(t),l2.endBool(t)}visitUtf8(e,t){return c2.startUtf8(t),c2.endUtf8(t)}visitDecimal(e,t){return Fv.startDecimal(t),Fv.addScale(t,e.scale),Fv.addPrecision(t,e.precision),Fv.endDecimal(t)}visitDate(e,t){return L0.startDate(t),L0.addUnit(t,e.unit),L0.endDate(t)}visitTime(e,t){return Uv.startTime(t),Uv.addUnit(t,e.unit),Uv.addBitWidth(t,e.bitWidth),Uv.endTime(t)}visitTimestamp(e,t){const n=e.timezone&&t.createString(e.timezone)||void 0;return Gv.startTimestamp(t),Gv.addUnit(t,e.unit),n!==void 0&&Gv.addTimezone(t,n),Gv.endTimestamp(t)}visitInterval(e,t){return N0.startInterval(t),N0.addUnit(t,e.unit),N0.endInterval(t)}visitList(e,t){return f2.startList(t),f2.endList(t)}visitStruct(e,t){return h2.startStruct_(t),h2.endStruct_(t)}visitUnion(e,t){Kl.startTypeIdsVector(t,e.typeIds.length);const n=Kl.createTypeIdsVector(t,e.typeIds);return Kl.startUnion(t),Kl.addMode(t,e.mode),Kl.addTypeIds(t,n),Kl.endUnion(t)}visitDictionary(e,t){const n=this.visit(e.indices,t);return Lf.startDictionaryEncoding(t),Lf.addId(t,new Xz(e.id,0)),Lf.addIsOrdered(t,e.isOrdered),n!==void 0&&Lf.addIndexType(t,n),Lf.endDictionaryEncoding(t)}visitFixedSizeBinary(e,t){return O0.startFixedSizeBinary(t),O0.addByteWidth(t,e.byteWidth),O0.endFixedSizeBinary(t)}visitFixedSizeList(e,t){return P0.startFixedSizeList(t),P0.addListSize(t,e.listSize),P0.endFixedSizeList(t)}visitMap(e,t){return R0.startMap(t),R0.addKeysSorted(t,e.keysSorted),R0.endMap(t)}}const B0=new Yz;function Hz(r,e=new Map){return new Qr(Kz(r,e),zv(r.customMetadata),e)}function d2(r){return new Zi(r.count,p2(r.columns),g2(r.columns))}function qz(r){return new eo(d2(r.data),r.id,r.isDelta)}function Kz(r,e){return(r.fields||[]).filter(Boolean).map(t=>Fr.fromJSON(t,e))}function v2(r,e){return(r.children||[]).filter(Boolean).map(t=>Fr.fromJSON(t,e))}function p2(r){return(r||[]).reduce((e,t)=>[...e,new Mu(t.count,Zz(t.VALIDITY)),...p2(t.children)],[])}function g2(r,e=[]){for(let t=-1,n=(r||[]).length;++t<n;){const i=r[t];i.VALIDITY&&e.push(new to(e.length,i.VALIDITY.length)),i.TYPE&&e.push(new to(e.length,i.TYPE.length)),i.OFFSET&&e.push(new to(e.length,i.OFFSET.length)),i.DATA&&e.push(new to(e.length,i.DATA.length)),e=g2(i.children,e)}return e}function Zz(r){return(r||[]).reduce((e,t)=>e+ +(t===0),0)}function Qz(r,e){let t,n,i,a,o,s;return!e||!(a=r.dictionary)?(o=m2(r,v2(r,e)),i=new Fr(r.name,o,r.nullable,zv(r.customMetadata))):e.has(t=a.id)?(n=(n=a.indexType)?y2(n):new xu,s=new gs(e.get(t),n,t,a.isOrdered),i=new Fr(r.name,s,r.nullable,zv(r.customMetadata))):(n=(n=a.indexType)?y2(n):new xu,e.set(t,o=m2(r,v2(r,e))),s=new gs(o,n,t,a.isOrdered),i=new Fr(r.name,s,r.nullable,zv(r.customMetadata))),i||null}function zv(r){return new Map(Object.entries(r||{}))}function y2(r){return new Pi(r.isSigned,r.bitWidth)}function m2(r,e){const t=r.type.name;switch(t){case"NONE":return new Bl;case"null":return new Bl;case"binary":return new mf;case"utf8":return new Gl;case"bool":return new bf;case"list":return new $l((e||[])[0]);case"struct":return new ka(e||[]);case"struct_":return new ka(e||[])}switch(t){case"int":{const n=r.type;return new Pi(n.isSigned,n.bitWidth)}case"floatingpoint":{const n=r.type;return new _u(la[n.precision])}case"decimal":{const n=r.type;return new Ev(n.scale,n.precision)}case"date":{const n=r.type;return new zl(Za[n.unit])}case"time":{const n=r.type;return new Av(Zr[n.unit],n.bitWidth)}case"timestamp":{const n=r.type;return new Tv(Zr[n.unit],n.timezone)}case"interval":{const n=r.type;return new Iv(Rl[n.unit])}case"union":{const n=r.type;return new wf(Oo[n.mode],n.typeIds||[],e||[])}case"fixedsizebinary":{const n=r.type;return new Cv(n.byteWidth)}case"fixedsizelist":{const n=r.type;return new xf(n.listSize,(e||[])[0])}case"map":{const n=r.type;return new _f((e||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${t}"`)}var Cu=Ee.Long,Jz=Ee.Builder,e8=Ee.ByteBuffer,zn=Fe.apache.arrow.flatbuf.Type,Oa=Fe.apache.arrow.flatbuf.Field,Fo=Fe.apache.arrow.flatbuf.Schema,t8=Fe.apache.arrow.flatbuf.Buffer,ws=ai.apache.arrow.flatbuf.Message,xs=Fe.apache.arrow.flatbuf.KeyValue,r8=ai.apache.arrow.flatbuf.FieldNode,b2=Fe.apache.arrow.flatbuf.Endianness,_s=ai.apache.arrow.flatbuf.RecordBatch,Zl=ai.apache.arrow.flatbuf.DictionaryBatch;class Ai{constructor(e,t,n,i){this._version=t,this._headerType=n,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=typeof e=="number"?e:e.low}static fromJSON(e,t){const n=new Ai(0,Ma.V4,t);return n._createHeader=n8(e,t),n}static decode(e){e=new e8(Dr(e));const t=ws.getRootAsMessage(e),n=t.bodyLength(),i=t.version(),a=t.headerType(),o=new Ai(n,i,a);return o._createHeader=i8(t,a),o}static encode(e){let t=new Jz,n=-1;return e.isSchema()?n=Qr.encode(t,e.header()):e.isRecordBatch()?n=Zi.encode(t,e.header()):e.isDictionaryBatch()&&(n=eo.encode(t,e.header())),ws.startMessage(t),ws.addVersion(t,Ma.V4),ws.addHeader(t,n),ws.addHeaderType(t,e.headerType),ws.addBodyLength(t,new Cu(e.bodyLength,0)),ws.finishMessageBuffer(t,ws.endMessage(t)),t.asUint8Array()}static from(e,t=0){if(e instanceof Qr)return new Ai(0,Ma.V4,en.Schema,e);if(e instanceof Zi)return new Ai(t,Ma.V4,en.RecordBatch,e);if(e instanceof eo)return new Ai(t,Ma.V4,en.DictionaryBatch,e);throw new Error(`Unrecognized Message header: ${e}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===en.Schema}isRecordBatch(){return this.headerType===en.RecordBatch}isDictionaryBatch(){return this.headerType===en.DictionaryBatch}}class Zi{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(e,t,n){this._nodes=t,this._buffers=n,this._length=typeof e=="number"?e:e.low}}class eo{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(e,t,n=!1){this._data=e,this._isDelta=n,this._id=typeof t=="number"?t:t.low}}class to{constructor(e,t){this.offset=typeof e=="number"?e:e.low,this.length=typeof t=="number"?t:t.low}}class Mu{constructor(e,t){this.length=typeof e=="number"?e:e.low,this.nullCount=typeof t=="number"?t:t.low}}function n8(r,e){return()=>{switch(e){case en.Schema:return Qr.fromJSON(r);case en.RecordBatch:return Zi.fromJSON(r);case en.DictionaryBatch:return eo.fromJSON(r)}throw new Error(`Unrecognized Message type: { name: ${en[e]}, type: ${e} }`)}}function i8(r,e){return()=>{switch(e){case en.Schema:return Qr.decode(r.header(new Fo));case en.RecordBatch:return Zi.decode(r.header(new _s),r.version());case en.DictionaryBatch:return eo.decode(r.header(new Zl),r.version())}throw new Error(`Unrecognized Message type: { name: ${en[e]}, type: ${e} }`)}}Fr.encode=p8;Fr.decode=d8;Fr.fromJSON=Qz;Qr.encode=v8;Qr.decode=a8;Qr.fromJSON=Hz;Zi.encode=g8;Zi.decode=o8;Zi.fromJSON=d2;eo.encode=y8;eo.decode=s8;eo.fromJSON=qz;Mu.encode=m8;Mu.decode=l8;to.encode=b8;to.decode=u8;function a8(r,e=new Map){const t=h8(r,e);return new Qr(t,$v(r),e)}function o8(r,e=Ma.V4){return new Zi(r.length(),c8(r),f8(r,e))}function s8(r,e=Ma.V4){return new eo(Zi.decode(r.data(),e),r.id(),r.isDelta())}function u8(r){return new to(r.offset(),r.length())}function l8(r){return new Mu(r.length(),r.nullCount())}function c8(r){const e=[];for(let t,n=-1,i=-1,a=r.nodesLength();++n<a;)(t=r.nodes(n))&&(e[++i]=Mu.decode(t));return e}function f8(r,e){const t=[];for(let n,i=-1,a=-1,o=r.buffersLength();++i<o;)(n=r.buffers(i))&&(e<Ma.V4&&(n.bb_pos+=8*(i+1)),t[++a]=to.decode(n));return t}function h8(r,e){const t=[];for(let n,i=-1,a=-1,o=r.fieldsLength();++i<o;)(n=r.fields(i))&&(t[++a]=Fr.decode(n,e));return t}function w2(r,e){const t=[];for(let n,i=-1,a=-1,o=r.childrenLength();++i<o;)(n=r.children(i))&&(t[++a]=Fr.decode(n,e));return t}function d8(r,e){let t,n,i,a,o,s;return!e||!(s=r.dictionary())?(i=_2(r,w2(r,e)),n=new Fr(r.name(),i,r.nullable(),$v(r))):e.has(t=s.id().low)?(a=(a=s.indexType())?x2(a):new xu,o=new gs(e.get(t),a,t,s.isOrdered()),n=new Fr(r.name(),o,r.nullable(),$v(r))):(a=(a=s.indexType())?x2(a):new xu,e.set(t,i=_2(r,w2(r,e))),o=new gs(i,a,t,s.isOrdered()),n=new Fr(r.name(),o,r.nullable(),$v(r))),n||null}function $v(r){const e=new Map;if(r)for(let t,n,i=-1,a=r.customMetadataLength()|0;++i<a;)(t=r.customMetadata(i))&&(n=t.key())!=null&&e.set(n,t.value());return e}function x2(r){return new Pi(r.isSigned(),r.bitWidth())}function _2(r,e){const t=r.typeType();switch(t){case zn.NONE:return new Bl;case zn.Null:return new Bl;case zn.Binary:return new mf;case zn.Utf8:return new Gl;case zn.Bool:return new bf;case zn.List:return new $l((e||[])[0]);case zn.Struct_:return new ka(e||[])}switch(t){case zn.Int:{const n=r.type(new Fe.apache.arrow.flatbuf.Int);return new Pi(n.isSigned(),n.bitWidth())}case zn.FloatingPoint:{const n=r.type(new Fe.apache.arrow.flatbuf.FloatingPoint);return new _u(n.precision())}case zn.Decimal:{const n=r.type(new Fe.apache.arrow.flatbuf.Decimal);return new Ev(n.scale(),n.precision())}case zn.Date:{const n=r.type(new Fe.apache.arrow.flatbuf.Date);return new zl(n.unit())}case zn.Time:{const n=r.type(new Fe.apache.arrow.flatbuf.Time);return new Av(n.unit(),n.bitWidth())}case zn.Timestamp:{const n=r.type(new Fe.apache.arrow.flatbuf.Timestamp);return new Tv(n.unit(),n.timezone())}case zn.Interval:{const n=r.type(new Fe.apache.arrow.flatbuf.Interval);return new Iv(n.unit())}case zn.Union:{const n=r.type(new Fe.apache.arrow.flatbuf.Union);return new wf(n.mode(),n.typeIdsArray()||[],e||[])}case zn.FixedSizeBinary:{const n=r.type(new Fe.apache.arrow.flatbuf.FixedSizeBinary);return new Cv(n.byteWidth())}case zn.FixedSizeList:{const n=r.type(new Fe.apache.arrow.flatbuf.FixedSizeList);return new xf(n.listSize(),(e||[])[0])}case zn.Map:{const n=r.type(new Fe.apache.arrow.flatbuf.Map);return new _f((e||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${zn[t]}" (${t})`)}function v8(r,e){const t=e.fields.map(a=>Fr.encode(r,a));Fo.startFieldsVector(r,t.length);const n=Fo.createFieldsVector(r,t),i=e.metadata&&e.metadata.size>0?Fo.createCustomMetadataVector(r,[...e.metadata].map(([a,o])=>{const s=r.createString(`${a}`),u=r.createString(`${o}`);return xs.startKeyValue(r),xs.addKey(r,s),xs.addValue(r,u),xs.endKeyValue(r)})):-1;return Fo.startSchema(r),Fo.addFields(r,n),Fo.addEndianness(r,w8?b2.Little:b2.Big),i!==-1&&Fo.addCustomMetadata(r,i),Fo.endSchema(r)}function p8(r,e){let t=-1,n=-1,i=-1,a=e.type,o=e.typeId;yr.isDictionary(a)?(o=a.dictionary.typeId,i=B0.visit(a,r),n=B0.visit(a.dictionary,r)):n=B0.visit(a,r);const s=(a.children||[]).map(c=>Fr.encode(r,c)),u=Oa.createChildrenVector(r,s),l=e.metadata&&e.metadata.size>0?Oa.createCustomMetadataVector(r,[...e.metadata].map(([c,f])=>{const d=r.createString(`${c}`),h=r.createString(`${f}`);return xs.startKeyValue(r),xs.addKey(r,d),xs.addValue(r,h),xs.endKeyValue(r)})):-1;return e.name&&(t=r.createString(e.name)),Oa.startField(r),Oa.addType(r,n),Oa.addTypeType(r,o),Oa.addChildren(r,u),Oa.addNullable(r,!!e.nullable),t!==-1&&Oa.addName(r,t),i!==-1&&Oa.addDictionary(r,i),l!==-1&&Oa.addCustomMetadata(r,l),Oa.endField(r)}function g8(r,e){const t=e.nodes||[],n=e.buffers||[];_s.startNodesVector(r,t.length),t.slice().reverse().forEach(o=>Mu.encode(r,o));const i=r.endVector();_s.startBuffersVector(r,n.length),n.slice().reverse().forEach(o=>to.encode(r,o));const a=r.endVector();return _s.startRecordBatch(r),_s.addLength(r,new Cu(e.length,0)),_s.addNodes(r,i),_s.addBuffers(r,a),_s.endRecordBatch(r)}function y8(r,e){const t=Zi.encode(r,e.data);return Zl.startDictionaryBatch(r),Zl.addId(r,new Cu(e.id,0)),Zl.addIsDelta(r,e.isDelta),Zl.addData(r,t),Zl.endDictionaryBatch(r)}function m8(r,e){return r8.createFieldNode(r,new Cu(e.length,0),new Cu(e.nullCount,0))}function b8(r,e){return t8.createBuffer(r,new Cu(e.offset,0),new Cu(e.length,0))}const w8=function(){const r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256}();var S2=Ee.ByteBuffer;const F0=r=>`Expected ${en[r]} Message in stream, but was null or length 0.`,U0=r=>`Header pointer of flatbuffer-encoded ${en[r]} Message is null or length 0.`,E2=(r,e)=>`Expected to read ${r} metadata bytes, but only read ${e}.`,A2=(r,e)=>`Expected to read ${r} bytes for message body, but only read ${e}.`;class T2{constructor(e){this.source=e instanceof Pv?e:new Pv(e)}[Symbol.iterator](){return this}next(){let e;return(e=this.readMetadataLength()).done||e.value===-1&&(e=this.readMetadataLength()).done||(e=this.readMetadata(e.value)).done?mn:e}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}readMessage(e){let t;if((t=this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw new Error(F0(e));return t.value}readMessageBody(e){if(e<=0)return new Uint8Array(0);const t=Dr(this.source.read(e));if(t.byteLength<e)throw new Error(A2(e,t.byteLength));return t.byteOffset%8==0&&t.byteOffset+t.byteLength<=t.buffer.byteLength?t:t.slice()}readSchema(e=!1){const t=en.Schema,n=this.readMessage(t),i=n&&n.header();if(e&&!i)throw new Error(U0(t));return i}readMetadataLength(){const e=this.source.read(Vv),t=e&&new S2(e),n=t&&t.readInt32(0)||0;return{done:n===0,value:n}}readMetadata(e){const t=this.source.read(e);if(!t)return mn;if(t.byteLength<e)throw new Error(E2(e,t.byteLength));return{done:!1,value:Ai.decode(t)}}}class x8{constructor(e,t){this.source=e instanceof Tu?e:sE(e)?new Rv(e,t):new Tu(e)}[Symbol.asyncIterator](){return this}async next(){let e;return(e=await this.readMetadataLength()).done||e.value===-1&&(e=await this.readMetadataLength()).done||(e=await this.readMetadata(e.value)).done?mn:e}async throw(e){return await this.source.throw(e)}async return(e){return await this.source.return(e)}async readMessage(e){let t;if((t=await this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw new Error(F0(e));return t.value}async readMessageBody(e){if(e<=0)return new Uint8Array(0);const t=Dr(await this.source.read(e));if(t.byteLength<e)throw new Error(A2(e,t.byteLength));return t.byteOffset%8==0&&t.byteOffset+t.byteLength<=t.buffer.byteLength?t:t.slice()}async readSchema(e=!1){const t=en.Schema,n=await this.readMessage(t),i=n&&n.header();if(e&&!i)throw new Error(U0(t));return i}async readMetadataLength(){const e=await this.source.read(Vv),t=e&&new S2(e),n=t&&t.readInt32(0)||0;return{done:n===0,value:n}}async readMetadata(e){const t=await this.source.read(e);if(!t)return mn;if(t.byteLength<e)throw new Error(E2(e,t.byteLength));return{done:!1,value:Ai.decode(t)}}}class _8 extends T2{constructor(e){super(new Uint8Array(0));this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=e instanceof iE?e:new iE(e)}next(){const{_json:e}=this;if(!this._schema){this._schema=!0;const t=Ai.fromJSON(e.schema,en.Schema);return{done:!1,value:t}}if(this._dictionaryIndex<e.dictionaries.length){const t=e.dictionaries[this._dictionaryIndex++];this._body=t.data.columns;const n=Ai.fromJSON(t,en.DictionaryBatch);return{done:!1,value:n}}if(this._batchIndex<e.batches.length){const t=e.batches[this._batchIndex++];this._body=t.columns;const n=Ai.fromJSON(t,en.RecordBatch);return{done:!1,value:n}}return this._body=[],mn}readMessageBody(e){return t(this._body);function t(n){return(n||[]).reduce((i,a)=>[...i,...a.VALIDITY&&[a.VALIDITY]||[],...a.TYPE&&[a.TYPE]||[],...a.OFFSET&&[a.OFFSET]||[],...a.DATA&&[a.DATA]||[],...t(a.children)],[])}}readMessage(e){let t;if((t=this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw new Error(F0(e));return t.value}readSchema(){const e=en.Schema,t=this.readMessage(e),n=t&&t.header();if(!t||!n)throw new Error(U0(e));return n}}const Vv=4,G0="ARROW1",Nf=new Uint8Array(G0.length);for(let r=0;r<G0.length;r+=1|0)Nf[r]=G0.charCodeAt(r);function z0(r,e=0){for(let t=-1,n=Nf.length;++t<n;)if(Nf[t]!==r[e+t])return!1;return!0}const Of=Nf.length,I2=Of+Vv,S8=Of*2+Vv;class Pn extends Ir{constructor(){super();this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}static assemble(...e){const t=new Pn,n=iz(Ri,e),[i=t]=t.visitMany(n);return i}visit(e){if(!yr.isDictionary(e.type)){const{data:t,length:n,nullCount:i}=e;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");yr.isNull(e.type)||Pa.call(this,i<=0?new Uint8Array(0):bv(t.offset,n,t.nullBitmap)),this.nodes.push(new Mu(n,i))}return super.visit(e)}visitNull(e){return this}visitDictionary(e){return this.visit(e.indices)}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}}function Pa(r){const e=r.byteLength+7&~7;return this.buffers.push(r),this.bufferRegions.push(new to(this._byteLength,e)),this._byteLength+=e,this}function E8(r){const{type:e,length:t,typeIds:n,valueOffsets:i}=r;if(Pa.call(this,n),e.mode===Oo.Sparse)return V0.call(this,r);if(e.mode===Oo.Dense){if(r.offset<=0)return Pa.call(this,i),V0.call(this,r);{const a=n.reduce((c,f)=>Math.max(c,f),n[0]),o=new Int32Array(a+1),s=new Int32Array(a+1).fill(-1),u=new Int32Array(t),l=yv(-i[0],t,i);for(let c,f,d=-1;++d<t;)(f=s[c=n[d]])===-1&&(f=s[c]=l[c]),u[d]=l[d]-f,++o[c];Pa.call(this,u);for(let c,f=-1,d=e.children.length;++f<d;)if(c=r.getChildAt(f)){const h=e.typeIds[f],v=Math.min(t,o[h]);this.visit(c.slice(s[h],v))}}}return this}function A8(r){let e;return r.nullCount>=r.length?Pa.call(this,new Uint8Array(0)):(e=r.values)instanceof Uint8Array?Pa.call(this,bv(r.offset,r.length,e)):Pa.call(this,df(r))}function Ss(r){return Pa.call(this,r.values.subarray(0,r.length*r.stride))}function C2(r){const{length:e,values:t,valueOffsets:n}=r,i=n[0],a=n[e],o=Math.min(a-i,t.byteLength-i);return Pa.call(this,yv(-n[0],e,n)),Pa.call(this,t.subarray(i,i+o)),this}function $0(r){const{length:e,valueOffsets:t}=r;return t&&Pa.call(this,yv(t[0],e,t)),this.visit(r.getChildAt(0))}function V0(r){return this.visitMany(r.type.children.map((e,t)=>r.getChildAt(t)).filter(Boolean))[0]}Pn.prototype.visitBool=A8;Pn.prototype.visitInt=Ss;Pn.prototype.visitFloat=Ss;Pn.prototype.visitUtf8=C2;Pn.prototype.visitBinary=C2;Pn.prototype.visitFixedSizeBinary=Ss;Pn.prototype.visitDate=Ss;Pn.prototype.visitTimestamp=Ss;Pn.prototype.visitTime=Ss;Pn.prototype.visitDecimal=Ss;Pn.prototype.visitList=$0;Pn.prototype.visitStruct=V0;Pn.prototype.visitUnion=E8;Pn.prototype.visitInterval=Ss;Pn.prototype.visitFixedSizeList=$0;Pn.prototype.visitMap=$0;class j0 extends wu{constructor(e){super();this._position=0,this._started=!1,this._sink=new Df,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,Xi(e)||(e={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof e.autoDestroy=="boolean"?e.autoDestroy:!0,this._writeLegacyIpcFormat=typeof e.writeLegacyIpcFormat=="boolean"?e.writeLegacyIpcFormat:!1}static throughNode(e){throw new Error('"throughNode" not available in this environment')}static throughDOM(e,t){throw new Error('"throughDOM" not available in this environment')}toString(e=!1){return this._sink.toString(e)}toUint8Array(e=!1){return this._sink.toUint8Array(e)}writeAll(e){return ps(e)?e.then(t=>this.writeAll(t)):No(e)?H0(this,e):Y0(this,e)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(e){return this._sink.toDOMStream(e)}toNodeStream(e){return this._sink.toNodeStream(e)}close(){return this.reset()._sink.close()}abort(e){return this.reset()._sink.abort(e)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(e=this._sink,t=null){return e===this._sink||e instanceof Df?this._sink=e:(this._sink=new Df,e&&yG(e)?this.toDOMStream({type:"bytes"}).pipeTo(e):e&&mG(e)&&this.toNodeStream({objectMode:!1}).pipe(e)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,(!t||!t.compareTo(this._schema))&&(t===null?(this._position=0,this._schema=null):(this._started=!0,this._schema=t,this._writeSchema(t))),this}write(e){let t=null;if(this._sink){if(e==null)return this.finish()&&void 0;if(e instanceof $r&&!(t=e.schema))return this.finish()&&void 0;if(e instanceof Ri&&!(t=e.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(t&&!t.compareTo(this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,t)}e instanceof Ri?e instanceof Yv||this._writeRecordBatch(e):e instanceof $r?this.writeAll(e.chunks):Ta(e)&&this.writeAll(e)}_writeMessage(e,t=8){const n=t-1,i=Ai.encode(e),a=i.byteLength,o=this._writeLegacyIpcFormat?4:8,s=a+o+n&~n,u=s-a-o;return e.headerType===en.RecordBatch?this._recordBatchBlocks.push(new bs(s,e.bodyLength,this._position)):e.headerType===en.DictionaryBatch&&this._dictionaryBlocks.push(new bs(s,e.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(s-o)),a>0&&this._write(i),this._writePadding(u)}_write(e){if(this._started){const t=Dr(e);t&&t.byteLength>0&&(this._sink.write(t),this._position+=t.byteLength)}return this}_writeSchema(e){return this._writeMessage(Ai.from(e))}_writeFooter(e){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Nf)}_writePadding(e){return e>0?this._write(new Uint8Array(e)):this}_writeRecordBatch(e){const{byteLength:t,nodes:n,bufferRegions:i,buffers:a}=Pn.assemble(e),o=new Zi(e.length,n,i),s=Ai.from(o,t);return this._writeDictionaries(e)._writeMessage(s)._writeBodyBuffers(a)}_writeDictionaryBatch(e,t,n=!1){this._dictionaryDeltaOffsets.set(t,e.length+(this._dictionaryDeltaOffsets.get(t)||0));const{byteLength:i,nodes:a,bufferRegions:o,buffers:s}=Pn.assemble(e),u=new Zi(e.length,a,o),l=new eo(u,t,n),c=Ai.from(l,i);return this._writeMessage(c)._writeBodyBuffers(s)}_writeBodyBuffers(e){let t,n,i;for(let a=-1,o=e.length;++a<o;)(t=e[a])&&(n=t.byteLength)>0&&(this._write(t),(i=(n+7&~7)-n)>0&&this._writePadding(i));return this}_writeDictionaries(e){for(let[t,n]of e.dictionaries){let i=this._dictionaryDeltaOffsets.get(t)||0;if(i===0||(n=n.slice(i)).length>0){const a="chunks"in n?n.chunks:[n];for(const o of a)this._writeDictionaryBatch(o,t,i>0),i+=o.length}}return this}}class W0 extends j0{static writeAll(e,t){const n=new W0(t);return ps(e)?e.then(i=>n.writeAll(i)):No(e)?H0(n,e):Y0(n,e)}}class X0 extends j0{constructor(){super();this._autoDestroy=!0}static writeAll(e){const t=new X0;return ps(e)?e.then(n=>t.writeAll(n)):No(e)?H0(t,e):Y0(t,e)}_writeSchema(e){return this._writeMagic()._writePadding(2)}_writeFooter(e){const t=kf.encode(new kf(e,Ma.V4,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(e)._write(t)._write(Int32Array.of(t.byteLength))._writeMagic()}}function Y0(r,e){let t=e;e instanceof $r&&(t=e.chunks,r.reset(void 0,e.schema));for(const n of t)r.write(n);return r.finish()}async function H0(r,e){for await(const t of e)r.write(t);return r.finish()}const q0=new Uint8Array(0),M2=r=>[q0,q0,new Uint8Array(r),q0];function T8(r,e,t=e.reduce((n,i)=>Math.max(n,i.length),0)){let n,i,a=-1,o=e.length;const s=[...r.fields],u=[],l=(t+63&~63)>>3;for(;++a<o;)(n=e[a])&&n.length===t?u[a]=n:((i=s[a]).nullable||(s[a]=s[a].clone({nullable:!0})),u[a]=n?n._changeLengthAndBackfillNullBitmap(t):wt.new(i.type,0,t,t,M2(l)));return[new Qr(s),t,u]}function I8(r){return k2(new Qr(r.map(({field:e})=>e)),r)}function k2(r,e){return C8(r,e.map(t=>t instanceof si?t.chunks.map(n=>n.data):[t.data]))}function C8(r,e){const t=[...r.fields],n=[],i={numBatches:e.reduce((f,d)=>Math.max(f,d.length),0)};let a=0,o=0,s=-1,u=e.length,l,c=[];for(;i.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,s=-1;++s<u;)c[s]=l=e[s].shift(),o=Math.min(o,l?l.length:o);isFinite(o)&&(c=M8(t,o,c,e,i),o>0&&(n[a++]=[o,c.slice()]))}return[r=new Qr(t,r.metadata),n.map(f=>new Ri(r,...f))]}function M8(r,e,t,n,i){let a,o,s=0,u=-1,l=n.length;const c=(e+63&~63)>>3;for(;++u<l;)(a=t[u])&&(s=a.length)>=e?s===e?t[u]=a:(t[u]=a.slice(0,e),a=a.slice(e,s-e),i.numBatches=Math.max(i.numBatches,n[u].unshift(a))):((o=r[u]).nullable||(r[u]=o.clone({nullable:!0})),t[u]=a?a._changeLengthAndBackfillNullBitmap(e):wt.new(o.type,0,e,e,M2(c)));return t}class nn extends Br{constructor(e,t){super();this._children=t,this.numChildren=e.childData.length,this._bindDataAccessors(this.data=e)}get type(){return this.data.type}get typeId(){return this.data.typeId}get length(){return this.data.length}get offset(){return this.data.offset}get stride(){return this.data.stride}get nullCount(){return this.data.nullCount}get byteLength(){return this.data.byteLength}get VectorName(){return`${ue[this.typeId]}Vector`}get ArrayType(){return this.type.ArrayType}get values(){return this.data.values}get typeIds(){return this.data.typeIds}get nullBitmap(){return this.data.nullBitmap}get valueOffsets(){return this.data.valueOffsets}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}clone(e,t=this._children){return Br.new(e,t)}concat(...e){return si.concat(this,...e)}slice(e,t){return x0(this,e,t,this._sliceInternal)}isValid(e){if(this.nullCount>0){const t=this.offset+e;return(this.nullBitmap[t>>3]&1<<t%8)!==0}return!0}getChildAt(e){return e<0||e>=this.numChildren?null:(this._children||(this._children=[]))[e]||(this._children[e]=Br.new(this.data.childData[e]))}toJSON(){return[...this]}_sliceInternal(e,t,n){return e.clone(e.data.slice(t,n-t),null)}_bindDataAccessors(e){}}nn.prototype[Symbol.isConcatSpreadable]=!0;class k8 extends nn{asUtf8(){return Br.new(this.data.clone(new Gl))}}class D8 extends nn{static from(e){return ku(()=>new bf,e)}}class K0 extends nn{static from(...e){return e.length===2?ku(()=>e[1]===Za.DAY?new i6:new bE,e[0]):ku(()=>new bE,e[0])}}class L8 extends K0{}class N8 extends K0{}class O8 extends nn{}class Z0 extends nn{constructor(e){super(e);this.indices=Br.new(e.clone(this.type.indices))}static from(...e){if(e.length===3){const[t,n,i]=e,a=new gs(t.type,n,null,null);return Br.new(wt.Dictionary(a,0,i.length,0,null,i,t))}return ku(()=>e[0].type,e[0])}get dictionary(){return this.data.dictionary}reverseLookup(e){return this.dictionary.indexOf(e)}getKey(e){return this.indices.get(e)}getValue(e){return this.dictionary.get(e)}setKey(e,t){return this.indices.set(e,t)}setValue(e,t){return this.dictionary.set(e,t)}}Z0.prototype.indices=null;class P8 extends nn{}class R8 extends nn{}class jv extends nn{static from(e){let t=U8(this);if(e instanceof ArrayBuffer||ArrayBuffer.isView(e)){let n=F8(e.constructor)||t;if(t===null&&(t=n),t&&t===n){let i=new t,a=e.byteLength/i.ArrayType.BYTES_PER_ELEMENT;if(!B8(t,e.constructor))return Br.new(wt.Float(i,0,a,0,null,e))}}if(t)return ku(()=>new t,e);throw e instanceof DataView||e instanceof ArrayBuffer?new TypeError(`Cannot infer float type from instance of ${e.constructor.name}`):new TypeError("Unrecognized FloatVector input")}}class D2 extends jv{toFloat32Array(){return new Float32Array(this)}toFloat64Array(){return new Float64Array(this)}}class L2 extends jv{}class N2 extends jv{}const B8=(r,e)=>r===Sv&&e!==Uint16Array,F8=r=>{switch(r){case Uint16Array:return Sv;case Float32Array:return h0;case Float64Array:return d0;default:return null}},U8=r=>{switch(r){case D2:return Sv;case L2:return h0;case N2:return d0;default:return null}};class Q0 extends nn{}class G8 extends Q0{}class z8 extends Q0{}class Ra extends nn{static from(...e){let[t,n=!1]=e,i=j8(this,n);if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)){let a=V8(t.constructor,n)||i;if(i===null&&(i=a),i&&i===a){let o=new i,s=t.byteLength/o.ArrayType.BYTES_PER_ELEMENT;return $8(i,t.constructor)&&(s*=.5),Br.new(wt.Int(o,0,s,0,null,t))}}if(i)return ku(()=>new i,t);throw t instanceof DataView||t instanceof ArrayBuffer?new TypeError(`Cannot infer integer type from instance of ${t.constructor.name}`):new TypeError("Unrecognized IntVector input")}}class O2 extends Ra{}class P2 extends Ra{}class R2 extends Ra{}class B2 extends Ra{toBigInt64Array(){return cE(this.values)}get values64(){return this._values64||(this._values64=this.toBigInt64Array())}}class F2 extends Ra{}class U2 extends Ra{}class G2 extends Ra{}class z2 extends Ra{toBigUint64Array(){return fE(this.values)}get values64(){return this._values64||(this._values64=this.toBigUint64Array())}}const $8=(r,e)=>(r===Fl||r===Ul)&&(e===Int32Array||e===Uint32Array),V8=(r,e)=>{switch(r){case Int8Array:return s0;case Int16Array:return u0;case Int32Array:return e?Fl:xu;case Ol:return Fl;case Uint8Array:return l0;case Uint16Array:return c0;case Uint32Array:return e?Ul:f0;case ff:return Ul;default:return null}},j8=(r,e)=>{switch(r){case O2:return s0;case P2:return u0;case R2:return e?Fl:xu;case B2:return Fl;case F2:return l0;case U2:return c0;case G2:return e?Ul:f0;case z2:return Ul;default:return null}};class W8 extends nn{}class X8 extends nn{asList(){const e=this.type.children[0];return Br.new(this.data.clone(new $l(e)))}bind(e){const t=this.getChildAt(0),{[e]:n,[e+1]:i}=this.valueOffsets;return new kE(t.slice(n,i))}}class Y8 extends nn{}const H8=Symbol.for("rowIndex");class Wv extends nn{bind(e){const t=this._row||(this._row=new DE(this)),n=Object.create(t);return n[H8]=e,n}}class Pf extends nn{}class q8 extends Pf{}class K8 extends Pf{}class Z8 extends Pf{}class Q8 extends Pf{}class Rf extends nn{}class J8 extends Rf{}class e$ extends Rf{}class t$ extends Rf{}class r$ extends Rf{}class J0 extends nn{get typeIdToChildIndex(){return this.data.type.typeIdToChildIndex}}class n$ extends J0{get valueOffsets(){return this.data.valueOffsets}}class i$ extends J0{}class a$ extends nn{static from(e){return ku(()=>new Gl,e)}asBinary(){return Br.new(this.data.clone(new mf))}}function $2(r){return function(){return r(this)}}function o$(r){return function(e){return r(this,e)}}function V2(r){return function(e,t){return r(this,e,t)}}class or extends Ir{}const s$=(r,e)=>864e5*r[e],eb=(r,e)=>4294967296*r[e+1]+(r[e]>>>0),u$=(r,e)=>4294967296*(r[e+1]/1e3)+(r[e]>>>0)/1e3,l$=(r,e)=>4294967296*(r[e+1]/1e6)+(r[e]>>>0)/1e6,j2=r=>new Date(r),c$=(r,e)=>j2(s$(r,e)),f$=(r,e)=>j2(eb(r,e)),h$=(r,e)=>null,W2=(r,e,t)=>{const{[t]:n,[t+1]:i}=e;return n!=null&&i!=null?r.subarray(n,i):null},d$=({offset:r,values:e},t)=>{const n=r+t;return(e[n>>3]&1<<n%8)!=0},X2=({values:r},e)=>c$(r,e),Y2=({values:r},e)=>f$(r,e*2),ro=({stride:r,values:e},t)=>e[r*t],H2=({stride:r,values:e},t)=>AE(e[r*t]),tb=({stride:r,values:e,type:t},n)=>Su.new(e.subarray(r*n,r*(n+1)),t.isSigned),v$=({stride:r,values:e},t)=>e.subarray(r*t,r*(t+1)),p$=({values:r,valueOffsets:e},t)=>W2(r,e,t),g$=({values:r,valueOffsets:e},t)=>{const n=W2(r,e,t);return n!==null?Km(n):null},y$=(r,e)=>r.type.bitWidth<64?ro(r,e):tb(r,e),m$=(r,e)=>r.type.precision!==la.HALF?ro(r,e):H2(r,e),b$=(r,e)=>r.type.unit===Za.DAY?X2(r,e):Y2(r,e),q2=({values:r},e)=>1e3*eb(r,e*2),K2=({values:r},e)=>eb(r,e*2),Z2=({values:r},e)=>u$(r,e*2),Q2=({values:r},e)=>l$(r,e*2),w$=(r,e)=>{switch(r.type.unit){case Zr.SECOND:return q2(r,e);case Zr.MILLISECOND:return K2(r,e);case Zr.MICROSECOND:return Z2(r,e);case Zr.NANOSECOND:return Q2(r,e)}},J2=({values:r,stride:e},t)=>r[e*t],eA=({values:r,stride:e},t)=>r[e*t],tA=({values:r},e)=>Su.signed(r.subarray(2*e,2*(e+1))),rA=({values:r},e)=>Su.signed(r.subarray(2*e,2*(e+1))),x$=(r,e)=>{switch(r.type.unit){case Zr.SECOND:return J2(r,e);case Zr.MILLISECOND:return eA(r,e);case Zr.MICROSECOND:return tA(r,e);case Zr.NANOSECOND:return rA(r,e)}},_$=({values:r},e)=>Su.decimal(r.subarray(4*e,4*(e+1))),S$=(r,e)=>{const t=r.getChildAt(0),{valueOffsets:n,stride:i}=r;return t.slice(n[e*i],n[e*i+1])},E$=(r,e)=>r.bind(e),A$=(r,e)=>r.bind(e),T$=(r,e)=>r.type.mode===Oo.Dense?nA(r,e):iA(r,e),nA=(r,e)=>{const t=r.typeIdToChildIndex[r.typeIds[e]],n=r.getChildAt(t);return n?n.get(r.valueOffsets[e]):null},iA=(r,e)=>{const t=r.typeIdToChildIndex[r.typeIds[e]],n=r.getChildAt(t);return n?n.get(e):null},I$=(r,e)=>r.getValue(r.getKey(e)),C$=(r,e)=>r.type.unit===Rl.DAY_TIME?aA(r,e):oA(r,e),aA=({values:r},e)=>r.subarray(2*e,2*(e+1)),oA=({values:r},e)=>{const t=r[e],n=new Int32Array(2);return n[0]=t/12|0,n[1]=t%12|0,n},M$=(r,e)=>{const t=r.getChildAt(0),{stride:n}=r;return t.slice(e*n,(e+1)*n)};or.prototype.visitNull=h$;or.prototype.visitBool=d$;or.prototype.visitInt=y$;or.prototype.visitInt8=ro;or.prototype.visitInt16=ro;or.prototype.visitInt32=ro;or.prototype.visitInt64=tb;or.prototype.visitUint8=ro;or.prototype.visitUint16=ro;or.prototype.visitUint32=ro;or.prototype.visitUint64=tb;or.prototype.visitFloat=m$;or.prototype.visitFloat16=H2;or.prototype.visitFloat32=ro;or.prototype.visitFloat64=ro;or.prototype.visitUtf8=g$;or.prototype.visitBinary=p$;or.prototype.visitFixedSizeBinary=v$;or.prototype.visitDate=b$;or.prototype.visitDateDay=X2;or.prototype.visitDateMillisecond=Y2;or.prototype.visitTimestamp=w$;or.prototype.visitTimestampSecond=q2;or.prototype.visitTimestampMillisecond=K2;or.prototype.visitTimestampMicrosecond=Z2;or.prototype.visitTimestampNanosecond=Q2;or.prototype.visitTime=x$;or.prototype.visitTimeSecond=J2;or.prototype.visitTimeMillisecond=eA;or.prototype.visitTimeMicrosecond=tA;or.prototype.visitTimeNanosecond=rA;or.prototype.visitDecimal=_$;or.prototype.visitList=S$;or.prototype.visitStruct=A$;or.prototype.visitUnion=T$;or.prototype.visitDenseUnion=nA;or.prototype.visitSparseUnion=iA;or.prototype.visitDictionary=I$;or.prototype.visitInterval=C$;or.prototype.visitIntervalDayTime=aA;or.prototype.visitIntervalYearMonth=oA;or.prototype.visitFixedSizeList=M$;or.prototype.visitMap=E$;const Xv=new or;class sr extends Ir{}function k$(r,e){return e===null&&r.length>0?0:-1}function D$(r,e){const{nullBitmap:t}=r;if(!t||r.nullCount<=0)return-1;let n=0;for(const i of vf(t,r.data.offset+(e||0),r.length,t,r0)){if(!i)return n;++n}return-1}function br(r,e,t){if(e===void 0)return-1;if(e===null)return D$(r,t);const n=Eu(e);for(let i=(t||0)-1,a=r.length;++i<a;)if(n(r.get(i)))return i;return-1}function sA(r,e,t){const n=Eu(e);for(let i=(t||0)-1,a=r.length;++i<a;)if(n(r.get(i)))return i;return-1}sr.prototype.visitNull=k$;sr.prototype.visitBool=br;sr.prototype.visitInt=br;sr.prototype.visitInt8=br;sr.prototype.visitInt16=br;sr.prototype.visitInt32=br;sr.prototype.visitInt64=br;sr.prototype.visitUint8=br;sr.prototype.visitUint16=br;sr.prototype.visitUint32=br;sr.prototype.visitUint64=br;sr.prototype.visitFloat=br;sr.prototype.visitFloat16=br;sr.prototype.visitFloat32=br;sr.prototype.visitFloat64=br;sr.prototype.visitUtf8=br;sr.prototype.visitBinary=br;sr.prototype.visitFixedSizeBinary=br;sr.prototype.visitDate=br;sr.prototype.visitDateDay=br;sr.prototype.visitDateMillisecond=br;sr.prototype.visitTimestamp=br;sr.prototype.visitTimestampSecond=br;sr.prototype.visitTimestampMillisecond=br;sr.prototype.visitTimestampMicrosecond=br;sr.prototype.visitTimestampNanosecond=br;sr.prototype.visitTime=br;sr.prototype.visitTimeSecond=br;sr.prototype.visitTimeMillisecond=br;sr.prototype.visitTimeMicrosecond=br;sr.prototype.visitTimeNanosecond=br;sr.prototype.visitDecimal=br;sr.prototype.visitList=br;sr.prototype.visitStruct=br;sr.prototype.visitUnion=br;sr.prototype.visitDenseUnion=sA;sr.prototype.visitSparseUnion=sA;sr.prototype.visitDictionary=br;sr.prototype.visitInterval=br;sr.prototype.visitIntervalDayTime=br;sr.prototype.visitIntervalYearMonth=br;sr.prototype.visitFixedSizeList=br;sr.prototype.visitMap=br;const uA=new sr;class ur extends Ir{}function L$(r){const e=Xv.getVisitFn(r);return vf(r.nullBitmap,r.offset,r.length,r,(t,n,i,a)=>(i&1<<a)!=0?e(t,n):null)}function hr(r){if(r.nullCount>0)return L$(r);const{type:e,typeId:t,length:n}=r;return r.stride===1&&(t===ue.Timestamp||t===ue.Int&&e.bitWidth!==64||t===ue.Time&&e.bitWidth!==64||t===ue.Float&&e.precision>0)?r.values.subarray(0,n)[Symbol.iterator]():function*(i){for(let a=-1;++a<n;)yield i(r,a)}(Xv.getVisitFn(r))}ur.prototype.visitNull=hr;ur.prototype.visitBool=hr;ur.prototype.visitInt=hr;ur.prototype.visitInt8=hr;ur.prototype.visitInt16=hr;ur.prototype.visitInt32=hr;ur.prototype.visitInt64=hr;ur.prototype.visitUint8=hr;ur.prototype.visitUint16=hr;ur.prototype.visitUint32=hr;ur.prototype.visitUint64=hr;ur.prototype.visitFloat=hr;ur.prototype.visitFloat16=hr;ur.prototype.visitFloat32=hr;ur.prototype.visitFloat64=hr;ur.prototype.visitUtf8=hr;ur.prototype.visitBinary=hr;ur.prototype.visitFixedSizeBinary=hr;ur.prototype.visitDate=hr;ur.prototype.visitDateDay=hr;ur.prototype.visitDateMillisecond=hr;ur.prototype.visitTimestamp=hr;ur.prototype.visitTimestampSecond=hr;ur.prototype.visitTimestampMillisecond=hr;ur.prototype.visitTimestampMicrosecond=hr;ur.prototype.visitTimestampNanosecond=hr;ur.prototype.visitTime=hr;ur.prototype.visitTimeSecond=hr;ur.prototype.visitTimeMillisecond=hr;ur.prototype.visitTimeMicrosecond=hr;ur.prototype.visitTimeNanosecond=hr;ur.prototype.visitDecimal=hr;ur.prototype.visitList=hr;ur.prototype.visitStruct=hr;ur.prototype.visitUnion=hr;ur.prototype.visitDenseUnion=hr;ur.prototype.visitSparseUnion=hr;ur.prototype.visitDictionary=hr;ur.prototype.visitInterval=hr;ur.prototype.visitIntervalDayTime=hr;ur.prototype.visitIntervalYearMonth=hr;ur.prototype.visitFixedSizeList=hr;ur.prototype.visitMap=hr;const rb=new ur;class lr extends Ir{}function dr(r){const{type:e,length:t,stride:n}=r;switch(e.typeId){case ue.Int:case ue.Float:case ue.Decimal:case ue.Time:case ue.Timestamp:return r.values.subarray(0,t*n)}return[...rb.visit(r)]}lr.prototype.visitNull=dr;lr.prototype.visitBool=dr;lr.prototype.visitInt=dr;lr.prototype.visitInt8=dr;lr.prototype.visitInt16=dr;lr.prototype.visitInt32=dr;lr.prototype.visitInt64=dr;lr.prototype.visitUint8=dr;lr.prototype.visitUint16=dr;lr.prototype.visitUint32=dr;lr.prototype.visitUint64=dr;lr.prototype.visitFloat=dr;lr.prototype.visitFloat16=dr;lr.prototype.visitFloat32=dr;lr.prototype.visitFloat64=dr;lr.prototype.visitUtf8=dr;lr.prototype.visitBinary=dr;lr.prototype.visitFixedSizeBinary=dr;lr.prototype.visitDate=dr;lr.prototype.visitDateDay=dr;lr.prototype.visitDateMillisecond=dr;lr.prototype.visitTimestamp=dr;lr.prototype.visitTimestampSecond=dr;lr.prototype.visitTimestampMillisecond=dr;lr.prototype.visitTimestampMicrosecond=dr;lr.prototype.visitTimestampNanosecond=dr;lr.prototype.visitTime=dr;lr.prototype.visitTimeSecond=dr;lr.prototype.visitTimeMillisecond=dr;lr.prototype.visitTimeMicrosecond=dr;lr.prototype.visitTimeNanosecond=dr;lr.prototype.visitDecimal=dr;lr.prototype.visitList=dr;lr.prototype.visitStruct=dr;lr.prototype.visitUnion=dr;lr.prototype.visitDenseUnion=dr;lr.prototype.visitSparseUnion=dr;lr.prototype.visitDictionary=dr;lr.prototype.visitInterval=dr;lr.prototype.visitIntervalDayTime=dr;lr.prototype.visitIntervalYearMonth=dr;lr.prototype.visitFixedSizeList=dr;lr.prototype.visitMap=dr;const lA=new lr,Bf=(r,e)=>r+e,nb=r=>`Cannot compute the byte width of variable-width column ${r}`;class N$ extends Ir{visitNull(e){return 0}visitInt(e){return e.bitWidth/8}visitFloat(e){return e.ArrayType.BYTES_PER_ELEMENT}visitBinary(e){throw new Error(nb(e))}visitUtf8(e){throw new Error(nb(e))}visitBool(e){return 1/8}visitDecimal(e){return 16}visitDate(e){return(e.unit+1)*4}visitTime(e){return e.bitWidth/8}visitTimestamp(e){return e.unit===Zr.SECOND?4:8}visitInterval(e){return(e.unit+1)*4}visitList(e){throw new Error(nb(e))}visitStruct(e){return this.visitFields(e.children).reduce(Bf,0)}visitUnion(e){return this.visitFields(e.children).reduce(Bf,0)}visitFixedSizeBinary(e){return e.byteWidth}visitFixedSizeList(e){return e.listSize*this.visitFields(e.children).reduce(Bf,0)}visitMap(e){return this.visitFields(e.children).reduce(Bf,0)}visitDictionary(e){return this.visit(e.indices)}visitFields(e){return(e||[]).map(t=>this.visit(t.type))}visitSchema(e){return this.visitFields(e.fields).reduce(Bf,0)}}const cA=new N$;class O$ extends Ir{visitNull(){return Y8}visitBool(){return D8}visitInt(){return Ra}visitInt8(){return O2}visitInt16(){return P2}visitInt32(){return R2}visitInt64(){return B2}visitUint8(){return F2}visitUint16(){return U2}visitUint32(){return G2}visitUint64(){return z2}visitFloat(){return jv}visitFloat16(){return D2}visitFloat32(){return L2}visitFloat64(){return N2}visitUtf8(){return a$}visitBinary(){return k8}visitFixedSizeBinary(){return P8}visitDate(){return K0}visitDateDay(){return L8}visitDateMillisecond(){return N8}visitTimestamp(){return Pf}visitTimestampSecond(){return q8}visitTimestampMillisecond(){return K8}visitTimestampMicrosecond(){return Z8}visitTimestampNanosecond(){return Q8}visitTime(){return Rf}visitTimeSecond(){return J8}visitTimeMillisecond(){return e$}visitTimeMicrosecond(){return t$}visitTimeNanosecond(){return r$}visitDecimal(){return O8}visitList(){return W8}visitStruct(){return Wv}visitUnion(){return J0}visitDenseUnion(){return n$}visitSparseUnion(){return i$}visitDictionary(){return Z0}visitInterval(){return Q0}visitIntervalDayTime(){return G8}visitIntervalYearMonth(){return z8}visitFixedSizeList(){return R8}visitMap(){return X8}}const fA=new O$;Br.new=P$;Br.from=R$;function P$(r,...e){return new(fA.getVisitFn(r)())(r,...e)}function ku(r,e){if(Ta(e))return Br.from({nullValues:[null,void 0],type:r(),values:e});if(No(e))return Br.from({nullValues:[null,void 0],type:r(),values:e});const{values:t=[],type:n=r(),nullValues:i=[null,void 0]}=On({},e);return Ta(t)?Br.from(kl(On({nullValues:i},e),{type:n})):Br.from(kl(On({nullValues:i},e),{type:n}))}function R$(r){const n=On({nullValues:[null,void 0]},r),{values:e=[]}=n,t=Lm(n,["values"]);if(Ta(e)){const i=[...bn.throughIterable(t)(e)];return i.length===1?i[0]:si.concat(i)}return(async i=>{const a=bn.throughAsyncIterable(t);for await(const o of a(e))i.push(o);return i.length===1?i[0]:si.concat(i)})([])}nn.prototype.get=function(e){return Xv.visit(this,e)};nn.prototype.set=function(e,t){return Ov.visit(this,e,t)};nn.prototype.indexOf=function(e,t){return uA.visit(this,e,t)};nn.prototype.toArray=function(){return lA.visit(this)};nn.prototype.getByteWidth=function(){return cA.visit(this.type)};nn.prototype[Symbol.iterator]=function(){return rb.visit(this)};nn.prototype._bindDataAccessors=G$;Object.keys(ue).map(r=>ue[r]).filter(r=>typeof r=="number").filter(r=>r!==ue.NONE).forEach(r=>{const e=fA.visit(r);e.prototype.get=o$(Xv.getVisitFn(r)),e.prototype.set=V2(Ov.getVisitFn(r)),e.prototype.indexOf=V2(uA.getVisitFn(r)),e.prototype.toArray=$2(lA.getVisitFn(r)),e.prototype.getByteWidth=B$(cA.getVisitFn(r)),e.prototype[Symbol.iterator]=$2(rb.getVisitFn(r))});function B$(r){return function(){return r(this.type)}}function F$(r){return function(e){return this.isValid(e)?r.call(this,e):null}}function U$(r){return function(e,t){yE(this.nullBitmap,this.offset+e,t!=null)&&r.call(this,e,t)}}function G$(){const r=this.nullBitmap;r&&r.byteLength>0&&(this.get=F$(this.get),this.set=U$(this.set))}class $r extends si{constructor(...e){let t=null;e[0]instanceof Qr&&(t=e.shift());let n=BE(Ri,e);if(!t&&!(t=n[0]&&n[0].schema))throw new TypeError("Table must be initialized with a Schema or at least one RecordBatch");n[0]||(n[0]=new Yv(t));super(new ka(t.fields),n);this._schema=t,this._chunks=n}static empty(e=new Qr([])){return new $r(e,[])}static from(e){if(!e)return $r.empty();if(typeof e=="object"){let n=Ta(e.values)?z$(e):No(e.values)?$$(e):null;if(n!==null)return n}let t=Ba.from(e);return ps(t)?(async()=>await $r.from(await t))():t.isSync()&&(t=t.open())?t.schema?new $r(t.schema,[...t]):$r.empty():(async n=>{const i=await n,a=i.schema,o=[];if(a){for await(let s of i)o.push(s);return new $r(a,o)}return $r.empty()})(t.open())}static async fromAsync(e){return await $r.from(e)}static fromStruct(e){return $r.new(e.data.childData,e.type.children)}static new(...e){return new $r(...I8(rz(e)))}get schema(){return this._schema}get length(){return this._length}get chunks(){return this._chunks}get numCols(){return this._numChildren}clone(e=this._chunks){return new $r(this._schema,e)}getColumn(e){return this.getColumnAt(this.getColumnIndex(e))}getColumnAt(e){return this.getChildAt(e)}getColumnIndex(e){return this._schema.fields.findIndex(t=>t.name===e)}getChildAt(e){if(e<0||e>=this.numChildren)return null;let t,n;const i=this._schema.fields,a=this._children||(this._children=[]);if(n=a[e])return n;if(t=i[e]){const o=this._chunks.map(s=>s.getChildAt(e)).filter(s=>s!=null);if(o.length>0)return a[e]=new La(t,o)}return null}serialize(e="binary",t=!0){return(t?W0:X0).writeAll(this).toUint8Array(!0)}count(){return this._length}select(...e){const t=this._schema.fields.reduce((n,i,a)=>n.set(i.name,a),new Map);return this.selectAt(...e.map(n=>t.get(n)).filter(n=>n>-1))}selectAt(...e){const t=this._schema.selectAt(...e);return new $r(t,this._chunks.map(({length:n,data:{childData:i}})=>new Ri(t,n,e.map(a=>i[a]).filter(Boolean))))}assign(e){const t=this._schema.fields,[n,i]=e.schema.fields.reduce((s,u,l)=>{const[c,f]=s,d=t.findIndex(h=>h.name===u.name);return~d?f[d]=l:c.push(l),s},[[],[]]),a=this._schema.assign(e.schema),o=[...t.map((s,u,l,c=i[u])=>c===void 0?this.getColumnAt(u):e.getColumnAt(c)),...n.map(s=>e.getColumnAt(s))].filter(Boolean);return new $r(...k2(a,o))}}function z$(r){const{type:e}=r;return e instanceof ka?$r.fromStruct(Wv.from(r)):null}function $$(r){const{type:e}=r;return e instanceof ka?Wv.from(r).then(t=>$r.fromStruct(t)):null}class Ri extends Wv{constructor(...e){let t,n=e[0],i;if(e[1]instanceof wt)[,t,i]=e;else{const a=n.fields,[,o,s]=e;t=wt.Struct(new ka(a),0,o,0,null,s)}super(t,i);this._schema=n}static from(e){return Ta(e.values),$r.from(e)}static new(...e){const[t,n]=FE(e),i=n.filter(a=>a instanceof Br);return new Ri(...T8(new Qr(t),i.map(a=>a.data)))}clone(e,t=this._children){return new Ri(this._schema,e,t)}concat(...e){const t=this._schema,n=si.flatten(this,...e);return new $r(t,n.map(({data:i})=>new Ri(t,i)))}get schema(){return this._schema}get numCols(){return this._schema.fields.length}get dictionaries(){return this._dictionaries||(this._dictionaries=ib.collect(this))}select(...e){const t=this._schema.fields.reduce((n,i,a)=>n.set(i.name,a),new Map);return this.selectAt(...e.map(n=>t.get(n)).filter(n=>n>-1))}selectAt(...e){const t=this._schema.selectAt(...e),n=e.map(i=>this.data.childData[i]).filter(Boolean);return new Ri(t,this.length,n)}}class Yv extends Ri{constructor(e){super(e,0,e.fields.map(t=>wt.new(t.type,0,0,0)))}}class ib extends Ir{constructor(){super(...arguments);this.dictionaries=new Map}static collect(e){return new ib().visit(e.data,new ka(e.schema.fields)).dictionaries}visit(e,t){return yr.isDictionary(t)?this.visitDictionary(e,t):(e.childData.forEach((n,i)=>this.visit(n,t.children[i].type)),this)}visitDictionary(e,t){const n=e.dictionary;return n&&n.length>0&&this.dictionaries.set(t.id,n),this}}class Ba extends wu{constructor(e){super();this._impl=e}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(e){return this._impl.throw(e)}return(e){return this._impl.return(e)}cancel(){return this._impl.cancel()}reset(e){return this._impl.reset(e),this._DOMStream=void 0,this._nodeStream=void 0,this}open(e){const t=this._impl.open(e);return ps(t)?t.then(()=>this):this}readRecordBatch(e){return this._impl.isFile()?this._impl.readRecordBatch(e):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return Yi.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return Yi.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(e){throw new Error('"throughNode" not available in this environment')}static throughDOM(e,t){throw new Error('"throughDOM" not available in this environment')}static from(e){return e instanceof Ba?e:Zm(e)?X$(e):sE(e)?q$(e):ps(e)?(async()=>await Ba.from(await e))():uE(e)||Qm(e)||lE(e)||No(e)?H$(new Tu(e)):Y$(new Pv(e))}static readAll(e){return e instanceof Ba?e.isSync()?gA(e):yA(e):Zm(e)||ArrayBuffer.isView(e)||Ta(e)||oE(e)?gA(e):yA(e)}}class Hv extends Ba{constructor(e){super(e);this._impl=e}[Symbol.iterator](){return this._impl[Symbol.iterator]()}async*[Symbol.asyncIterator](){yield*this[Symbol.iterator]()}}class qv extends Ba{constructor(e){super(e);this._impl=e}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}}class hA extends Hv{constructor(e){super(e);this._impl=e}}class V$ extends qv{constructor(e){super(e);this._impl=e}}class dA{constructor(e=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=e}get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(e){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=e,this.dictionaries=new Map,this}_loadRecordBatch(e,t){return new Ri(this.schema,e.length,this._loadVectors(e,t,this.schema.fields))}_loadDictionaryBatch(e,t){const{id:n,isDelta:i,data:a}=e,{dictionaries:o,schema:s}=this,u=o.get(n);if(i||!u){const l=s.dictionaries.get(n);return u&&i?u.concat(Br.new(this._loadVectors(a,t,[l])[0])):Br.new(this._loadVectors(a,t,[l])[0])}return u}_loadVectors(e,t,n){return new o2(t,e.nodes,e.buffers,this.dictionaries).visitMany(n)}}class Kv extends dA{constructor(e,t){super(t);this._reader=Zm(e)?new _8(this._handle=e):new T2(this._handle=e)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(e){return this.closed||(this.autoDestroy=pA(this,e),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(e):mn}return(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(e):mn}next(){if(this.closed)return mn;let e,{_reader:t}=this;for(;e=this._readNextMessageAndValidate();)if(e.isSchema())this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;const n=e.header(),i=t.readMessageBody(e.bodyLength),a=this._loadRecordBatch(n,i);return{done:!1,value:a}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;const n=e.header(),i=t.readMessageBody(e.bodyLength),a=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,a)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Yv(this.schema)}):this.return()}_readNextMessageAndValidate(e){return this._reader.readMessage(e)}}class Zv extends dA{constructor(e,t){super(t);this._reader=new x8(this._handle=e)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}async cancel(){!this.closed&&(this.closed=!0)&&(await this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}async open(e){return this.closed||(this.autoDestroy=pA(this,e),this.schema||(this.schema=await this._reader.readSchema())||await this.cancel()),this}async throw(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?await this.reset()._reader.throw(e):mn}async return(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?await this.reset()._reader.return(e):mn}async next(){if(this.closed)return mn;let e,{_reader:t}=this;for(;e=await this._readNextMessageAndValidate();)if(e.isSchema())await this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;const n=e.header(),i=await t.readMessageBody(e.bodyLength),a=this._loadRecordBatch(n,i);return{done:!1,value:a}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;const n=e.header(),i=await t.readMessageBody(e.bodyLength),a=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,a)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Yv(this.schema)}):await this.return()}async _readNextMessageAndValidate(e){return await this._reader.readMessage(e)}}class vA extends Kv{constructor(e,t){super(e instanceof a2?e:new a2(e),t)}get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}isSync(){return!0}isFile(){return!0}open(e){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(const t of this._footer.dictionaryBatches())t&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(e)}readRecordBatch(e){if(this.closed)return null;this._footer||this.open();const t=this._footer&&this._footer.getRecordBatch(e);if(t&&this._handle.seek(t.offset)){const n=this._reader.readMessage(en.RecordBatch);if(n&&n.isRecordBatch()){const i=n.header(),a=this._reader.readMessageBody(n.bodyLength);return this._loadRecordBatch(i,a)}}return null}_readDictionaryBatch(e){const t=this._footer&&this._footer.getDictionaryBatch(e);if(t&&this._handle.seek(t.offset)){const n=this._reader.readMessage(en.DictionaryBatch);if(n&&n.isDictionaryBatch()){const i=n.header(),a=this._reader.readMessageBody(n.bodyLength),o=this._loadDictionaryBatch(i,a);this.dictionaries.set(i.id,o)}}}_readFooter(){const{_handle:e}=this,t=e.size-I2,n=e.readInt32(t),i=e.readAt(t-n,n);return kf.decode(i)}_readNextMessageAndValidate(e){if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){const t=this._footer&&this._footer.getRecordBatch(this._recordBatchIndex);if(t&&this._handle.seek(t.offset))return this._reader.readMessage(e)}return null}}class j$ extends Zv{constructor(e,...t){const n=typeof t[0]!="number"?t.shift():void 0,i=t[0]instanceof Map?t.shift():void 0;super(e instanceof Rv?e:new Rv(e,n),i)}get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}isFile(){return!0}isAsync(){return!0}async open(e){if(!this.closed&&!this._footer){this.schema=(this._footer=await this._readFooter()).schema;for(const t of this._footer.dictionaryBatches())t&&await this._readDictionaryBatch(this._dictionaryIndex++)}return await super.open(e)}async readRecordBatch(e){if(this.closed)return null;this._footer||await this.open();const t=this._footer&&this._footer.getRecordBatch(e);if(t&&await this._handle.seek(t.offset)){const n=await this._reader.readMessage(en.RecordBatch);if(n&&n.isRecordBatch()){const i=n.header(),a=await this._reader.readMessageBody(n.bodyLength);return this._loadRecordBatch(i,a)}}return null}async _readDictionaryBatch(e){const t=this._footer&&this._footer.getDictionaryBatch(e);if(t&&await this._handle.seek(t.offset)){const n=await this._reader.readMessage(en.DictionaryBatch);if(n&&n.isDictionaryBatch()){const i=n.header(),a=await this._reader.readMessageBody(n.bodyLength),o=this._loadDictionaryBatch(i,a);this.dictionaries.set(i.id,o)}}}async _readFooter(){const{_handle:e}=this;e._pending&&await e._pending;const t=e.size-I2,n=await e.readInt32(t),i=await e.readAt(t-n,n);return kf.decode(i)}async _readNextMessageAndValidate(e){if(this._footer||await this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){const t=this._footer.getRecordBatch(this._recordBatchIndex);if(t&&await this._handle.seek(t.offset))return await this._reader.readMessage(e)}return null}}class W$ extends Kv{constructor(e,t){super(e,t)}_loadVectors(e,t,n){return new jz(t,e.nodes,e.buffers,this.dictionaries).visitMany(n)}}function pA(r,e){return e&&typeof e.autoDestroy=="boolean"?e.autoDestroy:r.autoDestroy}function*gA(r){const e=Ba.from(r);try{if(!e.open({autoDestroy:!1}).closed)do yield e;while(!e.reset().open().closed)}finally{e.cancel()}}async function*yA(r){const e=await Ba.from(r);try{if(!(await e.open({autoDestroy:!1})).closed)do yield e;while(!(await e.reset().open()).closed)}finally{await e.cancel()}}function X$(r){return new Hv(new W$(r))}function Y$(r){const e=r.peek(Of+7&~7);return e&&e.byteLength>=4?z0(e)?new hA(new vA(r.read())):new Hv(new Kv(r)):new Hv(new Kv(function*(){}()))}async function H$(r){const e=await r.peek(Of+7&~7);return e&&e.byteLength>=4?z0(e)?new hA(new vA(await r.read())):new qv(new Zv(r)):new qv(new Zv(async function*(){}()))}async function q$(r){const{size:e}=await r.stat(),t=new Rv(r,e);return e>=S8&&z0(await t.readAt(0,Of+7&~7))?new V$(new j$(t)):new qv(new Zv(t))}function K$(r,e){if(No(r))return Q$(r,e);if(Ta(r))return Z$(r,e);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function Z$(r,e){let t=null;const n=e&&e.type==="bytes"||!1,i=e&&e.highWaterMark||2**24;return new ReadableStream(kl(On({},e),{start(o){a(o,t||(t=r[Symbol.iterator]()))},pull(o){t?a(o,t):o.close()},cancel(){(t&&t.return&&t.return()||!0)&&(t=null)}}),On({highWaterMark:n?i:void 0},e));function a(o,s){let u,l=null,c=o.desiredSize||null;for(;!(l=s.next(n?c:null)).done;)if(ArrayBuffer.isView(l.value)&&(u=Dr(l.value))&&(c!=null&&n&&(c=c-u.byteLength+1),l.value=u),o.enqueue(l.value),c!=null&&--c<=0)return;o.close()}}function Q$(r,e){let t=null;const n=e&&e.type==="bytes"||!1,i=e&&e.highWaterMark||2**24;return new ReadableStream(kl(On({},e),{async start(o){await a(o,t||(t=r[Symbol.asyncIterator]()))},async pull(o){t?await a(o,t):o.close()},async cancel(){(t&&t.return&&await t.return()||!0)&&(t=null)}}),On({highWaterMark:n?i:void 0},e));async function a(o,s){let u,l=null,c=o.desiredSize||null;for(;!(l=await s.next(n?c:null)).done;)if(ArrayBuffer.isView(l.value)&&(u=Dr(l.value))&&(c!=null&&n&&(c=c-u.byteLength+1),l.value=u),o.enqueue(l.value),c!=null&&--c<=0)return;o.close()}}function J$(r){return new eV(r)}class eV{constructor(e){this._numChunks=0,this._finished=!1,this._bufferedSize=0;const u=e,{["readableStrategy"]:t,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=u,a=Lm(u,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=bn.new(a),this._getSize=i!=="bytes"?mA:bA;const{["highWaterMark"]:o=i==="bytes"?2**14:1e3}=On({},t),{["highWaterMark"]:s=i==="bytes"?2**14:1e3}=On({},n);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:l=>{this._maybeFlush(this._builder,this._controller=l)},start:l=>{this._maybeFlush(this._builder,this._controller=l)}},{highWaterMark:o,size:i!=="bytes"?mA:bA}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:s,size:l=>this._writeValueAndReturnChunkSize(l)})}_writeValueAndReturnChunkSize(e){const t=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(e)),this._bufferedSize-t}_maybeFlush(e,t){t!==null&&(this._bufferedSize>=t.desiredSize&&++this._numChunks&&this._enqueue(t,e.toVector()),e.finished&&((e.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(t,e.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(t,null)))}_enqueue(e,t){this._bufferedSize=0,this._controller=null,t===null?e.close():e.enqueue(t)}}const mA=r=>r.length,bA=r=>r.byteLength;function tV(r,e){const t=new Df;let n=null;const i=new ReadableStream({async cancel(){await t.close()},async start(s){await o(s,n||(n=await a()))},async pull(s){n?await o(s,n):s.close()}});return{writable:new WritableStream(t,On({highWaterMark:2**14},r)),readable:i};async function a(){return await(await Ba.from(t)).open(e)}async function o(s,u){let l=s.desiredSize,c=null;for(;!(c=await u.next()).done;)if(s.enqueue(c.value),l!=null&&--l<=0)return;s.close()}}function rV(r,e){const t=new this(r),n=new Tu(t),i=new ReadableStream({type:"bytes",async cancel(){await n.cancel()},async pull(o){await a(o)},async start(o){await a(o)}},On({highWaterMark:2**14},e));return{writable:new WritableStream(t,r),readable:i};async function a(o){let s=null,u=o.desiredSize;for(;s=await n.read(u||null);)if(o.enqueue(s),u!=null&&(u-=s.byteLength)<=0)return;o.close()}}class Ql{eq(e){return e instanceof Ql||(e=new Jl(e)),new nV(this,e)}le(e){return e instanceof Ql||(e=new Jl(e)),new iV(this,e)}ge(e){return e instanceof Ql||(e=new Jl(e)),new aV(this,e)}lt(e){return new Qv(this.ge(e))}gt(e){return new Qv(this.le(e))}ne(e){return new Qv(this.eq(e))}}class Jl extends Ql{constructor(e){super();this.v=e}}class wA extends Ql{constructor(e){super();this.name=e}bind(e){if(!this.colidx){this.colidx=-1;const n=e.schema.fields;for(let i=-1;++i<n.length;)if(n[i].name===this.name){this.colidx=i;break}if(this.colidx<0)throw new Error(`Failed to bind Col "${this.name}"`)}const t=this.vector=e.getChildAt(this.colidx);return n=>t.get(n)}}class ab{and(...e){return new ub(this,...e)}or(...e){return new lb(this,...e)}not(){return new Qv(this)}}class ob extends ab{constructor(e,t){super();this.left=e,this.right=t}bind(e){return this.left instanceof Jl?this.right instanceof Jl?this._bindLitLit(e,this.left,this.right):this._bindLitCol(e,this.left,this.right):this.right instanceof Jl?this._bindColLit(e,this.left,this.right):this._bindColCol(e,this.left,this.right)}}class sb extends ab{constructor(...e){super();this.children=e}}sb.prototype.children=Object.freeze([]);class ub extends sb{constructor(...e){e=e.reduce((t,n)=>t.concat(n instanceof ub?n.children:n),[]);super(...e)}bind(e){const t=this.children.map(n=>n.bind(e));return(n,i)=>t.every(a=>a(n,i))}}class lb extends sb{constructor(...e){e=e.reduce((t,n)=>t.concat(n instanceof lb?n.children:n),[]);super(...e)}bind(e){const t=this.children.map(n=>n.bind(e));return(n,i)=>t.some(a=>a(n,i))}}class nV extends ob{_bindLitLit(e,t,n){const i=t.v==n.v;return()=>i}_bindColCol(e,t,n){const i=t.bind(e),a=n.bind(e);return(o,s)=>i(o,s)==a(o,s)}_bindColLit(e,t,n){const i=t.bind(e);if(t.vector instanceof Z0){let a;const o=t.vector;return o.dictionary!==this.lastDictionary?(a=o.reverseLookup(n.v),this.lastDictionary=o.dictionary,this.lastKey=a):a=this.lastKey,a===-1?()=>!1:s=>o.getKey(s)===a}else return(a,o)=>i(a,o)==n.v}_bindLitCol(e,t,n){return this._bindColLit(e,n,t)}}class iV extends ob{_bindLitLit(e,t,n){const i=t.v<=n.v;return()=>i}_bindColCol(e,t,n){const i=t.bind(e),a=n.bind(e);return(o,s)=>i(o,s)<=a(o,s)}_bindColLit(e,t,n){const i=t.bind(e);return(a,o)=>i(a,o)<=n.v}_bindLitCol(e,t,n){const i=n.bind(e);return(a,o)=>t.v<=i(a,o)}}class aV extends ob{_bindLitLit(e,t,n){const i=t.v>=n.v;return()=>i}_bindColCol(e,t,n){const i=t.bind(e),a=n.bind(e);return(o,s)=>i(o,s)>=a(o,s)}_bindColLit(e,t,n){const i=t.bind(e);return(a,o)=>i(a,o)>=n.v}_bindLitCol(e,t,n){const i=n.bind(e);return(a,o)=>t.v>=i(a,o)}}class Qv extends ab{constructor(e){super();this.child=e}bind(e){const t=this.child.bind(e);return(n,i)=>!t(n,i)}}$r.prototype.countBy=function(r){return new Ff(this.chunks).countBy(r)};$r.prototype.scan=function(r,e){return new Ff(this.chunks).scan(r,e)};$r.prototype.scanReverse=function(r,e){return new Ff(this.chunks).scanReverse(r,e)};$r.prototype.filter=function(r){return new Ff(this.chunks).filter(r)};class Ff extends $r{filter(e){return new cb(this.chunks,e)}scan(e,t){const n=this.chunks,i=n.length;for(let a=-1;++a<i;){const o=n[a];t&&t(o);for(let s=-1,u=o.length;++s<u;)e(s,o)}}scanReverse(e,t){const n=this.chunks,i=n.length;for(let a=i;--a>=0;){const o=n[a];t&&t(o);for(let s=o.length;--s>=0;)e(s,o)}}countBy(e){const t=this.chunks,n=t.length,i=typeof e=="string"?new wA(e):e;i.bind(t[n-1]);const a=i.vector;if(!yr.isDictionary(a.type))throw new Error("countBy currently only supports dictionary-encoded columns");const o=Math.ceil(Math.log(a.length)/Math.log(256)),s=o==4?Uint32Array:o>=2?Uint16Array:Uint8Array,u=new s(a.dictionary.length);for(let l=-1;++l<n;){const c=t[l];i.bind(c);const f=i.vector.indices;for(let d=-1,h=c.length;++d<h;){let v=f.get(d);v!==null&&u[v]++}}return new xA(a.dictionary,Ra.from(u))}}class xA extends $r{constructor(e,t){const n=new Qr([new Fr("values",e.type),new Fr("counts",t.type)]);super(new Ri(n,t.length,[e,t]))}toJSON(){const e=this.getColumnAt(0),t=this.getColumnAt(1),n={};for(let i=-1;++i<this.length;)n[e.get(i)]=t.get(i);return n}}class cb extends Ff{constructor(e,t){super(e);this._predicate=t}scan(e,t){const n=this._chunks,i=n.length;for(let a=-1;++a<i;){const o=n[a],s=this._predicate.bind(o);let u=!1;for(let l=-1,c=o.length;++l<c;)s(l,o)&&(t&&!u&&(t(o),u=!0),e(l,o))}}scanReverse(e,t){const n=this._chunks,i=n.length;for(let a=i;--a>=0;){const o=n[a],s=this._predicate.bind(o);let u=!1;for(let l=o.length;--l>=0;)s(l,o)&&(t&&!u&&(t(o),u=!0),e(l,o))}}count(){let e=0;const t=this._chunks,n=t.length;for(let i=-1;++i<n;){const a=t[i],o=this._predicate.bind(a);for(let s=-1,u=a.length;++s<u;)o(s,a)&&++e}return e}*[Symbol.iterator](){const e=this._chunks,t=e.length;for(let n=-1;++n<t;){const i=e[n],a=this._predicate.bind(i);for(let o=-1,s=i.length;++o<s;)a(o,i)&&(yield i.get(o))}}filter(e){return new cb(this._chunks,this._predicate.and(e))}countBy(e){const t=this._chunks,n=t.length,i=typeof e=="string"?new wA(e):e;i.bind(t[n-1]);const a=i.vector;if(!yr.isDictionary(a.type))throw new Error("countBy currently only supports dictionary-encoded columns");const o=Math.ceil(Math.log(a.length)/Math.log(256)),s=o==4?Uint32Array:o>=2?Uint16Array:Uint8Array,u=new s(a.dictionary.length);for(let l=-1;++l<n;){const c=t[l],f=this._predicate.bind(c);i.bind(c);const d=i.vector.indices;for(let h=-1,v=c.length;++h<v;){let p=d.get(h);p!==null&&f(h,c)&&u[p]++}}return new xA(a.dictionary,Ra.from(u))}}On(On(On(On(On(On({},E6),Vz),KG),w6),jG),Q6);Yi.toDOMStream=K$;bn.throughDOM=J$;Ba.throughDOM=tV;j0.throughDOM=rV;/**
 * @license
 * Copyright 2018-2021 Streamlit Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var _A=function(){function r(e,t,n,i){var a=this;this.getCell=function(o,s){var u=o<a.headerRows&&s<a.headerColumns,l=o>=a.headerRows&&s<a.headerColumns,c=o<a.headerRows&&s>=a.headerColumns;if(u){var f=["blank"];return s>0&&f.push("level"+o),{type:"blank",classNames:f.join(" "),content:""}}else if(c){var d=s-a.headerColumns,f=["col_heading","level"+o,"col"+d];return{type:"columns",classNames:f.join(" "),content:a.getContent(a.columnsTable,d,o)}}else if(l){var h=o-a.headerRows,f=["row_heading","level"+s,"row"+h];return{type:"index",id:"T_"+a.uuid+"level"+s+"_row"+h,classNames:f.join(" "),content:a.getContent(a.indexTable,h,s)}}else{var h=o-a.headerRows,d=s-a.headerColumns,f=["data","row"+h,"col"+d],v=a.styler?a.getContent(a.styler.displayValuesTable,h,d):a.getContent(a.dataTable,h,d);return{type:"data",id:"T_"+a.uuid+"row"+h+"_col"+d,classNames:f.join(" "),content:v}}},this.getContent=function(o,s,u){var l=o.getColumnAt(u);if(l===null)return"";var c=a.getColumnTypeId(o,u);switch(c){case ue.Timestamp:return a.nanosToDate(l.get(s));default:return l.get(s)}},this.dataTable=$r.from(e),this.indexTable=$r.from(t),this.columnsTable=$r.from(n),this.styler=i?{caption:i.caption,displayValuesTable:$r.from(i.displayValues),styles:i.styles,uuid:i.uuid}:void 0}return Object.defineProperty(r.prototype,"rows",{get:function(){return this.indexTable.length+this.columnsTable.numCols},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"columns",{get:function(){return this.indexTable.numCols+this.columnsTable.length},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"headerRows",{get:function(){return this.rows-this.dataRows},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"headerColumns",{get:function(){return this.columns-this.dataColumns},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"dataRows",{get:function(){return this.dataTable.length},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"dataColumns",{get:function(){return this.dataTable.numCols},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"uuid",{get:function(){return this.styler&&this.styler.uuid},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"caption",{get:function(){return this.styler&&this.styler.caption},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"styles",{get:function(){return this.styler&&this.styler.styles},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"table",{get:function(){return this.dataTable},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"index",{get:function(){return this.indexTable},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"columnTable",{get:function(){return this.columnsTable},enumerable:!0,configurable:!0}),r.prototype.serialize=function(){return{data:this.dataTable.serialize(),index:this.indexTable.serialize(),columns:this.columnsTable.serialize()}},r.prototype.getColumnTypeId=function(e,t){return e.schema.fields[t].type.typeId},r.prototype.nanosToDate=function(e){return new Date(e/1e6)},r}();/**
 * @license
 * Copyright 2018-2021 Streamlit Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var Uf=globalThis&&globalThis.__assign||function(){return Uf=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},Uf.apply(this,arguments)},Gf;(function(r){r.COMPONENT_READY="streamlit:componentReady",r.SET_COMPONENT_VALUE="streamlit:setComponentValue",r.SET_FRAME_HEIGHT="streamlit:setFrameHeight"})(Gf||(Gf={}));var SA=function(){function r(){}return r.API_VERSION=1,r.RENDER_EVENT="streamlit:render",r.events=new vs,r.registeredMessageListener=!1,r.setComponentReady=function(){r.registeredMessageListener||(window.addEventListener("message",r.onMessageEvent),r.registeredMessageListener=!0),r.sendBackMsg(Gf.COMPONENT_READY,{apiVersion:r.API_VERSION})},r.setFrameHeight=function(e){e===void 0&&(e=document.body.scrollHeight),e!==r.lastFrameHeight&&(r.lastFrameHeight=e,r.sendBackMsg(Gf.SET_FRAME_HEIGHT,{height:e}))},r.setComponentValue=function(e){var t;e instanceof _A?(t="dataframe",e=e.serialize()):sV(e)?(t="bytes",e=new Uint8Array(e.buffer)):e instanceof ArrayBuffer?(t="bytes",e=new Uint8Array(e)):t="json",r.sendBackMsg(Gf.SET_COMPONENT_VALUE,{value:e,dataType:t})},r.onMessageEvent=function(e){var t=e.data.type;switch(t){case r.RENDER_EVENT:r.onRenderMessage(e.data);break}},r.onRenderMessage=function(e){var t=e.args;t==null&&(console.error("Got null args in onRenderMessage. This should never happen"),t={});var n=e.dfs&&e.dfs.length>0?r.argsDataframeToObject(e.dfs):{};t=Uf(Uf({},t),n);var i=Boolean(e.disabled),a=e.theme;a&&oV(a);var o={disabled:i,args:t,theme:a},s=new CustomEvent(r.RENDER_EVENT,{detail:o});r.events.dispatchEvent(s)},r.argsDataframeToObject=function(e){var t=e.map(function(n){var i=n.key,a=n.value;return[i,r.toArrowTable(a)]});return Object.fromEntries(t)},r.toArrowTable=function(e){var t=e.data,n=t.data,i=t.index,a=t.columns,o=t.styler;return new _A(n,i,a,o)},r.sendBackMsg=function(e,t){window.parent.postMessage(Uf({isStreamlitMessage:!0,type:e},t),"*")},r}(),oV=function(r){var e=document.createElement("style");document.head.appendChild(e),e.innerHTML=`
    :root {
      --primary-color: `+r.primaryColor+`;
      --background-color: `+r.backgroundColor+`;
      --secondary-background-color: `+r.secondaryBackgroundColor+`;
      --text-color: `+r.textColor+`;
      --font: `+r.font+`;
    }

    body {
      background-color: var(--background-color);
      color: var(--text-color);
    }
  `};function sV(r){var e=!1;try{e=r instanceof BigInt64Array||r instanceof BigUint64Array}catch{}return r instanceof Int8Array||r instanceof Uint8Array||r instanceof Uint8ClampedArray||r instanceof Int16Array||r instanceof Uint16Array||r instanceof Int32Array||r instanceof Uint32Array||r instanceof Float32Array||r instanceof Float64Array||e}/**
 * @license
 * Copyright 2018-2021 Streamlit Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var uV=globalThis&&globalThis.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();(function(r){uV(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.componentDidMount=function(){SA.setFrameHeight()},e.prototype.componentDidUpdate=function(){SA.setFrameHeight()},e})(tG.PureComponent);const EA=(r,e,t=null,n=null)=>{if(typeof r=="object"){if(Array.isArray(r))r.forEach((i,a)=>EA(i,e,r,a));else if(r.constructor===Object)for(const i in r)EA(r[i],e,r,i)}else typeof t=="object"&&n!==null&&(t[n]=e(r))};/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var fb=function(r,e){return fb=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},fb(r,e)};function Wt(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");fb(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var P=function(){return P=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},P.apply(this,arguments)};function Ti(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t}function Uo(r,e,t,n){function i(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function s(c){try{l(n.next(c))}catch(f){o(f)}}function u(c){try{l(n.throw(c))}catch(f){o(f)}}function l(c){c.done?a(c.value):i(c.value).then(s,u)}l((n=n.apply(r,e||[])).next())})}function Go(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(l){return function(c){return u([l,c])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;t;)try{if(n=1,i&&(a=l[0]&2?i.return:l[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,l[1])).done)return a;switch(i=0,a&&(l=[l[0]&2,a.value]),l[0]){case 0:case 1:a=l;break;case 4:return t.label++,{value:l[1],done:!1};case 5:t.label++,i=l[1],l=[0];continue;case 7:l=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(l[0]===6||l[0]===2)){t=0;continue}if(l[0]===3&&(!a||l[1]>a[0]&&l[1]<a[3])){t.label=l[1];break}if(l[0]===6&&t.label<a[1]){t.label=a[1],a=l;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(l);break}a[2]&&t.ops.pop(),t.trys.pop();continue}l=e.call(r,t)}catch(c){l=[6,c],i=0}finally{n=a=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function lV(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),i=0,e=0;e<t;e++)for(var a=arguments[e],o=0,s=a.length;o<s;o++,i++)n[i]=a[o];return n}function no(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return r.concat(a||Array.prototype.slice.call(e))}var Bi=function(r){return r!==null&&typeof r!="function"&&isFinite(r.length)},Jv=function(r,e){return Bi(r)?r.indexOf(e)>-1:!1},zf=function(r,e){if(!Bi(r))return r;for(var t=[],n=0;n<r.length;n++){var i=r[n];e(i,n)&&t.push(i)}return t},cV=function(r,e){return e===void 0&&(e=[]),zf(r,function(t){return!Jv(e,t)})},fV={}.toString,Fa=function(r,e){return fV.call(r)==="[object "+e+"]"},on=function(r){return Fa(r,"Function")},xt=function(r){return r==null},Mt=function(r){return Array.isArray?Array.isArray(r):Fa(r,"Array")},gi=function(r){var e=typeof r;return r!==null&&e==="object"||e==="function"};function xe(r,e){if(!!r){var t;if(Mt(r))for(var n=0,i=r.length;n<i&&(t=e(r[n],n),t!==!1);n++);else if(gi(r)){for(var a in r)if(r.hasOwnProperty(a)&&(t=e(r[a],a),t===!1))break}}}var AA=Object.keys?function(r){return Object.keys(r)}:function(r){var e=[];return xe(r,function(t,n){on(r)&&n==="prototype"||e.push(n)}),e};function TA(r,e){var t=AA(e),n=t.length;if(xt(r))return!n;for(var i=0;i<n;i+=1){var a=t[i];if(e[a]!==r[a]||!(a in r))return!1}return!0}var ep=function(r){return typeof r=="object"&&r!==null},ei=function(r){if(!ep(r)||!Fa(r,"Object"))return!1;if(Object.getPrototypeOf(r)===null)return!0;for(var e=r;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(r)===e};function hV(r,e){if(!Mt(r))return null;var t;if(on(e)&&(t=e),ei(e)&&(t=function(i){return TA(i,e)}),t){for(var n=0;n<r.length;n+=1)if(t(r[n]))return r[n]}return null}function dV(r,e,t){t===void 0&&(t=0);for(var n=t;n<r.length;n++)if(e(r[n],n))return n;return-1}var vV=function(r,e){for(var t=null,n=0;n<r.length;n++){var i=r[n],a=i[e];if(!xt(a)){Mt(a)?t=a[0]:t=a;break}}return t},pV=function(r){if(!Mt(r))return[];for(var e=[],t=0;t<r.length;t++)e=e.concat(r[t]);return e},IA=function(r,e){if(e===void 0&&(e=[]),!Mt(r))e.push(r);else for(var t=0;t<r.length;t+=1)IA(r[t],e);return e},ca=function(r){if(!!Mt(r))return r.reduce(function(e,t){return Math.max(e,t)},r[0])},fa=function(r){if(!!Mt(r))return r.reduce(function(e,t){return Math.min(e,t)},r[0])},CA=function(r){var e=r.filter(function(o){return!isNaN(o)});if(!e.length)return{min:0,max:0};if(Mt(r[0])){for(var t=[],n=0;n<r.length;n++)t=t.concat(r[n]);e=t}var i=ca(e),a=fa(e);return{min:a,max:i}},MA=Array.prototype,gV=MA.splice,yV=MA.indexOf,mV=function(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var n=0;n<e.length;n++)for(var i=e[n],a=-1;(a=yV.call(r,i))>-1;)gV.call(r,a,1);return r},bV=Array.prototype.splice,kA=function(e,t){if(!Bi(e))return[];for(var n=e?t.length:0,i=n-1;n--;){var a=void 0,o=t[n];(n===i||o!==a)&&(a=o,bV.call(e,o,1))}return e},DA=function(r,e,t){if(!Mt(r)&&!ei(r))return r;var n=t;return xe(r,function(i,a){n=e(n,i,a)}),n},wV=function(r,e){var t=[];if(!Bi(r))return t;for(var n=-1,i=[],a=r.length;++n<a;){var o=r[n];e(o,n,r)&&(t.push(o),i.push(n))}return kA(r,i),t},We=function(r){return Fa(r,"String")};function xV(r,e){var t;if(on(e))t=function(i,a){return e(i)-e(a)};else{var n=[];We(e)?n.push(e):Mt(e)&&(n=e),t=function(i,a){for(var o=0;o<n.length;o+=1){var s=n[o];if(i[s]>a[s])return 1;if(i[s]<a[s])return-1}return 0}}return r.sort(t),r}function LA(r,e){e===void 0&&(e=new Map);var t=[];if(Array.isArray(r))for(var n=0,i=r.length;n<i;n++){var a=r[n];e.has(a)||(t.push(a),e.set(a,!0))}return t}var _V=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return LA([].concat.apply([],r))},SV=function(r,e){for(var t=[],n={},i=0;i<r.length;i++){var a=r[i],o=a[e];if(!xt(o)){Mt(o)||(o=[o]);for(var s=0;s<o.length;s++){var u=o[s];n[u]||(t.push(u),n[u]=!0)}}}return t};function io(r){if(Bi(r))return r[0]}function ha(r){if(Bi(r)){var e=r;return e[e.length-1]}}function EV(r,e){return Mt(r)||We(r)?r[0]===e:!1}function AV(r,e){return Mt(r)||We(r)?r[r.length-1]===e:!1}var TV=function(r,e){for(var t=0;t<r.length;t++)if(!e(r[t],t))return!1;return!0},IV=function(r,e){for(var t=0;t<r.length;t++)if(e(r[t],t))return!0;return!1},CV=Object.prototype.hasOwnProperty;function tp(r,e){if(!e||!Mt(r))return{};for(var t={},n=on(e)?e:function(s){return s[e]},i,a=0;a<r.length;a++){var o=r[a];i=n(o),CV.call(t,i)?t[i].push(o):t[i]=[o]}return t}function NA(r,e){if(!e)return{0:r};if(!on(e)){var t=Mt(e)?e:e.replace(/\s+/g,"").split("*");e=function(n){for(var i="_",a=0,o=t.length;a<o;a++)i+=n[t[a]]&&n[t[a]].toString();return i}}return tp(r,e)}var MV=function(r,e){if(!e)return[r];var t=NA(r,e),n=[];for(var i in t)n.push(t[i]);return n};function kV(r,e){return r["_wrap_"+e]}function ec(r,e){if(r["_wrap_"+e])return r["_wrap_"+e];var t=function(n){r[e](n)};return r["_wrap_"+e]=t,t}var OA={};function DV(r){var e=OA[r];if(!e){for(var t=r.toString(16),n=t.length;n<6;n++)t="0"+t;e="#"+t,OA[r]=e}return e}function LV(r){var e=0,t=0,n=0,i=0;return Mt(r)?r.length===1?e=t=n=i=r[0]:r.length===2?(e=n=r[0],t=i=r[1]):r.length===3?(e=r[0],t=i=r[1],n=r[2]):(e=r[0],t=r[1],n=r[2],i=r[3]):e=t=n=i=r,{r1:e,r2:t,r3:n,r4:i}}var NV=function(r,e,t){return r<e?e:r>t?t:r},rp=function(r,e){var t=e.toString(),n=t.indexOf(".");if(n===-1)return Math.round(r);var i=t.substr(n+1).length;return i>20&&(i=20),parseFloat(r.toFixed(i))},Ft=function(r){return Fa(r,"Number")},OV=function(r){return Ft(r)&&r%1!=0},PV=function(r){return Ft(r)&&r%2==0},RV=Number.isInteger?Number.isInteger:function(r){return Ft(r)&&r%1==0},BV=function(r){return Ft(r)&&r<0},FV=1e-5;function PA(r,e,t){return t===void 0&&(t=FV),Math.abs(r-e)<t}var UV=function(r){return Ft(r)&&r%2!=0},GV=function(r){return Ft(r)&&r>0},zV=function(r,e){if(!!Mt(r)){for(var t,n=-1/0,i=0;i<r.length;i++){var a=r[i],o=on(e)?e(a):a[e];o>n&&(t=a,n=o)}return t}},$V=function(r,e){if(!!Mt(r)){for(var t,n=1/0,i=0;i<r.length;i++){var a=r[i],o=on(e)?e(a):a[e];o<n&&(t=a,n=o)}return t}},np=function(r,e){return(r%e+e)%e},VV=180/Math.PI,jV=function(r){return VV*r},WV=parseInt,XV=Math.PI/180,ip=function(r){return XV*r},RA=function(r,e){return r.hasOwnProperty(e)},hb=Object.values?function(r){return Object.values(r)}:function(r){var e=[];return xe(r,function(t,n){on(r)&&n==="prototype"||e.push(t)}),e},YV=function(r,e){return Jv(hb(r),e)},tc=function(r){return xt(r)?"":r.toString()},HV=function(r){return tc(r).toLowerCase()},qV=function(r){var e=tc(r);return e.charAt(0).toLowerCase()+e.substring(1)};function KV(r,e){return!r||!e?r:r.replace(/\\?\{([^{}]+)\}/g,function(t,n){return t.charAt(0)==="\\"?t.slice(1):e[n]===void 0?"":e[n]})}var ZV=function(r){return tc(r).toUpperCase()},rc=function(r){var e=tc(r);return e.charAt(0).toUpperCase()+e.substring(1)},QV={}.toString,BA=function(r){return QV.call(r).replace(/^\[object /,"").replace(/]$/,"")},JV=function(r){return Fa(r,"Arguments")},db=function(r){return Fa(r,"Boolean")},vb=function(r){return Fa(r,"Date")},ej=function(r){return Fa(r,"Error")};function tj(r){return Ft(r)&&isFinite(r)}var rj=function(r){return r===null},nj=Object.prototype,FA=function(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||nj;return r===t},ij=function(r){return Fa(r,"RegExp")},aj=function(r){return r===void 0},oj=function(r){return r instanceof Element||r instanceof HTMLDocument};function UA(r){var e=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return setTimeout(t,16)};return e(r)}function GA(r){var e=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame||clearTimeout;e(r)}function pb(r,e){for(var t in e)e.hasOwnProperty(t)&&t!=="constructor"&&e[t]!==void 0&&(r[t]=e[t])}function It(r,e,t,n){return e&&pb(r,e),t&&pb(r,t),n&&pb(r,n),r}var sj=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];for(var t=r[0],n=1;n<r.length;n++){var i=r[n];on(i)&&(i=i.prototype),It(t.prototype,i)}},Ur=function(r){if(typeof r!="object"||r===null)return r;var e;if(Mt(r)){e=[];for(var t=0,n=r.length;t<n;t++)typeof r[t]=="object"&&r[t]!=null?e[t]=Ur(r[t]):e[t]=r[t]}else{e={};for(var i in r)typeof r[i]=="object"&&r[i]!=null?e[i]=Ur(r[i]):e[i]=r[i]}return e};function gb(r,e,t){var n;return function(){var i=this,a=arguments,o=function(){n=null,t||r.apply(i,a)},s=t&&!n;clearTimeout(n),n=setTimeout(o,e),s&&r.apply(i,a)}}var zA=function(r,e){if(!on(r))throw new TypeError("Expected a function");var t=function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var a=e?e.apply(this,n):n[0],o=t.cache;if(o.has(a))return o.get(a);var s=r.apply(this,n);return o.set(a,s),s};return t.cache=new Map,t},uj=5;function $A(r,e,t,n){t=t||0,n=n||uj;for(var i in e)if(e.hasOwnProperty(i)){var a=e[i];a!==null&&ei(a)?(ei(r[i])||(r[i]={}),t<n?$A(r[i],a,t+1,n):r[i]=e[i]):Mt(a)?(r[i]=[],r[i]=r[i].concat(a)):a!==void 0&&(r[i]=a)}}var tn=function(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var n=0;n<e.length;n+=1)$A(r,e[n]);return r},lj=function(r,e,t,n){on(e)||(t=e,e=r,r=function(){});var i=Object.create?function(o,s){return Object.create(o,{constructor:{value:s}})}:function(o,s){function u(){}u.prototype=o;var l=new u;return l.constructor=s,l},a=i(e.prototype,r);return r.prototype=It(a,r.prototype),r.superclass=i(e.prototype,e),It(a,t),It(r,n),r},yb=function(r,e){if(!Bi(r))return-1;var t=Array.prototype.indexOf;if(t)return t.call(r,e);for(var n=-1,i=0;i<r.length;i++)if(r[i]===e){n=i;break}return n},cj=Object.prototype.hasOwnProperty;function VA(r){if(xt(r))return!0;if(Bi(r))return!r.length;var e=BA(r);if(e==="Map"||e==="Set")return!r.size;if(FA(r))return!Object.keys(r).length;for(var t in r)if(cj.call(r,t))return!1;return!0}var Du=function(r,e){if(r===e)return!0;if(!r||!e||We(r)||We(e))return!1;if(Bi(r)||Bi(e)){if(r.length!==e.length)return!1;for(var t=!0,n=0;n<r.length&&(t=Du(r[n],e[n]),!!t);n++);return t}if(ep(r)||ep(e)){var i=Object.keys(r),a=Object.keys(e);if(i.length!==a.length)return!1;for(var t=!0,n=0;n<i.length&&(t=Du(r[i[n]],e[i[n]]),!!t);n++);return t}return!1},fj=function(r,e,t){return on(t)?!!t(r,e):Du(r,e)},Lu=function(r,e){if(!Bi(r))return r;for(var t=[],n=0;n<r.length;n++){var i=r[n];t.push(e(i,n))}return t},hj=function(r){return r},dj=function(r,e){e===void 0&&(e=hj);var t={};return gi(r)&&!xt(r)&&Object.keys(r).forEach(function(n){t[n]=e(r[n],n)}),t},zo=function(r,e,t){for(var n=0,i=We(e)?e.split("."):e;r&&n<i.length;)r=r[i[n++]];return r===void 0||n<i.length?t:r},vj=function(r,e,t){var n=r,i=We(e)?e.split("."):e;return i.forEach(function(a,o){o<i.length-1?(gi(n[a])||(n[a]=Ft(i[o+1])?[]:{}),n=n[a]):n[a]=t}),r},pj=Object.prototype.hasOwnProperty,gj=function(r,e){if(r===null||!ei(r))return{};var t={};return xe(e,function(n){pj.call(r,n)&&(t[n]=r[n])}),t},yj=function(r,e){return DA(r,function(t,n,i){return e.includes(i)||(t[i]=n),t},{})},mb=function(r,e,t){var n,i,a,o,s=0;t||(t={});var u=function(){s=t.leading===!1?0:Date.now(),n=null,o=r.apply(i,a),n||(i=a=null)},l=function(){var c=Date.now();!s&&t.leading===!1&&(s=c);var f=e-(c-s);return i=this,a=arguments,f<=0||f>e?(n&&(clearTimeout(n),n=null),s=c,o=r.apply(i,a),n||(i=a=null)):!n&&t.trailing!==!1&&(n=setTimeout(u,f)),o};return l.cancel=function(){clearTimeout(n),s=0,n=i=a=null},l},jA=function(r){return Bi(r)?Array.prototype.slice.call(r):[]},ap={},ao=function(r){return r=r||"g",ap[r]?ap[r]+=1:ap[r]=1,r+ap[r]},$f=function(){},mj=function(r){return r};function op(r){return xt(r)?0:Bi(r)?r.length:Object.keys(r).length}var sp,Vf=zA(function(r,e){e===void 0&&(e={});var t=e.fontSize,n=e.fontFamily,i=e.fontWeight,a=e.fontStyle,o=e.fontVariant;return sp||(sp=document.createElement("canvas").getContext("2d")),sp.font=[a,o,i,t+"px",n].join(" "),sp.measureText(We(r)?r:"").width},function(r,e){return e===void 0&&(e={}),lV([r],hb(e)).join("")}),bj=function(r,e,t,n){n===void 0&&(n="...");var i=16,a=Vf(n,t),o=We(r)?r:tc(r),s=e,u=[],l,c;if(Vf(r,t)<=e)return r;for(;l=o.substr(0,i),c=Vf(l,t),!(c+a>s&&c>s);)if(u.push(l),s-=c,o=o.substr(i),!o)return u.join("");for(;l=o.substr(0,1),c=Vf(l,t),!(c+a>s);)if(u.push(l),s-=c,o=o.substr(1),!o)return u.join("");return""+u.join("")+n},wj=function(){function r(){this.map={}}return r.prototype.has=function(e){return this.map[e]!==void 0},r.prototype.get=function(e,t){var n=this.map[e];return n===void 0?t:n},r.prototype.set=function(e,t){this.map[e]=t},r.prototype.clear=function(){this.map={}},r.prototype.delete=function(e){delete this.map[e]},r.prototype.size=function(){return Object.keys(this.map).length},r}(),xj=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",contains:Jv,includes:Jv,difference:cV,find:hV,findIndex:dV,firstValue:vV,flatten:pV,flattenDeep:IA,getRange:CA,pull:mV,pullAt:kA,reduce:DA,remove:wV,sortBy:xV,union:_V,uniq:LA,valuesOfKey:SV,head:io,last:ha,startsWith:EV,endsWith:AV,filter:zf,every:TV,some:IV,group:MV,groupBy:tp,groupToMap:NA,getWrapBehavior:kV,wrapBehavior:ec,number2color:DV,parseRadius:LV,clamp:NV,fixedBase:rp,isDecimal:OV,isEven:PV,isInteger:RV,isNegative:BV,isNumberEqual:PA,isOdd:UV,isPositive:GV,max:ca,maxBy:zV,min:fa,minBy:$V,mod:np,toDegree:jV,toInteger:WV,toRadian:ip,forIn:xe,has:RA,hasKey:RA,hasValue:YV,keys:AA,isMatch:TA,values:hb,lowerCase:HV,lowerFirst:qV,substitute:KV,upperCase:ZV,upperFirst:rc,getType:BA,isArguments:JV,isArray:Mt,isArrayLike:Bi,isBoolean:db,isDate:vb,isError:ej,isFunction:on,isFinite:tj,isNil:xt,isNull:rj,isNumber:Ft,isObject:gi,isObjectLike:ep,isPlainObject:ei,isPrototype:FA,isRegExp:ij,isString:We,isType:Fa,isUndefined:aj,isElement:oj,requestAnimationFrame:UA,clearAnimationFrame:GA,augment:sj,clone:Ur,debounce:gb,memoize:zA,deepMix:tn,each:xe,extend:lj,indexOf:yb,isEmpty:VA,isEqual:Du,isEqualWith:fj,map:Lu,mapValues:dj,mix:It,assign:It,get:zo,set:vj,pick:gj,omit:yj,throttle:mb,toArray:jA,toString:tc,uniqueId:ao,noop:$f,identity:mj,size:op,measureTextWidth:Vf,getEllipsisText:bj,Cache:wj}),_j={getDefaultCfg:function(){return{}},getEvents:function(){return{}},updateCfg:function(e){return Object.assign(this,e),!0},shouldBegin:function(){return!0},shouldUpdate:function(){return!0},shouldEnd:function(){return!0},bind:function(e){var t=this,n=this.events;this.graph=e,(this.type==="drag-canvas"||this.type==="brush-select"||this.type==="lasso-select")&&e.get("canvas").set("draggable",!0),xe(n,function(i,a){e.on(a,i)}),document.addEventListener("visibilitychange",function(){t.keydown=!1})},unbind:function(e){var t=this.events,n=e.get("canvas").get("draggable");(this.type==="drag-canvas"||this.type==="brush-select"||this.type==="lasso-select")&&e.get("canvas").set("draggable",!1),xe(t,function(i,a){e.off(a,i)}),e.get("canvas").set("draggable",n)},get:function(e){return this[e]},set:function(e,t){return this[e]=t,this}},WA=function(){function r(){}return r.registerBehavior=function(e,t){if(!t)throw new Error("please specify handler for this behavior: "+e);var n=Ur(_j);Object.assign(n,t);var i=function(o){var s=this;Object.assign(this,this.getDefaultCfg(),o);var u=this.getEvents();this.events=null;var l={};u&&(xe(u,function(c,f){l[f]=ec(s,c)}),this.events=l)};i.prototype=n,r.types[e]=i},r.hasBehavior=function(e){return!!r.types[e]},r.getBehavior=function(e){return r.types[e]},r.types={},r}(),Sj="*",XA=function(){function r(){this._events={}}return r.prototype.on=function(e,t,n){return this._events[e]||(this._events[e]=[]),this._events[e].push({callback:t,once:!!n}),this},r.prototype.once=function(e,t){return this.on(e,t,!0),this},r.prototype.emit=function(e){for(var t=this,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var a=this._events[e]||[],o=this._events[Sj]||[],s=function(u){for(var l=u.length,c=0;c<l;c++)if(!!u[c]){var f=u[c],d=f.callback,h=f.once;h&&(u.splice(c,1),u.length===0&&delete t._events[e],l--,c--),d.apply(t,n)}};s(a),s(o)},r.prototype.off=function(e,t){if(!e)this._events={};else if(!t)delete this._events[e];else{for(var n=this._events[e]||[],i=n.length,a=0;a<i;a++)n[a].callback===t&&(n.splice(a,1),i--,a--);n.length===0&&delete this._events[e]}return this},r.prototype.getEvents=function(){return this._events},r}(),Qi=1e-6,$n=typeof Float32Array!="undefined"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var r=0,e=arguments.length;e--;)r+=arguments[e]*arguments[e];return Math.sqrt(r)});function nc(){var r=new $n(9);return $n!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function YA(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[4],r[4]=e[5],r[5]=e[6],r[6]=e[8],r[7]=e[9],r[8]=e[10],r}function Ej(r){var e=new $n(9);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e}function Aj(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r}function Tj(r,e,t,n,i,a,o,s,u){var l=new $n(9);return l[0]=r,l[1]=e,l[2]=t,l[3]=n,l[4]=i,l[5]=a,l[6]=o,l[7]=s,l[8]=u,l}function Ij(r,e,t,n,i,a,o,s,u,l){return r[0]=e,r[1]=t,r[2]=n,r[3]=i,r[4]=a,r[5]=o,r[6]=s,r[7]=u,r[8]=l,r}function Cj(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=1,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}function Mj(r,e){if(r===e){var t=e[1],n=e[2],i=e[5];r[1]=e[3],r[2]=e[6],r[3]=t,r[5]=e[7],r[6]=n,r[7]=i}else r[0]=e[0],r[1]=e[3],r[2]=e[6],r[3]=e[1],r[4]=e[4],r[5]=e[7],r[6]=e[2],r[7]=e[5],r[8]=e[8];return r}function bb(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=e[4],s=e[5],u=e[6],l=e[7],c=e[8],f=c*o-s*l,d=-c*a+s*u,h=l*a-o*u,v=t*f+n*d+i*h;return v?(v=1/v,r[0]=f*v,r[1]=(-c*n+i*l)*v,r[2]=(s*n-i*o)*v,r[3]=d*v,r[4]=(c*t-i*u)*v,r[5]=(-s*t+i*a)*v,r[6]=h*v,r[7]=(-l*t+n*u)*v,r[8]=(o*t-n*a)*v,r):null}function kj(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=e[4],s=e[5],u=e[6],l=e[7],c=e[8];return r[0]=o*c-s*l,r[1]=i*l-n*c,r[2]=n*s-i*o,r[3]=s*u-a*c,r[4]=t*c-i*u,r[5]=i*a-t*s,r[6]=a*l-o*u,r[7]=n*u-t*l,r[8]=t*o-n*a,r}function Dj(r){var e=r[0],t=r[1],n=r[2],i=r[3],a=r[4],o=r[5],s=r[6],u=r[7],l=r[8];return e*(l*a-o*u)+t*(-l*i+o*s)+n*(u*i-a*s)}function ti(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],u=e[5],l=e[6],c=e[7],f=e[8],d=t[0],h=t[1],v=t[2],p=t[3],g=t[4],y=t[5],m=t[6],b=t[7],w=t[8];return r[0]=d*n+h*o+v*l,r[1]=d*i+h*s+v*c,r[2]=d*a+h*u+v*f,r[3]=p*n+g*o+y*l,r[4]=p*i+g*s+y*c,r[5]=p*a+g*u+y*f,r[6]=m*n+b*o+w*l,r[7]=m*i+b*s+w*c,r[8]=m*a+b*u+w*f,r}function Lj(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],u=e[5],l=e[6],c=e[7],f=e[8],d=t[0],h=t[1];return r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=s,r[5]=u,r[6]=d*n+h*o+l,r[7]=d*i+h*s+c,r[8]=d*a+h*u+f,r}function Nj(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],u=e[5],l=e[6],c=e[7],f=e[8],d=Math.sin(t),h=Math.cos(t);return r[0]=h*n+d*o,r[1]=h*i+d*s,r[2]=h*a+d*u,r[3]=h*o-d*n,r[4]=h*s-d*i,r[5]=h*u-d*a,r[6]=l,r[7]=c,r[8]=f,r}function Oj(r,e,t){var n=t[0],i=t[1];return r[0]=n*e[0],r[1]=n*e[1],r[2]=n*e[2],r[3]=i*e[3],r[4]=i*e[4],r[5]=i*e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r}function jf(r,e){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=1,r[5]=0,r[6]=e[0],r[7]=e[1],r[8]=1,r}function Wf(r,e){var t=Math.sin(e),n=Math.cos(e);return r[0]=n,r[1]=t,r[2]=0,r[3]=-t,r[4]=n,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}function Xf(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=0,r[4]=e[1],r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}function Pj(r,e){return r[0]=e[0],r[1]=e[1],r[2]=0,r[3]=e[2],r[4]=e[3],r[5]=0,r[6]=e[4],r[7]=e[5],r[8]=1,r}function Rj(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=t+t,s=n+n,u=i+i,l=t*o,c=n*o,f=n*s,d=i*o,h=i*s,v=i*u,p=a*o,g=a*s,y=a*u;return r[0]=1-f-v,r[3]=c-y,r[6]=d+g,r[1]=c+y,r[4]=1-l-v,r[7]=h-p,r[2]=d-g,r[5]=h+p,r[8]=1-l-f,r}function HA(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=e[4],s=e[5],u=e[6],l=e[7],c=e[8],f=e[9],d=e[10],h=e[11],v=e[12],p=e[13],g=e[14],y=e[15],m=t*s-n*o,b=t*u-i*o,w=t*l-a*o,x=n*u-i*s,_=n*l-a*s,A=i*l-a*u,I=c*p-f*v,M=c*g-d*v,S=c*y-h*v,C=f*g-d*p,T=f*y-h*p,k=d*y-h*g,L=m*k-b*T+w*C+x*S-_*M+A*I;return L?(L=1/L,r[0]=(s*k-u*T+l*C)*L,r[1]=(u*S-o*k-l*M)*L,r[2]=(o*T-s*S+l*I)*L,r[3]=(i*T-n*k-a*C)*L,r[4]=(t*k-i*S+a*M)*L,r[5]=(n*S-t*T-a*I)*L,r[6]=(p*A-g*_+y*x)*L,r[7]=(g*w-v*A-y*b)*L,r[8]=(v*_-p*w+y*m)*L,r):null}function Bj(r,e,t){return r[0]=2/e,r[1]=0,r[2]=0,r[3]=0,r[4]=-2/t,r[5]=0,r[6]=-1,r[7]=1,r[8]=1,r}function Fj(r){return"mat3("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+", "+r[4]+", "+r[5]+", "+r[6]+", "+r[7]+", "+r[8]+")"}function Uj(r){return Math.hypot(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8])}function Gj(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r[8]=e[8]+t[8],r}function qA(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r[6]=e[6]-t[6],r[7]=e[7]-t[7],r[8]=e[8]-t[8],r}function zj(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r[8]=e[8]*t,r}function $j(r,e,t,n){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r[2]=e[2]+t[2]*n,r[3]=e[3]+t[3]*n,r[4]=e[4]+t[4]*n,r[5]=e[5]+t[5]*n,r[6]=e[6]+t[6]*n,r[7]=e[7]+t[7]*n,r[8]=e[8]+t[8]*n,r}function Vj(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]&&r[4]===e[4]&&r[5]===e[5]&&r[6]===e[6]&&r[7]===e[7]&&r[8]===e[8]}function jj(r,e){var t=r[0],n=r[1],i=r[2],a=r[3],o=r[4],s=r[5],u=r[6],l=r[7],c=r[8],f=e[0],d=e[1],h=e[2],v=e[3],p=e[4],g=e[5],y=e[6],m=e[7],b=e[8];return Math.abs(t-f)<=Qi*Math.max(1,Math.abs(t),Math.abs(f))&&Math.abs(n-d)<=Qi*Math.max(1,Math.abs(n),Math.abs(d))&&Math.abs(i-h)<=Qi*Math.max(1,Math.abs(i),Math.abs(h))&&Math.abs(a-v)<=Qi*Math.max(1,Math.abs(a),Math.abs(v))&&Math.abs(o-p)<=Qi*Math.max(1,Math.abs(o),Math.abs(p))&&Math.abs(s-g)<=Qi*Math.max(1,Math.abs(s),Math.abs(g))&&Math.abs(u-y)<=Qi*Math.max(1,Math.abs(u),Math.abs(y))&&Math.abs(l-m)<=Qi*Math.max(1,Math.abs(l),Math.abs(m))&&Math.abs(c-b)<=Qi*Math.max(1,Math.abs(c),Math.abs(b))}var Wj=ti,Xj=qA,Yj=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",create:nc,fromMat4:YA,clone:Ej,copy:Aj,fromValues:Tj,set:Ij,identity:Cj,transpose:Mj,invert:bb,adjoint:kj,determinant:Dj,multiply:ti,translate:Lj,rotate:Nj,scale:Oj,fromTranslation:jf,fromRotation:Wf,fromScaling:Xf,fromMat2d:Pj,fromQuat:Rj,normalFromMat4:HA,projection:Bj,str:Fj,frob:Uj,add:Gj,subtract:qA,multiplyScalar:zj,multiplyScalarAndAdd:$j,exactEquals:Vj,equals:jj,mul:Wj,sub:Xj});function Fi(){var r=new $n(16);return $n!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r}function Hj(r){var e=new $n(16);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],e}function wb(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r}function KA(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function up(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=e[4],s=e[5],u=e[6],l=e[7],c=e[8],f=e[9],d=e[10],h=e[11],v=e[12],p=e[13],g=e[14],y=e[15],m=t*s-n*o,b=t*u-i*o,w=t*l-a*o,x=n*u-i*s,_=n*l-a*s,A=i*l-a*u,I=c*p-f*v,M=c*g-d*v,S=c*y-h*v,C=f*g-d*p,T=f*y-h*p,k=d*y-h*g,L=m*k-b*T+w*C+x*S-_*M+A*I;return L?(L=1/L,r[0]=(s*k-u*T+l*C)*L,r[1]=(i*T-n*k-a*C)*L,r[2]=(p*A-g*_+y*x)*L,r[3]=(d*_-f*A-h*x)*L,r[4]=(u*S-o*k-l*M)*L,r[5]=(t*k-i*S+a*M)*L,r[6]=(g*w-v*A-y*b)*L,r[7]=(c*A-d*w+h*b)*L,r[8]=(o*T-s*S+l*I)*L,r[9]=(n*S-t*T-a*I)*L,r[10]=(v*_-p*w+y*m)*L,r[11]=(f*w-c*_-h*m)*L,r[12]=(s*M-o*C-u*I)*L,r[13]=(t*C-n*M+i*I)*L,r[14]=(p*b-v*x-g*m)*L,r[15]=(c*x-f*b+d*m)*L,r):null}function Nu(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],u=e[5],l=e[6],c=e[7],f=e[8],d=e[9],h=e[10],v=e[11],p=e[12],g=e[13],y=e[14],m=e[15],b=t[0],w=t[1],x=t[2],_=t[3];return r[0]=b*n+w*s+x*f+_*p,r[1]=b*i+w*u+x*d+_*g,r[2]=b*a+w*l+x*h+_*y,r[3]=b*o+w*c+x*v+_*m,b=t[4],w=t[5],x=t[6],_=t[7],r[4]=b*n+w*s+x*f+_*p,r[5]=b*i+w*u+x*d+_*g,r[6]=b*a+w*l+x*h+_*y,r[7]=b*o+w*c+x*v+_*m,b=t[8],w=t[9],x=t[10],_=t[11],r[8]=b*n+w*s+x*f+_*p,r[9]=b*i+w*u+x*d+_*g,r[10]=b*a+w*l+x*h+_*y,r[11]=b*o+w*c+x*v+_*m,b=t[12],w=t[13],x=t[14],_=t[15],r[12]=b*n+w*s+x*f+_*p,r[13]=b*i+w*u+x*d+_*g,r[14]=b*a+w*l+x*h+_*y,r[15]=b*o+w*c+x*v+_*m,r}function Yf(r,e,t){var n=t[0],i=t[1],a=t[2],o,s,u,l,c,f,d,h,v,p,g,y;return e===r?(r[12]=e[0]*n+e[4]*i+e[8]*a+e[12],r[13]=e[1]*n+e[5]*i+e[9]*a+e[13],r[14]=e[2]*n+e[6]*i+e[10]*a+e[14],r[15]=e[3]*n+e[7]*i+e[11]*a+e[15]):(o=e[0],s=e[1],u=e[2],l=e[3],c=e[4],f=e[5],d=e[6],h=e[7],v=e[8],p=e[9],g=e[10],y=e[11],r[0]=o,r[1]=s,r[2]=u,r[3]=l,r[4]=c,r[5]=f,r[6]=d,r[7]=h,r[8]=v,r[9]=p,r[10]=g,r[11]=y,r[12]=o*n+c*i+v*a+e[12],r[13]=s*n+f*i+p*a+e[13],r[14]=u*n+d*i+g*a+e[14],r[15]=l*n+h*i+y*a+e[15]),r}function qj(r,e,t){var n=Math.sin(t),i=Math.cos(t),a=e[4],o=e[5],s=e[6],u=e[7],l=e[8],c=e[9],f=e[10],d=e[11];return e!==r&&(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[4]=a*i+l*n,r[5]=o*i+c*n,r[6]=s*i+f*n,r[7]=u*i+d*n,r[8]=l*i-a*n,r[9]=c*i-o*n,r[10]=f*i-s*n,r[11]=d*i-u*n,r}function Kj(r,e,t){var n=Math.sin(t),i=Math.cos(t),a=e[0],o=e[1],s=e[2],u=e[3],l=e[8],c=e[9],f=e[10],d=e[11];return e!==r&&(r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=a*i-l*n,r[1]=o*i-c*n,r[2]=s*i-f*n,r[3]=u*i-d*n,r[8]=a*n+l*i,r[9]=o*n+c*i,r[10]=s*n+f*i,r[11]=u*n+d*i,r}function Hf(r,e){return r[0]=e[12],r[1]=e[13],r[2]=e[14],r}function ic(r,e){var t=e[0],n=e[1],i=e[2],a=e[4],o=e[5],s=e[6],u=e[8],l=e[9],c=e[10];return r[0]=Math.hypot(t,n,i),r[1]=Math.hypot(a,o,s),r[2]=Math.hypot(u,l,c),r}function qf(r,e){var t=new $n(3);ic(t,e);var n=1/t[0],i=1/t[1],a=1/t[2],o=e[0]*n,s=e[1]*i,u=e[2]*a,l=e[4]*n,c=e[5]*i,f=e[6]*a,d=e[8]*n,h=e[9]*i,v=e[10]*a,p=o+c+v,g=0;return p>0?(g=Math.sqrt(p+1)*2,r[3]=.25*g,r[0]=(f-h)/g,r[1]=(d-u)/g,r[2]=(s-l)/g):o>c&&o>v?(g=Math.sqrt(1+o-c-v)*2,r[3]=(f-h)/g,r[0]=.25*g,r[1]=(s+l)/g,r[2]=(d+u)/g):c>v?(g=Math.sqrt(1+c-o-v)*2,r[3]=(d-u)/g,r[0]=(s+l)/g,r[1]=.25*g,r[2]=(f+h)/g):(g=Math.sqrt(1+v-o-c)*2,r[3]=(s-l)/g,r[0]=(d+u)/g,r[1]=(f+h)/g,r[2]=.25*g),r}function Zj(r,e,t,n){var i=e[0],a=e[1],o=e[2],s=e[3],u=i+i,l=a+a,c=o+o,f=i*u,d=i*l,h=i*c,v=a*l,p=a*c,g=o*c,y=s*u,m=s*l,b=s*c,w=n[0],x=n[1],_=n[2];return r[0]=(1-(v+g))*w,r[1]=(d+b)*w,r[2]=(h-m)*w,r[3]=0,r[4]=(d-b)*x,r[5]=(1-(f+g))*x,r[6]=(p+y)*x,r[7]=0,r[8]=(h+m)*_,r[9]=(p-y)*_,r[10]=(1-(f+v))*_,r[11]=0,r[12]=t[0],r[13]=t[1],r[14]=t[2],r[15]=1,r}function ZA(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=t+t,s=n+n,u=i+i,l=t*o,c=n*o,f=n*s,d=i*o,h=i*s,v=i*u,p=a*o,g=a*s,y=a*u;return r[0]=1-f-v,r[1]=c+y,r[2]=d-g,r[3]=0,r[4]=c-y,r[5]=1-l-v,r[6]=h+p,r[7]=0,r[8]=d+g,r[9]=h-p,r[10]=1-l-f,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function Qj(r,e,t,n,i){var a=1/Math.tan(e/2),o;return r[0]=a/t,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=a,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,i!=null&&i!==1/0?(o=1/(n-i),r[10]=(i+n)*o,r[14]=2*i*n*o):(r[10]=-1,r[14]=-2*n),r}var Jj=Qj;function eW(r,e,t,n,i,a,o){var s=1/(e-t),u=1/(n-i),l=1/(a-o);return r[0]=-2*s,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*u,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*l,r[11]=0,r[12]=(e+t)*s,r[13]=(i+n)*u,r[14]=(o+a)*l,r[15]=1,r}var tW=eW;function rW(r,e,t,n){var i,a,o,s,u,l,c,f,d,h,v=e[0],p=e[1],g=e[2],y=n[0],m=n[1],b=n[2],w=t[0],x=t[1],_=t[2];return Math.abs(v-w)<Qi&&Math.abs(p-x)<Qi&&Math.abs(g-_)<Qi?KA(r):(c=v-w,f=p-x,d=g-_,h=1/Math.hypot(c,f,d),c*=h,f*=h,d*=h,i=m*d-b*f,a=b*c-y*d,o=y*f-m*c,h=Math.hypot(i,a,o),h?(h=1/h,i*=h,a*=h,o*=h):(i=0,a=0,o=0),s=f*o-d*a,u=d*i-c*o,l=c*a-f*i,h=Math.hypot(s,u,l),h?(h=1/h,s*=h,u*=h,l*=h):(s=0,u=0,l=0),r[0]=i,r[1]=s,r[2]=c,r[3]=0,r[4]=a,r[5]=u,r[6]=f,r[7]=0,r[8]=o,r[9]=l,r[10]=d,r[11]=0,r[12]=-(i*v+a*p+o*g),r[13]=-(s*v+u*p+l*g),r[14]=-(c*v+f*p+d*g),r[15]=1,r)}function Vr(){var r=new $n(3);return $n!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function $o(r){var e=new $n(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e}function lp(r){var e=r[0],t=r[1],n=r[2];return Math.hypot(e,t,n)}function nr(r,e,t){var n=new $n(3);return n[0]=r,n[1]=e,n[2]=t,n}function ui(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r}function ac(r,e,t,n){return r[0]=e,r[1]=t,r[2]=n,r}function Vo(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r}function xb(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r}function nW(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r[2]=e[2]*t[2],r}function Kf(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r}function iW(r,e){var t=e[0]-r[0],n=e[1]-r[1],i=e[2]-r[2];return Math.hypot(t,n,i)}function Zf(r,e){var t=e[0],n=e[1],i=e[2],a=t*t+n*n+i*i;return a>0&&(a=1/Math.sqrt(a)),r[0]=e[0]*a,r[1]=e[1]*a,r[2]=e[2]*a,r}function cp(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}function _b(r,e,t){var n=e[0],i=e[1],a=e[2],o=t[0],s=t[1],u=t[2];return r[0]=i*u-a*s,r[1]=a*o-n*u,r[2]=n*s-i*o,r}function Ou(r,e,t,n){var i=e[0],a=e[1],o=e[2];return r[0]=i+n*(t[0]-i),r[1]=a+n*(t[1]-a),r[2]=o+n*(t[2]-o),r}function Sb(r,e,t){var n=e[0],i=e[1],a=e[2],o=t[3]*n+t[7]*i+t[11]*a+t[15];return o=o||1,r[0]=(t[0]*n+t[4]*i+t[8]*a+t[12])/o,r[1]=(t[1]*n+t[5]*i+t[9]*a+t[13])/o,r[2]=(t[2]*n+t[6]*i+t[10]*a+t[14])/o,r}function oc(r,e,t){var n=e[0],i=e[1],a=e[2];return r[0]=n*t[0]+i*t[3]+a*t[6],r[1]=n*t[1]+i*t[4]+a*t[7],r[2]=n*t[2]+i*t[5]+a*t[8],r}function aW(r,e,t){var n=t[0],i=t[1],a=t[2],o=t[3],s=e[0],u=e[1],l=e[2],c=i*l-a*u,f=a*s-n*l,d=n*u-i*s,h=i*d-a*f,v=a*c-n*d,p=n*f-i*c,g=o*2;return c*=g,f*=g,d*=g,h*=2,v*=2,p*=2,r[0]=s+c+h,r[1]=u+f+v,r[2]=l+d+p,r}var Eb=xb,QA=iW,JA=lp;(function(){var r=Vr();return function(e,t,n,i,a,o){var s,u;for(t||(t=3),n||(n=0),i?u=Math.min(i*t+n,e.length):u=e.length,s=n;s<u;s+=t)r[0]=e[s],r[1]=e[s+1],r[2]=e[s+2],a(r,r,o),e[s]=r[0],e[s+1]=r[1],e[s+2]=r[2];return e}})();function Qf(){var r=new $n(4);return $n!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0,r[3]=0),r}function eT(r,e,t,n){var i=new $n(4);return i[0]=r,i[1]=e,i[2]=t,i[3]=n,i}function oW(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r}function sW(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=t*t+n*n+i*i+a*a;return o>0&&(o=1/Math.sqrt(o)),r[0]=t*o,r[1]=n*o,r[2]=i*o,r[3]=a*o,r}function Jf(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3];return r[0]=t[0]*n+t[4]*i+t[8]*a+t[12]*o,r[1]=t[1]*n+t[5]*i+t[9]*a+t[13]*o,r[2]=t[2]*n+t[6]*i+t[10]*a+t[14]*o,r[3]=t[3]*n+t[7]*i+t[11]*a+t[15]*o,r}(function(){var r=Qf();return function(e,t,n,i,a,o){var s,u;for(t||(t=4),n||(n=0),i?u=Math.min(i*t+n,e.length):u=e.length,s=n;s<u;s+=t)r[0]=e[s],r[1]=e[s+1],r[2]=e[s+2],r[3]=e[s+3],a(r,r,o),e[s]=r[0],e[s+1]=r[1],e[s+2]=r[2],e[s+3]=r[3];return e}})();function Vn(){var r=new $n(4);return $n!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function Pu(r,e,t){t=t*.5;var n=Math.sin(t);return r[0]=n*e[0],r[1]=n*e[1],r[2]=n*e[2],r[3]=Math.cos(t),r}function da(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=t[0],u=t[1],l=t[2],c=t[3];return r[0]=n*c+o*s+i*l-a*u,r[1]=i*c+o*u+a*s-n*l,r[2]=a*c+o*l+n*u-i*s,r[3]=o*c-n*s-i*u-a*l,r}function fp(r,e,t,n){var i=e[0],a=e[1],o=e[2],s=e[3],u=t[0],l=t[1],c=t[2],f=t[3],d,h,v,p,g;return h=i*u+a*l+o*c+s*f,h<0&&(h=-h,u=-u,l=-l,c=-c,f=-f),1-h>Qi?(d=Math.acos(h),v=Math.sin(d),p=Math.sin((1-n)*d)/v,g=Math.sin(n*d)/v):(p=1-n,g=n),r[0]=p*i+g*u,r[1]=p*a+g*l,r[2]=p*o+g*c,r[3]=p*s+g*f,r}function tT(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=t*t+n*n+i*i+a*a,s=o?1/o:0;return r[0]=-t*s,r[1]=-n*s,r[2]=-i*s,r[3]=a*s,r}function uW(r,e){var t=e[0]+e[4]+e[8],n;if(t>0)n=Math.sqrt(t+1),r[3]=.5*n,n=.5/n,r[0]=(e[5]-e[7])*n,r[1]=(e[6]-e[2])*n,r[2]=(e[1]-e[3])*n;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[i*3+i]&&(i=2);var a=(i+1)%3,o=(i+2)%3;n=Math.sqrt(e[i*3+i]-e[a*3+a]-e[o*3+o]+1),r[i]=.5*n,n=.5/n,r[3]=(e[a*3+o]-e[o*3+a])*n,r[a]=(e[a*3+i]+e[i*3+a])*n,r[o]=(e[o*3+i]+e[i*3+o])*n}return r}function Ab(r,e,t,n){var i=.5*Math.PI/180;e*=i,t*=i,n*=i;var a=Math.sin(e),o=Math.cos(e),s=Math.sin(t),u=Math.cos(t),l=Math.sin(n),c=Math.cos(n);return r[0]=a*u*c-o*s*l,r[1]=o*s*c+a*u*l,r[2]=o*u*l-a*s*c,r[3]=o*u*c+a*s*l,r}var Tb=eT,eh=oW,lW=da,sc=sW;(function(){var r=Vr(),e=nr(1,0,0),t=nr(0,1,0);return function(n,i,a){var o=cp(i,a);return o<-.999999?(_b(r,e,i),JA(r)<1e-6&&_b(r,t,i),Zf(r,r),Pu(n,r,Math.PI),n):o>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(_b(r,i,a),n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=1+o,sc(n,n))}})();(function(){var r=Vn(),e=Vn();return function(t,n,i,a,o,s){return fp(r,n,o,s),fp(e,i,a,s),fp(t,r,e,2*s*(1-s)),t}})();(function(){var r=nc();return function(e,t,n,i){return r[0]=n[0],r[3]=n[1],r[6]=n[2],r[1]=i[0],r[4]=i[1],r[7]=i[2],r[2]=-t[0],r[5]=-t[1],r[8]=-t[2],sc(e,uW(e,r))}})();function cW(){var r=new $n(2);return $n!=Float32Array&&(r[0]=0,r[1]=0),r}function li(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r}function fW(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r}function Ru(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r}function Bu(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r}function Ii(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r}function rT(r,e){var t=e[0]-r[0],n=e[1]-r[1];return Math.hypot(t,n)}function Fu(r,e){var t=e[0],n=e[1],i=t*t+n*n;return i>0&&(i=1/Math.sqrt(i)),r[0]=e[0]*i,r[1]=e[1]*i,r}function nT(r,e){return r[0]*e[0]+r[1]*e[1]}function iT(r,e){return r[0]===e[0]&&r[1]===e[1]}var Ib=fW;(function(){var r=cW();return function(e,t,n,i,a,o){var s,u;for(t||(t=2),n||(n=0),i?u=Math.min(i*t+n,e.length):u=e.length,s=n;s<u;s+=t)r[0]=e[s],r[1]=e[s+1],a(r,r,o),e[s]=r[0],e[s+1]=r[1];return e}})();function hW(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return jf(n,t),ti(r,n,e)}function dW(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return Wf(n,t),ti(r,n,e)}function vW(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return Xf(n,t),ti(r,n,e)}function pW(r,e,t){return ti(r,t,e)}function hp(r,e){for(var t=r?[].concat(r):[1,0,0,0,1,0,0,0,1],n=0,i=e.length;n<i;n++){var a=e[n];switch(a[0]){case"t":hW(t,t,[a[1],a[2]]);break;case"s":vW(t,t,[a[1],a[2]]);break;case"r":dW(t,t,a[1]);break;case"m":pW(t,t,a[1]);break}}return t}var Uu=function(e,t){var n=e.nodes,i=e.edges,a=[],o={};if(!n)throw new Error("invalid nodes data!");return n&&n.forEach(function(s,u){o[s.id]=u;var l=[];a.push(l)}),i&&i.forEach(function(s){var u=s.source,l=s.target,c=o[u],f=o[l];!c&&c!==0||!f&&f!==0||(a[c][f]=1,t||(a[f][c]=1))}),a},gW=function(e,t){return e===t},aT=function(){function r(e,t){t===void 0&&(t=null),this.value=e,this.next=t}return r.prototype.toString=function(e){return e?e(this.value):""+this.value},r}(),oT=function(){function r(e){e===void 0&&(e=gW),this.head=null,this.tail=null,this.compare=e}return r.prototype.prepend=function(e){var t=new aT(e,this.head);return this.head=t,this.tail||(this.tail=t),this},r.prototype.append=function(e){var t=new aT(e);return this.head?(this.tail.next=t,this.tail=t,this):(this.head=t,this.tail=t,this)},r.prototype.delete=function(e){if(!this.head)return null;for(var t=null;this.head&&this.compare(this.head.value,e);)t=this.head,this.head=this.head.next;var n=this.head;if(n!==null)for(;n.next;)this.compare(n.next.value,e)?(t=n.next,n.next=n.next.next):n=n.next;return this.compare(this.tail.value,e)&&(this.tail=n),t},r.prototype.find=function(e){var t=e.value,n=t===void 0?void 0:t,i=e.callback,a=i===void 0?void 0:i;if(!this.head)return null;for(var o=this.head;o;){if(a&&a(o.value)||n!==void 0&&this.compare(o.value,n))return o;o=o.next}return null},r.prototype.deleteTail=function(){var e=this.tail;if(this.head===this.tail)return this.head=null,this.tail=null,e;for(var t=this.head;t.next;)t.next.next?t=t.next:t.next=null;return this.tail=t,e},r.prototype.deleteHead=function(){if(!this.head)return null;var e=this.head;return this.head.next?this.head=this.head.next:(this.head=null,this.tail=null),e},r.prototype.fromArray=function(e){var t=this;return e.forEach(function(n){return t.append(n)}),this},r.prototype.toArray=function(){for(var e=[],t=this.head;t;)e.push(t),t=t.next;return e},r.prototype.reverse=function(){for(var e=this.head,t=null,n=null;e;)n=e.next,e.next=t,t=e,e=n;this.tail=this.head,this.head=t},r.prototype.toString=function(e){return e===void 0&&(e=void 0),this.toArray().map(function(t){return t.toString(e)}).toString()},r}(),yW=function(){function r(){this.linkedList=new oT}return r.prototype.isEmpty=function(){return!this.linkedList.head},r.prototype.peek=function(){return this.linkedList.head?this.linkedList.head.value:null},r.prototype.enqueue=function(e){this.linkedList.append(e)},r.prototype.dequeue=function(){var e=this.linkedList.deleteHead();return e?e.value:null},r.prototype.toString=function(e){return this.linkedList.toString(e)},r}(),Ji=function(e,t,n){t===void 0&&(t=[]);var i=t.filter(function(u){return u.source===e||u.target===e});if(n==="target"){var a=function(l){return l.source===e};return i.filter(a).map(function(u){return u.target})}if(n==="source"){var o=function(l){return l.target===e};return i.filter(o).map(function(u){return u.source})}var s=function(l){return l.source===e?l.target:l.source};return i.map(s)},mW=function(e,t){return t.filter(function(n){return n.source===e})},dp=function(e,t){return t.filter(function(n){return n.source===e||n.target===e})},sT=function(e){e===void 0&&(e=0);var t=(""+Math.random()).split(".")[1].substr(0,5),n=(""+Math.random()).split(".")[1].substr(0,5);return e+"-"+t+n};function bW(r){r===void 0&&(r={});var e=r,t=function(){},n=function(){var i={};return function(a){var o=a.next,s=o;return i[s]?!1:(i[s]=!0,!0)}}();return e.allowTraversal=r.allowTraversal||n,e.enter=r.enter||t,e.leave=r.leave||t,e}var uT=function(e,t,n,i){i===void 0&&(i=!0);var a=bW(n),o=new yW,s=e.edges,u=s===void 0?[]:s;o.enqueue(t);for(var l="",c=function(){var d=o.dequeue();a.enter({current:d,previous:l}),Ji(d,u,i?"target":void 0).forEach(function(h){a.allowTraversal({previous:l,current:d,next:h})&&o.enqueue(h)}),a.leave({current:d,previous:l}),l=d};!o.isEmpty();)c()},wW=function(e){for(var t=e.nodes,n=t===void 0?[]:t,i=e.edges,a=i===void 0?[]:i,o=[],s={},u=[],l=function h(v){u.push(v),s[v.id]=!0;for(var p=Ji(v.id,a),g=function(b){var w=p[b];if(!s[w]){var x=n.filter(function(_){return _.id===w});x.length>0&&h(x[0])}},y=0;y<p.length;++y)g(y)},c=0;c<n.length;c++){var f=n[c];if(!s[f.id]){l(f);for(var d=[];u.length>0;)d.push(u.pop());o.push(d)}}return o},lT=function(e){for(var t=e.nodes,n=t===void 0?[]:t,i=e.edges,a=i===void 0?[]:i,o=[],s={},u={},l={},c=[],f=0,d=function g(y){u[y.id]=f,l[y.id]=f,f+=1,o.push(y),s[y.id]=!0;for(var m=Ji(y.id,a,"target").filter(function(A){return n.map(function(I){return I.id}).indexOf(A)>-1}),b=function(I){var M=m[I];if(!u[M]&&u[M]!==0){var S=n.filter(function(C){return C.id===M});S.length>0&&g(S[0]),l[y.id]=Math.min(l[y.id],l[M])}else s[M]&&(l[y.id]=Math.min(l[y.id],u[M]))},w=0;w<m.length;w++)b(w);if(l[y.id]===u[y.id]){for(var x=[];o.length>0;){var _=o.pop();if(s[_.id]=!1,x.push(_),_===y)break}x.length>0&&c.push(x)}},h=0,v=n;h<v.length;h++){var p=v[h];!u[p.id]&&u[p.id]!==0&&d(p)}return c};function Cb(r,e){return e?lT(r):wW(r)}var Es=function(e){var t={},n=e.nodes,i=n===void 0?[]:n,a=e.edges,o=a===void 0?[]:a;return i.forEach(function(s){t[s.id]={degree:0,inDegree:0,outDegree:0}}),o.forEach(function(s){t[s.source].degree++,t[s.source].outDegree++,t[s.target].degree++,t[s.target].inDegree++}),t},cT=function(e,t){var n=Es(e);return n[t]?Es(e)[t].inDegree:0},fT=function(e,t){var n=Es(e);return n[t]?Es(e)[t].outDegree:0};function xW(r){r===void 0&&(r={});var e=r,t=function(){},n=function(){var i={};return function(a){var o=a.next;return i[o]?!1:(i[o]=!0,!0)}}();return e.allowTraversal=r.allowTraversal||n,e.enter=r.enter||t,e.leave=r.leave||t,e}function hT(r,e,t,n){n.enter({current:e,previous:t});var i=r.edges,a=i===void 0?[]:i;Ji(e,a,"target").forEach(function(o){n.allowTraversal({previous:t,current:e,next:o})&&hT(r,o,e,n)}),n.leave({current:e,previous:t})}function Mb(r,e,t){hT(r,e,"",xW(t))}var kb=function(e){var t=null,n=e.nodes,i=n===void 0?[]:n,a={},o={},s={},u={};i.forEach(function(f){o[f.id]=f});for(var l={enter:function(d){var h=d.current,v=d.previous;if(s[h]){t={};for(var p=h,g=v;g!==h;)t[p]=g,p=g,g=a[g];t[p]=g}else s[h]=h,delete o[h],a[h]=v},leave:function(d){var h=d.current;u[h]=h,delete s[h]},allowTraversal:function(d){var h=d.next;return t?!1:!u[h]}};Object.keys(o).length;){var c=Object.keys(o)[0];Mb(e,c,l)}return t},Db=function(e,t,n){var i,a;n===void 0&&(n=!0);for(var o=[],s=Cb(e,!1),u=0,l=s;u<l.length;u++){var c=l[u];if(!!c.length)for(var f=c[0],d=f.id,h=[f],v=(i={},i[d]=f,i),p=(a={},a[d]=new Set,a);h.length>0;)for(var g=h.pop(),y=g.id,m=Ji(y,e.edges),b=function(_){var A,I=m[_],M=e.nodes.find(function(B){return B.id===I});if(I===y)o.push((A={},A[I]=g,A));else if(!(I in p))v[I]=g,h.push(M),p[I]=new Set([g]);else if(!p[y].has(M)){for(var S=!0,C=[M,g],T=v[y];p[I].size&&!p[I].has(T)&&(C.push(T),T!==v[T.id]);)T=v[T.id];if(C.push(T),t&&n?(S=!1,C.findIndex(function(B){return t.indexOf(B.id)>-1})>-1&&(S=!0)):t&&!n&&C.findIndex(function(B){return t.indexOf(B.id)>-1})>-1&&(S=!1),S){for(var k={},L=1;L<C.length;L+=1)k[C[L-1].id]=C[L];C.length&&(k[C[C.length-1].id]=C[0]),o.push(k)}p[I].add(g)}},w=0;w<m.length;w+=1)b(w)}return o},Lb=function(e,t,n){n===void 0&&(n=!0);for(var i=[],a=new Set,o=[],s=[],u={},l={},c=function(T){for(var k=[T];k.length>0;){var L=k.pop();a.has(L)&&(a.delete(L),o[L.id].forEach(function(B){k.push(B)}),o[L.id].clear())}},f=function C(T,k,L){var B=!1;if(t&&n===!1&&t.indexOf(T.id)>-1)return B;i.push(T),a.add(T);for(var ee=L[T.id],K=0;K<ee.length;K+=1){var z=u[ee[K]];if(z===k){for(var X={},H=1;H<i.length;H+=1)X[i[H-1].id]=i[H];i.length&&(X[i[i.length-1].id]=i[0]),s.push(X),B=!0}else a.has(z)||C(z,k,L)&&(B=!0)}if(B)c(T);else for(var K=0;K<ee.length;K+=1){var z=u[ee[K]];o[z.id].has(T)||o[z.id].add(T)}return i.pop(),B},d=e.nodes,h=d===void 0?[]:d,v=0;v<h.length;v+=1){var p=h[v],g=p.id;l[g]=v,u[v]=p}if(t&&n)for(var y=function(T){var k=t[T];l[h[T].id]=l[k],l[k]=0,u[0]=h.find(function(L){return L.id===k}),u[l[h[T].id]]=h[T]},v=0;v<t.length;v++)y(v);for(var m=function(T){for(var k,L,B=1/0,ee=0;ee<T.length;ee+=1)for(var K=T[ee],z=0;z<K.length;z++){var X=l[K[z].id];X<B&&(B=X,L=ee)}for(var H=T[L],J=[],ee=0;ee<H.length;ee+=1){var ne=H[ee];J[ne.id]=[];for(var me=0,oe=Ji(ne.id,e.edges,"target").filter(function(qe){return H.map(function(ft){return ft.id}).indexOf(qe)>-1});me<oe.length;me++){var Ae=oe[me];Ae===ne.id&&!(n===!1&&t.indexOf(ne.id)>-1)?s.push((k={},k[ne.id]=ne,k)):J[ne.id].push(l[Ae])}}return{component:H,adjList:J,minIdx:B}},b=0;b<h.length;){var w=h.filter(function(C){return l[C.id]>=b}),x=lT({nodes:w,edges:e.edges}).filter(function(C){return C.length>1});if(x.length===0)break;var _=m(x),A=_.minIdx,I=_.adjList,M=_.component;if(M.length>1){M.forEach(function(C){o[C.id]=new Set});var S=u[A];if(t&&n&&t.indexOf(S.id)===-1)return s;f(S,S,I),b=A+1}else break}return s},dT=function(e,t,n,i){return i===void 0&&(i=!0),t?Lb(e,n,i):Db(e,n,i)},_W=function(e,t,n){for(var i=1/0,a,o=0;o<t.length;o++){var s=t[o].id;!n[s]&&e[s]<=i&&(i=e[s],a=t[o])}return a},th=function(e,t,n,i){var a=e.nodes,o=a===void 0?[]:a,s=e.edges,u=s===void 0?[]:s,l={},c={},f={};o.forEach(function(m,b){var w=m.id;c[w]=1/0,w===t&&(c[w]=0)});for(var d=o.length,h=function(b){var w=_W(c,o,l),x=w.id;if(l[x]=!0,c[x]===1/0)return"continue";var _=[];n?_=mW(x,u):_=dp(x,u),_.forEach(function(A){var I=A.target,M=A.source,S=I===x?M:I,C=i&&A[i]?A[i]:1;c[S]>c[w.id]+C?(c[S]=c[w.id]+C,f[S]=[w.id]):c[S]===c[w.id]+C&&f[S].push(w.id)})},v=0;v<d;v++)h();f[t]=[t];var p={};for(var g in c)c[g]!==1/0&&vT(t,g,f,p);var y={};for(var g in p)y[g]=p[g][0];return{length:c,path:y,allPath:p}};function vT(r,e,t,n){if(r===e)return[r];if(n[e])return n[e];for(var i=[],a=0,o=t[e];a<o.length;a++){var s=o[a],u=vT(r,s,t,n);if(!u)return;for(var l=0,c=u;l<c.length;l++){var f=c[l];Mt(f)?i.push(no(no([],f),[e])):i.push([f,e])}}return n[e]=i,n[e]}var pT=function(e,t,n,i,a){var o=th(e,t,i,a),s=o.length,u=o.path,l=o.allPath;return{length:s[n],path:u[n],allPath:l[n]}},gT=function(e,t,n,i){var a;if(t===n)return[[t]];var o=e.edges,s=o===void 0?[]:o,u=[t],l=(a={},a[t]=!0,a),c=[],f=[],d=i?Ji(t,s,"target"):Ji(t,s);for(c.push(d);u.length>0&&c.length>0;){var h=c[c.length-1];if(h.length){var v=h.shift();v&&(u.push(v),l[v]=!0,d=i?Ji(v,s,"target"):Ji(v,s),c.push(d.filter(function(y){return!l[y]})))}else{var p=u.pop();l[p]=!1,c.pop();continue}if(u[u.length-1]===n){var g=u.map(function(m){return m});f.push(g);var p=u.pop();l[p]=!1,c.pop()}}return f},rh=function(e,t){for(var n=Uu(e,t),i=[],a=n.length,o=0;o<a;o+=1){i[o]=[];for(var s=0;s<a;s+=1)o===s?i[o][s]=0:n[o][s]===0||!n[o][s]?i[o][s]=1/0:i[o][s]=n[o][s]}for(var u=0;u<a;u+=1)for(var o=0;o<a;o+=1)for(var s=0;s<a;s+=1)i[o][s]>i[o][u]+i[u][s]&&(i[o][s]=i[o][u]+i[u][s]);return i},yT=function(e,t,n,i){t===void 0&&(t=!1),n===void 0&&(n="weight"),i===void 0&&(i=1e3);var a=e.nodes,o=a===void 0?[]:a,s=e.edges,u=s===void 0?[]:s,l={},c={};o.forEach(function(b,w){var x=sT();b.clusterId=x,l[x]={id:x,nodes:[b]},c[b.id]={node:b,idx:w}});var f=Uu(e,t),d={};f.forEach(function(b,w){var x=o[w].id;d[x]={},b.forEach(function(_,A){if(!!_){var I=o[A].id;d[x][I]=_}})});for(var h=0,v=function(){var w=!1;if(o.forEach(function(x){var _={};Object.keys(d[x.id]).forEach(function(L){var B=d[x.id][L],ee=c[L].node,K=ee.clusterId;_[K]||(_[K]=0),_[K]+=B});var A=-1/0,I=[];if(Object.keys(_).forEach(function(L){A<_[L]?(A=_[L],I=[L]):A===_[L]&&I.push(L)}),!(I.length===1&&I[0]===x.clusterId)){var M=I.indexOf(x.clusterId);if(M>=0&&I.splice(M,1),I&&I.length){w=!0;var S=l[x.clusterId],C=S.nodes.indexOf(x);S.nodes.splice(C,1);var T=Math.floor(Math.random()*I.length),k=l[I[T]];k.nodes.push(x),x.clusterId=k.id}}}),!w)return"break";h++};h<i;){var p=v();if(p==="break")break}Object.keys(l).forEach(function(b){var w=l[b];(!w.nodes||!w.nodes.length)&&delete l[b]});var g=[],y={};u.forEach(function(b){var w=b.source,x=b.target,_=b[n]||1,A=c[w].node.clusterId,I=c[x].node.clusterId,M=A+"---"+I;if(y[M])y[M].weight+=_,y[M].count++;else{var S={source:A,target:I,weight:_,count:1};y[M]=S,g.push(S)}});var m=[];return Object.keys(l).forEach(function(b){m.push(l[b])}),{clusters:m,clusterEdges:g}},SW=function(e,t,n,i){for(var a=t.length,o=2*i,s=0,u=0;u<a;u++)for(var l=e[u].clusterId,c=0;c<a;c++){var f=e[c].clusterId;if(l===f){var d=t[u][c]||0,h=n[u]||0,v=n[c]||0;s+=d-h*v/o}}return s*=1/o,s},mT=function(e,t,n,i){t===void 0&&(t=!1),n===void 0&&(n="weight"),i===void 0&&(i=1e-4);var a=e.nodes,o=a===void 0?[]:a,s=e.edges,u=s===void 0?[]:s,l=1,c={},f={};o.forEach(function(I,M){var S=String(l++);I.clusterId=S,c[S]={id:S,nodes:[I]},f[I.id]={node:I,idx:M}});var d=Uu(e,t),h=[],v={},p=0;d.forEach(function(I,M){var S=0,C=o[M].id;v[C]={},I.forEach(function(T,k){if(!!T){S+=T;var L=o[k].id;v[C][L]=T,p+=T}}),h.push(S)}),p/=2;for(var g=1/0,y=1/0,m=0;g=SW(o,d,h,p),!(Math.abs(g-y)<i||m>100);)y=g,m++,Object.keys(c).forEach(function(I){var M=0;u.forEach(function(S){var C=S.source,T=S.target,k=f[C].node.clusterId,L=f[T].node.clusterId;(k===I&&L!==I||L===I&&k!==I)&&(M=M+(S[n]||1))}),c[I].sumTot=M}),o.forEach(function(I,M){var S=c[I.clusterId],C=0,T,k=h[M]/(2*p),L=0,B=S.nodes;B.forEach(function(ne){var me=f[ne.id].idx;L+=d[M][me]||0});var ee=L-S.sumTot*k,K=v[I.id];if(Object.keys(K).forEach(function(ne){var me=f[ne].node,oe=me.clusterId;if(oe!==I.clusterId){var Ae=c[oe],ze=Ae.nodes;if(!(!ze||!ze.length)){var qe=0;ze.forEach(function(st){var gr=f[st.id].idx;qe+=d[M][gr]||0});var ft=qe-Ae.sumTot*k,ct=ft-ee;ct>C&&(C=ct,T=Ae)}}}),C>0){T.nodes.push(I);var z=I.clusterId;I.clusterId=T.id;var X=S.nodes.indexOf(I);S.nodes.splice(X,1);var H=0,J=0;u.forEach(function(ne){var me=ne.source,oe=ne.target,Ae=f[me].node.clusterId,ze=f[oe].node.clusterId;(Ae===T.id&&ze!==T.id||ze===T.id&&Ae!==T.id)&&(H=H+(ne[n]||1)),(Ae===z&&ze!==z||ze===z&&Ae!==z)&&(J=J+(ne[n]||1))}),T.sumTot=H,S.sumTot=J}});var b={},w=0;Object.keys(c).forEach(function(I){var M=c[I];if(!M.nodes||!M.nodes.length){delete c[I];return}var S=String(w+1);S!==I&&(M.id=S,M.nodes=M.nodes.map(function(C){return{id:C.id,clusterId:S}}),c[S]=M,b[I]=S,delete c[I],w++)}),o.forEach(function(I){I.clusterId&&b[I.clusterId]&&(I.clusterId=b[I.clusterId])});var x=[],_={};u.forEach(function(I){var M=I.source,S=I.target,C=I[n]||1,T=f[M].node.clusterId,k=f[S].node.clusterId,L=T+"---"+k;if(_[L])_[L].weight+=C,_[L].count++;else{var B={source:T,target:k,weight:C,count:1};_[L]=B,x.push(B)}});var A=[];return Object.keys(c).forEach(function(I){A.push(c[I])}),{clusters:A,clusterEdges:x}},EW=function(){function r(e){this.count=e.length,this.parent={};for(var t=0,n=e;t<n.length;t++){var i=n[t];this.parent[i]=i}}return r.prototype.find=function(e){for(;this.parent[e]!==e;)e=this.parent[e];return e},r.prototype.union=function(e,t){var n=this.find(e),i=this.find(t);n!==i&&(n<i?(this.parent[t]!==t&&this.union(this.parent[t],e),this.parent[t]=this.parent[e]):(this.parent[e]!==e&&this.union(this.parent[e],t),this.parent[e]=this.parent[t]))},r.prototype.connected=function(e,t){return this.find(e)===this.find(t)},r}(),AW=function(e,t){return e-t},TW=function(){function r(e){e===void 0&&(e=AW),this.compareFn=e,this.list=[]}return r.prototype.getLeft=function(e){return 2*e+1},r.prototype.getRight=function(e){return 2*e+2},r.prototype.getParent=function(e){return e===0?null:Math.floor((e-1)/2)},r.prototype.isEmpty=function(){return this.list.length<=0},r.prototype.top=function(){return this.isEmpty()?void 0:this.list[0]},r.prototype.delMin=function(){var e=this.top(),t=this.list.pop();return this.list.length>0&&(this.list[0]=t,this.moveDown(0)),e},r.prototype.insert=function(e){if(e!==null){this.list.push(e);var t=this.list.length-1;return this.moveUp(t),!0}return!1},r.prototype.moveUp=function(e){for(var t=this.getParent(e);e&&e>0&&this.compareFn(this.list[t],this.list[e])>0;){var n=this.list[t];this.list[t]=this.list[e],this.list[e]=n,e=t,t=this.getParent(e)}},r.prototype.moveDown=function(e){var t,n=e,i=this.getLeft(e),a=this.getRight(e),o=this.list.length;i!==null&&i<o&&this.compareFn(this.list[n],this.list[i])>0?n=i:a!==null&&a<o&&this.compareFn(this.list[n],this.list[a])>0&&(n=a),e!==n&&(t=[this.list[n],this.list[e]],this.list[e]=t[0],this.list[n]=t[1],this.moveDown(n))},r}(),IW=function(e,t){var n=[],i=e.nodes,a=i===void 0?[]:i,o=e.edges,s=o===void 0?[]:o;if(a.length===0)return n;var u=a[0],l=new Set;l.add(u);var c=function(g,y){return t?g.weight-y.weight:0},f=new TW(c);for(dp(u.id,s).forEach(function(p){f.insert(p)});!f.isEmpty();){var d=f.delMin(),h=d.source,v=d.target;l.has(h)&&l.has(v)||(n.push(d),l.has(h)||(l.add(h),dp(h,s).forEach(function(p){f.insert(p)})),l.has(v)||(l.add(v),dp(v,s).forEach(function(p){f.insert(p)})))}return n},bT=function(e,t){var n=[],i=e.nodes,a=i===void 0?[]:i,o=e.edges,s=o===void 0?[]:o;if(a.length===0)return n;var u=s.map(function(h){return h});t&&u.sort(function(h,v){return h.weight-v.weight});for(var l=new EW(a.map(function(h){return h.id}));u.length>0;){var c=u.shift(),f=c.source,d=c.target;l.connected(f,d)||(n.push(c),l.union(f,d))}return n},wT=function(e,t,n){var i={prim:IW,kruskal:bT};return n?i[n](e,t):bT(e,t)},xT=function(e,t,n){typeof t!="number"&&(t=1e-6),typeof n!="number"&&(n=.85);for(var i=1,a=0,o=1e3,s=e.nodes,u=s===void 0?[]:s,l=e.edges,c=l===void 0?[]:l,f=u.length,d,h={},v={},p=0;p<f;++p){var g=u[p],y=g.id;h[y]=1/f,v[y]=1/f}for(var m=Es(e);o>0&&i>t;){a=0;for(var p=0;p<f;++p){var g=u[p],y=g.id;if(d=0,m[g.id].inDegree===0)h[y]=0;else{for(var b=Ji(y,c,"source"),w=0;w<b.length;++w){var x=b[w],_=m[x].outDegree;_>0&&(d+=v[x]/_)}h[y]=n*d,a+=h[y]}}a=(1-a)/f,i=0;for(var p=0;p<f;++p){var g=u[p],y=g.id;d=h[y]+a,i+=Math.abs(d-v[y]),v[y]=d}o-=1}return v},CW=-1,vp=-1,_T="-1",oo="-1",ST=-1,ET=function(){function r(e,t,n,i){e===void 0&&(e=CW),t===void 0&&(t=vp),n===void 0&&(n=vp),i===void 0&&(i=_T),this.id=e,this.from=t,this.to=n,this.label=i}return r}(),MW=function(){function r(e,t){e===void 0&&(e=vp),t===void 0&&(t=oo),this.id=e,this.label=t,this.edges=[],this.edgeMap={}}return r.prototype.addEdge=function(e){this.edges.push(e),this.edgeMap[e.id]=e},r}(),AT=function(){function r(e,t,n){e===void 0&&(e=vp),t===void 0&&(t=!0),n===void 0&&(n=!1),this.id=e,this.edgeIdAutoIncrease=t,this.edges=[],this.nodes=[],this.nodeMap={},this.edgeMap={},this.nodeLabelMap={},this.edgeLabelMap={},this.counter=0,this.directed=n}return r.prototype.getNodeNum=function(){return this.nodes.length},r.prototype.addNode=function(e,t){if(!this.nodeMap[e]){var n=new MW(e,t);this.nodes.push(n),this.nodeMap[e]=n,this.nodeLabelMap[t]||(this.nodeLabelMap[t]=[]),this.nodeLabelMap[t].push(e)}},r.prototype.addEdge=function(e,t,n,i){if((this.edgeIdAutoIncrease||e===void 0)&&(e=this.counter++),!(this.nodeMap[t]&&this.nodeMap[n]&&this.nodeMap[n].edgeMap[e])){var a=new ET(e,t,n,i);if(this.edges.push(a),this.edgeMap[e]=a,this.nodeMap[t].addEdge(a),this.edgeLabelMap[i]||(this.edgeLabelMap[i]=[]),this.edgeLabelMap[i].push(a),!this.directed){var o=new ET(e,n,t,i);this.nodeMap[n].addEdge(o),this.edgeLabelMap[i].push(o)}}},r}(),Gu=function(){function r(e,t,n,i,a){this.fromNode=e,this.toNode=t,this.nodeEdgeNodeLabel={nodeLabel1:n||oo,edgeLabel:i||_T,nodeLabel2:a||oo}}return r.prototype.equalTo=function(e){return this.fromNode===e.formNode&&this.toNode===e.toNode&&this.nodeEdgeNodeLabel===e.nodeEdgeNodeLabel},r.prototype.notEqualTo=function(e){return!this.equalTo(e)},r}(),TT=function(){function r(){this.rmpath=[],this.dfsEdgeList=[]}return r.prototype.equalTo=function(e){var t=this.dfsEdgeList.length,n=e.length;if(t!==n)return!1;for(var i=0;i<t;i++)if(this.dfsEdgeList[i]!==e[i])return!1;return!0},r.prototype.notEqualTo=function(e){return!this.equalTo(e)},r.prototype.pushBack=function(e,t,n,i,a){return this.dfsEdgeList.push(new Gu(e,t,n,i,a)),this.dfsEdgeList},r.prototype.toGraph=function(e,t){e===void 0&&(e=ST),t===void 0&&(t=!1);var n=new AT(e,!0,t);return this.dfsEdgeList.forEach(function(i){var a=i.fromNode,o=i.toNode,s=i.nodeEdgeNodeLabel,u=s.nodeLabel1,l=s.edgeLabel,c=s.nodeLabel2;u!==oo&&n.addNode(a,u),c!==oo&&n.addNode(o,c),u!==oo&&c!==u&&n.addEdge(void 0,a,o,l)}),n},r.prototype.buildRmpath=function(){this.rmpath=[];for(var e=void 0,t=this.dfsEdgeList.length,n=t-1;n>=0;n--){var i=this.dfsEdgeList[n],a=i.fromNode,o=i.toNode;a<o&&(e===void 0||o===e)&&(this.rmpath.push(n),e=a)}return this.rmpath},r.prototype.getNodeNum=function(){var e={};return this.dfsEdgeList.forEach(function(t){e[t.fromNode]||(e[t.fromNode]=!0),e[t.toNode]||(e[t.toNode]=!0)}),Object.keys(e).length},r}(),pp=function(){function r(e){if(this.his={},this.nodesUsed={},this.edgesUsed={},this.edges=[],!!e){for(;e;){var t=e.edge;this.edges.push(t),this.nodesUsed[t.from]=1,this.nodesUsed[t.to]=1,this.edgesUsed[t.id]=1,e=e.preNode}this.edges=this.edges.reverse()}}return r.prototype.hasNode=function(e){return this.nodesUsed[e.id]===1},r.prototype.hasEdge=function(e){return this.edgesUsed[e.id]===1},r}(),kW=function(){function r(e){var t=e.graphs,n=e.minSupport,i=n===void 0?2:n,a=e.minNodeNum,o=a===void 0?1:a,s=e.maxNodeNum,u=s===void 0?4:s,l=e.top,c=l===void 0?10:l,f=e.directed,d=f===void 0?!1:f,h=e.verbose,v=h===void 0?!1:h;this.graphs=t,this.dfsCode=new TT,this.support=0,this.frequentSize1Subgraphs=[],this.frequentSubgraphs=[],this.minSupport=i,this.top=c,this.directed=d,this.counter=0,this.maxNodeNum=u,this.minNodeNum=o,this.verbose=v,this.maxNodeNum<this.minNodeNum&&(this.maxNodeNum=this.minNodeNum),this.reportDF=[]}return r.prototype.findForwardRootEdges=function(e,t){var n=this,i=[],a=e.nodeMap;return t.edges.forEach(function(o){(n.directed||t.label<=a[o.to].label)&&i.push(o)}),i},r.prototype.findBackwardEdge=function(e,t,n,i){if(!this.directed&&t===n)return null;for(var a=e.nodeMap,o=a[n.to],s=o.edges,u=s.length,l=0;l<u;l++){var c=s[l];if(!(i.hasEdge(c)||c.to!==t.from)){if(this.directed){if(a[t.from].label<a[n.to].label||a[t.from].label===a[n.to].label&&t.label<=c.label)return c}else if(t.label<c.label||t.label===c.label&&a[t.to].label<=a[n.to].label)return c}}return null},r.prototype.findForwardPureEdges=function(e,t,n,i){for(var a=[],o=t.to,s=e.nodeMap[o].edges,u=s.length,l=0;l<u;l++){var c=s[l],f=e.nodeMap[c.to];n<=f.label&&!i.hasNode(f)&&a.push(c)}return a},r.prototype.findForwardRmpathEdges=function(e,t,n,i){for(var a=[],o=e.nodeMap,s=o[t.to].label,u=o[t.from],l=u.edges,c=l.length,f=0;f<c;f++){var d=l[f],h=o[d.to].label;t.to===d.to||n>h||i.hasNode(o[d.to])||(t.label<d.label||t.label===d.label&&s<=h)&&a.push(d)}return a},r.prototype.getSupport=function(e){var t={};return e.forEach(function(n){t[n.graphId]||(t[n.graphId]=!0)}),Object.keys(t).length},r.prototype.findMinLabel=function(e){var t=void 0;return Object.keys(e).forEach(function(n){var i=e[n],a=i.nodeLabel1,o=i.edgeLabel,s=i.nodeLabel2;if(!t){t={nodeLabel1:a,edgeLabel:o,nodeLabel2:s};return}(a<t.nodeLabel1||a===t.nodeLabel1&&o<t.edgeLabel||a===t.nodeLabel1&&o===t.edgeLabel&&s<t.nodeLabel2)&&(t={nodeLabel1:a,edgeLabel:o,nodeLabel2:s})}),t},r.prototype.isMin=function(){var e=this,t=this.dfsCode;if(this.verbose&&console.log("isMin checking",t),t.dfsEdgeList.length===1)return!0;var n=this.directed,i=t.toGraph(ST,n),a=i.nodeMap,o=new TT,s={};i.nodes.forEach(function(f){var d=e.findForwardRootEdges(i,f);d.forEach(function(h){var v=a[h.to],p=f.label+"-"+h.label+"-"+v.label;s[p]||(s[p]={projected:[],nodeLabel1:f.label,edgeLabel:h.label,nodeLabel2:v.label});var g={graphId:i.id,edge:h,preNode:null};s[p].projected.push(g)})});var u=this.findMinLabel(s);if(!!u){o.dfsEdgeList.push(new Gu(0,1,u.nodeLabel1,u.edgeLabel,u.nodeLabel2));var l=function f(d){for(var h=o.buildRmpath(),v=o.dfsEdgeList[0].nodeEdgeNodeLabel.nodeLabel1,p=o.dfsEdgeList[h[0]].toNode,g={},y=!1,m=0,b=n?-1:0,w=function(K){if(y)return"break";d.forEach(function(z){var X=new pp(z),H=e.findBackwardEdge(i,X.edges[h[K]],X.edges[h[0]],X);H&&(g[H.label]||(g[H.label]={projected:[],edgeLabel:H.label}),g[H.label].projected.push({graphId:i.id,edge:g,preNode:z}),m=o.dfsEdgeList[h[K]].fromNode,y=!0)})},x=h.length-1;x>b;x--){var _=w(x);if(_==="break")break}if(y){var A=e.findMinLabel(g);o.dfsEdgeList.push(new Gu(p,m,oo,A.edgeLabel,oo));var I=o.dfsEdgeList.length-1;return e.dfsCode.dfsEdgeList[I]!==o.dfsEdgeList[I]?!1:f(g[A.edgeLabel].projected)}var M={};y=!1;var S=0;d.forEach(function(ee){var K=new pp(ee),z=e.findForwardPureEdges(i,K.edges[h[0]],v,K);z.length>0&&(y=!0,S=p,z.forEach(function(X){var H=X.label+"-"+a[X.to].label;M[H]||(M[H]={projected:[],edgeLabel:X.label,nodeLabel2:a[X.to].label}),M[H].projected.push({graphId:i.id,edge:X,preNode:ee})}))});for(var C=h.length,T=function(K){if(y)return"break";var z=h[K];d.forEach(function(X){var H=new pp(X),J=e.findForwardRmpathEdges(i,H.edges[z],v,H);J.length>0&&(y=!0,S=o.dfsEdgeList[z].fromNode,J.forEach(function(ne){var me=ne.label+"-"+a[ne.to].label;M[me]||(M[me]={projected:[],edgeLabel:ne.label,nodeLabel2:a[ne.to].label}),M[me].projected.push({graphId:i.id,edge:ne,preNode:X})}))})},x=0;x<C;x++){var k=T(x);if(k==="break")break}if(!y)return!0;var L=e.findMinLabel(M);o.dfsEdgeList.push(new Gu(S,p+1,oo,L.edgeLabel,L.nodeLabel2));var B=o.dfsEdgeList.length-1;return t.dfsEdgeList[B]!==o.dfsEdgeList[B]?!1:f(M[L.edgeLabel+"-"+L.nodeLabel2].projected)},c=u.nodeLabel1+"-"+u.edgeLabel+"-"+u.nodeLabel2;return l(s[c].projected)}},r.prototype.report=function(){if(!(this.dfsCode.getNodeNum()<this.minNodeNum)){this.counter++;var e=this.dfsCode.toGraph(this.counter,this.directed);this.frequentSubgraphs.push(Ur(e))}},r.prototype.subGraphMining=function(e){var t=this,n=this.getSupport(e);if(!(n<this.minSupport)&&!!this.isMin()){this.report();var i=this.dfsCode.getNodeNum(),a=this.dfsCode.buildRmpath(),o=this.dfsCode.dfsEdgeList[a[0]].toNode,s=this.dfsCode.dfsEdgeList[0].nodeEdgeNodeLabel.nodeLabel1,u={},l={};e.forEach(function(c){for(var f=t.graphs[c.graphId],d=f.nodeMap,h=new pp(c),v=a.length-1;v>=0;v--){var p=t.findBackwardEdge(f,h.edges[a[v]],h.edges[a[0]],h);if(p){var g=t.dfsCode.dfsEdgeList[a[v]].fromNode+"-"+p.label;l[g]||(l[g]={projected:[],toNodeId:t.dfsCode.dfsEdgeList[a[v]].fromNode,edgeLabel:p.label}),l[g].projected.push({graphId:c.graphId,edge:p,preNode:c})}}if(!(i>=t.maxNodeNum)){var y=t.findForwardPureEdges(f,h.edges[a[0]],s,h);y.forEach(function(b){var w=o+"-"+b.label+"-"+d[b.to].label;u[w]||(u[w]={projected:[],fromNodeId:o,edgeLabel:b.label,nodeLabel2:d[b.to].label}),u[w].projected.push({graphId:c.graphId,edge:b,preNode:c})});for(var m=function(w){var x=t.findForwardRmpathEdges(f,h.edges[a[w]],s,h);x.forEach(function(_){var A=t.dfsCode.dfsEdgeList[a[w]].fromNode+"-"+_.label+"-"+d[_.to].label;u[A]||(u[A]={projected:[],fromNodeId:t.dfsCode.dfsEdgeList[a[w]].fromNode,edgeLabel:_.label,nodeLabel2:d[_.to].label}),u[A].projected.push({graphId:c.graphId,edge:_,preNode:c})})},v=0;v<a.length;v++)m(v)}}),Object.keys(l).forEach(function(c){var f=l[c],d=f.toNodeId,h=f.edgeLabel;t.dfsCode.dfsEdgeList.push(new Gu(o,d,"-1",h,"-1")),t.subGraphMining(l[c].projected),t.dfsCode.dfsEdgeList.pop()}),Object.keys(u).forEach(function(c){var f=u[c],d=f.fromNodeId,h=f.edgeLabel,v=f.nodeLabel2;t.dfsCode.dfsEdgeList.push(new Gu(d,o+1,oo,h,v)),t.subGraphMining(u[c].projected),t.dfsCode.dfsEdgeList.pop()})}},r.prototype.generate1EdgeFrequentSubGraphs=function(){var e=this.graphs,t=this.directed,n=this.minSupport,i=this.frequentSize1Subgraphs,a={},o={},s={},u={};return Object.keys(e).forEach(function(l){var c=e[l],f=c.nodeMap;c.nodes.forEach(function(d,h){var v=d.label,p=l+"-"+v;if(!s[p]){var g=a[v]||0;g++,a[v]=g}s[p]={graphKey:l,label:v},d.edges.forEach(function(y){var m=v,b=f[y.to].label;if(!t&&m>b){var w=b;b=m,m=w}var x=y.label,_=l+"-"+m+"-"+x+"-"+b,A=m+"-"+x+"-"+b;if(!o[A]){var I=o[A]||0;I++,o[A]=I}u[_]={graphId:l,nodeLabel1:m,edgeLabel:x,nodeLabel2:b}})})}),Object.keys(a).forEach(function(l){var c=a[l];if(!(c<n)){var f={nodes:[],edges:[]};f.nodes.push({id:"0",label:l}),i.push(f)}}),i},r.prototype.run=function(){var e=this;if(this.frequentSize1Subgraphs=this.generate1EdgeFrequentSubGraphs(),!(this.maxNodeNum<2)){var t=this.graphs;this.directed;var n={};Object.keys(t).forEach(function(i){var a=t[i],o=a.nodeMap;a.nodes.forEach(function(s){var u=e.findForwardRootEdges(a,s);u.forEach(function(l){var c=o[l.to],f=s.label+"-"+l.label+"-"+c.label;n[f]||(n[f]={projected:[],nodeLabel1:s.label,edgeLabel:l.label,nodeLabel2:c.label});var d={graphId:i,edge:l,preNode:null};n[f].projected.push(d)})})}),Object.keys(n).forEach(function(i){var a=n[i],o=a.projected,s=a.nodeLabel1,u=a.edgeLabel,l=a.nodeLabel2;e.dfsCode.dfsEdgeList.push(new Gu(0,1,s,u,l)),e.subGraphMining(o),e.dfsCode.dfsEdgeList.pop()})}},r}(),DW=function(e,t,n,i){var a={};return Object.keys(e).forEach(function(o,s){var u=e[o],l=new AT(s,!0,t),c={};u.nodes.forEach(function(f,d){l.addNode(d,f[n]),c[f.id]=d}),u.edges.forEach(function(f,d){var h=c[f.source],v=c[f.target];l.addEdge(-1,h,v,f[i])}),l&&l.getNodeNum()&&(a[l.id]=l)}),a},LW=function(e,t,n){var i=[];return e.forEach(function(a){var o={nodes:[],edges:[]};a.nodes.forEach(function(s){var u;o.nodes.push((u={id:""+s.id},u[t]=s.label,u))}),a.edges.forEach(function(s){var u;o.edges.push((u={source:""+s.from,target:""+s.to},u[n]=s.label,u))}),i.push(o)}),i},IT="cluster",NW=function(e){var t=e.graphs,n=e.directed,i=n===void 0?!1:n,a=e.nodeLabelProp,o=a===void 0?IT:a,s=e.edgeLabelProp,u=s===void 0?IT:s,l=DW(t,i,o,u),c=e.minSupport,f=e.maxNodeNum,d=e.minNodeNum,h=e.verbose,v=e.top,p={graphs:l,minSupport:c,maxNodeNum:f,minNodeNum:d,top:v,verbose:h,directed:i},g=new kW(p);g.run();var y=LW(g.frequentSubgraphs,o,u);return y},CT=function(e,t,n,i){n===void 0&&(n="cluster"),i===void 0&&(i=2);var a=[],o=e.nodes;return t.forEach(function(s,u){a.push(MT(o,s,u,n,i))}),a},MT=function(e,t,n,i,a){var o=[n],s=[],u={};return t.forEach(function(l,c){if(l<=a&&n!==c){o.push(c),s.push(e[c]);var f=e[c][i];u[f]?(u[f].count++,u[f].dists.push(l)):u[f]={count:1,dists:[l]}}}),Object.keys(u).forEach(function(l){u[l].dists=u[l].dists.sort(function(c,f){return c-f})}),{nodeIdx:n,nodeId:e[n].id,nodeIdxs:o,neighbors:s,neighborNum:o.length-1,nodeLabelCountMap:u}},OW=function(e,t,n,i,a){var o=Math.ceil(n/t),s={},u=0;return i.forEach(function(l,c){for(var f=0,d=0,h=l.nodeIdxs,v=l.neighborNum-1;f<o;){for(var p=h[1+Math.floor(Math.random()*v)],g=0;(s[c+"-"+p]||s[p+"-"+c])&&(p=Math.floor(Math.random()*t),g++,!(g>2*t)););if(g<2*t&&(s[c+"-"+p]={start:c,end:p,distance:a[c][p]},f++,u++,u>=n))return s;if(d++,d>2*t)break}if(f<o){var y=o-f;o=(o+y)/(t-c-1)}}),s},gp=function(e,t,n,i){var a=n.nodes;return i||(i={}),Object.keys(e).forEach(function(o){var s,u;if(!(i&&i[o])){i[o]={nodes:[],edges:[]};var l=e[o],c=(s=t[l.start])===null||s===void 0?void 0:s.nodeIdxs,f=(u=t[l.end])===null||u===void 0?void 0:u.nodeIdxs;if(!(!c||!f)){var d=new Set(f),h=c.filter(function(m){return d.has(m)});if(!(!h||!h.length)){for(var v={},p=h.length,g=0;g<p;g++){var y=a[h[g]];i[o].nodes.push(y),v[y.id]=!0}n.edges.forEach(function(m){v[m.source]&&v[m.target]&&i[o].edges.push(m)})}}}}),i},yp=function(e,t,n,i){var a,o,s={};e.nodes.forEach(function(l){s[l.id]=l});var u=0;return!((a=t==null?void 0:t.edges)===null||a===void 0?void 0:a.length)||((o=t==null?void 0:t.nodes)===null||o===void 0?void 0:o.length)<2?0:(e.edges.forEach(function(l){var c=s[l.source][n],f=s[l.target][n],d=t==null?void 0:t.nodes[0][n],h=t==null?void 0:t.nodes[1][n],v=t==null?void 0:t.edges[0][i];l[i]===v&&(c===d&&f===h||c===h&&f===d)&&u++}),u)},PW=function(e,t,n){for(var i=1/0,a=0,o=function(l){var c=e[l],f=Object.keys(c).sort(function(m,b){return c[m]-c[b]}),d=10,h=[];f.forEach(function(m,b){h[b%d]||(h[b%d]={graphs:[],totalCount:0,aveCount:0}),h[b%d].graphs.push(m),h[b%d].totalCount+=c[m]});var v=0,p=[];h.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(_,A){var I=c[_];m.graphs.forEach(function(M,S){A!==S&&(w+=Math.abs(I-c[M]))})}),w/=x*(x-1)/2,v+=w}),v/=h.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;i<y&&(i=y,a=l)},s=0;s<t;s++)o(s);return{structure:n[a],structureCountMap:e[a]}},kT=function(e,t){var n={},i={};return e.forEach(function(a,o){n[a.id]={idx:o,node:a,degree:0,inDegree:0,outDegree:0};var s=a[t];i[s]||(i[s]=[]),i[s].push(a)}),{nodeMap:n,nodeLabelMap:i}},DT=function(e,t,n){var i={},a={};return e.forEach(function(o,s){i[""+sT]={idx:s,edge:o};var u=o[t];a[u]||(a[u]=[]),a[u].push(o);var l=n[o.source];l&&(l.degree++,l.outDegree++);var c=n[o.target];c&&(c.degree++,c.inDegree++)}),{edgeMap:i,edgeLabelMap:a}},LT=function(e,t,n){var i=t.length,a={};return t.forEach(function(o,s){for(var u=n?0:s+1,l=e[s].id,c=u;c<i;c++)if(s!==c){var f=e[c].id,d=o[c];a[l+"-"+f]=d,n||(a[f+"-"+l]=d)}}),a},RW=function(e,t,n,i,a,o,s,u,l,c,f){var d,h=t.id+"-"+n.id;if(c&&c[h])return c[h];var v=f?f[h]:void 0;if(!v){var p=(d={},d[h]={start:i[t.id].idx,end:i[n.id].idx,distance:a},d);f=gp(p,o,e,f),v=f[h]}return yp(v,s,u,l)},NT=function(e,t,n,i){var a,o,s,u=(a=e[t])===null||a===void 0?void 0:a.degree,l=(o=e[t])===null||o===void 0?void 0:o.inDegree,c=(s=e[t])===null||s===void 0?void 0:s.outDegree;return e[t]===void 0&&(u=1/0,l=1/0,c=1/0,i[t].forEach(function(f){var d=n[f.id].degree;u>d&&(u=d);var h=n[f.id].inDegree;l>h&&(l=h);var v=n[f.id].outDegree;c>v&&(c=v)}),e[t]={degree:u,inDegree:l,outDegree:c}),{minPatternNodeLabelDegree:u,minPatternNodeLabelInDegree:l,minPatternNodeLabelOutDegree:c}},OT=function(e,t,n,i,a,o,s){if(n===void 0&&(n=!1),o===void 0&&(o="cluster"),s===void 0&&(s="cluster"),!(!e||!e.nodes)){var u=e.nodes.length;if(!!u){var l=rh(e,n),c=rh(t,n),f=LT(e.nodes,l,n),d=LT(t.nodes,c,n),h=kT(e.nodes,o),v=h.nodeMap,p=h.nodeLabelMap,g=kT(t.nodes,o),y=g.nodeMap,m=g.nodeLabelMap;DT(e.edges,s,v);var b=DT(t.edges,s,y).edgeLabelMap,w=[];c==null||c.forEach(function(Ye){w=w.concat(Ye)}),a||(a=Math.max.apply(Math,no(no([],w),[2]))),i||(i=a);var x=CT(e,l,o,i),_=CT(t,c,o,i),A=Math.min(100,u*(u-1)/2),I=OW(i,u,A,_,l),M=gp(I,x,e),S=10,C=1,T=1,k=4,L={graphs:M,nodeLabelProp:o,edgeLabelProp:s,minSupport:C,minNodeNum:T,maxNodeNum:k,directed:n},B=NW(L).slice(0,S),ee=B.length,K=[];B.forEach(function(Ye,pt){K[pt]={},Object.keys(M).forEach(function(ht){var dt=M[ht],D=yp(dt,Ye,o,s);K[pt][ht]=D})});var z=PW(K,ee,B),X=z.structure,H=z.structureCountMap,J=t.nodes[0],ne=J[o],me=p[ne],oe={},Ae={},ze={},qe={},ft={},ct={};Object.keys(m).forEach(function(Ye,pt){ft[Ye]=[],n&&(ct[Ye]=[]);var ht=m[Ye],dt={};ht.forEach(function(Se){var De=d[J.id+"-"+Se.id];if(De&&ft[Ye].push(De),dt[J.id+"-"+Se.id]={start:0,end:y[Se.id].idx,distance:De},n){var At=d[Se.id+"-"+J.id];At&&ct[Ye].push(At)}}),ft[Ye]=ft[Ye].sort(function(Se,De){return Se-De}),n&&(ct[Ye]=ct[Ye].sort(function(Se,De){return Se-De})),Ae=gp(dt,_,t,Ae);var D=[];if(Object.keys(dt).forEach(function(Se){if(ze[Se]){D.push(ze[Se]);return}var De=Ae[Se];ze[Se]=yp(De,X,o,s),D.push(ze[Se])}),D=D.sort(function(Se,De){return De-Se}),qe[J.id+"-"+Ye]=D,Ye!==ne)for(var V=me.length,he=function(De){var At=me[De],ut=x[v[At.id].idx],St=ut.nodeLabelCountMap[Ye],nt=m[Ye].length;if(!St||St.count<nt)return me.splice(De,1),"continue";for(var Zt=!1,Dt=0;Dt<nt;Dt++)if(St.dists[Dt]>ft[Ye][Dt]){Zt=!0;break}if(Zt)return me.splice(De,1),"continue";var vr={};ut.neighbors.forEach(function(kr){var Tn=f[At.id+"-"+kr.id];vr[At.id+"-"+kr.id]={start:v[At.id].idx,end:v[kr.id].idx,distance:Tn}}),M=gp(vr,x,e,M);var Nr=[];Object.keys(vr).forEach(function(kr){if(H[kr]){Nr.push(H[kr]);return}var Tn=M[kr];H[kr]=yp(Tn,X,o,s),Nr.push(H[kr])}),Nr=Nr.sort(function(kr,Tn){return Tn-kr});for(var qn=!1,Dt=0;Dt<nt;Dt++)if(Nr[Dt]<D[Dt]){qn=!0;break}if(qn)return me.splice(De,1),"continue"},ye=V-1;ye>=0;ye--)he(ye)});var st=[];me==null||me.forEach(function(Ye){for(var pt=v[Ye.id].idx,ht=MT(e.nodes,l[pt],pt,o,a),dt=ht.neighbors,D=dt.length,V=!1,he=D-1;he>=0;he--){if(dt.length+1<t.nodes.length){V=!0;return}var ye=dt[he],Se=ye[o];if(!m[Se]||!m[Se].length){dt.splice(he,1);continue}if(!ft[Se]||!ft[Se].length){dt.splice(he,1);continue}var De=Ye.id+"-"+ye.id,At=f[De],ut=ft[Se].length-1,St=ft[Se][ut];if(At>St){dt.splice(he,1);continue}if(n){var nt=ye.id+"-"+Ye.id,Zt=f[nt];ut=ct[Se].length-1;var Dt=ct[Se][ut];if(Zt>Dt){dt.splice(he,1);continue}}var vr=H[De]?H[De]:RW(e,Ye,ye,v,At,x,X,o,s,H,M),Nr=J.id+"-"+Se,qn=qe[Nr][qe[Nr].length-1];if(vr<qn){dt.splice(he,1);continue}var kr=NT(oe,Se,y,m),Tn=kr.minPatternNodeLabelDegree;if(kr.minPatternNodeLabelInDegree,kr.minPatternNodeLabelOutDegree,v[ye.id].degree<Tn){dt.splice(he,1);continue}}V||st.push({nodes:[Ye].concat(dt)})});var gr=th(t,J.id,!1).length,tr={};n?(Object.keys(gr).forEach(function(Ye){var pt=y[Ye].node[o];tr[pt]?tr[pt].push(gr[Ye]):tr[pt]=[gr[Ye]]}),Object.keys(tr).forEach(function(Ye){tr[Ye].sort(function(pt,ht){return pt-ht})})):tr=ft;for(var $=st.length,se=function(pt){var ht=st[pt],dt=ht.nodes[0],D={},V={};ht.nodes.forEach(function(zt,Hr){V[zt.id]={idx:Hr,node:zt,degree:0,inDegree:0,outDegree:0};var pr=zt[o];D[pr]?D[pr]++:D[pr]=1});var he=[],ye={};e.edges.forEach(function(zt){V[zt.source]&&V[zt.target]&&(he.push(zt),ye[zt[s]]?ye[zt[s]]++:ye[zt[s]]=1,V[zt.source].degree++,V[zt.target].degree++,V[zt.source].outDegree++,V[zt.target].inDegree++)});for(var Se=Object.keys(b).length,De=!1,At=0;At<Se;At++){var ut=Object.keys(b)[At];if(!ye[ut]||ye[ut]<b[ut].length){De=!0;break}}if(De)return st.splice(pt,1),"continue";var St=he.length;if(St<t.edges.length)return st.splice(pt,1),"break";for(var nt=!1,Zt=function(Hr){var pr=he[Hr],cn=pr[s],Sr=b[cn];if(!Sr||!Sr.length)return ye[cn]--,Sr&&ye[cn]<Sr.length?(nt=!0,"break"):(he.splice(Hr,1),V[pr.source].degree--,V[pr.target].degree--,V[pr.source].outDegree--,V[pr.target].inDegree--,"continue");var iu=V[pr.source].node[o],au=V[pr.target].node[o],Co=!1;if(Sr.forEach(function(ou){var su=y[ou.source].node,uu=y[ou.target].node;su[o]===iu&&uu[o]===au&&(Co=!0),!n&&su[o]===au&&uu[o]===iu&&(Co=!0)}),!Co)return ye[cn]--,Sr&&ye[cn]<Sr.length?(nt=!0,"break"):(he.splice(Hr,1),V[pr.source].degree--,V[pr.target].degree--,V[pr.source].outDegree--,V[pr.target].inDegree--,"continue")},At=St-1;At>=0;At--){var Dt=Zt(At);if(Dt==="break")break}if(nt)return st.splice(pt,1),"continue";ht.edges=he;var vr=th(ht,ht.nodes[0].id,!1).length;if(Object.keys(vr).reverse().forEach(function(zt){if(!(zt===ht.nodes[0].id||nt)){if(vr[zt]===1/0){var Hr=V[zt].node[o];if(D[Hr]--,D[Hr]<m[Hr].length){nt=!0;return}var pr=ht.nodes.indexOf(V[zt].node);ht.nodes.splice(pr,1),V[zt]=void 0;return}var cn=v[zt].node[o];if(!tr[cn]||!tr[cn].length||vr[zt]>tr[cn][tr[cn].length-1]){var Hr=V[zt].node[o];if(D[Hr]--,D[Hr]<m[Hr].length){nt=!0;return}var pr=ht.nodes.indexOf(V[zt].node);ht.nodes.splice(pr,1),V[zt]=void 0}}}),nt)return st.splice(pt,1),"continue";for(var Nr=!0,qn=0;Nr&&!nt;){Nr=!1;var kr=n?V[dt.id].degree<y[J.id].degree||V[dt.id].inDegree<y[J.id].inDegree||V[dt.id].outDegree<y[J.id].outDegree:V[dt.id].degree<y[J.id].degree;if(kr){nt=!0;break}if(D[dt[o]]<m[dt[o]].length){nt=!0;break}for(var Tn=ht.nodes.length,ba=Tn-1;ba>=0;ba--){var Un=ht.nodes[ba],nu=V[Un.id].degree,hl=V[Un.id].inDegree,dl=V[Un.id].outDegree,Uc=Un[o],Io=NT(oe,Uc,y,m),Ln=Io.minPatternNodeLabelDegree,Gc=Io.minPatternNodeLabelInDegree,zc=Io.minPatternNodeLabelOutDegree,$c=n?nu<Ln||hl<Gc||dl<zc:nu<Ln;if($c){if(D[Un[o]]--,D[Un[o]]<m[Un[o]].length){nt=!0;break}ht.nodes.splice(ba,1),V[Un.id]=void 0,Nr=!0}}if(nt||!Nr&&qn!==0)break;St=he.length;for(var wa=St-1;wa>=0;wa--){var In=he[wa];if(!V[In.source]||!V[In.target]){he.splice(wa,1);var xa=In[s];if(ye[xa]--,V[In.source]&&(V[In.source].degree--,V[In.source].outDegree--),V[In.target]&&(V[In.target].degree--,V[In.target].inDegree--),b[xa]&&ye[xa]<b[xa].length){nt=!0;break}Nr=!0}}qn++}if(nt||nt||ht.nodes.length<t.nodes.length||he.length<t.edges.length)return st.splice(pt,1),"continue"},W=$-1;W>=0;W--){var Ze=se(W);if(Ze==="break")break}for(var yt=st.length,at=function(pt){var ht=st[pt],dt={};ht.edges.forEach(function(he){var ye=he.source+"-"+he.target+"-"+he.label;dt[ye]?dt[ye]++:dt[ye]=1});for(var D=function(ye){var Se=st[ye],De={};Se.edges.forEach(function(ut){var St=ut.source+"-"+ut.target+"-"+ut.label;De[St]?De[St]++:De[St]=1});var At=!0;Object.keys(De).length!==Object.keys(dt).length?At=!1:Object.keys(dt).forEach(function(ut){De[ut]!==dt[ut]&&(At=!1)}),At&&st.splice(ye,1)},V=yt-1;V>pt;V--)D(V);yt=st.length},W=0;W<=yt-1;W++)at(W);return st}}},mp=function(){function r(e){e===void 0&&(e=10),this.linkedList=new oT,this.maxStep=e}return Object.defineProperty(r.prototype,"length",{get:function(){return this.linkedList.toArray().length},enumerable:!1,configurable:!0}),r.prototype.isEmpty=function(){return!this.linkedList.head},r.prototype.isMaxStack=function(){return this.toArray().length>=this.maxStep},r.prototype.peek=function(){return this.isEmpty()?null:this.linkedList.head.value},r.prototype.push=function(e){this.linkedList.prepend(e),this.length>this.maxStep&&this.linkedList.deleteTail()},r.prototype.pop=function(){var e=this.linkedList.deleteHead();return e?e.value:null},r.prototype.toArray=function(){return this.linkedList.toArray().map(function(e){return e.value})},r.prototype.clear=function(){for(;!this.isEmpty();)this.pop()},r}(),PT=kb,BW={getAdjMatrix:Uu,breadthFirstSearch:uT,connectedComponent:Cb,getDegree:Es,getInDegree:cT,getOutDegree:fT,detectCycle:kb,detectDirectedCycle:PT,detectAllCycles:dT,detectAllDirectedCycle:Lb,detectAllUndirectedCycle:Db,depthFirstSearch:Mb,dijkstra:th,findAllPath:gT,findShortestPath:pT,floydWarshall:rh,labelPropagation:yT,louvain:mT,minimumSpanningTree:wT,pageRank:xT,getNeighbors:Ji,Stack:mp,GADDI:OT},FW=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",getAdjMatrix:Uu,breadthFirstSearch:uT,connectedComponent:Cb,getDegree:Es,getInDegree:cT,getOutDegree:fT,detectCycle:kb,detectDirectedCycle:PT,detectAllCycles:dT,detectAllDirectedCycle:Lb,detectAllUndirectedCycle:Db,depthFirstSearch:Mb,dijkstra:th,findAllPath:gT,findShortestPath:pT,floydWarshall:rh,labelPropagation:yT,louvain:mT,minimumSpanningTree:wT,pageRank:xT,getNeighbors:Ji,Stack:mp,GADDI:OT,default:BW}),bp=hp,UW=function(e){return function(t,n){return t[e]-n[e]}},RT=function(e,t,n){return e>=t&&e<=n},wp=function(e,t,n,i){var a=1e-4,o={x:n.x-e.x,y:n.y-e.y},s={x:t.x-e.x,y:t.y-e.y},u={x:i.x-n.x,y:i.y-n.y},l=s.x*u.y-s.y*u.x,c=l*l,f=1/l,d=s.x*s.x+s.y*s.y,h=u.x*u.x+u.y*u.y;if(c>a*d*h){var v=(o.x*u.y-o.y*u.x)*f,p=(o.x*s.y-o.y*s.x)*f;return!RT(v,0,1)||!RT(p,0,1)?null:{x:e.x+v*s.x,y:e.y+v*s.y}}return null},BT=function(e,t){var n=e.x,i=e.y,a=e.width,o=e.height,s=n+a/2,u=i+o/2,l=[],c={x:s,y:u};l.push({x:n,y:i}),l.push({x:n+a,y:i}),l.push({x:n+a,y:i+o}),l.push({x:n,y:i+o}),l.push({x:n,y:i});for(var f=null,d=1;d<l.length&&(f=wp(l[d-1],l[d],c,t),!f);d++);return f},FT=function(e,t){var n=e.x,i=e.y,a=e.r,o=t.x,s=t.y,u=o-n,l=s-i,c=Math.sqrt(u*u+l*l);if(c<a)return null;var f=Math.sign(u),d=Math.sign(l),h=Math.atan(l/u);return{x:n+Math.abs(a*Math.cos(h))*f,y:i+Math.abs(a*Math.sin(h))*d}},UT=function(e,t){var n=e.rx,i=e.ry,a=e.x,o=e.y,s=t.x-a,u=t.y-o,l=Math.atan2(u/i,s/n);return l<0&&(l+=2*Math.PI),{x:a+n*Math.cos(l),y:o+i*Math.sin(l)}},xp=function(e,t,n){n===void 0&&(n=1);var i=[e.x,e.y,n];return(!t||isNaN(t[0]))&&(t=[1,0,0,0,1,0,0,0,1]),oc(i,i,t),{x:i[0],y:i[1]}},GT=function(e,t,n){n===void 0&&(n=1),(!t||isNaN(t[0]))&&(t=[1,0,0,0,1,0,0,0,1]);var i=bb([1,0,0,0,1,0,0,0,1],t);i||(i=[1,0,0,0,1,0,0,0,1]);var a=[e.x,e.y,n];return oc(a,a,i),{x:a[0],y:a[1]}},Nb=function(e,t,n){var i=e.x-t.x,a=e.y-t.y,o=e.x-n.x,s=e.y-n.y,u=(e.x*e.x-t.x*t.x-t.y*t.y+e.y*e.y)/2,l=(e.x*e.x-n.x*n.x-n.y*n.y+e.y*e.y)/2,c=a*o-i*s;return{x:-(s*u-a*l)/c,y:-(i*l-o*u)/c}},_p=function(e,t){var n=e.x-t.x,i=e.y-t.y;return Math.sqrt(n*n+i*i)},GW=function(e,t){var n=[];return e.forEach(function(i){var a=[];i.forEach(function(o){a.push(o*t)}),n.push(a)}),n},zW=function(e){for(var t=[],n=e.length,i=0;i<n;i+=1){t[i]=[];for(var a=0;a<n;a+=1)i===a?t[i][a]=0:e[i][a]===0||!e[i][a]?t[i][a]=1/0:t[i][a]=e[i][a]}for(var o=0;o<n;o+=1)for(var i=0;i<n;i+=1)for(var a=0;a<n;a+=1)t[i][a]>t[i][o]+t[o][a]&&(t[i][a]=t[i][o]+t[o][a]);return t},$W=function(e,t){var n=e.nodes,i=e.edges,a=[],o={};if(!n)throw new Error("invalid nodes data!");return n&&n.forEach(function(s,u){o[s.id]=u;var l=[];a.push(l)}),i&&i.forEach(function(s){var u=s.source,l=s.target,c=o[u],f=o[l];a[c][f]=1,t||(a[f][c]=1)}),a},zT=function(e,t){e.translate(t.x,t.y)},$T=function(e,t,n,i){i===void 0&&(i={duration:500});var a=e.getMatrix();a||(a=[1,0,0,0,1,0,0,0,1]);var o=e.getCanvasBBox(),s=t.x-o.minX,u=t.y-o.minY;if(n){var l=s*a[0],c=u*a[4],f=0,d=0,h=0,v=0;e.animate(function(g){return h=l*g,v=c*g,a=bp(a,[["t",h-f,v-d]]),f=h,d=v,{matrix:a}},i)}else{var p=bp(a,[["t",s,u]]);e.setMatrix(p)}},VW=function(e,t){var n=e.getMatrix();n||(n=[1,0,0,0,1,0,0,0,1]);var i=t;Mt(t)||(i=[t,t]),Mt(t)&&t.length===1&&(i=[t[0],t[0]]),n=bp(n,[["s",i[0],i[1]]]),e.setMatrix(n)},jW=function(e,t){var n=e.getMatrix();n||(n=[1,0,0,0,1,0,0,0,1]),n=bp(n,[["r",t]]),e.setMatrix(n)},WW=function(e,t,n){for(var i=[],a=0;a<e;a++)i[a]=0;return n.forEach(function(o){o.source&&(i[t[o.source]]+=1),o.target&&(i[t[o.target]]+=1)}),i};function XW(r,e,t){return(t[0]-r[0])*(e[1]-r[1])==(e[0]-r[0])*(t[1]-r[1])&&Math.min(r[0],e[0])<=t[0]&&t[0]<=Math.max(r[0],e[0])&&Math.min(r[1],e[1])<=t[1]&&t[1]<=Math.max(r[1],e[1])}var nh=function(e,t,n){var i=!1,a=e.length,o=1e-6;function s(f){return Math.abs(f)<o?0:f<0?-1:1}if(a<=2)return!1;for(var u=0;u<a;u++){var l=e[u],c=e[(u+1)%a];if(XW(l,c,[t,n]))return!0;s(l[1]-n)>0!=s(c[1]-n)>0&&s(t-(n-l[1])*(l[0]-c[0])/(l[1]-c[1])-l[0])<0&&(i=!i)}return i},VT=function(e,t){return!(t.minX>e.maxX||t.maxX<e.minX||t.minY>e.maxY||t.maxY<e.minY)},YW=function(e,t){var n=!1;return xe(e,function(i){if(wp(i.from,i.to,t.from,t.to))return n=!0,!1}),n},jT=function(e,t){var n=function(d){var h=d.map(function(p){return p[0]}),v=d.map(function(p){return p[1]});return{minX:Math.min.apply(null,h),maxX:Math.max.apply(null,h),minY:Math.min.apply(null,v),maxY:Math.max.apply(null,v)}},i=function(d){for(var h=[],v=d.length,p=0;p<v-1;p++){var g=d[p],y=d[p+1];h.push({from:{x:g[0],y:g[1]},to:{x:y[0],y:y[1]}})}if(h.length>1){var m=d[0],b=d[v-1];h.push({from:{x:b[0],y:b[1]},to:{x:m[0],y:m[1]}})}return h};if(e.length<2||t.length<2)return!1;var a=n(e),o=n(t);if(!VT(a,o))return!1;var s=!1;if(xe(t,function(f){if(nh(e,f[0],f[1]))return s=!0,!1}),s||(xe(e,function(f){if(nh(t,f[0],f[1]))return s=!0,!1}),s))return!0;var u=i(e),l=i(t),c=!1;return xe(l,function(f){if(YW(u,f))return c=!0,!1}),c},zu=function(){function r(e,t,n,i){this.x1=e,this.y1=t,this.x2=n,this.y2=i}return r.prototype.getBBox=function(){var e=Math.min(this.x1,this.x2),t=Math.min(this.y1,this.y2),n=Math.max(this.x1,this.x2),i=Math.max(this.y1,this.y2),a={x:e,y:t,minX:e,minY:t,maxX:n,maxY:i,width:n-e,height:i-t};return a},r}(),Ob=function(e,t){var n={top:[e.minX,e.minY,e.maxX,e.minY],left:[e.minX,e.minY,e.minX,e.maxY],bottom:[e.minX,e.maxY,e.maxX,e.maxY],right:[e.maxX,e.minY,e.maxX,e.maxY]};return n[t]},HW=function(e,t){var n=(t.x2-t.x1)*(e.y1-t.y1)-(t.y2-t.y1)*(e.x1-t.x1),i=(e.x2-e.x1)*(e.y1-t.y1)-(e.y2-e.y1)*(e.x1-t.x1),a=(t.y2-t.y1)*(e.x2-e.x1)-(t.x2-t.x1)*(e.y2-e.y1);if(a){var o=n/a,s=i/a;if(o>=0&&o<=1&&s>=0&&s<=1)return o}return Number.POSITIVE_INFINITY},WT=function(e,t){for(var n=["top","left","bottom","right"],i=e.getBBox(),a=0,o=[],s=0;s<4;s++){var u=Ob(i,n[s]),l=u[0],c=u[1],f=u[2],d=u[3];o[s]=wp({x:t.x1,y:t.y1},{x:t.x2,y:t.y2},{x:l,y:c},{x:f,y:d}),o[s]&&(a+=1)}return[o,a]},Pb=function(e,t){for(var n=["top","left","bottom","right"],i=e.getBBox(),a=Number.POSITIVE_INFINITY,o=0,s=0;s<4;s++){var u=Ob(i,n[s]),l=u[0],c=u[1],f=u[2],d=u[3],h=HW(t,new zu(l,c,f,d));h=Math.abs(h-.5),h>=0&&h<=1&&(o+=1,a=h<a?h:a)}return o===0?-1:a},XT=function(e){var t=0,n=0;if(e.length>0){for(var i=0,a=e;i<a.length;i++){var o=a[i];t+=o.x,n+=o.y}t/=e.length,n/=e.length}return{x:t,y:n}},Sp=function(e,t){return Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)},YT=function(e,t){var n=t.x1,i=t.y1,a=t.x2-n,o=t.y2-i,s=e.x-n,u=e.y-i,l=s*a+u*o,c;l<=0?c=0:(s=a-s,u=o-u,l=s*a+u*o,l<=0?c=0:c=l*l/(a*a+o*o));var f=s*s+u*u-c;return f<0&&(f=0),f},Rb=function(e,t,n){return n===void 0&&(n=.001),Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)<Math.pow(n,2)},HT=function(e,t){var n=e.x<t.x,i=e.x>t.x+t.width,a=e.y>t.y+t.height,o=e.y<t.y,s=n||i||a||o;if(!s)return 0;if(a&&!n&&!i)return Math.pow(t.y+t.height-e.y,2);if(o&&!n&&!i)return Math.pow(e.y-t.y,2);if(n&&!a&&!o)return Math.pow(t.x-e.x,2);if(i&&!a&&!o)return Math.pow(t.x+t.width-e.x,2);var u=Math.min(Math.abs(t.x-e.x),Math.abs(t.x+t.width-e.x)),l=Math.min(Math.abs(t.y-e.y),Math.abs(t.y+t.height-e.y));return u*u+l*l},qW=function(e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=t.x,u=t.y,l=[a-n,o-i];if(iT(l,[0,0]))return NaN;var c=[-l[1],l[0]];Fu(c,c);var f=[s-n,u-i];return Math.abs(nT(f,c))},KW=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",compare:UW,getLineIntersect:wp,getRectIntersectByPoint:BT,getCircleIntersectByPoint:FT,getEllipseIntersectByPoint:UT,applyMatrix:xp,invertMatrix:GT,getCircleCenterByPoints:Nb,distance:_p,scaleMatrix:GW,floydWarshall:zW,getAdjMatrix:$W,translate:zT,move:$T,scale:VW,rotate:jW,getDegree:WW,isPointInPolygon:nh,intersectBBox:VT,isPolygonsIntersect:jT,Line:zu,getBBoxBoundLine:Ob,itemIntersectByLine:WT,fractionToLine:Pb,getPointsCenter:XT,squareDist:Sp,pointLineSquareDist:YT,isPointsOverlap:Rb,pointRectSquareDist:HT,pointLineDistance:qW}),As="rgb(95, 149, 255)",ZW="rgb(255, 255, 255)",qT="rgb(0, 0, 0)",Bb="rgb(247, 250, 255)",KT="rgb(239, 244, 255)",Ep="rgb(253, 253, 253)",ZT="rgb(250, 250, 250)",Ap="rgb(224, 224, 224)",QT="rgb(234, 234, 234)",QW="rgb(245, 245, 245)",JW="rgb(191, 213, 255)",JT="#4572d9",e9="rgb(223, 234, 255)",Cr={mainStroke:As,mainFill:KT,activeStroke:As,activeFill:Bb,inactiveStroke:JW,inactiveFill:Bb,selectedStroke:As,selectedFill:ZW,highlightStroke:JT,highlightFill:e9,disableStroke:Ap,disableFill:ZT,edgeMainStroke:Ap,edgeActiveStroke:As,edgeInactiveStroke:QT,edgeSelectedStroke:As,edgeHighlightStroke:As,edgeDisableStroke:QW,comboMainStroke:Ap,comboMainFill:Ep,comboActiveStroke:As,comboActiveFill:Bb,comboInactiveStroke:Ap,comboInactiveFill:Ep,comboSelectedStroke:As,comboSelectedFill:Ep,comboHighlightStroke:JT,comboHighlightFill:Ep,comboDisableStroke:QT,comboDisableFill:ZT},kt={version:"0.3.11",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:Cr.mainStroke,fill:KT},size:20,color:Cr.mainStroke,linkPoints:{size:8,lineWidth:1,fill:Cr.activeFill,stroke:Cr.activeStroke}},nodeStateStyles:{active:{fill:Cr.activeFill,stroke:Cr.activeStroke,lineWidth:2,shadowColor:Cr.mainStroke,shadowBlur:10},selected:{fill:Cr.selectedFill,stroke:Cr.selectedStroke,lineWidth:4,shadowColor:Cr.selectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{fill:Cr.highlightFill,stroke:Cr.highlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{fill:Cr.inactiveFill,stroke:Cr.inactiveStroke,lineWidth:1},disable:{fill:Cr.disableFill,stroke:Cr.disableStroke,lineWidth:1}},edgeLabel:{style:{fill:qT,textAlign:"center",textBaseline:"middle",fontSize:12}},defaultEdge:{type:"line",size:1,style:{stroke:Cr.edgeMainStroke,lineAppendWidth:2},color:Cr.edgeMainStroke},edgeStateStyles:{active:{stroke:Cr.edgeActiveStroke,lineWidth:1},selected:{stroke:Cr.edgeSelectedStroke,lineWidth:2,shadowColor:Cr.edgeSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:Cr.edgeHighlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{stroke:Cr.edgeInactiveStroke,lineWidth:1},disable:{stroke:Cr.edgeDisableStroke,lineWidth:1}},comboLabel:{style:{fill:qT,textBaseline:"middle",fontSize:12},refY:10,refX:10},defaultCombo:{type:"circle",style:{fill:Cr.comboMainFill,lineWidth:1,stroke:Cr.comboMainStroke,r:5,width:20,height:10},size:[20,5],color:Cr.comboMainStroke,padding:[25,20,15,20]},comboStateStyles:{active:{stroke:Cr.comboActiveStroke,lineWidth:1,fill:Cr.comboActiveFill},selected:{stroke:Cr.comboSelectedStroke,lineWidth:2,fill:Cr.comboSelectedFill,shadowColor:Cr.comboSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:Cr.comboHighlightStroke,lineWidth:2,fill:Cr.comboHighlightFill,"text-shape":{fontWeight:500}},inactive:{stroke:Cr.comboInactiveStroke,fill:Cr.comboInactiveFill,lineWidth:1},disable:{stroke:Cr.comboDisableStroke,fill:Cr.comboDisableFill,lineWidth:1}},delegateStyle:{fill:"#F3F9FF",fillOpacity:.5,stroke:"#1890FF",strokeOpacity:.9,lineDash:[5,5]}},t9={" ":.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},so=Math.PI,Fb=Math.sin,Ub=Math.cos,ri=Fb(so/8),ni=Ub(so/8),Tp=function(e,t){var n=e.getBBox(),i={x:n.minX,y:n.minY},a={x:n.maxX,y:n.maxY};if(t){var o=t.getMatrix();o||(o=[1,0,0,0,1,0,0,0,1]),i=xp(i,o),a=xp(a,o)}var s=i.x,u=i.y,l=a.x,c=a.y;return{x:s,y:u,minX:s,minY:u,maxX:l,maxY:c,width:l-s,height:c-u}},eI=function(e){var t=e.sourceNode||e.targetNode,n=t.get("group"),i=n.getMatrix();i||(i=[1,0,0,0,1,0,0,0,1]);var a=t.getKeyShape(),o=a.getBBox(),s=e.loopCfg||{},u=s.dist||Math.max(o.width,o.height)*2,l=s.position||kt.defaultLoopPosition,c=[i[6],i[7]],f=[e.startPoint.x,e.startPoint.y],d=[e.endPoint.x,e.endPoint.y],h=o.height/2,v=o.height/2,p=h*ri,g=h*ni,y=v*ri,m=v*ni;if(f[0]===d[0]&&f[1]===d[1]){switch(l){case"top":f=[c[0]-p,c[1]-g],d=[c[0]+y,c[1]-m];break;case"top-right":h=o.height/2,v=o.width/2,p=h*ri,g=h*ni,y=v*ri,m=v*ni,f=[c[0]+p,c[1]-g],d=[c[0]+m,c[1]-y];break;case"right":h=o.width/2,v=o.width/2,p=h*ri,g=h*ni,y=v*ri,m=v*ni,f=[c[0]+g,c[1]-p],d=[c[0]+m,c[1]+y];break;case"bottom-right":h=o.width/2,v=o.height/2,p=h*ri,g=h*ni,y=v*ri,m=v*ni,f=[c[0]+g,c[1]+p],d=[c[0]+y,c[1]+m];break;case"bottom":h=o.height/2,v=o.height/2,p=h*ri,g=h*ni,y=v*ri,m=v*ni,f=[c[0]+p,c[1]+g],d=[c[0]-y,c[1]+m];break;case"bottom-left":h=o.height/2,v=o.width/2,p=h*ri,g=h*ni,y=v*ri,m=v*ni,f=[c[0]-p,c[1]+g],d=[c[0]-m,c[1]+y];break;case"left":h=o.width/2,v=o.width/2,p=h*ri,g=h*ni,y=v*ri,m=v*ni,f=[c[0]-g,c[1]+p],d=[c[0]-m,c[1]-y];break;case"top-left":h=o.width/2,v=o.height/2,p=h*ri,g=h*ni,y=v*ri,m=v*ni,f=[c[0]-g,c[1]-p],d=[c[0]-y,c[1]-m];break;default:h=o.width/2,v=o.width/2,p=h*ri,g=h*ni,y=v*ri,m=v*ni,f=[c[0]-p,c[1]-g],d=[c[0]+y,c[1]-m]}if(s.clockwise===!1){var b=[f[0],f[1]];f=[d[0],d[1]],d=[b[0],b[1]]}}var w=[f[0]-c[0],f[1]-c[1]],x=(h+u)/h,_=(v+u)/v;s.clockwise===!1&&(x=(v+u)/v,_=(h+u)/h);var A=Ii([0,0],w,x),I=[c[0]+A[0],c[1]+A[1]],M=[d[0]-c[0],d[1]-c[1]],S=Ii([0,0],M,_),C=[c[0]+S[0],c[1]+S[1]];return e.startPoint={x:f[0],y:f[1]},e.endPoint={x:d[0],y:d[1]},e.controlPoints=[{x:I[0],y:I[1]},{x:C[0],y:C[1]}],e},Gb=function(e,t,n,i,a){var o=1e-4,s=[],u=e==null?void 0:e.getPoint(t);if(!u)return{x:0,y:0,angle:0};if(t<o)s=e.getStartTangent().reverse();else if(t>1-o)s=e.getEndTangent();else{var l=e==null?void 0:e.getPoint(t+o);s.push([u.x,u.y]),s.push([l.x,l.y])}var c=Math.atan2(s[1][1]-s[0][1],s[1][0]-s[0][0]);if(c<0&&(c+=so*2),n&&(u.x+=Ub(c)*n,u.y+=Fb(c)*n),i){var f=c-so/2;c>1/2*so&&c<3*1/2*so&&(f-=so),u.x+=Ub(f)*i,u.y+=Fb(f)*i}var d={x:u.x,y:u.y,angle:c};return a?(c>.5*so&&c<1.5*so&&(c-=so),P({rotate:c},d)):d},tI=function r(e,t){if(t(e)===!1)return!1;if(e&&e.children){for(var n=e.children.length-1;n>=0;n--)if(!r(e.children[n],t))return!1}return!0},r9=function r(e,t){if(e&&e.children){for(var n=e.children.length-1;n>=0;n--)if(!r(e.children[n],t))return}return t(e)!==!1},ea=function(e,t){typeof t=="function"&&tI(e,t)},Ts=function(e,t){typeof t=="function"&&r9(e,t)},rI=function(e,t){return t*(t9[e]||1)},nI=function(e,t){var n=0,i=new RegExp("[\u4E00-\u9FA5]+");return e.split("").forEach(function(a){i.test(a)?n+=t:n+=rI(a,t)}),[n,t]},zb=function(e,t){var n=[],i={},a={};e.forEach(function(u){a[u.id]=u}),e.forEach(function(u,l){var c=Ur(u);c.itemType="combo",c.children=void 0,c.parentId===c.id?(console.warn("The parentId for combo "+c.id+" can not be the same as the combo's id"),delete c.parentId):c.parentId&&!a[c.parentId]&&(console.warn("The parent combo for combo "+c.id+" does not exist!"),delete c.parentId);var f=i[c.id];if(f){if(c.children=f.children,i[c.id]=c,f=c,!f.parentId){n.push(f);return}var d=i[f.parentId];if(d)d.children?d.children.push(c):d.children=[c];else{var h={id:f.parentId,children:[f]};i[f.parentId]=h,i[c.id]=c}return}if(We(u.parentId)){var v=i[u.parentId];if(v)v.children?v.children.push(c):v.children=[c],i[c.id]=c;else{var p={id:u.parentId,children:[c]};i[p.id]=p,i[c.id]=c}}else n.push(c),i[c.id]=c});var o={};(t||[]).forEach(function(u){o[u.id]=u;var l=i[u.comboId];if(l){var c={id:u.id,comboId:u.comboId};l.children?l.children.push(c):l.children=[c],c.itemType="node",i[u.id]=c}});var s=0;return n.forEach(function(u){u.depth=s+10,tI(u,function(l){var c,f=i[l.id].itemType;f==="node"?c=i[l.comboId]:c=i[l.parentId],c&&f==="node"?l.depth=s+1:l.depth=s+10,s<l.depth&&(s=l.depth);var d=o[l.id];return d&&(d.depth=l.depth),!0})}),n},$b=function(e,t,n){var i=e,a,o={root:{children:e}},s=!1,u="root";(e||[]).forEach(function(h){if(!s){if(h.id===t){a=h,h.itemType==="combo"?a.parentId=n:a.comboId=n,s=!0;return}ea(h,function(v){return o[v.id]={children:v.children},i=o[v.parentId||v.comboId||"root"].children,v&&(v.removed||t===v.id)&&i?(u=v.parentId||v.comboId||"root",a=v,v.itemType==="combo"?a.parentId=n:a.comboId=n,s=!0,!1):!0})}}),i=o[u].children;var l=i?i.indexOf(a):-1;if(l>-1&&i.splice(l,1),s||(a={id:t,itemType:"node",comboId:n},o[t]={children:void 0}),t){var c=!1;if(n){var f=0;(e||[]).forEach(function(h){c||ea(h,function(v){return n===v.id?(c=!0,v.children?v.children.push(a):v.children=[a],f=v.depth,a.itemType==="node"?a.depth=f+2:a.depth=f+1,!1):!0})})}else(!n||!c)&&a.itemType!=="node"&&e.push(a);var d=a.depth;ea(a,function(h){return h.itemType==="node"?d+=2:d+=1,h.depth=d,!0})}return e},ih=function(e,t){var n={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};return!e||e.length===0||(e.forEach(function(i){var a=t.findById(i.id);if(!(!a||!a.isVisible())){a.set("bboxCanvasCache",void 0);var o=a.getCanvasBBox();o.x&&n.minX>o.minX&&(n.minX=o.minX),o.y&&n.minY>o.minY&&(n.minY=o.minY),o.x&&n.maxX<o.maxX&&(n.maxX=o.maxX),o.y&&n.maxY<o.maxY&&(n.maxY=o.maxY)}}),n.x=(n.minX+n.maxX)/2,n.y=(n.minY+n.maxY)/2,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,Object.keys(n).forEach(function(i){(n[i]===1/0||n[i]===-1/0)&&(n[i]=void 0)})),n},n9=function(e){var t=Ft(e.x)||Ft(e.y)||e.type||e.anchorPoints||e.size;return e.style&&(t=t||Ft(e.style.r)||Ft(e.style.width)||Ft(e.style.height)||Ft(e.style.rx)||Ft(e.style.ry)),t},Ip=function(e){var t={};return Object.keys(e).forEach(function(n){var i=e[n];if(gi(i)){var a={};Object.keys(i).forEach(function(o){var s=i[o];o==="img"&&!We(s)||(a[o]=Ur(s))}),t[n]=a}else t[n]=Ur(i)}),t},i9=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",getBBox:Tp,getLoopCfgs:eI,getLabelPosition:Gb,traverseTree:ea,traverseTreeUp:Ts,getLetterWidth:rI,getTextSize:nI,plainCombosToTrees:zb,reconstructTree:$b,getComboBBox:ih,shouldRefreshEdge:n9,cloneBesidesImg:Ip}),iI=function(e){if(!e)return console.error("G6 Error Tips: the data must be defined"),!1;var t=e.nodes,n=e.edges,i=e.combos,a=i===void 0?[]:i;if(!t&&!n){var o=!0;return ea(e,function(d){return We(d.id)?!0:(o=!1,!1)}),o}var s=(t||[]).find(function(d){return!We(d.id)});if(s)return console.warn("G6 Warning Tips: missing 'id' property, or %c"+s.id+"%c is not a string.","font-size: 20px; color: red;",""),!1;var u=(t||[]).map(function(d){return d.id}),l=a.map(function(d){return d.id}),c=no(no([],u),l),f=(n||[]).find(function(d){return!c.includes(d.source)||!c.includes(d.target)});return f?(console.warn("G6 Warning Tips: The source %c"+f.source+"%c or the target %c"+f.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},a9=function(e,t){if(e==="node"||e==="combo"){if(t.id&&!We(t.id))return console.warn("G6 Warning Tips: missing 'id' property, or the 'id' %c"+t.id+"%c is not a string.","font-size: 20px; color: red;",""),!1}else if(e==="edge"&&(!t.source||!t.target))return console.warn("G6 Warning Tips: missing 'source' or 'target' for the edge."),!1;return!0},o9=function(){function r(e){this.graph=e,this.destroyed=!1,this.modes=e.get("modes")||{default:[]},this.formatModes(),this.mode=e.get("defaultMode")||"default",this.currentBehaves=[],this.setMode(this.mode)}return r.prototype.formatModes=function(){var e=this.modes;xe(e,function(t){xe(t,function(n,i){We(n)&&(t[i]={type:n})})})},r.prototype.setBehaviors=function(e){var t=this.graph,n=this.modes[e],i=[],a;xe(n||[],function(o){var s=WA.getBehavior(o.type||o);!s||(a=new s(o),a&&(a.bind(t),i.push(a)))}),this.currentBehaves=i},r.mergeBehaviors=function(e,t){return xe(t,function(n){e.indexOf(n)<0&&(We(n)&&(n={type:n}),e.push(n))}),e},r.filterBehaviors=function(e,t){var n=[];return e.forEach(function(i){var a="";We(i)?a=i:a=i.type,t.indexOf(a)<0&&n.push(i)}),n},r.prototype.setMode=function(e){var t=this,n=t.modes,i=t.graph,a=e,o=n[a];!o||(i.emit("beforemodechange",{mode:e}),xe(this.currentBehaves,function(s){s.delegate&&s.delegate.remove(),s.unbind(i)}),this.setBehaviors(a),i.emit("aftermodechange",{mode:e}),this.mode=e)},r.prototype.getMode=function(){return this.mode},r.prototype.manipulateBehaviors=function(e,t,n){var i=this,a;if(Mt(e)?a=e:a=[e],Mt(t))return xe(t,function(s){i.modes[s]?n?i.modes[s]=r.mergeBehaviors(i.modes[s]||[],a):i.modes[s]=r.filterBehaviors(i.modes[s]||[],a):n&&(i.modes[s]=a)}),this;var o=t;return t||(o=this.mode),this.modes[o]||n&&(this.modes[o]=a),n?this.modes[o]=r.mergeBehaviors(this.modes[o]||[],a):this.modes[o]=r.filterBehaviors(this.modes[o]||[],a),this.formatModes(),this.setMode(this.mode),this},r.prototype.updateBehavior=function(e,t,n){We(e)&&(e={type:e});var i=[];if(!n||n===this.mode||n==="default"){if(i=this.currentBehaves,!i||!i.length)return console.warn("Update behavior failed! There is no behaviors in this mode on the graph."),this;for(var a=i.length,o=0;o<a;o++){var s=i[o];if(s.type===e.type)return s.updateCfg(t),this;o===a-1&&console.warn("Update behavior failed! There is no such behavior in the mode")}}else{if(i=this.modes[n],!i||!i.length)return console.warn("Update behavior failed! There is no behaviors in this mode on the graph."),this;for(var u=i.length,o=0;o<u;o++){var s=i[o];if(s.type===e.type||s===e.type)return s===e.type&&(s={type:s}),Object.assign(s,t),i[o]=s,this;o===u-1&&console.warn("Update behavior failed! There is no such behavior in the mode")}}return this},r.prototype.destroy=function(){this.graph=null,this.modes=null,this.currentBehaves=null,this.destroyed=!0},r}(),ah=`	
\v\f\r \xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029`,s9=new RegExp("([a-z])["+ah+",]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?["+ah+"]*,?["+ah+"]*)+)","ig"),u9=new RegExp("(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)["+ah+"]*,?["+ah+"]*","ig"),uc=function(r){if(!r)return null;if(Mt(r))return r;var e={a:7,c:6,o:2,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,u:3,z:0},t=[];return String(r).replace(s9,function(n,i,a){var o=[],s=i.toLowerCase();if(a.replace(u9,function(u,l){l&&o.push(+l)}),s==="m"&&o.length>2&&(t.push([i].concat(o.splice(0,2))),s="l",i=i==="m"?"l":"L"),s==="o"&&o.length===1&&t.push([i,o[0]]),s==="r")t.push([i].concat(o));else for(;o.length>=e[s]&&(t.push([i].concat(o.splice(0,e[s]))),!!e[s]););return r}),t},Vb=function(r,e){for(var t=[],n=0,i=r.length;i-2*!e>n;n+=2){var a=[{x:+r[n-2],y:+r[n-1]},{x:+r[n],y:+r[n+1]},{x:+r[n+2],y:+r[n+3]},{x:+r[n+4],y:+r[n+5]}];e?n?i-4===n?a[3]={x:+r[0],y:+r[1]}:i-2===n&&(a[2]={x:+r[0],y:+r[1]},a[3]={x:+r[2],y:+r[3]}):a[0]={x:+r[i-2],y:+r[i-1]}:i-4===n?a[3]=a[2]:n||(a[0]={x:+r[n],y:+r[n+1]}),t.push(["C",(-a[0].x+6*a[1].x+a[2].x)/6,(-a[0].y+6*a[1].y+a[2].y)/6,(a[1].x+6*a[2].x-a[3].x)/6,(a[1].y+6*a[2].y-a[3].y)/6,a[2].x,a[2].y])}return t},Cp=function(r,e,t,n,i){var a=[];if(i===null&&n===null&&(n=t),r=+r,e=+e,t=+t,n=+n,i!==null){var o=Math.PI/180,s=r+t*Math.cos(-n*o),u=r+t*Math.cos(-i*o),l=e+t*Math.sin(-n*o),c=e+t*Math.sin(-i*o);a=[["M",s,l],["A",t,t,0,+(i-n>180),0,u,c]]}else a=[["M",r,e],["m",0,-n],["a",t,n,0,1,1,0,2*n],["a",t,n,0,1,1,0,-2*n],["z"]];return a},jb=function(r){if(r=uc(r),!r||!r.length)return[["M",0,0]];var e=[],t=0,n=0,i=0,a=0,o=0,s,u;r[0][0]==="M"&&(t=+r[0][1],n=+r[0][2],i=t,a=n,o++,e[0]=["M",t,n]);for(var l=r.length===3&&r[0][0]==="M"&&r[1][0].toUpperCase()==="R"&&r[2][0].toUpperCase()==="Z",c=void 0,f=void 0,d=o,h=r.length;d<h;d++){if(e.push(c=[]),f=r[d],s=f[0],s!==s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=f[1],c[2]=f[2],c[3]=f[3],c[4]=f[4],c[5]=f[5],c[6]=+f[6]+t,c[7]=+f[7]+n;break;case"V":c[1]=+f[1]+n;break;case"H":c[1]=+f[1]+t;break;case"R":u=[t,n].concat(f.slice(1));for(var v=2,p=u.length;v<p;v++)u[v]=+u[v]+t,u[++v]=+u[v]+n;e.pop(),e=e.concat(Vb(u,l));break;case"O":e.pop(),u=Cp(t,n,f[1],f[2]),u.push(u[0]),e=e.concat(u);break;case"U":e.pop(),e=e.concat(Cp(t,n,f[1],f[2],f[3])),c=["U"].concat(e[e.length-1].slice(-2));break;case"M":i=+f[1]+t,a=+f[2]+n;break;default:for(var v=1,p=f.length;v<p;v++)c[v]=+f[v]+(v%2?t:n)}else if(s==="R")u=[t,n].concat(f.slice(1)),e.pop(),e=e.concat(Vb(u,l)),c=["R"].concat(f.slice(-2));else if(s==="O")e.pop(),u=Cp(t,n,f[1],f[2]),u.push(u[0]),e=e.concat(u);else if(s==="U")e.pop(),e=e.concat(Cp(t,n,f[1],f[2],f[3])),c=["U"].concat(e[e.length-1].slice(-2));else for(var g=0,y=f.length;g<y;g++)c[g]=f[g];if(s=s.toUpperCase(),s!=="O")switch(c[0]){case"Z":t=+i,n=+a;break;case"H":t=c[1];break;case"V":n=c[1];break;case"M":i=c[c.length-2],a=c[c.length-1];break;default:t=c[c.length-2],n=c[c.length-1]}}return e},Mp=function(r,e,t,n){return[r,e,t,n,t,n]},aI=function(r,e,t,n,i,a){var o=1/3,s=2/3;return[o*r+s*t,o*e+s*n,o*i+s*t,o*a+s*n,i,a]},oI=function(r,e,t,n,i,a,o,s,u,l){t===n&&(t+=1);var c=Math.PI*120/180,f=Math.PI/180*(+i||0),d=[],h,v,p,g,y,m=function(qe,ft,ct){var st=qe*Math.cos(ct)-ft*Math.sin(ct),gr=qe*Math.sin(ct)+ft*Math.cos(ct);return{x:st,y:gr}};if(l)v=l[0],p=l[1],g=l[2],y=l[3];else{h=m(r,e,-f),r=h.x,e=h.y,h=m(s,u,-f),s=h.x,u=h.y,r===s&&e===u&&(s+=1,u+=1);var b=(r-s)/2,w=(e-u)/2,x=b*b/(t*t)+w*w/(n*n);x>1&&(x=Math.sqrt(x),t=x*t,n=x*n);var _=t*t,A=n*n,I=(a===o?-1:1)*Math.sqrt(Math.abs((_*A-_*w*w-A*b*b)/(_*w*w+A*b*b)));g=I*t*w/n+(r+s)/2,y=I*-n*b/t+(e+u)/2,v=Math.asin(((e-y)/n).toFixed(9)),p=Math.asin(((u-y)/n).toFixed(9)),v=r<g?Math.PI-v:v,p=s<g?Math.PI-p:p,v<0&&(v=Math.PI*2+v),p<0&&(p=Math.PI*2+p),o&&v>p&&(v=v-Math.PI*2),!o&&p>v&&(p=p-Math.PI*2)}var M=p-v;if(Math.abs(M)>c){var S=p,C=s,T=u;p=v+c*(o&&p>v?1:-1),s=g+t*Math.cos(p),u=y+n*Math.sin(p),d=oI(s,u,t,n,i,0,o,C,T,[p,S,g,y])}M=p-v;var k=Math.cos(v),L=Math.sin(v),B=Math.cos(p),ee=Math.sin(p),K=Math.tan(M/4),z=4/3*t*K,X=4/3*n*K,H=[r,e],J=[r+z*L,e-X*k],ne=[s+z*ee,u-X*B],me=[s,u];if(J[0]=2*H[0]-J[0],J[1]=2*H[1]-J[1],l)return[J,ne,me].concat(d);d=[J,ne,me].concat(d).join().split(",");for(var oe=[],Ae=0,ze=d.length;Ae<ze;Ae++)oe[Ae]=Ae%2?m(d[Ae-1],d[Ae],f).y:m(d[Ae],d[Ae+1],f).x;return oe},Wb=function(r,e){var t=jb(r),n=e&&jb(e),i={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},a={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},o=[],s=[],u="",l="",c,f=function(b,w,x){var _,A;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(oI.apply(0,[w.x,w.y].concat(b.slice(1))));break;case"S":x==="C"||x==="S"?(_=w.x*2-w.bx,A=w.y*2-w.by):(_=w.x,A=w.y),b=["C",_,A].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(aI(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(aI(w.x,w.y,b[1],b[2],b[3],b[4]));break;case"L":b=["C"].concat(Mp(w.x,w.y,b[1],b[2]));break;case"H":b=["C"].concat(Mp(w.x,w.y,b[1],w.y));break;case"V":b=["C"].concat(Mp(w.x,w.y,w.x,b[1]));break;case"Z":b=["C"].concat(Mp(w.x,w.y,w.X,w.Y));break}return b},d=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),c=Math.max(t.length,n&&n.length||0)}},h=function(b,w,x,_,A){b&&w&&b[A][0]==="M"&&w[A][0]!=="M"&&(w.splice(A,0,["M",_.x,_.y]),x.bx=0,x.by=0,x.x=b[A][1],x.y=b[A][2],c=Math.max(t.length,n&&n.length||0))};c=Math.max(t.length,n&&n.length||0);for(var v=0;v<c;v++){t[v]&&(u=t[v][0]),u!=="C"&&(o[v]=u,v&&(l=o[v-1])),t[v]=f(t[v],i,l),o[v]!=="A"&&u==="C"&&(o[v]="C"),d(t,v),n&&(n[v]&&(u=n[v][0]),u!=="C"&&(s[v]=u,v&&(l=s[v-1])),n[v]=f(n[v],a,l),s[v]!=="A"&&u==="C"&&(s[v]="C"),d(n,v)),h(t,n,i,a,v),h(n,t,a,i,v);var p=t[v],g=n&&n[v],y=p.length,m=n&&g.length;i.x=p[y-2],i.y=p[y-1],i.bx=parseFloat(p[y-4])||i.x,i.by=parseFloat(p[y-3])||i.y,a.bx=n&&(parseFloat(g[m-4])||a.x),a.by=n&&(parseFloat(g[m-3])||a.y),a.x=n&&g[m-2],a.y=n&&g[m-1]}return n?[t,n]:t},l9=/,?([a-z]),?/gi,sI=function(r){return r.join(",").replace(l9,"$1")},uI=function(r,e,t,n,i){var a=-3*e+9*t-9*n+3*i,o=r*a+6*e-12*t+6*n;return r*o-3*e+3*t},lI=function(r,e,t,n,i,a,o,s,u){u===null&&(u=1),u=u>1?1:u<0?0:u;for(var l=u/2,c=12,f=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],d=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],h=0,v=0;v<c;v++){var p=l*f[v]+l,g=uI(p,r,t,i,o),y=uI(p,e,n,a,s),m=g*g+y*y;h+=d[v]*Math.sqrt(m)}return l*h},c9=function(r,e,t,n,i,a,o,s){for(var u=[],l=[[],[]],c,f,d,h,v=0;v<2;++v){if(v===0?(f=6*r-12*t+6*i,c=-3*r+9*t-9*i+3*o,d=3*t-3*r):(f=6*e-12*n+6*a,c=-3*e+9*n-9*a+3*s,d=3*n-3*e),Math.abs(c)<1e-12){if(Math.abs(f)<1e-12)continue;h=-d/f,h>0&&h<1&&u.push(h);continue}var p=f*f-4*d*c,g=Math.sqrt(p);if(!(p<0)){var y=(-f+g)/(2*c);y>0&&y<1&&u.push(y);var m=(-f-g)/(2*c);m>0&&m<1&&u.push(m)}}for(var b=u.length,w=b,x;b--;)h=u[b],x=1-h,l[0][b]=x*x*x*r+3*x*x*h*t+3*x*h*h*i+h*h*h*o,l[1][b]=x*x*x*e+3*x*x*h*n+3*x*h*h*a+h*h*h*s;return l[0][w]=r,l[1][w]=e,l[0][w+1]=o,l[1][w+1]=s,l[0].length=l[1].length=w+2,{min:{x:Math.min.apply(0,l[0]),y:Math.min.apply(0,l[1])},max:{x:Math.max.apply(0,l[0]),y:Math.max.apply(0,l[1])}}},f9=function(r,e,t,n,i,a,o,s){if(!(Math.max(r,t)<Math.min(i,o)||Math.min(r,t)>Math.max(i,o)||Math.max(e,n)<Math.min(a,s)||Math.min(e,n)>Math.max(a,s))){var u=(r*n-e*t)*(i-o)-(r-t)*(i*s-a*o),l=(r*n-e*t)*(a-s)-(e-n)*(i*s-a*o),c=(r-t)*(a-s)-(e-n)*(i-o);if(!!c){var f=u/c,d=l/c,h=+f.toFixed(2),v=+d.toFixed(2);if(!(h<+Math.min(r,t).toFixed(2)||h>+Math.max(r,t).toFixed(2)||h<+Math.min(i,o).toFixed(2)||h>+Math.max(i,o).toFixed(2)||v<+Math.min(e,n).toFixed(2)||v>+Math.max(e,n).toFixed(2)||v<+Math.min(a,s).toFixed(2)||v>+Math.max(a,s).toFixed(2)))return{x:f,y:d}}}},Is=function(r,e,t){return e>=r.x&&e<=r.x+r.width&&t>=r.y&&t<=r.y+r.height},cI=function(r,e,t,n,i){if(i)return[["M",+r+ +i,e],["l",t-i*2,0],["a",i,i,0,0,1,i,i],["l",0,n-i*2],["a",i,i,0,0,1,-i,i],["l",i*2-t,0],["a",i,i,0,0,1,-i,-i],["l",0,i*2-n],["a",i,i,0,0,1,i,-i],["z"]];var a=[["M",r,e],["l",t,0],["l",0,n],["l",-t,0],["z"]];return a.parsePathArray=sI,a},Xb=function(r,e,t,n){return r===null&&(r=e=t=n=0),e===null&&(e=r.y,t=r.width,n=r.height,r=r.x),{x:r,y:e,width:t,w:t,height:n,h:n,x2:r+t,y2:e+n,cx:r+t/2,cy:e+n/2,r1:Math.min(t,n)/2,r2:Math.max(t,n)/2,r0:Math.sqrt(t*t+n*n)/2,path:cI(r,e,t,n),vb:[r,e,t,n].join(" ")}},h9=function(r,e){return r=Xb(r),e=Xb(e),Is(e,r.x,r.y)||Is(e,r.x2,r.y)||Is(e,r.x,r.y2)||Is(e,r.x2,r.y2)||Is(r,e.x,e.y)||Is(r,e.x2,e.y)||Is(r,e.x,e.y2)||Is(r,e.x2,e.y2)||(r.x<e.x2&&r.x>e.x||e.x<r.x2&&e.x>r.x)&&(r.y<e.y2&&r.y>e.y||e.y<r.y2&&e.y>r.y)},fI=function(r,e,t,n,i,a,o,s){Mt(r)||(r=[r,e,t,n,i,a,o,s]);var u=c9.apply(null,r);return Xb(u.min.x,u.min.y,u.max.x-u.min.x,u.max.y-u.min.y)},hI=function(r,e,t,n,i,a,o,s,u){var l=1-u,c=Math.pow(l,3),f=Math.pow(l,2),d=u*u,h=d*u,v=c*r+f*3*u*t+l*3*u*u*i+h*o,p=c*e+f*3*u*n+l*3*u*u*a+h*s,g=r+2*u*(t-r)+d*(i-2*t+r),y=e+2*u*(n-e)+d*(a-2*n+e),m=t+2*u*(i-t)+d*(o-2*i+t),b=n+2*u*(a-n)+d*(s-2*a+n),w=l*r+u*t,x=l*e+u*n,_=l*i+u*o,A=l*a+u*s,I=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:_,y:A},alpha:I}},d9=function(r,e,t){var n=fI(r),i=fI(e);if(!h9(n,i))return t?0:[];for(var a=lI.apply(0,r),o=lI.apply(0,e),s=~~(a/8),u=~~(o/8),l=[],c=[],f={},d=t?0:[],h=0;h<s+1;h++){var v=hI.apply(0,r.concat(h/s));l.push({x:v.x,y:v.y,t:h/s})}for(var h=0;h<u+1;h++){var v=hI.apply(0,e.concat(h/u));c.push({x:v.x,y:v.y,t:h/u})}for(var h=0;h<s;h++)for(var p=0;p<u;p++){var g=l[h],y=l[h+1],m=c[p],b=c[p+1],w=Math.abs(y.x-g.x)<.001?"y":"x",x=Math.abs(b.x-m.x)<.001?"y":"x",_=f9(g.x,g.y,y.x,y.y,m.x,m.y,b.x,b.y);if(_){if(f[_.x.toFixed(4)]===_.y.toFixed(4))continue;f[_.x.toFixed(4)]=_.y.toFixed(4);var A=g.t+Math.abs((_[w]-g[w])/(y[w]-g[w]))*(y.t-g.t),I=m.t+Math.abs((_[x]-m[x])/(b[x]-m[x]))*(b.t-m.t);A>=0&&A<=1&&I>=0&&I<=1&&(t?d+=1:d.push({x:_.x,y:_.y,t1:A,t2:I}))}}return d},v9=function(r,e,t){r=Wb(r),e=Wb(e);for(var n,i,a,o,s,u,l,c,f,d,h=t?0:[],v=0,p=r.length;v<p;v++){var g=r[v];if(g[0]==="M")n=s=g[1],i=u=g[2];else{g[0]==="C"?(f=[n,i].concat(g.slice(1)),n=f[6],i=f[7]):(f=[n,i,n,i,s,u,s,u],n=s,i=u);for(var y=0,m=e.length;y<m;y++){var b=e[y];if(b[0]==="M")a=l=b[1],o=c=b[2];else{b[0]==="C"?(d=[a,o].concat(b.slice(1)),a=d[6],o=d[7]):(d=[a,o,a,o,l,c,l,c],a=l,o=c);var w=d9(f,d,t);if(t)h+=w;else{for(var x=0,_=w.length;x<_;x++)w[x].segment1=v,w[x].segment2=y,w[x].bez1=f,w[x].bez2=d;h=h.concat(w)}}}}}return h},p9=function(r,e){return v9(r,e)};function g9(r,e){var t=[],n=[];function i(a,o){if(a.length===1)t.push(a[0]),n.push(a[0]);else{for(var s=[],u=0;u<a.length-1;u++)u===0&&t.push(a[0]),u===a.length-2&&n.push(a[u+1]),s[u]=[(1-o)*a[u][0]+o*a[u+1][0],(1-o)*a[u][1]+o*a[u+1][1]];i(s,o)}}return r.length&&i(r,e),{left:t,right:n.reverse()}}function y9(r,e,t){var n=[[r[1],r[2]]];t=t||2;var i=[];e[0]==="A"?(n.push(e[6]),n.push(e[7])):e[0]==="C"?(n.push([e[1],e[2]]),n.push([e[3],e[4]]),n.push([e[5],e[6]])):e[0]==="S"||e[0]==="Q"?(n.push([e[1],e[2]]),n.push([e[3],e[4]])):n.push([e[1],e[2]]);for(var a=n,o=1/t,s=0;s<t-1;s++){var u=o/(1-o*s),l=g9(a,u);i.push(l.left),a=l.right}i.push(a);var c=i.map(function(f){var d=[];return f.length===4&&(d.push("C"),d=d.concat(f[2])),f.length>=3&&(f.length===3&&d.push("Q"),d=d.concat(f[1])),f.length===2&&d.push("L"),d=d.concat(f[f.length-1]),d});return c}var m9=function(r,e,t){if(t===1)return[[].concat(r)];var n=[];if(e[0]==="L"||e[0]==="C"||e[0]==="Q")n=n.concat(y9(r,e,t));else{var i=[].concat(r);i[0]==="M"&&(i[0]="L");for(var a=0;a<=t-1;a++)n.push(i)}return n},b9=function(r,e){if(r.length===1)return r;var t=r.length-1,n=e.length-1,i=t/n,a=[];if(r.length===1&&r[0][0]==="M"){for(var o=0;o<n-t;o++)r.push(r[0]);return r}for(var o=0;o<n;o++){var s=Math.floor(i*o);a[s]=(a[s]||0)+1}var u=a.reduce(function(l,c,f){return f===t?l.concat(r[t]):l.concat(m9(r[f],r[f+1],c))},[]);return u.unshift(r[0]),(e[n]==="Z"||e[n]==="z")&&u.push("Z"),u},w9=function(r,e){if(r.length!==e.length)return!1;var t=!0;return xe(r,function(n,i){if(n!==e[i])return t=!1,!1}),t};function x9(r,e,t){var n=null,i=t;return e<i&&(i=e,n="add"),r<i&&(i=r,n="del"),{type:n,min:i}}var _9=function(r,e){var t=r.length,n=e.length,i,a,o=0;if(t===0||n===0)return null;for(var s=[],u=0;u<=t;u++)s[u]=[],s[u][0]={min:u};for(var l=0;l<=n;l++)s[0][l]={min:l};for(var u=1;u<=t;u++){i=r[u-1];for(var l=1;l<=n;l++){a=e[l-1],w9(i,a)?o=0:o=1;var c=s[u-1][l].min+1,f=s[u][l-1].min+1,d=s[u-1][l-1].min+o;s[u][l]=x9(c,f,d)}}return s},dI=function(r,e){var t=_9(r,e),n=r.length,i=e.length,a=[],o=1,s=1;if(t[n][i].min!==n){for(var u=1;u<=n;u++){var l=t[u][u].min;s=u;for(var c=o;c<=i;c++)t[u][c].min<l&&(l=t[u][c].min,s=c);o=s,t[u][o].type&&a.push({index:u-1,type:t[u][o].type})}for(var u=a.length-1;u>=0;u--)o=a[u].index,a[u].type==="add"?r.splice(o,0,[].concat(r[o])):r.splice(o,1)}n=r.length;var f=i-n;if(n<i)for(var u=0;u<f;u++)r[n-1][0]==="z"||r[n-1][0]==="Z"?r.splice(n-2,0,r[n-2]):r.push(r[n-1]),n+=1;return r};function Yb(r,e,t){for(var n=[].concat(r),i,a=1/(t+1),o=vI(e)[0],s=1;s<=t;s++)a*=s,i=Math.floor(r.length*a),i===0?n.unshift([o[0]*a+r[i][0]*(1-a),o[1]*a+r[i][1]*(1-a)]):n.splice(i,0,[o[0]*a+r[i][0]*(1-a),o[1]*a+r[i][1]*(1-a)]);return n}function vI(r){var e=[];switch(r[0]){case"M":e.push([r[1],r[2]]);break;case"L":e.push([r[1],r[2]]);break;case"A":e.push([r[6],r[7]]);break;case"Q":e.push([r[3],r[4]]),e.push([r[1],r[2]]);break;case"T":e.push([r[1],r[2]]);break;case"C":e.push([r[5],r[6]]),e.push([r[1],r[2]]),e.push([r[3],r[4]]);break;case"S":e.push([r[3],r[4]]),e.push([r[1],r[2]]);break;case"H":e.push([r[1],r[1]]);break;case"V":e.push([r[1],r[1]]);break}return e}var Hb=function(r,e){if(r.length<=1)return r;for(var t,n=0;n<e.length;n++)if(r[n][0]!==e[n][0])switch(t=vI(r[n]),e[n][0]){case"M":r[n]=["M"].concat(t[0]);break;case"L":r[n]=["L"].concat(t[0]);break;case"A":r[n]=[].concat(e[n]),r[n][6]=t[0][0],r[n][7]=t[0][1];break;case"Q":if(t.length<2)if(n>0)t=Yb(t,r[n-1],1);else{r[n]=e[n];break}r[n]=["Q"].concat(t.reduce(function(i,a){return i.concat(a)},[]));break;case"T":r[n]=["T"].concat(t[0]);break;case"C":if(t.length<3)if(n>0)t=Yb(t,r[n-1],2);else{r[n]=e[n];break}r[n]=["C"].concat(t.reduce(function(i,a){return i.concat(a)},[]));break;case"S":if(t.length<2)if(n>0)t=Yb(t,r[n-1],1);else{r[n]=e[n];break}r[n]=["S"].concat(t.reduce(function(i,a){return i.concat(a)},[]));break;default:r[n]=e[n]}return r},S9=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",catmullRomToBezier:Vb,fillPath:b9,fillPathByDiff:dI,formatPath:Hb,intersection:p9,parsePathArray:sI,parsePathString:uc,pathToAbsolute:jb,pathToCurve:Wb,rectPath:cI}),pI=function(){function r(e,t){this.bubbles=!0,this.target=null,this.currentTarget=null,this.delegateTarget=null,this.delegateObject=null,this.defaultPrevented=!1,this.propagationStopped=!1,this.shape=null,this.fromShape=null,this.toShape=null,this.propagationPath=[],this.type=e,this.name=e,this.originalEvent=t,this.timeStamp=t.timeStamp}return r.prototype.preventDefault=function(){this.defaultPrevented=!0,this.originalEvent.preventDefault&&this.originalEvent.preventDefault()},r.prototype.stopPropagation=function(){this.propagationStopped=!0},r.prototype.toString=function(){var e=this.type;return"[Event (type="+e+")]"},r.prototype.save=function(){},r.prototype.restore=function(){},r}();function gI(r,e){var t=r.indexOf(e);t!==-1&&r.splice(t,1)}var yI=typeof window!="undefined"&&typeof window.document!="undefined";function mI(r,e){if(r.isCanvas())return!0;for(var t=e.getParent(),n=!1;t;){if(t===r){n=!0;break}t=t.getParent()}return n}function qb(r){return r.cfg.visible&&r.cfg.capture}var E9=function(r){Wt(e,r);function e(t){var n=r.call(this)||this;n.destroyed=!1;var i=n.getDefaultCfg();return n.cfg=It(i,t),n}return e.prototype.getDefaultCfg=function(){return{}},e.prototype.get=function(t){return this.cfg[t]},e.prototype.set=function(t,n){this.cfg[t]=n},e.prototype.destroy=function(){this.cfg={destroyed:!0},this.off(),this.destroyed=!0},e}(XA),bI=globalThis&&globalThis.__spreadArray||function(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return r.concat(a||Array.prototype.slice.call(e))},A9=function(){function r(e,t,n){this.name=e,this.version=t,this.os=n,this.type="browser"}return r}(),T9=function(){function r(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}return r}(),I9=function(){function r(e,t,n,i){this.name=e,this.version=t,this.os=n,this.bot=i,this.type="bot-device"}return r}(),C9=function(){function r(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return r}(),M9=function(){function r(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return r}(),k9=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,D9=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,wI=3,L9=[["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|$)/],["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",k9]],xI=[["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/],["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 _I(r){return r?SI(r):typeof document=="undefined"&&typeof navigator!="undefined"&&navigator.product==="ReactNative"?new M9:typeof navigator!="undefined"?SI(navigator.userAgent):P9()}function N9(r){return r!==""&&L9.reduce(function(e,t){var n=t[0],i=t[1];if(e)return e;var a=i.exec(r);return!!a&&[n,a]},!1)}function SI(r){var e=N9(r);if(!e)return null;var t=e[0],n=e[1];if(t==="searchbot")return new C9;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length<wI&&(i=bI(bI([],i,!0),R9(wI-i.length),!0)):i=[];var a=i.join("."),o=O9(r),s=D9.exec(r);return s&&s[1]?new I9(t,a,o,s[1]):new A9(t,a,o)}function O9(r){for(var e=0,t=xI.length;e<t;e++){var n=xI[e],i=n[0],a=n[1],o=a.exec(r);if(o)return i}return null}function P9(){var r=typeof process!="undefined"&&process.version;return r?new T9(process.version.slice(1)):null}function R9(r){for(var e=[],t=0;t<r;t++)e.push("0");return e}function B9(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return jf(n,t),ti(r,n,e)}function F9(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return Wf(n,t),ti(r,n,e)}function U9(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return Xf(n,t),ti(r,n,e)}function G9(r,e,t){return ti(r,t,e)}function z9(r,e){for(var t=r?[].concat(r):[1,0,0,0,1,0,0,0,1],n=0,i=e.length;n<i;n++){var a=e[n];switch(a[0]){case"t":B9(t,t,[a[1],a[2]]);break;case"s":U9(t,t,[a[1],a[2]]);break;case"r":F9(t,t,a[1]);break;case"m":G9(t,t,a[1]);break}}return t}function EI(r,e){var t=[],n=r[0],i=r[1],a=r[2],o=r[3],s=r[4],u=r[5],l=r[6],c=r[7],f=r[8],d=e[0],h=e[1],v=e[2],p=e[3],g=e[4],y=e[5],m=e[6],b=e[7],w=e[8];return t[0]=d*n+h*o+v*l,t[1]=d*i+h*s+v*c,t[2]=d*a+h*u+v*f,t[3]=p*n+g*o+y*l,t[4]=p*i+g*s+y*c,t[5]=p*a+g*u+y*f,t[6]=m*n+b*o+w*l,t[7]=m*i+b*s+w*c,t[8]=m*a+b*u+w*f,t}function $u(r,e){var t=[],n=e[0],i=e[1];return t[0]=r[0]*n+r[3]*i+r[6],t[1]=r[1]*n+r[4]*i+r[7],t}function AI(r){var e=[],t=r[0],n=r[1],i=r[2],a=r[3],o=r[4],s=r[5],u=r[6],l=r[7],c=r[8],f=c*o-s*l,d=-c*a+s*u,h=l*a-o*u,v=t*f+n*d+i*h;return v?(v=1/v,e[0]=f*v,e[1]=(-c*n+i*l)*v,e[2]=(s*n-i*o)*v,e[3]=d*v,e[4]=(c*t-i*u)*v,e[5]=(-s*t+i*a)*v,e[6]=h*v,e[7]=(-l*t+n*u)*v,e[8]=(o*t-n*a)*v,e):null}var oh=z9,Kb="matrix",$9=["zIndex","capture","visible","type"],V9=["repeat"],j9=":",W9="*";function X9(r){for(var e=[],t=0;t<r.length;t++)Mt(r[t])?e.push([].concat(r[t])):e.push(r[t]);return e}function Y9(r,e){var t={},n=e.attrs;for(var i in r)t[i]=n[i];return t}function H9(r,e){var t={},n=e.attr();return xe(r,function(i,a){V9.indexOf(a)===-1&&!Du(n[a],i)&&(t[a]=i)}),t}function q9(r,e){if(e.onFrame)return r;var t=e.startTime,n=e.delay,i=e.duration,a=Object.prototype.hasOwnProperty;return xe(r,function(o){t+n<o.startTime+o.delay+o.duration&&i>o.delay&&xe(e.toAttrs,function(s,u){a.call(o.toAttrs,u)&&(delete o.toAttrs[u],delete o.fromAttrs[u])})}),r}var TI=function(r){Wt(e,r);function e(t){var n=r.call(this,t)||this;n.attrs={};var i=n.getDefaultAttrs();return It(i,t.attrs),n.attrs=i,n.initAttrs(i),n.initAnimate(),n}return e.prototype.getDefaultCfg=function(){return{visible:!0,capture:!0,zIndex:0}},e.prototype.getDefaultAttrs=function(){return{matrix:this.getDefaultMatrix(),opacity:1}},e.prototype.onCanvasChange=function(t){},e.prototype.initAttrs=function(t){},e.prototype.initAnimate=function(){this.set("animable",!0),this.set("animating",!1)},e.prototype.isGroup=function(){return!1},e.prototype.getParent=function(){return this.get("parent")},e.prototype.getCanvas=function(){return this.get("canvas")},e.prototype.attr=function(){for(var t,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var a=n[0],o=n[1];if(!a)return this.attrs;if(gi(a)){for(var s in a)this.setAttr(s,a[s]);return this.afterAttrsChange(a),this}return n.length===2?(this.setAttr(a,o),this.afterAttrsChange((t={},t[a]=o,t)),this):this.attrs[a]},e.prototype.isClipped=function(t,n){var i=this.getClip();return i&&!i.isHit(t,n)},e.prototype.setAttr=function(t,n){var i=this.attrs[t];i!==n&&(this.attrs[t]=n,this.onAttrChange(t,n,i))},e.prototype.onAttrChange=function(t,n,i){t==="matrix"&&this.set("totalMatrix",null)},e.prototype.afterAttrsChange=function(t){if(this.cfg.isClipShape){var n=this.cfg.applyTo;n&&n.onCanvasChange("clip")}else this.onCanvasChange("attr")},e.prototype.show=function(){return this.set("visible",!0),this.onCanvasChange("show"),this},e.prototype.hide=function(){return this.set("visible",!1),this.onCanvasChange("hide"),this},e.prototype.setZIndex=function(t){this.set("zIndex",t);var n=this.getParent();return n&&n.sort(),this},e.prototype.toFront=function(){var t=this.getParent();if(!!t){var n=t.getChildren();this.get("el");var i=n.indexOf(this);n.splice(i,1),n.push(this),this.onCanvasChange("zIndex")}},e.prototype.toBack=function(){var t=this.getParent();if(!!t){var n=t.getChildren();this.get("el");var i=n.indexOf(this);n.splice(i,1),n.unshift(this),this.onCanvasChange("zIndex")}},e.prototype.remove=function(t){t===void 0&&(t=!0);var n=this.getParent();n?(gI(n.getChildren(),this),n.get("clearing")||this.onCanvasChange("remove")):this.onCanvasChange("remove"),t&&this.destroy()},e.prototype.resetMatrix=function(){this.attr(Kb,this.getDefaultMatrix()),this.onCanvasChange("matrix")},e.prototype.getMatrix=function(){return this.attr(Kb)},e.prototype.setMatrix=function(t){this.attr(Kb,t),this.onCanvasChange("matrix")},e.prototype.getTotalMatrix=function(){var t=this.cfg.totalMatrix;if(!t){var n=this.attr("matrix"),i=this.cfg.parentMatrix;i&&n?t=EI(i,n):t=n||i,this.set("totalMatrix",t)}return t},e.prototype.applyMatrix=function(t){var n=this.attr("matrix"),i=null;t&&n?i=EI(t,n):i=n||t,this.set("totalMatrix",i),this.set("parentMatrix",t)},e.prototype.getDefaultMatrix=function(){return null},e.prototype.applyToMatrix=function(t){var n=this.attr("matrix");return n?$u(n,t):t},e.prototype.invertFromMatrix=function(t){var n=this.attr("matrix");if(n){var i=AI(n);if(i)return $u(i,t)}return t},e.prototype.setClip=function(t){var n=this.getCanvas(),i=null;if(t){var a=this.getShapeBase(),o=rc(t.type),s=a[o];s&&(i=new s({type:t.type,isClipShape:!0,applyTo:this,attrs:t.attrs,canvas:n}))}return this.set("clipShape",i),this.onCanvasChange("clip"),i},e.prototype.getClip=function(){var t=this.cfg.clipShape;return t||null},e.prototype.clone=function(){var t=this,n=this.attrs,i={};xe(n,function(s,u){Mt(n[u])?i[u]=X9(n[u]):i[u]=n[u]});var a=this.constructor,o=new a({attrs:i});return xe($9,function(s){o.set(s,t.get(s))}),o},e.prototype.destroy=function(){var t=this.destroyed;t||(this.attrs={},r.prototype.destroy.call(this))},e.prototype.isAnimatePaused=function(){return this.get("_pause").isPaused},e.prototype.animate=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];if(!(!this.get("timeline")&&!this.get("canvas"))){this.set("animating",!0);var i=this.get("timeline");i||(i=this.get("canvas").get("timeline"),this.set("timeline",i));var a=this.get("animations")||[];i.timer||i.initTimer();var o=t[0],s=t[1],u=t[2],l=u===void 0?"easeLinear":u,c=t[3],f=c===void 0?$f:c,d=t[4],h=d===void 0?0:d,v,p,g,y,m;on(o)?(v=o,o={}):gi(o)&&o.onFrame&&(v=o.onFrame,p=o.repeat),gi(s)?(m=s,s=m.duration,l=m.easing||"easeLinear",h=m.delay||0,p=m.repeat||p||!1,f=m.callback||$f,g=m.pauseCallback||$f,y=m.resumeCallback||$f):(Ft(f)&&(h=f,f=null),on(l)?(f=l,l="easeLinear"):l=l||"easeLinear");var b=H9(o,this),w={fromAttrs:Y9(b,this),toAttrs:b,duration:s,easing:l,repeat:p,callback:f,pauseCallback:g,resumeCallback:y,delay:h,startTime:i.getTime(),id:ao(),onFrame:v,pathFormatted:!1};a.length>0?a=q9(a,w):i.addAnimator(this),a.push(w),this.set("animations",a),this.set("_pause",{isPaused:!1})}},e.prototype.stopAnimate=function(t){var n=this;t===void 0&&(t=!0);var i=this.get("animations");xe(i,function(a){t&&(a.onFrame?n.attr(a.onFrame(1)):n.attr(a.toAttrs)),a.callback&&a.callback()}),this.set("animating",!1),this.set("animations",[])},e.prototype.pauseAnimate=function(){var t=this.get("timeline"),n=this.get("animations"),i=t.getTime();return xe(n,function(a){a._paused=!0,a._pauseTime=i,a.pauseCallback&&a.pauseCallback()}),this.set("_pause",{isPaused:!0,pauseTime:i}),this},e.prototype.resumeAnimate=function(){var t=this.get("timeline"),n=t.getTime(),i=this.get("animations"),a=this.get("_pause").pauseTime;return xe(i,function(o){o.startTime=o.startTime+(n-a),o._paused=!1,o._pauseTime=null,o.resumeCallback&&o.resumeCallback()}),this.set("_pause",{isPaused:!1}),this.set("animations",i),this},e.prototype.emitDelegation=function(t,n){var i=this,a=n.propagationPath;this.getEvents();var o;t==="mouseenter"?o=n.fromShape:t==="mouseleave"&&(o=n.toShape);for(var s=function(f){var d=a[f],h=d.get("name");if(h){if((d.isGroup()||d.isCanvas&&d.isCanvas())&&o&&mI(d,o))return"break";Mt(h)?xe(h,function(v){i.emitDelegateEvent(d,v,n)}):u.emitDelegateEvent(d,h,n)}},u=this,l=0;l<a.length;l++){var c=s(l);if(c==="break")break}},e.prototype.emitDelegateEvent=function(t,n,i){var a=this.getEvents(),o=n+j9+i.type;(a[o]||a[W9])&&(i.name=o,i.currentTarget=t,i.delegateTarget=this,i.delegateObject=t.get("delegateObject"),this.emit(o,i))},e.prototype.translate=function(t,n){t===void 0&&(t=0),n===void 0&&(n=0);var i=this.getMatrix(),a=oh(i,[["t",t,n]]);return this.setMatrix(a),this},e.prototype.move=function(t,n){var i=this.attr("x")||0,a=this.attr("y")||0;return this.translate(t-i,n-a),this},e.prototype.moveTo=function(t,n){return this.move(t,n)},e.prototype.scale=function(t,n){var i=this.getMatrix(),a=oh(i,[["s",t,n||t]]);return this.setMatrix(a),this},e.prototype.rotate=function(t){var n=this.getMatrix(),i=oh(n,[["r",t]]);return this.setMatrix(i),this},e.prototype.rotateAtStart=function(t){var n=this.attr(),i=n.x,a=n.y,o=this.getMatrix(),s=oh(o,[["t",-i,-a],["r",t],["t",i,a]]);return this.setMatrix(s),this},e.prototype.rotateAtPoint=function(t,n,i){var a=this.getMatrix(),o=oh(a,[["t",-t,-n],["r",i],["t",t,n]]);return this.setMatrix(o),this},e}(E9),II={},Zb="_INDEX";function CI(r,e){if(r.set("canvas",e),r.isGroup()){var t=r.get("children");t.length&&t.forEach(function(n){CI(n,e)})}}function MI(r,e){if(r.set("timeline",e),r.isGroup()){var t=r.get("children");t.length&&t.forEach(function(n){MI(n,e)})}}function K9(r,e,t){t===void 0&&(t=!0),t?e.destroy():(e.set("parent",null),e.set("canvas",null)),gI(r.getChildren(),e)}function Z9(r){return function(e,t){var n=r(e,t);return n===0?e[Zb]-t[Zb]:n}}var kI=function(r){Wt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.isCanvas=function(){return!1},e.prototype.getBBox=function(){var t=1/0,n=-1/0,i=1/0,a=-1/0,o=[],s=[],u=this.getChildren().filter(function(c){return c.get("visible")&&(!c.isGroup()||c.isGroup()&&c.getChildren().length>0)});u.length>0?(xe(u,function(c){var f=c.getBBox();o.push(f.minX,f.maxX),s.push(f.minY,f.maxY)}),t=fa(o),n=ca(o),i=fa(s),a=ca(s)):(t=0,n=0,i=0,a=0);var l={x:t,y:i,minX:t,minY:i,maxX:n,maxY:a,width:n-t,height:a-i};return l},e.prototype.getCanvasBBox=function(){var t=1/0,n=-1/0,i=1/0,a=-1/0,o=[],s=[],u=this.getChildren().filter(function(c){return c.get("visible")&&(!c.isGroup()||c.isGroup()&&c.getChildren().length>0)});u.length>0?(xe(u,function(c){var f=c.getCanvasBBox();o.push(f.minX,f.maxX),s.push(f.minY,f.maxY)}),t=fa(o),n=ca(o),i=fa(s),a=ca(s)):(t=0,n=0,i=0,a=0);var l={x:t,y:i,minX:t,minY:i,maxX:n,maxY:a,width:n-t,height:a-i};return l},e.prototype.getDefaultCfg=function(){var t=r.prototype.getDefaultCfg.call(this);return t.children=[],t},e.prototype.onAttrChange=function(t,n,i){if(r.prototype.onAttrChange.call(this,t,n,i),t==="matrix"){var a=this.getTotalMatrix();this._applyChildrenMarix(a)}},e.prototype.applyMatrix=function(t){var n=this.getTotalMatrix();r.prototype.applyMatrix.call(this,t);var i=this.getTotalMatrix();i!==n&&this._applyChildrenMarix(i)},e.prototype._applyChildrenMarix=function(t){var n=this.getChildren();xe(n,function(i){i.applyMatrix(t)})},e.prototype.addShape=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i=t[0],a=t[1];gi(i)?a=i:a.type=i;var o=II[a.type];o||(o=rc(a.type),II[a.type]=o);var s=this.getShapeBase(),u=new s[o](a);return this.add(u),u},e.prototype.addGroup=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i=t[0],a=t[1],o;if(on(i))a?o=new i(a):o=new i({parent:this});else{var s=i||{},u=this.getGroupBase();o=new u(s)}return this.add(o),o},e.prototype.getCanvas=function(){var t;return this.isCanvas()?t=this:t=this.get("canvas"),t},e.prototype.getShape=function(t,n,i){if(!qb(this))return null;var a=this.getChildren(),o;if(this.isCanvas())o=this._findShape(a,t,n,i);else{var s=[t,n,1];s=this.invertFromMatrix(s),this.isClipped(s[0],s[1])||(o=this._findShape(a,s[0],s[1],i))}return o},e.prototype._findShape=function(t,n,i,a){for(var o=null,s=t.length-1;s>=0;s--){var u=t[s];if(qb(u)&&(u.isGroup()?o=u.getShape(n,i,a):u.isHit(n,i)&&(o=u)),o)break}return o},e.prototype.add=function(t){var n=this.getCanvas(),i=this.getChildren(),a=this.get("timeline"),o=t.getParent();o&&K9(o,t,!1),t.set("parent",this),n&&CI(t,n),a&&MI(t,a),i.push(t),t.onCanvasChange("add"),this._applyElementMatrix(t)},e.prototype._applyElementMatrix=function(t){var n=this.getTotalMatrix();n&&t.applyMatrix(n)},e.prototype.getChildren=function(){return this.get("children")},e.prototype.sort=function(){var t=this.getChildren();xe(t,function(n,i){return n[Zb]=i,n}),t.sort(Z9(function(n,i){return n.get("zIndex")-i.get("zIndex")})),this.onCanvasChange("sort")},e.prototype.clear=function(){if(this.set("clearing",!0),!this.destroyed){for(var t=this.getChildren(),n=t.length-1;n>=0;n--)t[n].destroy();this.set("children",[]),this.onCanvasChange("clear"),this.set("clearing",!1)}},e.prototype.destroy=function(){this.get("destroyed")||(this.clear(),r.prototype.destroy.call(this))},e.prototype.getFirst=function(){return this.getChildByIndex(0)},e.prototype.getLast=function(){var t=this.getChildren();return this.getChildByIndex(t.length-1)},e.prototype.getChildByIndex=function(t){var n=this.getChildren();return n[t]},e.prototype.getCount=function(){var t=this.getChildren();return t.length},e.prototype.contain=function(t){var n=this.getChildren();return n.indexOf(t)>-1},e.prototype.removeChild=function(t,n){n===void 0&&(n=!0),this.contain(t)&&t.remove(n)},e.prototype.findAll=function(t){var n=[],i=this.getChildren();return xe(i,function(a){t(a)&&n.push(a),a.isGroup()&&(n=n.concat(a.findAll(t)))}),n},e.prototype.find=function(t){var n=null,i=this.getChildren();return xe(i,function(a){if(t(a)?n=a:a.isGroup()&&(n=a.find(t)),n)return!1}),n},e.prototype.findById=function(t){return this.find(function(n){return n.get("id")===t})},e.prototype.findByClassName=function(t){return this.find(function(n){return n.get("className")===t})},e.prototype.findAllByName=function(t){return this.findAll(function(n){return n.get("name")===t})},e}(TI),lc=0,sh=0,uh=0,DI=1e3,kp,lh,Dp=0,Vu=0,Lp=0,ch=typeof performance=="object"&&performance.now?performance:Date,LI=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(r){setTimeout(r,17)};function NI(){return Vu||(LI(Q9),Vu=ch.now()+Lp)}function Q9(){Vu=0}function Qb(){this._call=this._time=this._next=null}Qb.prototype=Jb.prototype={constructor:Qb,restart:function(r,e,t){if(typeof r!="function")throw new TypeError("callback is not a function");t=(t==null?NI():+t)+(e==null?0:+e),!this._next&&lh!==this&&(lh?lh._next=this:kp=this,lh=this),this._call=r,this._time=t,e1()},stop:function(){this._call&&(this._call=null,this._time=1/0,e1())}};function Jb(r,e,t){var n=new Qb;return n.restart(r,e,t),n}function J9(){NI(),++lc;for(var r=kp,e;r;)(e=Vu-r._time)>=0&&r._call.call(null,e),r=r._next;--lc}function OI(){Vu=(Dp=ch.now())+Lp,lc=sh=0;try{J9()}finally{lc=0,tX(),Vu=0}}function eX(){var r=ch.now(),e=r-Dp;e>DI&&(Lp-=e,Dp=r)}function tX(){for(var r,e=kp,t,n=1/0;e;)e._call?(n>e._time&&(n=e._time),r=e,e=e._next):(t=e._next,e._next=null,e=r?r._next=t:kp=t);lh=r,e1(n)}function e1(r){if(!lc){sh&&(sh=clearTimeout(sh));var e=r-Vu;e>24?(r<1/0&&(sh=setTimeout(OI,r-ch.now()-Lp)),uh&&(uh=clearInterval(uh))):(uh||(Dp=ch.now(),uh=setInterval(eX,DI)),lc=1,LI(OI))}}function rX(r){return+r}function nX(r){return r*r}function iX(r){return r*(2-r)}function PI(r){return((r*=2)<=1?r*r:--r*(2-r)+1)/2}function aX(r){return r*r*r}function oX(r){return--r*r*r+1}function RI(r){return((r*=2)<=1?r*r*r:(r-=2)*r*r+2)/2}var t1=3,sX=function r(e){e=+e;function t(n){return Math.pow(n,e)}return t.exponent=r,t}(t1),uX=function r(e){e=+e;function t(n){return 1-Math.pow(1-n,e)}return t.exponent=r,t}(t1),BI=function r(e){e=+e;function t(n){return((n*=2)<=1?Math.pow(n,e):2-Math.pow(2-n,e))/2}return t.exponent=r,t}(t1),FI=Math.PI,UI=FI/2;function lX(r){return+r==1?1:1-Math.cos(r*UI)}function cX(r){return Math.sin(r*UI)}function GI(r){return(1-Math.cos(FI*r))/2}function Cs(r){return(Math.pow(2,-10*r)-.0009765625)*1.0009775171065494}function fX(r){return Cs(1-+r)}function hX(r){return 1-Cs(r)}function zI(r){return((r*=2)<=1?Cs(1-r):2-Cs(r-1))/2}function dX(r){return 1-Math.sqrt(1-r*r)}function vX(r){return Math.sqrt(1- --r*r)}function $I(r){return((r*=2)<=1?1-Math.sqrt(1-r*r):Math.sqrt(1-(r-=2)*r)+1)/2}var r1=4/11,pX=6/11,gX=8/11,yX=3/4,mX=9/11,bX=10/11,wX=15/16,xX=21/22,_X=63/64,Np=1/r1/r1;function SX(r){return 1-fh(1-r)}function fh(r){return(r=+r)<r1?Np*r*r:r<gX?Np*(r-=pX)*r+yX:r<bX?Np*(r-=mX)*r+wX:Np*(r-=xX)*r+_X}function EX(r){return((r*=2)<=1?1-fh(1-r):fh(r-1)+1)/2}var n1=1.70158,AX=function r(e){e=+e;function t(n){return(n=+n)*n*(e*(n-1)+n)}return t.overshoot=r,t}(n1),TX=function r(e){e=+e;function t(n){return--n*n*((n+1)*e+n)+1}return t.overshoot=r,t}(n1),VI=function r(e){e=+e;function t(n){return((n*=2)<1?n*n*((e+1)*n-e):(n-=2)*n*((e+1)*n+e)+2)/2}return t.overshoot=r,t}(n1),cc=2*Math.PI,i1=1,a1=.3,IX=function r(e,t){var n=Math.asin(1/(e=Math.max(1,e)))*(t/=cc);function i(a){return e*Cs(- --a)*Math.sin((n-a)/t)}return i.amplitude=function(a){return r(a,t*cc)},i.period=function(a){return r(e,a)},i}(i1,a1),jI=function r(e,t){var n=Math.asin(1/(e=Math.max(1,e)))*(t/=cc);function i(a){return 1-e*Cs(a=+a)*Math.sin((a+n)/t)}return i.amplitude=function(a){return r(a,t*cc)},i.period=function(a){return r(e,a)},i}(i1,a1),CX=function r(e,t){var n=Math.asin(1/(e=Math.max(1,e)))*(t/=cc);function i(a){return((a=a*2-1)<0?e*Cs(-a)*Math.sin((n-a)/t):2-e*Cs(a)*Math.sin((n+a)/t))/2}return i.amplitude=function(a){return r(a,t*cc)},i.period=function(a){return r(e,a)},i}(i1,a1),WI=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",easeLinear:rX,easeQuad:PI,easeQuadIn:nX,easeQuadOut:iX,easeQuadInOut:PI,easeCubic:RI,easeCubicIn:aX,easeCubicOut:oX,easeCubicInOut:RI,easePoly:BI,easePolyIn:sX,easePolyOut:uX,easePolyInOut:BI,easeSin:GI,easeSinIn:lX,easeSinOut:cX,easeSinInOut:GI,easeExp:zI,easeExpIn:fX,easeExpOut:hX,easeExpInOut:zI,easeCircle:$I,easeCircleIn:dX,easeCircleOut:vX,easeCircleInOut:$I,easeBounce:fh,easeBounceIn:SX,easeBounceOut:fh,easeBounceInOut:EX,easeBack:VI,easeBackIn:AX,easeBackOut:TX,easeBackInOut:VI,easeElastic:jI,easeElasticIn:IX,easeElasticOut:jI,easeElasticInOut:CX});function o1(r,e,t){r.prototype=e.prototype=t,t.constructor=r}function XI(r,e){var t=Object.create(r.prototype);for(var n in e)t[n]=e[n];return t}function hh(){}var dh=.7,Op=1/dh,fc="\\s*([+-]?\\d+)\\s*",vh="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",uo="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",MX=/^#([0-9a-f]{3,8})$/,kX=new RegExp("^rgb\\("+[fc,fc,fc]+"\\)$"),DX=new RegExp("^rgb\\("+[uo,uo,uo]+"\\)$"),LX=new RegExp("^rgba\\("+[fc,fc,fc,vh]+"\\)$"),NX=new RegExp("^rgba\\("+[uo,uo,uo,vh]+"\\)$"),OX=new RegExp("^hsl\\("+[vh,uo,uo]+"\\)$"),PX=new RegExp("^hsla\\("+[vh,uo,uo,vh]+"\\)$"),YI={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};o1(hh,ph,{copy:function(r){return Object.assign(new this.constructor,this,r)},displayable:function(){return this.rgb().displayable()},hex:HI,formatHex:HI,formatHsl:RX,formatRgb:qI,toString:qI});function HI(){return this.rgb().formatHex()}function RX(){return eC(this).formatHsl()}function qI(){return this.rgb().formatRgb()}function ph(r){var e,t;return r=(r+"").trim().toLowerCase(),(e=MX.exec(r))?(t=e[1].length,e=parseInt(e[1],16),t===6?KI(e):t===3?new ta(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):t===8?Pp(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):t===4?Pp(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=kX.exec(r))?new ta(e[1],e[2],e[3],1):(e=DX.exec(r))?new ta(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=LX.exec(r))?Pp(e[1],e[2],e[3],e[4]):(e=NX.exec(r))?Pp(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=OX.exec(r))?JI(e[1],e[2]/100,e[3]/100,1):(e=PX.exec(r))?JI(e[1],e[2]/100,e[3]/100,e[4]):YI.hasOwnProperty(r)?KI(YI[r]):r==="transparent"?new ta(NaN,NaN,NaN,0):null}function KI(r){return new ta(r>>16&255,r>>8&255,r&255,1)}function Pp(r,e,t,n){return n<=0&&(r=e=t=NaN),new ta(r,e,t,n)}function BX(r){return r instanceof hh||(r=ph(r)),r?(r=r.rgb(),new ta(r.r,r.g,r.b,r.opacity)):new ta}function s1(r,e,t,n){return arguments.length===1?BX(r):new ta(r,e,t,n==null?1:n)}function ta(r,e,t,n){this.r=+r,this.g=+e,this.b=+t,this.opacity=+n}o1(ta,s1,XI(hh,{brighter:function(r){return r=r==null?Op:Math.pow(Op,r),new ta(this.r*r,this.g*r,this.b*r,this.opacity)},darker:function(r){return r=r==null?dh:Math.pow(dh,r),new ta(this.r*r,this.g*r,this.b*r,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:ZI,formatHex:ZI,formatRgb:QI,toString:QI}));function ZI(){return"#"+u1(this.r)+u1(this.g)+u1(this.b)}function QI(){var r=this.opacity;return r=isNaN(r)?1:Math.max(0,Math.min(1,r)),(r===1?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(r===1?")":", "+r+")")}function u1(r){return r=Math.max(0,Math.min(255,Math.round(r)||0)),(r<16?"0":"")+r.toString(16)}function JI(r,e,t,n){return n<=0?r=e=t=NaN:t<=0||t>=1?r=e=NaN:e<=0&&(r=NaN),new lo(r,e,t,n)}function eC(r){if(r instanceof lo)return new lo(r.h,r.s,r.l,r.opacity);if(r instanceof hh||(r=ph(r)),!r)return new lo;if(r instanceof lo)return r;r=r.rgb();var e=r.r/255,t=r.g/255,n=r.b/255,i=Math.min(e,t,n),a=Math.max(e,t,n),o=NaN,s=a-i,u=(a+i)/2;return s?(e===a?o=(t-n)/s+(t<n)*6:t===a?o=(n-e)/s+2:o=(e-t)/s+4,s/=u<.5?a+i:2-a-i,o*=60):s=u>0&&u<1?0:o,new lo(o,s,u,r.opacity)}function FX(r,e,t,n){return arguments.length===1?eC(r):new lo(r,e,t,n==null?1:n)}function lo(r,e,t,n){this.h=+r,this.s=+e,this.l=+t,this.opacity=+n}o1(lo,FX,XI(hh,{brighter:function(r){return r=r==null?Op:Math.pow(Op,r),new lo(this.h,this.s,this.l*r,this.opacity)},darker:function(r){return r=r==null?dh:Math.pow(dh,r),new lo(this.h,this.s,this.l*r,this.opacity)},rgb:function(){var r=this.h%360+(this.h<0)*360,e=isNaN(r)||isNaN(this.s)?0:this.s,t=this.l,n=t+(t<.5?t:1-t)*e,i=2*t-n;return new ta(l1(r>=240?r-240:r+120,i,n),l1(r,i,n),l1(r<120?r+240:r-120,i,n),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var r=this.opacity;return r=isNaN(r)?1:Math.max(0,Math.min(1,r)),(r===1?"hsl(":"hsla(")+(this.h||0)+", "+(this.s||0)*100+"%, "+(this.l||0)*100+"%"+(r===1?")":", "+r+")")}}));function l1(r,e,t){return(r<60?e+(t-e)*r/60:r<180?t:r<240?e+(t-e)*(240-r)/60:e)*255}function c1(r){return function(){return r}}function UX(r,e){return function(t){return r+t*e}}function GX(r,e,t){return r=Math.pow(r,t),e=Math.pow(e,t)-r,t=1/t,function(n){return Math.pow(r+n*e,t)}}function zX(r){return(r=+r)==1?tC:function(e,t){return t-e?GX(e,t,r):c1(isNaN(e)?t:e)}}function tC(r,e){var t=e-r;return t?UX(r,t):c1(isNaN(r)?e:r)}var rC=function r(e){var t=zX(e);function n(i,a){var o=t((i=s1(i)).r,(a=s1(a)).r),s=t(i.g,a.g),u=t(i.b,a.b),l=tC(i.opacity,a.opacity);return function(c){return i.r=o(c),i.g=s(c),i.b=u(c),i.opacity=l(c),i+""}}return n.gamma=r,n}(1);function nC(r,e){e||(e=[]);var t=r?Math.min(e.length,r.length):0,n=e.slice(),i;return function(a){for(i=0;i<t;++i)n[i]=r[i]*(1-a)+e[i]*a;return n}}function iC(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function $X(r,e){return(iC(e)?nC:aC)(r,e)}function aC(r,e){var t=e?e.length:0,n=r?Math.min(t,r.length):0,i=new Array(n),a=new Array(t),o;for(o=0;o<n;++o)i[o]=Rp(r[o],e[o]);for(;o<t;++o)a[o]=e[o];return function(s){for(o=0;o<n;++o)a[o]=i[o](s);return a}}function VX(r,e){var t=new Date;return r=+r,e=+e,function(n){return t.setTime(r*(1-n)+e*n),t}}function f1(r,e){return r=+r,e=+e,function(t){return r*(1-t)+e*t}}function jX(r,e){var t={},n={},i;(r===null||typeof r!="object")&&(r={}),(e===null||typeof e!="object")&&(e={});for(i in e)i in r?t[i]=Rp(r[i],e[i]):n[i]=e[i];return function(a){for(i in t)n[i]=t[i](a);return n}}var h1=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,d1=new RegExp(h1.source,"g");function WX(r){return function(){return r}}function XX(r){return function(e){return r(e)+""}}function YX(r,e){var t=h1.lastIndex=d1.lastIndex=0,n,i,a,o=-1,s=[],u=[];for(r=r+"",e=e+"";(n=h1.exec(r))&&(i=d1.exec(e));)(a=i.index)>t&&(a=e.slice(t,a),s[o]?s[o]+=a:s[++o]=a),(n=n[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,u.push({i:o,x:f1(n,i)})),t=d1.lastIndex;return t<e.length&&(a=e.slice(t),s[o]?s[o]+=a:s[++o]=a),s.length<2?u[0]?XX(u[0].x):WX(e):(e=u.length,function(l){for(var c=0,f;c<e;++c)s[(f=u[c]).i]=f.x(l);return s.join("")})}function Rp(r,e){var t=typeof e,n;return e==null||t==="boolean"?c1(e):(t==="number"?f1:t==="string"?(n=ph(e))?(e=n,rC):YX:e instanceof ph?rC:e instanceof Date?VX:iC(e)?nC:Array.isArray(e)?aC:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?jX:f1)(r,e)}var HX=function(r){return["fill","stroke","fillStyle","strokeStyle"].includes(r)},qX=function(r){return/^[r,R,L,l]{1}[\s]*\(/.test(r)},oC=[1,0,0,0,1,0,0,0,1];function KX(r,e,t){var n={},i=e.fromAttrs,a=e.toAttrs;if(!r.destroyed){var o;for(var s in a)if(!Du(i[s],a[s]))if(s==="path"){var u=a[s],l=i[s];u.length>l.length?(u=uc(a[s]),l=uc(i[s]),l=dI(l,u),l=Hb(l,u),e.fromAttrs.path=l,e.toAttrs.path=u):e.pathFormatted||(u=uc(a[s]),l=uc(i[s]),l=Hb(l,u),e.fromAttrs.path=l,e.toAttrs.path=u,e.pathFormatted=!0),n[s]=[];for(var c=0;c<u.length;c++){for(var f=u[c],d=l[c],h=[],v=0;v<f.length;v++)Ft(f[v])&&d&&Ft(d[v])?(o=Rp(d[v],f[v]),h.push(o(t))):h.push(f[v]);n[s].push(h)}}else if(s==="matrix"){var p=$X(i[s]||oC,a[s]||oC),g=p(t);n[s]=g}else HX(s)&&qX(a[s])?n[s]=a[s]:on(a[s])||(o=Rp(i[s],a[s]),n[s]=o(t));r.attr(n)}}function ZX(r,e,t){var n=e.startTime,i=e.delay;if(t<n+i||e._paused)return!1;var a,o=e.duration,s=e.easing;if(t=t-n-e.delay,e.repeat)a=t%o/o,a=WI[s](a);else if(a=t/o,a<1)a=WI[s](a);else return e.onFrame?r.attr(e.onFrame(1)):r.attr(e.toAttrs),!0;if(e.onFrame){var u=e.onFrame(a);r.attr(u)}else KX(r,e,a);return!1}var QX=function(){function r(e){this.animators=[],this.current=0,this.timer=null,this.canvas=e}return r.prototype.initTimer=function(){var e=this,t=!1,n,i,a;this.timer=Jb(function(o){if(e.current=o,e.animators.length>0){for(var s=e.animators.length-1;s>=0;s--){if(n=e.animators[s],n.destroyed){e.removeAnimator(s);continue}if(!n.isAnimatePaused()){i=n.get("animations");for(var u=i.length-1;u>=0;u--)a=i[u],t=ZX(n,a,o),t&&(i.splice(u,1),t=!1,a.callback&&a.callback())}i.length===0&&e.removeAnimator(s)}var l=e.canvas.get("autoDraw");l||e.canvas.draw()}})},r.prototype.addAnimator=function(e){this.animators.push(e)},r.prototype.removeAnimator=function(e){this.animators.splice(e,1)},r.prototype.isAnimating=function(){return!!this.animators.length},r.prototype.stop=function(){this.timer&&this.timer.stop()},r.prototype.stopAllAnimations=function(e){e===void 0&&(e=!0),this.animators.forEach(function(t){t.stopAnimate(e)}),this.animators=[],this.canvas.draw()},r.prototype.getTime=function(){return this.current},r}(),JX=40,sC=0,uC=["mousedown","mouseup","dblclick","mouseout","mouseover","mousemove","mouseleave","mouseenter","touchstart","touchmove","touchend","dragenter","dragover","dragleave","drop","contextmenu","mousewheel"];function lC(r,e,t){t.name=e,t.target=r,t.currentTarget=r,t.delegateTarget=r,r.emit(e,t)}function eY(r,e,t){if(t.bubbles){var n=void 0,i=!1;if(e==="mouseenter"?(n=t.fromShape,i=!0):e==="mouseleave"&&(i=!0,n=t.toShape),r.isCanvas()&&i)return;if(n&&mI(r,n)){t.bubbles=!1;return}t.name=e,t.currentTarget=r,t.delegateTarget=r,r.emit(e,t)}}var tY=function(){function r(e){var t=this;this.draggingShape=null,this.dragging=!1,this.currentShape=null,this.mousedownShape=null,this.mousedownPoint=null,this._eventCallback=function(n){var i=n.type;t._triggerEvent(i,n)},this._onDocumentMove=function(n){var i=t.canvas,a=i.get("el");if(a!==n.target&&(t.dragging||t.currentShape)){var o=t._getPointInfo(n);t.dragging&&t._emitEvent("drag",n,o,t.draggingShape)}},this._onDocumentMouseUp=function(n){var i=t.canvas,a=i.get("el");if(a!==n.target&&t.dragging){var o=t._getPointInfo(n);t.draggingShape&&t._emitEvent("drop",n,o,null),t._emitEvent("dragend",n,o,t.draggingShape),t._afterDrag(t.draggingShape,o,n)}},this.canvas=e.canvas}return r.prototype.init=function(){this._bindEvents()},r.prototype._bindEvents=function(){var e=this,t=this.canvas.get("el");xe(uC,function(n){t.addEventListener(n,e._eventCallback)}),document&&(document.addEventListener("mousemove",this._onDocumentMove),document.addEventListener("mouseup",this._onDocumentMouseUp))},r.prototype._clearEvents=function(){var e=this,t=this.canvas.get("el");xe(uC,function(n){t.removeEventListener(n,e._eventCallback)}),document&&(document.removeEventListener("mousemove",this._onDocumentMove),document.removeEventListener("mouseup",this._onDocumentMouseUp))},r.prototype._getEventObj=function(e,t,n,i,a,o){var s=new pI(e,t);return s.fromShape=a,s.toShape=o,s.x=n.x,s.y=n.y,s.clientX=n.clientX,s.clientY=n.clientY,s.propagationPath.push(i),s},r.prototype._getShape=function(e,t){return this.canvas.getShape(e.x,e.y,t)},r.prototype._getPointInfo=function(e){var t=this.canvas,n=t.getClientByEvent(e),i=t.getPointByEvent(e);return{x:i.x,y:i.y,clientX:n.x,clientY:n.y}},r.prototype._triggerEvent=function(e,t){var n=this._getPointInfo(t),i=this._getShape(n,t),a=this["_on"+e],o=!1;if(a)a.call(this,n,i,t);else{var s=this.currentShape;e==="mouseenter"||e==="dragenter"||e==="mouseover"?(this._emitEvent(e,t,n,null,null,i),i&&this._emitEvent(e,t,n,i,null,i),e==="mouseenter"&&this.draggingShape&&this._emitEvent("dragenter",t,n,null)):e==="mouseleave"||e==="dragleave"||e==="mouseout"?(o=!0,s&&this._emitEvent(e,t,n,s,s,null),this._emitEvent(e,t,n,null,s,null),e==="mouseleave"&&this.draggingShape&&this._emitEvent("dragleave",t,n,null)):this._emitEvent(e,t,n,i,null,null)}if(o||(this.currentShape=i),i&&!i.get("destroyed")){var u=this.canvas,l=u.get("el");l.style.cursor=i.attr("cursor")||u.get("cursor")}},r.prototype._onmousedown=function(e,t,n){n.button===sC&&(this.mousedownShape=t,this.mousedownPoint=e,this.mousedownTimeStamp=n.timeStamp),this._emitEvent("mousedown",n,e,t,null,null)},r.prototype._emitMouseoverEvents=function(e,t,n,i){var a=this.canvas.get("el");n!==i&&(n&&(this._emitEvent("mouseout",e,t,n,n,i),this._emitEvent("mouseleave",e,t,n,n,i),(!i||i.get("destroyed"))&&(a.style.cursor=this.canvas.get("cursor"))),i&&(this._emitEvent("mouseover",e,t,i,n,i),this._emitEvent("mouseenter",e,t,i,n,i)))},r.prototype._emitDragoverEvents=function(e,t,n,i,a){i?(i!==n&&(n&&this._emitEvent("dragleave",e,t,n,n,i),this._emitEvent("dragenter",e,t,i,n,i)),a||this._emitEvent("dragover",e,t,i)):n&&this._emitEvent("dragleave",e,t,n,n,i),a&&this._emitEvent("dragover",e,t,i)},r.prototype._afterDrag=function(e,t,n){e&&(e.set("capture",!0),this.draggingShape=null),this.dragging=!1;var i=this._getShape(t,n);i!==e&&this._emitMouseoverEvents(n,t,e,i),this.currentShape=i},r.prototype._onmouseup=function(e,t,n){if(n.button===sC){var i=this.draggingShape;this.dragging?(i&&this._emitEvent("drop",n,e,t),this._emitEvent("dragend",n,e,i),this._afterDrag(i,e,n)):(this._emitEvent("mouseup",n,e,t),t===this.mousedownShape&&this._emitEvent("click",n,e,t),this.mousedownShape=null,this.mousedownPoint=null)}},r.prototype._ondragover=function(e,t,n){n.preventDefault();var i=this.currentShape;this._emitDragoverEvents(n,e,i,t,!0)},r.prototype._onmousemove=function(e,t,n){var i=this.canvas,a=this.currentShape,o=this.draggingShape;if(this.dragging)o&&this._emitDragoverEvents(n,e,a,t,!1),this._emitEvent("drag",n,e,o);else{var s=this.mousedownPoint;if(s){var u=this.mousedownShape,l=n.timeStamp,c=l-this.mousedownTimeStamp,f=s.clientX-e.clientX,d=s.clientY-e.clientY,h=f*f+d*d;c>120||h>JX?u&&u.get("draggable")?(o=this.mousedownShape,o.set("capture",!1),this.draggingShape=o,this.dragging=!0,this._emitEvent("dragstart",n,e,o),this.mousedownShape=null,this.mousedownPoint=null):!u&&i.get("draggable")?(this.dragging=!0,this._emitEvent("dragstart",n,e,null),this.mousedownShape=null,this.mousedownPoint=null):(this._emitMouseoverEvents(n,e,a,t),this._emitEvent("mousemove",n,e,t)):(this._emitMouseoverEvents(n,e,a,t),this._emitEvent("mousemove",n,e,t))}else this._emitMouseoverEvents(n,e,a,t),this._emitEvent("mousemove",n,e,t)}},r.prototype._emitEvent=function(e,t,n,i,a,o){var s=this._getEventObj(e,t,n,i,a,o);if(i){s.shape=i,lC(i,e,s);for(var u=i.getParent();u;)u.emitDelegation(e,s),s.propagationStopped||eY(u,e,s),s.propagationPath.push(u),u=u.getParent()}else{var l=this.canvas;lC(l,e,s)}},r.prototype.destroy=function(){this._clearEvents(),this.canvas=null,this.currentShape=null,this.draggingShape=null,this.mousedownPoint=null,this.mousedownShape=null,this.mousedownTimeStamp=null},r}(),cC="px",fC=_I(),rY=fC&&fC.name==="firefox",hC=function(r){Wt(e,r);function e(t){var n=r.call(this,t)||this;return n.initContainer(),n.initDom(),n.initEvents(),n.initTimeline(),n}return e.prototype.getDefaultCfg=function(){var t=r.prototype.getDefaultCfg.call(this);return t.cursor="default",t.supportCSSTransform=!1,t},e.prototype.initContainer=function(){var t=this.get("container");We(t)&&(t=document.getElementById(t),this.set("container",t))},e.prototype.initDom=function(){var t=this.createDom();this.set("el",t);var n=this.get("container");n.appendChild(t),this.setDOMSize(this.get("width"),this.get("height"))},e.prototype.initEvents=function(){var t=new tY({canvas:this});t.init(),this.set("eventController",t)},e.prototype.initTimeline=function(){var t=new QX(this);this.set("timeline",t)},e.prototype.setDOMSize=function(t,n){var i=this.get("el");yI&&(i.style.width=t+cC,i.style.height=n+cC)},e.prototype.changeSize=function(t,n){this.setDOMSize(t,n),this.set("width",t),this.set("height",n),this.onCanvasChange("changeSize")},e.prototype.getRenderer=function(){return this.get("renderer")},e.prototype.getCursor=function(){return this.get("cursor")},e.prototype.setCursor=function(t){this.set("cursor",t);var n=this.get("el");yI&&n&&(n.style.cursor=t)},e.prototype.getPointByEvent=function(t){var n=this.get("supportCSSTransform");if(n){if(rY&&!xt(t.layerX)&&t.layerX!==t.offsetX)return{x:t.layerX,y:t.layerY};if(!xt(t.offsetX))return{x:t.offsetX,y:t.offsetY}}var i=this.getClientByEvent(t),a=i.x,o=i.y;return this.getPointByClient(a,o)},e.prototype.getClientByEvent=function(t){var n=t;return t.touches&&(t.type==="touchend"?n=t.changedTouches[0]:n=t.touches[0]),{x:n.clientX,y:n.clientY}},e.prototype.getPointByClient=function(t,n){var i=this.get("el"),a=i.getBoundingClientRect();return{x:t-a.left,y:n-a.top}},e.prototype.getClientByPoint=function(t,n){var i=this.get("el"),a=i.getBoundingClientRect();return{x:t+a.left,y:n+a.top}},e.prototype.draw=function(){},e.prototype.removeDom=function(){var t=this.get("el");t.parentNode.removeChild(t)},e.prototype.clearEvents=function(){var t=this.get("eventController");t.destroy()},e.prototype.isCanvas=function(){return!0},e.prototype.getParent=function(){return null},e.prototype.destroy=function(){var t=this.get("timeline");this.get("destroyed")||(this.clear(),t&&t.stop(),this.clearEvents(),this.removeDom(),r.prototype.destroy.call(this))},e}(kI),dC=function(r){Wt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.isGroup=function(){return!0},e.prototype.isEntityGroup=function(){return!1},e.prototype.clone=function(){for(var t=r.prototype.clone.call(this),n=this.getChildren(),i=0;i<n.length;i++){var a=n[i];t.add(a.clone())}return t},e}(kI),vC=function(r){Wt(e,r);function e(t){return r.call(this,t)||this}return e.prototype._isInBBox=function(t,n){var i=this.getBBox();return i.minX<=t&&i.maxX>=t&&i.minY<=n&&i.maxY>=n},e.prototype.afterAttrsChange=function(t){r.prototype.afterAttrsChange.call(this,t),this.clearCacheBBox()},e.prototype.getBBox=function(){var t=this.cfg.bbox;return t||(t=this.calculateBBox(),this.set("bbox",t)),t},e.prototype.getCanvasBBox=function(){var t=this.cfg.canvasBBox;return t||(t=this.calculateCanvasBBox(),this.set("canvasBBox",t)),t},e.prototype.applyMatrix=function(t){r.prototype.applyMatrix.call(this,t),this.set("canvasBBox",null)},e.prototype.calculateCanvasBBox=function(){var t=this.getBBox(),n=this.getTotalMatrix(),i=t.minX,a=t.minY,o=t.maxX,s=t.maxY;if(n){var u=$u(n,[t.minX,t.minY]),l=$u(n,[t.maxX,t.minY]),c=$u(n,[t.minX,t.maxY]),f=$u(n,[t.maxX,t.maxY]);i=Math.min(u[0],l[0],c[0],f[0]),o=Math.max(u[0],l[0],c[0],f[0]),a=Math.min(u[1],l[1],c[1],f[1]),s=Math.max(u[1],l[1],c[1],f[1])}var d=this.attrs;if(d.shadowColor){var h=d.shadowBlur,v=h===void 0?0:h,p=d.shadowOffsetX,g=p===void 0?0:p,y=d.shadowOffsetY,m=y===void 0?0:y,b=i-v+g,w=o+v+g,x=a-v+m,_=s+v+m;i=Math.min(i,b),o=Math.max(o,w),a=Math.min(a,x),s=Math.max(s,_)}return{x:i,y:a,minX:i,minY:a,maxX:o,maxY:s,width:o-i,height:s-a}},e.prototype.clearCacheBBox=function(){this.set("bbox",null),this.set("canvasBBox",null)},e.prototype.isClipShape=function(){return this.get("isClipShape")},e.prototype.isInShape=function(t,n){return!1},e.prototype.isOnlyHitBox=function(){return!1},e.prototype.isHit=function(t,n){var i=this.get("startArrowShape"),a=this.get("endArrowShape"),o=[t,n,1];o=this.invertFromMatrix(o);var s=o[0],u=o[1],l=this._isInBBox(s,u);return this.isOnlyHitBox()?l:!!(l&&!this.isClipped(s,u)&&(this.isInShape(s,u)||i&&i.isHit(s,u)||a&&a.isHit(s,u)))},e}(TI),pC=new Map;function co(r,e){pC.set(r,e)}function gC(r){return pC.get(r)}function yC(r){var e=r.attr(),t=e.x,n=e.y,i=e.width,a=e.height;return{x:t,y:n,width:i,height:a}}function mC(r){var e=r.attr(),t=e.x,n=e.y,i=e.r;return{x:t-i,y:n-i,width:i*2,height:i*2}}function bC(r){return Math.min.apply(null,r)}function wC(r){return Math.max.apply(null,r)}function yi(r,e,t,n){var i=r-t,a=e-n;return Math.sqrt(i*i+a*a)}function Bp(r,e){return Math.abs(r-e)<.001}function hc(r,e){var t=bC(r),n=bC(e),i=wC(r),a=wC(e);return{x:t,y:n,width:i-t,height:a-n}}function Fp(r){return(r+Math.PI*2)%(Math.PI*2)}var ii={box:function(r,e,t,n){return hc([r,t],[e,n])},length:function(r,e,t,n){return yi(r,e,t,n)},pointAt:function(r,e,t,n,i){return{x:(1-i)*r+i*t,y:(1-i)*e+i*n}},pointDistance:function(r,e,t,n,i,a){var o=(t-r)*(i-r)+(n-e)*(a-e);if(o<0)return yi(r,e,i,a);var s=(t-r)*(t-r)+(n-e)*(n-e);return o>s?yi(t,n,i,a):this.pointToLine(r,e,t,n,i,a)},pointToLine:function(r,e,t,n,i,a){var o=[t-r,n-e];if(iT(o,[0,0]))return Math.sqrt((i-r)*(i-r)+(a-e)*(a-e));var s=[-o[1],o[0]];Fu(s,s);var u=[i-r,a-e];return Math.abs(nT(u,s))},tangentAngle:function(r,e,t,n){return Math.atan2(n-e,t-r)}},nY=1e-4;function xC(r,e,t,n,i,a){var o,s=1/0,u=[t,n],l=20;a&&a>200&&(l=a/10);for(var c=1/l,f=c/10,d=0;d<=l;d++){var h=d*c,v=[i.apply(null,r.concat([h])),i.apply(null,e.concat([h]))],p=yi(u[0],u[1],v[0],v[1]);p<s&&(o=h,s=p)}if(o===0)return{x:r[0],y:e[0]};if(o===1){var g=r.length;return{x:r[g-1],y:e[g-1]}}s=1/0;for(var d=0;d<32&&!(f<nY);d++){var y=o-f,m=o+f,v=[i.apply(null,r.concat([y])),i.apply(null,e.concat([y]))],p=yi(u[0],u[1],v[0],v[1]);if(y>=0&&p<s)o=y,s=p;else{var b=[i.apply(null,r.concat([m])),i.apply(null,e.concat([m]))],w=yi(u[0],u[1],b[0],b[1]);m<=1&&w<s?(o=m,s=w):f*=.5}}return{x:i.apply(null,r.concat([o])),y:i.apply(null,e.concat([o]))}}function iY(r,e){for(var t=0,n=r.length,i=0;i<n;i++){var a=r[i],o=e[i],s=r[(i+1)%n],u=e[(i+1)%n];t+=yi(a,o,s,u)}return t/2}function Ms(r,e,t,n){var i=1-n;return i*i*r+2*n*i*e+n*n*t}function _C(r,e,t){var n=r+t-2*e;if(Bp(n,0))return[.5];var i=(r-e)/n;return i<=1&&i>=0?[i]:[]}function SC(r,e,t,n){return 2*(1-n)*(e-r)+2*n*(t-e)}function EC(r,e,t,n,i,a,o){var s=Ms(r,t,i,o),u=Ms(e,n,a,o),l=ii.pointAt(r,e,t,n,o),c=ii.pointAt(t,n,i,a,o);return[[r,e,l.x,l.y,s,u],[s,u,c.x,c.y,i,a]]}function v1(r,e,t,n,i,a,o){if(o===0)return(yi(r,e,t,n)+yi(t,n,i,a)+yi(r,e,i,a))/2;var s=EC(r,e,t,n,i,a,.5),u=s[0],l=s[1];return u.push(o-1),l.push(o-1),v1.apply(null,u)+v1.apply(null,l)}var AC={box:function(r,e,t,n,i,a){var o=_C(r,t,i)[0],s=_C(e,n,a)[0],u=[r,i],l=[e,a];return o!==void 0&&u.push(Ms(r,t,i,o)),s!==void 0&&l.push(Ms(e,n,a,s)),hc(u,l)},length:function(r,e,t,n,i,a){return v1(r,e,t,n,i,a,3)},nearestPoint:function(r,e,t,n,i,a,o,s){return xC([r,t,i],[e,n,a],o,s,Ms)},pointDistance:function(r,e,t,n,i,a,o,s){var u=this.nearestPoint(r,e,t,n,i,a,o,s);return yi(u.x,u.y,o,s)},interpolationAt:Ms,pointAt:function(r,e,t,n,i,a,o){return{x:Ms(r,t,i,o),y:Ms(e,n,a,o)}},divide:function(r,e,t,n,i,a,o){return EC(r,e,t,n,i,a,o)},tangentAngle:function(r,e,t,n,i,a,o){var s=SC(r,t,i,o),u=SC(e,n,a,o),l=Math.atan2(u,s);return Fp(l)}};function ks(r,e,t,n,i){var a=1-i;return a*a*a*r+3*e*i*a*a+3*t*i*i*a+n*i*i*i}function TC(r,e,t,n,i){var a=1-i;return 3*(a*a*(e-r)+2*a*i*(t-e)+i*i*(n-t))}function p1(r,e,t,n){var i=-3*r+9*e-9*t+3*n,a=6*r-12*e+6*t,o=3*e-3*r,s=[],u,l,c;if(Bp(i,0))Bp(a,0)||(u=-o/a,u>=0&&u<=1&&s.push(u));else{var f=a*a-4*i*o;Bp(f,0)?s.push(-a/(2*i)):f>0&&(c=Math.sqrt(f),u=(-a+c)/(2*i),l=(-a-c)/(2*i),u>=0&&u<=1&&s.push(u),l>=0&&l<=1&&s.push(l))}return s}function IC(r,e,t,n,i,a,o,s,u){var l=ks(r,t,i,o,u),c=ks(e,n,a,s,u),f=ii.pointAt(r,e,t,n,u),d=ii.pointAt(t,n,i,a,u),h=ii.pointAt(i,a,o,s,u),v=ii.pointAt(f.x,f.y,d.x,d.y,u),p=ii.pointAt(d.x,d.y,h.x,h.y,u);return[[r,e,f.x,f.y,v.x,v.y,l,c],[l,c,p.x,p.y,h.x,h.y,o,s]]}function g1(r,e,t,n,i,a,o,s,u){if(u===0)return iY([r,t,i,o],[e,n,a,s]);var l=IC(r,e,t,n,i,a,o,s,.5),c=l[0],f=l[1];return c.push(u-1),f.push(u-1),g1.apply(null,c)+g1.apply(null,f)}var gh={extrema:p1,box:function(r,e,t,n,i,a,o,s){for(var u=[r,o],l=[e,s],c=p1(r,t,i,o),f=p1(e,n,a,s),d=0;d<c.length;d++)u.push(ks(r,t,i,o,c[d]));for(var d=0;d<f.length;d++)l.push(ks(e,n,a,s,f[d]));return hc(u,l)},length:function(r,e,t,n,i,a,o,s){return g1(r,e,t,n,i,a,o,s,3)},nearestPoint:function(r,e,t,n,i,a,o,s,u,l,c){return xC([r,t,i,o],[e,n,a,s],u,l,ks,c)},pointDistance:function(r,e,t,n,i,a,o,s,u,l,c){var f=this.nearestPoint(r,e,t,n,i,a,o,s,u,l,c);return yi(f.x,f.y,u,l)},interpolationAt:ks,pointAt:function(r,e,t,n,i,a,o,s,u){return{x:ks(r,t,i,o,u),y:ks(e,n,a,s,u)}},divide:function(r,e,t,n,i,a,o,s,u){return IC(r,e,t,n,i,a,o,s,u)},tangentAngle:function(r,e,t,n,i,a,o,s,u){var l=TC(r,t,i,o,u),c=TC(e,n,a,s,u);return Fp(Math.atan2(c,l))}};function CC(r,e){var t=Math.abs(r);return e>0?t:t*-1}var aY={box:function(r,e,t,n){return{x:r-t,y:e-n,width:t*2,height:n*2}},length:function(r,e,t,n){return Math.PI*(3*(t+n)-Math.sqrt((3*t+n)*(t+3*n)))},nearestPoint:function(r,e,t,n,i,a){var o=t,s=n;if(o===0||s===0)return{x:r,y:e};for(var u=i-r,l=a-e,c=Math.abs(u),f=Math.abs(l),d=o*o,h=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=(d-h)*Math.pow(Math.cos(v),3)/o,b=(h-d)*Math.pow(Math.sin(v),3)/s,w=p-m,x=g-b,_=c-m,A=f-b,I=Math.hypot(x,w),M=Math.hypot(A,_),S=I*Math.asin((w*A-x*_)/(I*M)),C=S/Math.sqrt(d+h-p*p-g*g);v+=C,v=Math.min(Math.PI/2,Math.max(0,v))}return{x:r+CC(p,u),y:e+CC(g,l)}},pointDistance:function(r,e,t,n,i,a){var o=this.nearestPoint(r,e,t,n,i,a);return yi(o.x,o.y,i,a)},pointAt:function(r,e,t,n,i){var a=2*Math.PI*i;return{x:r+t*Math.cos(a),y:e+n*Math.sin(a)}},tangentAngle:function(r,e,t,n,i){var a=2*Math.PI*i,o=Math.atan2(n*Math.cos(a),-t*Math.sin(a));return Fp(o)}};function oY(r,e,t,n,i,a,o,s){return-1*t*Math.cos(i)*Math.sin(s)-n*Math.sin(i)*Math.cos(s)}function sY(r,e,t,n,i,a,o,s){return-1*t*Math.sin(i)*Math.sin(s)+n*Math.cos(i)*Math.cos(s)}function uY(r,e,t){return Math.atan(-e/r*Math.tan(t))}function lY(r,e,t){return Math.atan(e/(r*Math.tan(t)))}function MC(r,e,t,n,i,a){return t*Math.cos(i)*Math.cos(a)-n*Math.sin(i)*Math.sin(a)+r}function kC(r,e,t,n,i,a){return t*Math.sin(i)*Math.cos(a)+n*Math.cos(i)*Math.sin(a)+e}function cY(r,e,t,n){var i=Math.atan2(n*r,t*e);return(i+Math.PI*2)%(Math.PI*2)}function DC(r,e,t){return{x:r*Math.cos(t),y:e*Math.sin(t)}}function LC(r,e,t){var n=Math.cos(t),i=Math.sin(t);return[r*n-e*i,r*i+e*n]}var fY={box:function(r,e,t,n,i,a,o){for(var s=uY(t,n,i),u=1/0,l=-1/0,c=[a,o],f=-Math.PI*2;f<=Math.PI*2;f+=Math.PI){var d=s+f;a<o?a<d&&d<o&&c.push(d):o<d&&d<a&&c.push(d)}for(var f=0;f<c.length;f++){var h=MC(r,e,t,n,i,c[f]);h<u&&(u=h),h>l&&(l=h)}for(var v=lY(t,n,i),p=1/0,g=-1/0,y=[a,o],f=-Math.PI*2;f<=Math.PI*2;f+=Math.PI){var m=v+f;a<o?a<m&&m<o&&y.push(m):o<m&&m<a&&y.push(m)}for(var f=0;f<y.length;f++){var b=kC(r,e,t,n,i,y[f]);b<p&&(p=b),b>g&&(g=b)}return{x:u,y:p,width:l-u,height:g-p}},length:function(r,e,t,n,i,a,o){},nearestPoint:function(r,e,t,n,i,a,o,s,u){var l=LC(s-r,u-e,-i),c=l[0],f=l[1],d=aY.nearestPoint(0,0,t,n,c,f),h=cY(t,n,d.x,d.y);h<a?d=DC(t,n,a):h>o&&(d=DC(t,n,o));var v=LC(d.x,d.y,i);return{x:v[0]+r,y:v[1]+e}},pointDistance:function(r,e,t,n,i,a,o,s,u){var l=this.nearestPoint(r,e,t,n,s,u);return yi(l.x,l.y,s,u)},pointAt:function(r,e,t,n,i,a,o,s){var u=(o-a)*s+a;return{x:MC(r,e,t,n,i,u),y:kC(r,e,t,n,i,u)}},tangentAngle:function(r,e,t,n,i,a,o,s){var u=(o-a)*s+a,l=oY(r,e,t,n,i,a,o,u),c=sY(r,e,t,n,i,a,o,u);return Fp(Math.atan2(c,l))}};function NC(r){for(var e=0,t=[],n=0;n<r.length-1;n++){var i=r[n],a=r[n+1],o=yi(i[0],i[1],a[0],a[1]),s={from:i,to:a,length:o};t.push(s),e+=o}return{segments:t,totalLength:e}}function hY(r){if(r.length<2)return 0;for(var e=0,t=0;t<r.length-1;t++){var n=r[t],i=r[t+1];e+=yi(n[0],n[1],i[0],i[1])}return e}function dY(r,e){if(e>1||e<0||r.length<2)return null;var t=NC(r),n=t.segments,i=t.totalLength;if(i===0)return{x:r[0][0],y:r[0][1]};for(var a=0,o=null,s=0;s<n.length;s++){var u=n[s],l=u.from,c=u.to,f=u.length/i;if(e>=a&&e<=a+f){var d=(e-a)/f;o=ii.pointAt(l[0],l[1],c[0],c[1],d);break}a+=f}return o}function vY(r,e){if(e>1||e<0||r.length<2)return 0;for(var t=NC(r),n=t.segments,i=t.totalLength,a=0,o=0,s=0;s<n.length;s++){var u=n[s],l=u.from,c=u.to,f=u.length/i;if(e>=a&&e<=a+f){o=Math.atan2(c[1]-l[1],c[0]-l[0]);break}a+=f}return o}function pY(r,e,t){for(var n=1/0,i=0;i<r.length-1;i++){var a=r[i],o=r[i+1],s=ii.pointDistance(a[0],a[1],o[0],o[1],e,t);s<n&&(n=s)}return n}var OC={box:function(r){for(var e=[],t=[],n=0;n<r.length;n++){var i=r[n];e.push(i[0]),t.push(i[1])}return hc(e,t)},length:function(r){return hY(r)},pointAt:function(r,e){return dY(r,e)},pointDistance:function(r,e,t){return pY(r,e,t)},tangentAngle:function(r,e){return vY(r,e)}};function PC(r,e){return!r||!e?r||e:{minX:Math.min(r.minX,e.minX),minY:Math.min(r.minY,e.minY),maxX:Math.max(r.maxX,e.maxX),maxY:Math.max(r.maxY,e.maxY)}}function y1(r,e){var t=r.get("startArrowShape"),n=r.get("endArrowShape"),i=null,a=null;return t&&(i=t.getCanvasBBox(),e=PC(e,i)),n&&(a=n.getCanvasBBox(),e=PC(e,a)),e}function gY(r){for(var e=r.attr(),t=e.points,n=[],i=[],a=0;a<t.length;a++){var o=t[a];n.push(o[0]),i.push(o[1])}var s=hc(n,i),u=s.x,l=s.y,c=s.width,f=s.height,d={minX:u,minY:l,maxX:u+c,maxY:l+f};return d=y1(r,d),{x:d.minX,y:d.minY,width:d.maxX-d.minX,height:d.maxY-d.minY}}function yY(r){for(var e=r.attr(),t=e.points,n=[],i=[],a=0;a<t.length;a++){var o=t[a];n.push(o[0]),i.push(o[1])}return hc(n,i)}var m1=null;function RC(){if(!m1){var r=document.createElement("canvas");r.width=1,r.height=1,m1=r.getContext("2d")}return m1}function BC(r,e,t){var n=1;if(We(r)&&(n=r.split(`
`).length),n>1){var i=mY(e,t);return e*n+i*(n-1)}return e}function mY(r,e){return e?e-r:r*.14}function bY(r,e){var t=RC(),n=0;if(xt(r)||r==="")return n;if(t.save(),t.font=e,We(r)&&r.includes(`
`)){var i=r.split(`
`);xe(i,function(a){var o=t.measureText(a).width;n<o&&(n=o)})}else n=t.measureText(r).width;return t.restore(),n}function FC(r){var e=r.fontSize,t=r.fontFamily,n=r.fontWeight,i=r.fontStyle,a=r.fontVariant;return[i,a,n,e+"px",t].join(" ").trim()}function wY(r){var e=r.attr(),t=e.x,n=e.y,i=e.text,a=e.fontSize,o=e.lineHeight,s=e.font;s||(s=FC(e));var u=bY(i,s),l;if(!u)l={x:t,y:n,width:0,height:0};else{var c=e.textAlign,f=e.textBaseline,d=BC(i,a,o),h={x:t,y:n-d};c&&(c==="end"||c==="right"?h.x-=u:c==="center"&&(h.x-=u/2)),f&&(f==="top"?h.y+=d:f==="middle"&&(h.y+=d/2)),l={x:h.x,y:h.y,width:u,height:d}}return l}var xY=/[MLHVQTCSAZ]([^MLHVQTCSAZ]*)/ig,_Y=/[^\s\,]+/ig;function SY(r){var e=r||[];if(Mt(e))return e;if(We(e))return e=e.match(xY),xe(e,function(t,n){if(t=t.match(_Y),t[0].length>1){var i=t[0].charAt(0);t.splice(1,0,t[0].substr(1)),t[0]=i}xe(t,function(a,o){isNaN(a)||(t[o]=+a)}),e[n]=t}),e}function EY(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return jf(n,t),ti(r,n,e)}function AY(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return Wf(n,t),ti(r,n,e)}function TY(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return Xf(n,t),ti(r,n,e)}function IY(r,e,t){return ti(r,t,e)}function Up(r,e){for(var t=r?[].concat(r):[1,0,0,0,1,0,0,0,1],n=0,i=e.length;n<i;n++){var a=e[n];switch(a[0]){case"t":EY(t,t,[a[1],a[2]]);break;case"s":TY(t,t,[a[1],a[2]]);break;case"r":AY(t,t,a[1]);break;case"m":IY(t,t,a[1]);break}}return t}function CY(r,e,t,n){var i=[],a=!!n,o,s,u,l,c,f,d;if(a){u=n[0],l=n[1];for(var h=0,v=r.length;h<v;h+=1){var p=r[h];u=Ru([0,0],u,p),l=Bu([0,0],l,p)}}for(var h=0,g=r.length;h<g;h+=1){var p=r[h];if(h===0&&!t)d=p;else if(h===g-1&&!t)f=p,i.push(d),i.push(f);else{var y=[h?h-1:g-1,h-1][t?0:1];o=r[y],s=r[t?(h+1)%g:h+1];var m=[0,0];m=Ib(m,s,o),m=Ii(m,m,e);var b=rT(p,o),w=rT(p,s),x=b+w;x!==0&&(b/=x,w/=x);var _=Ii([0,0],m,-b),A=Ii([0,0],m,w);f=li([0,0],p,_),c=li([0,0],p,A),c=Ru([0,0],c,Bu([0,0],s,p)),c=Bu([0,0],c,Ru([0,0],s,p)),_=Ib([0,0],c,p),_=Ii([0,0],_,-b/w),f=li([0,0],p,_),f=Ru([0,0],f,Bu([0,0],o,p)),f=Bu([0,0],f,Ru([0,0],o,p)),A=Ib([0,0],p,f),A=Ii([0,0],A,w/b),c=li([0,0],p,A),a&&(f=Bu([0,0],f,u),f=Ru([0,0],f,l),c=Bu([0,0],c,u),c=Ru([0,0],c,l)),i.push(d),i.push(f),d=c}}return t&&i.push(i.shift()),i}function UC(r,e,t){e===void 0&&(e=!1),t===void 0&&(t=[[0,0],[1,1]]);for(var n=!!e,i=[],a=0,o=r.length;a<o;a+=2)i.push([r[a],r[a+1]]);for(var s=CY(i,.4,n,t),u=i.length,l=[],c,f,d,a=0;a<u-1;a+=1)c=s[a*2],f=s[a*2+1],d=i[a+1],l.push(["C",c[0],c[1],f[0],f[1],d[0],d[1]]);return n&&(c=s[u],f=s[u+1],d=i[0],l.push(["C",c[0],c[1],f[0],f[1],d[0],d[1]])),l}var yh=`	
\v\f\r \xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029`,MY=new RegExp("([a-z])["+yh+",]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?["+yh+"]*,?["+yh+"]*)+)","ig"),kY=new RegExp("(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)["+yh+"]*,?["+yh+"]*","ig");function b1(r){if(!r)return null;if(Mt(r))return r;var e={a:7,c:6,o:2,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,u:3,z:0},t=[];return String(r).replace(MY,function(n,i,a){var o=[],s=i.toLowerCase();if(a.replace(kY,function(u,l){l&&o.push(+l)}),s==="m"&&o.length>2&&(t.push([i].concat(o.splice(0,2))),s="l",i=i==="m"?"l":"L"),s==="o"&&o.length===1&&t.push([i,o[0]]),s==="r")t.push([i].concat(o));else for(;o.length>=e[s]&&(t.push([i].concat(o.splice(0,e[s]))),!!e[s]););return""}),t}var DY=/[a-z]/;function GC(r,e){return[e[0]+(e[0]-r[0]),e[1]+(e[1]-r[1])]}function zC(r){var e=b1(r);if(!e||!e.length)return[["M",0,0]];for(var t=!1,n=0;n<e.length;n++){var i=e[n][0];if(DY.test(i)||["V","H","T","S"].indexOf(i)>=0){t=!0;break}}if(!t)return e;var a=[],o=0,s=0,u=0,l=0,c=0,f=e[0];(f[0]==="M"||f[0]==="m")&&(o=+f[1],s=+f[2],u=o,l=s,c++,a[0]=["M",o,s]);for(var n=c,d=e.length;n<d;n++){var h=e[n],v=a[n-1],p=[],i=h[0],g=i.toUpperCase();if(i!==g)switch(p[0]=g,g){case"A":p[1]=h[1],p[2]=h[2],p[3]=h[3],p[4]=h[4],p[5]=h[5],p[6]=+h[6]+o,p[7]=+h[7]+s;break;case"V":p[1]=+h[1]+s;break;case"H":p[1]=+h[1]+o;break;case"M":u=+h[1]+o,l=+h[2]+s,p[1]=u,p[2]=l;break;default:for(var y=1,m=h.length;y<m;y++)p[y]=+h[y]+(y%2?o:s)}else p=e[n];switch(g){case"Z":o=+u,s=+l;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=GC([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=GC([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],l=p[p.length-1];break;default:o=p[p.length-2],s=p[p.length-1]}a.push(p)}return a}function Gp(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function w1(r,e){return Gp(r)*Gp(e)?(r[0]*e[0]+r[1]*e[1])/(Gp(r)*Gp(e)):1}function $C(r,e){return(r[0]*e[1]<r[1]*e[0]?-1:1)*Math.acos(w1(r,e))}function x1(r,e){return r[0]===e[0]&&r[1]===e[1]}function LY(r,e){var t=e[1],n=e[2],i=np(ip(e[3]),Math.PI*2),a=e[4],o=e[5],s=r[0],u=r[1],l=e[6],c=e[7],f=Math.cos(i)*(s-l)/2+Math.sin(i)*(u-c)/2,d=-1*Math.sin(i)*(s-l)/2+Math.cos(i)*(u-c)/2,h=f*f/(t*t)+d*d/(n*n);h>1&&(t*=Math.sqrt(h),n*=Math.sqrt(h));var v=t*t*(d*d)+n*n*(f*f),p=v?Math.sqrt((t*t*(n*n)-v)/v):1;a===o&&(p*=-1),isNaN(p)&&(p=0);var g=n?p*t*d/n:0,y=t?p*-n*f/t:0,m=(s+l)/2+Math.cos(i)*g-Math.sin(i)*y,b=(u+c)/2+Math.sin(i)*g+Math.cos(i)*y,w=[(f-g)/t,(d-y)/n],x=[(-1*f-g)/t,(-1*d-y)/n],_=$C([1,0],w),A=$C(w,x);return w1(w,x)<=-1&&(A=Math.PI),w1(w,x)>=1&&(A=0),o===0&&A>0&&(A=A-2*Math.PI),o===1&&A<0&&(A=A+2*Math.PI),{cx:m,cy:b,rx:x1(r,[l,c])?0:t,ry:x1(r,[l,c])?0:n,startAngle:_,endAngle:_+A,xRotation:i,arcFlag:a,sweepFlag:o}}function VC(r,e){return[e[0]+(e[0]-r[0]),e[1]+(e[1]-r[1])]}function jC(r){r=SY(r);for(var e=[],t=null,n=null,i=null,a=0,o=r.length,s=0;s<o;s++){var u=r[s];n=r[s+1];var l=u[0],c={command:l,prePoint:t,params:u,startTangent:null,endTangent:null};switch(l){case"M":i=[u[1],u[2]],a=s;break;case"A":var f=LY(t,u);c.arcParams=f;break}if(l==="Z")t=i,n=r[a+1];else{var d=u.length;t=[u[d-2],u[d-1]]}n&&n[0]==="Z"&&(n=r[a],e[a]&&(e[a].prePoint=t)),c.currentPoint=t,e[a]&&x1(t,e[a].currentPoint)&&(e[a].prePoint=c.prePoint);var h=n?[n[n.length-2],n[n.length-1]]:null;c.nextPoint=h;var v=c.prePoint;if(["L","H","V"].includes(l))c.startTangent=[v[0]-t[0],v[1]-t[1]],c.endTangent=[t[0]-v[0],t[1]-v[1]];else if(l==="Q"){var p=[u[1],u[2]];c.startTangent=[v[0]-p[0],v[1]-p[1]],c.endTangent=[t[0]-p[0],t[1]-p[1]]}else if(l==="T"){var g=e[s-1],p=VC(g.currentPoint,v);g.command==="Q"?(c.command="Q",c.startTangent=[v[0]-p[0],v[1]-p[1]],c.endTangent=[t[0]-p[0],t[1]-p[1]]):(c.command="TL",c.startTangent=[v[0]-t[0],v[1]-t[1]],c.endTangent=[t[0]-v[0],t[1]-v[1]])}else if(l==="C"){var y=[u[1],u[2]],m=[u[3],u[4]];c.startTangent=[v[0]-y[0],v[1]-y[1]],c.endTangent=[t[0]-m[0],t[1]-m[1]],c.startTangent[0]===0&&c.startTangent[1]===0&&(c.startTangent=[y[0]-m[0],y[1]-m[1]]),c.endTangent[0]===0&&c.endTangent[1]===0&&(c.endTangent=[m[0]-y[0],m[1]-y[1]])}else if(l==="S"){var g=e[s-1],y=VC(g.currentPoint,v),m=[u[1],u[2]];g.command==="C"?(c.command="C",c.startTangent=[v[0]-y[0],v[1]-y[1]],c.endTangent=[t[0]-m[0],t[1]-m[1]]):(c.command="SQ",c.startTangent=[v[0]-m[0],v[1]-m[1]],c.endTangent=[t[0]-m[0],t[1]-m[1]])}else if(l==="A"){var b=.001,w=c.arcParams||{},x=w.cx,_=x===void 0?0:x,A=w.cy,I=A===void 0?0:A,M=w.rx,S=M===void 0?0:M,C=w.ry,T=C===void 0?0:C,k=w.sweepFlag,L=k===void 0?0:k,B=w.startAngle,ee=B===void 0?0:B,K=w.endAngle,z=K===void 0?0:K;L===0&&(b*=-1);var X=S*Math.cos(ee-b)+_,H=T*Math.sin(ee-b)+I;c.startTangent=[X-i[0],H-i[1]];var J=S*Math.cos(ee+z+b)+_,ne=T*Math.sin(ee+z-b)+I;c.endTangent=[v[0]-J,v[1]-ne]}e.push(c)}return e}function NY(r,e){for(var t=[],n=[],i=[],a=0;a<r.length;a++){var o=r[a],s=o.currentPoint,u=o.params,l=o.prePoint,c=void 0;switch(o.command){case"Q":c=AC.box(l[0],l[1],u[1],u[2],u[3],u[4]);break;case"C":c=gh.box(l[0],l[1],u[1],u[2],u[3],u[4],u[5],u[6]);break;case"A":var f=o.arcParams;c=fY.box(f.cx,f.cy,f.rx,f.ry,f.xRotation,f.startAngle,f.endAngle);break;default:t.push(s[0]),n.push(s[1]);break}c&&(o.box=c,t.push(c.x,c.x+c.width),n.push(c.y,c.y+c.height)),e&&(o.command==="L"||o.command==="M")&&o.prePoint&&o.nextPoint&&i.push(o)}t=t.filter(function(y){return!Number.isNaN(y)}),n=n.filter(function(y){return!Number.isNaN(y)});var d=fa(t),h=fa(n),v=ca(t),p=ca(n);if(i.length===0)return{x:d,y:h,width:v-d,height:p-h};for(var a=0;a<i.length;a++){var o=i[a],s=o.currentPoint,g=void 0;s[0]===d?(g=zp(o,e),d=d-g.xExtra):s[0]===v&&(g=zp(o,e),v=v+g.xExtra),s[1]===h?(g=zp(o,e),h=h-g.yExtra):s[1]===p&&(g=zp(o,e),p=p+g.yExtra)}return{x:d,y:h,width:v-d,height:p-h}}function zp(r,e){var t=r.prePoint,n=r.currentPoint,i=r.nextPoint,a=Math.pow(n[0]-t[0],2)+Math.pow(n[1]-t[1],2),o=Math.pow(n[0]-i[0],2)+Math.pow(n[1]-i[1],2),s=Math.pow(t[0]-i[0],2)+Math.pow(t[1]-i[1],2),u=Math.acos((a+o-s)/(2*Math.sqrt(a)*Math.sqrt(o)));if(!u||Math.sin(u)===0||PA(u,0))return{xExtra:0,yExtra:0};var l=Math.abs(Math.atan2(i[1]-n[1],i[0]-n[0])),c=Math.abs(Math.atan2(i[0]-n[0],i[1]-n[1]));l=l>Math.PI/2?Math.PI-l:l,c=c>Math.PI/2?Math.PI-c:c;var f={xExtra:Math.cos(u/2-l)*(e/2*(1/Math.sin(u/2)))-e/2||0,yExtra:Math.cos(c-u/2)*(e/2*(1/Math.sin(u/2)))-e/2||0};return f}function OY(r){var e=r.attr(),t=e.path,n=e.stroke,i=n?e.lineWidth:0,a=r.get("segments")||jC(t),o=NY(a,i),s=o.x,u=o.y,l=o.width,c=o.height,f={minX:s,minY:u,maxX:s+l,maxY:u+c};return f=y1(r,f),{x:f.minX,y:f.minY,width:f.maxX-f.minX,height:f.maxY-f.minY}}function PY(r){var e=r.attr(),t=e.x1,n=e.y1,i=e.x2,a=e.y2,o=Math.min(t,i),s=Math.max(t,i),u=Math.min(n,a),l=Math.max(n,a),c={minX:o,maxX:s,minY:u,maxY:l};return c=y1(r,c),{x:c.minX,y:c.minY,width:c.maxX-c.minX,height:c.maxY-c.minY}}function RY(r){var e=r.attr(),t=e.x,n=e.y,i=e.rx,a=e.ry;return{x:t-i,y:n-a,width:i*2,height:a*2}}co("rect",yC);co("image",yC);co("circle",mC);co("marker",mC);co("polyline",gY);co("polygon",yY);co("text",wY);co("path",OY);co("line",PY);co("ellipse",RY);var BY=function(r){Wt(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.item=n.item,i.canvasX=n.canvasX,i.canvasY=n.canvasY,i.wheelDelta=n.wheelDelta,i.detail=n.detail,i}return e}(pI),_1=function(e){return e+"-"+Math.random()+Date.now()},S1=function(e){var t=0,n=0,i=0,a=0;if(Ft(e))t=n=i=a=e;else if(We(e)){var o=parseInt(e,10);t=n=i=a=o}else Mt(e)&&(t=e[0],i=xt(e[1])?e[0]:e[1],a=xt(e[2])?e[0]:e[2],n=xt(e[3])?i:e[3]);return[t,i,a,n]},FY=function(e){var t=new BY(e.type,e);return t.clientX=e.clientX,t.clientY=e.clientY,t.x=e.x,t.y=e.y,t.target=e.target,t.currentTarget=e.currentTarget,t.bubbles=!0,t.item=e.item,t},UY=function(e){if(!e)return!1;for(var t=9,n=[1,0,0,0,1,0,0,0,1],i=0;i<t;i++)if(e[i]!==n[i])return!0;return!1},$p=function(e){return Number.isNaN(Number(e))},WC=function(e){for(var t=1/0,n=-1/0,i=1/0,a=-1/0,o=0;o<e.length;o++){var s=e[o],u=s.getBBox(),l=u.minX,c=u.minY,f=u.maxX,d=u.maxY;l<t&&(t=l),c<i&&(i=c),f>n&&(n=f),d>a&&(a=d)}var h=Math.floor(t),v=Math.floor(i),p=Math.ceil(n)-Math.floor(t),g=Math.ceil(a)-Math.floor(i);return{x:h,y:v,width:p,height:g,minX:t,minY:i,maxX:n,maxY:a}},GY=function(e,t,n,i,a){t===void 0&&(t=15),n===void 0&&(n="quadratic"),i===void 0&&(i=void 0),a===void 0&&(a=void 0);for(var o=e.length,s=t*2,u=["top","top-right","right","bottom-right","bottom","bottom-left","left","top-left"],l={},c=[],f={},d=0;d<o;d++){var h=e[d],v=h.source,p=h.target,g=v+"-"+p;if(!c[d]){l[g]||(l[g]=[]),c[d]=!0,l[g].push(h);for(var y=0;y<o;y++)if(d!==y){var m=e[y],b=m.source,w=m.target;c[y]||(v===w&&p===b?(l[g].push(m),c[y]=!0,f[b+"|"+w+"|"+(l[g].length-1)]=!0):v===b&&p===w&&(l[g].push(m),c[y]=!0))}}}for(var x in l)for(var _=l[x],A=_.length,I=0;I<A;I++){var M=_[I];if(M.source===M.target){a&&(M.type=a),M.loopCfg={position:u[I%8],dist:Math.floor(I/8)*20+50};continue}if(A===1&&i&&M.source!==M.target){M.type=i;continue}M.type=n;var S=(I%2==0?1:-1)*(f[M.source+"|"+M.target+"|"+I]?-1:1);A%2==1?M.curveOffset=S*Math.ceil(I/2)*s:M.curveOffset=S*(Math.floor(I/2)*s+t)}return e},zY=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",uniqueId:_1,formatPadding:S1,cloneEvent:FY,isViewportChanged:UY,isNaN:$p,calculationItemsBBox:WC,processParallelEdges:GY}),$Y=function(){function r(e){this.destroyed=!1,this.graph=e,this.destroyed=!1}return r.prototype.getViewCenter=function(){var e=this.getFormatPadding(),t=this.graph,n=this.graph.get("width"),i=t.get("height");return{x:(n-e[1]-e[3])/2+e[3],y:(i-e[0]-e[2])/2+e[0]}},r.prototype.fitCenter=function(){var e=this.graph,t=e.get("group");t.resetMatrix();var n=t.getCanvasBBox();if(!(n.width===0||n.height===0)){var i=this.getViewCenter(),a={x:n.x+n.width/2,y:n.y+n.height/2};e.translate(i.x-a.x,i.y-a.y)}},r.prototype.fitView=function(){var e=this.graph,t=this.getFormatPadding(),n=e.get("width"),i=e.get("height"),a=e.get("group");a.resetMatrix();var o=a.getCanvasBBox();if(!(o.width===0||o.height===0)){var s=this.getViewCenter(),u={x:o.x+o.width/2,y:o.y+o.height/2};e.translate(s.x-u.x,s.y-u.y);var l=(n-t[1]-t[3])/o.width,c=(i-t[0]-t[2])/o.height,f=l;l>c&&(f=c),e.zoom(f,s)||console.warn("zoom failed, ratio out of range, ratio: %f",f)}},r.prototype.getFormatPadding=function(){var e=this.graph.get("fitViewPadding");return S1(e)},r.prototype.focusPoint=function(e,t,n){var i=this,a=this.getViewCenter(),o=this.getPointByCanvas(a.x,a.y),s=this.graph.get("group").getMatrix();if(s||(s=[1,0,0,0,1,0,0,0,1]),t){var u=(o.x-e.x)*s[0],l=(o.y-e.y)*s[4],c=0,f=0,d=0,h=0;this.graph.get("canvas").animate(function(v){d=u*v,h=l*v,i.graph.translate(d-c,h-f),c=d,f=h},P({},n))}else this.graph.translate((o.x-e.x)*s[0],(o.y-e.y)*s[4])},r.prototype.getPointByCanvas=function(e,t){var n=this.graph.get("group").getMatrix();n||(n=[1,0,0,0,1,0,0,0,1]);var i=GT({x:e,y:t},n);return i},r.prototype.getPointByClient=function(e,t){var n=this.graph.get("canvas"),i=n.getPointByClient(e,t);return this.getPointByCanvas(i.x,i.y)},r.prototype.getClientByPoint=function(e,t){var n=this.graph.get("canvas"),i=this.getCanvasByPoint(e,t),a=n.getClientByPoint(i.x,i.y);return{x:a.x,y:a.y}},r.prototype.getCanvasByPoint=function(e,t){var n=this.graph.get("group").getMatrix();return n||(n=[1,0,0,0,1,0,0,0,1]),xp({x:e,y:t},n)},r.prototype.focus=function(e,t,n){if(We(e)&&(e=this.graph.findById(e)),e){var i=0,a=0;if(e.getType&&e.getType()==="edge"){var o=e.getSource().get("group").getMatrix(),s=e.getTarget().get("group").getMatrix();o&&s?(i=(o[6]+s[6])/2,a=(o[7]+s[7])/2):(o||s)&&(i=o?o[6]:s[6],a=o?o[7]:s[7])}else{var u=e.get("group"),l=u.getMatrix();l||(l=[1,0,0,0,1,0,0,0,1]),i=l[6],a=l[7]}this.focusPoint({x:i,y:a},t,n)}},r.prototype.changeSize=function(e,t){var n=this.graph;if(!Ft(e)||!Ft(t))throw Error("invalid canvas width & height, please make sure width & height type is number");n.set({width:e,height:t});var i=n.get("canvas");i.changeSize(e,t);var a=n.get("plugins");a.forEach(function(o){o.get("gridContainer")&&o.positionInit()})},r.prototype.destroy=function(){this.graph=null,this.destroyed=!1},r}();function Vp(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Vp=function(t){return typeof t}:Vp=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vp(r)}function XC(r){if(typeof r!="string")return r;var e=function(A){if(typeof A!="string")return A;try{return JSON.parse(A.trim())}catch{return A.trim()}},t=e(r);if(typeof t!="string")return t;for(var n=function(A){return A[A.length-1]},i=r.trim(),a=[],o=[],s=function(){for(var A=[],I=0;I<arguments.length;I++)A[I]=arguments[I];return A.some(function(M){return n(o)===M})},u=function(){return n(a)},l=null,c=0,f="";c<i.length;){var d=i[c],h=s('"',"'");if(!h&&!d.trim()){c+=1;continue}var v=i[c-1]==="\\",p=s("}"),g=s("]"),y=s(","),m=u();if(h)if(n(o)===d&&!v){o.pop();var b=e(f);m.push(b),l=b,f=""}else f+=d;else if(g&&d===",")f&&(m.push(e(f)),f="");else if(p&&d===":")o.push(","),f&&(m.push(f),f="");else if(y&&d===",")f&&(m.push(e(f)),f=""),o.pop();else if(d==="}"&&(p||y)){f&&(m.push(e(f)),f=""),y&&o.pop();for(var w={},x=1;x<m.length;x+=2)w[m[x-1]]=m[x];a.pop(),a.length&&n(a).push(w),o.pop(),l=w}else d==="]"&&g?(f&&(m.push(e(f)),f=""),a.pop(),a.length&&n(a).push(m),o.pop(),l=m):d==="{"?(a.push([]),o.push("}")):d==="["?(a.push([]),o.push("]")):d==='"'?o.push('"'):d==="'"?o.push("'"):f+=d;c+=1}return l||f}var VY=function(e){return e.split("-").reduce(function(t,n){return t+n.charAt(0).toUpperCase()+n.slice(1)})},jY=function(e){return function(t){for(var n=e.length,i=[],a=0,o="";a<n;)if(e[a]==="{"&&e[a+1]==="{")i.push(o),o="",a+=2;else if(e[a]==="}"&&e[a+1]==="}"){if(i.length){var s=i.pop();o=zo(t,o,s.endsWith("=")?'"{'+o+'}"':o),i.push(s+o)}a+=2,o=""}else o+=e[a],a+=1;return i.push(o),i.map(function(u,l){return i[l-1]&&i[l-1].endsWith("=")?'"{'+u+'}"':u}).join("")}};function YC(r,e){var t={},n=r.getAttributeNames&&r.getAttributeNames()||[],i=r.children&&Array.from(r.children).map(function(s){return YC(s,e)}),a={},o=r.tagName?r.tagName.toLowerCase():"group";return o==="text"&&(t.text=r.innerText),a.type=o,o==="img"&&(a.type="image"),Array.from(n).forEach(function(s){var u=VY(s),l=r.getAttribute(s);try{if(u==="style"||u==="attrs"){var c=XC(l);t=P(P({},t),c)}else a[u]=XC(l)}catch(f){if(u==="style")throw f;a[u]=l}}),a.attrs=t,e&&e.style&&a.name&&Vp(e.style[a.name])==="object"&&(a.attrs=P(P({},a.attrs),e.style[a.name])),e&&e.style&&a.keyshape&&(a.attrs=P(P({},a.attrs),e.style)),i.length&&(a.children=i),a}function WY(r,e,t){var n=r.attrs,i=n===void 0?{}:n,a={x:e.x||0,y:e.y||0,width:t.width||0,height:t.height||0},o,s;switch(r.type){case"maker":case"circle":i.r&&(s=2*i.r,o=2*i.r);break;case"text":i.text&&(s=nI(i.text,i.fontSize||12)[0],o=16,a.y+=o,a.height=o,a.width=s,r.attrs=P({fontSize:12,fill:"#000"},i));break;default:i.width&&(s=i.width),i.height&&(o=i.height)}return o>=0&&(a.height=o),s>=0&&(a.width=s),i.marginTop&&(a.y+=i.marginTop),i.marginLeft&&(a.x+=i.marginLeft),a}function HC(r,e){var t;e===void 0&&(e={x:0,y:0});var n=P({x:0,y:0,width:0,height:0},e);if((t=r.children)===null||t===void 0?void 0:t.length){var i=r.attrs,a=i===void 0?{}:i,o=a.marginTop,s=P({},e);o&&(s.y+=o);for(var u=0;u<r.children.length;u++){r.children[u].attrs.key=(a.key||"root")+" -"+u+" ";var l=HC(r.children[u],s);if(l.bbox){var c=l.bbox;l.attrs.next==="inline"?s.x+=l.bbox.width:s.y+=l.bbox.height,c.width+c.x>n.width&&(n.width=c.width+c.x),c.height+c.y>n.height&&(n.height=c.height+c.y)}}}return r.bbox=WY(r,e,n),r.attrs=P(P({},r.attrs),r.bbox),r}function qC(r,e){var t,n,i,a,o=(r||{}).type,s=((e==null?void 0:e.attrs)||{}).key;if(s&&r&&(r.attrs.key=s),!r&&e)return{action:"delete",val:e,type:o,key:s};if(r&&!e)return{action:"add",val:r,type:o};if(!r&&!e)return{action:"same",type:o};var u=[];if(((t=r.children)===null||t===void 0?void 0:t.length)>0||((n=e.children)===null||n===void 0?void 0:n.length)>0)for(var l=Math.max((i=r.children)===null||i===void 0?void 0:i.length,(a=e.children)===null||a===void 0?void 0:a.length),c=e.children||[],f=r.children||[],d=0;d<l;d+=1)u.push(qC(f[d],c[d]));var h=Object.keys(e.attrs),v=Object.keys(r.attrs);return e.type!==r.type?{action:"restructure",nowTarget:r,formerTarget:e,key:s,children:u}:h.filter(function(p){return p!=="children"}).some(function(p){return r.attrs[p]!==e.attrs[p]||!v.includes(p)})?{action:"change",val:r,children:u,type:o,key:s}:{action:"same",children:u,type:o,key:s}}function KC(r){var e={},t=function(i){var a=typeof r=="function"?r(i):r,o=jY(a)(i),s=document.createElement("div");s.innerHTML=o;var u=s.children[0],l=HC(YC(u,i));return s.remove(),l};return{draw:function(i,a){var o=t(i),s=a,u=function l(c){var f=c.attrs,d=f===void 0?{}:f,h=c.bbox,v=c.type,p=c.children,g=Ti(c,["attrs","bbox","type","children"]);if(c.type!=="group"){var y=a.addShape(c.type,P({attrs:d,origin:{bbox:h,type:v,children:p}},g));c.keyshape&&(s=y)}c.children&&c.children.forEach(function(m){return l(m)})};return u(o),e[i.id]=[o],s},update:function(i,a){e[i.id]||(e[i.id]=[]);var o=a.getContainer(),s=o.get("children"),u=t(i),l=e[i.id].pop(),c=qC(u,l),f=function v(p){var g;p.type!=="group"&&o.addShape(p.type,{attrs:p.attrs}),((g=p.children)===null||g===void 0?void 0:g.length)&&p.children.map(function(y){return v(y)})},d=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?void 0:g.length)&&p.children.map(function(m){return v(m)})},h=function v(p){var g=p.key;if(p.type!=="group"){var y=s.find(function(b){return b.attrs.key===g});switch(p.action){case"change":if(y){var m=p.val.keyshape?a.getOriginStyle():{};y.attr(P(P({},m),p.val.attrs))}break;case"add":f(p.val);break;case"delete":d(p.val);break;case"restructure":d(p.formerTarget),f(p.nowTarget);break}}p.children&&p.children.forEach(function(b){return v(b)})};h(c),e[i.id].push(u)},getAnchorPoints:function(){return[[0,.5],[1,.5],[.5,1],[.5,0]]}}}var E1={};function ZC(r){return E1[r]||(E1[r]=rc(r)),E1[r]}var XY={defaultShapeType:"defaultType",className:null,getShape:function(e){var t=this,n=t[e]||t[t.defaultShapeType]||t["simple-circle"];return n},draw:function(e,t,n){var i=this.getShape(e),a=i.draw(t,n);return i.afterDraw&&i.afterDraw(t,n,a),a},baseUpdate:function(e,t,n,i){var a=this.getShape(e);a.update&&a.update(t,n,i),a.afterUpdate&&a.afterUpdate(t,n)},setState:function(e,t,n,i){var a=this.getShape(e);a.setState(t,n,i)},shouldUpdate:function(e){var t=this.getShape(e);return!!t.update},getControlPoints:function(e,t){var n=this.getShape(e);return n.getControlPoints(t)},getAnchorPoints:function(e,t){var n=this.getShape(e);return n.getAnchorPoints(t)}},A1={options:{},draw:function(e,t){return this.drawShape(e,t)},drawShape:function(){},afterDraw:function(){},afterUpdate:function(){},setState:function(){},getControlPoints:function(e){return e.controlPoints},getAnchorPoints:function(e){var t=this.options.anchorPoints,n=e.anchorPoints||t;return n}},hn=function(){function r(){}return r.registerFactory=function(e,t){var n=ZC(e),i=XY,a=P(P({},i),t);return r[n]=a,a.className=n,a},r.getFactory=function(e){var t=ZC(e);return r[t]},r.registerNode=function(e,t,n){var i=r.Node,a;if(typeof t=="string"||typeof t=="function"){var o=KC(t);a=P(P({},i.getShape("single-node")),o)}else if(t.jsx){var s=t.jsx,o=KC(s);a=P(P(P({},i.getShape("single-node")),o),t)}else{i.getShape(n);var u=n?i.getShape(n):A1;a=P(P({},u),t)}return a.type=e,a.itemType="node",i[e]=a,a},r.registerEdge=function(e,t,n){var i=r.Edge,a=n?i.getShape(n):A1,o=P(P({},a),t);return o.type=e,o.itemType="edge",i[e]=o,o},r.registerCombo=function(e,t,n){var i=r.Combo,a=n?i.getShape(n):A1,o=P(P({},a),t);return o.type=e,o.itemType="combo",i[e]=o,o},r}();hn.registerFactory("node",{defaultShapeType:"circle"});hn.registerFactory("edge",{defaultShapeType:"line"});hn.registerFactory("combo",{defaultShapeType:"circle"});var T1="bboxCache",I1="bboxCanvasCache",QC=function(){function r(e){this._cfg={},this.destroyed=!1;var t={id:void 0,type:"item",model:{},group:void 0,animate:!1,visible:!0,locked:!1,event:!0,keyShape:void 0,states:[]};this._cfg=Object.assign(t,this.getDefaultCfg(),e);var n=this.get("model"),i=n.id,a=this.get("type");i||(i=_1(a),this.get("model").id=i),this.set("id",i);var o=e.group;o&&(o.set("item",this),o.set("id",i)),this.init(),this.draw();var s=n.shape||n.type||(a==="edge"?"line":"circle"),u=this.get("shapeFactory");if(u&&u[s]){var l=u[s].options;if(l&&l.stateStyles){var c=this.get("styles")||n.stateStyles;c=tn({},l.stateStyles,c),this.set("styles",c)}}}return r.prototype.calculateBBox=function(){var e=this.get("keyShape"),t=this.get("group"),n=Tp(e,t);return n.x=n.minX,n.y=n.minY,n.width=n.maxX-n.minX,n.height=n.maxY-n.minY,n.centerX=(n.minX+n.maxX)/2,n.centerY=(n.minY+n.maxY)/2,n},r.prototype.calculateCanvasBBox=function(){var e=this.get("keyShape"),t=this.get("group"),n=Tp(e,t);return n.x=n.minX,n.y=n.minY,n.width=n.maxX-n.minX,n.height=n.maxY-n.minY,n.centerX=(n.minX+n.maxX)/2,n.centerY=(n.minY+n.maxY)/2,n},r.prototype.drawInner=function(){var e=this,t=e.get("shapeFactory"),n=e.get("group"),i=e.get("model");n.clear();var a=i.visible;if(a!==void 0&&!a&&e.changeVisibility(a),!!t){e.updatePosition(i);var o=e.getShapeCfg(i),s=o.type,u=t.draw(s,o,n);u&&(e.set("keyShape",u),u.set("isKeyShape",!0),u.set("draggable",!0)),this.setOriginStyle(),this.set("currentShape",s),this.restoreStates(t,s)}},r.prototype.setOriginStyle=function(){var e=this.get("group"),t=e.get("children"),n=this.getKeyShape(),i=this,a=n.get("name");if(this.get("originStyle")){var s=this.getOriginStyle();a&&!s[a]&&(s[a]={});var u=this.getCurrentStatesStyle();xe(t,function(l){var c=l.get("name"),f=l.attr();if(c&&c!==a){var d=u[c];s[c]||(s[c]={}),d?Object.keys(f).forEach(function(p){var g=f[p];g!==d[p]&&(s[c][p]=g)}):s[c]=l.get("type")!=="image"?Ur(f):i.getShapeStyleByName(c)}else{var h=l.attr(),v={};Object.keys(u).forEach(function(p){var g=u[p];(!ei(g)||p===a)&&(v[p]=g)}),Object.keys(h).forEach(function(p){var g=h[p];v[p]!==g&&(a?s[a][p]=g:s[p]=g)})}}),s.path&&delete s.path,s.matrix&&delete s.matrix,s.x&&delete s.x,s.y&&delete s.y,s[a]&&(delete s[a].x,delete s[a].y,delete s[a].matrix,delete s[a].path),i.set("originStyle",s)}else{var o={};xe(t,function(l){var c=l.get("type"),f=l.get("name");if(f&&f!==a)o[f]=c!=="image"?Ur(l.attr()):i.getShapeStyleByName(f),o[f]&&c==="text"&&(delete o[f].x,delete o[f].y,delete o[f].matrix);else{var d=i.getShapeStyleByName();if(delete d.path,delete d.matrix,!a)Object.assign(o,d);else if(f)o[a]=d;else{var h=_1("shape");l.set("name",h),o[h]=c!=="image"?Ur(l.attr()):i.getShapeStyleByName(f)}}}),i.set("originStyle",o)}},r.prototype.restoreStates=function(e,t){var n=this,i=n.get("states");xe(i,function(a){e.setState(t,a,!0,n)})},r.prototype.init=function(){var e=hn.getFactory(this.get("type"));this.set("shapeFactory",e)},r.prototype.get=function(e){return this._cfg[e]},r.prototype.set=function(e,t){ei(e)?this._cfg=P(P({},this._cfg),e):this._cfg[e]=t},r.prototype.getDefaultCfg=function(){return{}},r.prototype.clearCache=function(){this.set(T1,null),this.set(I1,null)},r.prototype.beforeDraw=function(){},r.prototype.afterDraw=function(){},r.prototype.afterUpdate=function(){},r.prototype.draw=function(){this.beforeDraw(),this.drawInner(),this.afterDraw()},r.prototype.getShapeStyleByName=function(e){var t=this.get("group"),n;if(e?n=t.find(function(a){return a.get("name")===e}):n=this.getKeyShape(),n){var i={};return xe(n.attr(),function(a,o){(o!=="img"||We(a))&&(i[o]=a)}),i}return{}},r.prototype.getShapeCfg=function(e,t){var n=this.get("styles");if(n){var i=e;return i.style=P(P({},n),e.style),i}return e},r.prototype.getStateStyle=function(e){var t=this.get("styles"),n=t&&t[e];return n},r.prototype.getOriginStyle=function(){return this.get("originStyle")},r.prototype.getCurrentStatesStyle=function(){var e=this,t={},n=e.getStates();return!n||!n.length?this.getOriginStyle():(xe(e.getStates(),function(i){t=Object.assign(t,e.getStateStyle(i))}),t)},r.prototype.setState=function(e,t){var n=this.get("states"),i=this.get("shapeFactory"),a=e,o=e;We(t)&&(a=e+":"+t,o=e+":");var s=n;if(db(t)){var u=n.indexOf(o);if(t){if(u>-1)return;n.push(a)}else u>-1&&n.splice(u,1)}else if(We(t)){var l=n.filter(function(d){return d.includes(o)});l.length>0&&this.clearStates(l),s=s.filter(function(d){return!d.includes(o)}),s.push(a),this.set("states",s)}if(i){var c=this.get("model"),f=c.type;i.setState(f,e,t,this)}},r.prototype.clearStates=function(e){var t=this,n=t.getStates(),i=t.get("shapeFactory"),a=t.get("model"),o=a.type;e||(e=n),We(e)&&(e=[e]);var s=n.filter(function(u){return e.indexOf(u)===-1});t.set("states",s),e.forEach(function(u){i.setState(o,u,!1,t)})},r.prototype.getContainer=function(){return this.get("group")},r.prototype.getKeyShape=function(){return this.get("keyShape")},r.prototype.getModel=function(){return this.get("model")},r.prototype.getType=function(){return this.get("type")},r.prototype.getID=function(){return this.get("id")},r.prototype.isItem=function(){return!0},r.prototype.getStates=function(){return this.get("states")},r.prototype.hasState=function(e){var t=this.getStates();return t.indexOf(e)>=0},r.prototype.refresh=function(e){var t=this.get("model");this.updatePosition(t),this.updateShape(e),this.afterUpdate(),this.clearCache()},r.prototype.getUpdateType=function(e){},r.prototype.update=function(e,t){t===void 0&&(t=void 0);var n=this.get("model");if(t==="move")this.updatePosition(e);else{var i=n.visible,a=e.visible;i!==a&&a!==void 0&&this.changeVisibility(a);var o={x:n.x,y:n.y};e.x=isNaN(+e.x)?n.x:+e.x,e.y=isNaN(+e.y)?n.y:+e.y;var s=this.get("styles");if(e.stateStyles){var u=e.stateStyles;It(s,u),delete e.stateStyles}Object.assign(n,e),(o.x!==e.x||o.y!==e.y)&&this.updatePosition(e),this.updateShape()}this.afterUpdate(),this.clearCache()},r.prototype.updateShape=function(e){var t=this.get("shapeFactory"),n=this.get("model"),i=n.type;if(t.shouldUpdate(i)&&i===this.get("currentShape")){var a=this.getShapeCfg(n,e);t.baseUpdate(i,a,this,e),e!=="move"&&this.setOriginStyle()}else this.draw();this.restoreStates(t,i)},r.prototype.updatePosition=function(e){var t=this.get("model"),n=isNaN(+e.x)?+t.x:+e.x,i=isNaN(+e.y)?+t.y:+e.y,a=this.get("group");if(isNaN(n)||isNaN(i))return!1;t.x=n,t.y=i;var o=a.getMatrix();return o&&o[6]===n&&o[7]===i?!1:(a.resetMatrix(),zT(a,{x:n,y:i}),this.clearCache(),!0)},r.prototype.getBBox=function(){var e=this.get(T1);return e||(e=this.calculateBBox(),this.set(T1,e)),e},r.prototype.getCanvasBBox=function(){var e=this.get(I1);return e||(e=this.calculateCanvasBBox(),this.set(I1,e)),e},r.prototype.toFront=function(){var e=this.get("group");e.toFront()},r.prototype.toBack=function(){var e=this.get("group");e.toBack()},r.prototype.show=function(){this.changeVisibility(!0)},r.prototype.hide=function(){this.changeVisibility(!1)},r.prototype.changeVisibility=function(e){var t=this.get("group");e?t.show():t.hide(),this.set("visible",e)},r.prototype.isVisible=function(){return this.get("visible")},r.prototype.enableCapture=function(e){var t=this.get("group");t&&t.set("capture",e)},r.prototype.destroy=function(){if(!this.destroyed){var e=this.get("animate"),t=this.get("group");e&&t.stopAnimate(),this.clearCache(),t.remove(),this._cfg=null,this.destroyed=!0}},r}(),jp={source:"start",target:"end"},fo="Node",dc="Point",YY="Anchor",HY=function(r){Wt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultCfg=function(){return{type:"edge",sourceNode:null,targetNode:null,startPoint:null,endPoint:null,linkCenter:!1}},e.prototype.setEnd=function(t,n){var i=jp[t]+dc,a=t+fo,o=this.get(a);o&&!o.destroyed&&o.removeEdge(this),ei(n)?(this.set(i,n),this.set(a,null)):n&&(n.addEdge(this),this.set(a,n),this.set(i,null))},e.prototype.getLinkPoint=function(t,n,i){var a=jp[t]+dc,o=t+fo,s=this.get(a);if(!s){var u=this.get(o),l=t+YY,c=this.getPrePoint(t,i),f=n[l];xt(f)||(s=u.getLinkPointByAnchor(f)),s=s||u.getLinkPoint(c),xt(s.index)||this.set(t+"AnchorIndex",s.index)}return s},e.prototype.getPrePoint=function(t,n){if(n&&n.length){var i=t==="source"?0:n.length-1;return n[i]}var a=t==="source"?"target":"source";return this.getEndPoint(a)},e.prototype.getEndPoint=function(t){var n=t+fo,i=jp[t]+dc,a=this.get(n);return a?a.get("model"):this.get(i)},e.prototype.getControlPointsByCenter=function(t){var n=this.getEndPoint("source"),i=this.getEndPoint("target"),a=this.get("shapeFactory"),o=t.type;return a.getControlPoints(o,{startPoint:n,endPoint:i})},e.prototype.getEndCenter=function(t){var n=t+fo,i=jp[t]+dc,a=this.get(n);if(a){var o=a.getBBox();return{x:o.centerX,y:o.centerY}}return this.get(i)},e.prototype.init=function(){r.prototype.init.call(this),this.setSource(this.get("source")),this.setTarget(this.get("target"))},e.prototype.getShapeCfg=function(t,n){var i=this,a=i.get("linkCenter"),o=n==="move"?t:r.prototype.getShapeCfg.call(this,t);if(a)o.startPoint=i.getEndCenter("source"),o.endPoint=i.getEndCenter("target");else{var s=o.controlPoints||i.getControlPointsByCenter(o);o.startPoint=i.getLinkPoint("source",t,s),o.endPoint=i.getLinkPoint("target",t,s)}return o.sourceNode=i.get("sourceNode"),o.targetNode=i.get("targetNode"),o},e.prototype.getModel=function(){var t=this.get("model"),n=this.get("source"+fo),i=this.get("target"+fo);return n?delete t["source"+fo]:t.source=this.get("start"+dc),i?delete t["target"+fo]:t.target=this.get("end"+dc),!We(t.source)&&!ei(t.source)&&(t.source=t.source.getID()),!We(t.target)&&!ei(t.target)&&(t.target=t.target.getID()),t},e.prototype.setSource=function(t){this.setEnd("source",t),this.set("source",t)},e.prototype.setTarget=function(t){this.setEnd("target",t),this.set("target",t)},e.prototype.getSource=function(){return this.get("source")},e.prototype.getTarget=function(){return this.get("target")},e.prototype.updatePosition=function(){return!1},e.prototype.update=function(t,n){n===void 0&&(n=void 0);var i=this.get("model"),a=i.visible,o=t.visible;a!==o&&o!==void 0&&this.changeVisibility(o);var s=this.get("styles");if(t.stateStyles){var u=t.stateStyles;It(s,u),delete t.stateStyles}Object.assign(i,t),this.updateShape(n),this.afterUpdate(),this.clearCache()},e.prototype.destroy=function(){var t=this.get("source"+fo),n=this.get("target"+fo);t&&!t.destroyed&&t.removeEdge(this),n&&!n.destroyed&&n.removeEdge(this),r.prototype.destroy.call(this)},e}(QC),C1="anchorPointsCache",qY="bboxCache",JC=function(r){Wt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getNearestPoint=function(t,n){for(var i=0,a=t[0],o=_p(t[0],n),s=0;s<t.length;s++){var u=t[s],l=_p(u,n);l<o&&(a=u,o=l,i=s)}return a.anchorIndex=i,a},e.prototype.getDefaultCfg=function(){return{type:"node",edges:[]}},e.prototype.getEdges=function(){return this.get("edges")},e.prototype.getInEdges=function(){var t=this;return this.get("edges").filter(function(n){return n.get("target")===t})},e.prototype.getOutEdges=function(){var t=this;return this.get("edges").filter(function(n){return n.get("source")===t})},e.prototype.getNeighbors=function(t){var n=this,i=this.get("edges");if(t==="target"){var a=function(l){return l.getSource()===n};return i.filter(a).map(function(u){return u.getTarget()})}if(t==="source"){var o=function(l){return l.getTarget()===n};return i.filter(o).map(function(u){return u.getSource()})}var s=function(l){return l.getSource()===n?l.getTarget():l.getSource()};return i.map(s)},e.prototype.getLinkPointByAnchor=function(t){var n=this.getAnchorPoints();return n[t]},e.prototype.getLinkPoint=function(t){var n=this.get("keyShape"),i=n.get("type"),a=this.get("type"),o,s,u=this.getBBox();a==="combo"?(o=u.centerX||(u.maxX+u.minX)/2,s=u.centerY||(u.maxY+u.minY)/2):(o=u.centerX,s=u.centerY);var l=this.getAnchorPoints(),c;switch(i){case"circle":c=FT({x:o,y:s,r:u.width/2},t);break;case"ellipse":c=UT({x:o,y:s,rx:u.width/2,ry:u.height/2},t);break;default:c=BT(u,t)}var f=c;return l.length&&(f||(f=t),f=this.getNearestPoint(l,f)),f||(f={x:o,y:s}),f},e.prototype.getAnchorPoints=function(){var t=this.get(C1);if(!t){t=[];var n=this.get("shapeFactory"),i=this.getBBox(),a=this.get("model"),o=this.getShapeCfg(a),s=a.type,u=n.getAnchorPoints(s,o)||[];xe(u,function(l,c){var f={x:i.minX+l[0]*i.width,y:i.minY+l[1]*i.height,anchorIndex:c};t.push(f)}),this.set(C1,t)}return t},e.prototype.addEdge=function(t){this.get("edges").push(t)},e.prototype.lock=function(){this.set("locked",!0)},e.prototype.unlock=function(){this.set("locked",!1)},e.prototype.hasLocked=function(){return this.get("locked")},e.prototype.removeEdge=function(t){var n=this.getEdges(),i=n.indexOf(t);i>-1&&n.splice(i,1)},e.prototype.clearCache=function(){this.set(qY,null),this.set(C1,null)},e.prototype.getUpdateType=function(t){var n,i,a,o,s;if(!!t){var u=!xt(t.x),l=!xt(t.y),c=Object.keys(t);return c.length===1&&(u||l)||c.length===2&&u&&l?"move":Ft(t.x)||Ft(t.y)||t.type||t.anchorPoints||t.size||(t==null?void 0:t.style)&&(((n=t==null?void 0:t.style)===null||n===void 0?void 0:n.r)||((i=t==null?void 0:t.style)===null||i===void 0?void 0:i.width)||((a=t==null?void 0:t.style)===null||a===void 0?void 0:a.height)||((o=t==null?void 0:t.style)===null||o===void 0?void 0:o.rx)||((s=t==null?void 0:t.style)===null||s===void 0?void 0:s.ry))?"bbox":"style"}},e}(QC),eM="bboxCache",tM="bboxCanvasCache",M1="sizeCache",rM="anchorPointsCache",KY=function(r){Wt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultCfg=function(){return{type:"combo",nodes:[],edges:[],combos:[]}},e.prototype.getShapeCfg=function(t){var n=this.get("styles"),i=this.get("bbox");if(n&&i){var a=t,o={r:Math.hypot(i.height,i.width)/2||kt.defaultCombo.size[0]/2,width:i.width||kt.defaultCombo.size[0],height:i.height||kt.defaultCombo.size[1]};a.style=P(P(P({},n),t.style),o);var s=t.padding||kt.defaultCombo.padding;return Ft(s)?(o.r+=s,o.width+=s*2,o.height+=s*2):(o.r+=s[0],o.width+=s[1]+s[3]||s[1]*2,o.height+=s[0]+s[2]||s[0]*2),this.set(M1,o),a}return t},e.prototype.calculateCanvasBBox=function(){if(!this.destroyed){var t=this.get("keyShape"),n=this.get("group"),i=Tp(t,n);i.centerX=(i.minX+i.maxX)/2,i.centerY=(i.minY+i.maxY)/2;var a=this.get(M1),o=this.get(eM)||{},s=o.x,u=o.x;if(a){a.width=Math.max(a.width,i.width),a.height=Math.max(a.height,i.height);var l=t.get("type");l==="circle"?(i.width=a.r*2,i.height=a.r*2):(i.width=a.width,i.height=a.height),i.minX=i.centerX-i.width/2,i.minY=i.centerY-i.height/2,i.maxX=i.centerX+i.width/2,i.maxY=i.centerY+i.height/2}else i.width=i.maxX-i.minX,i.height=i.maxY-i.minY,i.centerX=(i.minX+i.maxX)/2,i.centerY=(i.minY+i.maxY)/2;return i.x=i.minX,i.y=i.minY,(i.x!==s||i.y!==u)&&this.set(rM,null),i}},e.prototype.getChildren=function(){var t=this;return{nodes:t.getNodes(),combos:t.getCombos()}},e.prototype.getNodes=function(){var t=this;return t.get("nodes")},e.prototype.getCombos=function(){var t=this;return t.get("combos")},e.prototype.addChild=function(t){var n=this,i=t.getType();switch(i){case"node":n.addNode(t);break;case"combo":n.addCombo(t);break;default:return console.warn("Only node or combo items are allowed to be added into a combo"),!1}return!0},e.prototype.addCombo=function(t){var n=this;return n.get("combos").push(t),!0},e.prototype.addNode=function(t){var n=this;return n.get("nodes").push(t),!0},e.prototype.removeChild=function(t){var n=this,i=t.getType();switch(i){case"node":n.removeNode(t);break;case"combo":n.removeCombo(t);break;default:return console.warn("Only node or combo items are allowed to be added into a combo"),!1}return!0},e.prototype.removeCombo=function(t){if(!!t){var n=this.getCombos(),i=n.indexOf(t);return i>-1?(n.splice(i,1),!0):!1}},e.prototype.removeNode=function(t){if(!!t){var n=this.getNodes(),i=n.indexOf(t);return i>-1?(n.splice(i,1),!0):!1}},e.prototype.getUpdateType=function(t){},e.prototype.getBBox=function(){this.set(tM,null);var t=this.calculateCanvasBBox();return t},e.prototype.clearCache=function(){this.set(eM,null),this.set(tM,null),this.set(rM,null)},e.prototype.destroy=function(){if(!this.destroyed){var t=this.get("animate"),n=this.get("group");t&&n.stopAnimate(),this.clearCache(),this.set(M1,null),this.set("bbox",null),n.remove(),this._cfg=null,this.destroyed=!0}},e}(JC),mh="node",Wp="edge",nM="vedge",bh="combo",ZY="default",iM="Mapper",jo="stateStyles",QY=function(){function r(e){var t=this;this.edgeToBeUpdateMap={},this.throttleRefresh=mb(function(n){var i,a=t.graph;if(!(!a||a.get("destroyed"))){var o=t.edgeToBeUpdateMap;!o||!((i=Object.keys(o))===null||i===void 0?void 0:i.length)||(Object.keys(o).forEach(function(s){var u=o[s].edge;!u||u.destroyed||u.refresh(o[s].updateType)}),t.edgeToBeUpdateMap={})}},16,{trailing:!0,leading:!0}),this.graph=e,this.destroyed=!1}return r.prototype.addItem=function(e,t){var n=this.graph,i=e===nM?Wp:e,a=n.get(i+"Group")||n.get("group"),o=rc(i),s=null,u=n.get(i+rc(jo))||{},l=n.get(ZY+o);t[jo]&&(u=t[jo]),l&&xe(l,function(m,b){gi(m)&&!Mt(m)?t[b]=tn({},m,t[b]):Mt(m)?t[b]=t[b]||Ur(l[b]):t[b]=t[b]||l[b]});var c=n.get(i+iM);if(c){var f=c(t);f[jo]&&(u=f[jo],delete f[jo]),xe(f,function(m,b){gi(m)&&!Mt(m)?t[b]=tn({},t[b],m):t[b]=f[b]||t[b]})}if(n.emit("beforeadditem",{type:e,model:t}),e===Wp||e===nM){var d=void 0,h=void 0;if(d=t.source,h=t.target,d&&We(d)&&(d=n.findById(d)),h&&We(h)&&(h=n.findById(h)),!d||!h){console.warn("The source or target node of edge "+t.id+" does not exist!");return}d.getType&&d.getType()==="combo"&&(t.isComboEdge=!0),h.getType&&h.getType()==="combo"&&(t.isComboEdge=!0),s=new HY({model:t,source:d,target:h,styles:u,linkCenter:n.get("linkCenter"),group:a.addGroup()})}else if(e===mh)s=new JC({model:t,styles:u,group:a.addGroup()});else if(e===bh){var v=t.children,p=ih(v,n);isNaN(p.x)?isNaN(t.x)&&(t.x=Math.random()*100):t.x=p.x,isNaN(p.y)?isNaN(t.y)&&(t.y=Math.random()*100):t.y=p.y;var g=a.addGroup();g.setZIndex(t.depth),s=new KY({model:t,styles:u,bbox:t.collapsed?ih([],n):p,group:g});var y=s.getModel();(v||[]).forEach(function(m){var b=n.findById(m.id);s.addChild(b),m.depth=y.depth+2}),t.collapsed&&setTimeout(function(){s.destroyed||n.collapseCombo(s)},0)}if(s)return n.get(e+"s").push(s),n.get("itemMap")[s.get("id")]=s,n.emit("afteradditem",{item:s,model:t}),s},r.prototype.updateItem=function(e,t){var n=this,i,a,o=this.graph;if(We(e)&&(e=o.findById(e)),!(!e||e.destroyed)){var s="";e.getType&&(s=e.getType());var u=o.get(s+iM),l=e.getModel(),c=e.getUpdateType(t);if(u){var f=tn({},l,t),d=u(f),h=tn({},l,d,t);d[jo]&&(e.set("styles",h[jo]),delete h[jo]),xe(h,function(x,_){t[_]=x})}else xe(t,function(x,_){l[_]&&gi(x)&&!Mt(x)&&(t[_]=P(P({},l[_]),t[_]))});if(o.emit("beforeupdateitem",{item:e,cfg:t}),s===Wp){if(t.source){var v=t.source;We(v)&&(v=o.findById(v)),e.setSource(v)}if(t.target){var p=t.target;We(p)&&(p=o.findById(p)),e.setTarget(p)}e.update(t)}if(s===mh||s===bh){e.update(t,c);var g=e.getEdges(),y=c==="bbox"||c==="move";if(s===mh)c==="move"?xe(g,function(x){n.edgeToBeUpdateMap[x.getID()]={edge:x,updateType:c},n.throttleRefresh()}):y&&xe(g,function(x){x.refresh()});else if(y&&s===bh){var m=e.get("shapeFactory"),b=l.type||"circle",w=l.animate===void 0||t.animate===void 0?(a=(i=m[b])===null||i===void 0?void 0:i.options)===null||a===void 0?void 0:a.animate:l.animate||t.animate;w?setTimeout(function(){if(!(!e||e.destroyed)){var x=e.getKeyShape();!x||x.destroyed||xe(g,function(_){_&&!_.destroyed&&_.refresh()})}},201):xe(g,function(x){x.refresh()})}}o.emit("afterupdateitem",{item:e,cfg:t})}},r.prototype.updateCombo=function(e,t){var n=this,i,a,o=this.graph;if(We(e)&&(e=o.findById(e)),!(!e||e.destroyed)){var s=e.getModel(),u=ih(s.collapsed?[]:t,o),l=s.collapsed?ih(t,o):u,c=l.x,f=l.y;e.set("bbox",u),e.update({x:c,y:f});var d=e.get("shapeFactory"),h=s.type||"circle",v=s.animate===void 0?(a=(i=d[h])===null||i===void 0?void 0:i.options)===null||a===void 0?void 0:a.animate:s.animate;v?setTimeout(function(){if(!(!e||e.destroyed)){var p=e.getKeyShape();!p||p.destroyed||(e.getShapeCfg(s),n.updateComboEdges(e))}},201):this.updateComboEdges(e)}},r.prototype.updateComboEdges=function(e){for(var t=e.getEdges()||[],n=0;n<t.length;n++){var i=t[n];if(i&&!i.destroyed){var a=i.get("shapeFactory"),o=i.getShapeCfg(i.getModel()),s=i.getContainer();s.clear();var u=a.draw(o.type,o,s);i.set("keyShape",u),u.set("isKeyShape",!0),u.set("draggable",!0),i.setOriginStyle()}}},r.prototype.collapseCombo=function(e){var t=this.graph;We(e)&&(e=t.findById(e));var n=e.getChildren();n.nodes.forEach(function(i){t.hideItem(i)}),n.combos.forEach(function(i){t.hideItem(i)})},r.prototype.expandCombo=function(e){var t=this.graph;We(e)&&(e=t.findById(e));var n=e.getChildren();n.nodes.forEach(function(i){t.showItem(i)}),n.combos.forEach(function(i){i.getModel().collapsed?i.show():t.showItem(i)})},r.prototype.removeItem=function(e){var t=this,n=this.graph;if(We(e)&&(e=n.findById(e)),!(!e||e.destroyed)){var i=Ur(e.getModel());n.emit("beforeremoveitem",{item:i});var a="";e.getType&&(a=e.getType());var o=n.get(a+"s"),s=o.indexOf(e);if(s>-1&&o.splice(s,1),a===Wp){var u=n.get("v"+a+"s"),l=u.indexOf(e);l>-1&&u.splice(l,1)}var c=e.get("id"),f=n.get("itemMap");delete f[c];var d=n.get("comboTrees"),h=e.get("id");if(a===mh){var v=e.getModel().comboId;if(d&&v){var p=d,g=!1;d.forEach(function(_){g||ea(_,function(A){if(A.id===h&&p){var I=p.indexOf(A);return p.splice(I,1),g=!0,!1}return p=A.children,!0})})}for(var y=e.getEdges(),m=y.length-1;m>=0;m--)n.removeItem(y[m],!1);v&&n.updateCombo(v)}else if(a===bh){var b=e.getModel().parentId,w,x=!1;(d||[]).forEach(function(A){x||ea(A,function(I){return I.id===h?(w=I,x=!0,!1):!0})}),w.removed=!0,w&&w.children&&w.children.forEach(function(A){t.removeItem(A.id)});for(var y=e.getEdges(),m=y.length;m>=0;m--)n.removeItem(y[m],!1);b&&n.updateCombo(b)}e.destroy(),n.emit("afterremoveitem",{item:i})}},r.prototype.setItemState=function(e,t,n){var i=this.graph,a=t;We(n)&&(a=t+":"+n),!(e.hasState(a)===n&&n||We(n)&&e.hasState(a))&&(i.emit("beforeitemstatechange",{item:e,state:a,enabled:n}),e.setState(t,n),i.autoPaint(),i.emit("afteritemstatechange",{item:e,state:a,enabled:n}))},r.prototype.priorityState=function(e,t){var n=this.graph,i=e;We(e)&&(i=n.findById(e)),this.setItemState(i,t,!1),this.setItemState(i,t,!0)},r.prototype.clearItemStates=function(e,t){var n=this.graph;We(e)&&(e=n.findById(e)),n.emit("beforeitemstatesclear",{item:e,states:t}),e.clearStates(t),n.emit("afteritemstatesclear",{item:e,states:t})},r.prototype.refreshItem=function(e){var t=this.graph;We(e)&&(e=t.findById(e)),t.emit("beforeitemrefresh",{item:e}),e.refresh(),t.emit("afteritemrefresh",{item:e})},r.prototype.addCombos=function(e,t){var n=this,i=this.graph;(e||[]).forEach(function(o){Ts(o,function(s){var u;return t.forEach(function(l){l.id===s.id&&(l.children=s.children,l.depth=s.depth,u=l)}),u&&n.addItem("combo",u),!0})});var a=i.get("comboGroup");a&&a.sort()},r.prototype.changeItemVisibility=function(e,t){var n=this,i=this.graph;if(We(e)&&(e=i.findById(e)),!e){console.warn("The item to be shown or hidden does not exist!");return}if(i.emit("beforeitemvisibilitychange",{item:e,visible:t}),e.changeVisibility(t),e.getType&&e.getType()===mh){var a=e.getEdges();xe(a,function(c){t&&!(c.get("source").isVisible()&&c.get("target").isVisible())||n.changeItemVisibility(c,t)})}else if(e.getType&&e.getType()===bh){var o=i.get("comboTrees"),s=e.get("id"),u=[],l=!1;(o||[]).forEach(function(f){l||!f.children||f.children.length===0||ea(f,function(d){return d.id===s?(u=d.children,l=!0,!1):!0})}),u&&(!t||t&&!e.getModel().collapsed)&&u.forEach(function(f){var d=i.findById(f.id);n.changeItemVisibility(d,t)});var a=e.getEdges();xe(a,function(f){t&&!(f.get("source").isVisible()&&f.get("target").isVisible())||n.changeItemVisibility(f,t)})}return i.emit("afteritemvisibilitychange",{item:e,visible:t}),e},r.prototype.destroy=function(){this.graph=null,this.destroyed=!0},r}(),ju=null,JY=function(){function r(e){this.graph=e,this.cachedStates={enabled:{},disabled:{}},this.destroyed=!1}return r.checkCache=function(e,t,n){if(!!n[t]){var i=n[t].indexOf(e);i>=0&&n[t].splice(i,1)}},r.cacheState=function(e,t,n){n[t]||(n[t]=[]),n[t].push(e)},r.prototype.updateState=function(e,t,n){var i=this,a=r.checkCache,o=r.cacheState;if(!e.destroyed){var s=this.cachedStates,u=s.enabled,l=s.disabled;n?(a(e,t,l),o(e,t,u)):(a(e,t,u),o(e,t,l)),ju&&clearTimeout(ju),ju=setTimeout(function(){ju=null,i.updateGraphStates()},16)}},r.prototype.updateStates=function(e,t,n){var i=this;We(t)?this.updateState(e,t,n):t.forEach(function(a){i.updateState(e,a,n)})},r.prototype.updateGraphStates=function(){var e=this.graph.get("states"),t=this.cachedStates;xe(t.disabled,function(n,i){e[i]&&(e[i]=e[i].filter(function(a){return n.indexOf(a)<0&&!n.destroyed}))}),xe(t.enabled,function(n,i){if(!e[i])e[i]=n;else{var a={};e[i].forEach(function(o){o.destroyed||(a[o.get("id")]=!0)}),n.forEach(function(o){if(!o.destroyed){var s=o.get("id");a[s]||(a[s]=!0,e[i].push(o))}})}}),this.graph.emit("graphstatechange",{states:e}),this.cachedStates={enabled:{},disabled:{}}},r.prototype.destroy=function(){this.graph=null,this.cachedStates=null,ju&&clearTimeout(ju),ju=null,this.destroyed=!0},r}(),eH=function(e,t){return!e||!t?e:e.replace(/\\?\{([^{}]+)\}/g,function(n,i){if(n.charAt(0)==="\\")return n.slice(1);var a=t[i];return a===0&&(a="0"),a||""})},aM=function(e){var t=[];if(e.length<2)throw new Error("point length must largn than 2, now it's "+e.length);for(var n=0,i=e;n<i.length;n++){var a=i[n],o=a.x,s=a.y;t.push(o),t.push(s)}var u=UC(t);return u.unshift(["M",e[0].x,e[0].y]),u},Xp=function(e,t,n,i){n===void 0&&(n=0),i===void 0&&(i=0);var a={x:(1-n)*e.x+n*t.x,y:(1-n)*e.y+n*t.y},o=[0,0];Fu(o,[t.x-e.x,t.y-e.y]),(!o||!o[0]&&!o[1])&&(o=[0,0]);var s=[-o[1]*i,o[0]*i];return a.x+=s[0],a.y+=s[1],a},tH=function(e,t){var n=e.length;if(!n)return"";for(var i="",a="",o=0;o<n;o++){var s=e[o];o===0?a="M{x} {y}":a="L{x} {y}",i+=eH(a,s)}return t&&(i+="Z"),i},k1=function(e){var t=[];return e.forEach(function(n){var i=n[0];if(i!=="A")for(var a=1;a<n.length;a=a+2)t.push([n[a],n[a+1]]);else{var o=n.length;t.push([n[o-2],n[o-1]])}}),t},D1=function(e){if(e.length<2)throw new Error("point length must largn than 2, now it's "+e.length);var t=e[0],n=e[1],i=e[e.length-1],a=e[e.length-2];e.unshift(i),e.unshift(a),e.push(t),e.push(n);for(var o=[],s=1;s<e.length-2;s+=1){var u=e[s-1].x,l=e[s-1].y,c=e[s].x,f=e[s].y,d=e[s+1].x,h=e[s+1].y,v=s!==e.length-2?e[s+2].x:d,p=s!==e.length-2?e[s+2].y:h,g=c+(d-u)/6,y=f+(h-l)/6,m=d-(v-c)/6,b=h-(p-f)/6;o.push(["C",g,y,m,b,d,h])}return o.unshift(["M",i.x,i.y]),o},oM=function(e,t){return Ii([0,0],Fu([0,0],e),t)},sM=function(e,t){var n=[e[1]-t[1],t[0]-e[0]],i=Math.sqrt(n[0]*n[0]+n[1]*n[1]);if(i===0)throw new Error("p0 should not be equal to p1");return[n[0]/i,n[1]/i]},uM=function(e,t){return[t[0]-e[0],t[1]-e[1]]};function L1(r,e){var t=function(f){var d=[f[0][0],f[0][1]-e],h=[f[0][0],f[0][1]+e];return"M "+d+" A "+e+","+e+",0,0,0,"+h+" A "+e+","+e+",0,0,0,"+d},n=function(f){var d=Ii([0,0],sM(f[0],f[1]),e),h=Ii([0,0],d,-1),v=li([0,0],f[0],d),p=li([0,0],f[1],d),g=li([0,0],f[1],h),y=li([0,0],f[0],h);return"M "+v+" L "+p+" A "+[e,e,"0,0,0",g].join(",")+" L "+y+" A "+[e,e,"0,0,0",v].join(",")};if(!r||r.length<1)return"";if(r.length===1)return t(r);if(r.length===2)return n(r);for(var i=new Array(r.length),a=0;a<i.length;++a){var o=a===0?r[r.length-1]:r[a-1],s=r[a],u=Ii([0,0],sM(o,s),e);i[a]=[li([0,0],o,u),li([0,0],s,u)]}var l="A "+[e,e,"0,0,0,"].join(",");return i=i.map(function(c,f){var d="";return f===0&&(d="M "+i[i.length-1][1]+" "),d+=l+c[0]+" L "+c[1],d}),i.join(" ")}function lM(r,e){var t=r.length,n=function(c){var f=[c[0][0],c[0][1]-e],d=[c[0][0],c[0][1]+e];return"M "+f+" A "+[e,e,"0,0,0",d].join(",")+" A "+[e,e,"0,0,0",f].join(",")},i=function(c){var f=uM(c[0],c[1]),d=oM(f,e),h=li([0,0],c[0],Ii([0,0],d,-1)),v=li([0,0],c[1],d),p=1.2*e,g=oM(Fu([0,0],f),p),y=Ii([0,0],g,-1),m=li([0,0],h,y),b=li([0,0],v,y),w=li([0,0],h,g);return"M "+h+" C "+[m,b,v].join(",")+" S "+[w,h].join(",")+" Z"};if(!r||t<1)return"";if(t===1)return n(r);if(t===2)return i(r);for(var a=r.map(function(l,c){var f=r[(c+1)%t];return{p:l,v:Fu([0,0],uM(l,f))}}),o=0;o<a.length;++o){var s=o>0?o-1:t-1,u=Fu([0,0],li([0,0],a[s].v,Ii([0,0],a[o].v,-1)));a[o].p=li([0,0],a[o].p,Ii([0,0],u,e))}return a.map(function(l){var c=l.p;return{x:c[0],y:c[1]}})}var rH=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",getSpline:aM,getControlPoint:Xp,pointsToPolygon:tH,pathToPoints:k1,getClosedSpline:D1,roundedHull:L1,paddedHull:lM}),cM=function(e,t,n){return(e.y-n.y)*(t.x-n.x)-(e.x-n.x)*(t.y-n.y)},fM=function(e){var t=e.map(function(s){return{x:s.getModel().x,y:s.getModel().y}});if(t.sort(function(s,u){return s.x===u.x?s.y-u.y:s.x-u.x}),t.length===1)return t;for(var n=[],i=0;i<t.length;i++){for(;n.length>=2&&cM(n[n.length-2],n[n.length-1],t[i])<=0;)n.pop();n.push(t[i])}for(var a=[],i=t.length-1;i>=0;i--){for(;a.length>=2&&cM(a[a.length-2],a[a.length-1],t[i])<=0;)a.pop();a.push(t[i])}a.pop(),n.pop();var o=n.concat(a);return o},nH={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 iH(r,e,t){var n=!1,i=function(u,l){return e.cells[u+l*e.width]},a=function(u,l){var c=0;return i(u-1,l-1)>=t&&(c+=1),i(u,l-1)>t&&(c+=2),i(u-1,l)>t&&(c+=4),i(u,l)>t&&(c+=8),c},o=function(u,l){for(var c=u,f=l,d,h,v=0;v<e.width*e.height;v++){if(d=c,h=f,r.findIndex(function(g){return g.x===c&&g.y===f})>-1){if(!(r[0].x!==c||r[0].y!==f))return!0}else r.push({x:c,y:f});var p=a(c,f);switch(p){case-1:return console.warn("Marched out of bounds"),!0;case 0:case 3:case 2:case 7:c++;break;case 12:case 14:case 4:c--;break;case 6:d===0&&(h===-1?c-=1:c+=1);break;case 1:case 13:case 5:f--;break;case 9:d===1&&(h===0?f-=1:f+=1);break;case 10:case 8:case 11:f++;break;default:return console.warn("Marching squares invalid state: "+p),!0}}};this.march=function(){for(var s=0;s<e.width&&!n;s+=1)for(var u=0;u<e.height&&!n;u+=1)i(s,u)>t&&a(s,u)!==15&&(n=o(s,u));return n}}var aH=function(e,t,n){var i=Math.ceil(e/n),a=Math.ceil(t/n),o=new Float32Array(Math.max(0,i*a)).fill(0);return{cells:o,width:i,height:a}},oH=function(e,t,n){var i=null,a=Number.POSITIVE_INFINITY;return t.forEach(function(o){var s={x:e.getModel().x,y:e.getModel().y},u={x:o.getModel().x,y:o.getModel().y},l=Sp(s,u),c=new zu(s.x,s.y,u.x,u.y),f=n.reduce(function(d,h){return Pb(h,c)>0?d+1:d},0);l*Math.pow(f+1,2)<a&&(i=o,a=l*Math.pow(f+1,2))}),i},hM=function(e,t){var n=Number.POSITIVE_INFINITY,i=null;return e.forEach(function(a){var o=Pb(a,t);o>=0&&o<n&&(i=a,n=o)}),i},sH=function(e,t,n,i){var a=[],o=[];o.push(e);for(var s=!0,u=0,l=function(h,v){var p=!1;return v.forEach(function(g){p||(Rb(h,{x:g.x1,y:g.y1})||Rb(h,{x:g.x2,y:g.y2}))&&(p=!0)}),p},c=function(h,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(nh(b,h.x,h.y))return!0}return!1};s&&u<n;){s=!1;for(var f=function(){var h=o.pop(),v=hM(t,h);if(v){var p=WT(v,h),g=p[0],y=p[1];if(y===2){var m=function(w){for(var x=i,_=dM(v,x,g,w),A=l(_,o)||l(_,a),I=c(_,t);!A&&I&&x>=1;)x/=1.5,_=dM(v,x,g,w),A=l(_,o)||l(_,a),I=c(_,t);_&&!A&&(!w||!I)&&(o.push(new zu(h.x1,h.y1,_.x,_.y)),o.push(new zu(_.x,_.y,h.x2,h.y2)),s=!0)};m(!0),s||m(!1)}}s||a.push(h),u+=1};!s&&o.length;)f()}for(;o.length;)a.push(o.pop());return a};function uH(r,e,t,n,i){var a=oH(r,t,e);if(a===null)return[];var o=function(f){for(var d=[];f.length>0;){var h=f.pop();if(f.length===0){d.push(h);break}var v=f.pop(),p=new zu(h.x1,h.y1,v.x2,v.y2),g=hM(e,p);g?(d.push(h),f.push(v)):f.push(p)}return d},s=new zu(r.getModel().x,r.getModel().y,a.getModel().x,a.getModel().y),u=sH(s,e,n,i),l=o(u);return l}var lH=function(e,t,n){var i=Object.assign(nH,n),a=XT(e.map(function(m){return{x:m.getModel().x,y:m.getModel().y}}));e=e.sort(function(m,b){return Sp({x:m.getModel().x,y:m.getModel().y},a)-Sp({x:b.getModel().x,y:b.getModel().y},a)});var o=[],s=[];e.forEach(function(m){var b=uH(m,t,o,i.maxRoutingIterations,i.morphBuffer);b.forEach(function(w){s.push(w)}),o.push(m)});for(var u=cH(e,s,i.nodeR0),l=aH(u.width,u.height,i.pixelGroupSize),c=[],f=[],d=0;d<i.maxMarchingIterations;d++)if(fH(e,t,s,u,l,i),c=[],f=[],!!new iH(c,l,i.threshold).march()){var h=c.map(function(m){return{x:Math.round(m.x*i.pixelGroupSize+u.minX),y:Math.round(m.y*i.pixelGroupSize+u.minY)}});if(h){var v=h.length;if(i.skip>1)for(v=Math.floor(h.length/i.skip);v<3&&i.skip>1;)i.skip-=1,v=Math.floor(h.length/i.skip);for(var p=0,g=0;g<v;g+=1,p+=i.skip)f.push({x:h[p].x,y:h[p].y})}var y=function(){for(var b=0,w=e;b<w.length;b++){var x=w[b],_=f.map(function(A){return[A.x,A.y]});if(!nh(_,x.getBBox().centerX,x.getBBox().centerY))return!1}return!0};if(f&&y())return f;if(i.threshold*=.9,d<=i.maxMarchingIterations*.5)i.memberInfluenceFactor*=1.2,i.edgeInfluenceFactor*=1.2;else if(i.nonMemberInfluenceFactor!==0&&t.length>0)i.nonMemberInfluenceFactor*=.8;else break}return f};function cH(r,e,t){var n={minX:Number.POSITIVE_INFINITY,minY:Number.POSITIVE_INFINITY,maxX:Number.NEGATIVE_INFINITY,maxY:Number.NEGATIVE_INFINITY,width:0,height:0,x:0,y:0},i=[];r.forEach(function(u){i.push(u.getBBox())}),e.forEach(function(u){i.push(u.getBBox())});for(var a=0,o=i;a<o.length;a++){var s=o[a];n.minX=(s.minX<n.minX?s.minX:n.minX)-t,n.minY=(s.minY<n.minY?s.minY:n.minY)-t,n.maxX=(s.maxX>n.maxX?s.maxX:n.maxX)+t,n.maxY=(s.maxY>n.maxY?s.maxY:n.maxY)+t}return n.width=n.maxX-n.minX,n.height=n.maxY-n.minY,n.x=n.minX,n.y=n.minY,n}function fH(r,e,t,n,i,a){function o(h,v){var p=Math.floor((h-v)/a.pixelGroupSize);return p<0?0:p}function s(h,v){return h*a.pixelGroupSize+v}var u=(a.nodeR0-a.nodeR1)*(a.nodeR0-a.nodeR1),l=(a.edgeR0-a.edgeR1)*(a.edgeR0-a.edgeR1),c=function(v,p){var g=Math.min(o(v.minX,p+n.minX),i.width),y=Math.min(o(v.minY,p+n.minY),i.height),m=Math.min(o(v.maxX,-p+n.minX),i.width),b=Math.min(o(v.maxY,-p+n.minY),i.height);return[g,y,m,b]},f=function(v,p){for(var g=v.getBBox(),y=c(g,a.nodeR1),m=y[0],b=y[1],w=y[2],x=y[3],_=b;_<x;_+=1)for(var A=m;A<w;A+=1)if(!(p<0&&i[A+_*i.width]<=0)){var I=s(A,n.minX),M=s(_,n.minY),S=HT({x:I,y:M},{x:g.minX,y:g.minY,width:g.width,height:g.height});if(S<Math.pow(a.nodeR1,2)){var C=Math.sqrt(S)-a.nodeR1;i.cells[A+_*i.width]+=p*C*C}}},d=function(v,p){for(var g=v.getBBox(),y=c(g,a.edgeR1),m=y[0],b=y[1],w=y[2],x=y[3],_=b;_<x;_+=1)for(var A=m;A<w;A+=1)if(!(p<0&&i.cells[A+_*i.width]<=0)){var I=s(A,n.minX),M=s(_,n.minY),S=YT({x:I,y:M},v);if(S<Math.pow(a.edgeR1,2)){var C=Math.sqrt(S)-a.edgeR1;i.cells[A+_*i.width]+=p*C*C}}};a.nodeInfluenceFactor&&r.forEach(function(h){f(h,a.nodeInfluenceFactor/u)}),a.edgeInfluenceFactor&&t.forEach(function(h){d(h,a.edgeInfluenceFactor/l)}),a.negativeNodeInfluenceFactor&&e.forEach(function(h){f(h,a.negativeNodeInfluenceFactor/u)})}function dM(r,e,t,n){var i=r.getBBox(),a=t[0],o=t[1],s=t[2],u=t[3],l={topLeft:{x:i.minX-e,y:i.minY-e},topRight:{x:i.maxX+e,y:i.minY-e},bottomLeft:{x:i.minX-e,y:i.maxY+e},bottomRight:{x:i.maxX+e,y:i.maxY+e}},c=i.height*i.width;function f(v,p){return i.width*((v.y-i.minY+(p.y-i.minY))*.5)}if(o){if(a)return n?l.topLeft:l.bottomRight;if(s)return n?l.bottomLeft:l.topRight;var d=f(o,u);return d<c*.5?o.y>u.y?n?l.topLeft:l.bottomRight:n?l.topRight:l.bottomLeft:o.y<u.y?n?l.bottomLeft:l.topRight:n?l.bottomRight:l.topLeft}if(u){if(a)return n?l.topRight:l.bottomLeft;if(s)return n?l.bottomRight:l.topLeft}var h=f(a,s);return h<c*.5?a.x>s.x?n?l.topLeft:l.bottomRight:n?l.bottomLeft:l.topRight:a.x<s.x?n?l.topRight:l.bottomLeft:n?l.bottomRight:l.topLeft}var hH=function(){function r(e,t){this.cfg=tn(this.getDefaultCfg(),t),this.graph=e,this.id=this.cfg.id,this.group=this.cfg.group,this.members=this.cfg.members.map(function(n){return We(n)?e.findById(n):n}),this.nonMembers=this.cfg.nonMembers.map(function(n){return We(n)?e.findById(n):n}),this.setPadding(),this.setType(),this.path=this.calcPath(this.members,this.nonMembers),this.render()}return r.prototype.getDefaultCfg=function(){return{id:"g6-hull",type:"round-convex",members:[],nonMembers:[],style:{fill:"lightblue",stroke:"blue",opacity:.2},padding:10}},r.prototype.setPadding=function(){var e=this.members.length&&this.members[0].getKeyShape().getCanvasBBox().width/2;this.padding=this.cfg.padding>0?this.cfg.padding+e:10+e,this.cfg.bubbleCfg={nodeR0:this.padding-e,nodeR1:this.padding-e,morphBuffer:this.padding-e}},r.prototype.setType=function(){this.type=this.cfg.type,this.members.length<3&&(this.type="round-convex"),this.type!=="round-convex"&&this.type!=="smooth-convex"&&this.type!=="bubble"&&(console.warn("The hull type should be either round-convex, smooth-convex or bubble, round-convex is used by default."),this.type="round-convex")},r.prototype.calcPath=function(e,t){var n,i,a;switch(this.type){case"round-convex":n=fM(e),a=L1(n.map(function(o){return[o.x,o.y]}),this.padding),i=b1(a);break;case"smooth-convex":n=fM(e),n.length===2?(a=L1(n.map(function(o){return[o.x,o.y]}),this.padding),i=b1(a)):n.length>2&&(a=lM(n.map(function(o){return[o.x,o.y]}),this.padding),i=D1(a));break;case"bubble":n=lH(e,t,this.cfg.bubbleCfg),i=n.length>=2&&D1(n);break}return i},r.prototype.render=function(){this.group.addShape("path",{attrs:P({path:this.path},this.cfg.style),id:this.id,name:this.cfg.id}),this.group.toBack()},r.prototype.addMember=function(e){if(!!e){We(e)&&(e=this.graph.findById(e)),this.members.push(e);var t=this.nonMembers.indexOf(e);return t>-1&&this.nonMembers.splice(t,1),this.updateData(this.members,this.nonMembers),!0}},r.prototype.addNonMember=function(e){if(!!e){We(e)&&(e=this.graph.findById(e)),this.nonMembers.push(e);var t=this.members.indexOf(e);return t>-1&&this.members.splice(t,1),this.updateData(this.members,this.nonMembers),!0}},r.prototype.removeMember=function(e){if(!!e){We(e)&&(e=this.graph.findById(e));var t=this.members.indexOf(e);return t>-1?(this.members.splice(t,1),this.updateData(this.members,this.nonMembers),!0):!1}},r.prototype.removeNonMember=function(e){if(!!e){We(e)&&(e=this.graph.findById(e));var t=this.nonMembers.indexOf(e);return t>-1?(this.nonMembers.splice(t,1),this.updateData(this.members,this.nonMembers),!0):!1}},r.prototype.updateData=function(e,t){var n=this;this.group.findById(this.id).remove(),e&&(this.members=e.map(function(i){return We(i)?n.graph.findById(i):i})),t&&(this.nonMembers=t.map(function(i){return We(i)?n.graph.findById(i):i})),this.path=this.calcPath(this.members,this.nonMembers),this.render()},r.prototype.updateStyle=function(e){var t=this.group.findById(this.id);t.attr(P({},e))},r.prototype.updateCfg=function(e){var t=this;this.cfg=tn(this.cfg,e),this.id=this.cfg.id,this.group=this.cfg.group,e.members&&(this.members=this.cfg.members.map(function(n){return We(n)?t.graph.findById(n):n})),e.nonMembers&&(this.nonMembers=this.cfg.nonMembers.map(function(n){return We(n)?t.graph.findById(n):n})),this.setPadding(),this.setType(),this.path=this.calcPath(this.members,this.nonMembers),this.render()},r.prototype.contain=function(e){var t=this,n;We(e)?n=this.graph.findById(e):n=e;var i,a=n.getKeyShape();if(n.get("type")==="path")i=k1(a.attr("path"));else{var o=a.getCanvasBBox();i=[[o.minX,o.minY],[o.maxX,o.minY],[o.maxX,o.maxY],[o.minX,o.maxY]]}return i=i.map(function(s){var u=t.graph.getPointByCanvas(s[0],s[1]);return[u.x,u.y]}),jT(i,k1(this.path))},r.prototype.destroy=function(){this.group.remove(),this.cfg=null},r}(),N1=hp,dH="node",vH=function(r){Wt(e,r);function e(t){var n=r.call(this)||this;return n.cfg=tn(n.getDefaultCfg(),t),n.init(),n.animating=!1,n.destroyed=!1,n.cfg.enabledStack&&(n.undoStack=new mp(n.cfg.maxStep),n.redoStack=new mp(n.cfg.maxStep)),n}return e.prototype.init=function(){this.initCanvas();var t=new $Y(this),n=new o9(this),i=new QY(this),a=new JY(this);this.set({viewController:t,modeController:n,itemController:i,stateController:a}),this.initLayoutController(),this.initEventController(),this.initGroups(),this.initPlugins()},e.prototype.initGroups=function(){var t=this.get("canvas"),n=t==null?void 0:t.get("el"),i=n.id,a=t.addGroup({id:i+"-root",className:kt.rootContainerClassName});if(this.get("groupByTypes")){var o=a.addGroup({id:i+"-edge",className:kt.edgeContainerClassName}),s=a.addGroup({id:i+"-node",className:kt.nodeContainerClassName}),u=a.addGroup({id:i+"-combo",className:kt.comboContainerClassName});u.toBack(),this.set({nodeGroup:s,edgeGroup:o,comboGroup:u})}var l=a.addGroup({id:i+"-delegate",className:kt.delegateContainerClassName});this.set({delegateGroup:l}),this.set("group",a)},e.prototype.getDefaultCfg=function(){return{container:void 0,width:void 0,height:void 0,renderer:"canvas",modes:{},plugins:[],data:{},fitViewPadding:10,minZoom:.2,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:[]}},e.prototype.set=function(t,n){return ei(t)?this.cfg=P(P({},this.cfg),t):this.cfg[t]=n,this},e.prototype.get=function(t){var n;return(n=this.cfg)===null||n===void 0?void 0:n[t]},e.prototype.getGroup=function(){return this.get("group")},e.prototype.getContainer=function(){return this.get("container")},e.prototype.getMinZoom=function(){return this.get("minZoom")},e.prototype.setMinZoom=function(t){return this.set("minZoom",t)},e.prototype.getMaxZoom=function(){return this.get("maxZoom")},e.prototype.setMaxZoom=function(t){return this.set("maxZoom",t)},e.prototype.getWidth=function(){return this.get("width")},e.prototype.getHeight=function(){return this.get("height")},e.prototype.clearItemStates=function(t,n){We(t)&&(t=this.findById(t));var i=this.get("itemController");n||(n=t.get("states")),i.clearItemStates(t,n);var a=this.get("stateController");a.updateStates(t,n,!1)},e.prototype.node=function(t){typeof t=="function"&&this.set("nodeMapper",t)},e.prototype.edge=function(t){typeof t=="function"&&this.set("edgeMapper",t)},e.prototype.combo=function(t){typeof t=="function"&&this.set("comboMapper",t)},e.prototype.findById=function(t){return this.get("itemMap")[t]},e.prototype.find=function(t,n){var i,a=this.get(t+"s");return xe(a,function(o,s){if(n(o,s))return i=o,i}),i},e.prototype.findAll=function(t,n){var i=[];return xe(this.get(t+"s"),function(a,o){n(a,o)&&i.push(a)}),i},e.prototype.findAllByState=function(t,n){return this.findAll(t,function(i){return i.hasState(n)})},e.prototype.translate=function(t,n){var i=this.get("group"),a=Ur(i.getMatrix());a||(a=[1,0,0,0,1,0,0,0,1]),a=N1(a,[["t",t,n]]),i.setMatrix(a),this.emit("viewportchange",{action:"translate",matrix:i.getMatrix()}),this.autoPaint()},e.prototype.moveTo=function(t,n,i,a){var o=this.get("group");$T(o,{x:t,y:n},i,a||{duration:500,easing:"easeCubic"}),this.emit("viewportchange",{action:"move",matrix:o.getMatrix()})},e.prototype.fitView=function(t){t&&this.set("fitViewPadding",t);var n=this.get("viewController");n.fitView(),this.autoPaint()},e.prototype.fitCenter=function(){var t=this.get("viewController");t.fitCenter(),this.autoPaint()},e.prototype.addBehaviors=function(t,n){var i=this.get("modeController");return i.manipulateBehaviors(t,n,!0),this},e.prototype.removeBehaviors=function(t,n){var i=this.get("modeController");return i.manipulateBehaviors(t,n,!1),this},e.prototype.updateBehavior=function(t,n,i){var a=this.get("modeController");return a.updateBehavior(t,n,i),this},e.prototype.zoom=function(t,n){var i=this.get("group"),a=Ur(i.getMatrix()),o=this.get("minZoom"),s=this.get("maxZoom");return a||(a=[1,0,0,0,1,0,0,0,1]),n?a=N1(a,[["t",-n.x,-n.y],["s",t,t],["t",n.x,n.y]]):a=N1(a,[["s",t,t]]),o&&a[0]<o||s&&a[0]>s?!1:(i.setMatrix(a),this.emit("viewportchange",{action:"zoom",matrix:a}),this.autoPaint(),!0)},e.prototype.zoomTo=function(t,n){var i=t/this.getZoom();return this.zoom(i,n)},e.prototype.focusItem=function(t,n,i){var a=this.get("viewController"),o=!1;n?o=!0:n===void 0&&(o=this.get("animate"));var s={};i?s=i:i===void 0&&(s=this.get("animateCfg")),a.focus(t,o,s),this.autoPaint()},e.prototype.autoPaint=function(){this.get("autoPaint")&&this.paint()},e.prototype.paint=function(){this.emit("beforepaint"),this.get("canvas").draw(),this.emit("afterpaint")},e.prototype.getPointByClient=function(t,n){var i=this.get("viewController");return i.getPointByClient(t,n)},e.prototype.getClientByPoint=function(t,n){var i=this.get("viewController");return i.getClientByPoint(t,n)},e.prototype.getPointByCanvas=function(t,n){var i=this.get("viewController");return i.getPointByCanvas(t,n)},e.prototype.getCanvasByPoint=function(t,n){var i=this.get("viewController");return i.getCanvasByPoint(t,n)},e.prototype.getGraphCenterPoint=function(){var t=this.get("group").getCanvasBBox();return{x:(t.minX+t.maxX)/2,y:(t.minY+t.maxY)/2}},e.prototype.getViewPortCenterPoint=function(){return this.getPointByCanvas(this.get("width")/2,this.get("height")/2)},e.prototype.showItem=function(t,n){n===void 0&&(n=!0);var i=this.get("itemController"),a=i.changeItemVisibility(t,!0);if(n&&this.get("enabledStack")){var o=a.getID(),s=a.getType(),u={},l={};switch(s){case"node":u.nodes=[{id:o,visible:!1}],l.nodes=[{id:o,visible:!0}];break;case"edge":u.nodes=[{id:o,visible:!1}],l.edges=[{id:o,visible:!0}];break;case"combo":u.nodes=[{id:o,visible:!1}],l.combos=[{id:o,visible:!0}];break}this.pushStack("visible",{before:u,after:l})}},e.prototype.hideItem=function(t,n){n===void 0&&(n=!0);var i=this.get("itemController"),a=i.changeItemVisibility(t,!1);if(n&&this.get("enabledStack")){var o=a.getID(),s=a.getType(),u={},l={};switch(s){case"node":u.nodes=[{id:o,visible:!0}],l.nodes=[{id:o,visible:!1}];break;case"edge":u.nodes=[{id:o,visible:!0}],l.edges=[{id:o,visible:!1}];break;case"combo":u.nodes=[{id:o,visible:!0}],l.combos=[{id:o,visible:!1}];break}this.pushStack("visible",{before:u,after:l})}},e.prototype.refreshItem=function(t){var n=this.get("itemController");n.refreshItem(t)},e.prototype.setAutoPaint=function(t){var n=this;n.set("autoPaint",t);var i=n.get("canvas");i.set("autoDraw",t)},e.prototype.remove=function(t,n){n===void 0&&(n=!0),this.removeItem(t,n)},e.prototype.removeItem=function(t,n){n===void 0&&(n=!0);var i=t;if(We(t)&&(i=this.findById(t)),!i&&We(t))console.warn("The item to be removed does not exist!");else if(i){var a="";if(i.getType&&(a=i.getType()),n&&this.get("enabledStack")){var o=P(P({},i.getModel()),{itemType:a}),s={};switch(a){case"node":{s.nodes=[o],s.edges=[];for(var u=i.getEdges(),l=u.length-1;l>=0;l--)s.edges.push(P(P({},u[l].getModel()),{itemType:"edge"}));break}case"edge":s.edges=[o];break;case"combo":s.combos=[o];break}this.pushStack("delete",{before:s,after:{}})}if(a==="node"){var c=i.getModel();c.comboId&&this.updateComboTree(i,void 0,!1)}var f=this.get("itemController");if(f.removeItem(i),a==="combo"){var d=$b(this.get("comboTrees"));this.set("comboTrees",d)}}},e.prototype.addItem=function(t,n,i,a){i===void 0&&(i=!0),a===void 0&&(a=!0);var o=this.get("comboSorted");this.set("comboSorted",o&&!a);var s=this.get("itemController");if(!a9(t,n))return!1;if(n.id&&this.findById(n.id)){console.warn("This item exists already. Be sure the id %c"+n.id+"%c is unique.","font-size: 20px; color: red;","");return}var u,l=this.get("comboTrees");if(l||(l=[]),t==="combo"){var c=this.get("itemMap"),f=!1;if(l.forEach(function(w){f||Ts(w,function(x){if(n.parentId===x.id){f=!0;var _=P({id:n.id,depth:x.depth+2},n);x.children?x.children.push(_):x.children=[_],n.depth=_.depth,u=s.addItem(t,n)}var A=c[x.id];return f&&A&&A.getType&&A.getType()==="combo"&&s.updateCombo(A,x.children),!0})}),!f){var d=P({id:n.id,depth:0},n);n.depth=d.depth,l.push(d),u=s.addItem(t,n)}this.set("comboTrees",l)}else if(t==="node"&&We(n.comboId)&&l){var h=this.findById(n.comboId);h&&h.getType&&h.getType()!=="combo"&&console.warn("'"+n.comboId+"' is not a id of a combo in the graph, the node will be added without combo."),u=s.addItem(t,n);var v=this.get("itemMap"),p=!1,g=!1;(l||[]).forEach(function(w){g||p||Ts(w,function(x){if(x.id===n.id)return g=!0,!1;if(n.comboId===x.id&&!g){p=!0;var _=Ur(n);_.itemType="node",x.children?x.children.push(_):x.children=[_],_.depth=x.depth+1}return p&&v[x.id].getType&&v[x.id].getType()==="combo"&&s.updateCombo(v[x.id],x.children),!0})})}else u=s.addItem(t,n);if(t==="node"&&n.comboId||t==="combo"&&n.parentId){var h=this.findById(n.comboId||n.parentId);h&&h.getType&&h.getType()==="combo"&&h.addChild(u)}var y=this.get("combos");if(y&&y.length>0&&this.sortCombos(),this.autoPaint(),i&&this.get("enabledStack")){var m=P(P({},u.getModel()),{itemType:t}),b={};switch(t){case"node":b.nodes=[m];break;case"edge":b.edges=[m];break;case"combo":b.combos=[m];break}this.pushStack("add",{before:{},after:b})}return u},e.prototype.add=function(t,n,i,a){return i===void 0&&(i=!0),a===void 0&&(a=!0),this.addItem(t,n,i,a)},e.prototype.updateItem=function(t,n,i){var a=this;i===void 0&&(i=!0);var o=this.get("itemController"),s;We(t)?s=this.findById(t):s=t;var u=Ur(s.getModel()),l="";s.getType&&(l=s.getType());var c=no([],s.getStates());if(l==="combo"&&xe(c,function(v){return a.setItemState(s,v,!1)}),o.updateItem(s,n),l==="combo"&&xe(c,function(v){return a.setItemState(s,v,!0)}),i&&this.get("enabledStack")){var f={nodes:[],edges:[],combos:[]},d={nodes:[],edges:[],combos:[]},h=P({id:u.id},n);switch(l){case"node":f.nodes.push(u),d.nodes.push(h);break;case"edge":f.edges.push(u),d.edges.push(h);break;case"combo":f.combos.push(u),d.combos.push(h);break}l==="node"&&f.nodes.push(u),this.pushStack("update",{before:f,after:d})}},e.prototype.update=function(t,n,i){i===void 0&&(i=!0),this.updateItem(t,n,i)},e.prototype.setItemState=function(t,n,i){We(t)&&(t=this.findById(t));var a=this.get("itemController");a.setItemState(t,n,i);var o=this.get("stateController");We(i)?o.updateState(t,n+":"+i,!0):o.updateState(t,n,i)},e.prototype.priorityState=function(t,n){var i=this.get("itemController");i.priorityState(t,n)},e.prototype.data=function(t){iI(t),this.set("data",t)},e.prototype.render=function(){var t=this;this.set("comboSorted",!1);var n=this.get("data");if(this.get("enabledStack")&&this.clearStack(),!n)throw new Error("data must be defined first");var i=n.nodes,a=i===void 0?[]:i,o=n.edges,s=o===void 0?[]:o,u=n.combos,l=u===void 0?[]:u;if(this.clear(!0),this.emit("beforerender"),xe(a,function(g){t.add("node",g,!1,!1)}),l&&l.length!==0){var c=zb(l,a);this.set("comboTrees",c),t.addCombos(l)}xe(s,function(g){t.add("edge",g,!1,!1)});var f=t.get("animate");(t.get("fitView")||t.get("fitCenter"))&&t.set("animate",!1);var d=t.get("layoutController");if(d){if(d.layout(h),this.destroyed)return}else t.get("fitView")&&t.fitView(),t.get("fitCenter")&&t.fitCenter(),t.emit("afterrender"),t.set("animate",f);function h(){t.get("fitView")?t.fitView():t.get("fitCenter")&&t.fitCenter(),t.autoPaint(),t.emit("afterrender"),(t.get("fitView")||t.get("fitCenter"))&&t.set("animate",f)}if(!this.get("groupByTypes"))if(l&&l.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()})}this.get("enabledStack")&&this.pushStack("render")},e.prototype.read=function(t){this.data(t),this.render()},e.prototype.diffItems=function(t,n,i){var a=this,o,s=this.get("itemMap");xe(i,function(u){if(o=s[u.id],o){if(a.get("animate")&&t===dH){var l=o.getContainer().getMatrix();l||(l=[1,0,0,0,1,0,0,0,1]),o.set("originAttrs",{x:l[6],y:l[7]})}a.updateItem(o,u,!1)}else o=a.addItem(t,u,!1);o&&n[t+"s"].push(o)})},e.prototype.changeData=function(t,n){n===void 0&&(n=!0);var i=this;if(!iI(t))return this;n&&this.get("enabledStack")&&this.pushStack("changedata",{before:i.save(),after:t}),this.set("comboSorted",!1),this.removeHulls(),this.getNodes().map(function(p){return i.clearItemStates(p)}),this.getEdges().map(function(p){return i.clearItemStates(p)});var a=this.get("canvas"),o=a.get("localRefresh");a.set("localRefresh",!1),i.get("data")||(i.data(t),i.render());var s=this.get("itemMap"),u={nodes:[],edges:[]},l=t.combos;if(l){var c=zb(l,t.nodes);this.set("comboTrees",c)}else this.set("comboTrees",[]);this.diffItems("node",u,t.nodes),xe(s,function(p,g){s[g].getModel().depth=0,!(p.getType&&p.getType()==="edge")&&(p.getType&&p.getType()==="combo"?(delete s[g],p.destroy()):u.nodes.indexOf(p)<0&&(delete s[g],i.remove(p,!1)))});for(var f=this.getCombos(),d=f.length,h=d-1;h>=0;h--)f[h].destroyed&&f.splice(h,1);l&&(i.addCombos(l),this.get("groupByTypes")||this.sortCombos()),this.diffItems("edge",u,t.edges),xe(s,function(p,g){p.getType&&(p.getType()==="node"||p.getType()==="combo")||u.edges.indexOf(p)<0&&(delete s[g],i.remove(p,!1))}),this.set({nodes:u.nodes,edges:u.edges});var v=this.get("layoutController");return v&&(v.changeData(),i.get("animate")&&!v.getLayoutType()?i.positionsAnimate():i.autoPaint()),setTimeout(function(){a.set("localRefresh",o)},16),this},e.prototype.addCombos=function(t){var n=this,i=n.get("comboTrees"),a=this.get("itemController");a.addCombos(i,t)},e.prototype.createCombo=function(t,n){var i=this;this.set("comboSorted",!1);var a="",o;if(!!t){if(We(t))a=t,o={id:t};else{if(a=t.id,!a){console.warn("Create combo failed. Please assign a unique string id for the adding combo.");return}o=t}var s=n.map(function(l){var c=i.findById(l),f=c.getModel(),d="";c.getType&&(d=c.getType());var h={id:c.getID(),itemType:d};return d==="combo"?(h.parentId=a,f.parentId=a):d==="node"&&(h.comboId=a,f.comboId=a),h});o.children=s,this.addItem("combo",o,!1),this.set("comboSorted",!1);var u=this.get("comboTrees");(u||[]).forEach(function(l){Ts(l,function(c){return c.id===a?(c.itemType="combo",c.children=s,!1):!0})}),u&&this.sortCombos()}},e.prototype.uncombo=function(t){var n=this,i=this,a=t;if(We(t)&&(a=this.findById(t)),!a||a.getType&&a.getType()!=="combo"){console.warn("The item is not a combo!");return}var o=a.getModel().parentId,s=i.get("comboTrees");s||(s=[]);var u=this.get("itemMap"),l=a.get("id"),c,f=[],d=this.get("combos"),h=this.findById(o);if(s.forEach(function(p){c||Ts(p,function(g){if(g.id===l){c=g;var y=a.getEdges();y.forEach(function(b){n.removeItem(b,!1)});var m=d.indexOf(a);d.splice(m,1),delete u[l],a.destroy(),n.emit("afterremoveitem",{item:a})}if(o&&c&&g.id===o){h.removeCombo(a),f=g.children;var m=f.indexOf(c);return m!==-1&&f.splice(m,1),c.children.forEach(function(w){var x=n.findById(w.id),_=x.getModel();x.getType&&x.getType()==="combo"?(w.parentId=o,delete w.comboId,_.parentId=o,delete _.comboId):x.getType&&x.getType()==="node"&&(w.comboId=o,_.comboId=o),h.addChild(x),f.push(w)}),!1}return!0})}),!o&&c){var v=s.indexOf(c);s.splice(v,1),c.children.forEach(function(p){p.parentId=void 0;var g=n.findById(p.id).getModel();delete g.parentId,delete g.comboId,p.itemType!=="node"&&s.push(p)})}},e.prototype.updateCombos=function(){var t=this,n=this,i=this.get("comboTrees"),a=n.get("itemController"),o=n.get("itemMap");(i||[]).forEach(function(s){Ts(s,function(u){if(!u)return!0;var l=o[u.id];if(l&&l.getType&&l.getType()==="combo"){var c=no([],l.getStates());xe(c,function(f){return t.setItemState(l,f,!1)}),a.updateCombo(l,u.children),xe(c,function(f){return t.setItemState(l,f,!0)})}return!0})}),n.sortCombos()},e.prototype.updateCombo=function(t){var n=this,i=this,a=t,o;if(We(t)&&(a=this.findById(t)),!a||a.getType&&a.getType()!=="combo"){console.warn("The item to be updated is not a combo!");return}o=a.get("id");var s=this.get("comboTrees"),u=i.get("itemController"),l=i.get("itemMap");(s||[]).forEach(function(c){Ts(c,function(f){if(!f)return!0;var d=l[f.id];if(o===f.id&&d&&d.getType&&d.getType()==="combo"){var h=no([],d.getStates());xe(h,function(v){d.getStateStyle(v)&&n.setItemState(d,v,!1)}),u.updateCombo(d,f.children),xe(h,function(v){d.getStateStyle(v)&&n.setItemState(d,v,!0)}),o&&(o=f.parentId)}return!0})})},e.prototype.updateComboTree=function(t,n,i){i===void 0&&(i=!0);var a=this;this.set("comboSorted",!1);var o;We(t)?o=a.findById(t):o=t;var s=o.getModel(),u=s.comboId||s.parentId,l="";if(o.getType&&(l=o.getType()),n&&l==="combo"){var c=this.get("comboTrees"),f=!0,d;if((c||[]).forEach(function(m){d||ea(m,function(b){if(!d)return b.id===o.getID()&&(d=b),!0})}),ea(d,function(m){return m.id===n?(f=!1,!1):!0}),!f){console.warn("Failed to update the combo tree! The parentId points to a descendant of the combo!");return}}if(i&&this.get("enabledStack")){var h={},v={};l==="combo"?(h.combos=[{id:s.id,parentId:s.parentId}],v.combos=[{id:s.id,parentId:n}]):l==="node"&&(h.nodes=[{id:s.id,parentId:s.comboId}],v.nodes=[{id:s.id,parentId:n}]),this.pushStack("updateComboTree",{before:h,after:v})}if(s.parentId||s.comboId){var p=this.findById(s.parentId||s.comboId);p&&p.removeChild(o)}if(l==="combo"?s.parentId=n:l==="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=$b(this.get("comboTrees"),s.id,n);this.set("comboTrees",y),this.updateCombos()},e.prototype.save=function(){var t=[],n=[],i=[];return xe(this.get("nodes"),function(a){t.push(a.getModel())}),xe(this.get("edges"),function(a){n.push(a.getModel())}),xe(this.get("combos"),function(a){i.push(a.getModel())}),{nodes:t,edges:n,combos:i}},e.prototype.changeSize=function(t,n){var i=this.get("viewController");return i.changeSize(t,n),this},e.prototype.refresh=function(){var t=this;if(t.emit("beforegraphrefresh"),t.get("animate"))t.positionsAnimate();else{var n=t.get("nodes"),i=t.get("edges"),a=t.get("edges");xe(n,function(o){o.refresh()}),xe(i,function(o){o.refresh()}),xe(a,function(o){o.refresh()})}t.emit("aftergraphrefresh"),t.autoPaint()},e.prototype.getNodes=function(){return this.get("nodes")},e.prototype.getEdges=function(){return this.get("edges")},e.prototype.getCombos=function(){return this.get("combos")},e.prototype.getComboChildren=function(t){if(We(t)&&(t=this.findById(t)),!t||t.getType&&t.getType()!=="combo"){console.warn("The combo does not exist!");return}return t.getChildren()},e.prototype.positionsAnimate=function(){var t=this;t.emit("beforeanimate");var n=t.get("animateCfg"),i=n.onFrame,a=t.getNodes(),o=a.map(function(u){var l=u.getModel();return{id:l.id,x:l.x,y:l.y}});t.isAnimating()&&t.stopAnimate();var s=t.get("canvas");s.animate(function(u){xe(o,function(l){var c=t.findById(l.id);if(!(!c||c.destroyed)){var f=c.get("originAttrs"),d=c.get("model");if(!f){var h=c.getContainer().getMatrix();h||(h=[1,0,0,0,1,0,0,0,1]),f={x:h[6],y:h[7]},c.set("originAttrs",f)}if(i){var v=i(c,u,l,f);c.set("model",Object.assign(d,v))}else d.x=f.x+(l.x-f.x)*u,d.y=f.y+(l.y-f.y)*u}}),t.refreshPositions()},{duration:n.duration,easing:n.easing,callback:function(){xe(a,function(l){l.set("originAttrs",null)}),n.callback&&n.callback(),t.emit("afteranimate"),t.animating=!1}})},e.prototype.refreshPositions=function(){var t=this;t.emit("beforegraphrefreshposition");var n=t.get("nodes"),i=t.get("edges"),a=t.get("vedges"),o=t.get("combos"),s,u={};xe(n,function(l){s=l.getModel();var c=l.get("originAttrs");if(!(c&&s.x===c.x&&s.y===c.y)){var f=l.updatePosition({x:s.x,y:s.y});u[s.id]=f,s.comboId&&(u[s.comboId]=u[s.comboId]||f)}}),o&&o.length!==0&&t.updateCombos(),xe(i,function(l){var c=l.getSource().getModel(),f=l.getTarget();if(!ei(f)){var d=f.getModel();(u[c.id]||u[d.id]||l.getModel().isComboEdge)&&l.refresh()}}),xe(a,function(l){l.refresh()}),t.emit("aftergraphrefreshposition"),t.autoPaint()},e.prototype.stopAnimate=function(){this.get("canvas").stopAnimate()},e.prototype.isAnimating=function(){return this.animating},e.prototype.getZoom=function(){var t=this.get("group").getMatrix();return t?t[0]:1},e.prototype.getCurrentMode=function(){var t=this.get("modeController");return t.getMode()},e.prototype.setMode=function(t){var n=this.get("modeController");return n.setMode(t),this},e.prototype.clear=function(t){var n;return t===void 0&&(t=!1),(n=this.get("canvas"))===null||n===void 0||n.clear(),this.initGroups(),this.set({itemMap:{},nodes:[],edges:[],groups:[],combos:[],comboTrees:[]}),t||this.emit("afterrender"),this},e.prototype.updateLayout=function(t,n,i){var a=this,o=this.get("layoutController");if(We(t)&&(t={type:t}),n){var s=i;s||(n==="begin"?s={x:0,y:0}:s={x:this.getWidth()/2,y:this.getHeight()/2}),s=this.getPointByCanvas(s.x,s.y);var u=["force","gForce","fruchterman"];u.includes(t.type)||!t.type&&u.includes(o==null?void 0:o.layoutType)?t.center=[s.x,s.y]:this.once("afterlayout",function(f){var d=a.getGroup().getMatrix()||[1,0,0,0,1,0,0,0,1];s.x=s.x*d[0]+d[6],s.y=s.y*d[0]+d[7];var h=a.getGroup().getCanvasBBox(),v=h.minX,p=h.maxX,g=h.minY,y=h.maxY,m={x:(v+p)/2,y:(g+y)/2};n==="begin"&&(m.x=v,m.y=g),a.translate(s.x-m.x,s.y-m.y)})}var l=this.get("layout"),c={};Object.assign(c,l,t),this.set("layout",c),o.isLayoutTypeSame(c)&&c.gpuEnabled===l.gpuEnabled?o.updateLayoutCfg(c):o.changeLayout(c)},e.prototype.destroyLayout=function(){var t=this.get("layoutController");t.destroyLayout()},e.prototype.layout=function(){var t=this.get("layoutController"),n=this.get("layout");if(!(!n||!t)){if(n.workerEnabled){t.layout();return}t.layoutMethod?t.relayout(!0):t.layout()}},e.prototype.collapseCombo=function(t){var n=this;if(We(t)&&(t=this.findById(t)),!t){console.warn("The combo to be collapsed does not exist!");return}this.emit("beforecollapseexpandcombo",{action:"expand",item:t});var i=t.getModel(),a=this.get("itemController");a.collapseCombo(t),i.collapsed=!0;var o=this.getEdges().concat(this.get("vedges")),s=[],u=[],l=this.get("comboTrees"),c=!1;(l||[]).forEach(function(h){c||ea(h,function(v){if(c&&v.depth<=i.depth)return!1;if(i.id===v.id&&(c=!0),c){var p=n.findById(v.id);p&&p.getType&&p.getType()==="combo"&&(s=s.concat(p.getNodes()),u=u.concat(p.getCombos()))}return!0})});var f={},d=[];o.forEach(function(h){if(!(h.isVisible()&&!h.getModel().isVEdge)){var v=h.getSource(),p=h.getTarget();if((s.includes(v)||u.includes(v))&&!s.includes(p)&&!u.includes(p)||v.getModel().id===i.id){var g=h.getModel();if(g.isVEdge){n.removeItem(h,!1);return}for(var y=p.getModel();!p.isVisible();){if(p=n.findById(y.parentId||y.comboId),!p||!y.parentId&&!y.comboId)return;y=p.getModel()}var m=y.id;if(f[i.id+"-"+m]){f[i.id+"-"+m]+=g.size||1;return}var b=n.addItem("vedge",{source:i.id,target:m,isVEdge:!0},!1);f[i.id+"-"+m]=g.size||1,d.push(b)}else if(!s.includes(v)&&!u.includes(v)&&(s.includes(p)||u.includes(p))||p.getModel().id===i.id){var g=h.getModel();if(g.isVEdge){n.removeItem(h,!1);return}for(var w=v.getModel();!v.isVisible();){if(v=n.findById(w.parentId||w.comboId),!v||!w.parentId&&!w.comboId)return;w=v.getModel()}var x=w.id;if(f[x+"-"+i.id]){f[x+"-"+i.id]+=g.size||1;return}var b=n.addItem("vedge",{target:i.id,source:x,isVEdge:!0},!1);f[x+"-"+i.id]=g.size||1,d.push(b)}}}),d.forEach(function(h){var v=h.getModel();n.updateItem(h,{size:f[v.source+"-"+v.target]},!1)}),this.emit("aftercollapseexpandcombo",{action:"collapse",item:t})},e.prototype.expandCombo=function(t){var n=this;if(We(t)&&(t=this.findById(t)),!t||t.getType&&t.getType()!=="combo"){console.warn("The combo to be collapsed does not exist!");return}this.emit("beforecollapseexpandcombo",{action:"expand",item:t});var i=t.getModel(),a=this.get("itemController");a.expandCombo(t),i.collapsed=!1;var o=this.getEdges().concat(this.get("vedges")),s=[],u=[],l=this.get("comboTrees"),c=!1;(l||[]).forEach(function(h){c||ea(h,function(v){if(c&&v.depth<=i.depth)return!1;if(i.id===v.id&&(c=!0),c){var p=n.findById(v.id);p&&p.getType&&p.getType()==="combo"&&(s=s.concat(p.getNodes()),u=u.concat(p.getCombos()))}return!0})});var f={},d={};o.forEach(function(h){if(!(h.isVisible()&&!h.getModel().isVEdge)){var v=h.getSource(),p=h.getTarget(),g=v.get("id"),y=p.get("id");if((s.includes(v)||u.includes(v))&&!s.includes(p)&&!u.includes(p)||g===i.id){if(h.getModel().isVEdge){n.removeItem(h,!1);return}for(var m=p.getModel();!p.isVisible();){if(p=n.findById(m.comboId||m.parentId),!p||!m.parentId&&!m.comboId)return;m=p.getModel()}y=m.id;for(var b=v.getModel();!v.isVisible();){if(v=n.findById(b.comboId||b.parentId),!v||!b.parentId&&!b.comboId)return;if(b.comboId===i.id||b.parentId===i.id)break;b=v.getModel()}if(g=b.id,y){var w=g+"-"+y;if(f[w]){f[w]+=h.getModel().size||1,n.updateItem(d[w],{size:f[w]},!1);return}var x=n.addItem("vedge",{source:g,target:y,isVEdge:!0},!1);f[w]=h.getModel().size||1,d[w]=x}}else if(!s.includes(v)&&!u.includes(v)&&(s.includes(p)||u.includes(p))||y===i.id){if(h.getModel().isVEdge){n.removeItem(h,!1);return}for(var b=v.getModel();!v.isVisible();){if(v=n.findById(b.comboId||b.parentId),!v||!b.parentId&&!b.comboId)return;b=v.getModel()}g=b.id;for(var m=p.getModel();!p.isVisible();){if(p=n.findById(m.comboId||m.parentId),!p||!m.parentId&&!m.comboId)return;if(m.comboId===i.id||m.parentId===i.id)break;m=p.getModel()}if(y=m.id,g){var w=g+"-"+y;if(f[w]){f[w]+=h.getModel().size||1,n.updateItem(d[w],{size:f[w]},!1);return}var x=n.addItem("vedge",{target:y,source:g,isVEdge:!0},!1);f[w]=h.getModel().size||1,d[w]=x}}else(s.includes(v)||u.includes(v))&&(s.includes(p)||u.includes(p))&&v.isVisible()&&p.isVisible()&&h.show()}}),this.emit("aftercollapseexpandcombo",{action:"expand",item:t})},e.prototype.collapseExpandCombo=function(t){if(We(t)&&(t=this.findById(t)),!(!t||t.getType&&t.getType()!=="combo")){for(var n=t.getModel(),i=this.findById(n.parentId);i;){var a=i.getModel();if(a.collapsed){console.warn("Fail to expand the combo since it's ancestor combo is collapsed."),i=void 0;return}i=this.findById(a.parentId)}var o=n.collapsed;o?this.expandCombo(t):this.collapseCombo(t),this.updateCombo(t)}},e.prototype.sortCombos=function(){var t=this,n=this.get("comboSorted");if(!n){this.set("comboSorted",!0);var i=[],a={},o=this.get("comboTrees");(o||[]).forEach(function(u){ea(u,function(l){return i[l.depth]?i[l.depth].push(l.id):i[l.depth]=[l.id],a[l.id]=l.depth,!0})});var s=this.getEdges().concat(this.get("vedges"));(s||[]).forEach(function(u){var l=u.getModel(),c=a[l.source]||0,f=a[l.target]||0,d=Math.max(c,f);i[d]?i[d].push(l.id):i[d]=[l.id]}),i.forEach(function(u){if(!(!u||!u.length))for(var l=u.length-1;l>=0;l--){var c=t.findById(u[l]);c&&c.toFront()}})}},e.prototype.getNeighbors=function(t,n){var i=t;return We(t)&&(i=this.findById(t)),i.getNeighbors(n)},e.prototype.getNodeDegree=function(t,n,i){n===void 0&&(n=void 0),i===void 0&&(i=!1);var a=t;We(t)&&(a=this.findById(t));var o=this.get("degrees");(!o||i)&&(o=Es(this.save()),this.set("degrees",o));var s=o[a.getID()],u=0;if(!s)return 0;switch(n){case"in":u=s.inDegree;break;case"out":u=s.outDegree;break;case"all":u=s;break;default:u=s.degree;break}return u},e.prototype.getUndoStack=function(){return this.undoStack},e.prototype.getRedoStack=function(){return this.redoStack},e.prototype.getStackData=function(){return this.get("enabledStack")?{undoStack:this.undoStack.toArray(),redoStack:this.redoStack.toArray()}:null},e.prototype.clearStack=function(){this.get("enabledStack")&&(this.undoStack.clear(),this.redoStack.clear())},e.prototype.pushStack=function(t,n,i){if(t===void 0&&(t="update"),i===void 0&&(i="undo"),!this.get("enabledStack")){console.warn("\u8BF7\u5148\u542F\u7528 undo & redo \u529F\u80FD\uFF0C\u5728\u5B9E\u4F8B\u5316 Graph \u65F6\u5019\u914D\u7F6E enabledStack: true !");return}var a=n?Ur(n):{before:{},after:Ur(this.save())};i==="redo"?this.redoStack.push({action:t,data:a}):this.undoStack.push({action:t,data:a}),this.emit("stackchange",{undoStack:this.undoStack,redoStack:this.redoStack})},e.prototype.getAdjMatrix=function(t,n){t===void 0&&(t=!0),n===void 0&&(n=this.get("directed"));var i=this.get("adjMatrix");return(!i||!t)&&(i=Uu(this.save(),n),this.set("adjMatrix",i)),i},e.prototype.getShortestPathMatrix=function(t,n){t===void 0&&(t=!0),n===void 0&&(n=this.get("directed"));var i=this.get("adjMatrix"),a=this.get("shortestPathMatrix");return(!i||!t)&&(i=Uu(this.save(),n),this.set("adjMatrix",i)),(!a||!t)&&(a=rh(this.save(),n),this.set("shortestPathMatrix",a)),a},e.prototype.on=function(t,n,i){return r.prototype.on.call(this,t,n,i)},e.prototype.destroy=function(){this.clear(),this.clearStack(),this.get("itemController").destroy(),this.get("modeController").destroy(),this.get("viewController").destroy(),this.get("stateController").destroy(),this.get("canvas").destroy(),this.cfg=null,this.destroyed=!0,this.redoStack=null,this.undoStack=null},e.prototype.createHull=function(t){if(!t.members||t.members.length<1){console.warn("Create hull failed! The members is empty.");return}var n=this.get("hullGroup"),i=this.get("hullMap");if(i||(i={},this.set("hullMap",i)),(!n||n.get("destroyed"))&&(n=this.get("group").addGroup({id:"hullGroup"}),n.toBack(),this.set("hullGroup",n)),i[t.id])return console.warn("Existed hull id."),i[t.id];var a=n.addGroup({id:t.id+"-container"}),o=new hH(this,P(P({},t),{group:a})),s=o.id;return i[s]=o,o},e.prototype.getHulls=function(){return this.get("hullMap")},e.prototype.getHullById=function(t){return this.get("hullMap")[t]},e.prototype.removeHull=function(t){var n;We(t)?n=this.getHullById(t):n=t;var i=this.get("hullMap");delete i[n.id],n.destroy()},e.prototype.removeHulls=function(){var t=this.getHulls();!t||!Object.keys(t).length||(Object.keys(t).forEach(function(n){var i=t[n];i.destroy()}),this.set("hullMap",{}))},e}(XA);function Yp(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Yp=function(t){return typeof t}:Yp=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yp(r)}var Wu=hp,pH="-shape",vM="-label",Hp=["startArrow","endArrow"],pM={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},gH={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},qp={edge:gH,node:pM,combo:pM},O1="-label-bg",P1={options:{},itemType:"",type:"",getCustomConfig:function(e){return{}},getOptions:function(e,t){return t==="move"||t==="bbox"?{}:tn({labelCfg:{style:{fontFamily:typeof window!="undefined"&&window.getComputedStyle&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif"}},descriptionCfg:{style:{fontFamily:typeof window!="undefined"&&window.getComputedStyle&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif"}}},this.options,this.getCustomConfig(e)||{},e)},draw:function(e,t){var n=this.drawShape(e,t);if(n.set("className",this.itemType+pH),e.label){var i=this.drawLabel(e,t);i.set("className",this.itemType+vM)}return n},afterDraw:function(e,t,n){},drawShape:function(e,t){return null},drawLabel:function(e,t){var n=this.getOptions(e).labelCfg,i=n||{},a=this.getLabelStyle(e,i,t),o=a.rotate;delete a.rotate;var s=t.addShape("text",{attrs:a,draggable:!0,className:"text-shape",name:"text-shape"});if(!isNaN(o)&&o!==""){var u=s.getBBox(),l=[1,0,0,0,1,0,0,0,1];if(a.rotateCenter)switch(a.rotateCenter){case"center":l=Wu(l,[["t",-u.width/2,-u.height/2],["r",o],["t",u.width/2,u.height/2]]);break;case"lefttop":l=Wu(l,[["t",-a.x,-a.y],["r",o],["t",a.x,a.y]]);break;case"leftcenter":l=Wu(l,[["t",-a.x,-a.y-u.height/2],["r",o],["t",a.x,a.y+u.height/2]]);break;default:l=Wu(l,[["t",-u.width/2,-u.height/2],["r",o],["t",u.width/2,u.height/2]]);break}else l=Wu(l,[["t",-a.x,-a.y-u.height/2],["r",o],["t",a.x,a.y+u.height/2]]);s.setMatrix(l)}if(a.background){var c=this.drawLabelBg(e,t,s),f=this.itemType+O1;c.set("classname",f),s.toFront()}return s},drawLabelBg:function(e,t,n){var i=this.options.labelCfg,a=It({},i,e.labelCfg),o=this.getLabelBgStyleByPosition(n,e,a,t),s=t.addShape("rect",{name:"text-bg-shape",attrs:o});return s},getLabelStyleByPosition:function(e,t,n){return{text:e.label}},getLabelBgStyleByPosition:function(e,t,n,i){return{}},getLabelStyle:function(e,t,n){var i=this.getLabelStyleByPosition(e,t,n),a=this.itemType+"Label",o=kt[a]?kt[a].style:null,s=P(P(P({},o),i),t.style);return s},getShapeStyle:function(e){return e.style},update:function(e,t,n){this.updateShapeStyle(e,t,n),this.updateLabel(e,t,n)},updateShapeStyle:function(e,t,n){var i=t.getContainer(),a=t.getKeyShape(),o=It({},a.attr(),e.style),s=function(c){var f,d=o[c];if(ei(d)){var h=i.find(function(v){return v.get("name")===c});h&&h.attr(d)}else a.attr((f={},f[c]=d,f))};for(var u in o)s(u)},updateLabel:function(e,t,n){var i=t.getContainer(),a=this.getOptions({},n).labelCfg,o=this.itemType+vM,s=i.find(function(_){return _.get("className")===o}),u=this.itemType+O1,l=i.find(function(_){return _.get("classname")===u});if(e.label||e.label==="")if(s){var f={};t.getModel&&(f=t.getModel().labelCfg);var d=tn({},a,f,e.labelCfg),h=this.getLabelStyleByPosition(e,d,i),v=e.labelCfg?e.labelCfg.style:void 0,p=d.style&&d.style.background,g=P(P(P({},s.attr()),h),v),y=g.rotate;if(delete g.rotate,!isNaN(y)&&y!==""){var m=[1,0,0,0,1,0,0,0,1];m=Wu(m,[["t",-g.x,-g.y],["r",y],["t",g.x,g.y]]),s.resetMatrix(),s.attr(P(P({},g),{matrix:m}))}else s.resetMatrix(),s.attr(g);if(!l)g.background&&(l=this.drawLabelBg(e,i,s),l.set("classname",u),s.toFront());else if(g.background){var b=this.getLabelBgStyleByPosition(s,e,d,i),w=P(P({},b),p);if(l.resetMatrix(),!isNaN(y)&&y!==""){var x=[1,0,0,0,1,0,0,0,1];x=Wu(x,[["t",-w.x,-w.y],["r",y],["t",w.x,w.y]]),w.matrix=x}l.attr(w)}else i.removeChild(l)}else{var c=this.drawLabel(e,i);c.set("className",o)}},afterUpdate:function(e,t){},setState:function(e,t,n){var i,a,o=n.get("keyShape");if(!(!o||o.destroyed)){var s=n.getType(),u=db(t)?e:e+":"+t,l=this.getStateStyle(u,n),c=n.getStateStyle(u);if(!(!c&&!l)){var f=It({},c||l),d=n.getContainer(),h={x:1,y:1,cx:1,cy:1};if(s==="combo"&&(h.r=1,h.width=1,h.height=1),t){var v=function(B){var ee,K=f[B];if(ei(K)&&!Hp.includes(B)){var z=d.find(function(X){return X.get("name")===B});z&&z.attr(K)}else o.attr((ee={},ee[B]=K,ee))};for(var p in f)v(p)}else{var g=Ip(n.getCurrentStatesStyle()),y=n.getModel(),m=It({},y.style,Ip(n.getOriginStyle())),b=o.get("name"),w=o.attr(),x={};Object.keys(w).forEach(function(L){if(L!=="img"){var B=w[L];B&&Yp(B)==="object"?x[L]=Ur(B):x[L]=B}});var _={},A=function(B){var ee=f[B];if(ei(ee)&&!Hp.includes(B)){var K=d.find(function(H){return H.get("name")===B});if(K){var z=Ip(K.attr());xe(ee,function(H,J){if(B===b&&x[J]&&!h[J]){delete x[J];var ne=m[B][J]||qp[s][J];o.attr(J,ne)}else if(z[J]||z[J]===0){delete z[J];var me=m[B][J]||qp[s][J];K.attr(J,me)}}),_[B]=z}}else if(x[B]&&!h[B]){delete x[B];var X=m[B]||(m[b]?m[b][B]:void 0)||qp[s][B];o.attr(B,X)}};for(var I in f)A(I);b?_[b]=x:It(_,x);for(var p in g)if(!h[p]){var M=g[p];(!ei(M)||Hp.includes(p))&&(b?(It(m[b],(a={},a[p]=M,a)),delete m[p]):It(m,(i={},i[p]=M,i)),delete g[p])}var S={};tn(S,m,_,g);var C=!1,T=function(B){var ee,K,z=S[B];if(ei(z)&&!Hp.includes(B)){var X=d.find(function(J){return J.get("name")===B});X&&(X.get("type")==="text"&&(delete z.x,delete z.y,delete z.matrix),B===b&&(s==="combo"&&(delete z.r,delete z.width,delete z.height),C=!0),X.attr(z))}else if(!C){var H=z||qp[s][B];s==="combo"?b||o.attr((ee={},ee[B]=H,ee)):o.attr((K={},K[B]=H,K))}};for(var k in S)T(k)}}}},getStateStyle:function(e,t){var n=t.getModel(),i=t.getType(),a=this.getOptions(n),o=a.stateStyles,s=a.style,u=s===void 0?{}:s,l=n.stateStyles?n.stateStyles[e]:o&&o[e];return i==="combo"?Ur(l):It({},u,l)},getControlPoints:function(e){return e.controlPoints},getAnchorPoints:function(e){var t,n,i=(e==null?void 0:e.anchorPoints)||((t=this.getCustomConfig(e))===null||t===void 0?void 0:t.anchorPoints)||((n=this.options)===null||n===void 0?void 0:n.anchorPoints);return i}},yH={itemType:"node",shapeType:"single-node",labelPosition:"center",offset:kt.nodeLabel.offset,getSize:function(e){var t=e.size||this.getOptions({}).size||kt.defaultNode.size;return Mt(t)&&t.length===1&&(t=[t[0],t[0]]),Mt(t)||(t=[t,t]),t},getLabelStyleByPosition:function(e,t){var n=t.position||this.labelPosition;if(n==="center")return{x:0,y:0,text:e.label};var i=t.offset;xt(i)&&(i=this.offset);var a=this.getSize(e),o=a[0],s=a[1],u;switch(n){case"top":u={x:0,y:0-s/2-i,textBaseline:"bottom"};break;case"bottom":u={x:0,y:s/2+i,textBaseline:"top"};break;case"left":u={x:0-o/2-i,y:0,textAlign:"right"};break;default:u={x:o/2+i,y:0,textAlign:"left"};break}return u.text=e.label,u},getLabelBgStyleByPosition:function(e,t,n,i){if(!e)return{};var a=e.getBBox(),o=n.style&&n.style.background;if(!o)return{};var s=S1(o.padding),u=a.width+s[1]+s[3],l=a.height+s[0]+s[2];n.offset;var c;return c={x:a.minX-s[3],y:a.minY-s[0]},c=P(P(P({},c),o),{width:u,height:l}),c},drawShape:function(e,t){var n=this.shapeType,i=this.getShapeStyle(e),a=t.addShape(n,{attrs:i,draggable:!0,name:"node-shape"});return a},updateLinkPoints:function(e,t){var n=this.getOptions(e).linkPoints,i=t.find(function(A){return A.get("className")==="link-point-left"}),a=t.find(function(A){return A.get("className")==="link-point-right"}),o=t.find(function(A){return A.get("className")==="link-point-top"}),s=t.find(function(A){return A.get("className")==="link-point-bottom"}),u;i&&(u=i.attr()),a&&!u&&(u=a.attr()),o&&!u&&(u=o.attr()),s&&!u&&(u=s.attr()),u||(u=n);var l=It({},u,e.linkPoints),c=l.fill,f=l.stroke,d=l.lineWidth,h=l.size/2;h||(h=l.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],_={r:h,fill:c,stroke:f,lineWidth:d};i?!p&&p!==void 0?i.remove():i.attr(P(P({},_),{x:-w/2,y:0})):p&&t.addShape("circle",{attrs:P(P({},_),{x:-w/2,y:0}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0}),a?(!g&&g!==void 0&&a.remove(),a.attr(P(P({},_),{x:w/2,y:0}))):g&&t.addShape("circle",{attrs:P(P({},_),{x:w/2,y:0}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0}),o?(!y&&y!==void 0&&o.remove(),o.attr(P(P({},_),{x:0,y:-x/2}))):y&&t.addShape("circle",{attrs:P(P({},_),{x:0,y:-x/2}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0}),s?!m&&m!==void 0?s.remove():s.attr(P(P({},_),{x:0,y:x/2})):m&&t.addShape("circle",{attrs:P(P({},_),{x:0,y:x/2}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0})},updateShape:function(e,t,n,i){var a=t.get("keyShape");a.attr(P({},n)),this.updateLabel(e,t),i&&this.updateIcon(e,t)},updateIcon:function(e,t){var n=this,i=t.getContainer(),a=this.getOptions(e).icon,o=(e.icon?e.icon:{show:void 0}).show,s=i.find(function(v){return v.get("className")===n.type+"-icon"});if(s)if(o||o===void 0){var u=It({},s.attr(),a),l=u.width,c=l===void 0?20:l,f=u.height,d=f===void 0?20:f;s.attr(P(P({},u),{x:-c/2,y:-d/2}))}else s.remove();else if(o){var c=a.width,d=a.height;i.addShape("image",{attrs:P(P({},a),{x:-c/2,y:-d/2}),className:this.type+"-icon",name:this.type+"-icon"});var h=i.find(function(g){return g.get("className")==="node-label"});h&&h.toFront()}}},mH=P(P({},P1),yH);hn.registerNode("single-node",mH);var Kp="edge-shape";function bH(r){var e=r;return r==="start"?e="end":r==="end"&&(e="start"),e}var wH={itemType:"edge",labelPosition:"center",refX:0,refY:0,labelAutoRotate:!1,options:{size:kt.defaultEdge.size,style:{x:0,y:0,stroke:kt.defaultEdge.style.stroke,lineAppendWidth:kt.defaultEdge.style.lineAppendWidth},labelCfg:{style:{fill:kt.edgeLabel.style.fill,fontSize:kt.edgeLabel.style.fontSize}},stateStyles:P({},kt.edgeStateStyles)},getPath:function(e){var t=[];return xe(e,function(n,i){i===0?t.push(["M",n.x,n.y]):t.push(["L",n.x,n.y])}),t},getShapeStyle:function(e){var t=this.options.style,n={stroke:e.color},i=It({},t,n,e.style),a=e.size||kt.defaultEdge.size;e=this.getPathPoints(e);var o=e.startPoint,s=e.endPoint,u=this.getControlPoints(e),l=[o];u&&(l=l.concat(u)),l.push(s);var c=this.getPath(l),f=It({},kt.defaultEdge.style,{stroke:kt.defaultEdge.color,lineWidth:a,path:c},i);return f},updateShapeStyle:function(e,t,n){var i,a=t.getContainer(),o={stroke:e.color},s=((i=t.getKeyShape)===null||i===void 0?void 0:i.call(t))||a.find(function(w){return w.get("className")==="edge-shape"}),u=e.size;e=this.getPathPoints(e);var l=e.startPoint,c=e.endPoint,f=this.getControlPoints(e),d=[l];f&&(d=d.concat(f)),d.push(c);var h=s.attr(),v=It({},o,h,e.style),p=e.sourceNode,g=e.targetNode,y={radius:v.radius};f||(y={source:p,target:g,offset:v.offset,radius:v.radius});var m=this.getPath(d,y),b={};n==="move"?b={path:m}:(h.endArrow&&v.endArrow===!1&&(e.style.endArrow={path:""}),h.startArrow&&v.startArrow===!1&&(e.style.startArrow={path:""}),b=It(o,h,{lineWidth:u,path:m},e.style)),s&&s.attr(b)},getLabelStyleByPosition:function(e,t,n){var i=t.position||this.labelPosition,a={},o=n&&n.find(function(d){return d.get("className")===Kp}),s;i==="start"?s=0:i==="end"?s=1:s=.5;var u=t.refX||this.refX,l=t.refY||this.refY;if(e.startPoint.x===e.endPoint.x&&e.startPoint.y===e.endPoint.y)return a.x=e.startPoint.x+u,a.y=e.startPoint.y+l,a.text=e.label,a;var c;xt(t.autoRotate)?c=this.labelAutoRotate:c=t.autoRotate;var f=Gb(o,s,u,l,c);return a.x=f.x,a.y=f.y,a.rotate=f.rotate,a.textAlign=this._getTextAlign(i,f.angle),a.text=e.label,a},getLabelBgStyleByPosition:function(e,t,n,i){if(!e)return{};var a=e.getBBox(),o=n.style&&n.style.background;if(!o)return{};var s=o.padding,u=a.width+s[1]+s[3],l=a.height+s[0]+s[2],c=n.position||this.labelPosition,f=P(P({},o),{width:u,height:l,x:a.minX-s[2],y:a.minY-s[0],rotate:0}),d;xt(n.autoRotate)?d=this.labelAutoRotate:d=n.autoRotate;var h=i&&i.find(function(b){return b.get("className")===Kp}),v;c==="start"?v=0:c==="end"?v=1:v=.5;var p=n.refX||this.refX,g=n.refY||this.refY;if(t.startPoint.x===t.endPoint.x&&t.startPoint.y===t.endPoint.y)return f.x=t.startPoint.x+p-u/2,f.y=t.startPoint.y+g-l/2,f;var y=p-u/2;n.position==="start"?y=p-s[2]:n.position==="end"&&(y=p-u);var m=Gb(h,v,y,g+l/2,d);return d&&(f.x=m.x,f.y=m.y),f.rotate=m.rotate,f},_getTextAlign:function(e,t){var n="center";return t?(t=t%(Math.PI*2),e!=="center"&&(t>=0&&t<=Math.PI/2||t>=3/2*Math.PI&&t<2*Math.PI?n=e:n=bH(e)),n):e},getControlPoints:function(e){return e.controlPoints},getPathPoints:function(e){return e},drawShape:function(e,t){var n=this.getShapeStyle(e),i=t.addShape("path",{className:Kp,name:Kp,attrs:n});return i},drawLabel:function(e,t){var n=this.options.labelCfg,i;typeof window!="undefined"&&typeof window.getComputedStyle!="undefined"?i=window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif":i="Arial, sans-serif";var a=tn({fontFamily:i},n,e.labelCfg),o=this.getLabelStyle(e,a,t),s=o.rotate;delete o.rotate;var u=t.addShape("text",{attrs:o,name:"text-shape"});if(!isNaN(s)&&s!==""&&u.rotateAtStart(s),o.background){var l=this.drawLabelBg(e,t,u,o,s),c=this.itemType+O1;l.set("classname",c),u.toFront()}return u},drawLabelBg:function(e,t,n,i,a){var o=this.options.labelCfg,s=tn({},o,e.labelCfg),u=this.getLabelBgStyleByPosition(n,e,s,t);delete u.rotate;var l=t.addShape("rect",{name:"text-bg-shape",attrs:u});return isNaN(a)||l.rotateAtStart(a),l}},xH=P(P({},P1),wH);hn.registerEdge("single-edge",xH);hn.registerEdge("line",{getControlPoints:function(){}},"single-edge");hn.registerEdge("spline",{getPath:function(e){var t=aM(e);return t}},"single-edge");hn.registerEdge("arc",{curveOffset:20,clockwise:1,getControlPoints:function(e){var t=e.startPoint,n=e.endPoint,i={x:(t.x+n.x)/2,y:(t.y+n.y)/2},a,o;if(e.controlPoints!==void 0){if(o=e.controlPoints[0],a=Nb(t,o,n),t.x<=n.x&&t.y>n.y?this.clockwise=a.x>o.x?0:1:t.x<=n.x&&t.y<n.y?this.clockwise=a.x>o.x?1:0:t.x>n.x&&t.y<=n.y?this.clockwise=a.y<o.y?0:1:this.clockwise=a.y<o.y?1:0,(o.x-t.x)/(o.y-t.y)==(n.x-t.x)/(n.y-t.y))return[]}else{e.curveOffset===void 0&&(e.curveOffset=this.curveOffset),Mt(e.curveOffset)&&(e.curveOffset=e.curveOffset[0]),e.curveOffset<0?this.clockwise=0:this.clockwise=1;var s={x:n.x-t.x,y:n.y-t.y},u=Math.atan2(s.y,s.x);o={x:e.curveOffset*Math.cos(-Math.PI/2+u)+i.x,y:e.curveOffset*Math.sin(-Math.PI/2+u)+i.y},a=Nb(t,o,n)}var l=_p(t,a),c=[{x:l,y:l}];return c},getPath:function(e){var t=[];return t.push(["M",e[0].x,e[0].y]),e.length===2?t.push(["L",e[1].x,e[1].y]):t.push(["A",e[1].x,e[1].y,0,0,this.clockwise,e[2].x,e[2].y]),t}},"single-edge");hn.registerEdge("quadratic",{curvePosition:.5,curveOffset:-20,getControlPoints:function(e){var t=e.controlPoints;if(!t||!t.length){var n=e.startPoint,i=e.endPoint;e.curveOffset===void 0&&(e.curveOffset=this.curveOffset),e.curvePosition===void 0&&(e.curvePosition=this.curvePosition),Mt(this.curveOffset)&&(e.curveOffset=e.curveOffset[0]),Mt(this.curvePosition)&&(e.curvePosition=e.curveOffset[0]);var a=Xp(n,i,e.curvePosition,e.curveOffset);t=[a]}return t},getPath:function(e){var t=[];return t.push(["M",e[0].x,e[0].y]),t.push(["Q",e[1].x,e[1].y,e[2].x,e[2].y]),t}},"single-edge");hn.registerEdge("cubic",{curvePosition:[1/2,1/2],curveOffset:[-20,20],getControlPoints:function(e){var t=e.controlPoints;if(e.curveOffset===void 0&&(e.curveOffset=this.curveOffset),e.curvePosition===void 0&&(e.curvePosition=this.curvePosition),Ft(e.curveOffset)&&(e.curveOffset=[e.curveOffset,-e.curveOffset]),Ft(e.curvePosition)&&(e.curvePosition=[e.curvePosition,1-e.curvePosition]),!t||!t.length||t.length<2){var n=e.startPoint,i=e.endPoint,a=Xp(n,i,e.curvePosition[0],e.curveOffset[0]),o=Xp(n,i,e.curvePosition[1],e.curveOffset[1]);t=[a,o]}return t},getPath:function(e){var t=[];return t.push(["M",e[0].x,e[0].y]),t.push(["C",e[1].x,e[1].y,e[2].x,e[2].y,e[3].x,e[3].y]),t}},"single-edge");hn.registerEdge("cubic-vertical",{curvePosition:[1/2,1/2],minCurveOffset:[0,0],curveOffset:void 0,getControlPoints:function(e){var t=e.startPoint,n=e.endPoint;e.curvePosition===void 0&&(e.curvePosition=this.curvePosition),e.curveOffset===void 0&&(e.curveOffset=this.curveOffset),e.minCurveOffset===void 0&&(e.minCurveOffset=this.minCurveOffset),Ft(e.curveOffset)&&(e.curveOffset=[e.curveOffset,-e.curveOffset]),Ft(e.minCurveOffset)&&(e.minCurveOffset=[e.minCurveOffset,-e.minCurveOffset]),Ft(e.curvePosition)&&(e.curvePosition=[e.curvePosition,1-e.curvePosition]);var i=n.y-t.y,a=[0,0];e.curveOffset?a=e.curveOffset:Math.abs(i)<Math.abs(e.minCurveOffset[0])&&(a=e.minCurveOffset);var o={x:t.x,y:t.y+i*this.curvePosition[0]+a[0]},s={x:n.x,y:n.y-i*this.curvePosition[1]+a[1]};return[o,s]}},"cubic");hn.registerEdge("cubic-horizontal",{curvePosition:[1/2,1/2],minCurveOffset:[0,0],curveOffset:void 0,getControlPoints:function(e){var t=e.startPoint,n=e.endPoint;e.curvePosition===void 0&&(e.curvePosition=this.curvePosition),e.curveOffset===void 0&&(e.curveOffset=this.curveOffset),e.minCurveOffset===void 0&&(e.minCurveOffset=this.minCurveOffset),Ft(e.curveOffset)&&(e.curveOffset=[e.curveOffset,-e.curveOffset]),Ft(e.minCurveOffset)&&(e.minCurveOffset=[e.minCurveOffset,-e.minCurveOffset]),Ft(e.curvePosition)&&(e.curvePosition=[e.curvePosition,1-e.curvePosition]);var i=n.x-t.x,a=[0,0];e.curveOffset?a=e.curveOffset:Math.abs(i)<Math.abs(e.minCurveOffset[0])&&(a=e.minCurveOffset);var o={x:t.x+i*this.curvePosition[0]+a[0],y:t.y},s={x:n.x-i*this.curvePosition[1]+a[1],y:n.y},u=[o,s];return u}},"cubic");hn.registerEdge("loop",{getPathPoints:function(e){return eI(e)},getControlPoints:function(e){return e.controlPoints},afterDraw:function(e){e.controlPoints=void 0},afterUpdate:function(e){e.controlPoints=void 0}},"cubic");var _H={itemType:"combo",shapeType:"single-combo",labelPosition:"top",refX:kt.comboLabel.refX,refY:kt.comboLabel.refY,options:{style:{stroke:kt.defaultCombo.style.stroke,fill:kt.defaultCombo.style.fill,lineWidth:kt.defaultCombo.style.lineWidth},labelCfg:{style:{fill:kt.comboLabel.style.fill,fontSize:kt.comboLabel.style.fontSize}},stateStyles:P({},kt.comboStateStyles)},getSize:function(e){var t=Ur(e.size||this.options.size||kt.defaultCombo.size);return Mt(t)&&t.length===1&&(t=[t[0],t[0]]),Mt(t)||(t=[t,t]),t},getLabelStyleByPosition:function(e,t){var n=t.position||this.labelPosition,i=e.style,a=e.padding||this.options.padding;Mt(a)&&(a=a[0]);var o=t.refX,s=t.refY;xt(o)&&(o=this.refX),xt(s)&&(s=this.refY);var u=this.getSize(e),l=Math.max(i.r,u[0]/2)||u[0]/2,c=l+a,f;switch(n){case"top":f={x:0,y:-c-s,textBaseline:"bottom",textAlign:"center"};break;case"bottom":f={x:0,y:c+s,textBaseline:"bottom",textAlign:"center"};break;case"left":f={x:-c+o,y:0,textAlign:"left"};break;case"center":f={x:0,y:0,text:e.label,textAlign:"center"};break;default:f={x:c+o,y:0,textAlign:"right"};break}return f.text=e.label,f},drawShape:function(e,t){var n=this.shapeType,i=this.getShapeStyle(e),a=t.addShape(n,{attrs:i,draggable:!0,name:"combo-shape"});return a},updateShape:function(e,t,n){var i=t.get("keyShape"),a=e.animate===void 0?this.options.animate:e.animate;a&&i.animate?i.animate(n,{duration:200,easing:"easeLinear"}):i.attr(P({},n)),this.updateLabel(e,t)}},SH=P(P({},P1),_H);hn.registerCombo("single-combo",SH);hn.registerCombo("circle",{options:{size:[kt.defaultCombo.size[0],kt.defaultCombo.size[0]],padding:kt.defaultCombo.padding[0],animate:!0,style:{stroke:kt.defaultCombo.style.stroke,fill:kt.defaultCombo.style.fill,lineWidth:kt.defaultCombo.style.lineWidth},labelCfg:{style:{fill:kt.comboLabel.style.fill,fontSize:kt.comboLabel.style.fontSize},refX:0,refY:0},stateStyles:P({},kt.comboStateStyles)},shapeType:"circle",labelPosition:"top",drawShape:function(e,t){var n=this.getShapeStyle(e);delete n.height,delete n.width;var i=t.addShape("circle",{attrs:n,className:"circle-combo",name:"circle-combo",draggable:!0});return i},getShapeStyle:function(e){var t=this.options.style,n=e.padding||this.options.padding;Mt(n)&&(n=n[0]);var i={stroke:e.color},a=It({},t,i,e.style),o;if(e.fixSize)o=Ft(e.fixSize)?e.fixSize:e.fixSize[0];else{var s=this.getSize(e);!Ft(a.r)||isNaN(a.r)?o=s[0]/2||kt.defaultCombo.style.r:o=Math.max(a.r,s[0]/2)||s[0]/2}a.r=o+n;var u=P({x:0,y:0},a);return e.style?e.style.r=o:e.style={r:o},u},update:function(e,t){var n=this.getSize(e),i=e.padding||this.options.padding;Mt(i)&&(i=i[0]);var a=Ur(e.style),o;e.fixSize?o=Ft(e.fixSize)?e.fixSize:e.fixSize[0]:o=Math.max(a.r,n[0]/2)||n[0]/2,a.r=o+i;var s=t.get("sizeCache");s&&(s.r=a.r);var u={stroke:e.color},l=t.get("keyShape"),c=It({},l.attr(),u,a);e.style?e.style.r=o:e.style={r:o},this.updateShape(e,t,c,!0)}},"single-combo");hn.registerCombo("rect",{options:{size:[40,5],padding:[25,20,15,20],animate:!0,style:{radius:0,stroke:kt.defaultCombo.style.stroke,fill:kt.defaultCombo.style.fill,lineWidth:kt.defaultCombo.style.lineWidth},labelCfg:{style:{fill:kt.comboLabel.style.fill,fontSize:kt.comboLabel.style.fontSize}},anchorPoints:[[0,.5],[1,.5]],stateStyles:P({},kt.comboStateStyles)},shapeType:"rect",labelPosition:"top",drawShape:function(e,t){var n=this.getShapeStyle(e),i=t.addShape("rect",{attrs:n,className:"rect-combo",name:"rect-combo",draggable:!0});return i},getLabelStyleByPosition:function(e,t){var n=t.position||this.labelPosition,i=e.style,a=e.padding||this.options.padding;Ft(a)&&(a=[a,a,a,a]);var o=t.refX,s=t.refY;xt(o)&&(o=this.refX),xt(s)&&(s=this.refY);var u=i.width/2+a[3],l=i.height/2+a[0],c;switch(n){case"top":c={x:0-u+o,y:0-l+s,textBaseline:"top",textAlign:"left"};break;case"bottom":c={x:0,y:l+s,textBaseline:"bottom",textAlign:"center"};break;case"left":c={x:0-u+s,y:0,textAlign:"left"};break;case"center":c={x:0,y:0,text:e.label,textAlign:"center"};break;default:c={x:u+o,y:0,textAlign:"right"};break}return c.text=e.label,c},getShapeStyle:function(e){var t=this.options.style,n=e.padding||this.options.padding;Ft(n)&&(n=[n,n,n,n]);var i={stroke:e.color},a=It({},t,i,e.style),o=this.getSize(e),s,u,l=e.collapsed&&e.fixCollapseSize?e.fixCollapseSize:e.fixSize;l?Ft(l)?(s=l,u=l):(s=l[0],u=l[1]):(!Ft(a.width)||isNaN(a.width)?s=o[0]||kt.defaultCombo.style.width:s=Math.max(a.width,o[0])||o[0],!Ft(a.height)||isNaN(a.height)?u=o[1]||kt.defaultCombo.style.height:u=Math.max(a.height,o[1])||o[1]);var c=-s/2-n[3],f=-u/2-n[0];a.width=s+n[1]+n[3],a.height=u+n[0]+n[2];var d=P({x:c,y:f},a);return e.style?(e.style.width=s,e.style.height=u):e.style={width:s,height:u},d},update:function(e,t){var n=this.getSize(e),i=e.padding||this.options.padding;Ft(i)&&(i=[i,i,i,i]);var a=Ur(e.style),o,s,u=e.collapsed&&e.fixCollapseSize?e.fixCollapseSize:e.fixSize;u?Ft(u)?(o=u,s=u):(o=u[0],s=u[1]):(o=Math.max(a.width,n[0])||n[0],s=Math.max(a.height,n[1])||n[1]),a.width=o+i[1]+i[3],a.height=s+i[0]+i[2];var l=t.get("sizeCache");l&&(l.width=a.width,l.height=a.height),a.x=-o/2-i[3],a.y=-s/2-i[0];var c={stroke:e.color},f=t.get("keyShape"),d=It({},f.attr(),c,a);e.style?(e.style.width=o,e.style.height=s):e.style={width:o,height:s},this.updateShape(e,t,d,!1)},updateShape:function(e,t,n){var i=t.get("keyShape"),a=e.animate===void 0?this.options.animate:e.animate;a&&i.animate?i.animate(n,{duration:200,easing:"easeLinear"}):i.attr(P({},n)),this.updateLabel(e,t)}},"single-combo");hn.registerNode("simple-circle",{options:{size:kt.defaultNode.size,style:{x:0,y:0,stroke:kt.defaultNode.style.stroke,fill:kt.defaultNode.style.fill,lineWidth:kt.defaultNode.style.lineWidth},labelCfg:{style:{fill:kt.nodeLabel.style.fill,fontSize:kt.nodeLabel.style.fontSize}},stateStyles:P({},kt.nodeStateStyles)},shapeType:"simple-circle",labelPosition:"center",drawShape:function(e,t){var n=this.getShapeStyle(e),i=t.addShape("circle",{attrs:n,className:this.type+"-keyShape",draggable:!0});return i},getShapeStyle:function(e){var t=this.getOptions(e).style,n={stroke:e.color},i=tn({},t,n),a=this.getSize(e),o=a[0]/2,s=P({x:0,y:0,r:o},i);return s},update:function(e,t){var n=this.getSize(e),i={stroke:e.color,r:n[0]/2},a=t.get("keyShape"),o=tn({},a.attr(),i,e.style);this.updateShape(e,t,o,!0)}},"single-node");hn.registerNode("simple-rect",{options:{size:[100,30],style:{radius:0,stroke:kt.defaultNode.style.stroke,fill:kt.defaultNode.style.fill,lineWidth:kt.defaultNode.style.lineWidth},labelCfg:{style:{fill:kt.nodeLabel.style.fill,fontSize:kt.nodeLabel.style.fontSize}},anchorPoints:[[0,.5],[1,.5]],stateStyles:P({},kt.nodeStateStyles)},shapeType:"simple-rect",labelPosition:"center",drawShape:function(e,t){var n=this.getShapeStyle(e),i=t.addShape("rect",{attrs:n,className:this.type+"-keyShape",name:this.type+"-keyShape",draggable:!0});return i},getShapeStyle:function(e){var t=this.getOptions(e).style,n={stroke:e.color},i=It({},t,n),a=this.getSize(e),o=i.width||a[0],s=i.height||a[1],u=P({x:-o/2,y:-s/2,width:o,height:s},i);return u},update:function(e,t){t.getContainer();var n=this.getOptions({}).style,i=this.getSize(e),a=t.get("keyShape");e.size||(i[0]=a.attr("width")||n.width,i[1]=a.attr("height")||n.height);var o={stroke:e.color,x:-i[0]/2,y:-i[1]/2,width:i[0],height:i[1]},s=It({},n,a.attr(),o);s=It(s,e.style),this.updateShape(e,t,s,!1)}},"single-node");hn.registerNode("image",{options:{img:"https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*eD7nT6tmYgAAAAAAAAAAAABkARQnAQ",size:200,clipCfg:{show:!1,type:"circle",r:50,rx:50,ry:35,width:50,height:35,points:[[30,12],[12,30],[30,48],[48,30]],path:[["M",25,25],["L",50,25],["A",12.5,12.5,0,1,1,50,50],["A",12.5,12.5,0,1,0,50,50],["L",25,75],["Z"]],x:0,y:0}},shapeType:"image",labelPosition:"bottom",drawShape:function(e,t){var n=this.shapeType,i=this.getShapeStyle(e);delete i.fill;var a=t.addShape(n,{attrs:i,className:this.type+"-keyShape",name:this.type+"-keyShape",draggable:!0});return this.drawClip(e,a),a},drawClip:function(e,t){var n=this.getOptions(e).clipCfg;if(!!n.show){var i=n.type,a=n.x,o=n.y,s=n.style;if(i==="circle"){var u=n.r;t.setClip({type:"circle",attrs:P({r:u,x:a,y:o},s)})}else if(i==="rect"){var l=n.width,c=n.height,f=a-l/2,d=o-c/2;t.setClip({type:"rect",attrs:P({x:f,y:d,width:l,height:c},s)})}else if(i==="ellipse"){var h=n.rx,v=n.ry;t.setClip({type:"ellipse",attrs:P({x:a,y:o,rx:h,ry:v},s)})}else if(i==="polygon"){var p=n.points;t.setClip({type:"polygon",attrs:P({points:p},s)})}else if(i==="path"){var g=n.path;t.setClip({type:"path",attrs:P({path:g},s)})}}},getShapeStyle:function(e){var t=this.getOptions(e).style,n=this.getSize(e),i=this.getOptions(e).img,a=n[0],o=n[1];t&&(a=t.width||n[0],o=t.height||n[1]);var s=P({x:-a/2,y:-o/2,width:a,height:o,img:i},t);return s},updateShapeStyle:function(e,t){var n=t.getContainer(),i=this.itemType+"-shape",a=n.find(function(s){return s.get("className")===i})||t.getKeyShape(),o=this.getShapeStyle(e);a&&a.attr(o)}},"single-node");var EH={triangle:function(e,t,n){e===void 0&&(e=10),t===void 0&&(t=15),n===void 0&&(n=0);var i=n*2,a="M "+i+",0 L "+(i+t)+",-"+e/2+" L "+(i+t)+","+e/2+" Z";return a},vee:function(e,t,n){e===void 0&&(e=15),t===void 0&&(t=20),n===void 0&&(n=0);var i=n*2,a="M "+i+",0 L "+(i+t)+",-"+e/2+`
        L `+(i+2*t/3)+",0 L "+(i+t)+","+e/2+" Z";return a},circle:function(e,t){e===void 0&&(e=5),t===void 0&&(t=0);var n=t*2,i="M "+n+`, 0
            a `+e+","+e+" 0 1,0 "+e*2+`,0
            a `+e+","+e+" 0 1,0 "+-e*2+",0";return i},rect:function(e,t,n){e===void 0&&(e=10),t===void 0&&(t=10),n===void 0&&(n=0);var i=n*2,a="M "+i+","+-e/2+` 
        L `+(i+t)+","+-e/2+` 
        L `+(i+t)+","+e/2+` 
        L `+i+","+e/2+" Z";return a},diamond:function(e,t,n){e===void 0&&(e=15),t===void 0&&(t=15),n===void 0&&(n=0);var i=n*2,a="M "+i+`,0 
        L `+(i+t/2)+","+-e/2+` 
        L `+(i+t)+`,0 
        L `+(i+t/2)+","+e/2+" Z";return a},triangleRect:function(e,t,n,i,a,o){e===void 0&&(e=15),t===void 0&&(t=15),n===void 0&&(n=15),i===void 0&&(i=3),a===void 0&&(a=5),o===void 0&&(o=0);var s=o*2,u=s+t+a,l="M "+s+",0 L "+(s+t)+",-"+e/2+" L "+(s+t)+","+e/2+` Z
            M `+u+", -"+n/2+`
            L `+(u+i)+" -"+n/2+`
            L `+(u+i)+" "+n/2+`
            L `+u+" "+n/2+`
            Z`;return l}},AH={collapse:function(e,t,n){return[["M",e-n,t],["a",n,n,0,1,0,n*2,0],["a",n,n,0,1,0,-n*2,0],["M",e-n+4,t],["L",e+n-4,t]]},expand:function(e,t,n){return[["M",e-n,t],["a",n,n,0,1,0,n*2,0],["a",n,n,0,1,0,-n*2,0],["M",e-n+4,t],["L",e-n+2*n-4,t],["M",e-n+n,t-n+4],["L",e,t+n-4]]},upTriangle:function(e,t,n){var i=n*Math.cos(Math.PI/6),a=n*Math.sin(Math.PI/6);return[["M",e-i,t+a],["L",e+i,t+a],["L",e,t-n],["Z"]]},downTriangle:function(e,t,n){var i=n*Math.cos(Math.PI/6),a=n*Math.sin(Math.PI/6);return[["M",e-i,t-a],["L",e+i,t-a],["L",e,t+n],["Z"]]}},TH=["#5F95FF","#61DDAA","#65789B","#F6BD16","#7262FD","#78D3F8","#9661BC","#F6903D","#008685","#F08BB4"],IH=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",defaultSubjectColors:TH}),CH=hp,Ua=P(P(P(P(P(P({},zY),i9),rH),KW),IH),{transform:CH,mat3:Yj}),MH=function(){function r(e){this.graph=e,this.layoutCfg=e.get("layout")||{},this.layoutType=this.getLayoutType(),this.layoutMethods=[],this.initLayout()}return r.prototype.initLayout=function(){},r.prototype.getLayoutType=function(){return this.getLayoutCfgType(this.layoutCfg)},r.prototype.getLayoutCfgType=function(e){var t=e.type;if(t)return t;var n=e.pipes;return Array.isArray(n)?n.map(function(i){return(i==null?void 0:i.type)||""}):null},r.prototype.isLayoutTypeSame=function(e){var t=this.getLayoutCfgType(e);return Array.isArray(this.layoutType)?this.layoutType.every(function(n,i){return n===t[i]}):(e==null?void 0:e.type)===this.layoutType},r.prototype.refreshLayout=function(){var e=this.graph;!e||(e.get("animate")?e.positionsAnimate():e.refreshPositions())},r.prototype.changeLayout=function(e){this.layoutCfg=e,this.destoryLayoutMethods(),this.layout()},r.prototype.changeData=function(){this.destoryLayoutMethods(),this.layout()},r.prototype.destoryLayoutMethods=function(){var e=this.layoutMethods;e==null||e.forEach(function(t){t.destroy()}),this.layoutMethods=[]},r.prototype.destroyLayout=function(){var e=this.graph;this.destoryLayoutMethods(),e.set("layout",void 0),this.layoutCfg=void 0,this.layoutType=void 0,this.layoutMethods=void 0},r.prototype.setDataFromGraph=function(){for(var e=[],t=[],n=[],i=[],a=[],o=[],s=[],u=this.graph.getNodes(),l=this.graph.getEdges(),c=this.graph.getCombos(),f=u.length,d=0;d<f;d++){var h=u[d];if(!(!h||h.destroyed)){var v=h.getModel();if(!h.isVisible()){t.push(v);continue}e.push(v)}}for(var p=l.length,d=0;d<p;d++){var g=l[d];if(!(!g||g.destroyed)){var v=g.getModel();if(!g.isVisible()){i.push(v);continue}v.isComboEdge?a.push(v):n.push(v)}}for(var y=c.length,d=0;d<y;d++){var m=c[d];if(!m.destroyed){var v=m.getModel();if(!m.isVisible()){i.push(v);continue}o.push(v)}}return{nodes:e,hiddenNodes:t,edges:n,hiddenEdges:i,combos:o,hiddenCombos:s,comboEdges:a}},r.prototype.reLayoutMethod=function(e,t){var n=this;return new Promise(function(i,a){var o=n.graph,s=t==null?void 0:t.type;t.onLayoutEnd=function(){o.emit("aftersublayout",{type:s}),i()},e.init(n.data),s==="force"&&(e.ticking=!1,e.forceSimulation.stop()),o.emit("beforesublayout",{type:s}),e.execute(),e.isCustomLayout&&t.onLayoutEnd&&t.onLayoutEnd()})},r.prototype.relayout=function(e){var t=this,n=this,i=n.graph,a=n.layoutMethods,o=n.layoutCfg;if(e){this.data=this.setDataFromGraph();var s=this.data.nodes;if(!s)return!1;this.initPositions(o.center,s)}i.emit("beforelayout");var u=Promise.resolve();a==null||a.forEach(function(l,c){var f=o[c];u=u.then(function(){return t.reLayoutMethod(l,f)})}),u.then(function(){o.onAllLayoutEnd&&o.onAllLayoutEnd()}).catch(function(l){console.warn("relayout failed",l)})},r.prototype.filterLayoutData=function(e,t){var n=e.nodes,i=e.edges,a=Ti(e,["nodes","edges"]);if(!n)return e;var o,s;on(t==null?void 0:t.nodesFilter)?o=t.nodesFilter:o=function(){return!0};var u=n.filter(o);if(on(t==null?void 0:t.edgesFilter))s=t.edgesFilter;else{var l=u.reduce(function(c,f){return c[f.id]=!0,c},{});s=function(f){return l[f.source]&&l[f.target]}}return P({nodes:u,edges:i.filter(s)},a)},r.prototype.getLayoutBBox=function(e){var t=this.graph,n=tp(t.getNodes(),function(o){return o.getModel().layoutOrder}),i=Object.values(n).map(function(o){var s=WC(o);return s.size=[s.width,s.height],s}),a=Object.values(tp(e,"layoutOrder"));return{groupNodes:a,layoutNodes:i}},r.prototype.layoutAnimate=function(){},r.prototype.moveToZero=function(){var e=this.graph,t=e.get("data"),n=t.nodes;if(!(n[0].x===void 0||n[0].x===null||$p(n[0].x))){for(var i=[0,0],a=n.length,o=0;o<a;o++){var s=n[o];i[0]+=s.x,i[1]+=s.y}i[0]/=n.length,i[1]/=n.length;for(var o=0;o<a;o++){var s=n[o];s.x-=i[0],s.y-=i[1]}}},r.prototype.initPositions=function(e,t){var n=this.graph;if(!t)return!1;var i=t?t.length:0;if(!!i){var a=n.get("width")*.85,o=n.get("height")*.85,s=Math.ceil(Math.sqrt(i)*(a/o)),u=Math.ceil(i/s),l=a/(s-1),c=o/(u-1);(!isFinite(l)||!l)&&(l=0),(!isFinite(c)||!l)&&(c=0);for(var f=e[0]-a/2,d=e[1]-o/2,h=!0,v=0;v<i;v++){var p=t[v];$p(+p.x)&&(h=!1,p.x=v%s*l+f),$p(+p.y)&&(h=!1,p.y=Math.floor(v/s)*c+d)}return h}},r.prototype.destroy=function(){this.graph=null,this.destoryLayoutMethods(),this.destroyed=!0},r}(),kH=function(){function r(e){this.graph=e,this.destroyed=!1,this.initEvents()}return r}(),Zp;(function(r){r.CLICK="click",r.DBLCLICK="dblclick",r.MOUSEDOWN="mousedown",r.MOUDEUP="mouseup",r.CONTEXTMENU="contextmenu",r.MOUSEENTER="mouseenter",r.MOUSEOUT="mouseout",r.MOUSEOVER="mouseover",r.MOUSEMOVE="mousemove",r.MOUSELEAVE="mouseleave",r.DRAGSTART="dragstart",r.DRAGEND="dragend",r.DRAG="drag",r.DRAGENTER="dragenter",r.DRAGLEAVE="dragleave",r.DRAGOVER="dragover",r.DRAGOUT="dragout",r.DDROP="drop",r.KEYUP="keyup",r.KEYDOWN="keydown",r.WHEEL="wheel",r.FOCUS="focus",r.BLUR="blur",r.TOUCHSTART="touchstart",r.TOUCHMOVE="touchmove",r.TOUCHEND="touchend",r.CANVAS_TOUCHSTART="canvas:touchstart",r.CANVAS_TOUCHMOVE="canvas:touchmove",r.CANVAS_TOUCHEND="canvas:touchend",r.NODE_TOUCHSTART="node:touchstart",r.NODE_TOUCHMOVE="node:touchmove",r.NODE_TOUCHEND="node:touchend",r.COMBO_TOUCHSTART="combo:touchstart",r.COMBO_TOUCHMOVE="combo:touchmove",r.COMBO_TOUCHEND="combo:touchend",r.EDGE_TOUCHSTART="edge:touchstart",r.EDGE_TOUCHMOVE="edge:touchmove",r.EDGE_TOUCHEND="edge:touchend",r.NODE_CONTEXTMENU="node:contextmenu",r.NODE_CLICK="node:click",r.NODE_DBLCLICK="node:dblclick",r.NODE_MOUSEDOWN="node:mousedown",r.NODE_MOUSEUP="node:mouseup",r.NODE_MOUSEENTER="node:mouseenter",r.NODE_MOUSELEAVE="node:mouseleave",r.NODE_MOUSEMOVE="node:mousemove",r.NODE_MOUSEOUT="node:mouseout",r.NODE_MOUSEOVER="node:mouseover",r.NODE_DROP="node:drop",r.NODE_DRAGOVER="node:dragover",r.NODE_DRAGENTER="node:dragenter",r.NODE_DRAGLEAVE="node:dragleave",r.NODE_DRAGSTART="node:dragstart",r.NODE_DRAG="node:drag",r.NODE_DRAGEND="node:dragend",r.NODE_TAP="node:tap",r.NODE_PANSTART="node:panstart",r.NODE_PANMOVE="node:panmove",r.NODE_PANEND="node:panend",r.COMBO_CONTEXTMENU="combo:contextmenu",r.COMBO_CLICK="combo:click",r.COMBO_DBLCLICK="combo:dblclick",r.COMBO_MOUSEDOWN="combo:mousedown",r.COMBO_MOUSEUP="combo:mouseup",r.COMBO_MOUSEENTER="combo:mouseenter",r.COMBO_MOUSELEAVE="combo:mouseleave",r.COMBO_MOUSEMOVE="combo:mousemove",r.COMBO_MOUSEOUT="combo:mouseout",r.COMBO_MOUSEOVER="combo:mouseover",r.COMBO_DROP="combo:drop",r.COMBO_DRAGOVER="combo:dragover",r.COMBO_DRAGENTER="combo:dragenter",r.COMBO_DRAGLEAVE="combo:dragleave",r.COMBO_DRAGSTART="combo:dragstart",r.COMBO_DRAG="combo:drag",r.COMBO_DRAGEND="combo:dragend",r.COMBO_TAP="combo:tap",r.COMBO_PANSTART="combo:panstart",r.COMBO_PANMOVE="combo:panmove",r.COMBO_PANEND="combo:panend",r.EDGE_CONTEXTMENU="edge:contextmenu",r.EDGE_CLICK="edge:click",r.EDGE_DBLCLICK="edge:dblclick",r.EDGE_MOUSEDOWN="edge:mousedown",r.EDGE_MOUSEUP="edge:mouseup",r.EDGE_MOUSEENTER="edge:mouseenter",r.EDGE_MOUSELEAVE="edge:mouseleave",r.EDGE_MOUSEMOVE="edge:mousemove",r.EDGE_MOUSEOUT="edge:mouseout",r.EDGE_MOUSEOVER="edge:mouseover",r.EDGE_DROP="edge:drop",r.EDGE_DRAGOVER="edge:dragover",r.EDGE_DRAGENTER="edge:dragenter",r.EDGE_DRAGLEAVE="edge:dragleave",r.CANVAS_CONTEXTMENU="canvas:contextmenu",r.CANVAS_CLICK="canvas:click",r.CANVAS_DBLCLICK="canvas:dblclick",r.CANVAS_MOUSEDOWN="canvas:mousedown",r.CANVAS_MOUSEUP="canvas:mouseup",r.CANVAS_MOUSEENTER="canvas:mouseenter",r.CANVAS_MOUSELEAVE="canvas:mouseleave",r.CANVAS_MOUSEMOVE="canvas:mousemove",r.CANVAS_MOUSEOUT="canvas:mouseout",r.CANVAS_MOUSEOVER="canvas:mouseover",r.CANVAS_DROP="canvas:drop",r.CANVAS_DRAGENTER="canvas:dragenter",r.CANVAS_DRAGLEAVE="canvas:dragleave",r.CANVAS_DRAGSTART="canvas:dragstart",r.CANVAS_DRAG="canvas:drag",r.CANVAS_DRAGEND="canvas:dragend",r.CANVAS_TAP="canvas:tap",r.CANVAS_PANSTART="canvas:panstart",r.CANVAS_PANMOVE="canvas:panmove",r.CANVAS_PANEND="canvas:panend",r.BEFORERENDER="beforerender",r.AFTERRENDER="afterrender",r.BEFOREADDITEM="beforeadditem",r.AFTERADDITEM="afteradditem",r.BEFOREREMOVEITEM="beforeremoveitem",r.AFTERREMOVEITEM="afterremoveitem",r.BEFOREUPDATEITEM="beforeupdateitem",r.AFTERUPDATEITEM="afterupdateitem",r.BEFOREITEMVISIBILITYCHANGE="beforeitemvisibilitychange",r.AFTERITEMVISIBILITYCHANGE="afteritemvisibilitychange",r.BEFOREITEMSTATECHANGE="beforeitemstatechange",r.AFTERITEMSTATECHANGE="afteritemstatechange",r.BEFOREITEMREFRESH="beforeitemrefresh",r.AFTERITEMREFRESH="afteritemrefresh",r.BEFOREITEMSTATESCLEAR="beforeitemstatesclear",r.AFTERITEMSTATESCLEAR="afteritemstatesclear",r.BEFOREMODECHANGE="beforemodechange",r.AFTERMODECHANGE="aftermodechange",r.BEFORELAYOUT="beforelayout",r.AFTERLAYOUT="afterlayout",r.BEFORECREATEEDGE="beforecreateedge",r.AFTERCREATEEDGE="aftercreateedge",r.BEFOREGRAPHREFRESHPOSITION="beforegraphrefreshposition",r.AFTERGRAPHREFRESHPOSITION="aftergraphrefreshposition",r.BEFOREGRAPHREFRESH="beforegraphrefresh",r.AFTERGRAPHREFRESH="aftergraphrefresh",r.BEFOREANIMATE="beforeanimate",r.AFTERANIMATE="afteranimate",r.BEFOREPAINT="beforepaint",r.AFTERPAINT="afterpaint",r.BEFORECOLLAPSEEXPANDCOMBO="beforecollapseexpandcombo",r.AFTERCOLLAPSEEXPANDCOMBO="aftercollapseexpandcombo",r.GRAPHSTATECHANGE="graphstatechange",r.AFTERACTIVATERELATIONS="afteractivaterelations",r.NODESELECTCHANGE="nodeselectchange",r.TOOLTIPCHANGE="tooltipchange",r.WHEELZOOM="wheelzoom",r.VIEWPORTCHANGE="viewportchange",r.DRAGNODEEND="dragnodeend",r.STACKCHANGE="stackchange",r.TAP="tap",r.PINCHSTART="pinchstart",r.PINCHMOVE="pinchmove",r.PANSTART="panstart",r.PANMOVE="panmove",r.PANEND="panend"})(Zp||(Zp={}));var Wo=hn.registerNode,gM=hn.registerEdge,DH=hn.registerCombo,yM=WA.registerBehavior,vt=kt,R1={},wr={},Qp={},Ds={};Object.defineProperty(Ds,"__esModule",{value:!0});Ds.MESSAGE=Ds.ALGORITHM=void 0;var LH={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"};Ds.ALGORITHM=LH;var NH={SUCCESS:"SUCCESS",FAILURE:"FAILURE"};Ds.MESSAGE=NH;var Jp={},mM={},Xu={};Object.defineProperty(Xu,"__esModule",{value:!0});Xu.default=void 0;var OH=function(e,t){var n=e.nodes,i=e.edges,a=[],o={};if(!n)throw new Error("invalid nodes data!");return n&&n.forEach(function(s,u){o[s.id]=u;var l=[];a.push(l)}),i&&i.forEach(function(s){var u=s.source,l=s.target,c=o[u],f=o[l];!c&&c!==0||!f&&f!==0||(a[c][f]=1,t||(a[f][c]=1))}),a},PH=OH;Xu.default=PH;var eg={},tg={},vc={};Object.defineProperty(vc,"__esModule",{value:!0});vc.default=vc.LinkedListNode=void 0;var RH=function(e,t){return e===t},B1=function(){function r(e,t){t===void 0&&(t=null),this.value=e,this.next=t}return r.prototype.toString=function(e){return e?e(this.value):""+this.value},r}();vc.LinkedListNode=B1;var BH=function(){function r(e){e===void 0&&(e=RH),this.head=null,this.tail=null,this.compare=e}return r.prototype.prepend=function(e){var t=new B1(e,this.head);return this.head=t,this.tail||(this.tail=t),this},r.prototype.append=function(e){var t=new B1(e);return this.head?(this.tail.next=t,this.tail=t,this):(this.head=t,this.tail=t,this)},r.prototype.delete=function(e){if(!this.head)return null;for(var t=null;this.head&&this.compare(this.head.value,e);)t=this.head,this.head=this.head.next;var n=this.head;if(n!==null)for(;n.next;)this.compare(n.next.value,e)?(t=n.next,n.next=n.next.next):n=n.next;return this.compare(this.tail.value,e)&&(this.tail=n),t},r.prototype.find=function(e){var t=e.value,n=t===void 0?void 0:t,i=e.callback,a=i===void 0?void 0:i;if(!this.head)return null;for(var o=this.head;o;){if(a&&a(o.value)||n!==void 0&&this.compare(o.value,n))return o;o=o.next}return null},r.prototype.deleteTail=function(){var e=this.tail;if(this.head===this.tail)return this.head=null,this.tail=null,e;for(var t=this.head;t.next;)t.next.next?t=t.next:t.next=null;return this.tail=t,e},r.prototype.deleteHead=function(){if(!this.head)return null;var e=this.head;return this.head.next?this.head=this.head.next:(this.head=null,this.tail=null),e},r.prototype.fromArray=function(e){var t=this;return e.forEach(function(n){return t.append(n)}),this},r.prototype.toArray=function(){for(var e=[],t=this.head;t;)e.push(t),t=t.next;return e},r.prototype.reverse=function(){for(var e=this.head,t=null,n=null;e;)n=e.next,e.next=t,t=e,e=n;this.tail=this.head,this.head=t},r.prototype.toString=function(e){return e===void 0&&(e=void 0),this.toArray().map(function(t){return t.toString(e)}).toString()},r}(),FH=BH;vc.default=FH;Object.defineProperty(tg,"__esModule",{value:!0});tg.default=void 0;var UH=GH(vc);function GH(r){return r&&r.__esModule?r:{default:r}}var zH=function(){function r(){this.linkedList=new UH.default}return r.prototype.isEmpty=function(){return!this.linkedList.head},r.prototype.peek=function(){return this.linkedList.head?this.linkedList.head.value:null},r.prototype.enqueue=function(e){this.linkedList.append(e)},r.prototype.dequeue=function(){var e=this.linkedList.deleteHead();return e?e.value:null},r.prototype.toString=function(e){return this.linkedList.toString(e)},r}(),$H=zH;tg.default=$H;var Rn={};Object.defineProperty(Rn,"__esModule",{value:!0});Rn.uniqueId=Rn.getEdgesByNodeId=Rn.getOutEdgesNodeId=Rn.getNeighbors=void 0;var VH=function(e,t,n){t===void 0&&(t=[]);var i=t.filter(function(u){return u.source===e||u.target===e});if(n==="target"){var a=function(l){return l.source===e};return i.filter(a).map(function(u){return u.target})}if(n==="source"){var o=function(l){return l.target===e};return i.filter(o).map(function(u){return u.source})}var s=function(l){return l.source===e?l.target:l.source};return i.map(s)};Rn.getNeighbors=VH;var jH=function(e,t){return t.filter(function(n){return n.source===e})};Rn.getOutEdgesNodeId=jH;var WH=function(e,t){return t.filter(function(n){return n.source===e||n.target===e})};Rn.getEdgesByNodeId=WH;var XH=function(e){e===void 0&&(e=0);var t=(""+Math.random()).split(".")[1].substr(0,5),n=(""+Math.random()).split(".")[1].substr(0,5);return e+"-"+t+n};Rn.uniqueId=XH;Object.defineProperty(eg,"__esModule",{value:!0});eg.default=void 0;var YH=qH(tg),HH=Rn;function qH(r){return r&&r.__esModule?r:{default:r}}function KH(r){r===void 0&&(r={});var e=r,t=function(){},n=function(){var i={};return function(a){var o=a.next,s=o;return i[s]?!1:(i[s]=!0,!0)}}();return e.allowTraversal=r.allowTraversal||n,e.enter=r.enter||t,e.leave=r.leave||t,e}var ZH=function(e,t,n,i){i===void 0&&(i=!0);var a=KH(n),o=new YH.default,s=e.edges,u=s===void 0?[]:s;o.enqueue(t);for(var l="",c=function(){var d=o.dequeue();a.enter({current:d,previous:l}),(0,HH.getNeighbors)(d,u,i?"target":void 0).forEach(function(h){a.allowTraversal({previous:l,current:d,next:h})&&o.enqueue(h)}),a.leave({current:d,previous:l}),l=d};!o.isEmpty();)c()},QH=ZH;eg.default=QH;var Ls={};Object.defineProperty(Ls,"__esModule",{value:!0});Ls.default=JH;Ls.detectStrongConnectComponents=Ls.detectConnectedComponents=void 0;var bM=Rn,wM=function(e){for(var t=e.nodes,n=t===void 0?[]:t,i=e.edges,a=i===void 0?[]:i,o=[],s={},u=[],l=function h(v){u.push(v),s[v.id]=!0;for(var p=(0,bM.getNeighbors)(v.id,a),g=function(b){var w=p[b];if(!s[w]){var x=n.filter(function(_){return _.id===w});x.length>0&&h(x[0])}},y=0;y<p.length;++y)g(y)},c=0;c<n.length;c++){var f=n[c];if(!s[f.id]){l(f);for(var d=[];u.length>0;)d.push(u.pop());o.push(d)}}return o};Ls.detectConnectedComponents=wM;var xM=function(e){for(var t=e.nodes,n=t===void 0?[]:t,i=e.edges,a=i===void 0?[]:i,o=[],s={},u={},l={},c=[],f=0,d=function g(y){u[y.id]=f,l[y.id]=f,f+=1,o.push(y),s[y.id]=!0;for(var m=(0,bM.getNeighbors)(y.id,a,"target").filter(function(A){return n.map(function(I){return I.id}).indexOf(A)>-1}),b=function(I){var M=m[I];if(!u[M]&&u[M]!==0){var S=n.filter(function(C){return C.id===M});S.length>0&&g(S[0]),l[y.id]=Math.min(l[y.id],l[M])}else s[M]&&(l[y.id]=Math.min(l[y.id],u[M]))},w=0;w<m.length;w++)b(w);if(l[y.id]===u[y.id]){for(var x=[];o.length>0;){var _=o.pop();if(s[_.id]=!1,x.push(_),_===y)break}x.length>0&&c.push(x)}},h=0,v=n;h<v.length;h++){var p=v[h];!u[p.id]&&u[p.id]!==0&&d(p)}return c};Ls.detectStrongConnectComponents=xM;function JH(r,e){return e?xM(r):wM(r)}var Xo={};Object.defineProperty(Xo,"__esModule",{value:!0});Xo.getOutDegree=Xo.getInDegree=Xo.default=void 0;var wh=function(e){var t={},n=e.nodes,i=n===void 0?[]:n,a=e.edges,o=a===void 0?[]:a;return i.forEach(function(s){t[s.id]={degree:0,inDegree:0,outDegree:0}}),o.forEach(function(s){t[s.source].degree++,t[s.source].outDegree++,t[s.target].degree++,t[s.target].inDegree++}),t},e7=wh;Xo.default=e7;var t7=function(e,t){var n=wh(e);return n[t]?wh(e)[t].inDegree:0};Xo.getInDegree=t7;var r7=function(e,t){var n=wh(e);return n[t]?wh(e)[t].outDegree:0};Xo.getOutDegree=r7;var ho={},rg={};Object.defineProperty(rg,"__esModule",{value:!0});rg.default=a7;var n7=Rn;function i7(r){r===void 0&&(r={});var e=r,t=function(){},n=function(){var i={};return function(a){var o=a.next;return i[o]?!1:(i[o]=!0,!0)}}();return e.allowTraversal=r.allowTraversal||n,e.enter=r.enter||t,e.leave=r.leave||t,e}function _M(r,e,t,n){n.enter({current:e,previous:t});var i=r.edges,a=i===void 0?[]:i;(0,n7.getNeighbors)(e,a,"target").forEach(function(o){n.allowTraversal({previous:t,current:e,next:o})&&_M(r,o,e,n)}),n.leave({current:e,previous:t})}function a7(r,e,t){_M(r,e,"",i7(t))}function ng(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ng=function(t){return typeof t}:ng=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ng(r)}Object.defineProperty(ho,"__esModule",{value:!0});ho.default=ho.detectAllCycles=ho.detectAllDirectedCycle=ho.detectAllUndirectedCycle=void 0;var o7=u7(rg),SM=s7(Ls),EM=Rn;function AM(){if(typeof WeakMap!="function")return null;var r=new WeakMap;return AM=function(){return r},r}function s7(r){if(r&&r.__esModule)return r;if(r===null||ng(r)!=="object"&&typeof r!="function")return{default:r};var e=AM();if(e&&e.has(r))return e.get(r);var t={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in r)if(Object.prototype.hasOwnProperty.call(r,i)){var a=n?Object.getOwnPropertyDescriptor(r,i):null;a&&(a.get||a.set)?Object.defineProperty(t,i,a):t[i]=r[i]}return t.default=r,e&&e.set(r,t),t}function u7(r){return r&&r.__esModule?r:{default:r}}var l7=function(e){var t=null,n=e.nodes,i=n===void 0?[]:n,a={},o={},s={},u={};i.forEach(function(f){o[f.id]=f});for(var l={enter:function(d){var h=d.current,v=d.previous;if(s[h]){t={};for(var p=h,g=v;g!==h;)t[p]=g,p=g,g=a[g];t[p]=g}else s[h]=h,delete o[h],a[h]=v},leave:function(d){var h=d.current;u[h]=h,delete s[h]},allowTraversal:function(d){var h=d.next;return t?!1:!u[h]}};Object.keys(o).length;){var c=Object.keys(o)[0];(0,o7.default)(e,c,l)}return t},TM=function(e,t,n){var i,a;n===void 0&&(n=!0);for(var o=[],s=(0,SM.default)(e,!1),u=0,l=s;u<l.length;u++){var c=l[u];if(!!c.length)for(var f=c[0],d=f.id,h=[f],v=(i={},i[d]=f,i),p=(a={},a[d]=new Set,a);h.length>0;)for(var g=h.pop(),y=g.id,m=(0,EM.getNeighbors)(y,e.edges),b=function(_){var A,I=m[_],M=e.nodes.find(function(B){return B.id===I});if(I===y)o.push((A={},A[I]=g,A));else if(!(I in p))v[I]=g,h.push(M),p[I]=new Set([g]);else if(!p[y].has(M)){for(var S=!0,C=[M,g],T=v[y];p[I].size&&!p[I].has(T)&&(C.push(T),T!==v[T.id]);)T=v[T.id];if(C.push(T),t&&n?(S=!1,C.findIndex(function(B){return t.indexOf(B.id)>-1})>-1&&(S=!0)):t&&!n&&C.findIndex(function(B){return t.indexOf(B.id)>-1})>-1&&(S=!1),S){for(var k={},L=1;L<C.length;L+=1)k[C[L-1].id]=C[L];C.length&&(k[C[C.length-1].id]=C[0]),o.push(k)}p[I].add(g)}},w=0;w<m.length;w+=1)b(w)}return o};ho.detectAllUndirectedCycle=TM;var IM=function(e,t,n){n===void 0&&(n=!0);for(var i=[],a=new Set,o=[],s=[],u={},l={},c=function(T){for(var k=[T];k.length>0;){var L=k.pop();a.has(L)&&(a.delete(L),o[L.id].forEach(function(B){k.push(B)}),o[L.id].clear())}},f=function C(T,k,L){var B=!1;if(t&&n===!1&&t.indexOf(T.id)>-1)return B;i.push(T),a.add(T);for(var ee=L[T.id],K=0;K<ee.length;K+=1){var z=u[ee[K]];if(z===k){for(var X={},H=1;H<i.length;H+=1)X[i[H-1].id]=i[H];i.length&&(X[i[i.length-1].id]=i[0]),s.push(X),B=!0}else a.has(z)||C(z,k,L)&&(B=!0)}if(B)c(T);else for(var K=0;K<ee.length;K+=1){var z=u[ee[K]];o[z.id].has(T)||o[z.id].add(T)}return i.pop(),B},d=e.nodes,h=d===void 0?[]:d,v=0;v<h.length;v+=1){var p=h[v],g=p.id;l[g]=v,u[v]=p}if(t&&n)for(var y=function(T){var k=t[T];l[h[T].id]=l[k],l[k]=0,u[0]=h.find(function(L){return L.id===k}),u[l[h[T].id]]=h[T]},v=0;v<t.length;v++)y(v);for(var m=function(T){for(var k,L,B=1/0,ee=0;ee<T.length;ee+=1)for(var K=T[ee],z=0;z<K.length;z++){var X=l[K[z].id];X<B&&(B=X,L=ee)}for(var H=T[L],J=[],ee=0;ee<H.length;ee+=1){var ne=H[ee];J[ne.id]=[];for(var me=0,oe=(0,EM.getNeighbors)(ne.id,e.edges,"target").filter(function(qe){return H.map(function(ft){return ft.id}).indexOf(qe)>-1});me<oe.length;me++){var Ae=oe[me];Ae===ne.id&&!(n===!1&&t.indexOf(ne.id)>-1)?s.push((k={},k[ne.id]=ne,k)):J[ne.id].push(l[Ae])}}return{component:H,adjList:J,minIdx:B}},b=0;b<h.length;){var w=h.filter(function(C){return l[C.id]>=b}),x=(0,SM.detectStrongConnectComponents)({nodes:w,edges:e.edges}).filter(function(C){return C.length>1});if(x.length===0)break;var _=m(x),A=_.minIdx,I=_.adjList,M=_.component;if(M.length>1){M.forEach(function(C){o[C.id]=new Set});var S=u[A];if(t&&n&&t.indexOf(S.id)===-1)return s;f(S,S,I),b=A+1}else break}return s};ho.detectAllDirectedCycle=IM;var c7=function(e,t,n,i){return i===void 0&&(i=!0),t?IM(e,n,i):TM(e,n,i)};ho.detectAllCycles=c7;var f7=l7;ho.default=f7;var pc={},F1={exports:{}};/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */(function(r){var e,t,n,i,a,o,s,u,l,c,f,d,h,v,p,g,y,m,b,w,x,_,A,I;(function(M){var S=typeof sf=="object"?sf:typeof self=="object"?self:typeof this=="object"?this:{};M(C(S,C(r.exports)));function C(T,k){return T!==S&&(typeof Object.create=="function"?Object.defineProperty(T,"__esModule",{value:!0}):T.__esModule=!0),function(L,B){return T[L]=k?k(L,B):B}}})(function(M){var S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(T,k){T.__proto__=k}||function(T,k){for(var L in k)Object.prototype.hasOwnProperty.call(k,L)&&(T[L]=k[L])};e=function(T,k){if(typeof k!="function"&&k!==null)throw new TypeError("Class extends value "+String(k)+" is not a constructor or null");S(T,k);function L(){this.constructor=T}T.prototype=k===null?Object.create(k):(L.prototype=k.prototype,new L)},t=Object.assign||function(T){for(var k,L=1,B=arguments.length;L<B;L++){k=arguments[L];for(var ee in k)Object.prototype.hasOwnProperty.call(k,ee)&&(T[ee]=k[ee])}return T},n=function(T,k){var L={};for(var B in T)Object.prototype.hasOwnProperty.call(T,B)&&k.indexOf(B)<0&&(L[B]=T[B]);if(T!=null&&typeof Object.getOwnPropertySymbols=="function")for(var ee=0,B=Object.getOwnPropertySymbols(T);ee<B.length;ee++)k.indexOf(B[ee])<0&&Object.prototype.propertyIsEnumerable.call(T,B[ee])&&(L[B[ee]]=T[B[ee]]);return L},i=function(T,k,L,B){var ee=arguments.length,K=ee<3?k:B===null?B=Object.getOwnPropertyDescriptor(k,L):B,z;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")K=Reflect.decorate(T,k,L,B);else for(var X=T.length-1;X>=0;X--)(z=T[X])&&(K=(ee<3?z(K):ee>3?z(k,L,K):z(k,L))||K);return ee>3&&K&&Object.defineProperty(k,L,K),K},a=function(T,k){return function(L,B){k(L,B,T)}},o=function(T,k){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(T,k)},s=function(T,k,L,B){function ee(K){return K instanceof L?K:new L(function(z){z(K)})}return new(L||(L=Promise))(function(K,z){function X(ne){try{J(B.next(ne))}catch(me){z(me)}}function H(ne){try{J(B.throw(ne))}catch(me){z(me)}}function J(ne){ne.done?K(ne.value):ee(ne.value).then(X,H)}J((B=B.apply(T,k||[])).next())})},u=function(T,k){var L={label:0,sent:function(){if(K[0]&1)throw K[1];return K[1]},trys:[],ops:[]},B,ee,K,z;return z={next:X(0),throw:X(1),return:X(2)},typeof Symbol=="function"&&(z[Symbol.iterator]=function(){return this}),z;function X(J){return function(ne){return H([J,ne])}}function H(J){if(B)throw new TypeError("Generator is already executing.");for(;L;)try{if(B=1,ee&&(K=J[0]&2?ee.return:J[0]?ee.throw||((K=ee.return)&&K.call(ee),0):ee.next)&&!(K=K.call(ee,J[1])).done)return K;switch(ee=0,K&&(J=[J[0]&2,K.value]),J[0]){case 0:case 1:K=J;break;case 4:return L.label++,{value:J[1],done:!1};case 5:L.label++,ee=J[1],J=[0];continue;case 7:J=L.ops.pop(),L.trys.pop();continue;default:if(K=L.trys,!(K=K.length>0&&K[K.length-1])&&(J[0]===6||J[0]===2)){L=0;continue}if(J[0]===3&&(!K||J[1]>K[0]&&J[1]<K[3])){L.label=J[1];break}if(J[0]===6&&L.label<K[1]){L.label=K[1],K=J;break}if(K&&L.label<K[2]){L.label=K[2],L.ops.push(J);break}K[2]&&L.ops.pop(),L.trys.pop();continue}J=k.call(T,L)}catch(ne){J=[6,ne],ee=0}finally{B=K=0}if(J[0]&5)throw J[1];return{value:J[0]?J[1]:void 0,done:!0}}},l=function(T,k){for(var L in T)L!=="default"&&!Object.prototype.hasOwnProperty.call(k,L)&&I(k,T,L)},I=Object.create?function(T,k,L,B){B===void 0&&(B=L),Object.defineProperty(T,B,{enumerable:!0,get:function(){return k[L]}})}:function(T,k,L,B){B===void 0&&(B=L),T[B]=k[L]},c=function(T){var k=typeof Symbol=="function"&&Symbol.iterator,L=k&&T[k],B=0;if(L)return L.call(T);if(T&&typeof T.length=="number")return{next:function(){return T&&B>=T.length&&(T=void 0),{value:T&&T[B++],done:!T}}};throw new TypeError(k?"Object is not iterable.":"Symbol.iterator is not defined.")},f=function(T,k){var L=typeof Symbol=="function"&&T[Symbol.iterator];if(!L)return T;var B=L.call(T),ee,K=[],z;try{for(;(k===void 0||k-- >0)&&!(ee=B.next()).done;)K.push(ee.value)}catch(X){z={error:X}}finally{try{ee&&!ee.done&&(L=B.return)&&L.call(B)}finally{if(z)throw z.error}}return K},d=function(){for(var T=[],k=0;k<arguments.length;k++)T=T.concat(f(arguments[k]));return T},h=function(){for(var T=0,k=0,L=arguments.length;k<L;k++)T+=arguments[k].length;for(var B=Array(T),ee=0,k=0;k<L;k++)for(var K=arguments[k],z=0,X=K.length;z<X;z++,ee++)B[ee]=K[z];return B},v=function(T,k,L){if(L||arguments.length===2)for(var B=0,ee=k.length,K;B<ee;B++)(K||!(B in k))&&(K||(K=Array.prototype.slice.call(k,0,B)),K[B]=k[B]);return T.concat(K||Array.prototype.slice.call(k))},p=function(T){return this instanceof p?(this.v=T,this):new p(T)},g=function(T,k,L){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var B=L.apply(T,k||[]),ee,K=[];return ee={},z("next"),z("throw"),z("return"),ee[Symbol.asyncIterator]=function(){return this},ee;function z(oe){B[oe]&&(ee[oe]=function(Ae){return new Promise(function(ze,qe){K.push([oe,Ae,ze,qe])>1||X(oe,Ae)})})}function X(oe,Ae){try{H(B[oe](Ae))}catch(ze){me(K[0][3],ze)}}function H(oe){oe.value instanceof p?Promise.resolve(oe.value.v).then(J,ne):me(K[0][2],oe)}function J(oe){X("next",oe)}function ne(oe){X("throw",oe)}function me(oe,Ae){oe(Ae),K.shift(),K.length&&X(K[0][0],K[0][1])}},y=function(T){var k,L;return k={},B("next"),B("throw",function(ee){throw ee}),B("return"),k[Symbol.iterator]=function(){return this},k;function B(ee,K){k[ee]=T[ee]?function(z){return(L=!L)?{value:p(T[ee](z)),done:ee==="return"}:K?K(z):z}:K}},m=function(T){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var k=T[Symbol.asyncIterator],L;return k?k.call(T):(T=typeof c=="function"?c(T):T[Symbol.iterator](),L={},B("next"),B("throw"),B("return"),L[Symbol.asyncIterator]=function(){return this},L);function B(K){L[K]=T[K]&&function(z){return new Promise(function(X,H){z=T[K](z),ee(X,H,z.done,z.value)})}}function ee(K,z,X,H){Promise.resolve(H).then(function(J){K({value:J,done:X})},z)}},b=function(T,k){return Object.defineProperty?Object.defineProperty(T,"raw",{value:k}):T.raw=k,T};var C=Object.create?function(T,k){Object.defineProperty(T,"default",{enumerable:!0,value:k})}:function(T,k){T.default=k};w=function(T){if(T&&T.__esModule)return T;var k={};if(T!=null)for(var L in T)L!=="default"&&Object.prototype.hasOwnProperty.call(T,L)&&I(k,T,L);return C(k,T),k},x=function(T){return T&&T.__esModule?T:{default:T}},_=function(T,k,L,B){if(L==="a"&&!B)throw new TypeError("Private accessor was defined without a getter");if(typeof k=="function"?T!==k||!B:!k.has(T))throw new TypeError("Cannot read private member from an object whose class did not declare it");return L==="m"?B:L==="a"?B.call(T):B?B.value:k.get(T)},A=function(T,k,L,B,ee){if(B==="m")throw new TypeError("Private method is not writable");if(B==="a"&&!ee)throw new TypeError("Private accessor was defined without a setter");if(typeof k=="function"?T!==k||!ee:!k.has(T))throw new TypeError("Cannot write private member to an object whose class did not declare it");return B==="a"?ee.call(T,L):ee?ee.value=L:k.set(T,L),L},M("__extends",e),M("__assign",t),M("__rest",n),M("__decorate",i),M("__param",a),M("__metadata",o),M("__awaiter",s),M("__generator",u),M("__exportStar",l),M("__createBinding",I),M("__values",c),M("__read",f),M("__spread",d),M("__spreadArrays",h),M("__spreadArray",v),M("__await",p),M("__asyncGenerator",g),M("__asyncDelegator",y),M("__asyncValues",m),M("__makeTemplateObject",b),M("__importStar",w),M("__importDefault",x),M("__classPrivateFieldGet",_),M("__classPrivateFieldSet",A)})})(F1);var U1=IU(xj);Object.defineProperty(pc,"__esModule",{value:!0});pc.default=void 0;var CM=F1.exports,h7=U1,MM=Rn,d7=function(e,t,n){for(var i=1/0,a,o=0;o<t.length;o++){var s=t[o].id;!n[s]&&e[s]<=i&&(i=e[s],a=t[o])}return a},v7=function(e,t,n,i){var a=e.nodes,o=a===void 0?[]:a,s=e.edges,u=s===void 0?[]:s,l={},c={},f={};o.forEach(function(m,b){var w=m.id;c[w]=1/0,w===t&&(c[w]=0)});for(var d=o.length,h=function(b){var w=d7(c,o,l),x=w.id;if(l[x]=!0,c[x]===1/0)return"continue";var _=[];n?_=(0,MM.getOutEdgesNodeId)(x,u):_=(0,MM.getEdgesByNodeId)(x,u),_.forEach(function(A){var I=A.target,M=A.source,S=I===x?M:I,C=i&&A[i]?A[i]:1;c[S]>c[w.id]+C?(c[S]=c[w.id]+C,f[S]=[w.id]):c[S]===c[w.id]+C&&f[S].push(w.id)})},v=0;v<d;v++)h();f[t]=[t];var p={};for(var g in c)c[g]!==1/0&&kM(t,g,f,p);var y={};for(var g in p)y[g]=p[g][0];return{length:c,path:y,allPath:p}},p7=v7;pc.default=p7;function kM(r,e,t,n){if(r===e)return[r];if(n[e])return n[e];for(var i=[],a=0,o=t[e];a<o.length;a++){var s=o[a],u=kM(r,s,t,n);if(!u)return;for(var l=0,c=u;l<c.length;l++){var f=c[l];(0,h7.isArray)(f)?i.push((0,CM.__spreadArray)((0,CM.__spreadArray)([],f),[e])):i.push([f,e])}}return n[e]=i,n[e]}var gc={};Object.defineProperty(gc,"__esModule",{value:!0});gc.findAllPath=gc.findShortestPath=void 0;var g7=y7(pc),ig=Rn;function y7(r){return r&&r.__esModule?r:{default:r}}var m7=function(e,t,n,i,a){var o=(0,g7.default)(e,t,i,a),s=o.length,u=o.path,l=o.allPath;return{length:s[n],path:u[n],allPath:l[n]}};gc.findShortestPath=m7;var b7=function(e,t,n,i){var a;if(t===n)return[[t]];var o=e.edges,s=o===void 0?[]:o,u=[t],l=(a={},a[t]=!0,a),c=[],f=[],d=i?(0,ig.getNeighbors)(t,s,"target"):(0,ig.getNeighbors)(t,s);for(c.push(d);u.length>0&&c.length>0;){var h=c[c.length-1];if(h.length){var v=h.shift();v&&(u.push(v),l[v]=!0,d=i?(0,ig.getNeighbors)(v,s,"target"):(0,ig.getNeighbors)(v,s),c.push(d.filter(function(y){return!l[y]})))}else{var p=u.pop();l[p]=!1,c.pop();continue}if(u[u.length-1]===n){var g=u.map(function(m){return m});f.push(g);var p=u.pop();l[p]=!1,c.pop()}}return f};gc.findAllPath=b7;var xh={};Object.defineProperty(xh,"__esModule",{value:!0});xh.default=void 0;var w7=x7(Xu);function x7(r){return r&&r.__esModule?r:{default:r}}var _7=function(e,t){for(var n=(0,w7.default)(e,t),i=[],a=n.length,o=0;o<a;o+=1){i[o]=[];for(var s=0;s<a;s+=1)o===s?i[o][s]=0:n[o][s]===0||!n[o][s]?i[o][s]=1/0:i[o][s]=n[o][s]}for(var u=0;u<a;u+=1)for(var o=0;o<a;o+=1)for(var s=0;s<a;s+=1)i[o][s]>i[o][u]+i[u][s]&&(i[o][s]=i[o][u]+i[u][s]);return i},S7=_7;xh.default=S7;var ag={};Object.defineProperty(ag,"__esModule",{value:!0});ag.default=void 0;var E7=T7(Xu),A7=Rn;function T7(r){return r&&r.__esModule?r:{default:r}}var I7=function(e,t,n,i){t===void 0&&(t=!1),n===void 0&&(n="weight"),i===void 0&&(i=1e3);var a=e.nodes,o=a===void 0?[]:a,s=e.edges,u=s===void 0?[]:s,l={},c={};o.forEach(function(b,w){var x=(0,A7.uniqueId)();b.clusterId=x,l[x]={id:x,nodes:[b]},c[b.id]={node:b,idx:w}});var f=(0,E7.default)(e,t),d={};f.forEach(function(b,w){var x=o[w].id;d[x]={},b.forEach(function(_,A){if(!!_){var I=o[A].id;d[x][I]=_}})});for(var h=0,v=function(){var w=!1;if(o.forEach(function(x){var _={};Object.keys(d[x.id]).forEach(function(L){var B=d[x.id][L],ee=c[L].node,K=ee.clusterId;_[K]||(_[K]=0),_[K]+=B});var A=-1/0,I=[];if(Object.keys(_).forEach(function(L){A<_[L]?(A=_[L],I=[L]):A===_[L]&&I.push(L)}),!(I.length===1&&I[0]===x.clusterId)){var M=I.indexOf(x.clusterId);if(M>=0&&I.splice(M,1),I&&I.length){w=!0;var S=l[x.clusterId],C=S.nodes.indexOf(x);S.nodes.splice(C,1);var T=Math.floor(Math.random()*I.length),k=l[I[T]];k.nodes.push(x),x.clusterId=k.id}}}),!w)return"break";h++};h<i;){var p=v();if(p==="break")break}Object.keys(l).forEach(function(b){var w=l[b];(!w.nodes||!w.nodes.length)&&delete l[b]});var g=[],y={};u.forEach(function(b){var w=b.source,x=b.target,_=b[n]||1,A=c[w].node.clusterId,I=c[x].node.clusterId,M=A+"---"+I;if(y[M])y[M].weight+=_,y[M].count++;else{var S={source:A,target:I,weight:_,count:1};y[M]=S,g.push(S)}});var m=[];return Object.keys(l).forEach(function(b){m.push(l[b])}),{clusters:m,clusterEdges:g}},C7=I7;ag.default=C7;var og={};Object.defineProperty(og,"__esModule",{value:!0});og.default=void 0;var M7=k7(Xu);function k7(r){return r&&r.__esModule?r:{default:r}}var D7=function(e,t,n,i){for(var a=t.length,o=2*i,s=0,u=0;u<a;u++)for(var l=e[u].clusterId,c=0;c<a;c++){var f=e[c].clusterId;if(l===f){var d=t[u][c]||0,h=n[u]||0,v=n[c]||0;s+=d-h*v/o}}return s*=1/o,s},L7=function(e,t,n,i){t===void 0&&(t=!1),n===void 0&&(n="weight"),i===void 0&&(i=1e-4);var a=e.nodes,o=a===void 0?[]:a,s=e.edges,u=s===void 0?[]:s,l=1,c={},f={};o.forEach(function(I,M){var S=String(l++);I.clusterId=S,c[S]={id:S,nodes:[I]},f[I.id]={node:I,idx:M}});var d=(0,M7.default)(e,t),h=[],v={},p=0;d.forEach(function(I,M){var S=0,C=o[M].id;v[C]={},I.forEach(function(T,k){if(!!T){S+=T;var L=o[k].id;v[C][L]=T,p+=T}}),h.push(S)}),p/=2;for(var g=1/0,y=1/0,m=0;g=D7(o,d,h,p),!(Math.abs(g-y)<i||m>100);)y=g,m++,Object.keys(c).forEach(function(I){var M=0;u.forEach(function(S){var C=S.source,T=S.target,k=f[C].node.clusterId,L=f[T].node.clusterId;(k===I&&L!==I||L===I&&k!==I)&&(M=M+(S[n]||1))}),c[I].sumTot=M}),o.forEach(function(I,M){var S=c[I.clusterId],C=0,T,k=h[M]/(2*p),L=0,B=S.nodes;B.forEach(function(ne){var me=f[ne.id].idx;L+=d[M][me]||0});var ee=L-S.sumTot*k,K=v[I.id];if(Object.keys(K).forEach(function(ne){var me=f[ne].node,oe=me.clusterId;if(oe!==I.clusterId){var Ae=c[oe],ze=Ae.nodes;if(!(!ze||!ze.length)){var qe=0;ze.forEach(function(st){var gr=f[st.id].idx;qe+=d[M][gr]||0});var ft=qe-Ae.sumTot*k,ct=ft-ee;ct>C&&(C=ct,T=Ae)}}}),C>0){T.nodes.push(I);var z=I.clusterId;I.clusterId=T.id;var X=S.nodes.indexOf(I);S.nodes.splice(X,1);var H=0,J=0;u.forEach(function(ne){var me=ne.source,oe=ne.target,Ae=f[me].node.clusterId,ze=f[oe].node.clusterId;(Ae===T.id&&ze!==T.id||ze===T.id&&Ae!==T.id)&&(H=H+(ne[n]||1)),(Ae===z&&ze!==z||ze===z&&Ae!==z)&&(J=J+(ne[n]||1))}),T.sumTot=H,S.sumTot=J}});var b={},w=0;Object.keys(c).forEach(function(I){var M=c[I];if(!M.nodes||!M.nodes.length){delete c[I];return}var S=String(w+1);S!==I&&(M.id=S,M.nodes=M.nodes.map(function(C){return{id:C.id,clusterId:S}}),c[S]=M,b[I]=S,delete c[I],w++)}),o.forEach(function(I){I.clusterId&&b[I.clusterId]&&(I.clusterId=b[I.clusterId])});var x=[],_={};u.forEach(function(I){var M=I.source,S=I.target,C=I[n]||1,T=f[M].node.clusterId,k=f[S].node.clusterId,L=T+"---"+k;if(_[L])_[L].weight+=C,_[L].count++;else{var B={source:T,target:k,weight:C,count:1};_[L]=B,x.push(B)}});var A=[];return Object.keys(c).forEach(function(I){A.push(c[I])}),{clusters:A,clusterEdges:x}},N7=L7;og.default=N7;var sg={},ug={};Object.defineProperty(ug,"__esModule",{value:!0});ug.default=void 0;var O7=function(){function r(e){this.count=e.length,this.parent={};for(var t=0,n=e;t<n.length;t++){var i=n[t];this.parent[i]=i}}return r.prototype.find=function(e){for(;this.parent[e]!==e;)e=this.parent[e];return e},r.prototype.union=function(e,t){var n=this.find(e),i=this.find(t);n!==i&&(n<i?(this.parent[t]!==t&&this.union(this.parent[t],e),this.parent[t]=this.parent[e]):(this.parent[e]!==e&&this.union(this.parent[e],t),this.parent[e]=this.parent[t]))},r.prototype.connected=function(e,t){return this.find(e)===this.find(t)},r}(),P7=O7;ug.default=P7;var lg={};Object.defineProperty(lg,"__esModule",{value:!0});lg.default=void 0;var R7=function(e,t){return e-t},B7=function(){function r(e){e===void 0&&(e=R7),this.compareFn=e,this.list=[]}return r.prototype.getLeft=function(e){return 2*e+1},r.prototype.getRight=function(e){return 2*e+2},r.prototype.getParent=function(e){return e===0?null:Math.floor((e-1)/2)},r.prototype.isEmpty=function(){return this.list.length<=0},r.prototype.top=function(){return this.isEmpty()?void 0:this.list[0]},r.prototype.delMin=function(){var e=this.top(),t=this.list.pop();return this.list.length>0&&(this.list[0]=t,this.moveDown(0)),e},r.prototype.insert=function(e){if(e!==null){this.list.push(e);var t=this.list.length-1;return this.moveUp(t),!0}return!1},r.prototype.moveUp=function(e){for(var t=this.getParent(e);e&&e>0&&this.compareFn(this.list[t],this.list[e])>0;){var n=this.list[t];this.list[t]=this.list[e],this.list[e]=n,e=t,t=this.getParent(e)}},r.prototype.moveDown=function(e){var t,n=e,i=this.getLeft(e),a=this.getRight(e),o=this.list.length;i!==null&&i<o&&this.compareFn(this.list[n],this.list[i])>0?n=i:a!==null&&a<o&&this.compareFn(this.list[n],this.list[a])>0&&(n=a),e!==n&&(t=[this.list[n],this.list[e]],this.list[e]=t[0],this.list[n]=t[1],this.moveDown(n))},r}(),F7=B7;lg.default=F7;Object.defineProperty(sg,"__esModule",{value:!0});sg.default=void 0;var U7=DM(ug),G7=DM(lg),G1=Rn;function DM(r){return r&&r.__esModule?r:{default:r}}var z7=function(e,t){var n=[],i=e.nodes,a=i===void 0?[]:i,o=e.edges,s=o===void 0?[]:o;if(a.length===0)return n;var u=a[0],l=new Set;l.add(u);var c=function(g,y){return t?g.weight-y.weight:0},f=new G7.default(c);for((0,G1.getEdgesByNodeId)(u.id,s).forEach(function(p){f.insert(p)});!f.isEmpty();){var d=f.delMin(),h=d.source,v=d.target;l.has(h)&&l.has(v)||(n.push(d),l.has(h)||(l.add(h),(0,G1.getEdgesByNodeId)(h,s).forEach(function(p){f.insert(p)})),l.has(v)||(l.add(v),(0,G1.getEdgesByNodeId)(v,s).forEach(function(p){f.insert(p)})))}return n},LM=function(e,t){var n=[],i=e.nodes,a=i===void 0?[]:i,o=e.edges,s=o===void 0?[]:o;if(a.length===0)return n;var u=s.map(function(h){return h});t&&u.sort(function(h,v){return h.weight-v.weight});for(var l=new U7.default(a.map(function(h){return h.id}));u.length>0;){var c=u.shift(),f=c.source,d=c.target;l.connected(f,d)||(n.push(c),l.union(f,d))}return n},$7=function(e,t,n){var i={prim:z7,kruskal:LM};return n?i[n](e,t):LM(e,t)},V7=$7;sg.default=V7;var cg={};Object.defineProperty(cg,"__esModule",{value:!0});cg.default=void 0;var j7=X7(Xo),W7=Rn;function X7(r){return r&&r.__esModule?r:{default:r}}var Y7=function(e,t,n){typeof t!="number"&&(t=1e-6),typeof n!="number"&&(n=.85);for(var i=1,a=0,o=1e3,s=e.nodes,u=s===void 0?[]:s,l=e.edges,c=l===void 0?[]:l,f=u.length,d,h={},v={},p=0;p<f;++p){var g=u[p],y=g.id;h[y]=1/f,v[y]=1/f}for(var m=(0,j7.default)(e);o>0&&i>t;){a=0;for(var p=0;p<f;++p){var g=u[p],y=g.id;if(d=0,m[g.id].inDegree===0)h[y]=0;else{for(var b=(0,W7.getNeighbors)(y,c,"source"),w=0;w<b.length;++w){var x=b[w],_=m[x].outDegree;_>0&&(d+=v[x]/_)}h[y]=n*d,a+=h[y]}}a=(1-a)/f,i=0;for(var p=0;p<f;++p){var g=u[p],y=g.id;d=h[y]+a,i+=Math.abs(d-v[y]),v[y]=d}o-=1}return v},H7=Y7;cg.default=H7;var fg={},hg={},Bn={};Object.defineProperty(Bn,"__esModule",{value:!0});Bn.Graph=Bn.Node=Bn.Edge=Bn.AUTO_EDGE_ID=Bn.VACANT_GRAPH_ID=Bn.VACANT_NODE_LABEL=Bn.VACANT_EDGE_LABEL=Bn.VACANT_NODE_ID=Bn.VACANT_EDGE_ID=void 0;var NM=-1;Bn.VACANT_EDGE_ID=NM;var _h=-1;Bn.VACANT_NODE_ID=_h;var OM="-1";Bn.VACANT_EDGE_LABEL=OM;var PM="-1";Bn.VACANT_NODE_LABEL=PM;var q7=-1;Bn.VACANT_GRAPH_ID=q7;var K7="-1";Bn.AUTO_EDGE_ID=K7;var z1=function(){function r(e,t,n,i){e===void 0&&(e=NM),t===void 0&&(t=_h),n===void 0&&(n=_h),i===void 0&&(i=OM),this.id=e,this.from=t,this.to=n,this.label=i}return r}();Bn.Edge=z1;var RM=function(){function r(e,t){e===void 0&&(e=_h),t===void 0&&(t=PM),this.id=e,this.label=t,this.edges=[],this.edgeMap={}}return r.prototype.addEdge=function(e){this.edges.push(e),this.edgeMap[e.id]=e},r}();Bn.Node=RM;var Z7=function(){function r(e,t,n){e===void 0&&(e=_h),t===void 0&&(t=!0),n===void 0&&(n=!1),this.id=e,this.edgeIdAutoIncrease=t,this.edges=[],this.nodes=[],this.nodeMap={},this.edgeMap={},this.nodeLabelMap={},this.edgeLabelMap={},this.counter=0,this.directed=n}return r.prototype.getNodeNum=function(){return this.nodes.length},r.prototype.addNode=function(e,t){if(!this.nodeMap[e]){var n=new RM(e,t);this.nodes.push(n),this.nodeMap[e]=n,this.nodeLabelMap[t]||(this.nodeLabelMap[t]=[]),this.nodeLabelMap[t].push(e)}},r.prototype.addEdge=function(e,t,n,i){if((this.edgeIdAutoIncrease||e===void 0)&&(e=this.counter++),!(this.nodeMap[t]&&this.nodeMap[n]&&this.nodeMap[n].edgeMap[e])){var a=new z1(e,t,n,i);if(this.edges.push(a),this.edgeMap[e]=a,this.nodeMap[t].addEdge(a),this.edgeLabelMap[i]||(this.edgeLabelMap[i]=[]),this.edgeLabelMap[i].push(a),!this.directed){var o=new z1(e,n,t,i);this.nodeMap[n].addEdge(o),this.edgeLabelMap[i].push(o)}}},r}();Bn.Graph=Z7;Object.defineProperty(hg,"__esModule",{value:!0});hg.default=void 0;var Q7=U1,Ui=Bn,Yu=function(){function r(e,t,n,i,a){this.fromNode=e,this.toNode=t,this.nodeEdgeNodeLabel={nodeLabel1:n||Ui.VACANT_NODE_LABEL,edgeLabel:i||Ui.VACANT_EDGE_LABEL,nodeLabel2:a||Ui.VACANT_NODE_LABEL}}return r.prototype.equalTo=function(e){return this.fromNode===e.formNode&&this.toNode===e.toNode&&this.nodeEdgeNodeLabel===e.nodeEdgeNodeLabel},r.prototype.notEqualTo=function(e){return!this.equalTo(e)},r}(),BM=function(){function r(){this.rmpath=[],this.dfsEdgeList=[]}return r.prototype.equalTo=function(e){var t=this.dfsEdgeList.length,n=e.length;if(t!==n)return!1;for(var i=0;i<t;i++)if(this.dfsEdgeList[i]!==e[i])return!1;return!0},r.prototype.notEqualTo=function(e){return!this.equalTo(e)},r.prototype.pushBack=function(e,t,n,i,a){return this.dfsEdgeList.push(new Yu(e,t,n,i,a)),this.dfsEdgeList},r.prototype.toGraph=function(e,t){e===void 0&&(e=Ui.VACANT_GRAPH_ID),t===void 0&&(t=!1);var n=new Ui.Graph(e,!0,t);return this.dfsEdgeList.forEach(function(i){var a=i.fromNode,o=i.toNode,s=i.nodeEdgeNodeLabel,u=s.nodeLabel1,l=s.edgeLabel,c=s.nodeLabel2;u!==Ui.VACANT_NODE_LABEL&&n.addNode(a,u),c!==Ui.VACANT_NODE_LABEL&&n.addNode(o,c),u!==Ui.VACANT_NODE_LABEL&&c!==u&&n.addEdge(void 0,a,o,l)}),n},r.prototype.buildRmpath=function(){this.rmpath=[];for(var e=void 0,t=this.dfsEdgeList.length,n=t-1;n>=0;n--){var i=this.dfsEdgeList[n],a=i.fromNode,o=i.toNode;a<o&&(e===void 0||o===e)&&(this.rmpath.push(n),e=a)}return this.rmpath},r.prototype.getNodeNum=function(){var e={};return this.dfsEdgeList.forEach(function(t){e[t.fromNode]||(e[t.fromNode]=!0),e[t.toNode]||(e[t.toNode]=!0)}),Object.keys(e).length},r}(),dg=function(){function r(e){if(this.his={},this.nodesUsed={},this.edgesUsed={},this.edges=[],!!e){for(;e;){var t=e.edge;this.edges.push(t),this.nodesUsed[t.from]=1,this.nodesUsed[t.to]=1,this.edgesUsed[t.id]=1,e=e.preNode}this.edges=this.edges.reverse()}}return r.prototype.hasNode=function(e){return this.nodesUsed[e.id]===1},r.prototype.hasEdge=function(e){return this.edgesUsed[e.id]===1},r}(),J7=function(){function r(e){var t=e.graphs,n=e.minSupport,i=n===void 0?2:n,a=e.minNodeNum,o=a===void 0?1:a,s=e.maxNodeNum,u=s===void 0?4:s,l=e.top,c=l===void 0?10:l,f=e.directed,d=f===void 0?!1:f,h=e.verbose,v=h===void 0?!1:h;this.graphs=t,this.dfsCode=new BM,this.support=0,this.frequentSize1Subgraphs=[],this.frequentSubgraphs=[],this.minSupport=i,this.top=c,this.directed=d,this.counter=0,this.maxNodeNum=u,this.minNodeNum=o,this.verbose=v,this.maxNodeNum<this.minNodeNum&&(this.maxNodeNum=this.minNodeNum),this.reportDF=[]}return r.prototype.findForwardRootEdges=function(e,t){var n=this,i=[],a=e.nodeMap;return t.edges.forEach(function(o){(n.directed||t.label<=a[o.to].label)&&i.push(o)}),i},r.prototype.findBackwardEdge=function(e,t,n,i){if(!this.directed&&t===n)return null;for(var a=e.nodeMap,o=a[n.to],s=o.edges,u=s.length,l=0;l<u;l++){var c=s[l];if(!(i.hasEdge(c)||c.to!==t.from)){if(this.directed){if(a[t.from].label<a[n.to].label||a[t.from].label===a[n.to].label&&t.label<=c.label)return c}else if(t.label<c.label||t.label===c.label&&a[t.to].label<=a[n.to].label)return c}}return null},r.prototype.findForwardPureEdges=function(e,t,n,i){for(var a=[],o=t.to,s=e.nodeMap[o].edges,u=s.length,l=0;l<u;l++){var c=s[l],f=e.nodeMap[c.to];n<=f.label&&!i.hasNode(f)&&a.push(c)}return a},r.prototype.findForwardRmpathEdges=function(e,t,n,i){for(var a=[],o=e.nodeMap,s=o[t.to].label,u=o[t.from],l=u.edges,c=l.length,f=0;f<c;f++){var d=l[f],h=o[d.to].label;t.to===d.to||n>h||i.hasNode(o[d.to])||(t.label<d.label||t.label===d.label&&s<=h)&&a.push(d)}return a},r.prototype.getSupport=function(e){var t={};return e.forEach(function(n){t[n.graphId]||(t[n.graphId]=!0)}),Object.keys(t).length},r.prototype.findMinLabel=function(e){var t=void 0;return Object.keys(e).forEach(function(n){var i=e[n],a=i.nodeLabel1,o=i.edgeLabel,s=i.nodeLabel2;if(!t){t={nodeLabel1:a,edgeLabel:o,nodeLabel2:s};return}(a<t.nodeLabel1||a===t.nodeLabel1&&o<t.edgeLabel||a===t.nodeLabel1&&o===t.edgeLabel&&s<t.nodeLabel2)&&(t={nodeLabel1:a,edgeLabel:o,nodeLabel2:s})}),t},r.prototype.isMin=function(){var e=this,t=this.dfsCode;if(this.verbose&&console.log("isMin checking",t),t.dfsEdgeList.length===1)return!0;var n=this.directed,i=t.toGraph(Ui.VACANT_GRAPH_ID,n),a=i.nodeMap,o=new BM,s={};i.nodes.forEach(function(f){var d=e.findForwardRootEdges(i,f);d.forEach(function(h){var v=a[h.to],p=f.label+"-"+h.label+"-"+v.label;s[p]||(s[p]={projected:[],nodeLabel1:f.label,edgeLabel:h.label,nodeLabel2:v.label});var g={graphId:i.id,edge:h,preNode:null};s[p].projected.push(g)})});var u=this.findMinLabel(s);if(!!u){o.dfsEdgeList.push(new Yu(0,1,u.nodeLabel1,u.edgeLabel,u.nodeLabel2));var l=function f(d){for(var h=o.buildRmpath(),v=o.dfsEdgeList[0].nodeEdgeNodeLabel.nodeLabel1,p=o.dfsEdgeList[h[0]].toNode,g={},y=!1,m=0,b=n?-1:0,w=function(K){if(y)return"break";d.forEach(function(z){var X=new dg(z),H=e.findBackwardEdge(i,X.edges[h[K]],X.edges[h[0]],X);H&&(g[H.label]||(g[H.label]={projected:[],edgeLabel:H.label}),g[H.label].projected.push({graphId:i.id,edge:g,preNode:z}),m=o.dfsEdgeList[h[K]].fromNode,y=!0)})},x=h.length-1;x>b;x--){var _=w(x);if(_==="break")break}if(y){var A=e.findMinLabel(g);o.dfsEdgeList.push(new Yu(p,m,Ui.VACANT_NODE_LABEL,A.edgeLabel,Ui.VACANT_NODE_LABEL));var I=o.dfsEdgeList.length-1;return e.dfsCode.dfsEdgeList[I]!==o.dfsEdgeList[I]?!1:f(g[A.edgeLabel].projected)}var M={};y=!1;var S=0;d.forEach(function(ee){var K=new dg(ee),z=e.findForwardPureEdges(i,K.edges[h[0]],v,K);z.length>0&&(y=!0,S=p,z.forEach(function(X){var H=X.label+"-"+a[X.to].label;M[H]||(M[H]={projected:[],edgeLabel:X.label,nodeLabel2:a[X.to].label}),M[H].projected.push({graphId:i.id,edge:X,preNode:ee})}))});for(var C=h.length,T=function(K){if(y)return"break";var z=h[K];d.forEach(function(X){var H=new dg(X),J=e.findForwardRmpathEdges(i,H.edges[z],v,H);J.length>0&&(y=!0,S=o.dfsEdgeList[z].fromNode,J.forEach(function(ne){var me=ne.label+"-"+a[ne.to].label;M[me]||(M[me]={projected:[],edgeLabel:ne.label,nodeLabel2:a[ne.to].label}),M[me].projected.push({graphId:i.id,edge:ne,preNode:X})}))})},x=0;x<C;x++){var k=T(x);if(k==="break")break}if(!y)return!0;var L=e.findMinLabel(M);o.dfsEdgeList.push(new Yu(S,p+1,Ui.VACANT_NODE_LABEL,L.edgeLabel,L.nodeLabel2));var B=o.dfsEdgeList.length-1;return t.dfsEdgeList[B]!==o.dfsEdgeList[B]?!1:f(M[L.edgeLabel+"-"+L.nodeLabel2].projected)},c=u.nodeLabel1+"-"+u.edgeLabel+"-"+u.nodeLabel2;return l(s[c].projected)}},r.prototype.report=function(){if(!(this.dfsCode.getNodeNum()<this.minNodeNum)){this.counter++;var e=this.dfsCode.toGraph(this.counter,this.directed);this.frequentSubgraphs.push((0,Q7.clone)(e))}},r.prototype.subGraphMining=function(e){var t=this,n=this.getSupport(e);if(!(n<this.minSupport)&&!!this.isMin()){this.report();var i=this.dfsCode.getNodeNum(),a=this.dfsCode.buildRmpath(),o=this.dfsCode.dfsEdgeList[a[0]].toNode,s=this.dfsCode.dfsEdgeList[0].nodeEdgeNodeLabel.nodeLabel1,u={},l={};e.forEach(function(c){for(var f=t.graphs[c.graphId],d=f.nodeMap,h=new dg(c),v=a.length-1;v>=0;v--){var p=t.findBackwardEdge(f,h.edges[a[v]],h.edges[a[0]],h);if(p){var g=t.dfsCode.dfsEdgeList[a[v]].fromNode+"-"+p.label;l[g]||(l[g]={projected:[],toNodeId:t.dfsCode.dfsEdgeList[a[v]].fromNode,edgeLabel:p.label}),l[g].projected.push({graphId:c.graphId,edge:p,preNode:c})}}if(!(i>=t.maxNodeNum)){var y=t.findForwardPureEdges(f,h.edges[a[0]],s,h);y.forEach(function(b){var w=o+"-"+b.label+"-"+d[b.to].label;u[w]||(u[w]={projected:[],fromNodeId:o,edgeLabel:b.label,nodeLabel2:d[b.to].label}),u[w].projected.push({graphId:c.graphId,edge:b,preNode:c})});for(var m=function(w){var x=t.findForwardRmpathEdges(f,h.edges[a[w]],s,h);x.forEach(function(_){var A=t.dfsCode.dfsEdgeList[a[w]].fromNode+"-"+_.label+"-"+d[_.to].label;u[A]||(u[A]={projected:[],fromNodeId:t.dfsCode.dfsEdgeList[a[w]].fromNode,edgeLabel:_.label,nodeLabel2:d[_.to].label}),u[A].projected.push({graphId:c.graphId,edge:_,preNode:c})})},v=0;v<a.length;v++)m(v)}}),Object.keys(l).forEach(function(c){var f=l[c],d=f.toNodeId,h=f.edgeLabel;t.dfsCode.dfsEdgeList.push(new Yu(o,d,"-1",h,"-1")),t.subGraphMining(l[c].projected),t.dfsCode.dfsEdgeList.pop()}),Object.keys(u).forEach(function(c){var f=u[c],d=f.fromNodeId,h=f.edgeLabel,v=f.nodeLabel2;t.dfsCode.dfsEdgeList.push(new Yu(d,o+1,Ui.VACANT_NODE_LABEL,h,v)),t.subGraphMining(u[c].projected),t.dfsCode.dfsEdgeList.pop()})}},r.prototype.generate1EdgeFrequentSubGraphs=function(){var e=this.graphs,t=this.directed,n=this.minSupport,i=this.frequentSize1Subgraphs,a={},o={},s={},u={};return Object.keys(e).forEach(function(l){var c=e[l],f=c.nodeMap;c.nodes.forEach(function(d,h){var v=d.label,p=l+"-"+v;if(!s[p]){var g=a[v]||0;g++,a[v]=g}s[p]={graphKey:l,label:v},d.edges.forEach(function(y){var m=v,b=f[y.to].label;if(!t&&m>b){var w=b;b=m,m=w}var x=y.label,_=l+"-"+m+"-"+x+"-"+b,A=m+"-"+x+"-"+b;if(!o[A]){var I=o[A]||0;I++,o[A]=I}u[_]={graphId:l,nodeLabel1:m,edgeLabel:x,nodeLabel2:b}})})}),Object.keys(a).forEach(function(l){var c=a[l];if(!(c<n)){var f={nodes:[],edges:[]};f.nodes.push({id:"0",label:l}),i.push(f)}}),i},r.prototype.run=function(){var e=this;if(this.frequentSize1Subgraphs=this.generate1EdgeFrequentSubGraphs(),!(this.maxNodeNum<2)){var t=this.graphs;this.directed;var n={};Object.keys(t).forEach(function(i){var a=t[i],o=a.nodeMap;a.nodes.forEach(function(s){var u=e.findForwardRootEdges(a,s);u.forEach(function(l){var c=o[l.to],f=s.label+"-"+l.label+"-"+c.label;n[f]||(n[f]={projected:[],nodeLabel1:s.label,edgeLabel:l.label,nodeLabel2:c.label});var d={graphId:i,edge:l,preNode:null};n[f].projected.push(d)})})}),Object.keys(n).forEach(function(i){var a=n[i],o=a.projected,s=a.nodeLabel1,u=a.edgeLabel,l=a.nodeLabel2;e.dfsCode.dfsEdgeList.push(new Yu(0,1,s,u,l)),e.subGraphMining(o),e.dfsCode.dfsEdgeList.pop()})}},r}(),eq=function(e,t,n,i){var a={};return Object.keys(e).forEach(function(o,s){var u=e[o],l=new Ui.Graph(s,!0,t),c={};u.nodes.forEach(function(f,d){l.addNode(d,f[n]),c[f.id]=d}),u.edges.forEach(function(f,d){var h=c[f.source],v=c[f.target];l.addEdge(-1,h,v,f[i])}),l&&l.getNodeNum()&&(a[l.id]=l)}),a},tq=function(e,t,n){var i=[];return e.forEach(function(a){var o={nodes:[],edges:[]};a.nodes.forEach(function(s){var u;o.nodes.push((u={id:""+s.id},u[t]=s.label,u))}),a.edges.forEach(function(s){var u;o.edges.push((u={source:""+s.from,target:""+s.to},u[n]=s.label,u))}),i.push(o)}),i},FM="cluster",rq=function(e){var t=e.graphs,n=e.directed,i=n===void 0?!1:n,a=e.nodeLabelProp,o=a===void 0?FM:a,s=e.edgeLabelProp,u=s===void 0?FM:s,l=eq(t,i,o,u),c=e.minSupport,f=e.maxNodeNum,d=e.minNodeNum,h=e.verbose,v=e.top,p={graphs:l,minSupport:c,maxNodeNum:f,minNodeNum:d,top:v,verbose:h,directed:i},g=new J7(p);g.run();var y=tq(g.frequentSubgraphs,o,u);return y},nq=rq;hg.default=nq;Object.defineProperty(fg,"__esModule",{value:!0});fg.default=void 0;var UM=F1.exports,GM=$1(xh),iq=$1(hg),zM=$1(pc),aq=Rn;function $1(r){return r&&r.__esModule?r:{default:r}}var $M=function(e,t,n,i){n===void 0&&(n="cluster"),i===void 0&&(i=2);var a=[],o=e.nodes;return t.forEach(function(s,u){a.push(VM(o,s,u,n,i))}),a},VM=function(e,t,n,i,a){var o=[n],s=[],u={};return t.forEach(function(l,c){if(l<=a&&n!==c){o.push(c),s.push(e[c]);var f=e[c][i];u[f]?(u[f].count++,u[f].dists.push(l)):u[f]={count:1,dists:[l]}}}),Object.keys(u).forEach(function(l){u[l].dists=u[l].dists.sort(function(c,f){return c-f})}),{nodeIdx:n,nodeId:e[n].id,nodeIdxs:o,neighbors:s,neighborNum:o.length-1,nodeLabelCountMap:u}},oq=function(e,t,n,i,a){var o=Math.ceil(n/t),s={},u=0;return i.forEach(function(l,c){for(var f=0,d=0,h=l.nodeIdxs,v=l.neighborNum-1;f<o;){for(var p=h[1+Math.floor(Math.random()*v)],g=0;(s[c+"-"+p]||s[p+"-"+c])&&(p=Math.floor(Math.random()*t),g++,!(g>2*t)););if(g<2*t&&(s[c+"-"+p]={start:c,end:p,distance:a[c][p]},f++,u++,u>=n))return s;if(d++,d>2*t)break}if(f<o){var y=o-f;o=(o+y)/(t-c-1)}}),s},vg=function(e,t,n,i){var a=n.nodes;return i||(i={}),Object.keys(e).forEach(function(o){var s,u;if(!(i&&i[o])){i[o]={nodes:[],edges:[]};var l=e[o],c=(s=t[l.start])===null||s===void 0?void 0:s.nodeIdxs,f=(u=t[l.end])===null||u===void 0?void 0:u.nodeIdxs;if(!(!c||!f)){var d=new Set(f),h=c.filter(function(m){return d.has(m)});if(!(!h||!h.length)){for(var v={},p=h.length,g=0;g<p;g++){var y=a[h[g]];i[o].nodes.push(y),v[y.id]=!0}n.edges.forEach(function(m){v[m.source]&&v[m.target]&&i[o].edges.push(m)})}}}}),i},pg=function(e,t,n,i){var a,o,s={};e.nodes.forEach(function(l){s[l.id]=l});var u=0;return!((a=t==null?void 0:t.edges)===null||a===void 0?void 0:a.length)||((o=t==null?void 0:t.nodes)===null||o===void 0?void 0:o.length)<2?0:(e.edges.forEach(function(l){var c=s[l.source][n],f=s[l.target][n],d=t==null?void 0:t.nodes[0][n],h=t==null?void 0:t.nodes[1][n],v=t==null?void 0:t.edges[0][i];l[i]===v&&(c===d&&f===h||c===h&&f===d)&&u++}),u)},sq=function(e,t,n){for(var i=1/0,a=0,o=function(l){var c=e[l],f=Object.keys(c).sort(function(m,b){return c[m]-c[b]}),d=10,h=[];f.forEach(function(m,b){h[b%d]||(h[b%d]={graphs:[],totalCount:0,aveCount:0}),h[b%d].graphs.push(m),h[b%d].totalCount+=c[m]});var v=0,p=[];h.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(_,A){var I=c[_];m.graphs.forEach(function(M,S){A!==S&&(w+=Math.abs(I-c[M]))})}),w/=x*(x-1)/2,v+=w}),v/=h.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;i<y&&(i=y,a=l)},s=0;s<t;s++)o(s);return{structure:n[a],structureCountMap:e[a]}},jM=function(e,t){var n={},i={};return e.forEach(function(a,o){n[a.id]={idx:o,node:a,degree:0,inDegree:0,outDegree:0};var s=a[t];i[s]||(i[s]=[]),i[s].push(a)}),{nodeMap:n,nodeLabelMap:i}},WM=function(e,t,n){var i={},a={};return e.forEach(function(o,s){i[""+aq.uniqueId]={idx:s,edge:o};var u=o[t];a[u]||(a[u]=[]),a[u].push(o);var l=n[o.source];l&&(l.degree++,l.outDegree++);var c=n[o.target];c&&(c.degree++,c.inDegree++)}),{edgeMap:i,edgeLabelMap:a}},XM=function(e,t,n){var i=t.length,a={};return t.forEach(function(o,s){for(var u=n?0:s+1,l=e[s].id,c=u;c<i;c++)if(s!==c){var f=e[c].id,d=o[c];a[l+"-"+f]=d,n||(a[f+"-"+l]=d)}}),a},uq=function(e,t,n,i,a,o,s,u,l,c,f){var d,h=t.id+"-"+n.id;if(c&&c[h])return c[h];var v=f?f[h]:void 0;if(!v){var p=(d={},d[h]={start:i[t.id].idx,end:i[n.id].idx,distance:a},d);f=vg(p,o,e,f),v=f[h]}return pg(v,s,u,l)},YM=function(e,t,n,i){var a,o,s,u=(a=e[t])===null||a===void 0?void 0:a.degree,l=(o=e[t])===null||o===void 0?void 0:o.inDegree,c=(s=e[t])===null||s===void 0?void 0:s.outDegree;return e[t]===void 0&&(u=1/0,l=1/0,c=1/0,i[t].forEach(function(f){var d=n[f.id].degree;u>d&&(u=d);var h=n[f.id].inDegree;l>h&&(l=h);var v=n[f.id].outDegree;c>v&&(c=v)}),e[t]={degree:u,inDegree:l,outDegree:c}),{minPatternNodeLabelDegree:u,minPatternNodeLabelInDegree:l,minPatternNodeLabelOutDegree:c}},lq=function(e,t,n,i,a,o,s){if(n===void 0&&(n=!1),o===void 0&&(o="cluster"),s===void 0&&(s="cluster"),!(!e||!e.nodes)){var u=e.nodes.length;if(!!u){var l=(0,GM.default)(e,n),c=(0,GM.default)(t,n),f=XM(e.nodes,l,n),d=XM(t.nodes,c,n),h=jM(e.nodes,o),v=h.nodeMap,p=h.nodeLabelMap,g=jM(t.nodes,o),y=g.nodeMap,m=g.nodeLabelMap;WM(e.edges,s,v);var b=WM(t.edges,s,y).edgeLabelMap,w=[];c==null||c.forEach(function(Ye){w=w.concat(Ye)}),a||(a=Math.max.apply(Math,(0,UM.__spreadArray)((0,UM.__spreadArray)([],w),[2]))),i||(i=a);var x=$M(e,l,o,i),_=$M(t,c,o,i),A=Math.min(100,u*(u-1)/2),I=oq(i,u,A,_,l),M=vg(I,x,e),S=10,C=1,T=1,k=4,L={graphs:M,nodeLabelProp:o,edgeLabelProp:s,minSupport:C,minNodeNum:T,maxNodeNum:k,directed:n},B=(0,iq.default)(L).slice(0,S),ee=B.length,K=[];B.forEach(function(Ye,pt){K[pt]={},Object.keys(M).forEach(function(ht){var dt=M[ht],D=pg(dt,Ye,o,s);K[pt][ht]=D})});var z=sq(K,ee,B),X=z.structure,H=z.structureCountMap,J=t.nodes[0],ne=J[o],me=p[ne],oe={},Ae={},ze={},qe={},ft={},ct={};Object.keys(m).forEach(function(Ye,pt){ft[Ye]=[],n&&(ct[Ye]=[]);var ht=m[Ye],dt={};ht.forEach(function(Se){var De=d[J.id+"-"+Se.id];if(De&&ft[Ye].push(De),dt[J.id+"-"+Se.id]={start:0,end:y[Se.id].idx,distance:De},n){var At=d[Se.id+"-"+J.id];At&&ct[Ye].push(At)}}),ft[Ye]=ft[Ye].sort(function(Se,De){return Se-De}),n&&(ct[Ye]=ct[Ye].sort(function(Se,De){return Se-De})),Ae=vg(dt,_,t,Ae);var D=[];if(Object.keys(dt).forEach(function(Se){if(ze[Se]){D.push(ze[Se]);return}var De=Ae[Se];ze[Se]=pg(De,X,o,s),D.push(ze[Se])}),D=D.sort(function(Se,De){return De-Se}),qe[J.id+"-"+Ye]=D,Ye!==ne)for(var V=me.length,he=function(De){var At=me[De],ut=x[v[At.id].idx],St=ut.nodeLabelCountMap[Ye],nt=m[Ye].length;if(!St||St.count<nt)return me.splice(De,1),"continue";for(var Zt=!1,Dt=0;Dt<nt;Dt++)if(St.dists[Dt]>ft[Ye][Dt]){Zt=!0;break}if(Zt)return me.splice(De,1),"continue";var vr={};ut.neighbors.forEach(function(kr){var Tn=f[At.id+"-"+kr.id];vr[At.id+"-"+kr.id]={start:v[At.id].idx,end:v[kr.id].idx,distance:Tn}}),M=vg(vr,x,e,M);var Nr=[];Object.keys(vr).forEach(function(kr){if(H[kr]){Nr.push(H[kr]);return}var Tn=M[kr];H[kr]=pg(Tn,X,o,s),Nr.push(H[kr])}),Nr=Nr.sort(function(kr,Tn){return Tn-kr});for(var qn=!1,Dt=0;Dt<nt;Dt++)if(Nr[Dt]<D[Dt]){qn=!0;break}if(qn)return me.splice(De,1),"continue"},ye=V-1;ye>=0;ye--)he(ye)});var st=[];me==null||me.forEach(function(Ye){for(var pt=v[Ye.id].idx,ht=VM(e.nodes,l[pt],pt,o,a),dt=ht.neighbors,D=dt.length,V=!1,he=D-1;he>=0;he--){if(dt.length+1<t.nodes.length){V=!0;return}var ye=dt[he],Se=ye[o];if(!m[Se]||!m[Se].length){dt.splice(he,1);continue}if(!ft[Se]||!ft[Se].length){dt.splice(he,1);continue}var De=Ye.id+"-"+ye.id,At=f[De],ut=ft[Se].length-1,St=ft[Se][ut];if(At>St){dt.splice(he,1);continue}if(n){var nt=ye.id+"-"+Ye.id,Zt=f[nt];ut=ct[Se].length-1;var Dt=ct[Se][ut];if(Zt>Dt){dt.splice(he,1);continue}}var vr=H[De]?H[De]:uq(e,Ye,ye,v,At,x,X,o,s,H,M),Nr=J.id+"-"+Se,qn=qe[Nr][qe[Nr].length-1];if(vr<qn){dt.splice(he,1);continue}var kr=YM(oe,Se,y,m),Tn=kr.minPatternNodeLabelDegree;if(kr.minPatternNodeLabelInDegree,kr.minPatternNodeLabelOutDegree,v[ye.id].degree<Tn){dt.splice(he,1);continue}}V||st.push({nodes:[Ye].concat(dt)})});var gr=(0,zM.default)(t,J.id,!1).length,tr={};n?(Object.keys(gr).forEach(function(Ye){var pt=y[Ye].node[o];tr[pt]?tr[pt].push(gr[Ye]):tr[pt]=[gr[Ye]]}),Object.keys(tr).forEach(function(Ye){tr[Ye].sort(function(pt,ht){return pt-ht})})):tr=ft;for(var $=st.length,se=function(pt){var ht=st[pt],dt=ht.nodes[0],D={},V={};ht.nodes.forEach(function(zt,Hr){V[zt.id]={idx:Hr,node:zt,degree:0,inDegree:0,outDegree:0};var pr=zt[o];D[pr]?D[pr]++:D[pr]=1});var he=[],ye={};e.edges.forEach(function(zt){V[zt.source]&&V[zt.target]&&(he.push(zt),ye[zt[s]]?ye[zt[s]]++:ye[zt[s]]=1,V[zt.source].degree++,V[zt.target].degree++,V[zt.source].outDegree++,V[zt.target].inDegree++)});for(var Se=Object.keys(b).length,De=!1,At=0;At<Se;At++){var ut=Object.keys(b)[At];if(!ye[ut]||ye[ut]<b[ut].length){De=!0;break}}if(De)return st.splice(pt,1),"continue";var St=he.length;if(St<t.edges.length)return st.splice(pt,1),"break";for(var nt=!1,Zt=function(Hr){var pr=he[Hr],cn=pr[s],Sr=b[cn];if(!Sr||!Sr.length)return ye[cn]--,Sr&&ye[cn]<Sr.length?(nt=!0,"break"):(he.splice(Hr,1),V[pr.source].degree--,V[pr.target].degree--,V[pr.source].outDegree--,V[pr.target].inDegree--,"continue");var iu=V[pr.source].node[o],au=V[pr.target].node[o],Co=!1;if(Sr.forEach(function(ou){var su=y[ou.source].node,uu=y[ou.target].node;su[o]===iu&&uu[o]===au&&(Co=!0),!n&&su[o]===au&&uu[o]===iu&&(Co=!0)}),!Co)return ye[cn]--,Sr&&ye[cn]<Sr.length?(nt=!0,"break"):(he.splice(Hr,1),V[pr.source].degree--,V[pr.target].degree--,V[pr.source].outDegree--,V[pr.target].inDegree--,"continue")},At=St-1;At>=0;At--){var Dt=Zt(At);if(Dt==="break")break}if(nt)return st.splice(pt,1),"continue";ht.edges=he;var vr=(0,zM.default)(ht,ht.nodes[0].id,!1).length;if(Object.keys(vr).reverse().forEach(function(zt){if(!(zt===ht.nodes[0].id||nt)){if(vr[zt]===1/0){var Hr=V[zt].node[o];if(D[Hr]--,D[Hr]<m[Hr].length){nt=!0;return}var pr=ht.nodes.indexOf(V[zt].node);ht.nodes.splice(pr,1),V[zt]=void 0;return}var cn=v[zt].node[o];if(!tr[cn]||!tr[cn].length||vr[zt]>tr[cn][tr[cn].length-1]){var Hr=V[zt].node[o];if(D[Hr]--,D[Hr]<m[Hr].length){nt=!0;return}var pr=ht.nodes.indexOf(V[zt].node);ht.nodes.splice(pr,1),V[zt]=void 0}}}),nt)return st.splice(pt,1),"continue";for(var Nr=!0,qn=0;Nr&&!nt;){Nr=!1;var kr=n?V[dt.id].degree<y[J.id].degree||V[dt.id].inDegree<y[J.id].inDegree||V[dt.id].outDegree<y[J.id].outDegree:V[dt.id].degree<y[J.id].degree;if(kr){nt=!0;break}if(D[dt[o]]<m[dt[o]].length){nt=!0;break}for(var Tn=ht.nodes.length,ba=Tn-1;ba>=0;ba--){var Un=ht.nodes[ba],nu=V[Un.id].degree,hl=V[Un.id].inDegree,dl=V[Un.id].outDegree,Uc=Un[o],Io=YM(oe,Uc,y,m),Ln=Io.minPatternNodeLabelDegree,Gc=Io.minPatternNodeLabelInDegree,zc=Io.minPatternNodeLabelOutDegree,$c=n?nu<Ln||hl<Gc||dl<zc:nu<Ln;if($c){if(D[Un[o]]--,D[Un[o]]<m[Un[o]].length){nt=!0;break}ht.nodes.splice(ba,1),V[Un.id]=void 0,Nr=!0}}if(nt||!Nr&&qn!==0)break;St=he.length;for(var wa=St-1;wa>=0;wa--){var In=he[wa];if(!V[In.source]||!V[In.target]){he.splice(wa,1);var xa=In[s];if(ye[xa]--,V[In.source]&&(V[In.source].degree--,V[In.source].outDegree--),V[In.target]&&(V[In.target].degree--,V[In.target].inDegree--),b[xa]&&ye[xa]<b[xa].length){nt=!0;break}Nr=!0}}qn++}if(nt||nt||ht.nodes.length<t.nodes.length||he.length<t.edges.length)return st.splice(pt,1),"continue"},W=$-1;W>=0;W--){var Ze=se(W);if(Ze==="break")break}for(var yt=st.length,at=function(pt){var ht=st[pt],dt={};ht.edges.forEach(function(he){var ye=he.source+"-"+he.target+"-"+he.label;dt[ye]?dt[ye]++:dt[ye]=1});for(var D=function(ye){var Se=st[ye],De={};Se.edges.forEach(function(ut){var St=ut.source+"-"+ut.target+"-"+ut.label;De[St]?De[St]++:De[St]=1});var At=!0;Object.keys(De).length!==Object.keys(dt).length?At=!1:Object.keys(dt).forEach(function(ut){De[ut]!==dt[ut]&&(At=!1)}),At&&st.splice(ye,1)},V=yt-1;V>pt;V--)D(V);yt=st.length},W=0;W<=yt-1;W++)at(W);return st}}},cq=lq;fg.default=cq;(function(r){function e(w){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?e=function(_){return typeof _}:e=function(_){return _&&typeof Symbol=="function"&&_.constructor===Symbol&&_!==Symbol.prototype?"symbol":typeof _},e(w)}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"getAdjMatrix",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(r,"breadthFirstSearch",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(r,"connectedComponent",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(r,"getDegree",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(r,"getInDegree",{enumerable:!0,get:function(){return a.getInDegree}}),Object.defineProperty(r,"getOutDegree",{enumerable:!0,get:function(){return a.getOutDegree}}),Object.defineProperty(r,"detectCycle",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(r,"depthFirstSearch",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(r,"dijkstra",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(r,"findAllPath",{enumerable:!0,get:function(){return l.findAllPath}}),Object.defineProperty(r,"findShortestPath",{enumerable:!0,get:function(){return l.findShortestPath}}),Object.defineProperty(r,"floydWarshall",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(r,"labelPropagation",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(r,"louvain",{enumerable:!0,get:function(){return d.default}}),Object.defineProperty(r,"minimumSpanningTree",{enumerable:!0,get:function(){return h.default}}),Object.defineProperty(r,"pageRank",{enumerable:!0,get:function(){return v.default}}),Object.defineProperty(r,"GADDI",{enumerable:!0,get:function(){return p.default}}),Object.defineProperty(r,"getNeighbors",{enumerable:!0,get:function(){return g.getNeighbors}});var t=b(Xu),n=b(eg),i=b(Ls),a=m(Xo),o=b(ho),s=b(rg),u=b(pc),l=gc,c=b(xh),f=b(ag),d=b(og),h=b(sg),v=b(cg),p=b(fg),g=Rn;function y(){if(typeof WeakMap!="function")return null;var w=new WeakMap;return y=function(){return w},w}function m(w){if(w&&w.__esModule)return w;if(w===null||e(w)!=="object"&&typeof w!="function")return{default:w};var x=y();if(x&&x.has(w))return x.get(w);var _={},A=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var I in w)if(Object.prototype.hasOwnProperty.call(w,I)){var M=A?Object.getOwnPropertyDescriptor(w,I):null;M&&(M.get||M.set)?Object.defineProperty(_,I,M):_[I]=w[I]}return _.default=w,x&&x.set(w,_),_}function b(w){return w&&w.__esModule?w:{default:w}}})(mM);function gg(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?gg=function(t){return typeof t}:gg=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gg(r)}Object.defineProperty(Jp,"__esModule",{value:!0});Jp.default=void 0;var V1=fq(mM),HM=Ds;function qM(){if(typeof WeakMap!="function")return null;var r=new WeakMap;return qM=function(){return r},r}function fq(r){if(r&&r.__esModule)return r;if(r===null||gg(r)!=="object"&&typeof r!="function")return{default:r};var e=qM();if(e&&e.has(r))return e.get(r);var t={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in r)if(Object.prototype.hasOwnProperty.call(r,i)){var a=n?Object.getOwnPropertyDescriptor(r,i):null;a&&(a.get||a.set)?Object.defineProperty(t,i,a):t[i]=r[i]}return t.default=r,e&&e.set(r,t),t}var j1=typeof self!="undefined"?self:{};j1.onmessage=function(r){var e=r.data,t=e._algorithmType,n=e.data;if(!!t){if(typeof V1[t]=="function"){var i=V1[t].apply(V1,n);j1.postMessage({_algorithmType:HM.MESSAGE.SUCCESS,data:i});return}j1.postMessage({_algorithmType:HM.MESSAGE.FAILURE})}};var hq=null;Jp.default=hq;Object.defineProperty(Qp,"__esModule",{value:!0});Qp.default=void 0;var dq=Ds,vq=pq(Jp);function pq(r){return r&&r.__esModule?r:{default:r}}var gq=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new Promise(function(i,a){var o=new vq.default;o.postMessage({_algorithmType:e,data:t}),o.onmessage=function(s){var u=s.data,l=u.data,c=u._algorithmType;dq.MESSAGE.SUCCESS===c?i(l):a(),o.terminate()}})}},yq=gq;Qp.default=yq;Object.defineProperty(wr,"__esModule",{value:!0});wr.GADDIAsync=wr.getNeighborsAsync=wr.pageRankAsync=wr.minimumSpanningTreeAsync=wr.louvainAsync=wr.labelPropagationAsync=wr.floydWarshallAsync=wr.findShortestPathAsync=wr.findAllPathAsync=wr.dijkstraAsync=wr.detectAllUndirectedCycleAsync=wr.detectAllDirectedCycleAsync=wr.detectAllCyclesAsync=wr.detectCycleAsync=wr.getOutDegreeAsync=wr.getInDegreeAsync=wr.getDegreeAsync=wr.connectedComponentAsync=wr.getAdjMatrixAsync=void 0;var jn=mq(Qp),Wn=Ds;function mq(r){return r&&r.__esModule?r:{default:r}}var bq=function(e,t){return(0,jn.default)(Wn.ALGORITHM.getAdjMatrix).apply(void 0,[e,t])};wr.getAdjMatrixAsync=bq;var wq=function(e,t){return(0,jn.default)(Wn.ALGORITHM.connectedComponent).apply(void 0,[e,t])};wr.connectedComponentAsync=wq;var xq=function(e){return(0,jn.default)(Wn.ALGORITHM.getDegree)(e)};wr.getDegreeAsync=xq;var _q=function(e,t){return(0,jn.default)(Wn.ALGORITHM.getInDegree)(e,t)};wr.getInDegreeAsync=_q;var Sq=function(e,t){return(0,jn.default)(Wn.ALGORITHM.getOutDegree)(e,t)};wr.getOutDegreeAsync=Sq;var Eq=function(e){return(0,jn.default)(Wn.ALGORITHM.detectCycle)(e)};wr.detectCycleAsync=Eq;var Aq=function(e){return(0,jn.default)(Wn.ALGORITHM.detectAllCycles)(e)};wr.detectAllCyclesAsync=Aq;var Tq=function(e){return(0,jn.default)(Wn.ALGORITHM.detectAllDirectedCycle)(e)};wr.detectAllDirectedCycleAsync=Tq;var Iq=function(e){return(0,jn.default)(Wn.ALGORITHM.detectAllUndirectedCycle)(e)};wr.detectAllUndirectedCycleAsync=Iq;var Cq=function(e,t,n,i){return(0,jn.default)(Wn.ALGORITHM.dijkstra).apply(void 0,[e,t,n,i])};wr.dijkstraAsync=Cq;var Mq=function(e,t,n,i){return(0,jn.default)(Wn.ALGORITHM.findAllPath).apply(void 0,[e,t,n,i])};wr.findAllPathAsync=Mq;var kq=function(e,t,n,i,a){return(0,jn.default)(Wn.ALGORITHM.findShortestPath).apply(void 0,[e,t,n,i,a])};wr.findShortestPathAsync=kq;var Dq=function(e,t){return(0,jn.default)(Wn.ALGORITHM.floydWarshall).apply(void 0,[e,t])};wr.floydWarshallAsync=Dq;var Lq=function(e,t,n,i){return i===void 0&&(i=1e3),(0,jn.default)(Wn.ALGORITHM.labelPropagation)(e,t,n,i)};wr.labelPropagationAsync=Lq;var Nq=function(e,t,n,i){return(0,jn.default)(Wn.ALGORITHM.louvain)(e,t,n,i)};wr.louvainAsync=Nq;var Oq=function(e,t,n){return(0,jn.default)(Wn.ALGORITHM.minimumSpanningTree).apply(void 0,[e,t,n])};wr.minimumSpanningTreeAsync=Oq;var Pq=function(e,t,n){return(0,jn.default)(Wn.ALGORITHM.pageRank).apply(void 0,[e,t,n])};wr.pageRankAsync=Pq;var Rq=function(e,t,n){return(0,jn.default)(Wn.ALGORITHM.getNeighbors).apply(void 0,[e,t,n])};wr.getNeighborsAsync=Rq;var Bq=function(e,t,n,i,a,o,s){return n===void 0&&(n=!1),o===void 0&&(o="cluster"),s===void 0&&(s="cluster"),(0,jn.default)(Wn.ALGORITHM.GADDI).apply(void 0,[e,t,n,i,a,o,s])};wr.GADDIAsync=Bq;(function(r){Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"getAdjMatrixAsync",{enumerable:!0,get:function(){return e.getAdjMatrixAsync}}),Object.defineProperty(r,"connectedComponentAsync",{enumerable:!0,get:function(){return e.connectedComponentAsync}}),Object.defineProperty(r,"getDegreeAsync",{enumerable:!0,get:function(){return e.getDegreeAsync}}),Object.defineProperty(r,"getInDegreeAsync",{enumerable:!0,get:function(){return e.getInDegreeAsync}}),Object.defineProperty(r,"getOutDegreeAsync",{enumerable:!0,get:function(){return e.getOutDegreeAsync}}),Object.defineProperty(r,"detectCycleAsync",{enumerable:!0,get:function(){return e.detectCycleAsync}}),Object.defineProperty(r,"detectAllCyclesAsync",{enumerable:!0,get:function(){return e.detectAllCyclesAsync}}),Object.defineProperty(r,"detectAllDirectedCycleAsync",{enumerable:!0,get:function(){return e.detectAllDirectedCycleAsync}}),Object.defineProperty(r,"detectAllUndirectedCycleAsync",{enumerable:!0,get:function(){return e.detectAllUndirectedCycleAsync}}),Object.defineProperty(r,"dijkstraAsync",{enumerable:!0,get:function(){return e.dijkstraAsync}}),Object.defineProperty(r,"findAllPathAsync",{enumerable:!0,get:function(){return e.findAllPathAsync}}),Object.defineProperty(r,"findShortestPathAsync",{enumerable:!0,get:function(){return e.findShortestPathAsync}}),Object.defineProperty(r,"floydWarshallAsync",{enumerable:!0,get:function(){return e.floydWarshallAsync}}),Object.defineProperty(r,"labelPropagationAsync",{enumerable:!0,get:function(){return e.labelPropagationAsync}}),Object.defineProperty(r,"louvainAsync",{enumerable:!0,get:function(){return e.louvainAsync}}),Object.defineProperty(r,"minimumSpanningTreeAsync",{enumerable:!0,get:function(){return e.minimumSpanningTreeAsync}}),Object.defineProperty(r,"pageRankAsync",{enumerable:!0,get:function(){return e.pageRankAsync}}),Object.defineProperty(r,"getNeighborsAsync",{enumerable:!0,get:function(){return e.getNeighborsAsync}}),Object.defineProperty(r,"GADDIAsync",{enumerable:!0,get:function(){return e.GADDIAsync}}),r.default=r.detectDirectedCycleAsync=void 0;var e=wr,t=e.detectCycleAsync;r.detectDirectedCycleAsync=t;var n={getAdjMatrixAsync:e.getAdjMatrixAsync,connectedComponentAsync:e.connectedComponentAsync,getDegreeAsync:e.getDegreeAsync,getInDegreeAsync:e.getInDegreeAsync,getOutDegreeAsync:e.getOutDegreeAsync,detectCycleAsync:e.detectCycleAsync,detectDirectedCycleAsync:t,detectAllCyclesAsync:e.detectAllCyclesAsync,detectAllDirectedCycleAsync:e.detectAllDirectedCycleAsync,detectAllUndirectedCycleAsync:e.detectAllUndirectedCycleAsync,dijkstraAsync:e.dijkstraAsync,findAllPathAsync:e.findAllPathAsync,findShortestPathAsync:e.findShortestPathAsync,floydWarshallAsync:e.floydWarshallAsync,labelPropagationAsync:e.labelPropagationAsync,louvainAsync:e.louvainAsync,minimumSpanningTreeAsync:e.minimumSpanningTreeAsync,pageRankAsync:e.pageRankAsync,getNeighborsAsync:e.getNeighborsAsync,GADDIAsync:e.GADDIAsync};r.default=n})(R1);var Fq=TU(R1),Uq=Object.freeze(AU({__proto__:null,[Symbol.toStringTag]:"Module",default:Fq},[R1]));function Gq(){return window?window.devicePixelRatio:1}function KM(r,e,t,n){var i=r-t,a=e-n;return Math.sqrt(i*i+a*a)}function Hu(r,e,t,n,i,a){return i>=r&&i<=r+t&&a>=e&&a<=e+n}function Sh(r,e){return!(e.minX>r.maxX||e.maxX<r.minX||e.minY>r.maxY||e.maxY<r.minY)}function zq(r,e){return!r||!e?r||e:{minX:Math.min(r.minX,e.minX),minY:Math.min(r.minY,e.minY),maxX:Math.max(r.maxX,e.maxX),maxY:Math.max(r.maxY,e.maxY)}}function ZM(r,e){return r[0]===e[0]&&r[1]===e[1]}var $q=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,Vq=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,jq=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,QM=/[\d.]+:(#[^\s]+|[^\)]+\))/gi;function JM(r,e){var t=r.match(QM);xe(t,function(n){var i=n.split(":");e.addColorStop(i[0],i[1])})}function Wq(r,e,t){var n=$q.exec(t),i=parseFloat(n[1])%360*(Math.PI/180),a=n[2],o=e.getBBox(),s,u;i>=0&&i<1/2*Math.PI?(s={x:o.minX,y:o.minY},u={x:o.maxX,y:o.maxY}):1/2*Math.PI<=i&&i<Math.PI?(s={x:o.maxX,y:o.minY},u={x:o.minX,y:o.maxY}):Math.PI<=i&&i<3/2*Math.PI?(s={x:o.maxX,y:o.maxY},u={x:o.minX,y:o.minY}):(s={x:o.minX,y:o.maxY},u={x:o.maxX,y:o.minY});var l=Math.tan(i),c=l*l,f=(u.x-s.x+l*(u.y-s.y))/(c+1)+s.x,d=l*(u.x-s.x+l*(u.y-s.y))/(c+1)+s.y,h=r.createLinearGradient(s.x,s.y,f,d);return JM(a,h),h}function Xq(r,e,t){var n=Vq.exec(t),i=parseFloat(n[1]),a=parseFloat(n[2]),o=parseFloat(n[3]),s=n[4];if(o===0){var u=s.match(QM);return u[u.length-1].split(":")[1]}var l=e.getBBox(),c=l.maxX-l.minX,f=l.maxY-l.minY,d=Math.sqrt(c*c+f*f)/2,h=r.createRadialGradient(l.minX+c*i,l.minY+f*a,0,l.minX+c/2,l.minY+f/2,o*d);return JM(s,h),h}function Yq(r,e,t){if(e.get("patternSource")&&e.get("patternSource")===t)return e.get("pattern");var n,i,a=jq.exec(t),o=a[1],s=a[2];function u(){n=r.createPattern(i,o),e.set("pattern",n),e.set("patternSource",t)}switch(o){case"a":o="repeat";break;case"x":o="repeat-x";break;case"y":o="repeat-y";break;case"n":o="no-repeat";break;default:o="no-repeat"}return i=new Image,s.match(/^data:/i)||(i.crossOrigin="Anonymous"),i.src=s,i.complete?u():(i.onload=u,i.src=i.src),n}function Hq(r,e,t){var n=e.getBBox();if(isNaN(n.x)||isNaN(n.y)||isNaN(n.width)||isNaN(n.height))return t;if(We(t)){if(t[1]==="("||t[2]==="("){if(t[0]==="l")return Wq(r,e,t);if(t[0]==="r")return Xq(r,e,t);if(t[0]==="p")return Yq(r,e,t)}return t}if(t instanceof CanvasPattern)return t}function qq(r){var e=0,t=0,n=0,i=0;return Mt(r)?r.length===1?e=t=n=i=r[0]:r.length===2?(e=n=r[0],t=i=r[1]):r.length===3?(e=r[0],t=i=r[1],n=r[2]):(e=r[0],t=r[1],n=r[2],i=r[3]):e=t=n=i=r,[e,t,n,i]}function yg(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function W1(r,e){return yg(r)*yg(e)?(r[0]*e[0]+r[1]*e[1])/(yg(r)*yg(e)):1}function ek(r,e){return(r[0]*e[1]<r[1]*e[0]?-1:1)*Math.acos(W1(r,e))}function tk(r,e){var t=e[1],n=e[2],i=np(ip(e[3]),Math.PI*2),a=e[4],o=e[5],s=r[0],u=r[1],l=e[6],c=e[7],f=Math.cos(i)*(s-l)/2+Math.sin(i)*(u-c)/2,d=-1*Math.sin(i)*(s-l)/2+Math.cos(i)*(u-c)/2,h=f*f/(t*t)+d*d/(n*n);h>1&&(t*=Math.sqrt(h),n*=Math.sqrt(h));var v=t*t*(d*d)+n*n*(f*f),p=v?Math.sqrt((t*t*(n*n)-v)/v):1;a===o&&(p*=-1),isNaN(p)&&(p=0);var g=n?p*t*d/n:0,y=t?p*-n*f/t:0,m=(s+l)/2+Math.cos(i)*g-Math.sin(i)*y,b=(u+c)/2+Math.sin(i)*g+Math.cos(i)*y,w=[(f-g)/t,(d-y)/n],x=[(-1*f-g)/t,(-1*d-y)/n],_=ek([1,0],w),A=ek(w,x);return W1(w,x)<=-1&&(A=Math.PI),W1(w,x)>=1&&(A=0),o===0&&A>0&&(A=A-2*Math.PI),o===1&&A<0&&(A=A+2*Math.PI),{cx:m,cy:b,rx:ZM(r,[l,c])?0:t,ry:ZM(r,[l,c])?0:n,startAngle:_,endAngle:_+A,xRotation:i,arcFlag:a,sweepFlag:o}}var mg=Math.sin,bg=Math.cos,X1=Math.atan2,wg=Math.PI;function rk(r,e,t,n,i,a,o){var s=e.stroke,u=e.lineWidth,l=t-i,c=n-a,f=X1(c,l),d=new J1({type:"path",canvas:r.get("canvas"),isArrowShape:!0,attrs:{path:"M"+10*bg(wg/6)+","+10*mg(wg/6)+" L0,0 L"+10*bg(wg/6)+",-"+10*mg(wg/6),stroke:s,lineWidth:u}});d.translate(i,a),d.rotateAtPoint(i,a,f),r.set(o?"startArrowShape":"endArrowShape",d)}function nk(r,e,t,n,i,a,o){var s=e.startArrow,u=e.endArrow,l=e.stroke,c=e.lineWidth,f=o?s:u,d=f.d,h=f.fill,v=f.stroke,p=f.lineWidth,g=Ti(f,["d","fill","stroke","lineWidth"]),y=t-i,m=n-a,b=X1(m,y);d&&(i=i-bg(b)*d,a=a-mg(b)*d);var w=new J1({type:"path",canvas:r.get("canvas"),isArrowShape:!0,attrs:P(P({},g),{stroke:v||l,lineWidth:p||c,fill:h})});w.translate(i,a),w.rotateAtPoint(i,a,b),r.set(o?"startArrowShape":"endArrowShape",w)}function qu(r,e,t,n,i){var a=X1(n-e,t-r);return{dx:bg(a)*i,dy:mg(a)*i}}function Y1(r,e,t,n,i,a){typeof e.startArrow=="object"?nk(r,e,t,n,i,a,!0):e.startArrow?rk(r,e,t,n,i,a,!0):r.set("startArrowShape",null)}function H1(r,e,t,n,i,a){typeof e.endArrow=="object"?nk(r,e,t,n,i,a,!1):e.endArrow?rk(r,e,t,n,i,a,!1):r.set("startArrowShape",null)}var ik={fill:"fillStyle",stroke:"strokeStyle",opacity:"globalAlpha"};function yc(r,e){var t=e.attr();for(var n in t){var i=t[n],a=ik[n]?ik[n]:n;a==="matrix"&&i?r.transform(i[0],i[1],i[3],i[4],i[6],i[7]):a==="lineDash"&&r.setLineDash?Mt(i)&&r.setLineDash(i):(a==="strokeStyle"||a==="fillStyle"?i=Hq(r,e,i):a==="globalAlpha"&&(i=i*r.globalAlpha),r[a]=i)}}function q1(r,e,t){for(var n=0;n<e.length;n++){var i=e[n];i.cfg.visible?i.draw(r,t):i.skipDraw()}}function Kq(r,e,t){var n=r.get("refreshElements");xe(n,function(i){if(i!==r)for(var a=i.cfg.parent;a&&a!==r&&!a.cfg.refresh;)a.cfg.refresh=!0,a=a.cfg.parent}),n[0]===r?Z1(e):K1(e,t)}function K1(r,e){for(var t=0;t<r.length;t++){var n=r[t];if(n.cfg.visible)if(n.cfg.hasChanged)n.cfg.refresh=!0,n.isGroup()&&Z1(n.cfg.children);else if(n.cfg.refresh)n.isGroup()&&K1(n.cfg.children,e);else{var i=Zq(n,e);n.cfg.refresh=i,i&&n.isGroup()&&K1(n.cfg.children,e)}}}function ak(r){for(var e=0;e<r.length;e++){var t=r[e];t.cfg.hasChanged=!1,t.isGroup()&&!t.destroyed&&ak(t.cfg.children)}}function Z1(r,e){for(var t=0;t<r.length;t++){var n=r[t];n.cfg.refresh=!0,n.isGroup()&&Z1(n.get("children"))}}function Zq(r,e){var t=r.cfg.cacheCanvasBBox,n=r.cfg.isInView&&t&&Sh(t,e);return n}function ok(r,e,t,n){var i=t.path,a=t.startArrow,o=t.endArrow;if(!!i){var s=[0,0],u=[0,0],l={dx:0,dy:0};e.beginPath();for(var c=0;c<i.length;c++){var f=i[c],d=f[0];if(c===0&&a&&a.d){var h=r.getStartTangent();l=qu(h[0][0],h[0][1],h[1][0],h[1][1],a.d)}else if(c===i.length-2&&i[c+1][0]==="Z"&&o&&o.d){var v=i[c+1];if(v[0]==="Z"){var h=r.getEndTangent();l=qu(h[0][0],h[0][1],h[1][0],h[1][1],o.d)}}else if(c===i.length-1&&o&&o.d&&i[0]!=="Z"){var h=r.getEndTangent();l=qu(h[0][0],h[0][1],h[1][0],h[1][1],o.d)}var p=l.dx,g=l.dy;switch(d){case"M":e.moveTo(f[1]-p,f[2]-g),u=[f[1],f[2]];break;case"L":e.lineTo(f[1]-p,f[2]-g);break;case"Q":e.quadraticCurveTo(f[1],f[2],f[3]-p,f[4]-g);break;case"C":e.bezierCurveTo(f[1],f[2],f[3],f[4],f[5]-p,f[6]-g);break;case"A":{var y=void 0;n?(y=n[c],y||(y=tk(s,f),n[c]=y)):y=tk(s,f);var m=y.cx,b=y.cy,w=y.rx,x=y.ry,_=y.startAngle,A=y.endAngle,I=y.xRotation,M=y.sweepFlag;if(e.ellipse)e.ellipse(m,b,w,x,I,_,A,1-M);else{var S=w>x?w:x,C=w>x?1:w/x,T=w>x?x/w:1;e.translate(m,b),e.rotate(I),e.scale(C,T),e.arc(0,0,S,_,A,1-M),e.scale(1/C,1/T),e.rotate(-I),e.translate(-m,-b)}break}case"Z":e.closePath();break}if(d==="Z")s=u;else{var k=f.length;s=[f[k-2],f[k-1]]}}}}function sk(r,e){var t=r.get("canvas");t&&(e==="remove"&&(r._cacheCanvasBBox=r.get("cacheCanvasBBox")),r.get("hasChanged")||(r.set("hasChanged",!0),r.cfg.parent&&r.cfg.parent.get("hasChanged")||(t.refreshElement(r,e,t),t.get("autoDraw")&&t.draw())))}function Qq(r){var e;if(r.destroyed)e=r._cacheCanvasBBox;else{var t=r.get("cacheCanvasBBox"),n=t&&!!(t.width&&t.height),i=r.getCanvasBBox(),a=i&&!!(i.width&&i.height);n&&a?e=zq(t,i):n?e=t:a&&(e=i)}return e}function Jq(r){if(!r.length)return null;var e=[],t=[],n=[],i=[];return xe(r,function(a){var o=Qq(a);o&&(e.push(o.minX),t.push(o.minY),n.push(o.maxX),i.push(o.maxY))}),{minX:fa(e),minY:fa(t),maxX:ca(n),maxY:ca(i)}}function eK(r,e){return!r||!e||!Sh(r,e)?null:{minX:Math.max(r.minX,e.minX),minY:Math.max(r.minY,e.minY),maxX:Math.min(r.maxX,e.maxX),maxY:Math.min(r.maxY,e.maxY)}}var uk=function(r){Wt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.onCanvasChange=function(t){sk(this,t)},e.prototype.getShapeBase=function(){return Nm},e.prototype.getGroupBase=function(){return e},e.prototype._applyClip=function(t,n){n&&(t.save(),yc(t,n),n.createPath(t),t.restore(),t.clip(),n._afterDraw())},e.prototype.cacheCanvasBBox=function(){var t=this.cfg.children,n=[],i=[];xe(t,function(d){var h=d.cfg.cacheCanvasBBox;h&&d.cfg.isInView&&(n.push(h.minX,h.maxX),i.push(h.minY,h.maxY))});var a=null;if(n.length){var o=fa(n),s=ca(n),u=fa(i),l=ca(i);a={minX:o,minY:u,x:o,y:u,maxX:s,maxY:l,width:s-o,height:l-u};var c=this.cfg.canvas;if(c){var f=c.getViewRange();this.set("isInView",Sh(a,f))}}else this.set("isInView",!1);this.set("cacheCanvasBBox",a)},e.prototype.draw=function(t,n){var i=this.cfg.children,a=n?this.cfg.refresh:!0;i.length&&a&&(t.save(),yc(t,this),this._applyClip(t,this.getClip()),q1(t,i,n),t.restore(),this.cacheCanvasBBox()),this.cfg.refresh=null,this.set("hasChanged",!1)},e.prototype.skipDraw=function(){this.set("cacheCanvasBBox",null),this.set("hasChanged",!1)},e}(dC),tK=function(r){Wt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return P(P({},t),{lineWidth:1,lineAppendWidth:0,strokeOpacity:1,fillOpacity:1})},e.prototype.getShapeBase=function(){return Nm},e.prototype.getGroupBase=function(){return uk},e.prototype.onCanvasChange=function(t){sk(this,t)},e.prototype.calculateBBox=function(){var t=this.get("type"),n=this.getHitLineWidth(),i=gC(t),a=i(this),o=n/2,s=a.x-o,u=a.y-o,l=a.x+a.width+o,c=a.y+a.height+o;return{x:s,minX:s,y:u,minY:u,width:a.width+n,height:a.height+n,maxX:l,maxY:c}},e.prototype.isFill=function(){return!!this.attrs.fill||this.isClipShape()},e.prototype.isStroke=function(){return!!this.attrs.stroke},e.prototype._applyClip=function(t,n){n&&(t.save(),yc(t,n),n.createPath(t),t.restore(),t.clip(),n._afterDraw())},e.prototype.draw=function(t,n){var i=this.cfg.clipShape;if(n){if(this.cfg.refresh===!1){this.set("hasChanged",!1);return}var a=this.getCanvasBBox();if(!Sh(n,a)){this.set("hasChanged",!1),this.cfg.isInView&&this._afterDraw();return}}t.save(),yc(t,this),this._applyClip(t,i),this.drawPath(t),t.restore(),this._afterDraw()},e.prototype.getCanvasViewBox=function(){var t=this.cfg.canvas;return t?t.getViewRange():null},e.prototype.cacheCanvasBBox=function(){var t=this.getCanvasViewBox();if(t){var n=this.getCanvasBBox(),i=Sh(n,t);this.set("isInView",i),i?this.set("cacheCanvasBBox",n):this.set("cacheCanvasBBox",null)}},e.prototype._afterDraw=function(){this.cacheCanvasBBox(),this.set("hasChanged",!1),this.set("refresh",null)},e.prototype.skipDraw=function(){this.set("cacheCanvasBBox",null),this.set("isInView",null),this.set("hasChanged",!1)},e.prototype.drawPath=function(t){this.createPath(t),this.strokeAndFill(t),this.afterDrawPath(t)},e.prototype.fill=function(t){t.fill()},e.prototype.stroke=function(t){t.stroke()},e.prototype.strokeAndFill=function(t){var n=this.attrs,i=n.lineWidth,a=n.opacity,o=n.strokeOpacity,s=n.fillOpacity;this.isFill()&&(!xt(s)&&s!==1?(t.globalAlpha=s,this.fill(t),t.globalAlpha=a):this.fill(t)),this.isStroke()&&i>0&&(!xt(o)&&o!==1&&(t.globalAlpha=o),this.stroke(t)),this.afterDrawPath(t)},e.prototype.createPath=function(t){},e.prototype.afterDrawPath=function(t){},e.prototype.isInShape=function(t,n){var i=this.isStroke(),a=this.isFill(),o=this.getHitLineWidth();return this.isInStrokeOrPath(t,n,i,a,o)},e.prototype.isInStrokeOrPath=function(t,n,i,a,o){return!1},e.prototype.getHitLineWidth=function(){if(!this.isStroke())return 0;var t=this.attrs;return t.lineWidth+t.lineAppendWidth},e}(vC),Ga=tK,rK=function(r){Wt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return P(P({},t),{x:0,y:0,r:0})},e.prototype.isInStrokeOrPath=function(t,n,i,a,o){var s=this.attr(),u=s.x,l=s.y,c=s.r,f=o/2,d=KM(u,l,t,n);return a&&i?d<=c+f:a?d<=c:i?d>=c-f&&d<=c+f:!1},e.prototype.createPath=function(t){var n=this.attr(),i=n.x,a=n.y,o=n.r;t.beginPath(),t.arc(i,a,o,0,Math.PI*2,!1),t.closePath()},e}(Ga),nK=rK;function xg(r,e,t,n){return r/(t*t)+e/(n*n)}var iK=function(r){Wt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return P(P({},t),{x:0,y:0,rx:0,ry:0})},e.prototype.isInStrokeOrPath=function(t,n,i,a,o){var s=this.attr(),u=o/2,l=s.x,c=s.y,f=s.rx,d=s.ry,h=(t-l)*(t-l),v=(n-c)*(n-c);return a&&i?xg(h,v,f+u,d+u)<=1:a?xg(h,v,f,d)<=1:i?xg(h,v,f-u,d-u)>=1&&xg(h,v,f+u,d+u)<=1:!1},e.prototype.createPath=function(t){var n=this.attr(),i=n.x,a=n.y,o=n.rx,s=n.ry;if(t.beginPath(),t.ellipse)t.ellipse(i,a,o,s,0,0,Math.PI*2,!1);else{var u=o>s?o:s,l=o>s?1:o/s,c=o>s?s/o:1;t.save(),t.translate(i,a),t.scale(l,c),t.arc(0,0,u,0,Math.PI*2),t.restore(),t.closePath()}},e}(Ga),aK=iK;function lk(r){return r instanceof HTMLElement&&We(r.nodeName)&&r.nodeName.toUpperCase()==="CANVAS"}var oK=function(r){Wt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return P(P({},t),{x:0,y:0,width:0,height:0})},e.prototype.initAttrs=function(t){this._setImage(t.img)},e.prototype.isStroke=function(){return!1},e.prototype.isOnlyHitBox=function(){return!0},e.prototype._afterLoading=function(){if(this.get("toDraw")===!0){var t=this.get("canvas");t?t.draw():this.createPath(this.get("context"))}},e.prototype._setImage=function(t){var n=this,i=this.attrs;if(We(t)){var a=new Image;a.onload=function(){if(n.destroyed)return!1;n.attr("img",a),n.set("loading",!1),n._afterLoading();var o=n.get("callback");o&&o.call(n)},a.crossOrigin="Anonymous",a.src=t,this.set("loading",!0)}else t instanceof Image?(i.width||(i.width=t.width),i.height||(i.height=t.height)):lk(t)&&(i.width||(i.width=Number(t.getAttribute("width"))),i.height||(i.height,Number(t.getAttribute("height"))))},e.prototype.onAttrChange=function(t,n,i){r.prototype.onAttrChange.call(this,t,n,i),t==="img"&&this._setImage(n)},e.prototype.createPath=function(t){if(this.get("loading")){this.set("toDraw",!0),this.set("context",t);return}var n=this.attr(),i=n.x,a=n.y,o=n.width,s=n.height,u=n.sx,l=n.sy,c=n.swidth,f=n.sheight,d=n.img;(d instanceof Image||lk(d))&&(!xt(u)&&!xt(l)&&!xt(c)&&!xt(f)?t.drawImage(d,u,l,c,f,i,a,o,s):t.drawImage(d,i,a,o,s))},e}(Ga),sK=oK;function Ns(r,e,t,n,i,a,o){var s=Math.min(r,t),u=Math.max(r,t),l=Math.min(e,n),c=Math.max(e,n),f=i/2;return a>=s-f&&a<=u+f&&o>=l-f&&o<=c+f?ii.pointToLine(r,e,t,n,a,o)<=i/2:!1}var uK=function(r){Wt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return P(P({},t),{x1:0,y1:0,x2:0,y2:0,startArrow:!1,endArrow:!1})},e.prototype.initAttrs=function(t){this.setArrow()},e.prototype.onAttrChange=function(t,n,i){r.prototype.onAttrChange.call(this,t,n,i),this.setArrow()},e.prototype.setArrow=function(){var t=this.attr(),n=t.x1,i=t.y1,a=t.x2,o=t.y2,s=t.startArrow,u=t.endArrow;s&&Y1(this,t,a,o,n,i),u&&H1(this,t,n,i,a,o)},e.prototype.isInStrokeOrPath=function(t,n,i,a,o){if(!i||!o)return!1;var s=this.attr(),u=s.x1,l=s.y1,c=s.x2,f=s.y2;return Ns(u,l,c,f,o,t,n)},e.prototype.createPath=function(t){var n=this.attr(),i=n.x1,a=n.y1,o=n.x2,s=n.y2,u=n.startArrow,l=n.endArrow,c={dx:0,dy:0},f={dx:0,dy:0};u&&u.d&&(c=qu(i,a,o,s,n.startArrow.d)),l&&l.d&&(f=qu(i,a,o,s,n.endArrow.d)),t.beginPath(),t.moveTo(i+c.dx,a+c.dy),t.lineTo(o-f.dx,s-f.dy)},e.prototype.afterDrawPath=function(t){var n=this.get("startArrowShape"),i=this.get("endArrowShape");n&&n.draw(t),i&&i.draw(t)},e.prototype.getTotalLength=function(){var t=this.attr(),n=t.x1,i=t.y1,a=t.x2,o=t.y2;return ii.length(n,i,a,o)},e.prototype.getPoint=function(t){var n=this.attr(),i=n.x1,a=n.y1,o=n.x2,s=n.y2;return ii.pointAt(i,a,o,s,t)},e}(Ga),lK=uK,cK={circle:function(r,e,t){return[["M",r-t,e],["A",t,t,0,1,0,r+t,e],["A",t,t,0,1,0,r-t,e]]},square:function(r,e,t){return[["M",r-t,e-t],["L",r+t,e-t],["L",r+t,e+t],["L",r-t,e+t],["Z"]]},diamond:function(r,e,t){return[["M",r-t,e],["L",r,e-t],["L",r+t,e],["L",r,e+t],["Z"]]},triangle:function(r,e,t){var n=t*Math.sin(1/3*Math.PI);return[["M",r-t,e+n],["L",r,e-n],["L",r+t,e+n],["Z"]]},"triangle-down":function(r,e,t){var n=t*Math.sin(1/3*Math.PI);return[["M",r-t,e-n],["L",r+t,e-n],["L",r,e+n],["Z"]]}},fK=function(r){Wt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.initAttrs=function(t){this._resetParamsCache()},e.prototype._resetParamsCache=function(){this.set("paramsCache",{})},e.prototype.onAttrChange=function(t,n,i){r.prototype.onAttrChange.call(this,t,n,i),["symbol","x","y","r","radius"].indexOf(t)!==-1&&this._resetParamsCache()},e.prototype.isOnlyHitBox=function(){return!0},e.prototype._getR=function(t){return xt(t.r)?t.radius:t.r},e.prototype._getPath=function(){var t=this.attr(),n=t.x,i=t.y,a=t.symbol||"circle",o=this._getR(t),s,u;if(on(a))s=a,u=s(n,i,o),u=zC(u);else{if(s=e.Symbols[a],!s)return console.warn(a+" marker is not supported."),null;u=s(n,i,o)}return u},e.prototype.createPath=function(t){var n=this._getPath(),i=this.get("paramsCache");ok(this,t,{path:n},i)},e.Symbols=cK,e}(Ga),hK=fK;function ck(r,e,t){var n=RC();return r.createPath(n),n.isPointInPath(e,t)}var dK=1e-6;function Q1(r){return Math.abs(r)<dK?0:r<0?-1:1}function vK(r,e,t){return(t[0]-r[0])*(e[1]-r[1])==(e[0]-r[0])*(t[1]-r[1])&&Math.min(r[0],e[0])<=t[0]&&t[0]<=Math.max(r[0],e[0])&&Math.min(r[1],e[1])<=t[1]&&t[1]<=Math.max(r[1],e[1])}function fk(r,e,t){var n=!1,i=r.length;if(i<=2)return!1;for(var a=0;a<i;a++){var o=r[a],s=r[(a+1)%i];if(vK(o,s,[e,t]))return!0;Q1(o[1]-t)>0!=Q1(s[1]-t)>0&&Q1(e-(t-o[1])*(o[0]-s[0])/(o[1]-s[1])-o[0])<0&&(n=!n)}return n}function pK(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return jf(n,t),ti(r,n,e)}function gK(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return Wf(n,t),ti(r,n,e)}function yK(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return Xf(n,t),ti(r,n,e)}function mK(r,e,t){return ti(r,t,e)}function bK(r,e){for(var t=r?[].concat(r):[1,0,0,0,1,0,0,0,1],n=0,i=e.length;n<i;n++){var a=e[n];switch(a[0]){case"t":pK(t,t,[a[1],a[2]]);break;case"s":yK(t,t,[a[1],a[2]]);break;case"r":gK(t,t,a[1]);break;case"m":mK(t,t,a[1]);break}}return t}function Eh(r,e,t,n,i,a,o,s){var u=(Math.atan2(s-e,o-r)+Math.PI*2)%(Math.PI*2);if(u<n||u>i)return!1;var l={x:r+t*Math.cos(u),y:e+t*Math.sin(u)};return KM(l.x,l.y,o,s)<=a/2}var wK=bK;function xK(r){for(var e=!1,t=r.length,n=0;n<t;n++){var i=r[n],a=i[0];if(a==="C"||a==="A"||a==="Q"){e=!0;break}}return e}function _K(r,e,t,n,i){for(var a=!1,o=e/2,s=0;s<r.length;s++){var u=r[s],l=u.currentPoint,c=u.params,f=u.prePoint,d=u.box;if(!(d&&!Hu(d.x-o,d.y-o,d.width+e,d.height+e,t,n))){switch(u.command){case"L":case"Z":a=Ns(f[0],f[1],l[0],l[1],e,t,n);break;case"Q":var h=AC.pointDistance(f[0],f[1],c[1],c[2],c[3],c[4],t,n);a=h<=e/2;break;case"C":var v=gh.pointDistance(f[0],f[1],c[1],c[2],c[3],c[4],c[5],c[6],t,n,i);a=v<=e/2;break;case"A":var p=u.arcParams,g=p.cx,y=p.cy,m=p.rx,b=p.ry,w=p.startAngle,x=p.endAngle,_=p.xRotation,A=[t,n,1],I=m>b?m:b,M=m>b?1:m/b,S=m>b?b/m:1,C=wK(null,[["t",-g,-y],["r",-_],["s",1/M,1/S]]);oc(A,A,C),a=Eh(0,0,I,w,x,e,A[0],A[1]);break}if(a)break}}return a}function SK(r){for(var e=r.length,t=[],n=[],i=[],a=0;a<e;a++){var o=r[a],s=o[0];s==="M"?(i.length&&(n.push(i),i=[]),i.push([o[1],o[2]])):s==="Z"?i.length&&(t.push(i),i=[]):i.push([o[1],o[2]])}return i.length>0&&n.push(i),{polygons:t,polylines:n}}var _g=P({hasArc:xK,extractPolygons:SK,isPointInStroke:_K},S9);function hk(r,e,t){for(var n=!1,i=0;i<r.length;i++){var a=r[i];if(n=fk(a,e,t),n)break}return n}var EK=function(r){Wt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return P(P({},t),{startArrow:!1,endArrow:!1})},e.prototype.initAttrs=function(t){this._setPathArr(t.path),this.setArrow()},e.prototype.onAttrChange=function(t,n,i){r.prototype.onAttrChange.call(this,t,n,i),t==="path"&&this._setPathArr(n),this.setArrow()},e.prototype._setPathArr=function(t){this.attrs.path=zC(t);var n=_g.hasArc(t);this.set("hasArc",n),this.set("paramsCache",{}),this.set("segments",null),this.set("curve",null),this.set("tCache",null),this.set("totalLength",null)},e.prototype.getSegments=function(){var t=this.get("segements");return t||(t=jC(this.attr("path")),this.set("segments",t)),t},e.prototype.setArrow=function(){var t=this.attr(),n=t.startArrow,i=t.endArrow;if(n){var a=this.getStartTangent();Y1(this,t,a[0][0],a[0][1],a[1][0],a[1][1])}if(i){var a=this.getEndTangent();H1(this,t,a[0][0],a[0][1],a[1][0],a[1][1])}},e.prototype.isInStrokeOrPath=function(t,n,i,a,o){var s=this.getSegments(),u=this.get("hasArc"),l=!1;if(i){var c=this.getTotalLength();l=_g.isPointInStroke(s,o,t,n,c)}if(!l&&a)if(u)l=ck(this,t,n);else{var f=this.attr("path"),d=_g.extractPolygons(f);l=hk(d.polygons,t,n)||hk(d.polylines,t,n)}return l},e.prototype.createPath=function(t){var n=this.attr(),i=this.get("paramsCache");ok(this,t,n,i)},e.prototype.afterDrawPath=function(t){var n=this.get("startArrowShape"),i=this.get("endArrowShape");n&&n.draw(t),i&&i.draw(t)},e.prototype.getTotalLength=function(){var t=this.get("totalLength");return xt(t)?(this._calculateCurve(),this._setTcache(),this.get("totalLength")):t},e.prototype.getPoint=function(t){var n=this.get("tCache");n||(this._calculateCurve(),this._setTcache(),n=this.get("tCache"));var i,a,o=this.get("curve");if(!n||n.length===0)return o?{x:o[0][1],y:o[0][2]}:null;xe(n,function(c,f){t>=c[0]&&t<=c[1]&&(i=(t-c[0])/(c[1]-c[0]),a=f)});var s=o[a];if(xt(s)||xt(a))return null;var u=s.length,l=o[a+1];return gh.pointAt(s[u-2],s[u-1],l[1],l[2],l[3],l[4],l[5],l[6],i)},e.prototype._calculateCurve=function(){var t=this.attr().path;this.set("curve",_g.pathToCurve(t))},e.prototype._setTcache=function(){var t=0,n=0,i=[],a,o,s,u,l=this.get("curve");if(!!l){if(xe(l,function(c,f){s=l[f+1],u=c.length,s&&(t+=gh.length(c[u-2],c[u-1],s[1],s[2],s[3],s[4],s[5],s[6])||0)}),this.set("totalLength",t),t===0){this.set("tCache",[]);return}xe(l,function(c,f){s=l[f+1],u=c.length,s&&(a=[],a[0]=n/t,o=gh.length(c[u-2],c[u-1],s[1],s[2],s[3],s[4],s[5],s[6]),n+=o||0,a[1]=n/t,i.push(a))}),this.set("tCache",i)}},e.prototype.getStartTangent=function(){var t=this.getSegments(),n;if(t.length>1){var i=t[0].currentPoint,a=t[1].currentPoint,o=t[1].startTangent;n=[],o?(n.push([i[0]-o[0],i[1]-o[1]]),n.push([i[0],i[1]])):(n.push([a[0],a[1]]),n.push([i[0],i[1]]))}return n},e.prototype.getEndTangent=function(){var t=this.getSegments(),n=t.length,i;if(n>1){var a=t[n-2].currentPoint,o=t[n-1].currentPoint,s=t[n-1].endTangent;i=[],s?(i.push([o[0]-s[0],o[1]-s[1]]),i.push([o[0],o[1]])):(i.push([a[0],a[1]]),i.push([o[0],o[1]]))}return i},e}(Ga),J1=EK;function dk(r,e,t,n,i){var a=r.length;if(a<2)return!1;for(var o=0;o<a-1;o++){var s=r[o][0],u=r[o][1],l=r[o+1][0],c=r[o+1][1];if(Ns(s,u,l,c,e,t,n))return!0}if(i){var f=r[0],d=r[a-1];if(Ns(f[0],f[1],d[0],d[1],e,t,n))return!0}return!1}var AK=function(r){Wt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.isInStrokeOrPath=function(t,n,i,a,o){var s=this.attr().points,u=!1;return i&&(u=dk(s,o,t,n,!0)),!u&&a&&(u=fk(s,t,n)),u},e.prototype.createPath=function(t){var n=this.attr(),i=n.points;if(!(i.length<2)){t.beginPath();for(var a=0;a<i.length;a++){var o=i[a];a===0?t.moveTo(o[0],o[1]):t.lineTo(o[0],o[1])}t.closePath()}},e}(Ga),TK=AK,IK=function(r){Wt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return P(P({},t),{startArrow:!1,endArrow:!1})},e.prototype.initAttrs=function(t){this.setArrow()},e.prototype.onAttrChange=function(t,n,i){r.prototype.onAttrChange.call(this,t,n,i),this.setArrow(),["points"].indexOf(t)!==-1&&this._resetCache()},e.prototype._resetCache=function(){this.set("totalLength",null),this.set("tCache",null)},e.prototype.setArrow=function(){var t=this.attr(),n=this.attrs,i=n.points,a=n.startArrow,o=n.endArrow,s=i.length,u=i[0][0],l=i[0][1],c=i[s-1][0],f=i[s-1][1];a&&Y1(this,t,i[1][0],i[1][1],u,l),o&&H1(this,t,i[s-2][0],i[s-2][1],c,f)},e.prototype.isFill=function(){return!1},e.prototype.isInStrokeOrPath=function(t,n,i,a,o){if(!i||!o)return!1;var s=this.attr().points;return dk(s,o,t,n,!1)},e.prototype.isStroke=function(){return!0},e.prototype.createPath=function(t){var n=this.attr(),i=n.points,a=n.startArrow,o=n.endArrow,s=i.length;if(!(i.length<2)){var u=i[0][0],l=i[0][1],c=i[s-1][0],f=i[s-1][1];if(a&&a.d){var d=qu(u,l,i[1][0],i[1][1],a.d);u+=d.dx,l+=d.dy}if(o&&o.d){var d=qu(i[s-2][0],i[s-2][1],c,f,o.d);c-=d.dx,f-=d.dy}t.beginPath(),t.moveTo(u,l);for(var h=0;h<s-1;h++){var v=i[h];t.lineTo(v[0],v[1])}t.lineTo(c,f)}},e.prototype.afterDrawPath=function(t){var n=this.get("startArrowShape"),i=this.get("endArrowShape");n&&n.draw(t),i&&i.draw(t)},e.prototype.getTotalLength=function(){var t=this.attr().points,n=this.get("totalLength");return xt(n)?(this.set("totalLength",OC.length(t)),this.get("totalLength")):n},e.prototype.getPoint=function(t){var n=this.attr().points,i=this.get("tCache");i||(this._setTcache(),i=this.get("tCache"));var a,o;return xe(i,function(s,u){t>=s[0]&&t<=s[1]&&(a=(t-s[0])/(s[1]-s[0]),o=u)}),ii.pointAt(n[o][0],n[o][1],n[o+1][0],n[o+1][1],a)},e.prototype._setTcache=function(){var t=this.attr().points;if(!(!t||t.length===0)){var n=this.getTotalLength();if(!(n<=0)){var i=0,a=[],o,s;xe(t,function(u,l){t[l+1]&&(o=[],o[0]=i/n,s=ii.length(u[0],u[1],t[l+1][0],t[l+1][1]),i+=s,o[1]=i/n,a.push(o))}),this.set("tCache",a)}}},e.prototype.getStartTangent=function(){var t=this.attr().points,n=[];return n.push([t[1][0],t[1][1]]),n.push([t[0][0],t[0][1]]),n},e.prototype.getEndTangent=function(){var t=this.attr().points,n=t.length-1,i=[];return i.push([t[n-1][0],t[n-1][1]]),i.push([t[n][0],t[n][1]]),i},e}(Ga),CK=IK;function MK(r,e,t,n,i,a,o){var s=i/2;return Hu(r-s,e-s,t,i,a,o)||Hu(r+t-s,e-s,i,n,a,o)||Hu(r+s,e+n-s,t,i,a,o)||Hu(r-s,e+s,i,n,a,o)}function kK(r,e,t,n,i,a,o,s){return Ns(r+i,e,r+t-i,e,a,o,s)||Ns(r+t,e+i,r+t,e+n-i,a,o,s)||Ns(r+t-i,e+n,r+i,e+n,a,o,s)||Ns(r,e+n-i,r,e+i,a,o,s)||Eh(r+t-i,e+i,i,1.5*Math.PI,2*Math.PI,a,o,s)||Eh(r+t-i,e+n-i,i,0,.5*Math.PI,a,o,s)||Eh(r+i,e+n-i,i,.5*Math.PI,Math.PI,a,o,s)||Eh(r+i,e+i,i,Math.PI,1.5*Math.PI,a,o,s)}var DK=function(r){Wt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return P(P({},t),{x:0,y:0,width:0,height:0,radius:0})},e.prototype.isInStrokeOrPath=function(t,n,i,a,o){var s=this.attr(),u=s.x,l=s.y,c=s.width,f=s.height,d=s.radius;if(d){var v=!1;return i&&(v=kK(u,l,c,f,d,o,t,n)),!v&&a&&(v=ck(this,t,n)),v}else{var h=o/2;if(a&&i)return Hu(u-h,l-h,c+h,f+h,t,n);if(a)return Hu(u,l,c,f,t,n);if(i)return MK(u,l,c,f,o,t,n)}},e.prototype.createPath=function(t){var n=this.attr(),i=n.x,a=n.y,o=n.width,s=n.height,u=n.radius;if(t.beginPath(),u===0)t.rect(i,a,o,s);else{var l=qq(u),c=l[0],f=l[1],d=l[2],h=l[3];t.moveTo(i+c,a),t.lineTo(i+o-f,a),f!==0&&t.arc(i+o-f,a+f,f,-Math.PI/2,0),t.lineTo(i+o,a+s-d),d!==0&&t.arc(i+o-d,a+s-d,d,0,Math.PI/2),t.lineTo(i+h,a+s),h!==0&&t.arc(i+h,a+s-h,h,Math.PI/2,Math.PI),t.lineTo(i,a+c),c!==0&&t.arc(i+c,a+c,c,Math.PI,Math.PI*1.5),t.closePath()}},e}(Ga),LK=DK,NK=function(r){Wt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return P(P({},t),{x:0,y:0,text:null,fontSize:12,fontFamily:"sans-serif",fontStyle:"normal",fontWeight:"normal",fontVariant:"normal",textAlign:"start",textBaseline:"bottom"})},e.prototype.isOnlyHitBox=function(){return!0},e.prototype.initAttrs=function(t){this._assembleFont(),t.text&&this._setText(t.text)},e.prototype._assembleFont=function(){var t=this.attrs;t.font=FC(t)},e.prototype._setText=function(t){var n=null;We(t)&&t.indexOf(`
`)!==-1&&(n=t.split(`
`)),this.set("textArr",n)},e.prototype.onAttrChange=function(t,n,i){r.prototype.onAttrChange.call(this,t,n,i),t.startsWith("font")&&this._assembleFont(),t==="text"&&this._setText(n)},e.prototype._getSpaceingY=function(){var t=this.attrs,n=t.lineHeight,i=t.fontSize*1;return n?n-i:i*.14},e.prototype._drawTextArr=function(t,n,i){var a=this.attrs,o=a.textBaseline,s=a.x,u=a.y,l=a.fontSize*1,c=this._getSpaceingY(),f=BC(a.text,a.fontSize,a.lineHeight),d;xe(n,function(h,v){d=u+v*(c+l)-f+l,o==="middle"&&(d+=f-l-(f-l)/2),o==="top"&&(d+=f-l),xt(h)||(i?t.fillText(h,s,d):t.strokeText(h,s,d))})},e.prototype._drawText=function(t,n){var i=this.attr(),a=i.x,o=i.y,s=this.get("textArr");if(s)this._drawTextArr(t,s,n);else{var u=i.text;xt(u)||(n?t.fillText(u,a,o):t.strokeText(u,a,o))}},e.prototype.strokeAndFill=function(t){var n=this.attrs,i=n.lineWidth,a=n.opacity,o=n.strokeOpacity,s=n.fillOpacity;this.isStroke()&&i>0&&(!xt(o)&&o!==1&&(t.globalAlpha=a),this.stroke(t)),this.isFill()&&(!xt(s)&&s!==1?(t.globalAlpha=s,this.fill(t),t.globalAlpha=a):this.fill(t)),this.afterDrawPath(t)},e.prototype.fill=function(t){this._drawText(t,!0)},e.prototype.stroke=function(t){this._drawText(t,!1)},e}(Ga),OK=NK;function PK(r,e){if(e){var t=AI(e);return $u(t,r)}return r}function vk(r,e,t){var n=r.getTotalMatrix();if(n){var i=PK([e,t,1],n),a=i[0],o=i[1];return[a,o]}return[e,t]}function pk(r,e,t){if(r.isCanvas&&r.isCanvas())return!0;if(!qb(r)||r.cfg.isInView===!1)return!1;if(r.cfg.clipShape){var n=vk(r,e,t),i=n[0],a=n[1];if(r.isClipped(i,a))return!1}var o=r.cfg.cacheCanvasBBox||r.getCanvasBBox();return e>=o.minX&&e<=o.maxX&&t>=o.minY&&t<=o.maxY}function gk(r,e,t){if(!pk(r,e,t))return null;for(var n=null,i=r.getChildren(),a=i.length,o=a-1;o>=0;o--){var s=i[o];if(s.isGroup())n=gk(s,e,t);else if(pk(s,e,t)){var u=s,l=vk(s,e,t),c=l[0],f=l[1];u.isInShape(c,f)&&(n=s)}if(n)break}return n}var Os=function(r){Wt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultCfg=function(){var t=r.prototype.getDefaultCfg.call(this);return t.renderer="canvas",t.autoDraw=!0,t.localRefresh=!0,t.refreshElements=[],t.clipView=!0,t.quickHit=!1,t},e.prototype.onCanvasChange=function(t){(t==="attr"||t==="sort"||t==="changeSize")&&(this.set("refreshElements",[this]),this.draw())},e.prototype.getShapeBase=function(){return Nm},e.prototype.getGroupBase=function(){return uk},e.prototype.getPixelRatio=function(){var t=this.get("pixelRatio")||Gq();return t>=1?Math.ceil(t):1},e.prototype.getViewRange=function(){return{minX:0,minY:0,maxX:this.cfg.width,maxY:this.cfg.height}},e.prototype.createDom=function(){var t=document.createElement("canvas"),n=t.getContext("2d");return this.set("context",n),t},e.prototype.setDOMSize=function(t,n){r.prototype.setDOMSize.call(this,t,n);var i=this.get("context"),a=this.get("el"),o=this.getPixelRatio();a.width=o*t,a.height=o*n,o>1&&i.scale(o,o)},e.prototype.clear=function(){r.prototype.clear.call(this),this._clearFrame();var t=this.get("context"),n=this.get("el");t.clearRect(0,0,n.width,n.height)},e.prototype.getShape=function(t,n){var i;return this.get("quickHit")?i=gk(this,t,n):i=r.prototype.getShape.call(this,t,n,null),i},e.prototype._getRefreshRegion=function(){var t=this.get("refreshElements"),n=this.getViewRange(),i;if(t.length&&t[0]===this)i=n;else if(i=Jq(t),i){i.minX=Math.floor(i.minX),i.minY=Math.floor(i.minY),i.maxX=Math.ceil(i.maxX),i.maxY=Math.ceil(i.maxY),i.maxY+=1;var a=this.get("clipView");a&&(i=eK(i,n))}return i},e.prototype.refreshElement=function(t){var n=this.get("refreshElements");n.push(t)},e.prototype._clearFrame=function(){var t=this.get("drawFrame");t&&(GA(t),this.set("drawFrame",null),this.set("refreshElements",[]))},e.prototype.draw=function(){var t=this.get("drawFrame");this.get("autoDraw")&&t||this._startDraw()},e.prototype._drawAll=function(){var t=this.get("context"),n=this.get("el"),i=this.getChildren();t.clearRect(0,0,n.width,n.height),yc(t,this),q1(t,i),this.set("refreshElements",[])},e.prototype._drawRegion=function(){var t=this.get("context"),n=this.get("refreshElements"),i=this.getChildren(),a=this._getRefreshRegion();a?(t.clearRect(a.minX,a.minY,a.maxX-a.minX,a.maxY-a.minY),t.save(),t.beginPath(),t.rect(a.minX,a.minY,a.maxX-a.minX,a.maxY-a.minY),t.clip(),yc(t,this),Kq(this,i,a),q1(t,i,a),t.restore()):n.length&&ak(n),xe(n,function(o){o.get("hasChanged")&&o.set("hasChanged",!1)}),this.set("refreshElements",[])},e.prototype._startDraw=function(){var t=this,n=this.get("drawFrame");n||(n=UA(function(){t.get("localRefresh")?t._drawRegion():t._drawAll(),t.set("drawFrame",null)}),this.set("drawFrame",n))},e.prototype.skipDraw=function(){},e.prototype.removeDom=function(){var t=this.get("el");t.width=0,t.height=0,t.parentNode.removeChild(t)},e}(hC),ew={rect:"path",circle:"circle",line:"line",path:"path",marker:"path",text:"text",polyline:"polyline",polygon:"polygon",image:"image",ellipse:"ellipse",dom:"foreignObject"},Lr={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 va(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function yk(r){var e=ew[r.type],t=r.getParent();if(!e)throw new Error("the type "+r.type+" is not supported by svg");var n=va(e);if(r.get("id")&&(n.id=r.get("id")),r.set("el",n),r.set("attrs",{}),t){var i=t.get("el");i||(i=t.createDom(),t.set("el",i)),i.appendChild(n)}return n}function mk(r,e){var t=r.get("el"),n=jA(t.children).sort(e),i=document.createDocumentFragment();n.forEach(function(a){i.appendChild(a)}),t.appendChild(i)}function RK(r,e){var t=r.parentNode,n=Array.from(t.childNodes).filter(function(s){return s.nodeType===1&&s.nodeName.toLowerCase()!=="defs"}),i=n[e],a=n.indexOf(r);if(i){if(a>e)t.insertBefore(r,i);else if(a<e){var o=n[e+1];o?t.insertBefore(r,o):t.appendChild(r)}}else t.appendChild(r)}function BK(r,e){var t=r.cfg.el,n=r.attr(),i={dx:n.shadowOffsetX,dy:n.shadowOffsetY,blur:n.shadowBlur,color:n.shadowColor};if(!i.dx&&!i.dy&&!i.blur&&!i.color)t.removeAttribute("filter");else{var a=e.find("filter",i);a||(a=e.addShadow(i)),t.setAttribute("filter","url(#"+a+")")}}function Ah(r){var e=r.attr().matrix;if(e){for(var t=r.cfg.el,n=[],i=0;i<9;i+=3)n.push(e[i]+","+e[i+1]);n=n.join(","),n.indexOf("NaN")===-1?t.setAttribute("transform","matrix("+n+")"):console.warn("invalid matrix:",e)}}function Th(r,e){var t=r.getClip(),n=r.get("el");if(!t)n.removeAttribute("clip-path");else if(t&&!n.hasAttribute("clip-path")){yk(t),t.createPath(e);var i=e.addClip(t);n.setAttribute("clip-path","url(#"+i+")")}}function bk(r,e){e.forEach(function(t){t.draw(r)})}function wk(r,e){var t=r.get("canvas");if(t&&t.get("autoDraw")){var n=t.get("context"),i=r.getParent(),a=i?i.getChildren():[t],o=r.get("el");if(e==="remove"){var s=r.get("isClipShape");if(s){var u=o&&o.parentNode,l=u&&u.parentNode;u&&l&&l.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")RK(o,a.indexOf(r));else if(e==="sort"){var c=r.get("children");c&&c.length&&mk(r,function(f,d){return c.indexOf(f)-c.indexOf(d)?1:0})}else e==="clear"?o&&(o.innerHTML=""):e==="matrix"?Ah(r):e==="clip"?Th(r,n):e==="attr"||e==="add"&&r.draw(n)}}var xk=function(r){Wt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.isEntityGroup=function(){return!0},e.prototype.createDom=function(){var t=va("g");this.set("el",t);var n=this.getParent();if(n){var i=n.get("el");i||(i=n.createDom(),n.set("el",i)),i.appendChild(t)}return t},e.prototype.afterAttrsChange=function(t){r.prototype.afterAttrsChange.call(this,t);var n=this.get("canvas");if(n&&n.get("autoDraw")){var i=n.get("context");this.createPath(i,t)}},e.prototype.onCanvasChange=function(t){wk(this,t)},e.prototype.getShapeBase=function(){return Om},e.prototype.getGroupBase=function(){return e},e.prototype.draw=function(t){var n=this.getChildren(),i=this.get("el");this.get("destroyed")?i&&i.parentNode.removeChild(i):(i||this.createDom(),Th(this,t),this.createPath(t),n.length&&bk(t,n))},e.prototype.createPath=function(t,n){var i=this.attr(),a=this.get("el");xe(n||i,function(o,s){Lr[s]&&a.setAttribute(Lr[s],o)}),Ah(this)},e}(dC),FK=function(r){Wt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="svg",t.canFill=!1,t.canStroke=!1,t}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return P(P({},t),{lineWidth:1,lineAppendWidth:0,strokeOpacity:1,fillOpacity:1})},e.prototype.afterAttrsChange=function(t){r.prototype.afterAttrsChange.call(this,t);var n=this.get("canvas");if(n&&n.get("autoDraw")){var i=n.get("context");this.draw(i,t)}},e.prototype.getShapeBase=function(){return Om},e.prototype.getGroupBase=function(){return xk},e.prototype.onCanvasChange=function(t){wk(this,t)},e.prototype.calculateBBox=function(){var t=this.get("el"),n=null;if(t)n=t.getBBox();else{var i=gC(this.get("type"));i&&(n=i(this))}if(n){var a=n.x,o=n.y,s=n.width,u=n.height,l=this.getHitLineWidth(),c=l/2,f=a-c,d=o-c,h=a+s+c,v=o+u+c;return{x:f,y:d,minX:f,minY:d,maxX:h,maxY:v,width:s+l,height:u+l}}return{x:0,y:0,minX:0,minY:0,maxX:0,maxY:0,width:0,height:0}},e.prototype.isFill=function(){var t=this.attr(),n=t.fill,i=t.fillStyle;return(n||i||this.isClipShape())&&this.canFill},e.prototype.isStroke=function(){var t=this.attr(),n=t.stroke,i=t.strokeStyle;return(n||i)&&this.canStroke},e.prototype.draw=function(t,n){var i=this.get("el");this.get("destroyed")?i&&i.parentNode.removeChild(i):(i||yk(this),Th(this,t),this.createPath(t,n),this.shadow(t,n),this.strokeAndFill(t,n),this.transform(n))},e.prototype.createPath=function(t,n){},e.prototype.strokeAndFill=function(t,n){var i=n||this.attr(),a=i.fill,o=i.fillStyle,s=i.stroke,u=i.strokeStyle,l=i.fillOpacity,c=i.strokeOpacity,f=i.lineWidth,d=this.get("el");this.canFill&&(n?"fill"in i?this._setColor(t,"fill",a):"fillStyle"in i&&this._setColor(t,"fill",o):this._setColor(t,"fill",a||o),l&&d.setAttribute(Lr.fillOpacity,l)),this.canStroke&&f>0&&(n?"stroke"in i?this._setColor(t,"stroke",s):"strokeStyle"in i&&this._setColor(t,"stroke",u):this._setColor(t,"stroke",s||u),c&&d.setAttribute(Lr.strokeOpacity,c),f&&d.setAttribute(Lr.lineWidth,f))},e.prototype._setColor=function(t,n,i){var a=this.get("el");if(!i){a.setAttribute(Lr[n],"none");return}if(i=i.trim(),/^[r,R,L,l]{1}[\s]*\(/.test(i)){var o=t.find("gradient",i);o||(o=t.addGradient(i)),a.setAttribute(Lr[n],"url(#"+o+")")}else if(/^[p,P]{1}[\s]*\(/.test(i)){var o=t.find("pattern",i);o||(o=t.addPattern(i)),a.setAttribute(Lr[n],"url(#"+o+")")}else a.setAttribute(Lr[n],i)},e.prototype.shadow=function(t,n){var i=this.attr(),a=n||i,o=a.shadowOffsetX,s=a.shadowOffsetY,u=a.shadowBlur,l=a.shadowColor;(o||s||u||l)&&BK(this,t)},e.prototype.transform=function(t){var n=this.attr(),i=(t||n).matrix;i&&Ah(this)},e.prototype.isInShape=function(t,n){return this.isPointInPath(t,n)},e.prototype.isPointInPath=function(t,n){var i=this.get("el"),a=this.get("canvas"),o=a.get("el").getBoundingClientRect(),s=t+o.left,u=n+o.top,l=document.elementFromPoint(s,u);return!!(l&&l.isEqualNode(i))},e.prototype.getHitLineWidth=function(){var t=this.attrs,n=t.lineWidth,i=t.lineAppendWidth;return this.isStroke()?n+i:0},e}(vC),pa=FK,UK=function(r){Wt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="circle",t.canFill=!0,t.canStroke=!0,t}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return P(P({},t),{x:0,y:0,r:0})},e.prototype.createPath=function(t,n){var i=this.attr(),a=this.get("el");xe(n||i,function(o,s){s==="x"||s==="y"?a.setAttribute("c"+s,o):Lr[s]&&a.setAttribute(Lr[s],o)})},e}(pa),GK=UK,zK=function(r){Wt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="dom",t.canFill=!1,t.canStroke=!1,t}return e.prototype.createPath=function(t,n){var i=this.attr(),a=this.get("el");if(xe(n||i,function(l,c){Lr[c]&&a.setAttribute(Lr[c],l)}),typeof i.html=="function"){var o=i.html.call(this,i);if(o instanceof Element||o instanceof HTMLDocument){for(var s=a.childNodes,u=s.length-1;u>=0;u--)a.removeChild(s[u]);a.appendChild(o)}else a.innerHTML=o}else a.innerHTML=i.html},e}(pa),$K=zK,VK=function(r){Wt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="ellipse",t.canFill=!0,t.canStroke=!0,t}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return P(P({},t),{x:0,y:0,rx:0,ry:0})},e.prototype.createPath=function(t,n){var i=this.attr(),a=this.get("el");xe(n||i,function(o,s){s==="x"||s==="y"?a.setAttribute("c"+s,o):Lr[s]&&a.setAttribute(Lr[s],o)})},e}(pa),jK=VK,WK=function(r){Wt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="image",t.canFill=!1,t.canStroke=!1,t}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return P(P({},t),{x:0,y:0,width:0,height:0})},e.prototype.createPath=function(t,n){var i=this,a=this.attr(),o=this.get("el");xe(n||a,function(s,u){u==="img"?i._setImage(a.img):Lr[u]&&o.setAttribute(Lr[u],s)})},e.prototype.setAttr=function(t,n){this.attrs[t]=n,t==="img"&&this._setImage(n)},e.prototype._setImage=function(t){var n=this.attr(),i=this.get("el");if(We(t))i.setAttribute("href",t);else if(t instanceof window.Image)n.width||(i.setAttribute("width",t.width),this.attr("width",t.width)),n.height||(i.setAttribute("height",t.height),this.attr("height",t.height)),i.setAttribute("href",t.src);else if(t instanceof HTMLElement&&We(t.nodeName)&&t.nodeName.toUpperCase()==="CANVAS")i.setAttribute("href",t.toDataURL());else if(t instanceof ImageData){var a=document.createElement("canvas");a.setAttribute("width",""+t.width),a.setAttribute("height",""+t.height),a.getContext("2d").putImageData(t,0,0),n.width||(i.setAttribute("width",""+t.width),this.attr("width",t.width)),n.height||(i.setAttribute("height",""+t.height),this.attr("height",t.height)),i.setAttribute("href",a.toDataURL())}},e}(pa),XK=WK,YK=function(r){Wt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="line",t.canFill=!1,t.canStroke=!0,t}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return P(P({},t),{x1:0,y1:0,x2:0,y2:0,startArrow:!1,endArrow:!1})},e.prototype.createPath=function(t,n){var i=this.attr(),a=this.get("el");xe(n||i,function(o,s){if(s==="startArrow"||s==="endArrow")if(o){var u=gi(o)?t.addArrow(i,Lr[s]):t.getDefaultArrow(i,Lr[s]);a.setAttribute(Lr[s],"url(#"+u+")")}else a.removeAttribute(Lr[s]);else Lr[s]&&a.setAttribute(Lr[s],o)})},e.prototype.getTotalLength=function(){var t=this.attr(),n=t.x1,i=t.y1,a=t.x2,o=t.y2;return ii.length(n,i,a,o)},e.prototype.getPoint=function(t){var n=this.attr(),i=n.x1,a=n.y1,o=n.x2,s=n.y2;return ii.pointAt(i,a,o,s,t)},e}(pa),HK=YK,Sg={circle:function(r,e,t){return[["M",r,e],["m",-t,0],["a",t,t,0,1,0,t*2,0],["a",t,t,0,1,0,-t*2,0]]},square:function(r,e,t){return[["M",r-t,e-t],["L",r+t,e-t],["L",r+t,e+t],["L",r-t,e+t],["Z"]]},diamond:function(r,e,t){return[["M",r-t,e],["L",r,e-t],["L",r+t,e],["L",r,e+t],["Z"]]},triangle:function(r,e,t){var n=t*Math.sin(1/3*Math.PI);return[["M",r-t,e+n],["L",r,e-n],["L",r+t,e+n],["z"]]},triangleDown:function(r,e,t){var n=t*Math.sin(1/3*Math.PI);return[["M",r-t,e-n],["L",r+t,e-n],["L",r,e+n],["Z"]]}},_k={get:function(r){return Sg[r]},register:function(r,e){Sg[r]=e},remove:function(r){delete Sg[r]},getAll:function(){return Sg}},qK=function(r){Wt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="marker",t.canFill=!0,t.canStroke=!0,t}return e.prototype.createPath=function(t){var n=this.get("el");n.setAttribute("d",this._assembleMarker())},e.prototype._assembleMarker=function(){var t=this._getPath();return Mt(t)?t.map(function(n){return n.join(" ")}).join(""):t},e.prototype._getPath=function(){var t=this.attr(),n=t.x,i=t.y,a=t.r||t.radius,o=t.symbol||"circle",s;return on(o)?s=o:s=_k.get(o),s?s(n,i,a):(console.warn(s+" symbol is not exist."),null)},e.symbolsFactory=_k,e}(pa),KK=qK,ZK=function(r){Wt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="path",t.canFill=!0,t.canStroke=!0,t}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return P(P({},t),{startArrow:!1,endArrow:!1})},e.prototype.createPath=function(t,n){var i=this,a=this.attr(),o=this.get("el");xe(n||a,function(s,u){if(u==="path"&&Mt(s))o.setAttribute("d",i._formatPath(s));else if(u==="startArrow"||u==="endArrow")if(s){var l=gi(s)?t.addArrow(a,Lr[u]):t.getDefaultArrow(a,Lr[u]);o.setAttribute(Lr[u],"url(#"+l+")")}else o.removeAttribute(Lr[u]);else Lr[u]&&o.setAttribute(Lr[u],s)})},e.prototype._formatPath=function(t){var n=t.map(function(i){return i.join(" ")}).join("");return~n.indexOf("NaN")?"":n},e.prototype.getTotalLength=function(){var t=this.get("el");return t?t.getTotalLength():null},e.prototype.getPoint=function(t){var n=this.get("el"),i=this.getTotalLength();if(i===0)return null;var a=n?n.getPointAtLength(t*i):null;return a?{x:a.x,y:a.y}:null},e}(pa),QK=ZK,JK=function(r){Wt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="polygon",t.canFill=!0,t.canStroke=!0,t}return e.prototype.createPath=function(t,n){var i=this.attr(),a=this.get("el");xe(n||i,function(o,s){s==="points"&&Mt(o)&&o.length>=2?a.setAttribute("points",o.map(function(u){return u[0]+","+u[1]}).join(" ")):Lr[s]&&a.setAttribute(Lr[s],o)})},e}(pa),eZ=JK,tZ=function(r){Wt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="polyline",t.canFill=!0,t.canStroke=!0,t}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return P(P({},t),{startArrow:!1,endArrow:!1})},e.prototype.onAttrChange=function(t,n,i){r.prototype.onAttrChange.call(this,t,n,i),["points"].indexOf(t)!==-1&&this._resetCache()},e.prototype._resetCache=function(){this.set("totalLength",null),this.set("tCache",null)},e.prototype.createPath=function(t,n){var i=this.attr(),a=this.get("el");xe(n||i,function(o,s){s==="points"&&Mt(o)&&o.length>=2?a.setAttribute("points",o.map(function(u){return u[0]+","+u[1]}).join(" ")):Lr[s]&&a.setAttribute(Lr[s],o)})},e.prototype.getTotalLength=function(){var t=this.attr().points,n=this.get("totalLength");return xt(n)?(this.set("totalLength",OC.length(t)),this.get("totalLength")):n},e.prototype.getPoint=function(t){var n=this.attr().points,i=this.get("tCache");i||(this._setTcache(),i=this.get("tCache"));var a,o;return xe(i,function(s,u){t>=s[0]&&t<=s[1]&&(a=(t-s[0])/(s[1]-s[0]),o=u)}),ii.pointAt(n[o][0],n[o][1],n[o+1][0],n[o+1][1],a)},e.prototype._setTcache=function(){var t=this.attr().points;if(!(!t||t.length===0)){var n=this.getTotalLength();if(!(n<=0)){var i=0,a=[],o,s;xe(t,function(u,l){t[l+1]&&(o=[],o[0]=i/n,s=ii.length(u[0],u[1],t[l+1][0],t[l+1][1]),i+=s,o[1]=i/n,a.push(o))}),this.set("tCache",a)}}},e.prototype.getStartTangent=function(){var t=this.attr().points,n=[];return n.push([t[1][0],t[1][1]]),n.push([t[0][0],t[0][1]]),n},e.prototype.getEndTangent=function(){var t=this.attr().points,n=t.length-1,i=[];return i.push([t[n-1][0],t[n-1][1]]),i.push([t[n][0],t[n][1]]),i},e}(pa),rZ=tZ;function nZ(r){var e=0,t=0,n=0,i=0;return Mt(r)?r.length===1?e=t=n=i=r[0]:r.length===2?(e=n=r[0],t=i=r[1]):r.length===3?(e=r[0],t=i=r[1],n=r[2]):(e=r[0],t=r[1],n=r[2],i=r[3]):e=t=n=i=r,{r1:e,r2:t,r3:n,r4:i}}var iZ=function(r){Wt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="rect",t.canFill=!0,t.canStroke=!0,t}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return P(P({},t),{x:0,y:0,width:0,height:0,radius:0})},e.prototype.createPath=function(t,n){var i=this,a=this.attr(),o=this.get("el"),s=!1,u=["x","y","width","height","radius"];xe(n||a,function(l,c){u.indexOf(c)!==-1&&!s?(o.setAttribute("d",i._assembleRect(a)),s=!0):u.indexOf(c)===-1&&Lr[c]&&o.setAttribute(Lr[c],l)})},e.prototype._assembleRect=function(t){var n=t.x,i=t.y,a=t.width,o=t.height,s=t.radius;if(!s)return"M "+n+","+i+" l "+a+",0 l 0,"+o+" l"+-a+" 0 z";var u=nZ(s);Mt(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 l=[["M "+(n+u.r1)+","+i],["l "+(a-u.r1-u.r2)+",0"],["a "+u.r2+","+u.r2+",0,0,1,"+u.r2+","+u.r2],["l 0,"+(o-u.r2-u.r3)],["a "+u.r3+","+u.r3+",0,0,1,"+-u.r3+","+u.r3],["l "+(u.r3+u.r4-a)+",0"],["a "+u.r4+","+u.r4+",0,0,1,"+-u.r4+","+-u.r4],["l 0,"+(u.r4+u.r1-o)],["a "+u.r1+","+u.r1+",0,0,1,"+u.r1+","+-u.r1],["z"]];return l.join(" ")},e}(pa),aZ=iZ,Sk=.3,oZ={top:"before-edge",middle:"central",bottom:"after-edge",alphabetic:"baseline",hanging:"hanging"},sZ={top:"text-before-edge",middle:"central",bottom:"text-after-edge",alphabetic:"alphabetic",hanging:"hanging"},uZ={left:"left",start:"left",center:"middle",right:"end",end:"end"},lZ=function(r){Wt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="text",t.canFill=!0,t.canStroke=!0,t}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return P(P({},t),{x:0,y:0,text:null,fontSize:12,fontFamily:"sans-serif",fontStyle:"normal",fontWeight:"normal",fontVariant:"normal",textAlign:"start",textBaseline:"bottom"})},e.prototype.createPath=function(t,n){var i=this,a=this.attr(),o=this.get("el");this._setFont(),xe(n||a,function(s,u){u==="text"?i._setText(""+s):u==="matrix"&&s?Ah(i):Lr[u]&&o.setAttribute(Lr[u],s)}),o.setAttribute("paint-order","stroke"),o.setAttribute("style","stroke-linecap:butt; stroke-linejoin:miter;")},e.prototype._setFont=function(){var t=this.get("el"),n=this.attr(),i=n.textBaseline,a=n.textAlign,o=_I();o&&o.name==="firefox"?t.setAttribute("dominant-baseline",sZ[i]||"alphabetic"):t.setAttribute("alignment-baseline",oZ[i]||"baseline"),t.setAttribute("text-anchor",uZ[a]||"left")},e.prototype._setText=function(t){var n=this.get("el"),i=this.attr(),a=i.x,o=i.textBaseline,s=o===void 0?"bottom":o;if(!t)n.innerHTML="";else if(~t.indexOf(`
`)){var u=t.split(`
`),l=u.length-1,c="";xe(u,function(f,d){d===0?s==="alphabetic"?c+='<tspan x="'+a+'" dy="'+-l+'em">'+f+"</tspan>":s==="top"?c+='<tspan x="'+a+'" dy="0.9em">'+f+"</tspan>":s==="middle"?c+='<tspan x="'+a+'" dy="'+-(l-1)/2+'em">'+f+"</tspan>":s==="bottom"?c+='<tspan x="'+a+'" dy="-'+(l+Sk)+'em">'+f+"</tspan>":s==="hanging"&&(c+='<tspan x="'+a+'" dy="'+(-(l-1)-Sk)+'em">'+f+"</tspan>"):c+='<tspan x="'+a+'" dy="1em">'+f+"</tspan>"}),n.innerHTML=c}else n.innerHTML=t},e}(pa),cZ=lZ,fZ=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,hZ=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,dZ=/[\d.]+:(#[^\s]+|[^)]+\))/gi;function Ek(r){var e=r.match(dZ);if(!e)return"";var t="";return e.sort(function(n,i){return n=n.split(":"),i=i.split(":"),Number(n[0])-Number(i[0])}),xe(e,function(n){n=n.split(":"),t+='<stop offset="'+n[0]+'" stop-color="'+n[1]+'"></stop>'}),t}function vZ(r,e){var t=fZ.exec(r),n=np(ip(parseFloat(t[1])),Math.PI*2),i=t[2],a,o;n>=0&&n<.5*Math.PI?(a={x:0,y:0},o={x:1,y:1}):.5*Math.PI<=n&&n<Math.PI?(a={x:1,y:0},o={x:0,y:1}):Math.PI<=n&&n<1.5*Math.PI?(a={x:1,y:1},o={x:0,y:0}):(a={x:0,y:1},o={x:1,y:0});var s=Math.tan(n),u=s*s,l=(o.x-a.x+s*(o.y-a.y))/(u+1)+a.x,c=s*(o.x-a.x+s*(o.y-a.y))/(u+1)+a.y;e.setAttribute("x1",a.x),e.setAttribute("y1",a.y),e.setAttribute("x2",l),e.setAttribute("y2",c),e.innerHTML=Ek(i)}function pZ(r,e){var t=hZ.exec(r),n=parseFloat(t[1]),i=parseFloat(t[2]),a=parseFloat(t[3]),o=t[4];e.setAttribute("cx",n),e.setAttribute("cy",i),e.setAttribute("r",a),e.innerHTML=Ek(o)}var gZ=function(){function r(e){this.cfg={};var t=null,n=ao("gradient_");return e.toLowerCase()[0]==="l"?(t=va("linearGradient"),vZ(e,t)):(t=va("radialGradient"),pZ(e,t)),t.setAttribute("id",n),this.el=t,this.id=n,this.cfg=e,this}return r.prototype.match=function(e,t){return this.cfg===t},r}(),yZ={shadowColor:"color",shadowOpacity:"opacity",shadowBlur:"blur",shadowOffsetX:"dx",shadowOffsetY:"dy"},mZ={x:"-40%",y:"-40%",width:"200%",height:"200%"},bZ=function(){function r(e){this.type="filter",this.cfg={},this.type="filter";var t=va("filter");return xe(mZ,function(n,i){t.setAttribute(i,n)}),this.el=t,this.id=ao("filter_"),this.el.id=this.id,this.cfg=e,this._parseShadow(e,t),this}return r.prototype.match=function(e,t){if(this.type!==e)return!1;var n=!0,i=this.cfg;return xe(Object.keys(i),function(a){if(i[a]!==t[a])return n=!1,!1}),n},r.prototype.update=function(e,t){var n=this.cfg;return n[yZ[e]]=t,this._parseShadow(n,this.el),this},r.prototype._parseShadow=function(e,t){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)+`"
      />`;t.innerHTML=n},r}(),Ak=function(){function r(e,t){this.cfg={};var n=va("marker"),i=ao("marker_");n.setAttribute("id",i);var a=va("path");a.setAttribute("stroke",e.stroke||"none"),a.setAttribute("fill",e.fill||"none"),n.appendChild(a),n.setAttribute("overflow","visible"),n.setAttribute("orient","auto-start-reverse"),this.el=n,this.child=a,this.id=i;var o=e[t==="marker-start"?"startArrow":"endArrow"];return this.stroke=e.stroke||"#000",o===!0?this._setDefaultPath(t,a):(this.cfg=o,this._setMarker(e.lineWidth,a)),this}return r.prototype.match=function(){return!1},r.prototype._setDefaultPath=function(e,t){var n=this.el;t.setAttribute("d","M0,0 L"+10*Math.cos(Math.PI/6)+",5 L0,10"),n.setAttribute("refX",""+10*Math.cos(Math.PI/6)),n.setAttribute("refY",""+5)},r.prototype._setMarker=function(e,t){var n=this.el,i=this.cfg.path,a=this.cfg.d;Mt(i)&&(i=i.map(function(o){return o.join(" ")}).join("")),t.setAttribute("d",i),n.appendChild(t),a&&n.setAttribute("refX",""+a/e)},r.prototype.update=function(e){var t=this.child;t.attr?t.attr("fill",e):t.setAttribute("fill",e)},r}(),wZ=function(){function r(e){this.type="clip",this.cfg={};var t=va("clipPath");this.el=t,this.id=ao("clip_"),t.id=this.id;var n=e.cfg.el;return t.appendChild(n),this.cfg=e,this}return r.prototype.match=function(){return!1},r.prototype.remove=function(){var e=this.el;e.parentNode.removeChild(e)},r}(),xZ=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,_Z=function(){function r(e){this.cfg={};var t=va("pattern");t.setAttribute("patternUnits","userSpaceOnUse");var n=va("image");t.appendChild(n);var i=ao("pattern_");t.id=i,this.el=t,this.id=i,this.cfg=e;var a=xZ.exec(e),o=a[2];n.setAttribute("href",o);var s=new Image;o.match(/^data:/i)||(s.crossOrigin="Anonymous"),s.src=o;function u(){t.setAttribute("width",""+s.width),t.setAttribute("height",""+s.height)}return s.complete?u():(s.onload=u,s.src=s.src),this}return r.prototype.match=function(e,t){return this.cfg===t},r}(),SZ=function(){function r(e){var t=va("defs"),n=ao("defs_");t.id=n,e.appendChild(t),this.children=[],this.defaultArrow={},this.el=t,this.canvas=e}return r.prototype.find=function(e,t){for(var n=this.children,i=null,a=0;a<n.length;a++)if(n[a].match(e,t)){i=n[a].id;break}return i},r.prototype.findById=function(e){for(var t=this.children,n=null,i=0;i<t.length;i++)if(t[i].id===e){n=t[i];break}return n},r.prototype.add=function(e){this.children.push(e),e.canvas=this.canvas,e.parent=this},r.prototype.getDefaultArrow=function(e,t){var n=e.stroke||e.strokeStyle;if(this.defaultArrow[n])return this.defaultArrow[n].id;var i=new Ak(e,t);return this.defaultArrow[n]=i,this.el.appendChild(i.el),this.add(i),i.id},r.prototype.addGradient=function(e){var t=new gZ(e);return this.el.appendChild(t.el),this.add(t),t.id},r.prototype.addArrow=function(e,t){var n=new Ak(e,t);return this.el.appendChild(n.el),this.add(n),n.id},r.prototype.addShadow=function(e){var t=new bZ(e);return this.el.appendChild(t.el),this.add(t),t.id},r.prototype.addPattern=function(e){var t=new _Z(e);return this.el.appendChild(t.el),this.add(t),t.id},r.prototype.addClip=function(e){var t=new wZ(e);return this.el.appendChild(t.el),this.add(t),t.id},r}(),Ih=function(r){Wt(e,r);function e(t){return r.call(this,P(P({},t),{autoDraw:!0,renderer:"svg"}))||this}return e.prototype.getShapeBase=function(){return Om},e.prototype.getGroupBase=function(){return xk},e.prototype.getShape=function(t,n,i){var a=i.target||i.srcElement;if(!ew[a.tagName]){for(var o=a.parentNode;o&&!ew[o.tagName];)o=o.parentNode;a=o}return this.find(function(s){return s.get("el")===a})},e.prototype.createDom=function(){var t=va("svg"),n=new SZ(t);return t.setAttribute("width",""+this.get("width")),t.setAttribute("height",""+this.get("height")),this.set("context",n),t},e.prototype.onCanvasChange=function(t){var n=this.get("context"),i=this.get("el");if(t==="sort"){var a=this.get("children");a&&a.length&&mk(this,function(s,u){return a.indexOf(s)-a.indexOf(u)?1:0})}else if(t==="clear"){if(i){i.innerHTML="";var o=n.el;o.innerHTML="",i.appendChild(o)}}else t==="matrix"?Ah(this):t==="clip"?Th(this,n):t==="changeSize"&&(i.setAttribute("width",""+this.get("width")),i.setAttribute("height",""+this.get("height")))},e.prototype.draw=function(){var t=this.get("context"),n=this.getChildren();Th(this,t),n.length&&bk(t,n)},e}(hC),Tk={exports:{}},Ik={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]},Ck={exports:{}},EZ=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")},AZ=EZ,TZ=Array.prototype.concat,IZ=Array.prototype.slice,Mk=Ck.exports=function(e){for(var t=[],n=0,i=e.length;n<i;n++){var a=e[n];AZ(a)?t=TZ.call(t,IZ.call(a)):t.push(a)}return t};Mk.wrap=function(r){return function(){return r(Mk(arguments))}};var Eg=Ik,Ch=Ck.exports,kk={};for(var tw in Eg)Eg.hasOwnProperty(tw)&&(kk[Eg[tw]]=tw);var ra=Tk.exports={to:{},get:{}};ra.get=function(r){var e=r.substring(0,3).toLowerCase(),t,n;switch(e){case"hsl":t=ra.get.hsl(r),n="hsl";break;case"hwb":t=ra.get.hwb(r),n="hwb";break;default:t=ra.get.rgb(r),n="rgb";break}return t?{model:n,value:t}:null};ra.get.rgb=function(r){if(!r)return null;var e=/^#([a-f0-9]{3,4})$/i,t=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,n=/^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,i=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,a=/(\D+)/,o=[0,0,0,1],s,u,l;if(s=r.match(t)){for(l=s[2],s=s[1],u=0;u<3;u++){var c=u*2;o[u]=parseInt(s.slice(c,c+2),16)}l&&(o[3]=parseInt(l,16)/255)}else if(s=r.match(e)){for(s=s[1],l=s[3],u=0;u<3;u++)o[u]=parseInt(s[u]+s[u],16);l&&(o[3]=parseInt(l+l,16)/255)}else if(s=r.match(n)){for(u=0;u<3;u++)o[u]=parseInt(s[u+1],0);s[4]&&(o[3]=parseFloat(s[4]))}else if(s=r.match(i)){for(u=0;u<3;u++)o[u]=Math.round(parseFloat(s[u+1])*2.55);s[4]&&(o[3]=parseFloat(s[4]))}else return(s=r.match(a))?s[1]==="transparent"?[0,0,0,0]:(o=Eg[s[1]],o?(o[3]=1,o):null):null;for(u=0;u<3;u++)o[u]=Ps(o[u],0,255);return o[3]=Ps(o[3],0,1),o};ra.get.hsl=function(r){if(!r)return null;var e=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?[\d\.]+)\s*)?\)$/,t=r.match(e);if(t){var n=parseFloat(t[4]),i=(parseFloat(t[1])+360)%360,a=Ps(parseFloat(t[2]),0,100),o=Ps(parseFloat(t[3]),0,100),s=Ps(isNaN(n)?1:n,0,1);return[i,a,o,s]}return null};ra.get.hwb=function(r){if(!r)return null;var e=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,t=r.match(e);if(t){var n=parseFloat(t[4]),i=(parseFloat(t[1])%360+360)%360,a=Ps(parseFloat(t[2]),0,100),o=Ps(parseFloat(t[3]),0,100),s=Ps(isNaN(n)?1:n,0,1);return[i,a,o,s]}return null};ra.to.hex=function(){var r=Ch(arguments);return"#"+Ag(r[0])+Ag(r[1])+Ag(r[2])+(r[3]<1?Ag(Math.round(r[3]*255)):"")};ra.to.rgb=function(){var r=Ch(arguments);return r.length<4||r[3]===1?"rgb("+Math.round(r[0])+", "+Math.round(r[1])+", "+Math.round(r[2])+")":"rgba("+Math.round(r[0])+", "+Math.round(r[1])+", "+Math.round(r[2])+", "+r[3]+")"};ra.to.rgb.percent=function(){var r=Ch(arguments),e=Math.round(r[0]/255*100),t=Math.round(r[1]/255*100),n=Math.round(r[2]/255*100);return r.length<4||r[3]===1?"rgb("+e+"%, "+t+"%, "+n+"%)":"rgba("+e+"%, "+t+"%, "+n+"%, "+r[3]+")"};ra.to.hsl=function(){var r=Ch(arguments);return r.length<4||r[3]===1?"hsl("+r[0]+", "+r[1]+"%, "+r[2]+"%)":"hsla("+r[0]+", "+r[1]+"%, "+r[2]+"%, "+r[3]+")"};ra.to.hwb=function(){var r=Ch(arguments),e="";return r.length>=4&&r[3]!==1&&(e=", "+r[3]),"hwb("+r[0]+", "+r[1]+"%, "+r[2]+"%"+e+")"};ra.to.keyword=function(r){return kk[r.slice(0,3)]};function Ps(r,e,t){return Math.min(Math.max(e,r),t)}function Ag(r){var e=r.toString(16).toUpperCase();return e.length<2?"0"+e:e}var rw={exports:{}},Ku=Ik,Dk={};for(var nw in Ku)Ku.hasOwnProperty(nw)&&(Dk[Ku[nw]]=nw);var Ot=rw.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 Gi in Ot)if(Ot.hasOwnProperty(Gi)){if(!("channels"in Ot[Gi]))throw new Error("missing channels property: "+Gi);if(!("labels"in Ot[Gi]))throw new Error("missing channel labels property: "+Gi);if(Ot[Gi].labels.length!==Ot[Gi].channels)throw new Error("channel and label counts mismatch: "+Gi);var CZ=Ot[Gi].channels,MZ=Ot[Gi].labels;delete Ot[Gi].channels,delete Ot[Gi].labels,Object.defineProperty(Ot[Gi],"channels",{value:CZ}),Object.defineProperty(Ot[Gi],"labels",{value:MZ})}Ot.rgb.hsl=function(r){var e=r[0]/255,t=r[1]/255,n=r[2]/255,i=Math.min(e,t,n),a=Math.max(e,t,n),o=a-i,s,u,l;return a===i?s=0:e===a?s=(t-n)/o:t===a?s=2+(n-e)/o:n===a&&(s=4+(e-t)/o),s=Math.min(s*60,360),s<0&&(s+=360),l=(i+a)/2,a===i?u=0:l<=.5?u=o/(a+i):u=o/(2-a-i),[s,u*100,l*100]};Ot.rgb.hsv=function(r){var e,t,n,i,a,o=r[0]/255,s=r[1]/255,u=r[2]/255,l=Math.max(o,s,u),c=l-Math.min(o,s,u),f=function(d){return(l-d)/6/c+1/2};return c===0?i=a=0:(a=c/l,e=f(o),t=f(s),n=f(u),o===l?i=n-t:s===l?i=1/3+e-n:u===l&&(i=2/3+t-e),i<0?i+=1:i>1&&(i-=1)),[i*360,a*100,l*100]};Ot.rgb.hwb=function(r){var e=r[0],t=r[1],n=r[2],i=Ot.rgb.hsl(r)[0],a=1/255*Math.min(e,Math.min(t,n));return n=1-1/255*Math.max(e,Math.max(t,n)),[i,a*100,n*100]};Ot.rgb.cmyk=function(r){var e=r[0]/255,t=r[1]/255,n=r[2]/255,i,a,o,s;return s=Math.min(1-e,1-t,1-n),i=(1-e-s)/(1-s)||0,a=(1-t-s)/(1-s)||0,o=(1-n-s)/(1-s)||0,[i*100,a*100,o*100,s*100]};function kZ(r,e){return Math.pow(r[0]-e[0],2)+Math.pow(r[1]-e[1],2)+Math.pow(r[2]-e[2],2)}Ot.rgb.keyword=function(r){var e=Dk[r];if(e)return e;var t=1/0,n;for(var i in Ku)if(Ku.hasOwnProperty(i)){var a=Ku[i],o=kZ(r,a);o<t&&(t=o,n=i)}return n};Ot.keyword.rgb=function(r){return Ku[r]};Ot.rgb.xyz=function(r){var e=r[0]/255,t=r[1]/255,n=r[2]/255;e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92,t=t>.04045?Math.pow((t+.055)/1.055,2.4):t/12.92,n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92;var i=e*.4124+t*.3576+n*.1805,a=e*.2126+t*.7152+n*.0722,o=e*.0193+t*.1192+n*.9505;return[i*100,a*100,o*100]};Ot.rgb.lab=function(r){var e=Ot.rgb.xyz(r),t=e[0],n=e[1],i=e[2],a,o,s;return t/=95.047,n/=100,i/=108.883,t=t>.008856?Math.pow(t,1/3):7.787*t+16/116,n=n>.008856?Math.pow(n,1/3):7.787*n+16/116,i=i>.008856?Math.pow(i,1/3):7.787*i+16/116,a=116*n-16,o=500*(t-n),s=200*(n-i),[a,o,s]};Ot.hsl.rgb=function(r){var e=r[0]/360,t=r[1]/100,n=r[2]/100,i,a,o,s,u;if(t===0)return u=n*255,[u,u,u];n<.5?a=n*(1+t):a=n+t-n*t,i=2*n-a,s=[0,0,0];for(var l=0;l<3;l++)o=e+1/3*-(l-1),o<0&&o++,o>1&&o--,6*o<1?u=i+(a-i)*6*o:2*o<1?u=a:3*o<2?u=i+(a-i)*(2/3-o)*6:u=i,s[l]=u*255;return s};Ot.hsl.hsv=function(r){var e=r[0],t=r[1]/100,n=r[2]/100,i=t,a=Math.max(n,.01),o,s;return n*=2,t*=n<=1?n:2-n,i*=a<=1?a:2-a,s=(n+t)/2,o=n===0?2*i/(a+i):2*t/(n+t),[e,o*100,s*100]};Ot.hsv.rgb=function(r){var e=r[0]/60,t=r[1]/100,n=r[2]/100,i=Math.floor(e)%6,a=e-Math.floor(e),o=255*n*(1-t),s=255*n*(1-t*a),u=255*n*(1-t*(1-a));switch(n*=255,i){case 0:return[n,u,o];case 1:return[s,n,o];case 2:return[o,n,u];case 3:return[o,s,n];case 4:return[u,o,n];case 5:return[n,o,s]}};Ot.hsv.hsl=function(r){var e=r[0],t=r[1]/100,n=r[2]/100,i=Math.max(n,.01),a,o,s;return s=(2-t)*n,a=(2-t)*i,o=t*i,o/=a<=1?a:2-a,o=o||0,s/=2,[e,o*100,s*100]};Ot.hwb.rgb=function(r){var e=r[0]/360,t=r[1]/100,n=r[2]/100,i=t+n,a,o,s,u;i>1&&(t/=i,n/=i),a=Math.floor(6*e),o=1-n,s=6*e-a,(a&1)!=0&&(s=1-s),u=t+s*(o-t);var l,c,f;switch(a){default:case 6:case 0:l=o,c=u,f=t;break;case 1:l=u,c=o,f=t;break;case 2:l=t,c=o,f=u;break;case 3:l=t,c=u,f=o;break;case 4:l=u,c=t,f=o;break;case 5:l=o,c=t,f=u;break}return[l*255,c*255,f*255]};Ot.cmyk.rgb=function(r){var e=r[0]/100,t=r[1]/100,n=r[2]/100,i=r[3]/100,a,o,s;return a=1-Math.min(1,e*(1-i)+i),o=1-Math.min(1,t*(1-i)+i),s=1-Math.min(1,n*(1-i)+i),[a*255,o*255,s*255]};Ot.xyz.rgb=function(r){var e=r[0]/100,t=r[1]/100,n=r[2]/100,i,a,o;return i=e*3.2406+t*-1.5372+n*-.4986,a=e*-.9689+t*1.8758+n*.0415,o=e*.0557+t*-.204+n*1.057,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:i*12.92,a=a>.0031308?1.055*Math.pow(a,1/2.4)-.055:a*12.92,o=o>.0031308?1.055*Math.pow(o,1/2.4)-.055:o*12.92,i=Math.min(Math.max(0,i),1),a=Math.min(Math.max(0,a),1),o=Math.min(Math.max(0,o),1),[i*255,a*255,o*255]};Ot.xyz.lab=function(r){var e=r[0],t=r[1],n=r[2],i,a,o;return e/=95.047,t/=100,n/=108.883,e=e>.008856?Math.pow(e,1/3):7.787*e+16/116,t=t>.008856?Math.pow(t,1/3):7.787*t+16/116,n=n>.008856?Math.pow(n,1/3):7.787*n+16/116,i=116*t-16,a=500*(e-t),o=200*(t-n),[i,a,o]};Ot.lab.xyz=function(r){var e=r[0],t=r[1],n=r[2],i,a,o;a=(e+16)/116,i=t/500+a,o=a-n/200;var s=Math.pow(a,3),u=Math.pow(i,3),l=Math.pow(o,3);return a=s>.008856?s:(a-16/116)/7.787,i=u>.008856?u:(i-16/116)/7.787,o=l>.008856?l:(o-16/116)/7.787,i*=95.047,a*=100,o*=108.883,[i,a,o]};Ot.lab.lch=function(r){var e=r[0],t=r[1],n=r[2],i,a,o;return i=Math.atan2(n,t),a=i*360/2/Math.PI,a<0&&(a+=360),o=Math.sqrt(t*t+n*n),[e,o,a]};Ot.lch.lab=function(r){var e=r[0],t=r[1],n=r[2],i,a,o;return o=n/360*2*Math.PI,i=t*Math.cos(o),a=t*Math.sin(o),[e,i,a]};Ot.rgb.ansi16=function(r){var e=r[0],t=r[1],n=r[2],i=1 in arguments?arguments[1]:Ot.rgb.hsv(r)[2];if(i=Math.round(i/50),i===0)return 30;var a=30+(Math.round(n/255)<<2|Math.round(t/255)<<1|Math.round(e/255));return i===2&&(a+=60),a};Ot.hsv.ansi16=function(r){return Ot.rgb.ansi16(Ot.hsv.rgb(r),r[2])};Ot.rgb.ansi256=function(r){var e=r[0],t=r[1],n=r[2];if(e===t&&t===n)return e<8?16:e>248?231:Math.round((e-8)/247*24)+232;var i=16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5);return i};Ot.ansi16.rgb=function(r){var e=r%10;if(e===0||e===7)return r>50&&(e+=3.5),e=e/10.5*255,[e,e,e];var t=(~~(r>50)+1)*.5,n=(e&1)*t*255,i=(e>>1&1)*t*255,a=(e>>2&1)*t*255;return[n,i,a]};Ot.ansi256.rgb=function(r){if(r>=232){var e=(r-232)*10+8;return[e,e,e]}r-=16;var t,n=Math.floor(r/36)/5*255,i=Math.floor((t=r%36)/6)/5*255,a=t%6/5*255;return[n,i,a]};Ot.rgb.hex=function(r){var e=((Math.round(r[0])&255)<<16)+((Math.round(r[1])&255)<<8)+(Math.round(r[2])&255),t=e.toString(16).toUpperCase();return"000000".substring(t.length)+t};Ot.hex.rgb=function(r){var e=r.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];var t=e[0];e[0].length===3&&(t=t.split("").map(function(s){return s+s}).join(""));var n=parseInt(t,16),i=n>>16&255,a=n>>8&255,o=n&255;return[i,a,o]};Ot.rgb.hcg=function(r){var e=r[0]/255,t=r[1]/255,n=r[2]/255,i=Math.max(Math.max(e,t),n),a=Math.min(Math.min(e,t),n),o=i-a,s,u;return o<1?s=a/(1-o):s=0,o<=0?u=0:i===e?u=(t-n)/o%6:i===t?u=2+(n-e)/o:u=4+(e-t)/o+4,u/=6,u%=1,[u*360,o*100,s*100]};Ot.hsl.hcg=function(r){var e=r[1]/100,t=r[2]/100,n=1,i=0;return t<.5?n=2*e*t:n=2*e*(1-t),n<1&&(i=(t-.5*n)/(1-n)),[r[0],n*100,i*100]};Ot.hsv.hcg=function(r){var e=r[1]/100,t=r[2]/100,n=e*t,i=0;return n<1&&(i=(t-n)/(1-n)),[r[0],n*100,i*100]};Ot.hcg.rgb=function(r){var e=r[0]/360,t=r[1]/100,n=r[2]/100;if(t===0)return[n*255,n*255,n*255];var i=[0,0,0],a=e%1*6,o=a%1,s=1-o,u=0;switch(Math.floor(a)){case 0:i[0]=1,i[1]=o,i[2]=0;break;case 1:i[0]=s,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=o;break;case 3:i[0]=0,i[1]=s,i[2]=1;break;case 4:i[0]=o,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=s}return u=(1-t)*n,[(t*i[0]+u)*255,(t*i[1]+u)*255,(t*i[2]+u)*255]};Ot.hcg.hsv=function(r){var e=r[1]/100,t=r[2]/100,n=e+t*(1-e),i=0;return n>0&&(i=e/n),[r[0],i*100,n*100]};Ot.hcg.hsl=function(r){var e=r[1]/100,t=r[2]/100,n=t*(1-e)+.5*e,i=0;return n>0&&n<.5?i=e/(2*n):n>=.5&&n<1&&(i=e/(2*(1-n))),[r[0],i*100,n*100]};Ot.hcg.hwb=function(r){var e=r[1]/100,t=r[2]/100,n=e+t*(1-e);return[r[0],(n-e)*100,(1-n)*100]};Ot.hwb.hcg=function(r){var e=r[1]/100,t=r[2]/100,n=1-t,i=n-e,a=0;return i<1&&(a=(n-i)/(1-i)),[r[0],i*100,a*100]};Ot.apple.rgb=function(r){return[r[0]/65535*255,r[1]/65535*255,r[2]/65535*255]};Ot.rgb.apple=function(r){return[r[0]/255*65535,r[1]/255*65535,r[2]/255*65535]};Ot.gray.rgb=function(r){return[r[0]/100*255,r[0]/100*255,r[0]/100*255]};Ot.gray.hsl=Ot.gray.hsv=function(r){return[0,0,r[0]]};Ot.gray.hwb=function(r){return[0,100,r[0]]};Ot.gray.cmyk=function(r){return[0,0,0,r[0]]};Ot.gray.lab=function(r){return[r[0],0,0]};Ot.gray.hex=function(r){var e=Math.round(r[0]/100*255)&255,t=(e<<16)+(e<<8)+e,n=t.toString(16).toUpperCase();return"000000".substring(n.length)+n};Ot.rgb.gray=function(r){var e=(r[0]+r[1]+r[2])/3;return[e/255*100]};var Tg=rw.exports;function DZ(){for(var r={},e=Object.keys(Tg),t=e.length,n=0;n<t;n++)r[e[n]]={distance:-1,parent:null};return r}function LZ(r){var e=DZ(),t=[r];for(e[r].distance=0;t.length;)for(var n=t.pop(),i=Object.keys(Tg[n]),a=i.length,o=0;o<a;o++){var s=i[o],u=e[s];u.distance===-1&&(u.distance=e[n].distance+1,u.parent=n,t.unshift(s))}return e}function NZ(r,e){return function(t){return e(r(t))}}function OZ(r,e){for(var t=[e[r].parent,r],n=Tg[e[r].parent][r],i=e[r].parent;e[i].parent;)t.unshift(e[i].parent),n=NZ(Tg[e[i].parent][i],n),i=e[i].parent;return n.conversion=t,n}var PZ=function(r){for(var e=LZ(r),t={},n=Object.keys(e),i=n.length,a=0;a<i;a++){var o=n[a],s=e[o];s.parent!==null&&(t[o]=OZ(o,e))}return t},iw=rw.exports,RZ=PZ,mc={},BZ=Object.keys(iw);function FZ(r){var e=function(t){return t==null?t:(arguments.length>1&&(t=Array.prototype.slice.call(arguments)),r(t))};return"conversion"in r&&(e.conversion=r.conversion),e}function UZ(r){var e=function(t){if(t==null)return t;arguments.length>1&&(t=Array.prototype.slice.call(arguments));var n=r(t);if(typeof n=="object")for(var i=n.length,a=0;a<i;a++)n[a]=Math.round(n[a]);return n};return"conversion"in r&&(e.conversion=r.conversion),e}BZ.forEach(function(r){mc[r]={},Object.defineProperty(mc[r],"channels",{value:iw[r].channels}),Object.defineProperty(mc[r],"labels",{value:iw[r].labels});var e=RZ(r),t=Object.keys(e);t.forEach(function(n){var i=e[n];mc[r][n]=UZ(i),mc[r][n].raw=FZ(i)})});var GZ=mc,Mh=Tk.exports,na=GZ,aw=[].slice,Lk=["keyword","gray","hex"],ow={};Object.keys(na).forEach(function(r){ow[aw.call(na[r].labels).sort().join("")]=r});var Ig={};function ci(r,e){if(!(this instanceof ci))return new ci(r,e);if(e&&e in Lk&&(e=null),e&&!(e in na))throw new Error("Unknown model: "+e);var t,n;if(r==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(r instanceof ci)this.model=r.model,this.color=r.color.slice(),this.valpha=r.valpha;else if(typeof r=="string"){var i=Mh.get(r);if(i===null)throw new Error("Unable to parse color from string: "+r);this.model=i.model,n=na[this.model].channels,this.color=i.value.slice(0,n),this.valpha=typeof i.value[n]=="number"?i.value[n]:1}else if(r.length){this.model=e||"rgb",n=na[this.model].channels;var a=aw.call(r,0,n);this.color=sw(a,n),this.valpha=typeof r[n]=="number"?r[n]:1}else if(typeof r=="number")r&=16777215,this.model="rgb",this.color=[r>>16&255,r>>8&255,r&255],this.valpha=1;else{this.valpha=1;var o=Object.keys(r);"alpha"in r&&(o.splice(o.indexOf("alpha"),1),this.valpha=typeof r.alpha=="number"?r.alpha:0);var s=o.sort().join("");if(!(s in ow))throw new Error("Unable to parse color from object: "+JSON.stringify(r));this.model=ow[s];var u=na[this.model].labels,l=[];for(t=0;t<u.length;t++)l.push(r[u[t]]);this.color=sw(l)}if(Ig[this.model])for(n=na[this.model].channels,t=0;t<n;t++){var c=Ig[this.model][t];c&&(this.color[t]=c(this.color[t]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}ci.prototype={toString:function(){return this.string()},toJSON:function(){return this[this.model]()},string:function(r){var e=this.model in Mh.to?this:this.rgb();e=e.round(typeof r=="number"?r:1);var t=e.valpha===1?e.color:e.color.concat(this.valpha);return Mh.to[e.model](t)},percentString:function(r){var e=this.rgb().round(typeof r=="number"?r:1),t=e.valpha===1?e.color:e.color.concat(this.valpha);return Mh.to.rgb.percent(t)},array:function(){return this.valpha===1?this.color.slice():this.color.concat(this.valpha)},object:function(){for(var r={},e=na[this.model].channels,t=na[this.model].labels,n=0;n<e;n++)r[t[n]]=this.color[n];return this.valpha!==1&&(r.alpha=this.valpha),r},unitArray:function(){var r=this.rgb().color;return r[0]/=255,r[1]/=255,r[2]/=255,this.valpha!==1&&r.push(this.valpha),r},unitObject:function(){var r=this.rgb().object();return r.r/=255,r.g/=255,r.b/=255,this.valpha!==1&&(r.alpha=this.valpha),r},round:function(r){return r=Math.max(r||0,0),new ci(this.color.map($Z(r)).concat(this.valpha),this.model)},alpha:function(r){return arguments.length?new ci(this.color.concat(Math.max(0,Math.min(1,r))),this.model):this.valpha},red:En("rgb",0,Xn(255)),green:En("rgb",1,Xn(255)),blue:En("rgb",2,Xn(255)),hue:En(["hsl","hsv","hsl","hwb","hcg"],0,function(r){return(r%360+360)%360}),saturationl:En("hsl",1,Xn(100)),lightness:En("hsl",2,Xn(100)),saturationv:En("hsv",1,Xn(100)),value:En("hsv",2,Xn(100)),chroma:En("hcg",1,Xn(100)),gray:En("hcg",2,Xn(100)),white:En("hwb",1,Xn(100)),wblack:En("hwb",2,Xn(100)),cyan:En("cmyk",0,Xn(100)),magenta:En("cmyk",1,Xn(100)),yellow:En("cmyk",2,Xn(100)),black:En("cmyk",3,Xn(100)),x:En("xyz",0,Xn(100)),y:En("xyz",1,Xn(100)),z:En("xyz",2,Xn(100)),l:En("lab",0,Xn(100)),a:En("lab",1),b:En("lab",2),keyword:function(r){return arguments.length?new ci(r):na[this.model].keyword(this.color)},hex:function(r){return arguments.length?new ci(r):Mh.to.hex(this.rgb().round().color)},rgbNumber:function(){var r=this.rgb().color;return(r[0]&255)<<16|(r[1]&255)<<8|r[2]&255},luminosity:function(){for(var r=this.rgb().color,e=[],t=0;t<r.length;t++){var n=r[t]/255;e[t]=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4)}return .2126*e[0]+.7152*e[1]+.0722*e[2]},contrast:function(r){var e=this.luminosity(),t=r.luminosity();return e>t?(e+.05)/(t+.05):(t+.05)/(e+.05)},level:function(r){var e=this.contrast(r);return e>=7.1?"AAA":e>=4.5?"AA":""},isDark:function(){var r=this.rgb().color,e=(r[0]*299+r[1]*587+r[2]*114)/1e3;return e<128},isLight:function(){return!this.isDark()},negate:function(){for(var r=this.rgb(),e=0;e<3;e++)r.color[e]=255-r.color[e];return r},lighten:function(r){var e=this.hsl();return e.color[2]+=e.color[2]*r,e},darken:function(r){var e=this.hsl();return e.color[2]-=e.color[2]*r,e},saturate:function(r){var e=this.hsl();return e.color[1]+=e.color[1]*r,e},desaturate:function(r){var e=this.hsl();return e.color[1]-=e.color[1]*r,e},whiten:function(r){var e=this.hwb();return e.color[1]+=e.color[1]*r,e},blacken:function(r){var e=this.hwb();return e.color[2]+=e.color[2]*r,e},grayscale:function(){var r=this.rgb().color,e=r[0]*.3+r[1]*.59+r[2]*.11;return ci.rgb(e,e,e)},fade:function(r){return this.alpha(this.valpha-this.valpha*r)},opaquer:function(r){return this.alpha(this.valpha+this.valpha*r)},rotate:function(r){var e=this.hsl(),t=e.color[0];return t=(t+r)%360,t=t<0?360+t:t,e.color[0]=t,e},mix:function(r,e){if(!r||!r.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof r);var t=r.rgb(),n=this.rgb(),i=e===void 0?.5:e,a=2*i-1,o=t.alpha()-n.alpha(),s=((a*o==-1?a:(a+o)/(1+a*o))+1)/2,u=1-s;return ci.rgb(s*t.red()+u*n.red(),s*t.green()+u*n.green(),s*t.blue()+u*n.blue(),t.alpha()*i+n.alpha()*(1-i))}};Object.keys(na).forEach(function(r){if(Lk.indexOf(r)===-1){var e=na[r].channels;ci.prototype[r]=function(){if(this.model===r)return new ci(this);if(arguments.length)return new ci(arguments,r);var t=typeof arguments[e]=="number"?e:this.valpha;return new ci(VZ(na[this.model][r].raw(this.color)).concat(t),r)},ci[r]=function(t){return typeof t=="number"&&(t=sw(aw.call(arguments),e)),new ci(t,r)}}});function zZ(r,e){return Number(r.toFixed(e))}function $Z(r){return function(e){return zZ(e,r)}}function En(r,e,t){return r=Array.isArray(r)?r:[r],r.forEach(function(n){(Ig[n]||(Ig[n]=[]))[e]=t}),r=r[0],function(n){var i;return arguments.length?(t&&(n=t(n)),i=this[r](),i.color[e]=n,i):(i=this[r]().color[e],t&&(i=t(i)),i)}}function Xn(r){return function(e){return Math.max(0,Math.min(r,e))}}function VZ(r){return Array.isArray(r)?r:[r]}function sw(r,e){for(var t=0;t<e;t++)typeof r[t]!="number"&&(r[t]=0);return r}var kh=ci,Nk={exports:{}};(function(r){(function(e){var t=/^\s+/,n=/\s+$/,i=0,a=e.round,o=e.min,s=e.max,u=e.random;function l($,se){if($=$||"",se=se||{},$ instanceof l)return $;if(!(this instanceof l))return new l($,se);var W=c($);this._originalInput=$,this._r=W.r,this._g=W.g,this._b=W.b,this._a=W.a,this._roundA=a(100*this._a)/100,this._format=se.format||W.format,this._gradientType=se.gradientType,this._r<1&&(this._r=a(this._r)),this._g<1&&(this._g=a(this._g)),this._b<1&&(this._b=a(this._b)),this._ok=W.ok,this._tc_id=i++}l.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 $=this.toRgb();return($.r*299+$.g*587+$.b*114)/1e3},getLuminance:function(){var $=this.toRgb(),se,W,Ze,yt,at,Ye;return se=$.r/255,W=$.g/255,Ze=$.b/255,se<=.03928?yt=se/12.92:yt=e.pow((se+.055)/1.055,2.4),W<=.03928?at=W/12.92:at=e.pow((W+.055)/1.055,2.4),Ze<=.03928?Ye=Ze/12.92:Ye=e.pow((Ze+.055)/1.055,2.4),.2126*yt+.7152*at+.0722*Ye},setAlpha:function($){return this._a=X($),this._roundA=a(100*this._a)/100,this},toHsv:function(){var $=v(this._r,this._g,this._b);return{h:$.h*360,s:$.s,v:$.v,a:this._a}},toHsvString:function(){var $=v(this._r,this._g,this._b),se=a($.h*360),W=a($.s*100),Ze=a($.v*100);return this._a==1?"hsv("+se+", "+W+"%, "+Ze+"%)":"hsva("+se+", "+W+"%, "+Ze+"%, "+this._roundA+")"},toHsl:function(){var $=d(this._r,this._g,this._b);return{h:$.h*360,s:$.s,l:$.l,a:this._a}},toHslString:function(){var $=d(this._r,this._g,this._b),se=a($.h*360),W=a($.s*100),Ze=a($.l*100);return this._a==1?"hsl("+se+", "+W+"%, "+Ze+"%)":"hsla("+se+", "+W+"%, "+Ze+"%, "+this._roundA+")"},toHex:function($){return g(this._r,this._g,this._b,$)},toHexString:function($){return"#"+this.toHex($)},toHex8:function($){return y(this._r,this._g,this._b,this._a,$)},toHex8String:function($){return"#"+this.toHex8($)},toRgb:function(){return{r:a(this._r),g:a(this._g),b:a(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+a(this._r)+", "+a(this._g)+", "+a(this._b)+")":"rgba("+a(this._r)+", "+a(this._g)+", "+a(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:a(H(this._r,255)*100)+"%",g:a(H(this._g,255)*100)+"%",b:a(H(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+a(H(this._r,255)*100)+"%, "+a(H(this._g,255)*100)+"%, "+a(H(this._b,255)*100)+"%)":"rgba("+a(H(this._r,255)*100)+"%, "+a(H(this._g,255)*100)+"%, "+a(H(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:K[g(this._r,this._g,this._b,!0)]||!1},toFilter:function($){var se="#"+m(this._r,this._g,this._b,this._a),W=se,Ze=this._gradientType?"GradientType = 1, ":"";if($){var yt=l($);W="#"+m(yt._r,yt._g,yt._b,yt._a)}return"progid:DXImageTransform.Microsoft.gradient("+Ze+"startColorstr="+se+",endColorstr="+W+")"},toString:function($){var se=!!$;$=$||this._format;var W=!1,Ze=this._a<1&&this._a>=0,yt=!se&&Ze&&($==="hex"||$==="hex6"||$==="hex3"||$==="hex4"||$==="hex8"||$==="name");return yt?$==="name"&&this._a===0?this.toName():this.toRgbString():($==="rgb"&&(W=this.toRgbString()),$==="prgb"&&(W=this.toPercentageRgbString()),($==="hex"||$==="hex6")&&(W=this.toHexString()),$==="hex3"&&(W=this.toHexString(!0)),$==="hex4"&&(W=this.toHex8String(!0)),$==="hex8"&&(W=this.toHex8String()),$==="name"&&(W=this.toName()),$==="hsl"&&(W=this.toHslString()),$==="hsv"&&(W=this.toHsvString()),W||this.toHexString())},clone:function(){return l(this.toString())},_applyModification:function($,se){var W=$.apply(null,[this].concat([].slice.call(se)));return this._r=W._r,this._g=W._g,this._b=W._b,this.setAlpha(W._a),this},lighten:function(){return this._applyModification(_,arguments)},brighten:function(){return this._applyModification(A,arguments)},darken:function(){return this._applyModification(I,arguments)},desaturate:function(){return this._applyModification(b,arguments)},saturate:function(){return this._applyModification(w,arguments)},greyscale:function(){return this._applyModification(x,arguments)},spin:function(){return this._applyModification(M,arguments)},_applyCombination:function($,se){return $.apply(null,[this].concat([].slice.call(se)))},analogous:function(){return this._applyCombination(L,arguments)},complement:function(){return this._applyCombination(S,arguments)},monochromatic:function(){return this._applyCombination(B,arguments)},splitcomplement:function(){return this._applyCombination(k,arguments)},triad:function(){return this._applyCombination(C,arguments)},tetrad:function(){return this._applyCombination(T,arguments)}},l.fromRatio=function($,se){if(typeof $=="object"){var W={};for(var Ze in $)$.hasOwnProperty(Ze)&&(Ze==="a"?W[Ze]=$[Ze]:W[Ze]=ze($[Ze]));$=W}return l($,se)};function c($){var se={r:0,g:0,b:0},W=1,Ze=null,yt=null,at=null,Ye=!1,pt=!1;return typeof $=="string"&&($=gr($)),typeof $=="object"&&(st($.r)&&st($.g)&&st($.b)?(se=f($.r,$.g,$.b),Ye=!0,pt=String($.r).substr(-1)==="%"?"prgb":"rgb"):st($.h)&&st($.s)&&st($.v)?(Ze=ze($.s),yt=ze($.v),se=p($.h,Ze,yt),Ye=!0,pt="hsv"):st($.h)&&st($.s)&&st($.l)&&(Ze=ze($.s),at=ze($.l),se=h($.h,Ze,at),Ye=!0,pt="hsl"),$.hasOwnProperty("a")&&(W=$.a)),W=X(W),{ok:Ye,format:$.format||pt,r:o(255,s(se.r,0)),g:o(255,s(se.g,0)),b:o(255,s(se.b,0)),a:W}}function f($,se,W){return{r:H($,255)*255,g:H(se,255)*255,b:H(W,255)*255}}function d($,se,W){$=H($,255),se=H(se,255),W=H(W,255);var Ze=s($,se,W),yt=o($,se,W),at,Ye,pt=(Ze+yt)/2;if(Ze==yt)at=Ye=0;else{var ht=Ze-yt;switch(Ye=pt>.5?ht/(2-Ze-yt):ht/(Ze+yt),Ze){case $:at=(se-W)/ht+(se<W?6:0);break;case se:at=(W-$)/ht+2;break;case W:at=($-se)/ht+4;break}at/=6}return{h:at,s:Ye,l:pt}}function h($,se,W){var Ze,yt,at;$=H($,360),se=H(se,100),W=H(W,100);function Ye(dt,D,V){return V<0&&(V+=1),V>1&&(V-=1),V<1/6?dt+(D-dt)*6*V:V<1/2?D:V<2/3?dt+(D-dt)*(2/3-V)*6:dt}if(se===0)Ze=yt=at=W;else{var pt=W<.5?W*(1+se):W+se-W*se,ht=2*W-pt;Ze=Ye(ht,pt,$+1/3),yt=Ye(ht,pt,$),at=Ye(ht,pt,$-1/3)}return{r:Ze*255,g:yt*255,b:at*255}}function v($,se,W){$=H($,255),se=H(se,255),W=H(W,255);var Ze=s($,se,W),yt=o($,se,W),at,Ye,pt=Ze,ht=Ze-yt;if(Ye=Ze===0?0:ht/Ze,Ze==yt)at=0;else{switch(Ze){case $:at=(se-W)/ht+(se<W?6:0);break;case se:at=(W-$)/ht+2;break;case W:at=($-se)/ht+4;break}at/=6}return{h:at,s:Ye,v:pt}}function p($,se,W){$=H($,360)*6,se=H(se,100),W=H(W,100);var Ze=e.floor($),yt=$-Ze,at=W*(1-se),Ye=W*(1-yt*se),pt=W*(1-(1-yt)*se),ht=Ze%6,dt=[W,Ye,at,at,pt,W][ht],D=[pt,W,W,Ye,at,at][ht],V=[at,at,pt,W,W,Ye][ht];return{r:dt*255,g:D*255,b:V*255}}function g($,se,W,Ze){var yt=[Ae(a($).toString(16)),Ae(a(se).toString(16)),Ae(a(W).toString(16))];return Ze&&yt[0].charAt(0)==yt[0].charAt(1)&&yt[1].charAt(0)==yt[1].charAt(1)&&yt[2].charAt(0)==yt[2].charAt(1)?yt[0].charAt(0)+yt[1].charAt(0)+yt[2].charAt(0):yt.join("")}function y($,se,W,Ze,yt){var at=[Ae(a($).toString(16)),Ae(a(se).toString(16)),Ae(a(W).toString(16)),Ae(qe(Ze))];return yt&&at[0].charAt(0)==at[0].charAt(1)&&at[1].charAt(0)==at[1].charAt(1)&&at[2].charAt(0)==at[2].charAt(1)&&at[3].charAt(0)==at[3].charAt(1)?at[0].charAt(0)+at[1].charAt(0)+at[2].charAt(0)+at[3].charAt(0):at.join("")}function m($,se,W,Ze){var yt=[Ae(qe(Ze)),Ae(a($).toString(16)),Ae(a(se).toString(16)),Ae(a(W).toString(16))];return yt.join("")}l.equals=function($,se){return!$||!se?!1:l($).toRgbString()==l(se).toRgbString()},l.random=function(){return l.fromRatio({r:u(),g:u(),b:u()})};function b($,se){se=se===0?0:se||10;var W=l($).toHsl();return W.s-=se/100,W.s=J(W.s),l(W)}function w($,se){se=se===0?0:se||10;var W=l($).toHsl();return W.s+=se/100,W.s=J(W.s),l(W)}function x($){return l($).desaturate(100)}function _($,se){se=se===0?0:se||10;var W=l($).toHsl();return W.l+=se/100,W.l=J(W.l),l(W)}function A($,se){se=se===0?0:se||10;var W=l($).toRgb();return W.r=s(0,o(255,W.r-a(255*-(se/100)))),W.g=s(0,o(255,W.g-a(255*-(se/100)))),W.b=s(0,o(255,W.b-a(255*-(se/100)))),l(W)}function I($,se){se=se===0?0:se||10;var W=l($).toHsl();return W.l-=se/100,W.l=J(W.l),l(W)}function M($,se){var W=l($).toHsl(),Ze=(W.h+se)%360;return W.h=Ze<0?360+Ze:Ze,l(W)}function S($){var se=l($).toHsl();return se.h=(se.h+180)%360,l(se)}function C($){var se=l($).toHsl(),W=se.h;return[l($),l({h:(W+120)%360,s:se.s,l:se.l}),l({h:(W+240)%360,s:se.s,l:se.l})]}function T($){var se=l($).toHsl(),W=se.h;return[l($),l({h:(W+90)%360,s:se.s,l:se.l}),l({h:(W+180)%360,s:se.s,l:se.l}),l({h:(W+270)%360,s:se.s,l:se.l})]}function k($){var se=l($).toHsl(),W=se.h;return[l($),l({h:(W+72)%360,s:se.s,l:se.l}),l({h:(W+216)%360,s:se.s,l:se.l})]}function L($,se,W){se=se||6,W=W||30;var Ze=l($).toHsl(),yt=360/W,at=[l($)];for(Ze.h=(Ze.h-(yt*se>>1)+720)%360;--se;)Ze.h=(Ze.h+yt)%360,at.push(l(Ze));return at}function B($,se){se=se||6;for(var W=l($).toHsv(),Ze=W.h,yt=W.s,at=W.v,Ye=[],pt=1/se;se--;)Ye.push(l({h:Ze,s:yt,v:at})),at=(at+pt)%1;return Ye}l.mix=function($,se,W){W=W===0?0:W||50;var Ze=l($).toRgb(),yt=l(se).toRgb(),at=W/100,Ye={r:(yt.r-Ze.r)*at+Ze.r,g:(yt.g-Ze.g)*at+Ze.g,b:(yt.b-Ze.b)*at+Ze.b,a:(yt.a-Ze.a)*at+Ze.a};return l(Ye)},l.readability=function($,se){var W=l($),Ze=l(se);return(e.max(W.getLuminance(),Ze.getLuminance())+.05)/(e.min(W.getLuminance(),Ze.getLuminance())+.05)},l.isReadable=function($,se,W){var Ze=l.readability($,se),yt,at;switch(at=!1,yt=tr(W),yt.level+yt.size){case"AAsmall":case"AAAlarge":at=Ze>=4.5;break;case"AAlarge":at=Ze>=3;break;case"AAAsmall":at=Ze>=7;break}return at},l.mostReadable=function($,se,W){var Ze=null,yt=0,at,Ye,pt,ht;W=W||{},Ye=W.includeFallbackColors,pt=W.level,ht=W.size;for(var dt=0;dt<se.length;dt++)at=l.readability($,se[dt]),at>yt&&(yt=at,Ze=l(se[dt]));return l.isReadable($,Ze,{level:pt,size:ht})||!Ye?Ze:(W.includeFallbackColors=!1,l.mostReadable($,["#fff","#000"],W))};var ee=l.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"},K=l.hexNames=z(ee);function z($){var se={};for(var W in $)$.hasOwnProperty(W)&&(se[$[W]]=W);return se}function X($){return $=parseFloat($),(isNaN($)||$<0||$>1)&&($=1),$}function H($,se){me($)&&($="100%");var W=oe($);return $=o(se,s(0,parseFloat($))),W&&($=parseInt($*se,10)/100),e.abs($-se)<1e-6?1:$%se/parseFloat(se)}function J($){return o(1,s(0,$))}function ne($){return parseInt($,16)}function me($){return typeof $=="string"&&$.indexOf(".")!=-1&&parseFloat($)===1}function oe($){return typeof $=="string"&&$.indexOf("%")!=-1}function Ae($){return $.length==1?"0"+$:""+$}function ze($){return $<=1&&($=$*100+"%"),$}function qe($){return e.round(parseFloat($)*255).toString(16)}function ft($){return ne($)/255}var ct=function(){var $="[-\\+]?\\d+%?",se="[-\\+]?\\d*\\.\\d+%?",W="(?:"+se+")|(?:"+$+")",Ze="[\\s|\\(]+("+W+")[,|\\s]+("+W+")[,|\\s]+("+W+")\\s*\\)?",yt="[\\s|\\(]+("+W+")[,|\\s]+("+W+")[,|\\s]+("+W+")[,|\\s]+("+W+")\\s*\\)?";return{CSS_UNIT:new RegExp(W),rgb:new RegExp("rgb"+Ze),rgba:new RegExp("rgba"+yt),hsl:new RegExp("hsl"+Ze),hsla:new RegExp("hsla"+yt),hsv:new RegExp("hsv"+Ze),hsva:new RegExp("hsva"+yt),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 st($){return!!ct.CSS_UNIT.exec($)}function gr($){$=$.replace(t,"").replace(n,"").toLowerCase();var se=!1;if(ee[$])$=ee[$],se=!0;else if($=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var W;return(W=ct.rgb.exec($))?{r:W[1],g:W[2],b:W[3]}:(W=ct.rgba.exec($))?{r:W[1],g:W[2],b:W[3],a:W[4]}:(W=ct.hsl.exec($))?{h:W[1],s:W[2],l:W[3]}:(W=ct.hsla.exec($))?{h:W[1],s:W[2],l:W[3],a:W[4]}:(W=ct.hsv.exec($))?{h:W[1],s:W[2],v:W[3]}:(W=ct.hsva.exec($))?{h:W[1],s:W[2],v:W[3],a:W[4]}:(W=ct.hex8.exec($))?{r:ne(W[1]),g:ne(W[2]),b:ne(W[3]),a:ft(W[4]),format:se?"name":"hex8"}:(W=ct.hex6.exec($))?{r:ne(W[1]),g:ne(W[2]),b:ne(W[3]),format:se?"name":"hex"}:(W=ct.hex4.exec($))?{r:ne(W[1]+""+W[1]),g:ne(W[2]+""+W[2]),b:ne(W[3]+""+W[3]),a:ft(W[4]+""+W[4]),format:se?"name":"hex8"}:(W=ct.hex3.exec($))?{r:ne(W[1]+""+W[1]),g:ne(W[2]+""+W[2]),b:ne(W[3]+""+W[3]),format:se?"name":"hex"}:!1}function tr($){var se,W;return $=$||{level:"AA",size:"small"},se=($.level||"AA").toUpperCase(),W=($.size||"small").toLowerCase(),se!=="AA"&&se!=="AAA"&&(se="AA"),W!=="small"&&W!=="large"&&(W="small"),{level:se,size:W}}r.exports?r.exports=l:window.tinycolor=l})(Math)})(Nk);var Cg=Nk.exports,Mg=2,Ok=.16,jZ=.05,WZ=.05,XZ=.15,Pk=5,Rk=4,YZ=[{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 Bk(r,e,t){var n;return Math.round(r.h)>=60&&Math.round(r.h)<=240?n=t?Math.round(r.h)-Mg*e:Math.round(r.h)+Mg*e:n=t?Math.round(r.h)+Mg*e:Math.round(r.h)-Mg*e,n<0?n+=360:n>=360&&(n-=360),n}function Fk(r,e,t){if(r.h===0&&r.s===0)return r.s;var n;return t?n=r.s-Ok*e:e===Rk?n=r.s+Ok:n=r.s+jZ*e,n>1&&(n=1),t&&e===Pk&&n>.1&&(n=.1),n<.06&&(n=.06),Number(n.toFixed(2))}function Uk(r,e,t){var n;return t?n=r.v+WZ*e:n=r.v-XZ*e,n>1&&(n=1),Number(n.toFixed(2))}function kg(r){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=[],n=Cg(r),i=Pk;i>0;i-=1){var a=n.toHsv(),o=Cg({h:Bk(a,i,!0),s:Fk(a,i,!0),v:Uk(a,i,!0)}).toHexString();t.push(o)}t.push(n.toHexString());for(var s=1;s<=Rk;s+=1){var u=n.toHsv(),l=Cg({h:Bk(u,s),s:Fk(u,s),v:Uk(u,s)}).toHexString();t.push(l)}return e.theme==="dark"?YZ.map(function(c){var f=c.index,d=c.opacity,h=Cg.mix(e.backgroundColor||"#141414",t[f],d*100).toHexString();return h}):t}var uw={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"},mi={},lw={};Object.keys(uw).forEach(function(r){mi[r]=kg(uw[r]),mi[r].primary=mi[r][5],lw[r]=kg(uw[r],{theme:"dark",backgroundColor:"#141414"}),lw[r].primary=lw[r][5]});mi.red;mi.volcano;mi.gold;mi.orange;mi.yellow;mi.lime;mi.green;mi.cyan;mi.blue;mi.geekblue;mi.purple;mi.magenta;mi.grey;var Yn=function(e,t,n){var i=kh(e),a=kh(t);return kh([(1-n)*i.red()+n*a.red(),(1-n)*i.green()+n*a.green(),(1-n)*i.blue()+n*a.blue()]).rgb()},HZ=function(e,t,n){t===void 0&&(t="#fff"),n===void 0&&(n="rgb(150, 150, 150)");var i=Yn(t,e,.05).rgb().toString(),a=Yn(t,e,.1).rgb().toString(),o=Yn(t,e,.2).rgb().toString(),s=Yn(t,e,.4).rgb().toString(),u=Yn(t,n,.02).rgb().toString(),l=Yn(t,n,.05).rgb().toString(),c=Yn(t,n,.1).rgb().toString(),f=Yn(t,n,.2).rgb().toString(),d=Yn(t,n,.3).rgb().toString(),h=kg(e,{theme:"default",backgroundColor:t}),v=kh(e).hex().toLowerCase(),p=h.indexOf(v),g=e;return p!==-1&&(g=h[p+1]),{mainStroke:e,mainFill:a,activeStroke:e,activeFill:i,inactiveStroke:s,inactiveFill:i,selectedStroke:e,selectedFill:t,highlightStroke:g,highlightFill:o,disableStroke:d,disableFill:l,edgeMainStroke:d,edgeActiveStroke:e,edgeInactiveStroke:f,edgeSelectedStroke:e,edgeHighlightStroke:e,edgeDisableStroke:c,comboMainStroke:d,comboMainFill:u,comboActiveStroke:e,comboActiveFill:i,comboInactiveStroke:d,comboInactiveFill:u,comboSelectedStroke:e,comboSelectedFill:u,comboHighlightStroke:g,comboHighlightFill:u,comboDisableStroke:f,comboDisableFill:l}},qZ=function(e,t,n){t===void 0&&(t="#fff"),n===void 0&&(n="#777");var i=Yn(t,e,.2).rgb().toString(),a=Yn(t,e,.3).rgb().toString(),o=Yn(t,e,.6).rgb().toString(),s=Yn(t,e,.8).rgb().toString(),u=Yn(t,n,.2).rgb().toString(),l=Yn(t,n,.25).rgb().toString(),c=Yn(t,n,.3).rgb().toString(),f=Yn(t,n,.4).rgb().toString(),d=Yn(t,n,.5).rgb().toString(),h=kg(e,{theme:"dark",backgroundColor:t}),v=kh(e).hex().toLowerCase(),p=h.indexOf(v),g=e;return p!==-1&&(g=h[p+1]),{mainStroke:s,mainFill:i,activeStroke:e,activeFill:a,inactiveStroke:s,inactiveFill:i,selectedStroke:e,selectedFill:i,highlightStroke:e,highlightFill:o,disableStroke:d,disableFill:l,edgeMainStroke:n,edgeActiveStroke:e,edgeInactiveStroke:n,edgeSelectedStroke:e,edgeHighlightStroke:e,edgeDisableStroke:c,comboMainStroke:f,comboMainFill:l,comboActiveStroke:e,comboActiveFill:u,comboInactiveStroke:f,comboInactiveFill:l,comboSelectedStroke:e,comboSelectedFill:u,comboHighlightStroke:g,comboHighlightFill:l,comboDisableStroke:f,comboDisableFill:u}},cw=function(e,t,n,i){return t===void 0&&(t="#fff"),n===void 0&&(n="default"),n==="default"?HZ(e,t,"rgb(150, 150, 150)"):qZ(e,t,"#777")},KZ=function(e,t,n,i){t===void 0&&(t="#fff"),n===void 0&&(n="default");var a=[];return e.forEach(function(o){a.push(cw(o,t,n))}),a},ZZ=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",mixColor:Yn,getColorsWithSubjectColor:cw,getColorSetsBySubjectColors:KZ}),QZ="rgb(95, 149, 255)",JZ="rgb(255, 255, 255)",Gk="rgb(0, 0, 0)",xr=cw(QZ,JZ),Zu={version:"0.3.11",rootContainerClassName:"root-container",nodeContainerClassName:"node-container",edgeContainerClassName:"edge-container",comboContainerClassName:"combo-container",delegateContainerClassName:"delegate-container",defaultLoopPosition:"top",nodeLabel:{style:{fill:"#000",fontSize:12,textAlign:"center",textBaseline:"middle"},offset:4},defaultNode:{type:"circle",style:{lineWidth:1,stroke:xr.mainStroke,fill:xr.mainFill},size:20,color:xr.mainStroke,linkPoints:{size:8,lineWidth:1,fill:xr.activeFill,stroke:xr.activeStroke}},nodeStateStyles:{active:{fill:xr.activeFill,stroke:xr.activeStroke,lineWidth:2,shadowColor:xr.mainStroke,shadowBlur:10},selected:{fill:xr.selectedFill,stroke:xr.selectedStroke,lineWidth:4,shadowColor:xr.selectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{fill:xr.highlightFill,stroke:xr.highlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{fill:xr.inactiveFill,stroke:xr.inactiveStroke,lineWidth:1},disable:{fill:xr.disableFill,stroke:xr.disableStroke,lineWidth:1}},edgeLabel:{style:{fill:Gk,textAlign:"center",textBaseline:"middle",fontSize:12}},defaultEdge:{type:"line",size:1,style:{stroke:xr.edgeMainStroke,lineAppendWidth:2},color:xr.edgeMainStroke},edgeStateStyles:{active:{stroke:xr.edgeActiveStroke,lineWidth:1},selected:{stroke:xr.edgeSelectedStroke,lineWidth:2,shadowColor:xr.edgeSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:xr.edgeHighlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{stroke:xr.edgeInactiveStroke,lineWidth:1},disable:{stroke:xr.edgeDisableStroke,lineWidth:1}},comboLabel:{style:{fill:Gk,textBaseline:"middle",fontSize:12},refY:10,refX:10},defaultCombo:{type:"circle",style:{fill:xr.comboMainFill,lineWidth:1,stroke:xr.comboMainStroke,r:5,width:20,height:10},size:[20,5],color:xr.comboMainStroke,padding:[25,20,15,20]},comboStateStyles:{active:{stroke:xr.comboActiveStroke,lineWidth:1,fill:xr.comboActiveFill},selected:{stroke:xr.comboSelectedStroke,lineWidth:2,fill:xr.comboSelectedFill,shadowColor:xr.comboSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:xr.comboHighlightStroke,lineWidth:2,fill:xr.comboHighlightFill,"text-shape":{fontWeight:500}},inactive:{stroke:xr.comboInactiveStroke,fill:xr.comboInactiveFill,lineWidth:1},disable:{stroke:xr.comboDisableStroke,fill:xr.comboDisableFill,lineWidth:1}},delegateStyle:{fill:"#F3F9FF",fillOpacity:.5,stroke:"#1890FF",strokeOpacity:.9,lineDash:[5,5]},textWaterMarkerConfig:{width:150,height:100,compatible:!1,text:{x:0,y:60,lineHeight:20,rotate:20,fontSize:14,fontFamily:"Microsoft YaHei",fill:"rgba(0, 0, 0, 0.1)",baseline:"Middle"}},imageWaterMarkerConfig:{width:150,height:130,compatible:!1,image:{x:0,y:0,width:30,height:20,rotate:0}},waterMarkerImage:"https://gw.alipayobjects.com/os/s/prod/antv/assets/image/logo-with-text-73b8a.svg"};function Dh(r,e,t){if(r){if(typeof r.addEventListener=="function")return r.addEventListener(e,t,!1),{remove:function(){r.removeEventListener(e,t,!1)}};if(typeof r.attachEvent=="function")return r.attachEvent("on"+e,t),{remove:function(){r.detachEvent("on"+e,t)}}}}var Lh,fw,zk,hw;function eQ(){Lh=document.createElement("table"),fw=document.createElement("tr"),zk=/^\s*<(\w+|!)[^>]*>/,hw={tr:document.createElement("tbody"),tbody:Lh,thead:Lh,tfoot:Lh,td:fw,th:fw,"*":document.createElement("div")}}function An(r){Lh||eQ();var e=zk.test(r)&&RegExp.$1;(!e||!(e in hw))&&(e="*");var t=hw[e];r=r.replace(/(^\s*)|(\s*$)/g,""),t.innerHTML=""+r;var n=t.childNodes[0];return t.removeChild(n),n}function jr(r,e){if(r)for(var t in e)e.hasOwnProperty(t)&&(r.style[t]=e[t]);return r}var tQ=Ua.cloneEvent,rQ=Ua.isViewportChanged,nQ=function(r){Wt(e,r);function e(t){var n=r.call(this,t)||this;return n.extendEvents=[],n.dragging=!1,n.preItem=null,n.graph=t,n.destroyed=!1,n.initEvents(),n}return e.prototype.initEvents=function(){var t=this,n=t.graph,i=t.extendEvents,a=i===void 0?[]:i,o=n.get("canvas"),s=o.get("el"),u=ec(this,"onCanvasEvents"),l=ec(this,"onExtendEvents"),c=ec(this,"onWheelEvent");o.off("*").on("*",u),this.canvasHandler=u,a.push(Dh(s,"DOMMouseScroll",c)),a.push(Dh(s,"mousewheel",c)),typeof window!="undefined"&&(a.push(Dh(window,"keydown",l)),a.push(Dh(window,"keyup",l)),a.push(Dh(window,"focus",l)))},e.getItemRoot=function(t){for(;t&&!t.get("item");)t=t.get("parent");return t},e.prototype.onCanvasEvents=function(t){var n=this.graph,i=n.get("canvas"),a=t.target,o=t.type;t.canvasX=t.x,t.canvasY=t.y;var s={x:t.canvasX,y:t.canvasY},u=n.get("group"),l=u.getMatrix();if(l||(l=[1,0,0,0,1,0,0,0,1]),rQ(l)&&(s=n.getPointByClient(t.clientX,t.clientY)),t.x=s.x,t.y=s.y,t.currentTarget=n,a===i){(o==="mousemove"||o==="mouseleave")&&this.handleMouseMove(t,"canvas"),t.target=i,t.item=null,n.emit(o,t),n.emit("canvas:"+o,t);return}var c=e.getItemRoot(a);if(!c){n.emit(o,t);return}var f=c.get("item");if(!f.destroyed){var d=f.getType();if(t.target=a,t.item=f,t.canvasX===t.x&&t.canvasY===t.y){var h=n.getCanvasByPoint(t.x,t.y);t.canvasX=h.x,t.canvasY=h.y}n.emit(o,t),t.name&&!t.name.includes(":")?n.emit(d+":"+o,t):n.emit(t.name,t),o==="dragstart"&&(this.dragging=!0),o==="dragend"&&(this.dragging=!1),o==="mousemove"&&this.handleMouseMove(t,d)}},e.prototype.onExtendEvents=function(t){this.graph.emit(t.type,t)},e.prototype.onWheelEvent=function(t){xt(t.wheelDelta)&&(t.wheelDelta=-t.detail),this.graph.emit("wheel",t)},e.prototype.handleMouseMove=function(t,n){var i=this,a=i.graph,o=i.preItem,s=a.get("canvas"),u=t.target===s?null:t.item;t=tQ(t),o&&o!==u&&!o.destroyed&&(t.item=o,this.emitCustomEvent(o.getType(),"mouseleave",t),this.dragging&&this.emitCustomEvent(o.getType(),"dragleave",t)),u&&o!==u&&(t.item=u,this.emitCustomEvent(n,"mouseenter",t),this.dragging&&this.emitCustomEvent(n,"dragenter",t)),this.preItem=u},e.prototype.emitCustomEvent=function(t,n,i){i.type=n,this.graph.emit(t+":"+n,i)},e.prototype.destroy=function(){var t=this,n=t.graph,i=t.canvasHandler,a=t.extendEvents,o=n.get("canvas");o.off("*",i),xe(a,function(s){s.remove()}),this.dragging=!1,this.preItem=null,this.extendEvents.length=0,this.canvasHandler=null,this.destroyed=!0},e}(kH);class Ci{constructor(){this.nodes=[],this.edges=[],this.combos=[],this.positions=[],this.destroyed=!1,this.onLayoutEnd=()=>{}}layout(e){return this.init(e),this.execute(!0)}init(e){this.nodes=e.nodes||[],this.edges=e.edges||[],this.combos=e.combos||[]}execute(e){}executeWithWorker(){}getDefaultCfg(){return{}}updateCfg(e){e&&Object.assign(this,e)}getType(){return"base"}destroy(){this.nodes=null,this.edges=null,this.combos=null,this.positions=null,this.destroyed=!0}}const Nh=r=>typeof r=="string",fi=Array.isArray,gt=r=>typeof r=="number",dw=r=>Number.isNaN(Number(r)),vo=r=>r!==null&&typeof r=="object",vw=r=>{if(r===null)return r;if(r instanceof Date)return new Date(r.getTime());if(r instanceof Array){const e=[];return r.forEach(t=>{e.push(t)}),e.map(t=>vw(t))}if(typeof r=="object"&&r!=={}){const e=Object.assign({},r);return Object.keys(e).forEach(t=>{e[t]=vw(e[t])}),e}return r},Pr=(r,e)=>{const t=r[e];return vo(t)?t.cell:t},Oh=(r,e,t)=>{const n=[];for(let i=0;i<r;i++)n[i]=0;return t&&t.forEach(i=>{const a=Pr(i,"source"),o=Pr(i,"target");a&&(n[e[a]]+=1),o&&(n[e[o]]+=1)}),n},$k=r=>{const e=[],t=r.length;for(let n=0;n<t;n+=1){e[n]=[];for(let i=0;i<t;i+=1)n===i?e[n][i]=0:r[n][i]===0||!r[n][i]?e[n][i]=1/0:e[n][i]=r[n][i]}for(let n=0;n<t;n+=1)for(let i=0;i<t;i+=1)for(let a=0;a<t;a+=1)e[i][a]>e[i][n]+e[n][a]&&(e[i][a]=e[i][n]+e[n][a]);return e},Vk=(r,e)=>{const{nodes:t,edges:n}=r,i=[],a={};if(!t)throw new Error("invalid nodes data!");return t&&t.forEach((o,s)=>{a[o.id]=s;const u=[];i.push(u)}),n&&n.forEach(o=>{const s=Pr(o,"source"),u=Pr(o,"target"),l=a[s],c=a[u];i[l][c]=1,e||(i[c][l]=1)}),i},iQ=(r,e)=>{const t=[];return r.forEach(n=>{const i=[];n.forEach(a=>{i.push(a*e)}),t.push(i)}),t},jk=(r,e)=>{if(r&&r.children){for(let t=r.children.length-1;t>=0;t--)if(!jk(r.children[t],e))return}return!!e(r)},Dg=(r,e)=>{typeof e=="function"&&jk(r,e)},Rs=r=>typeof r=="function",Ph=new Map,bi=(r,e)=>{if(Ph.get(r)&&console.warn(`The layout with the name ${r} exists already, it will be overridden`),vo(e)){class t extends Ci{constructor(i){super();const a=this,o={},s=a.getDefaultCfg();Object.assign(o,s,e,i),Object.keys(o).forEach(u=>{const l=o[u];a[u]=l})}}Ph.set(r,t)}else Ph.set(r,e)},aQ=r=>Ph.has(r)?Ph.get(r):null;class oQ extends Ci{constructor(e){super();this.begin=[0,0],this.preventOverlap=!0,this.preventOverlapPadding=10,this.condense=!1,this.sortBy="degree",this.nodeSize=30,this.nodes=[],this.edges=[],this.width=300,this.height=300,this.row=0,this.col=0,this.cellWidth=0,this.cellHeight=0,this.cellUsed={},this.id2manPos={},this.onLayoutEnd=()=>{},this.updateCfg(e)}getDefaultCfg(){return{begin:[0,0],preventOverlap:!0,preventOverlapPadding:10,condense:!1,rows:void 0,cols:void 0,position:void 0,sortBy:"degree",nodeSize:30}}execute(){const e=this,t=e.nodes,n=e.edges,i=t.length,a=e.begin;if(i===0)return e.onLayoutEnd&&e.onLayoutEnd(),{nodes:t,edges:n};if(i===1)return t[0].x=a[0],t[0].y=a[1],e.onLayoutEnd&&e.onLayoutEnd(),{nodes:t,edges:n};const o=[];t.forEach(c=>{o.push(c)});const s={};if(o.forEach((c,f)=>{s[c.id]=f}),(e.sortBy==="degree"||!Nh(e.sortBy)||o[0][e.sortBy]===void 0)&&(e.sortBy="degree",dw(t[0].degree))){const c=Oh(o.length,s,n);o.forEach((f,d)=>{f.degree=c[d]})}o.sort((c,f)=>f[e.sortBy]-c[e.sortBy]),!e.width&&typeof window!="undefined"&&(e.width=window.innerWidth),!e.height&&typeof window!="undefined"&&(e.height=window.innerHeight);const u=e.rows,l=e.cols!=null?e.cols:e.columns;if(e.cells=i,u!=null&&l!=null?(e.rows=u,e.cols=l):u!=null&&l==null?(e.rows=u,e.cols=Math.ceil(e.cells/e.rows)):u==null&&l!=null?(e.cols=l,e.rows=Math.ceil(e.cells/e.cols)):(e.splits=Math.sqrt(e.cells*e.height/e.width),e.rows=Math.round(e.splits),e.cols=Math.round(e.width/e.height*e.splits)),e.cols*e.rows>e.cells){const c=e.small(),f=e.large();(c-1)*f>=e.cells?e.small(c-1):(f-1)*c>=e.cells&&e.large(f-1)}else for(;e.cols*e.rows<e.cells;){const c=e.small(),f=e.large();(f+1)*c>=e.cells?e.large(f+1):e.small(c+1)}e.cellWidth=e.width/e.cols,e.cellHeight=e.height/e.rows,e.condense&&(e.cellWidth=0,e.cellHeight=0),e.preventOverlap&&o.forEach(c=>{(!c.x||!c.y)&&(c.x=0,c.y=0);let f,d;fi(c.size)?(f=c.size[0],d=c.size[1]):gt(c.size)?(f=c.size,d=c.size):vo(c.size)&&(f=c.size.width,d=c.size.height),(f===void 0||d===void 0)&&(fi(e.nodeSize)?(f=e.nodeSize[0],d=e.nodeSize[1]):gt(e.nodeSize)?(f=e.nodeSize,d=e.nodeSize):(f=30,d=30));const h=e.preventOverlapPadding,v=f+h,p=d+h;e.cellWidth=Math.max(e.cellWidth,v),e.cellHeight=Math.max(e.cellHeight,p)}),e.cellUsed={},e.row=0,e.col=0,e.id2manPos={};for(let c=0;c<o.length;c++){const f=o[c];let d;if(e.position&&(d=e.position(f)),d&&(d.row!==void 0||d.col!==void 0)){const h={row:d.row,col:d.col};if(h.col===void 0)for(h.col=0;e.used(h.row,h.col);)h.col++;else if(h.row===void 0)for(h.row=0;e.used(h.row,h.col);)h.row++;e.id2manPos[f.id]=h,e.use(h.row,h.col)}e.getPos(f)}return e.onLayoutEnd&&e.onLayoutEnd(),{edges:n,nodes:o}}small(e){const t=this;let n;const i=t.rows||5,a=t.cols||5;return e==null?n=Math.min(i,a):Math.min(i,a)===t.rows?t.rows=e:t.cols=e,n}large(e){const t=this;let n;const i=t.rows||5,a=t.cols||5;return e==null?n=Math.max(i,a):Math.max(i,a)===t.rows?t.rows=e:t.cols=e,n}used(e,t){return this.cellUsed[`c-${e}-${t}`]||!1}use(e,t){const n=this;n.cellUsed[`c-${e}-${t}`]=!0}moveToNextCell(){const e=this,t=e.cols||5;e.col++,e.col>=t&&(e.col=0,e.row++)}getPos(e){const t=this,n=t.begin,i=t.cellWidth,a=t.cellHeight;let o,s;const u=t.id2manPos[e.id];if(u)o=u.col*i+i/2+n[0],s=u.row*a+a/2+n[1];else{for(;t.used(t.row,t.col);)t.moveToNextCell();o=t.col*i+i/2+n[0],s=t.row*a+a/2+n[1],t.use(t.row,t.col),t.moveToNextCell()}e.x=o,e.y=s}getType(){return"grid"}}class sQ extends Ci{constructor(e){super();this.center=[0,0],this.width=300,this.height=300,this.nodes=[],this.edges=[],this.onLayoutEnd=()=>{},this.updateCfg(e)}getDefaultCfg(){return{center:[0,0],width:300,height:300}}execute(){const e=this,t=e.nodes,n=.9,i=e.center;return!e.width&&typeof window!="undefined"&&(e.width=window.innerWidth),!e.height&&typeof window!="undefined"&&(e.height=window.innerHeight),t&&t.forEach(a=>{a.x=(Math.random()-.5)*n*e.width+i[0],a.y=(Math.random()-.5)*n*e.height+i[1]}),e.onLayoutEnd&&e.onLayoutEnd(),{nodes:t,edges:this.edges}}getType(){return"random"}}const pw=(r,e)=>{let t;return r?gt(r)?t=n=>r:t=r:t=n=>e||1,t};class uQ extends Ci{constructor(e){super();this.maxIteration=1e3,this.edgeStrength=200,this.nodeStrength=1e3,this.coulombDisScale=.005,this.damping=.9,this.maxSpeed=1e3,this.minMovement=.5,this.interval=.02,this.factor=1,this.linkDistance=1,this.gravity=10,this.preventOverlap=!0,this.tick=()=>{},this.nodes=[],this.edges=[],this.width=300,this.height=300,this.nodeMap={},this.nodeIdxMap={},this.updateCfg(e)}getDefaultCfg(){return{maxIteration:500,gravity:10,enableTick:!0}}execute(){const e=this,t=e.nodes;if(e.timeInterval!==void 0&&typeof window!="undefined"&&window.clearInterval(e.timeInterval),!t||t.length===0){e.onLayoutEnd&&e.onLayoutEnd();return}!e.width&&typeof window!="undefined"&&(e.width=window.innerWidth),!e.height&&typeof window!="undefined"&&(e.height=window.innerHeight),e.center||(e.center=[e.width/2,e.height/2]);const n=e.center;if(t.length===1){t[0].x=n[0],t[0].y=n[1],e.onLayoutEnd&&e.onLayoutEnd();return}const i={},a={};t.forEach((l,c)=>{gt(l.x)||(l.x=Math.random()*e.width),gt(l.y)||(l.y=Math.random()*e.height),i[l.id]=l,a[l.id]=c}),e.nodeMap=i,e.nodeIdxMap=a,e.linkDistance=pw(e.linkDistance,1),e.nodeStrength=pw(e.nodeStrength,1),e.edgeStrength=pw(e.edgeStrength,1);const o=e.nodeSize;let s;if(e.preventOverlap){const l=e.nodeSpacing;let c;gt(l)?c=()=>l:Rs(l)?c=l:c=()=>0,o?fi(o)?s=f=>(o[0]>o[1]?o[0]:o[1])+c(f):s=f=>o+c(f):s=f=>f.size?fi(f.size)?(f.size[0]>f.size[1]?f.size[0]:f.size[1])+c(f):vo(f.size)?(f.size.width>f.size.height?f.size.width:f.size.height)+c(f):f.size+c(f):10+c(f)}e.nodeSize=s;const u=e.edges;e.degrees=Oh(t.length,e.nodeIdxMap,u),e.getMass||(e.getMass=l=>e.degrees[e.nodeIdxMap[l.id]]||1),e.run()}run(){const e=this,t=e.nodes,n=e.edges,i=e.maxIteration;if(typeof window=="undefined")return;let a=0;this.timeInterval=window.setInterval(()=>{const o=[],s=[];if(!t)return;t.forEach((f,d)=>{o[2*d]=0,o[2*d+1]=0,s[2*d]=0,s[2*d+1]=0}),e.calRepulsive(o,t),n&&e.calAttractive(o,n),e.calGravity(o,t);const u=Math.max(.02,e.interval-a*.002);e.updateVelocity(o,s,u,t);const l=[];t.forEach(f=>{l.push({x:f.x,y:f.y})}),e.updatePosition(s,u,t),e.tick&&e.tick();let c=0;t.forEach((f,d)=>{const h=f.x-l[d].x,v=f.y-l[d].y;c+=Math.sqrt(h*h+v*v)}),c/=t.length,c<e.minMovement&&(window.clearInterval(e.timeInterval),e.onLayoutEnd&&e.onLayoutEnd()),a++,a>=i&&(e.onLayoutEnd&&e.onLayoutEnd(),window.clearInterval(e.timeInterval))},0)}calRepulsive(e,t){const n=this,i=n.getMass,a=n.nodeStrength,o=n.factor,s=n.coulombDisScale,u=n.preventOverlap,l=n.nodeSize;t.forEach((c,f)=>{const d=i?i(c):1;t.forEach((h,v)=>{if(f>=v)return;const p=c.x-h.x,g=c.y-h.y,y=Math.sqrt(p*p+g*g)+.01,m=(y+.1)*s,b=p/y,w=g/y,x=(a(c)+a(h))/2*o/(m*m),_=i?i(h):1;if(e[2*f]+=b*x,e[2*f+1]+=w*x,e[2*v]-=b*x,e[2*v+1]-=w*x,u&&y<(l(c)+l(h))/2){const A=(a(c)+a(h))/2/(y*y);e[2*f]+=b*A/d,e[2*f+1]+=w*A/d,e[2*v]-=b*A/_,e[2*v+1]-=w*A/_}})})}calAttractive(e,t){const n=this,i=n.nodeMap,a=n.nodeIdxMap,o=n.linkDistance,s=n.edgeStrength,u=n.getMass;t.forEach((l,c)=>{const f=Pr(l,"source"),d=Pr(l,"target"),h=i[f],v=i[d],p=v.x-h.x,g=v.y-h.y,y=Math.sqrt(p*p+g*g)+.01,m=p/y,b=g/y,_=((o(l)||1)-y)*s(l),A=a[f],I=a[d],M=u?u(h):1,S=u?u(v):1;e[2*A]-=m*_/M,e[2*A+1]-=b*_/M,e[2*I]+=m*_/S,e[2*I+1]+=b*_/S})}calGravity(e,t){const n=this,i=n.center,a=n.gravity,o=n.degrees,s=t.length;for(let u=0;u<s;u++){const l=t[u];let c=l.x-i[0],f=l.y-i[1],d=a;if(n.getCenter){const h=n.getCenter(l,o[u]);h&&gt(h[0])&&gt(h[1])&&gt(h[2])&&(c=l.x-h[0],f=l.y-h[1],d=h[2])}!d||(e[2*u]-=d*c,e[2*u+1]-=d*f)}}updateVelocity(e,t,n,i){const a=this,o=n*a.damping;i.forEach((s,u)=>{let l=e[2*u]*o||.01,c=e[2*u+1]*o||.01;const f=Math.sqrt(l*l+c*c);if(f>a.maxSpeed){const d=a.maxSpeed/f;l=d*l,c=d*c}t[2*u]=l,t[2*u+1]=c})}updatePosition(e,t,n){n.forEach((i,a)=>{if(gt(i.fx)&&gt(i.fy)){i.x=i.fx,i.y=i.fy;return}const o=e[2*a]*t,s=e[2*a+1]*t;i.x+=o,i.y+=s})}stop(){this.timeInterval&&typeof window!="undefined"&&window.clearInterval(this.timeInterval)}destroy(){const e=this;e.stop(),e.tick=null,e.nodes=null,e.edges=null,e.destroyed=!0}getType(){return"gForce"}}function lQ(r,e){var t,n=1;r==null&&(r=0),e==null&&(e=0);function i(){var a,o=t.length,s,u=0,l=0;for(a=0;a<o;++a)s=t[a],u+=s.x,l+=s.y;for(u=(u/o-r)*n,l=(l/o-e)*n,a=0;a<o;++a)s=t[a],s.x-=u,s.y-=l}return i.initialize=function(a){t=a},i.x=function(a){return arguments.length?(r=+a,i):r},i.y=function(a){return arguments.length?(e=+a,i):e},i.strength=function(a){return arguments.length?(n=+a,i):n},i}function cQ(r){const e=+this._x.call(null,r),t=+this._y.call(null,r);return Wk(this.cover(e,t),e,t,r)}function Wk(r,e,t,n){if(isNaN(e)||isNaN(t))return r;var i,a=r._root,o={data:n},s=r._x0,u=r._y0,l=r._x1,c=r._y1,f,d,h,v,p,g,y,m;if(!a)return r._root=o,r;for(;a.length;)if((p=e>=(f=(s+l)/2))?s=f:l=f,(g=t>=(d=(u+c)/2))?u=d:c=d,i=a,!(a=a[y=g<<1|p]))return i[y]=o,r;if(h=+r._x.call(null,a.data),v=+r._y.call(null,a.data),e===h&&t===v)return o.next=a,i?i[y]=o:r._root=o,r;do i=i?i[y]=new Array(4):r._root=new Array(4),(p=e>=(f=(s+l)/2))?s=f:l=f,(g=t>=(d=(u+c)/2))?u=d:c=d;while((y=g<<1|p)==(m=(v>=d)<<1|h>=f));return i[m]=a,i[y]=o,r}function fQ(r){var e,t,n=r.length,i,a,o=new Array(n),s=new Array(n),u=1/0,l=1/0,c=-1/0,f=-1/0;for(t=0;t<n;++t)isNaN(i=+this._x.call(null,e=r[t]))||isNaN(a=+this._y.call(null,e))||(o[t]=i,s[t]=a,i<u&&(u=i),i>c&&(c=i),a<l&&(l=a),a>f&&(f=a));if(u>c||l>f)return this;for(this.cover(u,l).cover(c,f),t=0;t<n;++t)Wk(this,o[t],s[t],r[t]);return this}function hQ(r,e){if(isNaN(r=+r)||isNaN(e=+e))return this;var t=this._x0,n=this._y0,i=this._x1,a=this._y1;if(isNaN(t))i=(t=Math.floor(r))+1,a=(n=Math.floor(e))+1;else{for(var o=i-t||1,s=this._root,u,l;t>r||r>=i||n>e||e>=a;)switch(l=(e<n)<<1|r<t,u=new Array(4),u[l]=s,s=u,o*=2,l){case 0:i=t+o,a=n+o;break;case 1:t=i-o,a=n+o;break;case 2:i=t+o,n=a-o;break;case 3:t=i-o,n=a-o;break}this._root&&this._root.length&&(this._root=s)}return this._x0=t,this._y0=n,this._x1=i,this._y1=a,this}function dQ(){var r=[];return this.visit(function(e){if(!e.length)do r.push(e.data);while(e=e.next)}),r}function vQ(r){return arguments.length?this.cover(+r[0][0],+r[0][1]).cover(+r[1][0],+r[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function Mi(r,e,t,n,i){this.node=r,this.x0=e,this.y0=t,this.x1=n,this.y1=i}function pQ(r,e,t){var n,i=this._x0,a=this._y0,o,s,u,l,c=this._x1,f=this._y1,d=[],h=this._root,v,p;for(h&&d.push(new Mi(h,i,a,c,f)),t==null?t=1/0:(i=r-t,a=e-t,c=r+t,f=e+t,t*=t);v=d.pop();)if(!(!(h=v.node)||(o=v.x0)>c||(s=v.y0)>f||(u=v.x1)<i||(l=v.y1)<a))if(h.length){var g=(o+u)/2,y=(s+l)/2;d.push(new Mi(h[3],g,y,u,l),new Mi(h[2],o,y,g,l),new Mi(h[1],g,s,u,y),new Mi(h[0],o,s,g,y)),(p=(e>=y)<<1|r>=g)&&(v=d[d.length-1],d[d.length-1]=d[d.length-1-p],d[d.length-1-p]=v)}else{var m=r-+this._x.call(null,h.data),b=e-+this._y.call(null,h.data),w=m*m+b*b;if(w<t){var x=Math.sqrt(t=w);i=r-x,a=e-x,c=r+x,f=e+x,n=h.data}}return n}function gQ(r){if(isNaN(c=+this._x.call(null,r))||isNaN(f=+this._y.call(null,r)))return this;var e,t=this._root,n,i,a,o=this._x0,s=this._y0,u=this._x1,l=this._y1,c,f,d,h,v,p,g,y;if(!t)return this;if(t.length)for(;;){if((v=c>=(d=(o+u)/2))?o=d:u=d,(p=f>=(h=(s+l)/2))?s=h:l=h,e=t,!(t=t[g=p<<1|v]))return this;if(!t.length)break;(e[g+1&3]||e[g+2&3]||e[g+3&3])&&(n=e,y=g)}for(;t.data!==r;)if(i=t,!(t=t.next))return this;return(a=t.next)&&delete t.next,i?(a?i.next=a:delete i.next,this):e?(a?e[g]=a:delete e[g],(t=e[0]||e[1]||e[2]||e[3])&&t===(e[3]||e[2]||e[1]||e[0])&&!t.length&&(n?n[y]=t:this._root=t),this):(this._root=a,this)}function yQ(r){for(var e=0,t=r.length;e<t;++e)this.remove(r[e]);return this}function mQ(){return this._root}function bQ(){var r=0;return this.visit(function(e){if(!e.length)do++r;while(e=e.next)}),r}function wQ(r){var e=[],t,n=this._root,i,a,o,s,u;for(n&&e.push(new Mi(n,this._x0,this._y0,this._x1,this._y1));t=e.pop();)if(!r(n=t.node,a=t.x0,o=t.y0,s=t.x1,u=t.y1)&&n.length){var l=(a+s)/2,c=(o+u)/2;(i=n[3])&&e.push(new Mi(i,l,c,s,u)),(i=n[2])&&e.push(new Mi(i,a,c,l,u)),(i=n[1])&&e.push(new Mi(i,l,o,s,c)),(i=n[0])&&e.push(new Mi(i,a,o,l,c))}return this}function xQ(r){var e=[],t=[],n;for(this._root&&e.push(new Mi(this._root,this._x0,this._y0,this._x1,this._y1));n=e.pop();){var i=n.node;if(i.length){var a,o=n.x0,s=n.y0,u=n.x1,l=n.y1,c=(o+u)/2,f=(s+l)/2;(a=i[0])&&e.push(new Mi(a,o,s,c,f)),(a=i[1])&&e.push(new Mi(a,c,s,u,f)),(a=i[2])&&e.push(new Mi(a,o,f,c,l)),(a=i[3])&&e.push(new Mi(a,c,f,u,l))}t.push(n)}for(;n=t.pop();)r(n.node,n.x0,n.y0,n.x1,n.y1);return this}function _Q(r){return r[0]}function SQ(r){return arguments.length?(this._x=r,this):this._x}function EQ(r){return r[1]}function AQ(r){return arguments.length?(this._y=r,this):this._y}function gw(r,e,t){var n=new yw(e==null?_Q:e,t==null?EQ:t,NaN,NaN,NaN,NaN);return r==null?n:n.addAll(r)}function yw(r,e,t,n,i,a){this._x=r,this._y=e,this._x0=t,this._y0=n,this._x1=i,this._y1=a,this._root=void 0}function Xk(r){for(var e={data:r.data},t=e;r=r.next;)t=t.next={data:r.data};return e}var ki=gw.prototype=yw.prototype;ki.copy=function(){var r=new yw(this._x,this._y,this._x0,this._y0,this._x1,this._y1),e=this._root,t,n;if(!e)return r;if(!e.length)return r._root=Xk(e),r;for(t=[{source:e,target:r._root=new Array(4)}];e=t.pop();)for(var i=0;i<4;++i)(n=e.source[i])&&(n.length?t.push({source:n,target:e.target[i]=new Array(4)}):e.target[i]=Xk(n));return r};ki.add=cQ;ki.addAll=fQ;ki.cover=hQ;ki.data=dQ;ki.extent=vQ;ki.find=pQ;ki.remove=gQ;ki.removeAll=yQ;ki.root=mQ;ki.size=bQ;ki.visit=wQ;ki.visitAfter=xQ;ki.x=SQ;ki.y=AQ;function Di(r){return function(){return r}}function Bs(r){return(r()-.5)*1e-6}function TQ(r){return r.x+r.vx}function IQ(r){return r.y+r.vy}function Yk(r){var e,t,n,i=1,a=1;typeof r!="function"&&(r=Di(r==null?1:+r));function o(){for(var l,c=e.length,f,d,h,v,p,g,y=0;y<a;++y)for(f=gw(e,TQ,IQ).visitAfter(s),l=0;l<c;++l)d=e[l],p=t[d.index],g=p*p,h=d.x+d.vx,v=d.y+d.vy,f.visit(m);function m(b,w,x,_,A){var I=b.data,M=b.r,S=p+M;if(I){if(I.index>d.index){var C=h-I.x-I.vx,T=v-I.y-I.vy,k=C*C+T*T;k<S*S&&(C===0&&(C=Bs(n),k+=C*C),T===0&&(T=Bs(n),k+=T*T),k=(S-(k=Math.sqrt(k)))/k*i,d.vx+=(C*=k)*(S=(M*=M)/(g+M)),d.vy+=(T*=k)*S,I.vx-=C*(S=1-S),I.vy-=T*S)}return}return w>h+S||_<h-S||x>v+S||A<v-S}}function s(l){if(l.data)return l.r=t[l.data.index];for(var c=l.r=0;c<4;++c)l[c]&&l[c].r>l.r&&(l.r=l[c].r)}function u(){if(!!e){var l,c=e.length,f;for(t=new Array(c),l=0;l<c;++l)f=e[l],t[f.index]=+r(f,l,e)}}return o.initialize=function(l,c){e=l,n=c,u()},o.iterations=function(l){return arguments.length?(a=+l,o):a},o.strength=function(l){return arguments.length?(i=+l,o):i},o.radius=function(l){return arguments.length?(r=typeof l=="function"?l:Di(+l),u(),o):r},o}function CQ(r){return r.index}function Hk(r,e){var t=r.get(e);if(!t)throw new Error("node not found: "+e);return t}function mw(r){var e=CQ,t=f,n,i=Di(30),a,o,s,u,l,c=1;r==null&&(r=[]);function f(g){return 1/Math.min(s[g.source.index],s[g.target.index])}function d(g){for(var y=0,m=r.length;y<c;++y)for(var b=0,w,x,_,A,I,M,S;b<m;++b)w=r[b],x=w.source,_=w.target,A=_.x+_.vx-x.x-x.vx||Bs(l),I=_.y+_.vy-x.y-x.vy||Bs(l),M=Math.sqrt(A*A+I*I),M=(M-a[b])/M*g*n[b],A*=M,I*=M,_.vx-=A*(S=u[b]),_.vy-=I*S,x.vx+=A*(S=1-S),x.vy+=I*S}function h(){if(!!o){var g,y=o.length,m=r.length,b=new Map(o.map((x,_)=>[e(x,_,o),x])),w;for(g=0,s=new Array(y);g<m;++g)w=r[g],w.index=g,typeof w.source!="object"&&(w.source=Hk(b,w.source)),typeof w.target!="object"&&(w.target=Hk(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=r[g],u[g]=s[w.source.index]/(s[w.source.index]+s[w.target.index]);n=new Array(m),v(),a=new Array(m),p()}}function v(){if(!!o)for(var g=0,y=r.length;g<y;++g)n[g]=+t(r[g],g,r)}function p(){if(!!o)for(var g=0,y=r.length;g<y;++g)a[g]=+i(r[g],g,r)}return d.initialize=function(g,y){o=g,l=y,h()},d.links=function(g){return arguments.length?(r=g,h(),d):r},d.id=function(g){return arguments.length?(e=g,d):e},d.iterations=function(g){return arguments.length?(c=+g,d):c},d.strength=function(g){return arguments.length?(t=typeof g=="function"?g:Di(+g),v(),d):t},d.distance=function(g){return arguments.length?(i=typeof g=="function"?g:Di(+g),p(),d):i},d}var MQ={value:()=>{}};function qk(){for(var r=0,e=arguments.length,t={},n;r<e;++r){if(!(n=arguments[r]+"")||n in t||/[\s.]/.test(n))throw new Error("illegal type: "+n);t[n]=[]}return new Lg(t)}function Lg(r){this._=r}function kQ(r,e){return r.trim().split(/^|\s+/).map(function(t){var n="",i=t.indexOf(".");if(i>=0&&(n=t.slice(i+1),t=t.slice(0,i)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}})}Lg.prototype=qk.prototype={constructor:Lg,on:function(r,e){var t=this._,n=kQ(r+"",t),i,a=-1,o=n.length;if(arguments.length<2){for(;++a<o;)if((i=(r=n[a]).type)&&(i=DQ(t[i],r.name)))return i;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++a<o;)if(i=(r=n[a]).type)t[i]=Kk(t[i],r.name,e);else if(e==null)for(i in t)t[i]=Kk(t[i],r.name,null);return this},copy:function(){var r={},e=this._;for(var t in e)r[t]=e[t].slice();return new Lg(r)},call:function(r,e){if((i=arguments.length-2)>0)for(var t=new Array(i),n=0,i,a;n<i;++n)t[n]=arguments[n+2];if(!this._.hasOwnProperty(r))throw new Error("unknown type: "+r);for(a=this._[r],n=0,i=a.length;n<i;++n)a[n].value.apply(e,t)},apply:function(r,e,t){if(!this._.hasOwnProperty(r))throw new Error("unknown type: "+r);for(var n=this._[r],i=0,a=n.length;i<a;++i)n[i].value.apply(e,t)}};function DQ(r,e){for(var t=0,n=r.length,i;t<n;++t)if((i=r[t]).name===e)return i.value}function Kk(r,e,t){for(var n=0,i=r.length;n<i;++n)if(r[n].name===e){r[n]=MQ,r=r.slice(0,n).concat(r.slice(n+1));break}return t!=null&&r.push({name:e,value:t}),r}const LQ=1664525,NQ=1013904223,Zk=4294967296;function OQ(){let r=1;return()=>(r=(LQ*r+NQ)%Zk)/Zk}function PQ(r){return r.x}function RQ(r){return r.y}var BQ=10,FQ=Math.PI*(3-Math.sqrt(5));function Qk(r){var e,t=1,n=.001,i=1-Math.pow(n,1/300),a=0,o=.6,s=new Map,u=Jb(f),l=qk("tick","end"),c=OQ();r==null&&(r=[]);function f(){d(),l.call("tick",e),t<n&&(u.stop(),l.call("end",e))}function d(p){var g,y=r.length,m;p===void 0&&(p=1);for(var b=0;b<p;++b)for(t+=(a-t)*i,s.forEach(function(w){w(t)}),g=0;g<y;++g)m=r[g],m.fx==null?m.x+=m.vx*=o:(m.x=m.fx,m.vx=0),m.fy==null?m.y+=m.vy*=o:(m.y=m.fy,m.vy=0);return e}function h(){for(var p=0,g=r.length,y;p<g;++p){if(y=r[p],y.index=p,y.fx!=null&&(y.x=y.fx),y.fy!=null&&(y.y=y.fy),isNaN(y.x)||isNaN(y.y)){var m=BQ*Math.sqrt(.5+p),b=p*FQ;y.x=m*Math.cos(b),y.y=m*Math.sin(b)}(isNaN(y.vx)||isNaN(y.vy))&&(y.vx=y.vy=0)}}function v(p){return p.initialize&&p.initialize(r,c),p}return h(),e={tick:d,restart:function(){return u.restart(f),e},stop:function(){return u.stop(),e},nodes:function(p){return arguments.length?(r=p,h(),s.forEach(v),e):r},alpha:function(p){return arguments.length?(t=+p,e):t},alphaMin:function(p){return arguments.length?(n=+p,e):n},alphaDecay:function(p){return arguments.length?(i=+p,e):+i},alphaTarget:function(p){return arguments.length?(a=+p,e):a},velocityDecay:function(p){return arguments.length?(o=1-p,e):1-o},randomSource:function(p){return arguments.length?(c=p,s.forEach(v),e):c},force:function(p,g){return arguments.length>1?(g==null?s.delete(p):s.set(p,v(g)),e):s.get(p)},find:function(p,g,y){var m=0,b=r.length,w,x,_,A,I;for(y==null?y=1/0:y*=y,m=0;m<b;++m)A=r[m],w=p-A.x,x=g-A.y,_=w*w+x*x,_<y&&(I=A,y=_);return I},on:function(p,g){return arguments.length>1?(l.on(p,g),e):l.on(p)}}}function Jk(){var r,e,t,n,i=Di(-30),a,o=1,s=1/0,u=.81;function l(h){var v,p=r.length,g=gw(r,PQ,RQ).visitAfter(f);for(n=h,v=0;v<p;++v)e=r[v],g.visit(d)}function c(){if(!!r){var h,v=r.length,p;for(a=new Array(v),h=0;h<v;++h)p=r[h],a[p.index]=+i(p,h,r)}}function f(h){var v=0,p,g,y=0,m,b,w;if(h.length){for(m=b=w=0;w<4;++w)(p=h[w])&&(g=Math.abs(p.value))&&(v+=p.value,y+=g,m+=g*p.x,b+=g*p.y);h.x=m/y,h.y=b/y}else{p=h,p.x=p.data.x,p.y=p.data.y;do v+=a[p.data.index];while(p=p.next)}h.value=v}function d(h,v,p,g){if(!h.value)return!0;var y=h.x-e.x,m=h.y-e.y,b=g-v,w=y*y+m*m;if(b*b/u<w)return w<s&&(y===0&&(y=Bs(t),w+=y*y),m===0&&(m=Bs(t),w+=m*m),w<o&&(w=Math.sqrt(o*w)),e.vx+=y*h.value*n/w,e.vy+=m*h.value*n/w),!0;if(h.length||w>=s)return;(h.data!==e||h.next)&&(y===0&&(y=Bs(t),w+=y*y),m===0&&(m=Bs(t),w+=m*m),w<o&&(w=Math.sqrt(o*w)));do h.data!==e&&(b=a[h.data.index]*n/w,e.vx+=y*b,e.vy+=m*b);while(h=h.next)}return l.initialize=function(h,v){r=h,t=v,c()},l.strength=function(h){return arguments.length?(i=typeof h=="function"?h:Di(+h),c(),l):i},l.distanceMin=function(h){return arguments.length?(o=h*h,l):Math.sqrt(o)},l.distanceMax=function(h){return arguments.length?(s=h*h,l):Math.sqrt(s)},l.theta=function(h){return arguments.length?(u=h*h,l):Math.sqrt(u)},l}function UQ(r){var e=Di(.1),t,n,i;typeof r!="function"&&(r=Di(r==null?0:+r));function a(s){for(var u=0,l=t.length,c;u<l;++u)c=t[u],c.vx+=(i[u]-c.x)*n[u]*s}function o(){if(!!t){var s,u=t.length;for(n=new Array(u),i=new Array(u),s=0;s<u;++s)n[s]=isNaN(i[s]=+r(t[s],s,t))?0:+e(t[s],s,t)}}return a.initialize=function(s){t=s,o()},a.strength=function(s){return arguments.length?(e=typeof s=="function"?s:Di(+s),o(),a):e},a.x=function(s){return arguments.length?(r=typeof s=="function"?s:Di(+s),o(),a):r},a}function GQ(r){var e=Di(.1),t,n,i;typeof r!="function"&&(r=Di(r==null?0:+r));function a(s){for(var u=0,l=t.length,c;u<l;++u)c=t[u],c.vy+=(i[u]-c.y)*n[u]*s}function o(){if(!!t){var s,u=t.length;for(n=new Array(u),i=new Array(u),s=0;s<u;++s)n[s]=isNaN(i[s]=+r(t[s],s,t))?0:+e(t[s],s,t)}}return a.initialize=function(s){t=s,o()},a.strength=function(s){return arguments.length?(e=typeof s=="function"?s:Di(+s),o(),a):e},a.y=function(s){return arguments.length?(r=typeof s=="function"?s:Di(+s),o(),a):r},a}function zQ(){function r(oe){return()=>oe}let e=oe=>oe.cluster,t=r(1),n=r(-1),i=r(100),a=r(.1),o=[0,0],s=[],u={},l=[],c=100,f=100,d={none:{x:0,y:0}},h=[],v,p="force",g=!0,y=.1;function m(oe){if(!g)return m;v.tick(),I();for(let Ae=0,ze=s.length,qe,ft=oe*y;Ae<ze;++Ae)qe=s[Ae],qe.vx+=(d[e(qe)].x-qe.x)*ft,qe.vy+=(d[e(qe)].y-qe.y)*ft}function b(){!s||w()}function w(){if(!s||!s.length)return;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()");const oe=x();v=Qk(oe.nodes).force("x",UQ(c).strength(.1)).force("y",GQ(f).strength(.1)).force("collide",Yk(Ae=>Ae.r).iterations(4)).force("charge",Jk().strength(n)).force("links",mw(oe.nodes.length?oe.links:[]).distance(i).strength(a)),h=v.nodes(),I()}function x(){const oe=[],Ae=[],ze={};let qe=[],ft={},ct=[];return ft=_(s),ct=A(l),qe=Object.keys(ft),qe.forEach((st,gr)=>{const tr=ft[st];oe.push({id:st,size:tr.count,r:Math.sqrt(tr.sumforceNodeSize/Math.PI)}),ze[st]=gr}),ct.forEach(st=>{const gr=Pr(st,"source"),tr=Pr(st,"target"),$=ze[gr],se=ze[tr];$!==void 0&&se!==void 0&&Ae.push({source:$,target:se,count:st.count})}),{nodes:oe,links:Ae}}function _(oe){const Ae={};return oe.forEach(ze=>{const qe=e(ze);Ae[qe]||(Ae[qe]={count:0,sumforceNodeSize:0})}),oe.forEach(ze=>{const qe=e(ze),ft=t(ze),ct=Ae[qe];ct.count=ct.count+1,ct.sumforceNodeSize=ct.sumforceNodeSize+Math.PI*(ft*ft)*1.3,Ae[qe]=ct}),Ae}function A(oe){const Ae={},ze=[];return oe.forEach(ft=>{const ct=M(ft);let st=0;Ae[ct]!==void 0&&(st=Ae[ct]),st+=1,Ae[ct]=st}),Object.entries(Ae).forEach(([ft,ct])=>{const st=ft.split("~")[0],gr=ft.split("~")[1];st!==void 0&&gr!==void 0&&ze.push({source:st,target:gr,count:ct})}),ze}function I(){return d={none:{x:0,y:0}},h.forEach(oe=>{d[oe.id]={x:oe.x-o[0],y:oe.y-o[1]}}),d}function M(oe){const Ae=Pr(oe,"source"),ze=Pr(oe,"target"),qe=e(u[Ae]),ft=e(u[ze]);return qe<=ft?`${qe}~${ft}`:`${ft}~${qe}`}function S(oe){u={},oe.forEach(Ae=>{u[Ae.id]=Ae})}function C(oe){return arguments.length?(p=oe,b(),m):p}function T(oe){return arguments.length?typeof oe=="string"?(e=Ae=>Ae[oe],m):(e=oe,m):e}function k(oe){return arguments.length?(g=oe,m):g}function L(oe){return arguments.length?(y=oe,m):y}function B(oe){return arguments.length?(c=oe,m):c}function ee(oe){return arguments.length?(f=oe,m):f}function K(oe){return arguments.length?(S(oe||[]),s=oe||[],m):s}function z(oe){return arguments.length?(l=oe||[],b(),m):l}function X(oe){return arguments.length?(typeof oe=="function"?t=oe:t=r(+oe),b(),m):t}function H(oe){return arguments.length?(typeof oe=="function"?n=oe:n=r(+oe),b(),m):n}function J(oe){return arguments.length?(typeof oe=="function"?i=oe:i=r(+oe),b(),m):i}function ne(oe){return arguments.length?(typeof oe=="function"?a=oe:a=r(+oe),b(),m):a}function me(oe){return arguments.length?(o=oe,m):o}return m.initialize=oe=>{s=oe,b()},m.template=C,m.groupBy=T,m.enableGrouping=k,m.strength=L,m.centerX=B,m.centerY=ee,m.nodes=K,m.links=z,m.forceNodeSize=X,m.nodeSize=m.forceNodeSize,m.forceCharge=H,m.forceLinkDistance=J,m.forceLinkStrength=ne,m.offset=me,m.getFocis=I,m}const bw={RUN:"LAYOUT_RUN",END:"LAYOUT_END",ERROR:"LAYOUT_ERROR",TICK:"LAYOUT_TICK",GPURUN:"GPU_LAYOUT_RUN",GPUEND:"GPU_LAYOUT_END"};class $Q extends Ci{constructor(e){super();this.center=[0,0],this.nodeStrength=null,this.edgeStrength=null,this.preventOverlap=!1,this.clusterNodeStrength=null,this.clusterEdgeStrength=null,this.clusterEdgeDistance=null,this.clusterNodeSize=null,this.clusterFociStrength=null,this.linkDistance=50,this.alphaDecay=.028,this.alphaMin=.001,this.alpha=.3,this.collideStrength=1,this.workerEnabled=!1,this.tick=()=>{},this.onLayoutEnd=()=>{},this.ticking=void 0,e&&this.updateCfg(e)}getDefaultCfg(){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(){},onLayoutEnd(){},workerEnabled:!1}}init(e){const t=this;t.nodes=e.nodes||[];const n=e.edges||[];t.edges=n.map(i=>{const a={},o=["targetNode","sourceNode","startPoint","endPoint"];return Object.keys(i).forEach(s=>{o.indexOf(s)>-1||(a[s]=i[s])}),a}),t.ticking=!1}execute(e){const t=this,n=t.nodes,i=t.edges;if(t.ticking)return;let a=t.forceSimulation;const o=t.alphaMin,s=t.alphaDecay,u=t.alpha;if(a){if(e){if(t.clustering&&t.clusterForce&&(t.clusterForce.nodes(n),t.clusterForce.links(i)),a.nodes(n),i&&t.edgeForce)t.edgeForce.links(i);else if(i&&!t.edgeForce){const l=mw().id(c=>c.id).links(i);t.edgeStrength&&l.strength(t.edgeStrength),t.linkDistance&&l.distance(t.linkDistance),t.edgeForce=l,a.force("link",l)}}t.preventOverlap&&t.overlapProcess(a),a.alpha(u).restart(),this.ticking=!0}else try{const l=Jk();if(t.nodeStrength&&l.strength(t.nodeStrength),a=Qk().nodes(n),t.clustering){const c=zQ();c.centerX(t.center[0]).centerY(t.center[1]).template("force").strength(t.clusterFociStrength),i&&c.links(i),n&&c.nodes(n),c.forceLinkDistance(t.clusterEdgeDistance).forceLinkStrength(t.clusterEdgeStrength).forceCharge(t.clusterNodeStrength).forceNodeSize(t.clusterNodeSize),t.clusterForce=c,a.force("group",c)}if(a.force("center",lQ(t.center[0],t.center[1])).force("charge",l).alpha(u).alphaDecay(s).alphaMin(o),t.preventOverlap&&t.overlapProcess(a),i){const c=mw().id(f=>f.id).links(i);t.edgeStrength&&c.strength(t.edgeStrength),t.linkDistance&&c.distance(t.linkDistance),t.edgeForce=c,a.force("link",c)}if(t.workerEnabled&&!jQ()&&(t.workerEnabled=!1,console.warn("workerEnabled option is only supported when running in web worker.")),!t.workerEnabled)a.on("tick",()=>{t.tick()}).on("end",()=>{t.ticking=!1,t.onLayoutEnd&&t.onLayoutEnd()}),t.ticking=!0;else{a.stop();const c=VQ(a);for(let f=1;f<=c;f++)a.tick(),postMessage({nodes:n,currentTick:f,totalTicks:c,type:bw.TICK},void 0);t.ticking=!1}t.forceSimulation=a,t.ticking=!0}catch(l){t.ticking=!1,console.warn(l)}}overlapProcess(e){const t=this,n=t.nodeSize,i=t.nodeSpacing;let a,o;const s=t.collideStrength;if(gt(i)?o=()=>i:Rs(i)?o=i:o=()=>0,!n)a=u=>u.size?fi(u.size)?(u.size[0]>u.size[1]?u.size[0]:u.size[1])/2+o(u):vo(u.size)?(u.size.width>u.size.height?u.size.width:u.size.height)/2+o(u):u.size/2+o(u):10+o(u);else if(Rs(n))a=u=>n(u)+o(u);else if(fi(n)){const l=(n[0]>n[1]?n[0]:n[1])/2;a=c=>l+o(c)}else if(gt(n)){const u=n/2;a=l=>u+o(l)}else a=()=>10;e.force("collisionForce",Yk(a).strength(s))}updateCfg(e){const t=this;t.ticking&&(t.forceSimulation.stop(),t.ticking=!1),t.forceSimulation=null,Object.assign(t,e)}destroy(){const e=this;e.ticking&&(e.forceSimulation.stop(),e.ticking=!1),e.nodes=null,e.edges=null,e.destroyed=!0}}function VQ(r){const e=r.alphaMin(),t=r.alphaTarget(),n=r.alpha(),i=Math.log((e-t)/(n-t))/Math.log(1-r.alphaDecay());return Math.ceil(i)}function jQ(){return typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope}function WQ(r,e,t,n){r.forEach((i,a)=>{r[a].children=[],r[a].parent=[]}),n?e.forEach(i=>{const a=Pr(i,"source"),o=Pr(i,"target");let s=0;a&&(s=t[a]);let u=0;o&&(u=t[o]);const l=r[s].children,c=r[u].parent;l.push(r[u].id),c.push(r[s].id)}):e.forEach(i=>{const a=Pr(i,"source"),o=Pr(i,"target");let s=0;a&&(s=t[a]);let u=0;o&&(u=t[o]);const l=r[s].children,c=r[u].children;l.push(r[u].id),c.push(r[s].id)})}function XQ(r,e,t){const n=t.length;for(let i=0;i<n;i++){const a=Pr(t[i],"source"),o=Pr(t[i],"target");if(r.id===a&&e.id===o||e.id===a&&r.id===o)return!0}return!1}function YQ(r,e){const t=r.degree,n=e.degree;return t<n?-1:t>n?1:0}class HQ extends Ci{constructor(e){super();this.radius=null,this.startRadius=null,this.endRadius=null,this.startAngle=0,this.endAngle=2*Math.PI,this.clockwise=!0,this.divisions=1,this.ordering=null,this.angleRatio=1,this.nodes=[],this.edges=[],this.nodeMap={},this.degrees=[],this.width=300,this.height=300,this.updateCfg(e)}getDefaultCfg(){return{radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1}}execute(){const e=this,t=e.nodes,n=e.edges,i=t.length;if(i===0){e.onLayoutEnd&&e.onLayoutEnd();return}!e.width&&typeof window!="undefined"&&(e.width=window.innerWidth),!e.height&&typeof window!="undefined"&&(e.height=window.innerHeight),e.center||(e.center=[e.width/2,e.height/2]);const a=e.center;if(i===1){t[0].x=a[0],t[0].y=a[1],e.onLayoutEnd&&e.onLayoutEnd();return}let o=e.radius,s=e.startRadius,u=e.endRadius;const l=e.divisions,c=e.startAngle,f=e.endAngle,d=(f-c)/i,h={};t.forEach((x,_)=>{h[x.id]=_}),e.nodeMap=h;const v=Oh(t.length,h,n);e.degrees=v,!o&&!s&&!u?o=e.height>e.width?e.width/2:e.height/2:!s&&u?s=u:s&&!u&&(u=s);const p=e.angleRatio,g=d*p,y=e.ordering;let m=[];y==="topology"?m=e.topologyOrdering():y==="topology-directed"?m=e.topologyOrdering(!0):y==="degree"?m=e.degreeOrdering():m=t;const b=e.clockwise,w=Math.ceil(i/l);for(let x=0;x<i;++x){let _=o;!_&&s!==null&&u!==null&&(_=s+x*(u-s)/(i-1)),_||(_=10+x*100/(i-1));let A=c+x%w*g+2*Math.PI/l*Math.floor(x/w);b||(A=f-x%w*g-2*Math.PI/l*Math.floor(x/w)),m[x].x=a[0]+Math.cos(A)*_,m[x].y=a[1]+Math.sin(A)*_,m[x].weight=v[x]}return e.onLayoutEnd&&e.onLayoutEnd(),{nodes:m,edges:this.edges}}topologyOrdering(e=!1){const t=this,n=t.degrees,i=t.edges,a=t.nodes,o=vw(a),s=t.nodeMap,u=[o[0]],l=[a[0]],c=[],f=a.length;c[0]=!0,WQ(o,i,s,e);let d=0;return o.forEach((h,v)=>{if(v!==0)if((v===f-1||n[v]!==n[v+1]||XQ(u[d],h,i))&&!c[v])u.push(h),l.push(a[s[h.id]]),c[v]=!0,d++;else{const p=u[d].children;let g=!1;for(let m=0;m<p.length;m++){const b=s[p[m]];if(n[b]===n[v]&&!c[b]){u.push(o[b]),l.push(a[s[o[b].id]]),c[b]=!0,g=!0;break}}let y=0;for(;!g&&(c[y]||(u.push(o[y]),l.push(a[s[o[y].id]]),c[y]=!0,g=!0),y++,y!==f););}}),l}degreeOrdering(){const e=this,t=e.nodes,n=[],i=e.degrees;return t.forEach((a,o)=>{a.degree=i[o],n.push(a)}),n.sort(YQ),n}getType(){return"circular"}}var Ng;if(typeof kS=="function")try{Ng=require("graphlib")}catch{}Ng||(Ng=window.graphlib);var za=Ng,Og;if(typeof kS=="function")try{Og={cloneDeep:require("lodash/cloneDeep"),constant:require("lodash/constant"),defaults:require("lodash/defaults"),each:require("lodash/each"),filter:require("lodash/filter"),find:require("lodash/find"),flatten:require("lodash/flatten"),forEach:require("lodash/forEach"),forIn:require("lodash/forIn"),has:require("lodash/has"),isUndefined:require("lodash/isUndefined"),last:require("lodash/last"),map:require("lodash/map"),mapValues:require("lodash/mapValues"),max:require("lodash/max"),merge:require("lodash/merge"),min:require("lodash/min"),minBy:require("lodash/minBy"),now:require("lodash/now"),pick:require("lodash/pick"),range:require("lodash/range"),reduce:require("lodash/reduce"),sortBy:require("lodash/sortBy"),uniqueId:require("lodash/uniqueId"),values:require("lodash/values"),zipObject:require("lodash/zipObject")}}catch{}Og||(Og=window._);var dn=Og,qQ=Pg;function Pg(){var r={};r._next=r._prev=r,this._sentinel=r}Pg.prototype.dequeue=function(){var r=this._sentinel,e=r._prev;if(e!==r)return eD(e),e};Pg.prototype.enqueue=function(r){var e=this._sentinel;r._prev&&r._next&&eD(r),r._next=e._next,e._next._prev=r,e._next=r,r._prev=e};Pg.prototype.toString=function(){for(var r=[],e=this._sentinel,t=e._prev;t!==e;)r.push(JSON.stringify(t,KQ)),t=t._prev;return"["+r.join(", ")+"]"};function eD(r){r._prev._next=r._next,r._next._prev=r._prev,delete r._next,delete r._prev}function KQ(r,e){if(r!=="_next"&&r!=="_prev")return e}var Yo=dn,ZQ=za.Graph,QQ=qQ,JQ=tJ,eJ=Yo.constant(1);function tJ(r,e){if(r.nodeCount()<=1)return[];var t=nJ(r,e||eJ),n=rJ(t.graph,t.buckets,t.zeroIdx);return Yo.flatten(Yo.map(n,function(i){return r.outEdges(i.v,i.w)}),!0)}function rJ(r,e,t){for(var n=[],i=e[e.length-1],a=e[0],o;r.nodeCount();){for(;o=a.dequeue();)ww(r,e,t,o);for(;o=i.dequeue();)ww(r,e,t,o);if(r.nodeCount()){for(var s=e.length-2;s>0;--s)if(o=e[s].dequeue(),o){n=n.concat(ww(r,e,t,o,!0));break}}}return n}function ww(r,e,t,n,i){var a=i?[]:void 0;return Yo.forEach(r.inEdges(n.v),function(o){var s=r.edge(o),u=r.node(o.v);i&&a.push({v:o.v,w:o.w}),u.out-=s,xw(e,t,u)}),Yo.forEach(r.outEdges(n.v),function(o){var s=r.edge(o),u=o.w,l=r.node(u);l.in-=s,xw(e,t,l)}),r.removeNode(n.v),a}function nJ(r,e){var t=new ZQ,n=0,i=0;Yo.forEach(r.nodes(),function(s){t.setNode(s,{v:s,in:0,out:0})}),Yo.forEach(r.edges(),function(s){var u=t.edge(s.v,s.w)||0,l=e(s),c=u+l;t.setEdge(s.v,s.w,c),i=Math.max(i,t.node(s.v).out+=l),n=Math.max(n,t.node(s.w).in+=l)});var a=Yo.range(i+n+3).map(function(){return new QQ}),o=n+1;return Yo.forEach(t.nodes(),function(s){xw(a,o,t.node(s))}),{graph:t,buckets:a,zeroIdx:o}}function xw(r,e,t){t.out?t.in?r[t.out-t.in+e].enqueue(t):r[r.length-1].enqueue(t):r[0].enqueue(t)}var Qu=dn,iJ=JQ,aJ={run:oJ,undo:uJ};function oJ(r){var e=r.graph().acyclicer==="greedy"?iJ(r,t(r)):sJ(r);Qu.forEach(e,function(n){var i=r.edge(n);r.removeEdge(n),i.forwardName=n.name,i.reversed=!0,r.setEdge(n.w,n.v,i,Qu.uniqueId("rev"))});function t(n){return function(i){return n.edge(i).weight}}}function sJ(r){var e=[],t={},n={};function i(a){Qu.has(n,a)||(n[a]=!0,t[a]=!0,Qu.forEach(r.outEdges(a),function(o){Qu.has(t,o.w)?e.push(o):i(o.w)}),delete t[a])}return Qu.forEach(r.nodes(),i),e}function uJ(r){Qu.forEach(r.edges(),function(e){var t=r.edge(e);if(t.reversed){r.removeEdge(e);var n=t.forwardName;delete t.reversed,delete t.forwardName,r.setEdge(e.w,e.v,t,n)}})}var Wr=dn,tD=za.Graph,zi={addDummyNode:rD,simplify:lJ,asNonCompoundGraph:cJ,successorWeights:fJ,predecessorWeights:hJ,intersectRect:dJ,buildLayerMatrix:vJ,normalizeRanks:pJ,removeEmptyRanks:gJ,addBorderNode:yJ,maxRank:nD,partition:mJ,time:bJ,notime:wJ};function rD(r,e,t,n){var i;do i=Wr.uniqueId(n);while(r.hasNode(i));return t.dummy=e,r.setNode(i,t),i}function lJ(r){var e=new tD().setGraph(r.graph());return Wr.forEach(r.nodes(),function(t){e.setNode(t,r.node(t))}),Wr.forEach(r.edges(),function(t){var n=e.edge(t.v,t.w)||{weight:0,minlen:1},i=r.edge(t);e.setEdge(t.v,t.w,{weight:n.weight+i.weight,minlen:Math.max(n.minlen,i.minlen)})}),e}function cJ(r){var e=new tD({multigraph:r.isMultigraph()}).setGraph(r.graph());return Wr.forEach(r.nodes(),function(t){r.children(t).length||e.setNode(t,r.node(t))}),Wr.forEach(r.edges(),function(t){e.setEdge(t,r.edge(t))}),e}function fJ(r){var e=Wr.map(r.nodes(),function(t){var n={};return Wr.forEach(r.outEdges(t),function(i){n[i.w]=(n[i.w]||0)+r.edge(i).weight}),n});return Wr.zipObject(r.nodes(),e)}function hJ(r){var e=Wr.map(r.nodes(),function(t){var n={};return Wr.forEach(r.inEdges(t),function(i){n[i.v]=(n[i.v]||0)+r.edge(i).weight}),n});return Wr.zipObject(r.nodes(),e)}function dJ(r,e){var t=r.x,n=r.y,i=e.x-t,a=e.y-n,o=r.width/2,s=r.height/2;if(!i&&!a)throw new Error("Not possible to find intersection inside of the rectangle");var u,l;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),u=s*i/a,l=s):(i<0&&(o=-o),u=o,l=o*a/i),{x:t+u,y:n+l}}function vJ(r){var e=Wr.map(Wr.range(nD(r)+1),function(){return[]});return Wr.forEach(r.nodes(),function(t){var n=r.node(t),i=n.rank;Wr.isUndefined(i)||(e[i][n.order]=t)}),e}function pJ(r){var e=Wr.min(Wr.map(r.nodes(),function(t){return r.node(t).rank}));Wr.forEach(r.nodes(),function(t){var n=r.node(t);Wr.has(n,"rank")&&(n.rank-=e)})}function gJ(r){var e=Wr.min(Wr.map(r.nodes(),function(a){return r.node(a).rank})),t=[];Wr.forEach(r.nodes(),function(a){var o=r.node(a).rank-e;t[o]||(t[o]=[]),t[o].push(a)});var n=0,i=r.graph().nodeRankFactor;Wr.forEach(t,function(a,o){Wr.isUndefined(a)&&o%i!=0?--n:n&&Wr.forEach(a,function(s){r.node(s).rank+=n})})}function yJ(r,e,t,n){var i={width:0,height:0};return arguments.length>=4&&(i.rank=t,i.order=n),rD(r,"border",i,e)}function nD(r){return Wr.max(Wr.map(r.nodes(),function(e){var t=r.node(e).rank;if(!Wr.isUndefined(t))return t}))}function mJ(r,e){var t={lhs:[],rhs:[]};return Wr.forEach(r,function(n){e(n)?t.lhs.push(n):t.rhs.push(n)}),t}function bJ(r,e){var t=Wr.now();try{return e()}finally{console.log(r+" time: "+(Wr.now()-t)+"ms")}}function wJ(r,e){return e()}var iD=dn,xJ=zi,_J={run:SJ,undo:AJ};function SJ(r){r.graph().dummyChains=[],iD.forEach(r.edges(),function(e){EJ(r,e)})}function EJ(r,e){var t=e.v,n=r.node(t).rank,i=e.w,a=r.node(i).rank,o=e.name,s=r.edge(e),u=s.labelRank;if(a!==n+1){r.removeEdge(e);var l,c,f;for(f=0,++n;n<a;++f,++n)s.points=[],c={width:0,height:0,edgeLabel:s,edgeObj:e,rank:n},l=xJ.addDummyNode(r,"edge",c,"_d"),n===u&&(c.width=s.width,c.height=s.height,c.dummy="edge-label",c.labelpos=s.labelpos),r.setEdge(t,l,{weight:s.weight},o),f===0&&r.graph().dummyChains.push(l),t=l;r.setEdge(t,i,{weight:s.weight},o)}}function AJ(r){iD.forEach(r.graph().dummyChains,function(e){var t=r.node(e),n=t.edgeLabel,i;for(r.setEdge(t.edgeObj,n);t.dummy;)i=r.successors(e)[0],r.removeNode(e),n.points.push({x:t.x,y:t.y}),t.dummy==="edge-label"&&(n.x=t.x,n.y=t.y,n.width=t.width,n.height=t.height),e=i,t=r.node(e)})}var Rg=dn,Bg={longestPath:TJ,slack:IJ};function TJ(r){var e={};function t(n){var i=r.node(n);if(Rg.has(e,n))return i.rank;e[n]=!0;var a=Rg.min(Rg.map(r.outEdges(n),function(o){return t(o.w)-r.edge(o).minlen}));return(a===Number.POSITIVE_INFINITY||a===void 0||a===null)&&(a=0),i.rank=a}Rg.forEach(r.sources(),t)}function IJ(r,e){return r.node(e.w).rank-r.node(e.v).rank-r.edge(e).minlen}var Fg=dn,CJ=za.Graph,Ug=Bg.slack,aD=MJ;function MJ(r){var e=new CJ({directed:!1}),t=r.nodes()[0],n=r.nodeCount();e.setNode(t,{});for(var i,a;kJ(e,r)<n;)i=DJ(e,r),a=e.hasNode(i.v)?Ug(r,i):-Ug(r,i),LJ(e,r,a);return e}function kJ(r,e){function t(n){Fg.forEach(e.nodeEdges(n),function(i){var a=i.v,o=n===a?i.w:a;!r.hasNode(o)&&!Ug(e,i)&&(r.setNode(o,{}),r.setEdge(n,o,{}),t(o))})}return Fg.forEach(r.nodes(),t),r.nodeCount()}function DJ(r,e){return Fg.minBy(e.edges(),function(t){if(r.hasNode(t.v)!==r.hasNode(t.w))return Ug(e,t)})}function LJ(r,e,t){Fg.forEach(r.nodes(),function(n){e.node(n).rank+=t})}var Ho=dn,NJ=aD,OJ=Bg.slack,PJ=Bg.longestPath,RJ=za.alg.preorder,BJ=za.alg.postorder,FJ=zi.simplify,UJ=Ju;Ju.initLowLimValues=Sw;Ju.initCutValues=_w;Ju.calcCutValue=oD;Ju.leaveEdge=uD;Ju.enterEdge=lD;Ju.exchangeEdges=cD;function Ju(r){r=FJ(r),PJ(r);var e=NJ(r);Sw(e),_w(e,r);for(var t,n;t=uD(e);)n=lD(e,r,t),cD(e,r,t,n)}function _w(r,e){var t=BJ(r,r.nodes());t=t.slice(0,t.length-1),Ho.forEach(t,function(n){GJ(r,e,n)})}function GJ(r,e,t){var n=r.node(t),i=n.parent;r.edge(t,i).cutvalue=oD(r,e,t)}function oD(r,e,t){var n=r.node(t),i=n.parent,a=!0,o=e.edge(t,i),s=0;return o||(a=!1,o=e.edge(i,t)),s=o.weight,Ho.forEach(e.nodeEdges(t),function(u){var l=u.v===t,c=l?u.w:u.v;if(c!==i){var f=l===a,d=e.edge(u).weight;if(s+=f?d:-d,$J(r,t,c)){var h=r.edge(t,c).cutvalue;s+=f?-h:h}}}),s}function Sw(r,e){arguments.length<2&&(e=r.nodes()[0]),sD(r,{},1,e)}function sD(r,e,t,n,i){var a=t,o=r.node(n);return e[n]=!0,Ho.forEach(r.neighbors(n),function(s){Ho.has(e,s)||(t=sD(r,e,t,s,n))}),o.low=a,o.lim=t++,i?o.parent=i:delete o.parent,t}function uD(r){return Ho.find(r.edges(),function(e){return r.edge(e).cutvalue<0})}function lD(r,e,t){var n=t.v,i=t.w;e.hasEdge(n,i)||(n=t.w,i=t.v);var a=r.node(n),o=r.node(i),s=a,u=!1;a.lim>o.lim&&(s=o,u=!0);var l=Ho.filter(e.edges(),function(c){return u===fD(r,r.node(c.v),s)&&u!==fD(r,r.node(c.w),s)});return Ho.minBy(l,function(c){return OJ(e,c)})}function cD(r,e,t,n){var i=t.v,a=t.w;r.removeEdge(i,a),r.setEdge(n.v,n.w,{}),Sw(r),_w(r,e),zJ(r,e)}function zJ(r,e){var t=Ho.find(r.nodes(),function(i){return!e.node(i).parent}),n=RJ(r,t);n=n.slice(1),Ho.forEach(n,function(i){var a=r.node(i).parent,o=e.edge(i,a),s=!1;o||(o=e.edge(a,i),s=!0),e.node(i).rank=e.node(a).rank+(s?o.minlen:-o.minlen)})}function $J(r,e,t){return r.hasEdge(e,t)}function fD(r,e,t){return t.low<=e.lim&&e.lim<=t.lim}var VJ=Bg,hD=VJ.longestPath,jJ=aD,WJ=UJ,XJ=YJ;function YJ(r){switch(r.graph().ranker){case"network-simplex":dD(r);break;case"tight-tree":qJ(r);break;case"longest-path":HJ(r);break;default:dD(r)}}var HJ=hD;function qJ(r){hD(r),jJ(r)}function dD(r){WJ(r)}var Ew=dn,KJ=ZJ;function ZJ(r){var e=JJ(r);Ew.forEach(r.graph().dummyChains,function(t){for(var n=r.node(t),i=n.edgeObj,a=QJ(r,e,i.v,i.w),o=a.path,s=a.lca,u=0,l=o[u],c=!0;t!==i.w;){if(n=r.node(t),c){for(;(l=o[u])!==s&&r.node(l).maxRank<n.rank;)u++;l===s&&(c=!1)}if(!c){for(;u<o.length-1&&r.node(l=o[u+1]).minRank<=n.rank;)u++;l=o[u]}r.setParent(t,l),t=r.successors(t)[0]}})}function QJ(r,e,t,n){var i=[],a=[],o=Math.min(e[t].low,e[n].low),s=Math.max(e[t].lim,e[n].lim),u,l;u=t;do u=r.parent(u),i.push(u);while(u&&(e[u].low>o||s>e[u].lim));for(l=u,u=n;(u=r.parent(u))!==l;)a.push(u);return{path:i.concat(a.reverse()),lca:l}}function JJ(r){var e={},t=0;function n(i){var a=t;Ew.forEach(r.children(i),n),e[i]={low:a,lim:t++}}return Ew.forEach(r.children(),n),e}var qo=dn,Aw=zi,eee={run:tee,cleanup:iee};function tee(r){var e=Aw.addDummyNode(r,"root",{},"_root"),t=ree(r),n=qo.max(qo.values(t))-1,i=2*n+1;r.graph().nestingRoot=e,qo.forEach(r.edges(),function(o){r.edge(o).minlen*=i});var a=nee(r)+1;qo.forEach(r.children(),function(o){vD(r,e,i,a,n,t,o)}),r.graph().nodeRankFactor=i}function vD(r,e,t,n,i,a,o){var s=r.children(o);if(!s.length){o!==e&&r.setEdge(e,o,{weight:0,minlen:t});return}var u=Aw.addBorderNode(r,"_bt"),l=Aw.addBorderNode(r,"_bb"),c=r.node(o);r.setParent(u,o),c.borderTop=u,r.setParent(l,o),c.borderBottom=l,qo.forEach(s,function(f){vD(r,e,t,n,i,a,f);var d=r.node(f),h=d.borderTop?d.borderTop:f,v=d.borderBottom?d.borderBottom:f,p=d.borderTop?n:2*n,g=h!==v?1:i-a[o]+1;r.setEdge(u,h,{weight:p,minlen:g,nestingEdge:!0}),r.setEdge(v,l,{weight:p,minlen:g,nestingEdge:!0})}),r.parent(o)||r.setEdge(e,u,{weight:0,minlen:i+a[o]})}function ree(r){var e={};function t(n,i){var a=r.children(n);a&&a.length&&qo.forEach(a,function(o){t(o,i+1)}),e[n]=i}return qo.forEach(r.children(),function(n){t(n,1)}),e}function nee(r){return qo.reduce(r.edges(),function(e,t){return e+r.edge(t).weight},0)}function iee(r){var e=r.graph();r.removeNode(e.nestingRoot),delete e.nestingRoot,qo.forEach(r.edges(),function(t){var n=r.edge(t);n.nestingEdge&&r.removeEdge(t)})}var Tw=dn,aee=zi,oee=see;function see(r){function e(t){var n=r.children(t),i=r.node(t);if(n.length&&Tw.forEach(n,e),Tw.has(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,o=i.maxRank+1;a<o;++a)pD(r,"borderLeft","_bl",t,i,a),pD(r,"borderRight","_br",t,i,a)}}Tw.forEach(r.children(),e)}function pD(r,e,t,n,i,a){var o={width:0,height:0,rank:a,borderType:e},s=i[e][a-1],u=aee.addDummyNode(r,"border",o,t);i[e][a]=u,r.setParent(u,n),s&&r.setEdge(s,u,{weight:1})}var po=dn,uee={adjust:lee,undo:cee};function lee(r){var e=r.graph().rankdir.toLowerCase();(e==="lr"||e==="rl")&&gD(r)}function cee(r){var e=r.graph().rankdir.toLowerCase();(e==="bt"||e==="rl")&&fee(r),(e==="lr"||e==="rl")&&(hee(r),gD(r))}function gD(r){po.forEach(r.nodes(),function(e){yD(r.node(e))}),po.forEach(r.edges(),function(e){yD(r.edge(e))})}function yD(r){var e=r.width;r.width=r.height,r.height=e}function fee(r){po.forEach(r.nodes(),function(e){Iw(r.node(e))}),po.forEach(r.edges(),function(e){var t=r.edge(e);po.forEach(t.points,Iw),po.has(t,"y")&&Iw(t)})}function Iw(r){r.y=-r.y}function hee(r){po.forEach(r.nodes(),function(e){Cw(r.node(e))}),po.forEach(r.edges(),function(e){var t=r.edge(e);po.forEach(t.points,Cw),po.has(t,"x")&&Cw(t)})}function Cw(r){var e=r.x;r.x=r.y,r.y=e}var Ko=dn,dee=vee;function vee(r){var e={},t=Ko.filter(r.nodes(),function(s){return!r.children(s).length}),n=Ko.max(Ko.map(t,function(s){return r.node(s).rank})),i=Ko.map(Ko.range(n+1),function(){return[]});function a(s){if(!Ko.has(e,s)){e[s]=!0;var u=r.node(s);i[u.rank].push(s),Ko.forEach(r.successors(s),a)}}var o=Ko.sortBy(t,function(s){return r.node(s).rank});return Ko.forEach(o,a),i}var Fs=dn,pee=gee;function gee(r,e){for(var t=0,n=1;n<e.length;++n)t+=yee(r,e[n-1],e[n]);return t}function yee(r,e,t){for(var n=Fs.zipObject(t,Fs.map(t,function(l,c){return c})),i=Fs.flatten(Fs.map(e,function(l){return Fs.sortBy(Fs.map(r.outEdges(l),function(c){return{pos:n[c.w],weight:r.edge(c).weight}}),"pos")}),!0),a=1;a<t.length;)a<<=1;var o=2*a-1;a-=1;var s=Fs.map(new Array(o),function(){return 0}),u=0;return Fs.forEach(i.forEach(function(l){var c=l.pos+a;s[c]+=l.weight;for(var f=0;c>0;)c%2&&(f+=s[c+1]),c=c-1>>1,s[c]+=l.weight;u+=l.weight*f})),u}var mD=dn,mee=bee;function bee(r,e){return mD.map(e,function(t){var n=r.inEdges(t);if(n.length){var i=mD.reduce(n,function(a,o){var s=r.edge(o),u=r.node(o.v);return{sum:a.sum+s.weight*u.order,weight:a.weight+s.weight}},{sum:0,weight:0});return{v:t,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:t}})}var ia=dn,wee=xee;function xee(r,e){var t={};ia.forEach(r,function(i,a){var o=t[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:a};ia.isUndefined(i.barycenter)||(o.barycenter=i.barycenter,o.weight=i.weight)}),ia.forEach(e.edges(),function(i){var a=t[i.v],o=t[i.w];!ia.isUndefined(a)&&!ia.isUndefined(o)&&(o.indegree++,a.out.push(t[i.w]))});var n=ia.filter(t,function(i){return!i.indegree});return _ee(n)}function _ee(r){var e=[];function t(a){return function(o){o.merged||(ia.isUndefined(o.barycenter)||ia.isUndefined(a.barycenter)||o.barycenter>=a.barycenter)&&See(a,o)}}function n(a){return function(o){o.in.push(a),--o.indegree==0&&r.push(o)}}for(;r.length;){var i=r.pop();e.push(i),ia.forEach(i.in.reverse(),t(i)),ia.forEach(i.out,n(i))}return ia.map(ia.filter(e,function(a){return!a.merged}),function(a){return ia.pick(a,["vs","i","barycenter","weight"])})}function See(r,e){var t=0,n=0;r.weight&&(t+=r.barycenter*r.weight,n+=r.weight),e.weight&&(t+=e.barycenter*e.weight,n+=e.weight),r.vs=e.vs.concat(r.vs),r.barycenter=t/n,r.weight=n,r.i=Math.min(e.i,r.i),e.merged=!0}var Rh=dn,Eee=zi,Aee=Tee;function Tee(r,e){var t=Eee.partition(r,function(c){return Rh.has(c,"barycenter")}),n=t.lhs,i=Rh.sortBy(t.rhs,function(c){return-c.i}),a=[],o=0,s=0,u=0;n.sort(Iee(!!e)),u=bD(a,i,u),Rh.forEach(n,function(c){u+=c.vs.length,a.push(c.vs),o+=c.barycenter*c.weight,s+=c.weight,u=bD(a,i,u)});var l={vs:Rh.flatten(a,!0)};return s&&(l.barycenter=o/s,l.weight=s),l}function bD(r,e,t){for(var n;e.length&&(n=Rh.last(e)).i<=t;)e.pop(),r.push(n.vs),t++;return t}function Iee(r){return function(e,t){return e.barycenter<t.barycenter?-1:e.barycenter>t.barycenter?1:r?t.i-e.i:e.i-t.i}}var Us=dn,Cee=mee,Mee=wee,kee=Aee,Dee=wD;function wD(r,e,t,n){var i=r.children(e),a=r.node(e),o=a?a.borderLeft:void 0,s=a?a.borderRight:void 0,u={};o&&(i=Us.filter(i,function(v){return v!==o&&v!==s}));var l=Cee(r,i);Us.forEach(l,function(v){if(r.children(v.v).length){var p=wD(r,v.v,t,n);u[v.v]=p,Us.has(p,"barycenter")&&Nee(v,p)}});var c=Mee(l,t);Lee(c,u);var f=kee(c,n);if(o&&(f.vs=Us.flatten([o,f.vs,s],!0),r.predecessors(o).length)){var d=r.node(r.predecessors(o)[0]),h=r.node(r.predecessors(s)[0]);Us.has(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+d.order+h.order)/(f.weight+2),f.weight+=2}return f}function Lee(r,e){Us.forEach(r,function(t){t.vs=Us.flatten(t.vs.map(function(n){return e[n]?e[n].vs:n}),!0)})}function Nee(r,e){Us.isUndefined(r.barycenter)?(r.barycenter=e.barycenter,r.weight=e.weight):(r.barycenter=(r.barycenter*r.weight+e.barycenter*e.weight)/(r.weight+e.weight),r.weight+=e.weight)}var Bh=dn,Oee=za.Graph,Pee=Ree;function Ree(r,e,t){var n=Bee(r),i=new Oee({compound:!0}).setGraph({root:n}).setDefaultNodeLabel(function(a){return r.node(a)});return Bh.forEach(r.nodes(),function(a){var o=r.node(a),s=r.parent(a);(o.rank===e||o.minRank<=e&&e<=o.maxRank)&&(i.setNode(a),i.setParent(a,s||n),Bh.forEach(r[t](a),function(u){var l=u.v===a?u.w:u.v,c=i.edge(l,a),f=Bh.isUndefined(c)?0:c.weight;i.setEdge(l,a,{weight:r.edge(u).weight+f})}),Bh.has(o,"minRank")&&i.setNode(a,{borderLeft:o.borderLeft[e],borderRight:o.borderRight[e]}))}),i}function Bee(r){for(var e;r.hasNode(e=Bh.uniqueId("_root")););return e}var Fee=dn,Uee=Gee;function Gee(r,e,t){var n={},i;Fee.forEach(t,function(a){for(var o=r.parent(a),s,u;o;){if(s=r.parent(o),s?(u=n[s],n[s]=o):(u=i,i=o),u&&u!==o){e.setEdge(u,o);return}o=s}})}var Gs=dn,zee=dee,$ee=pee,Vee=Dee,jee=Pee,Wee=Uee,Xee=za.Graph,xD=zi,Yee=Hee;function Hee(r){var e=xD.maxRank(r),t=_D(r,Gs.range(1,e+1),"inEdges"),n=_D(r,Gs.range(e-1,-1,-1),"outEdges"),i=zee(r);SD(r,i);for(var a=Number.POSITIVE_INFINITY,o,s=0,u=0;u<4;++s,++u){qee(s%2?t:n,s%4>=2),i=xD.buildLayerMatrix(r);var l=$ee(r,i);l<a&&(u=0,o=Gs.cloneDeep(i),a=l)}SD(r,o)}function _D(r,e,t){return Gs.map(e,function(n){return jee(r,n,t)})}function qee(r,e){var t=new Xee;Gs.forEach(r,function(n){var i=n.graph().root,a=Vee(n,i,t,e);Gs.forEach(a.vs,function(o,s){n.node(o).order=s}),Wee(n,t,a.vs)})}function SD(r,e){Gs.forEach(e,function(t){Gs.forEach(t,function(n,i){r.node(n).order=i})})}var cr=dn,Kee=za.Graph,Zee=zi,Qee={positionX:tte,findType1Conflicts:ED,findType2Conflicts:AD,addConflict:Mw,hasConflict:TD,verticalAlignment:ID,horizontalCompaction:CD,alignCoordinates:kD,findSmallestWidthAlignment:MD,balance:DD};function ED(r,e){var t={};function n(i,a){var o=0,s=0,u=i.length,l=cr.last(a);return cr.forEach(a,function(c,f){var d=Jee(r,c),h=d?r.node(d).order:u;(d||c===l)&&(cr.forEach(a.slice(s,f+1),function(v){cr.forEach(r.predecessors(v),function(p){var g=r.node(p),y=g.order;(y<o||h<y)&&!(g.dummy&&r.node(v).dummy)&&Mw(t,p,v)})}),s=f+1,o=h)}),a}return cr.reduce(e,n),t}function AD(r,e){var t={};function n(a,o,s,u,l){var c;cr.forEach(cr.range(o,s),function(f){c=a[f],r.node(c).dummy&&cr.forEach(r.predecessors(c),function(d){var h=r.node(d);h.dummy&&(h.order<u||h.order>l)&&Mw(t,d,c)})})}function i(a,o){var s=-1,u,l=0;return cr.forEach(o,function(c,f){if(r.node(c).dummy==="border"){var d=r.predecessors(c);d.length&&(u=r.node(d[0]).order,n(o,l,f,s,u),l=f,s=u)}n(o,l,o.length,u,a.length)}),o}return cr.reduce(e,i),t}function Jee(r,e){if(r.node(e).dummy)return cr.find(r.predecessors(e),function(t){return r.node(t).dummy})}function Mw(r,e,t){if(e>t){var n=e;e=t,t=n}var i=r[e];i||(r[e]=i={}),i[t]=!0}function TD(r,e,t){if(e>t){var n=e;e=t,t=n}return cr.has(r[e],t)}function ID(r,e,t,n){var i={},a={},o={};return cr.forEach(e,function(s){cr.forEach(s,function(u,l){i[u]=u,a[u]=u,o[u]=l})}),cr.forEach(e,function(s){var u=-1;cr.forEach(s,function(l){var c=n(l);if(c.length){c=cr.sortBy(c,function(p){return o[p]});for(var f=(c.length-1)/2,d=Math.floor(f),h=Math.ceil(f);d<=h;++d){var v=c[d];a[l]===l&&u<o[v]&&!TD(t,l,v)&&(a[v]=l,a[l]=i[l]=i[v],u=o[v])}}})}),{root:i,align:a}}function CD(r,e,t,n,i){var a={},o=ete(r,e,t,i),s=i?"borderLeft":"borderRight";function u(f,d){for(var h=o.nodes(),v=h.pop(),p={};v;)p[v]?f(v):(p[v]=!0,h.push(v),h=h.concat(d(v))),v=h.pop()}function l(f){a[f]=o.inEdges(f).reduce(function(d,h){return Math.max(d,a[h.v]+o.edge(h))},0)}function c(f){var d=o.outEdges(f).reduce(function(v,p){return Math.min(v,a[p.w]-o.edge(p))},Number.POSITIVE_INFINITY),h=r.node(f);d!==Number.POSITIVE_INFINITY&&h.borderType!==s&&(a[f]=Math.max(a[f],d))}return u(l,o.predecessors.bind(o)),u(c,o.successors.bind(o)),cr.forEach(n,function(f){a[f]=a[t[f]]}),a}function ete(r,e,t,n){var i=new Kee,a=r.graph(),o=rte(a.nodesep,a.edgesep,n);return cr.forEach(e,function(s){var u;cr.forEach(s,function(l){var c=t[l];if(i.setNode(c),u){var f=t[u],d=i.edge(f,c);i.setEdge(f,c,Math.max(o(r,l,u),d||0))}u=l})}),i}function MD(r,e){return cr.minBy(cr.values(e),function(t){var n=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;return cr.forIn(t,function(a,o){var s=nte(r,o)/2;n=Math.max(a+s,n),i=Math.min(a-s,i)}),n-i})}function kD(r,e){var t=cr.values(e),n=cr.min(t),i=cr.max(t);cr.forEach(["u","d"],function(a){cr.forEach(["l","r"],function(o){var s=a+o,u=r[s],l;if(u!==e){var c=cr.values(u);l=o==="l"?n-cr.min(c):i-cr.max(c),l&&(r[s]=cr.mapValues(u,function(f){return f+l}))}})})}function DD(r,e){return cr.mapValues(r.ul,function(t,n){if(e)return r[e.toLowerCase()][n];var i=cr.sortBy(cr.map(r,n));return(i[1]+i[2])/2})}function tte(r){var e=Zee.buildLayerMatrix(r),t=cr.merge(ED(r,e),AD(r,e)),n={},i;cr.forEach(["u","d"],function(o){i=o==="u"?e:cr.values(e).reverse(),cr.forEach(["l","r"],function(s){s==="r"&&(i=cr.map(i,function(f){return cr.values(f).reverse()}));var u=(o==="u"?r.predecessors:r.successors).bind(r),l=ID(r,i,t,u),c=CD(r,i,l.root,l.align,s==="r");s==="r"&&(c=cr.mapValues(c,function(f){return-f})),n[o+s]=c})});var a=MD(r,n);return kD(n,a),DD(n,r.graph().align)}function rte(r,e,t){return function(n,i,a){var o=n.node(i),s=n.node(a),u=0,l;if(u+=o.width/2,cr.has(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":l=-o.width/2;break;case"r":l=o.width/2;break}if(l&&(u+=t?l:-l),l=0,u+=(o.dummy?e:r)/2,u+=(s.dummy?e:r)/2,u+=s.width/2,cr.has(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":l=s.width/2;break;case"r":l=-s.width/2;break}return l&&(u+=t?l:-l),l=0,u}}function nte(r,e){return r.node(e).width}var Fh=dn,LD=zi,ite=Qee.positionX,ate=ote;function ote(r){r=LD.asNonCompoundGraph(r),ste(r),Fh.forEach(ite(r),function(e,t){r.node(t).x=e})}function ste(r){var e=LD.buildLayerMatrix(r),t=r.graph().ranksep,n=0;Fh.forEach(e,function(i){var a=Fh.max(Fh.map(i,function(o){return r.node(o).height}));Fh.forEach(i,function(o){r.node(o).y=n+a/2}),n+=a+t})}var _r=dn,ND=aJ,OD=_J,ute=XJ,lte=zi.normalizeRanks,cte=KJ,fte=zi.removeEmptyRanks,PD=eee,hte=oee,RD=uee,dte=Yee,vte=ate,zs=zi,pte=za.Graph,gte=yte;function yte(r,e){var t=e&&e.debugTiming?zs.time:zs.notime;t("layout",function(){var n=t("  buildLayoutGraph",function(){return Cte(r)});t("  runLayout",function(){mte(n,t)}),t("  updateInputGraph",function(){bte(r,n)})})}function mte(r,e){e("    makeSpaceForEdgeLabels",function(){Mte(r)}),e("    removeSelfEdges",function(){Fte(r)}),e("    acyclic",function(){ND.run(r)}),e("    nestingGraph.run",function(){PD.run(r)}),e("    rank",function(){ute(zs.asNonCompoundGraph(r))}),e("    injectEdgeLabelProxies",function(){kte(r)}),e("    removeEmptyRanks",function(){fte(r)}),e("    nestingGraph.cleanup",function(){PD.cleanup(r)}),e("    normalizeRanks",function(){lte(r)}),e("    assignRankMinMax",function(){Dte(r)}),e("    removeEdgeLabelProxies",function(){Lte(r)}),e("    normalize.run",function(){OD.run(r)}),e("    parentDummyChains",function(){cte(r)}),e("    addBorderSegments",function(){hte(r)}),e("    order",function(){dte(r)}),e("    insertSelfEdges",function(){Ute(r)}),e("    adjustCoordinateSystem",function(){RD.adjust(r)}),e("    position",function(){vte(r)}),e("    positionSelfEdges",function(){Gte(r)}),e("    removeBorderNodes",function(){Bte(r)}),e("    normalize.undo",function(){OD.undo(r)}),e("    fixupEdgeLabelCoords",function(){Pte(r)}),e("    undoCoordinateSystem",function(){RD.undo(r)}),e("    translateGraph",function(){Nte(r)}),e("    assignNodeIntersects",function(){Ote(r)}),e("    reversePoints",function(){Rte(r)}),e("    acyclic.undo",function(){ND.undo(r)})}function bte(r,e){_r.forEach(r.nodes(),function(t){var n=r.node(t),i=e.node(t);n&&(n.x=i.x,n.y=i.y,e.children(t).length&&(n.width=i.width,n.height=i.height))}),_r.forEach(r.edges(),function(t){var n=r.edge(t),i=e.edge(t);n.points=i.points,_r.has(i,"x")&&(n.x=i.x,n.y=i.y)}),r.graph().width=e.graph().width,r.graph().height=e.graph().height}var wte=["nodesep","edgesep","ranksep","marginx","marginy"],xte={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},_te=["acyclicer","ranker","rankdir","align"],Ste=["width","height"],Ete={width:0,height:0},Ate=["minlen","weight","width","height","labeloffset"],Tte={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Ite=["labelpos"];function Cte(r){var e=new pte({multigraph:!0,compound:!0}),t=Dw(r.graph());return e.setGraph(_r.merge({},xte,kw(t,wte),_r.pick(t,_te))),_r.forEach(r.nodes(),function(n){var i=Dw(r.node(n));e.setNode(n,_r.defaults(kw(i,Ste),Ete)),e.setParent(n,r.parent(n))}),_r.forEach(r.edges(),function(n){var i=Dw(r.edge(n));e.setEdge(n,_r.merge({},Tte,kw(i,Ate),_r.pick(i,Ite)))}),e}function Mte(r){var e=r.graph();e.ranksep/=2,_r.forEach(r.edges(),function(t){var n=r.edge(t);n.minlen*=2,n.labelpos.toLowerCase()!=="c"&&(e.rankdir==="TB"||e.rankdir==="BT"?n.width+=n.labeloffset:n.height+=n.labeloffset)})}function kte(r){_r.forEach(r.edges(),function(e){var t=r.edge(e);if(t.width&&t.height){var n=r.node(e.v),i=r.node(e.w),a={rank:(i.rank-n.rank)/2+n.rank,e};zs.addDummyNode(r,"edge-proxy",a,"_ep")}})}function Dte(r){var e=0;_r.forEach(r.nodes(),function(t){var n=r.node(t);n.borderTop&&(n.minRank=r.node(n.borderTop).rank,n.maxRank=r.node(n.borderBottom).rank,e=_r.max(e,n.maxRank))}),r.graph().maxRank=e}function Lte(r){_r.forEach(r.nodes(),function(e){var t=r.node(e);t.dummy==="edge-proxy"&&(r.edge(t.e).labelRank=t.rank,r.removeNode(e))})}function Nte(r){var e=Number.POSITIVE_INFINITY,t=0,n=Number.POSITIVE_INFINITY,i=0,a=r.graph(),o=a.marginx||0,s=a.marginy||0;function u(l){var c=l.x,f=l.y,d=l.width,h=l.height;e=Math.min(e,c-d/2),t=Math.max(t,c+d/2),n=Math.min(n,f-h/2),i=Math.max(i,f+h/2)}_r.forEach(r.nodes(),function(l){u(r.node(l))}),_r.forEach(r.edges(),function(l){var c=r.edge(l);_r.has(c,"x")&&u(c)}),e-=o,n-=s,_r.forEach(r.nodes(),function(l){var c=r.node(l);c.x-=e,c.y-=n}),_r.forEach(r.edges(),function(l){var c=r.edge(l);_r.forEach(c.points,function(f){f.x-=e,f.y-=n}),_r.has(c,"x")&&(c.x-=e),_r.has(c,"y")&&(c.y-=n)}),a.width=t-e+o,a.height=i-n+s}function Ote(r){_r.forEach(r.edges(),function(e){var t=r.edge(e),n=r.node(e.v),i=r.node(e.w),a,o;t.points?(a=t.points[0],o=t.points[t.points.length-1]):(t.points=[],a=i,o=n),t.points.unshift(zs.intersectRect(n,a)),t.points.push(zs.intersectRect(i,o))})}function Pte(r){_r.forEach(r.edges(),function(e){var t=r.edge(e);if(_r.has(t,"x"))switch((t.labelpos==="l"||t.labelpos==="r")&&(t.width-=t.labeloffset),t.labelpos){case"l":t.x-=t.width/2+t.labeloffset;break;case"r":t.x+=t.width/2+t.labeloffset;break}})}function Rte(r){_r.forEach(r.edges(),function(e){var t=r.edge(e);t.reversed&&t.points.reverse()})}function Bte(r){_r.forEach(r.nodes(),function(e){if(r.children(e).length){var t=r.node(e),n=r.node(t.borderTop),i=r.node(t.borderBottom),a=r.node(_r.last(t.borderLeft)),o=r.node(_r.last(t.borderRight));t.width=Math.abs(o.x-a.x),t.height=Math.abs(i.y-n.y),t.x=a.x+t.width/2,t.y=n.y+t.height/2}}),_r.forEach(r.nodes(),function(e){r.node(e).dummy==="border"&&r.removeNode(e)})}function Fte(r){_r.forEach(r.edges(),function(e){if(e.v===e.w){var t=r.node(e.v);t.selfEdges||(t.selfEdges=[]),t.selfEdges.push({e,label:r.edge(e)}),r.removeEdge(e)}})}function Ute(r){var e=zs.buildLayerMatrix(r);_r.forEach(e,function(t){var n=0;_r.forEach(t,function(i,a){var o=r.node(i);o.order=a+n,_r.forEach(o.selfEdges,function(s){zs.addDummyNode(r,"selfedge",{width:s.label.width,height:s.label.height,rank:o.rank,order:a+ ++n,e:s.e,label:s.label},"_se")}),delete o.selfEdges})})}function Gte(r){_r.forEach(r.nodes(),function(e){var t=r.node(e);if(t.dummy==="selfedge"){var n=r.node(t.e.v),i=n.x+n.width/2,a=n.y,o=t.x-i,s=n.height/2;r.setEdge(t.e,t.label),r.removeNode(e),t.label.points=[{x:i+2*o/3,y:a-s},{x:i+5*o/6,y:a-s},{x:i+o,y:a},{x:i+5*o/6,y:a+s},{x:i+2*o/3,y:a+s}],t.label.x=t.x,t.label.y=t.y}})}function kw(r,e){return _r.mapValues(_r.pick(r,e),Number)}function Dw(r){var e={};return _r.forEach(r,function(t,n){e[n.toLowerCase()]=t}),e}var Gg=dn,zte=zi,$te=za.Graph,Vte={debugOrdering:jte};function jte(r){var e=zte.buildLayerMatrix(r),t=new $te({compound:!0,multigraph:!0}).setGraph({});return Gg.forEach(r.nodes(),function(n){t.setNode(n,{label:n}),t.setParent(n,"layer"+r.node(n).rank)}),Gg.forEach(r.edges(),function(n){t.setEdge(n.v,n.w,{},n.name)}),Gg.forEach(e,function(n,i){var a="layer"+i;t.setNode(a,{rank:"same"}),Gg.reduce(n,function(o,s){return t.setEdge(o,s,{style:"invis"}),s})}),t}var Wte="0.8.5",BD={graphlib:za,layout:gte,debug:Vte,util:{time:zi.time,notime:zi.notime},version:Wte};class Xte extends Ci{constructor(e){super();this.rankdir="TB",this.nodesep=50,this.ranksep=50,this.controlPoints=!1,this.sortByCombo=!1,this.nodes=[],this.edges=[],this.onLayoutEnd=()=>{},this.updateCfg(e)}getDefaultCfg(){return{rankdir:"TB",align:void 0,nodeSize:void 0,nodesepFunc:void 0,ranksepFunc:void 0,nodesep:50,ranksep:50,controlPoints:!1}}execute(){const e=this,{nodes:t,nodeSize:n,rankdir:i,combos:a}=e;if(!t)return;const o=e.edges||[],s=new BD.graphlib.Graph({multigraph:!0,compound:!0});let u;n?fi(n)?u=()=>n:u=()=>[n,n]:u=h=>h.size?fi(h.size)?h.size:vo(h.size)?[h.size.width||40,h.size.height||40]:[h.size,h.size]:[40,40];let l=zg(e.nodesepFunc,e.nodesep,50),c=zg(e.ranksepFunc,e.ranksep,50);(i==="LR"||i==="RL")&&(l=zg(e.ranksepFunc,e.ranksep,50),c=zg(e.nodesepFunc,e.nodesep,50)),s.setDefaultEdgeLabel(()=>({})),s.setGraph(e);const f={};t.filter(h=>h.layout!==!1).forEach(h=>{const v=u(h),p=c(h),g=l(h),y=v[0]+2*g,m=v[1]+2*p;s.setNode(h.id,{width:y,height:m}),this.sortByCombo&&h.comboId&&(f[h.comboId]||(f[h.comboId]=!0,s.setNode(h.comboId,{})),s.setParent(h.id,h.comboId))}),this.sortByCombo&&a&&a.forEach(h=>{!h.parentId||(f[h.parentId]||(f[h.parentId]=!0,s.setNode(h.parentId,{})),s.setParent(h.id,h.parentId))}),o.forEach(h=>{const v=Pr(h,"source"),p=Pr(h,"target");s.setEdge(v,p,{weight:h.weight||1})}),BD.layout(s);let d;return s.nodes().forEach(h=>{d=s.node(h);const v=t.findIndex(p=>p.id===h);!t[v]||(t[v].x=d.x,t[v].y=d.y)}),s.edges().forEach(h=>{d=s.edge(h);const v=o.findIndex(p=>{const g=Pr(p,"source"),y=Pr(p,"target");return g===h.v&&y===h.w});e.controlPoints&&o[v].type!=="loop"&&(o[v].controlPoints=d.points.slice(1,d.points.length-1))}),e.onLayoutEnd&&e.onLayoutEnd(),{nodes:t,edges:o}}getType(){return"dagre"}}function zg(r,e,t){let n;return r?n=r:gt(e)?n=()=>e:n=()=>t,n}const Yte=Object.prototype.toString;function $g(r){return Yte.call(r).endsWith("Array]")}function Hte(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!$g(r))throw new TypeError("input must be an array");if(r.length===0)throw new TypeError("input must not be empty");var t=e.fromIndex,n=t===void 0?0:t,i=e.toIndex,a=i===void 0?r.length:i;if(n<0||n>=r.length||!Number.isInteger(n))throw new Error("fromIndex must be a positive integer smaller than length");if(a<=n||a>r.length||!Number.isInteger(a))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var o=r[n],s=n+1;s<a;s++)r[s]>o&&(o=r[s]);return o}function qte(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!$g(r))throw new TypeError("input must be an array");if(r.length===0)throw new TypeError("input must not be empty");var t=e.fromIndex,n=t===void 0?0:t,i=e.toIndex,a=i===void 0?r.length:i;if(n<0||n>=r.length||!Number.isInteger(n))throw new Error("fromIndex must be a positive integer smaller than length");if(a<=n||a>r.length||!Number.isInteger(a))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var o=r[n],s=n+1;s<a;s++)r[s]<o&&(o=r[s]);return o}function FD(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if($g(r)){if(r.length===0)throw new TypeError("input must not be empty")}else throw new TypeError("input must be an array");var t;if(e.output!==void 0){if(!$g(e.output))throw new TypeError("output option must be an array if specified");t=e.output}else t=new Array(r.length);var n=qte(r),i=Hte(r);if(n===i)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var a=e.min,o=a===void 0?e.autoMinMax?n:0:a,s=e.max,u=s===void 0?e.autoMinMax?i:1:s;if(o>=u)throw new RangeError("min option must be smaller than max option");for(var l=(u-o)/(i-n),c=0;c<r.length;c++)t[c]=(r[c]-n)*l+o;return t}const Vg=" ".repeat(2),UD=" ".repeat(4);function Kte(){return GD(this)}function GD(r,e={}){const{maxRows:t=15,maxColumns:n=10,maxNumSize:i=8}=e;return`${r.constructor.name} {
${Vg}[
${UD}${Zte(r,t,n,i)}
${Vg}]
${Vg}rows: ${r.rows}
${Vg}columns: ${r.columns}
}`}function Zte(r,e,t,n){const{rows:i,columns:a}=r,o=Math.min(i,e),s=Math.min(a,t),u=[];for(let l=0;l<o;l++){let c=[];for(let f=0;f<s;f++)c.push(Qte(r.get(l,f),n));u.push(`${c.join(" ")}`)}return s!==a&&(u[u.length-1]+=` ... ${a-t} more columns`),o!==i&&u.push(`... ${i-e} more rows`),u.join(`
${UD}`)}function Qte(r,e){const t=String(r);if(t.length<=e)return t.padEnd(e," ");const n=r.toPrecision(e-2);if(n.length<=e)return n;const i=r.toExponential(e-2),a=i.indexOf("e"),o=i.slice(a);return i.slice(0,e-o.length)+o}function Jte(r,e){r.prototype.add=function(n){return typeof n=="number"?this.addS(n):this.addM(n)},r.prototype.addS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)+n);return this},r.prototype.addM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)+n.get(i,a));return this},r.add=function(n,i){return new e(n).add(i)},r.prototype.sub=function(n){return typeof n=="number"?this.subS(n):this.subM(n)},r.prototype.subS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)-n);return this},r.prototype.subM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)-n.get(i,a));return this},r.sub=function(n,i){return new e(n).sub(i)},r.prototype.subtract=r.prototype.sub,r.prototype.subtractS=r.prototype.subS,r.prototype.subtractM=r.prototype.subM,r.subtract=r.sub,r.prototype.mul=function(n){return typeof n=="number"?this.mulS(n):this.mulM(n)},r.prototype.mulS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)*n);return this},r.prototype.mulM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)*n.get(i,a));return this},r.mul=function(n,i){return new e(n).mul(i)},r.prototype.multiply=r.prototype.mul,r.prototype.multiplyS=r.prototype.mulS,r.prototype.multiplyM=r.prototype.mulM,r.multiply=r.mul,r.prototype.div=function(n){return typeof n=="number"?this.divS(n):this.divM(n)},r.prototype.divS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)/n);return this},r.prototype.divM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)/n.get(i,a));return this},r.div=function(n,i){return new e(n).div(i)},r.prototype.divide=r.prototype.div,r.prototype.divideS=r.prototype.divS,r.prototype.divideM=r.prototype.divM,r.divide=r.div,r.prototype.mod=function(n){return typeof n=="number"?this.modS(n):this.modM(n)},r.prototype.modS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)%n);return this},r.prototype.modM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)%n.get(i,a));return this},r.mod=function(n,i){return new e(n).mod(i)},r.prototype.modulus=r.prototype.mod,r.prototype.modulusS=r.prototype.modS,r.prototype.modulusM=r.prototype.modM,r.modulus=r.mod,r.prototype.and=function(n){return typeof n=="number"?this.andS(n):this.andM(n)},r.prototype.andS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)&n);return this},r.prototype.andM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)&n.get(i,a));return this},r.and=function(n,i){return new e(n).and(i)},r.prototype.or=function(n){return typeof n=="number"?this.orS(n):this.orM(n)},r.prototype.orS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)|n);return this},r.prototype.orM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)|n.get(i,a));return this},r.or=function(n,i){return new e(n).or(i)},r.prototype.xor=function(n){return typeof n=="number"?this.xorS(n):this.xorM(n)},r.prototype.xorS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)^n);return this},r.prototype.xorM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)^n.get(i,a));return this},r.xor=function(n,i){return new e(n).xor(i)},r.prototype.leftShift=function(n){return typeof n=="number"?this.leftShiftS(n):this.leftShiftM(n)},r.prototype.leftShiftS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)<<n);return this},r.prototype.leftShiftM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)<<n.get(i,a));return this},r.leftShift=function(n,i){return new e(n).leftShift(i)},r.prototype.signPropagatingRightShift=function(n){return typeof n=="number"?this.signPropagatingRightShiftS(n):this.signPropagatingRightShiftM(n)},r.prototype.signPropagatingRightShiftS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)>>n);return this},r.prototype.signPropagatingRightShiftM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)>>n.get(i,a));return this},r.signPropagatingRightShift=function(n,i){return new e(n).signPropagatingRightShift(i)},r.prototype.rightShift=function(n){return typeof n=="number"?this.rightShiftS(n):this.rightShiftM(n)},r.prototype.rightShiftS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)>>>n);return this},r.prototype.rightShiftM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)>>>n.get(i,a));return this},r.rightShift=function(n,i){return new e(n).rightShift(i)},r.prototype.zeroFillRightShift=r.prototype.rightShift,r.prototype.zeroFillRightShiftS=r.prototype.rightShiftS,r.prototype.zeroFillRightShiftM=r.prototype.rightShiftM,r.zeroFillRightShift=r.rightShift,r.prototype.not=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,~this.get(n,i));return this},r.not=function(n){return new e(n).not()},r.prototype.abs=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.abs(this.get(n,i)));return this},r.abs=function(n){return new e(n).abs()},r.prototype.acos=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.acos(this.get(n,i)));return this},r.acos=function(n){return new e(n).acos()},r.prototype.acosh=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.acosh(this.get(n,i)));return this},r.acosh=function(n){return new e(n).acosh()},r.prototype.asin=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.asin(this.get(n,i)));return this},r.asin=function(n){return new e(n).asin()},r.prototype.asinh=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.asinh(this.get(n,i)));return this},r.asinh=function(n){return new e(n).asinh()},r.prototype.atan=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.atan(this.get(n,i)));return this},r.atan=function(n){return new e(n).atan()},r.prototype.atanh=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.atanh(this.get(n,i)));return this},r.atanh=function(n){return new e(n).atanh()},r.prototype.cbrt=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.cbrt(this.get(n,i)));return this},r.cbrt=function(n){return new e(n).cbrt()},r.prototype.ceil=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.ceil(this.get(n,i)));return this},r.ceil=function(n){return new e(n).ceil()},r.prototype.clz32=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.clz32(this.get(n,i)));return this},r.clz32=function(n){return new e(n).clz32()},r.prototype.cos=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.cos(this.get(n,i)));return this},r.cos=function(n){return new e(n).cos()},r.prototype.cosh=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.cosh(this.get(n,i)));return this},r.cosh=function(n){return new e(n).cosh()},r.prototype.exp=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.exp(this.get(n,i)));return this},r.exp=function(n){return new e(n).exp()},r.prototype.expm1=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.expm1(this.get(n,i)));return this},r.expm1=function(n){return new e(n).expm1()},r.prototype.floor=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.floor(this.get(n,i)));return this},r.floor=function(n){return new e(n).floor()},r.prototype.fround=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.fround(this.get(n,i)));return this},r.fround=function(n){return new e(n).fround()},r.prototype.log=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.log(this.get(n,i)));return this},r.log=function(n){return new e(n).log()},r.prototype.log1p=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.log1p(this.get(n,i)));return this},r.log1p=function(n){return new e(n).log1p()},r.prototype.log10=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.log10(this.get(n,i)));return this},r.log10=function(n){return new e(n).log10()},r.prototype.log2=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.log2(this.get(n,i)));return this},r.log2=function(n){return new e(n).log2()},r.prototype.round=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.round(this.get(n,i)));return this},r.round=function(n){return new e(n).round()},r.prototype.sign=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.sign(this.get(n,i)));return this},r.sign=function(n){return new e(n).sign()},r.prototype.sin=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.sin(this.get(n,i)));return this},r.sin=function(n){return new e(n).sin()},r.prototype.sinh=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.sinh(this.get(n,i)));return this},r.sinh=function(n){return new e(n).sinh()},r.prototype.sqrt=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.sqrt(this.get(n,i)));return this},r.sqrt=function(n){return new e(n).sqrt()},r.prototype.tan=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.tan(this.get(n,i)));return this},r.tan=function(n){return new e(n).tan()},r.prototype.tanh=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.tanh(this.get(n,i)));return this},r.tanh=function(n){return new e(n).tanh()},r.prototype.trunc=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.trunc(this.get(n,i)));return this},r.trunc=function(n){return new e(n).trunc()},r.pow=function(n,i){return new e(n).pow(i)},r.prototype.pow=function(n){return typeof n=="number"?this.powS(n):this.powM(n)},r.prototype.powS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,Math.pow(this.get(i,a),n));return this},r.prototype.powM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,Math.pow(this.get(i,a),n.get(i,a)));return this}}function $a(r,e,t){let n=t?r.rows:r.rows-1;if(e<0||e>n)throw new RangeError("Row index out of range")}function Va(r,e,t){let n=t?r.columns:r.columns-1;if(e<0||e>n)throw new RangeError("Column index out of range")}function bc(r,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==r.columns)throw new RangeError("vector size must be the same as the number of columns");return e}function wc(r,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==r.rows)throw new RangeError("vector size must be the same as the number of rows");return e}function ere(r,e,t){return{row:tre(r,e),column:rre(r,t)}}function tre(r,e){if(typeof e!="object")throw new TypeError("unexpected type for row indices");if(e.some(n=>n<0||n>=r.rows))throw new RangeError("row indices are out of range");return Array.isArray(e)||(e=Array.from(e)),e}function rre(r,e){if(typeof e!="object")throw new TypeError("unexpected type for column indices");if(e.some(n=>n<0||n>=r.columns))throw new RangeError("column indices are out of range");return Array.isArray(e)||(e=Array.from(e)),e}function zD(r,e,t,n,i){if(arguments.length!==5)throw new RangeError("expected 4 arguments");if(Wg("startRow",e),Wg("endRow",t),Wg("startColumn",n),Wg("endColumn",i),e>t||n>i||e<0||e>=r.rows||t<0||t>=r.rows||n<0||n>=r.columns||i<0||i>=r.columns)throw new RangeError("Submatrix indices are out of range")}function jg(r,e=0){let t=[];for(let n=0;n<r;n++)t.push(e);return t}function Wg(r,e){if(typeof e!="number")throw new TypeError(`${r} must be a number`)}function xc(r){if(r.isEmpty())throw new Error("Empty matrix has no elements to index")}function nre(r){let e=jg(r.rows);for(let t=0;t<r.rows;++t)for(let n=0;n<r.columns;++n)e[t]+=r.get(t,n);return e}function ire(r){let e=jg(r.columns);for(let t=0;t<r.rows;++t)for(let n=0;n<r.columns;++n)e[n]+=r.get(t,n);return e}function are(r){let e=0;for(let t=0;t<r.rows;t++)for(let n=0;n<r.columns;n++)e+=r.get(t,n);return e}function ore(r){let e=jg(r.rows,1);for(let t=0;t<r.rows;++t)for(let n=0;n<r.columns;++n)e[t]*=r.get(t,n);return e}function sre(r){let e=jg(r.columns,1);for(let t=0;t<r.rows;++t)for(let n=0;n<r.columns;++n)e[n]*=r.get(t,n);return e}function ure(r){let e=1;for(let t=0;t<r.rows;t++)for(let n=0;n<r.columns;n++)e*=r.get(t,n);return e}function lre(r,e,t){const n=r.rows,i=r.columns,a=[];for(let o=0;o<n;o++){let s=0,u=0,l=0;for(let c=0;c<i;c++)l=r.get(o,c)-t[o],s+=l,u+=l*l;e?a.push((u-s*s/i)/(i-1)):a.push((u-s*s/i)/i)}return a}function cre(r,e,t){const n=r.rows,i=r.columns,a=[];for(let o=0;o<i;o++){let s=0,u=0,l=0;for(let c=0;c<n;c++)l=r.get(c,o)-t[o],s+=l,u+=l*l;e?a.push((u-s*s/n)/(n-1)):a.push((u-s*s/n)/n)}return a}function fre(r,e,t){const n=r.rows,i=r.columns,a=n*i;let o=0,s=0,u=0;for(let l=0;l<n;l++)for(let c=0;c<i;c++)u=r.get(l,c)-t,o+=u,s+=u*u;return e?(s-o*o/a)/(a-1):(s-o*o/a)/a}function hre(r,e){for(let t=0;t<r.rows;t++)for(let n=0;n<r.columns;n++)r.set(t,n,r.get(t,n)-e[t])}function dre(r,e){for(let t=0;t<r.rows;t++)for(let n=0;n<r.columns;n++)r.set(t,n,r.get(t,n)-e[n])}function vre(r,e){for(let t=0;t<r.rows;t++)for(let n=0;n<r.columns;n++)r.set(t,n,r.get(t,n)-e)}function pre(r){const e=[];for(let t=0;t<r.rows;t++){let n=0;for(let i=0;i<r.columns;i++)n+=Math.pow(r.get(t,i),2)/(r.columns-1);e.push(Math.sqrt(n))}return e}function gre(r,e){for(let t=0;t<r.rows;t++)for(let n=0;n<r.columns;n++)r.set(t,n,r.get(t,n)/e[t])}function yre(r){const e=[];for(let t=0;t<r.columns;t++){let n=0;for(let i=0;i<r.rows;i++)n+=Math.pow(r.get(i,t),2)/(r.rows-1);e.push(Math.sqrt(n))}return e}function mre(r,e){for(let t=0;t<r.rows;t++)for(let n=0;n<r.columns;n++)r.set(t,n,r.get(t,n)/e[n])}function bre(r){const e=r.size-1;let t=0;for(let n=0;n<r.columns;n++)for(let i=0;i<r.rows;i++)t+=Math.pow(r.get(i,n),2)/e;return Math.sqrt(t)}function wre(r,e){for(let t=0;t<r.rows;t++)for(let n=0;n<r.columns;n++)r.set(t,n,r.get(t,n)/e)}class Mr{static from1DArray(e,t,n){if(e*t!==n.length)throw new RangeError("data length does not match given dimensions");let a=new Xt(e,t);for(let o=0;o<e;o++)for(let s=0;s<t;s++)a.set(o,s,n[o*t+s]);return a}static rowVector(e){let t=new Xt(1,e.length);for(let n=0;n<e.length;n++)t.set(0,n,e[n]);return t}static columnVector(e){let t=new Xt(e.length,1);for(let n=0;n<e.length;n++)t.set(n,0,e[n]);return t}static zeros(e,t){return new Xt(e,t)}static ones(e,t){return new Xt(e,t).fill(1)}static rand(e,t,n={}){if(typeof n!="object")throw new TypeError("options must be an object");const{random:i=Math.random}=n;let a=new Xt(e,t);for(let o=0;o<e;o++)for(let s=0;s<t;s++)a.set(o,s,i());return a}static randInt(e,t,n={}){if(typeof n!="object")throw new TypeError("options must be an object");const{min:i=0,max:a=1e3,random:o=Math.random}=n;if(!Number.isInteger(i))throw new TypeError("min must be an integer");if(!Number.isInteger(a))throw new TypeError("max must be an integer");if(i>=a)throw new RangeError("min must be smaller than max");let s=a-i,u=new Xt(e,t);for(let l=0;l<e;l++)for(let c=0;c<t;c++){let f=i+Math.round(o()*s);u.set(l,c,f)}return u}static eye(e,t,n){t===void 0&&(t=e),n===void 0&&(n=1);let i=Math.min(e,t),a=this.zeros(e,t);for(let o=0;o<i;o++)a.set(o,o,n);return a}static diag(e,t,n){let i=e.length;t===void 0&&(t=i),n===void 0&&(n=t);let a=Math.min(i,t,n),o=this.zeros(t,n);for(let s=0;s<a;s++)o.set(s,s,e[s]);return o}static min(e,t){e=this.checkMatrix(e),t=this.checkMatrix(t);let n=e.rows,i=e.columns,a=new Xt(n,i);for(let o=0;o<n;o++)for(let s=0;s<i;s++)a.set(o,s,Math.min(e.get(o,s),t.get(o,s)));return a}static max(e,t){e=this.checkMatrix(e),t=this.checkMatrix(t);let n=e.rows,i=e.columns,a=new this(n,i);for(let o=0;o<n;o++)for(let s=0;s<i;s++)a.set(o,s,Math.max(e.get(o,s),t.get(o,s)));return a}static checkMatrix(e){return Mr.isMatrix(e)?e:new Xt(e)}static isMatrix(e){return e!=null&&e.klass==="Matrix"}get size(){return this.rows*this.columns}apply(e){if(typeof e!="function")throw new TypeError("callback must be a function");for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)e.call(this,t,n);return this}to1DArray(){let e=[];for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)e.push(this.get(t,n));return e}to2DArray(){let e=[];for(let t=0;t<this.rows;t++){e.push([]);for(let n=0;n<this.columns;n++)e[t].push(this.get(t,n))}return e}toJSON(){return this.to2DArray()}isRowVector(){return this.rows===1}isColumnVector(){return this.columns===1}isVector(){return this.rows===1||this.columns===1}isSquare(){return this.rows===this.columns}isEmpty(){return this.rows===0||this.columns===0}isSymmetric(){if(this.isSquare()){for(let e=0;e<this.rows;e++)for(let t=0;t<=e;t++)if(this.get(e,t)!==this.get(t,e))return!1;return!0}return!1}isEchelonForm(){let e=0,t=0,n=-1,i=!0,a=!1;for(;e<this.rows&&i;){for(t=0,a=!1;t<this.columns&&a===!1;)this.get(e,t)===0?t++:this.get(e,t)===1&&t>n?(a=!0,n=t):(i=!1,a=!0);e++}return i}isReducedEchelonForm(){let e=0,t=0,n=-1,i=!0,a=!1;for(;e<this.rows&&i;){for(t=0,a=!1;t<this.columns&&a===!1;)this.get(e,t)===0?t++:this.get(e,t)===1&&t>n?(a=!0,n=t):(i=!1,a=!0);for(let o=t+1;o<this.rows;o++)this.get(e,o)!==0&&(i=!1);e++}return i}echelonForm(){let e=this.clone(),t=0,n=0;for(;t<e.rows&&n<e.columns;){let i=t;for(let a=t;a<e.rows;a++)e.get(a,n)>e.get(i,n)&&(i=a);if(e.get(i,n)===0)n++;else{e.swapRows(t,i);let a=e.get(t,n);for(let o=n;o<e.columns;o++)e.set(t,o,e.get(t,o)/a);for(let o=t+1;o<e.rows;o++){let s=e.get(o,n)/e.get(t,n);e.set(o,n,0);for(let u=n+1;u<e.columns;u++)e.set(o,u,e.get(o,u)-e.get(t,u)*s)}t++,n++}}return e}reducedEchelonForm(){let e=this.echelonForm(),t=e.columns,n=e.rows,i=n-1;for(;i>=0;)if(e.maxRow(i)===0)i--;else{let a=0,o=!1;for(;a<n&&o===!1;)e.get(i,a)===1?o=!0:a++;for(let s=0;s<i;s++){let u=e.get(s,a);for(let l=a;l<t;l++){let c=e.get(s,l)-u*e.get(i,l);e.set(s,l,c)}}i--}return e}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(e={}){if(typeof e!="object")throw new TypeError("options must be an object");const{rows:t=1,columns:n=1}=e;if(!Number.isInteger(t)||t<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(n)||n<=0)throw new TypeError("columns must be a positive integer");let i=new Xt(this.rows*t,this.columns*n);for(let a=0;a<t;a++)for(let o=0;o<n;o++)i.setSubMatrix(this,this.rows*a,this.columns*o);return i}fill(e){for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,e);return this}neg(){return this.mulS(-1)}getRow(e){$a(this,e);let t=[];for(let n=0;n<this.columns;n++)t.push(this.get(e,n));return t}getRowVector(e){return Xt.rowVector(this.getRow(e))}setRow(e,t){$a(this,e),t=bc(this,t);for(let n=0;n<this.columns;n++)this.set(e,n,t[n]);return this}swapRows(e,t){$a(this,e),$a(this,t);for(let n=0;n<this.columns;n++){let i=this.get(e,n);this.set(e,n,this.get(t,n)),this.set(t,n,i)}return this}getColumn(e){Va(this,e);let t=[];for(let n=0;n<this.rows;n++)t.push(this.get(n,e));return t}getColumnVector(e){return Xt.columnVector(this.getColumn(e))}setColumn(e,t){Va(this,e),t=wc(this,t);for(let n=0;n<this.rows;n++)this.set(n,e,t[n]);return this}swapColumns(e,t){Va(this,e),Va(this,t);for(let n=0;n<this.rows;n++){let i=this.get(n,e);this.set(n,e,this.get(n,t)),this.set(n,t,i)}return this}addRowVector(e){e=bc(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)+e[n]);return this}subRowVector(e){e=bc(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)-e[n]);return this}mulRowVector(e){e=bc(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)*e[n]);return this}divRowVector(e){e=bc(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)/e[n]);return this}addColumnVector(e){e=wc(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)+e[t]);return this}subColumnVector(e){e=wc(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)-e[t]);return this}mulColumnVector(e){e=wc(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)*e[t]);return this}divColumnVector(e){e=wc(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)/e[t]);return this}mulRow(e,t){$a(this,e);for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t);return this}mulColumn(e,t){Va(this,e);for(let n=0;n<this.rows;n++)this.set(n,e,this.get(n,e)*t);return this}max(){if(this.isEmpty())return NaN;let e=this.get(0,0);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.get(t,n)>e&&(e=this.get(t,n));return e}maxIndex(){xc(this);let e=this.get(0,0),t=[0,0];for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.get(n,i)>e&&(e=this.get(n,i),t[0]=n,t[1]=i);return t}min(){if(this.isEmpty())return NaN;let e=this.get(0,0);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.get(t,n)<e&&(e=this.get(t,n));return e}minIndex(){xc(this);let e=this.get(0,0),t=[0,0];for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.get(n,i)<e&&(e=this.get(n,i),t[0]=n,t[1]=i);return t}maxRow(e){if($a(this,e),this.isEmpty())return NaN;let t=this.get(e,0);for(let n=1;n<this.columns;n++)this.get(e,n)>t&&(t=this.get(e,n));return t}maxRowIndex(e){$a(this,e),xc(this);let t=this.get(e,0),n=[e,0];for(let i=1;i<this.columns;i++)this.get(e,i)>t&&(t=this.get(e,i),n[1]=i);return n}minRow(e){if($a(this,e),this.isEmpty())return NaN;let t=this.get(e,0);for(let n=1;n<this.columns;n++)this.get(e,n)<t&&(t=this.get(e,n));return t}minRowIndex(e){$a(this,e),xc(this);let t=this.get(e,0),n=[e,0];for(let i=1;i<this.columns;i++)this.get(e,i)<t&&(t=this.get(e,i),n[1]=i);return n}maxColumn(e){if(Va(this,e),this.isEmpty())return NaN;let t=this.get(0,e);for(let n=1;n<this.rows;n++)this.get(n,e)>t&&(t=this.get(n,e));return t}maxColumnIndex(e){Va(this,e),xc(this);let t=this.get(0,e),n=[0,e];for(let i=1;i<this.rows;i++)this.get(i,e)>t&&(t=this.get(i,e),n[0]=i);return n}minColumn(e){if(Va(this,e),this.isEmpty())return NaN;let t=this.get(0,e);for(let n=1;n<this.rows;n++)this.get(n,e)<t&&(t=this.get(n,e));return t}minColumnIndex(e){Va(this,e),xc(this);let t=this.get(0,e),n=[0,e];for(let i=1;i<this.rows;i++)this.get(i,e)<t&&(t=this.get(i,e),n[0]=i);return n}diag(){let e=Math.min(this.rows,this.columns),t=[];for(let n=0;n<e;n++)t.push(this.get(n,n));return t}norm(e="frobenius"){let t=0;if(e==="max")return this.max();if(e==="frobenius"){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)t=t+this.get(n,i)*this.get(n,i);return Math.sqrt(t)}else throw new RangeError(`unknown norm type: ${e}`)}cumulativeSum(){let e=0;for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)e+=this.get(t,n),this.set(t,n,e);return this}dot(e){Mr.isMatrix(e)&&(e=e.to1DArray());let t=this.to1DArray();if(t.length!==e.length)throw new RangeError("vectors do not have the same size");let n=0;for(let i=0;i<t.length;i++)n+=t[i]*e[i];return n}mmul(e){e=Xt.checkMatrix(e);let t=this.rows,n=this.columns,i=e.columns,a=new Xt(t,i),o=new Float64Array(n);for(let s=0;s<i;s++){for(let u=0;u<n;u++)o[u]=e.get(u,s);for(let u=0;u<t;u++){let l=0;for(let c=0;c<n;c++)l+=this.get(u,c)*o[c];a.set(u,s,l)}}return a}strassen2x2(e){e=Xt.checkMatrix(e);let t=new Xt(2,2);const n=this.get(0,0),i=e.get(0,0),a=this.get(0,1),o=e.get(0,1),s=this.get(1,0),u=e.get(1,0),l=this.get(1,1),c=e.get(1,1),f=(n+l)*(i+c),d=(s+l)*i,h=n*(o-c),v=l*(u-i),p=(n+a)*c,g=(s-n)*(i+o),y=(a-l)*(u+c),m=f+v-p+y,b=h+p,w=d+v,x=f-d+h+g;return t.set(0,0,m),t.set(0,1,b),t.set(1,0,w),t.set(1,1,x),t}strassen3x3(e){e=Xt.checkMatrix(e);let t=new Xt(3,3);const n=this.get(0,0),i=this.get(0,1),a=this.get(0,2),o=this.get(1,0),s=this.get(1,1),u=this.get(1,2),l=this.get(2,0),c=this.get(2,1),f=this.get(2,2),d=e.get(0,0),h=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+i+a-o-s-c-f)*g,_=(n-o)*(-h+g),A=s*(-d+h+p-g-y-m+w),I=(-n+o+s)*(d-h+g),M=(o+s)*(-d+h),S=n*d,C=(-n+l+c)*(d-v+y),T=(-n+l)*(v-y),k=(l+c)*(-d+v),L=(n+i+a-s-u-l-c)*y,B=c*(-d+v+p-g-y-m+b),ee=(-a+c+f)*(g+m-b),K=(a-f)*(g-b),z=a*m,X=(c+f)*(-m+b),H=(-a+s+u)*(y+m-w),J=(a-u)*(y-w),ne=(s+u)*(-m+w),me=i*p,oe=u*b,Ae=o*v,ze=l*h,qe=f*w,ft=S+z+me,ct=x+I+M+S+ee+z+X,st=S+C+k+L+z+H+ne,gr=_+A+I+S+z+H+J,tr=_+I+M+S+oe,$=z+H+J+ne+Ae,se=S+C+T+B+ee+K+z,W=ee+K+z+X+ze,Ze=S+C+T+k+qe;return t.set(0,0,ft),t.set(0,1,ct),t.set(0,2,st),t.set(1,0,gr),t.set(1,1,tr),t.set(1,2,$),t.set(2,0,se),t.set(2,1,W),t.set(2,2,Ze),t}mmulStrassen(e){e=Xt.checkMatrix(e);let t=this.clone(),n=t.rows,i=t.columns,a=e.rows,o=e.columns;i!==a&&console.warn(`Multiplying ${n} x ${i} and ${a} x ${o} matrix: dimensions do not match.`);function s(f,d,h){let v=f.rows,p=f.columns;if(v===d&&p===h)return f;{let g=Mr.zeros(d,h);return g=g.setSubMatrix(f,0,0),g}}let u=Math.max(n,a),l=Math.max(i,o);t=s(t,u,l),e=s(e,u,l);function c(f,d,h,v){if(h<=512||v<=512)return f.mmul(d);h%2==1&&v%2==1?(f=s(f,h+1,v+1),d=s(d,h+1,v+1)):h%2==1?(f=s(f,h+1,v),d=s(d,h+1,v)):v%2==1&&(f=s(f,h,v+1),d=s(d,h,v+1));let p=parseInt(f.rows/2,10),g=parseInt(f.columns/2,10),y=f.subMatrix(0,p-1,0,g-1),m=d.subMatrix(0,p-1,0,g-1),b=f.subMatrix(0,p-1,g,f.columns-1),w=d.subMatrix(0,p-1,g,d.columns-1),x=f.subMatrix(p,f.rows-1,0,g-1),_=d.subMatrix(p,d.rows-1,0,g-1),A=f.subMatrix(p,f.rows-1,g,f.columns-1),I=d.subMatrix(p,d.rows-1,g,d.columns-1),M=c(Mr.add(y,A),Mr.add(m,I),p,g),S=c(Mr.add(x,A),m,p,g),C=c(y,Mr.sub(w,I),p,g),T=c(A,Mr.sub(_,m),p,g),k=c(Mr.add(y,b),I,p,g),L=c(Mr.sub(x,y),Mr.add(m,w),p,g),B=c(Mr.sub(b,A),Mr.add(_,I),p,g),ee=Mr.add(M,T);ee.sub(k),ee.add(B);let K=Mr.add(C,k),z=Mr.add(S,T),X=Mr.sub(M,S);X.add(C),X.add(L);let H=Mr.zeros(2*ee.rows,2*ee.columns);return H=H.setSubMatrix(ee,0,0),H=H.setSubMatrix(K,ee.rows,0),H=H.setSubMatrix(z,0,ee.columns),H=H.setSubMatrix(X,ee.rows,ee.columns),H.subMatrix(0,h-1,0,v-1)}return c(t,e,u,l)}scaleRows(e={}){if(typeof e!="object")throw new TypeError("options must be an object");const{min:t=0,max:n=1}=e;if(!Number.isFinite(t))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(t>=n)throw new RangeError("min must be smaller than max");let i=new Xt(this.rows,this.columns);for(let a=0;a<this.rows;a++){const o=this.getRow(a);o.length>0&&FD(o,{min:t,max:n,output:o}),i.setRow(a,o)}return i}scaleColumns(e={}){if(typeof e!="object")throw new TypeError("options must be an object");const{min:t=0,max:n=1}=e;if(!Number.isFinite(t))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(t>=n)throw new RangeError("min must be smaller than max");let i=new Xt(this.rows,this.columns);for(let a=0;a<this.columns;a++){const o=this.getColumn(a);o.length&&FD(o,{min:t,max:n,output:o}),i.setColumn(a,o)}return i}flipRows(){const e=Math.ceil(this.columns/2);for(let t=0;t<this.rows;t++)for(let n=0;n<e;n++){let i=this.get(t,n),a=this.get(t,this.columns-1-n);this.set(t,n,a),this.set(t,this.columns-1-n,i)}return this}flipColumns(){const e=Math.ceil(this.rows/2);for(let t=0;t<this.columns;t++)for(let n=0;n<e;n++){let i=this.get(n,t),a=this.get(this.rows-1-n,t);this.set(n,t,a),this.set(this.rows-1-n,t,i)}return this}kroneckerProduct(e){e=Xt.checkMatrix(e);let t=this.rows,n=this.columns,i=e.rows,a=e.columns,o=new Xt(t*i,n*a);for(let s=0;s<t;s++)for(let u=0;u<n;u++)for(let l=0;l<i;l++)for(let c=0;c<a;c++)o.set(i*s+l,a*u+c,this.get(s,u)*e.get(l,c));return o}kroneckerSum(e){if(e=Xt.checkMatrix(e),!this.isSquare()||!e.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let t=this.rows,n=e.rows,i=this.kroneckerProduct(Xt.eye(n,n)),a=Xt.eye(t,t).kroneckerProduct(e);return i.add(a)}transpose(){let e=new Xt(this.columns,this.rows);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)e.set(n,t,this.get(t,n));return e}sortRows(e=$D){for(let t=0;t<this.rows;t++)this.setRow(t,this.getRow(t).sort(e));return this}sortColumns(e=$D){for(let t=0;t<this.columns;t++)this.setColumn(t,this.getColumn(t).sort(e));return this}subMatrix(e,t,n,i){zD(this,e,t,n,i);let a=new Xt(t-e+1,i-n+1);for(let o=e;o<=t;o++)for(let s=n;s<=i;s++)a.set(o-e,s-n,this.get(o,s));return a}subMatrixRow(e,t,n){if(t===void 0&&(t=0),n===void 0&&(n=this.columns-1),t>n||t<0||t>=this.columns||n<0||n>=this.columns)throw new RangeError("Argument out of range");let i=new Xt(e.length,n-t+1);for(let a=0;a<e.length;a++)for(let o=t;o<=n;o++){if(e[a]<0||e[a]>=this.rows)throw new RangeError(`Row index out of range: ${e[a]}`);i.set(a,o-t,this.get(e[a],o))}return i}subMatrixColumn(e,t,n){if(t===void 0&&(t=0),n===void 0&&(n=this.rows-1),t>n||t<0||t>=this.rows||n<0||n>=this.rows)throw new RangeError("Argument out of range");let i=new Xt(n-t+1,e.length);for(let a=0;a<e.length;a++)for(let o=t;o<=n;o++){if(e[a]<0||e[a]>=this.columns)throw new RangeError(`Column index out of range: ${e[a]}`);i.set(o-t,a,this.get(o,e[a]))}return i}setSubMatrix(e,t,n){if(e=Xt.checkMatrix(e),e.isEmpty())return this;let i=t+e.rows-1,a=n+e.columns-1;zD(this,t,i,n,a);for(let o=0;o<e.rows;o++)for(let s=0;s<e.columns;s++)this.set(t+o,n+s,e.get(o,s));return this}selection(e,t){let n=ere(this,e,t),i=new Xt(e.length,t.length);for(let a=0;a<n.row.length;a++){let o=n.row[a];for(let s=0;s<n.column.length;s++){let u=n.column[s];i.set(a,s,this.get(o,u))}}return i}trace(){let e=Math.min(this.rows,this.columns),t=0;for(let n=0;n<e;n++)t+=this.get(n,n);return t}clone(){let e=new Xt(this.rows,this.columns);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)e.set(t,n,this.get(t,n));return e}sum(e){switch(e){case"row":return nre(this);case"column":return ire(this);case void 0:return are(this);default:throw new Error(`invalid option: ${e}`)}}product(e){switch(e){case"row":return ore(this);case"column":return sre(this);case void 0:return ure(this);default:throw new Error(`invalid option: ${e}`)}}mean(e){const t=this.sum(e);switch(e){case"row":{for(let n=0;n<this.rows;n++)t[n]/=this.columns;return t}case"column":{for(let n=0;n<this.columns;n++)t[n]/=this.rows;return t}case void 0:return t/this.size;default:throw new Error(`invalid option: ${e}`)}}variance(e,t={}){if(typeof e=="object"&&(t=e,e=void 0),typeof t!="object")throw new TypeError("options must be an object");const{unbiased:n=!0,mean:i=this.mean(e)}=t;if(typeof n!="boolean")throw new TypeError("unbiased must be a boolean");switch(e){case"row":{if(!Array.isArray(i))throw new TypeError("mean must be an array");return lre(this,n,i)}case"column":{if(!Array.isArray(i))throw new TypeError("mean must be an array");return cre(this,n,i)}case void 0:{if(typeof i!="number")throw new TypeError("mean must be a number");return fre(this,n,i)}default:throw new Error(`invalid option: ${e}`)}}standardDeviation(e,t){typeof e=="object"&&(t=e,e=void 0);const n=this.variance(e,t);if(e===void 0)return Math.sqrt(n);for(let i=0;i<n.length;i++)n[i]=Math.sqrt(n[i]);return n}center(e,t={}){if(typeof e=="object"&&(t=e,e=void 0),typeof t!="object")throw new TypeError("options must be an object");const{center:n=this.mean(e)}=t;switch(e){case"row":{if(!Array.isArray(n))throw new TypeError("center must be an array");return hre(this,n),this}case"column":{if(!Array.isArray(n))throw new TypeError("center must be an array");return dre(this,n),this}case void 0:{if(typeof n!="number")throw new TypeError("center must be a number");return vre(this,n),this}default:throw new Error(`invalid option: ${e}`)}}scale(e,t={}){if(typeof e=="object"&&(t=e,e=void 0),typeof t!="object")throw new TypeError("options must be an object");let n=t.scale;switch(e){case"row":{if(n===void 0)n=pre(this);else if(!Array.isArray(n))throw new TypeError("scale must be an array");return gre(this,n),this}case"column":{if(n===void 0)n=yre(this);else if(!Array.isArray(n))throw new TypeError("scale must be an array");return mre(this,n),this}case void 0:{if(n===void 0)n=bre(this);else if(typeof n!="number")throw new TypeError("scale must be a number");return wre(this,n),this}default:throw new Error(`invalid option: ${e}`)}}toString(e){return GD(this,e)}}Mr.prototype.klass="Matrix";typeof Symbol!="undefined"&&(Mr.prototype[Symbol.for("nodejs.util.inspect.custom")]=Kte);function $D(r,e){return r-e}Mr.random=Mr.rand;Mr.randomInt=Mr.randInt;Mr.diagonal=Mr.diag;Mr.prototype.diagonal=Mr.prototype.diag;Mr.identity=Mr.eye;Mr.prototype.negate=Mr.prototype.neg;Mr.prototype.tensorProduct=Mr.prototype.kroneckerProduct;class Xt extends Mr{constructor(e,t){super();if(Xt.isMatrix(e))return e.clone();if(Number.isInteger(e)&&e>=0)if(this.data=[],Number.isInteger(t)&&t>=0)for(let n=0;n<e;n++)this.data.push(new Float64Array(t));else throw new TypeError("nColumns must be a positive integer");else if(Array.isArray(e)){const n=e;if(e=n.length,t=e?n[0].length:0,typeof t!="number")throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let i=0;i<e;i++){if(n[i].length!==t)throw new RangeError("Inconsistent array dimensions");this.data.push(Float64Array.from(n[i]))}}else throw new TypeError("First argument must be a positive number or an array");this.rows=e,this.columns=t}set(e,t,n){return this.data[e][t]=n,this}get(e,t){return this.data[e][t]}removeRow(e){return $a(this,e),this.data.splice(e,1),this.rows-=1,this}addRow(e,t){return t===void 0&&(t=e,e=this.rows),$a(this,e,!0),t=Float64Array.from(bc(this,t)),this.data.splice(e,0,t),this.rows+=1,this}removeColumn(e){Va(this,e);for(let t=0;t<this.rows;t++){const n=new Float64Array(this.columns-1);for(let i=0;i<e;i++)n[i]=this.data[t][i];for(let i=e+1;i<this.columns;i++)n[i-1]=this.data[t][i];this.data[t]=n}return this.columns-=1,this}addColumn(e,t){typeof t=="undefined"&&(t=e,e=this.columns),Va(this,e,!0),t=wc(this,t);for(let n=0;n<this.rows;n++){const i=new Float64Array(this.columns+1);let a=0;for(;a<e;a++)i[a]=this.data[n][a];for(i[a++]=t[n];a<this.columns+1;a++)i[a]=this.data[n][a-1];this.data[n]=i}return this.columns+=1,this}}Jte(Mr,Xt);class xre extends Mr{constructor(e){super();this.data=e,this.rows=e.length,this.columns=e[0].length}set(e,t,n){return this.data[e][t]=n,this}get(e,t){return this.data[e][t]}}function _c(r,e){let t=0;return Math.abs(r)>Math.abs(e)?(t=e/r,Math.abs(r)*Math.sqrt(1+t*t)):e!==0?(t=r/e,Math.abs(e)*Math.sqrt(1+t*t)):0}class VD{constructor(e,t={}){if(e=xre.checkMatrix(e),e.isEmpty())throw new Error("Matrix must be non-empty");let n=e.rows,i=e.columns;const{computeLeftSingularVectors:a=!0,computeRightSingularVectors:o=!0,autoTranspose:s=!1}=t;let u=Boolean(a),l=Boolean(o),c=!1,f;if(n<i)if(!s)f=e.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else{f=e.transpose(),n=f.rows,i=f.columns,c=!0;let S=u;u=l,l=S}else f=e.clone();let d=Math.min(n,i),h=Math.min(n+1,i),v=new Float64Array(h),p=new Xt(n,d),g=new Xt(i,i),y=new Float64Array(i),m=new Float64Array(n),b=new Float64Array(h);for(let S=0;S<h;S++)b[S]=S;let w=Math.min(n-1,i),x=Math.max(0,Math.min(i-2,n)),_=Math.max(w,x);for(let S=0;S<_;S++){if(S<w){v[S]=0;for(let C=S;C<n;C++)v[S]=_c(v[S],f.get(C,S));if(v[S]!==0){f.get(S,S)<0&&(v[S]=-v[S]);for(let C=S;C<n;C++)f.set(C,S,f.get(C,S)/v[S]);f.set(S,S,f.get(S,S)+1)}v[S]=-v[S]}for(let C=S+1;C<i;C++){if(S<w&&v[S]!==0){let T=0;for(let k=S;k<n;k++)T+=f.get(k,S)*f.get(k,C);T=-T/f.get(S,S);for(let k=S;k<n;k++)f.set(k,C,f.get(k,C)+T*f.get(k,S))}y[C]=f.get(S,C)}if(u&&S<w)for(let C=S;C<n;C++)p.set(C,S,f.get(C,S));if(S<x){y[S]=0;for(let C=S+1;C<i;C++)y[S]=_c(y[S],y[C]);if(y[S]!==0){y[S+1]<0&&(y[S]=0-y[S]);for(let C=S+1;C<i;C++)y[C]/=y[S];y[S+1]+=1}if(y[S]=-y[S],S+1<n&&y[S]!==0){for(let C=S+1;C<n;C++)m[C]=0;for(let C=S+1;C<n;C++)for(let T=S+1;T<i;T++)m[C]+=y[T]*f.get(C,T);for(let C=S+1;C<i;C++){let T=-y[C]/y[S+1];for(let k=S+1;k<n;k++)f.set(k,C,f.get(k,C)+T*m[k])}}if(l)for(let C=S+1;C<i;C++)g.set(C,S,y[C])}}let A=Math.min(i,n+1);if(w<i&&(v[w]=f.get(w,w)),n<A&&(v[A-1]=0),x+1<A&&(y[x]=f.get(x,A-1)),y[A-1]=0,u){for(let S=w;S<d;S++){for(let C=0;C<n;C++)p.set(C,S,0);p.set(S,S,1)}for(let S=w-1;S>=0;S--)if(v[S]!==0){for(let C=S+1;C<d;C++){let T=0;for(let k=S;k<n;k++)T+=p.get(k,S)*p.get(k,C);T=-T/p.get(S,S);for(let k=S;k<n;k++)p.set(k,C,p.get(k,C)+T*p.get(k,S))}for(let C=S;C<n;C++)p.set(C,S,-p.get(C,S));p.set(S,S,1+p.get(S,S));for(let C=0;C<S-1;C++)p.set(C,S,0)}else{for(let C=0;C<n;C++)p.set(C,S,0);p.set(S,S,1)}}if(l)for(let S=i-1;S>=0;S--){if(S<x&&y[S]!==0)for(let C=S+1;C<i;C++){let T=0;for(let k=S+1;k<i;k++)T+=g.get(k,S)*g.get(k,C);T=-T/g.get(S+1,S);for(let k=S+1;k<i;k++)g.set(k,C,g.get(k,C)+T*g.get(k,S))}for(let C=0;C<i;C++)g.set(C,S,0);g.set(S,S,1)}let I=A-1,M=Number.EPSILON;for(;A>0;){let S,C;for(S=A-2;S>=-1&&S!==-1;S--){const T=Number.MIN_VALUE+M*Math.abs(v[S]+Math.abs(v[S+1]));if(Math.abs(y[S])<=T||Number.isNaN(y[S])){y[S]=0;break}}if(S===A-2)C=4;else{let T;for(T=A-1;T>=S&&T!==S;T--){let k=(T!==A?Math.abs(y[T]):0)+(T!==S+1?Math.abs(y[T-1]):0);if(Math.abs(v[T])<=M*k){v[T]=0;break}}T===S?C=3:T===A-1?C=1:(C=2,S=T)}switch(S++,C){case 1:{let T=y[A-2];y[A-2]=0;for(let k=A-2;k>=S;k--){let L=_c(v[k],T),B=v[k]/L,ee=T/L;if(v[k]=L,k!==S&&(T=-ee*y[k-1],y[k-1]=B*y[k-1]),l)for(let K=0;K<i;K++)L=B*g.get(K,k)+ee*g.get(K,A-1),g.set(K,A-1,-ee*g.get(K,k)+B*g.get(K,A-1)),g.set(K,k,L)}break}case 2:{let T=y[S-1];y[S-1]=0;for(let k=S;k<A;k++){let L=_c(v[k],T),B=v[k]/L,ee=T/L;if(v[k]=L,T=-ee*y[k],y[k]=B*y[k],u)for(let K=0;K<n;K++)L=B*p.get(K,k)+ee*p.get(K,S-1),p.set(K,S-1,-ee*p.get(K,k)+B*p.get(K,S-1)),p.set(K,k,L)}break}case 3:{const T=Math.max(Math.abs(v[A-1]),Math.abs(v[A-2]),Math.abs(y[A-2]),Math.abs(v[S]),Math.abs(y[S])),k=v[A-1]/T,L=v[A-2]/T,B=y[A-2]/T,ee=v[S]/T,K=y[S]/T,z=((L+k)*(L-k)+B*B)/2,X=k*B*(k*B);let H=0;(z!==0||X!==0)&&(z<0?H=0-Math.sqrt(z*z+X):H=Math.sqrt(z*z+X),H=X/(z+H));let J=(ee+k)*(ee-k)+H,ne=ee*K;for(let me=S;me<A-1;me++){let oe=_c(J,ne);oe===0&&(oe=Number.MIN_VALUE);let Ae=J/oe,ze=ne/oe;if(me!==S&&(y[me-1]=oe),J=Ae*v[me]+ze*y[me],y[me]=Ae*y[me]-ze*v[me],ne=ze*v[me+1],v[me+1]=Ae*v[me+1],l)for(let qe=0;qe<i;qe++)oe=Ae*g.get(qe,me)+ze*g.get(qe,me+1),g.set(qe,me+1,-ze*g.get(qe,me)+Ae*g.get(qe,me+1)),g.set(qe,me,oe);if(oe=_c(J,ne),oe===0&&(oe=Number.MIN_VALUE),Ae=J/oe,ze=ne/oe,v[me]=oe,J=Ae*y[me]+ze*v[me+1],v[me+1]=-ze*y[me]+Ae*v[me+1],ne=ze*y[me+1],y[me+1]=Ae*y[me+1],u&&me<n-1)for(let qe=0;qe<n;qe++)oe=Ae*p.get(qe,me)+ze*p.get(qe,me+1),p.set(qe,me+1,-ze*p.get(qe,me)+Ae*p.get(qe,me+1)),p.set(qe,me,oe)}y[A-2]=J;break}case 4:{if(v[S]<=0&&(v[S]=v[S]<0?-v[S]:0,l))for(let T=0;T<=I;T++)g.set(T,S,-g.get(T,S));for(;S<I&&!(v[S]>=v[S+1]);){let T=v[S];if(v[S]=v[S+1],v[S+1]=T,l&&S<i-1)for(let k=0;k<i;k++)T=g.get(k,S+1),g.set(k,S+1,g.get(k,S)),g.set(k,S,T);if(u&&S<n-1)for(let k=0;k<n;k++)T=p.get(k,S+1),p.set(k,S+1,p.get(k,S)),p.set(k,S,T);S++}A--;break}}}if(c){let S=g;g=p,p=S}this.m=n,this.n=i,this.s=v,this.U=p,this.V=g}solve(e){let t=e,n=this.threshold,i=this.s.length,a=Xt.zeros(i,i);for(let d=0;d<i;d++)Math.abs(this.s[d])<=n?a.set(d,d,0):a.set(d,d,1/this.s[d]);let o=this.U,s=this.rightSingularVectors,u=s.mmul(a),l=s.rows,c=o.rows,f=Xt.zeros(l,c);for(let d=0;d<l;d++)for(let h=0;h<c;h++){let v=0;for(let p=0;p<i;p++)v+=u.get(d,p)*o.get(h,p);f.set(d,h,v)}return f.mmul(t)}solveForDiagonal(e){return this.solve(Xt.diag(e))}inverse(){let e=this.V,t=this.threshold,n=e.rows,i=e.columns,a=new Xt(n,this.s.length);for(let c=0;c<n;c++)for(let f=0;f<i;f++)Math.abs(this.s[f])>t&&a.set(c,f,e.get(c,f)/this.s[f]);let o=this.U,s=o.rows,u=o.columns,l=new Xt(n,s);for(let c=0;c<n;c++)for(let f=0;f<s;f++){let d=0;for(let h=0;h<u;h++)d+=a.get(c,h)*o.get(f,h);l.set(c,f,d)}return l}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let e=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,t=0,n=this.s;for(let i=0,a=n.length;i<a;i++)n[i]>e&&t++;return t}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return Xt.diag(this.s)}}class _re{constructor(e){this.distances=e.distances,this.dimension=e.dimension||2,this.linkDistance=e.linkDistance}layout(){const e=this,{dimension:t,distances:n,linkDistance:i}=e;try{const a=Xt.mul(Xt.pow(n,2),-.5),o=a.mean("row"),s=a.mean("column"),u=a.mean();a.add(u).subRowVector(o).subColumnVector(s);const l=new VD(a),c=Xt.sqrt(l.diagonalMatrix).diagonal();return l.leftSingularVectors.toJSON().map(f=>Xt.mul([f],[c]).toJSON()[0].splice(0,t))}catch{const o=[];for(let s=0;s<n.length;s++){const u=Math.random()*i,l=Math.random()*i;o.push([u,l])}return o}}}const Sre=800;class Ere{constructor(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}layout(){const e=this,t=e.positions,n=[],i=e.iterations,a=e.width/10;e.maxDisplace=a,e.disp=n;for(let o=0;o<i;o++)t.forEach((s,u)=>{n[u]={x:0,y:0}}),e.getRepulsion(),e.updatePositions();return t}getRepulsion(){const e=this,t=e.positions,n=e.nodes,i=e.disp,a=e.k,o=e.radii||[];t.forEach((s,u)=>{i[u]={x:0,y:0},t.forEach((l,c)=>{if(u===c||o[u]!==o[c])return;let f=s[0]-l[0],d=s[1]-l[1],h=Math.sqrt(f*f+d*d);if(h===0){h=1;const v=u>c?1:-1;f=.01*v,d=.01*v}if(h<e.nodeSizeFunc(n[u])/2+e.nodeSizeFunc(n[c])/2){const v=a*a/h;i[u].x+=f/h*v,i[u].y+=d/h*v}})})}updatePositions(){const e=this,t=e.positions,n=e.disp,i=e.speed,a=e.strictRadial,o=e.focusID,s=e.maxDisplace||e.width/10;a&&n.forEach((l,c)=>{const f=t[c][0]-t[o][0],d=t[c][1]-t[o][1],h=Math.sqrt(f*f+d*d);let v=d/h,p=-f/h;const g=Math.sqrt(l.x*l.x+l.y*l.y);let y=Math.acos((v*l.x+p*l.y)/g);y>Math.PI/2&&(y-=Math.PI/2,v*=-1,p*=-1);const m=Math.cos(y)*g;l.x=v*m,l.y=p*m});const u=e.radii;t.forEach((l,c)=>{if(c===o)return;const f=Math.sqrt(n[c].x*n[c].x+n[c].y*n[c].y);if(f>0&&c!==o){const d=Math.min(s*(i/Sre),f);if(l[0]+=n[c].x/f*d,l[1]+=n[c].y/f*d,a){let h=l[0]-t[o][0],v=l[1]-t[o][1];const p=Math.sqrt(h*h+v*v);h=h/p*u[c],v=v/p*u[c],l[0]=t[o][0]+h,l[1]=t[o][1]+v}}})}}function Are(r){const e=r.length,t=r[0].length,n=[];for(let i=0;i<e;i++){const a=[];for(let o=0;o<t;o++)r[i][o]!==0?a.push(1/(r[i][o]*r[i][o])):a.push(0);n.push(a)}return n}function Tre(r,e){let t=-1;return r.forEach((n,i)=>{n.id===e&&(t=i)}),t}function jD(r,e){return Math.sqrt((r[0]-e[0])*(r[0]-e[0])+(r[1]-e[1])*(r[1]-e[1]))}class Ire extends Ci{constructor(e){super();this.maxIteration=1e3,this.focusNode=null,this.unitRadius=null,this.linkDistance=50,this.preventOverlap=!1,this.strictRadial=!0,this.maxPreventOverlapIteration=200,this.sortStrength=10,this.nodes=[],this.edges=[],this.updateCfg(e)}getDefaultCfg(){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}}execute(){const e=this,t=e.nodes,n=e.edges||[];if(!t||t.length===0){e.onLayoutEnd&&e.onLayoutEnd();return}!e.width&&typeof window!="undefined"&&(e.width=window.innerWidth),!e.height&&typeof window!="undefined"&&(e.height=window.innerHeight),e.center||(e.center=[e.width/2,e.height/2]);const i=e.center;if(t.length===1){t[0].x=i[0],t[0].y=i[1],e.onLayoutEnd&&e.onLayoutEnd();return}const a=e.linkDistance;let o=null;if(Nh(e.focusNode)){let C=!1;for(let T=0;T<t.length;T++)t[T].id===e.focusNode&&(o=t[T],e.focusNode=o,C=!0,T=t.length);C||(o=null)}else o=e.focusNode;o||(o=t[0],e.focusNode=o);const s=Tre(t,o.id);e.focusIndex=s;const u=Vk({nodes:t,edges:n},!1),l=$k(u),c=e.maxToFocus(l,s);e.handleInfinity(l,s,c+1),e.distances=l;const f=l[s],d=e.width||500,h=e.height||500;let v=d-i[0]>i[0]?i[0]:d-i[0],p=h-i[1]>i[1]?i[1]:h-i[1];v===0&&(v=d/2),p===0&&(p=h/2);const g=p>v?v:p,y=Math.max(...f),m=[];f.forEach((C,T)=>{e.unitRadius||(e.unitRadius=g/y),m[T]=C*e.unitRadius}),e.radii=m;const b=e.eIdealDisMatrix();e.eIdealDistances=b;const w=Are(b);e.weights=w;let _=new _re({linkDistance:a,distances:b}).layout();_.forEach(C=>{dw(C[0])&&(C[0]=Math.random()*a),dw(C[1])&&(C[1]=Math.random()*a)}),e.positions=_,_.forEach((C,T)=>{t[T].x=C[0]+i[0],t[T].y=C[1]+i[1]}),_.forEach(C=>{C[0]-=_[s][0],C[1]-=_[s][1]}),e.run();const A=e.preventOverlap,I=e.nodeSize;let M;const S=e.strictRadial;if(A){const C=e.nodeSpacing;let T;gt(C)?T=()=>C:Rs(C)?T=C:T=()=>0,I?fi(I)?M=B=>(I[0]>I[1]?I[0]:I[1])+T(B):M=B=>I+T(B):M=B=>B.size?fi(B.size)?(B.size[0]>B.size[1]?B.size[0]:B.size[1])+T(B):vo(B.size)?(B.size.width>B.size.height?B.size.width:B.size.height)+T(B):B.size+T(B):10+T(B);const k={nodes:t,nodeSizeFunc:M,adjMatrix:u,positions:_,radii:m,height:h,width:d,strictRadial:S,focusID:s,iterations:e.maxPreventOverlapIteration||200,k:_.length/4.5};_=new Ere(k).layout()}return _.forEach((C,T)=>{t[T].x=C[0]+i[0],t[T].y=C[1]+i[1]}),e.onLayoutEnd&&e.onLayoutEnd(),{nodes:t,edges:n}}run(){const e=this,t=e.maxIteration,n=e.positions||[],i=e.weights||[],a=e.eIdealDistances||[],o=e.radii||[];for(let s=0;s<=t;s++){const u=s/t;e.oneIteration(u,n,o,a,i)}}oneIteration(e,t,n,i,a){const o=this,s=1-e,u=o.focusIndex;t.forEach((l,c)=>{const f=jD(l,[0,0]),d=f===0?0:1/f;if(c===u)return;let h=0,v=0,p=0;t.forEach((y,m)=>{if(c===m)return;const b=jD(l,y),w=b===0?0:1/b,x=i[m][c];p+=a[c][m],h+=a[c][m]*(y[0]+x*(l[0]-y[0])*w),v+=a[c][m]*(y[1]+x*(l[1]-y[1])*w)});const g=n[c]===0?0:1/n[c];p*=s,p+=e*g*g,h*=s,h+=e*g*l[0]*d,l[0]=h/p,v*=s,v+=e*g*l[1]*d,l[1]=v/p})}eIdealDisMatrix(){const e=this,t=e.nodes;if(!t)return[];const n=e.distances,i=e.linkDistance,a=e.radii||[],o=e.unitRadius||50,s=[];return n&&n.forEach((u,l)=>{const c=[];u.forEach((f,d)=>{if(l===d)c.push(0);else if(a[l]===a[d])if(e.sortBy==="data")c.push(f*(Math.abs(l-d)*e.sortStrength)/(a[l]/o));else if(e.sortBy){let h=t[l][e.sortBy]||0,v=t[d][e.sortBy]||0;Nh(h)&&(h=h.charCodeAt(0)),Nh(v)&&(v=v.charCodeAt(0)),c.push(f*(Math.abs(h-v)*e.sortStrength)/(a[l]/o))}else c.push(f*i/(a[l]/o));else{const h=(i+o)/2;c.push(f*h)}}),s.push(c)}),s}handleInfinity(e,t,n){const i=e.length;for(let a=0;a<i;a++)if(e[t][a]===1/0){e[t][a]=n,e[a][t]=n;for(let o=0;o<i;o++)e[a][o]!==1/0&&e[t][o]===1/0&&(e[t][o]=n+e[a][o],e[o][t]=n+e[a][o])}for(let a=0;a<i;a++)if(a!==t){for(let o=0;o<i;o++)if(e[a][o]===1/0){let s=Math.abs(e[t][a]-e[t][o]);s=s===0?1:s,e[a][o]=s}}}maxToFocus(e,t){let n=0;for(let i=0;i<e[t].length;i++)e[t][i]!==1/0&&(n=e[t][i]>n?e[t][i]:n);return n}getType(){return"radial"}}class Cre extends Ci{constructor(e){super();this.nodeSize=30,this.minNodeSpacing=10,this.preventOverlap=!1,this.equidistant=!1,this.startAngle=3/2*Math.PI,this.clockwise=!0,this.sortBy="degree",this.nodes=[],this.edges=[],this.width=300,this.height=300,this.onLayoutEnd=()=>{},this.updateCfg(e)}getDefaultCfg(){return{nodeSize:30,minNodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:3/2*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"}}execute(){const e=this,t=e.nodes,n=e.edges,i=t.length;if(i===0){e.onLayoutEnd&&e.onLayoutEnd();return}!e.width&&typeof window!="undefined"&&(e.width=window.innerWidth),!e.height&&typeof window!="undefined"&&(e.height=window.innerHeight),e.center||(e.center=[e.width/2,e.height/2]);const a=e.center;if(i===1){t[0].x=a[0],t[0].y=a[1],e.onLayoutEnd&&e.onLayoutEnd();return}const o=[];let s;fi(e.nodeSize)?s=Math.max(e.nodeSize[0],e.nodeSize[1]):s=e.nodeSize,t.forEach(v=>{o.push(v);let p=s;fi(v.size)?p=Math.max(v.size[0],v.size[1]):gt(v.size)?p=v.size:vo(v.size)&&(p=Math.max(v.size.width,v.size.height)),s=Math.max(s,p)}),e.clockwise=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise;const u={},l={};if(o.forEach((v,p)=>{u[v.id]=v,l[v.id]=p}),(e.sortBy==="degree"||!Nh(e.sortBy)||o[0][e.sortBy]===void 0)&&(e.sortBy="degree",!gt(t[0].degree))){const v=Oh(t.length,l,n);o.forEach((p,g)=>{p.degree=v[g]})}o.sort((v,p)=>p[e.sortBy]-v[e.sortBy]),e.maxValueNode=o[0],e.maxLevelDiff=e.maxLevelDiff||e.maxValueNode[e.sortBy]/4;const c=[[]];let f=c[0];o.forEach(v=>{if(f.length>0){const p=Math.abs(f[0][e.sortBy]-v[e.sortBy]);e.maxLevelDiff&&p>=e.maxLevelDiff&&(f=[],c.push(f))}f.push(v)});let d=s+e.minNodeSpacing;if(!e.preventOverlap){const v=c.length>0&&c[0].length>1,g=(Math.min(e.width,e.height)/2-d)/(c.length+(v?1:0));d=Math.min(d,g)}let h=0;if(c.forEach(v=>{let p=e.sweep;p===void 0&&(p=2*Math.PI-2*Math.PI/v.length);const g=v.dTheta=p/Math.max(1,v.length-1);if(v.length>1&&e.preventOverlap){const y=Math.cos(g)-Math.cos(0),m=Math.sin(g)-Math.sin(0),b=Math.sqrt(d*d/(y*y+m*m));h=Math.max(b,h)}v.r=h,h+=d}),e.equidistant){let v=0,p=0;for(let g=0;g<c.length;g++){const m=c[g].r-p;v=Math.max(v,m)}p=0,c.forEach((g,y)=>{y===0&&(p=g.r),g.r=p,p+=v})}return c.forEach(v=>{const p=v.dTheta,g=v.r;v.forEach((y,m)=>{const b=e.startAngle+(e.clockwise?1:-1)*p*m;y.x=a[0]+g*Math.cos(b),y.y=a[1]+g*Math.sin(b)})}),e.onLayoutEnd&&e.onLayoutEnd(),{nodes:t,edges:n}}getType(){return"concentric"}}class Mre extends Ci{constructor(e){super();this.center=[0,0],this.linkDistance=50,this.nodes=[],this.edges=[],this.onLayoutEnd=()=>{},this.updateCfg(e)}getDefaultCfg(){return{center:[0,0],linkDistance:50}}execute(){const e=this,{nodes:t,edges:n=[]}=e,i=e.center;if(!t||t.length===0){e.onLayoutEnd&&e.onLayoutEnd();return}if(t.length===1){t[0].x=i[0],t[0].y=i[1],e.onLayoutEnd&&e.onLayoutEnd();return}const a=e.linkDistance,o=Vk({nodes:t,edges:n},!1),s=$k(o);e.handleInfinity(s);const u=iQ(s,a);e.scaledDistances=u;const l=e.runMDS();return e.positions=l,l.forEach((c,f)=>{t[f].x=c[0]+i[0],t[f].y=c[1]+i[1]}),e.onLayoutEnd&&e.onLayoutEnd(),{nodes:t,edges:n}}runMDS(){const e=this,t=2,n=e.scaledDistances,i=Xt.mul(Xt.pow(n,2),-.5),a=i.mean("row"),o=i.mean("column"),s=i.mean();i.add(s).subRowVector(a).subColumnVector(o);const u=new VD(i),l=Xt.sqrt(u.diagonalMatrix).diagonal();return u.leftSingularVectors.toJSON().map(c=>Xt.mul([c],[l]).toJSON()[0].splice(0,t))}handleInfinity(e){let t=-999999;e.forEach(n=>{n.forEach(i=>{i!==1/0&&t<i&&(t=i)})}),e.forEach((n,i)=>{n.forEach((a,o)=>{a===1/0&&(e[i][o]=t)})})}getType(){return"mds"}}const kre=800;class Dre extends Ci{constructor(e){super();this.maxIteration=1e3,this.gravity=10,this.speed=5,this.clustering=!1,this.clusterGravity=10,this.nodes=[],this.edges=[],this.width=300,this.height=300,this.nodeMap={},this.nodeIdxMap={},this.onLayoutEnd=()=>{},this.tick=()=>{},this.updateCfg(e)}getDefaultCfg(){return{maxIteration:1e3,gravity:10,speed:1,clustering:!1,clusterGravity:10}}execute(){const e=this,t=e.nodes;if(e.timeInterval!==void 0&&typeof window!="undefined"&&window.clearInterval(e.timeInterval),!t||t.length===0){e.onLayoutEnd&&e.onLayoutEnd();return}!e.width&&typeof window!="undefined"&&(e.width=window.innerWidth),!e.height&&typeof window!="undefined"&&(e.height=window.innerHeight),e.center||(e.center=[e.width/2,e.height/2]);const n=e.center;if(t.length===1){t[0].x=n[0],t[0].y=n[1],e.onLayoutEnd&&e.onLayoutEnd();return}const i={},a={};return t.forEach((o,s)=>{gt(o.x)||(o.x=Math.random()*this.width),gt(o.y)||(o.y=Math.random()*this.height),i[o.id]=o,a[o.id]=s}),e.nodeMap=i,e.nodeIdxMap=a,e.run()}run(){const e=this,t=e.nodes;if(!t)return;const n=e.edges,i=e.maxIteration,a=e.center,o=e.height*e.width,s=Math.sqrt(o)/10,u=o/(t.length+1),l=Math.sqrt(u),c=e.gravity,f=e.speed,d=e.clustering,h={};if(d){t.forEach(p=>{if(h[p.cluster]===void 0){const y={name:p.cluster,cx:0,cy:0,count:0};h[p.cluster]=y}const g=h[p.cluster];gt(p.x)&&(g.cx+=p.x),gt(p.y)&&(g.cy+=p.y),g.count++});for(const p in h)h[p].cx/=h[p].count,h[p].cy/=h[p].count}if(typeof window=="undefined")return;let v=0;return this.timeInterval=window.setInterval(()=>{if(!t)return;const p=[];if(t.forEach((g,y)=>{p[y]={x:0,y:0}}),e.applyCalculate(t,n,p,l,u),d){const g=e.clusterGravity||c;t.forEach((y,m)=>{if(!gt(y.x)||!gt(y.y))return;const b=h[y.cluster],w=Math.sqrt((y.x-b.cx)*(y.x-b.cx)+(y.y-b.cy)*(y.y-b.cy)),x=l*g;p[m].x-=x*(y.x-b.cx)/w,p[m].y-=x*(y.y-b.cy)/w});for(const y in h)h[y].cx=0,h[y].cy=0,h[y].count=0;t.forEach(y=>{const m=h[y.cluster];gt(y.x)&&(m.cx+=y.x),gt(y.y)&&(m.cy+=y.y),m.count++});for(const y in h)h[y].cx/=h[y].count,h[y].cy/=h[y].count}t.forEach((g,y)=>{if(!gt(g.x)||!gt(g.y))return;const m=.01*l*c;p[y].x-=m*(g.x-a[0]),p[y].y-=m*(g.y-a[1])}),t.forEach((g,y)=>{if(gt(g.fx)&&gt(g.fy)){g.x=g.fx,g.y=g.fy;return}if(!gt(g.x)||!gt(g.y))return;const m=Math.sqrt(p[y].x*p[y].x+p[y].y*p[y].y);if(m>0){const b=Math.min(s*(f/kre),m);g.x+=p[y].x/m*b,g.y+=p[y].y/m*b}}),e.tick&&e.tick(),v++,v>=i&&(e.onLayoutEnd&&e.onLayoutEnd(),window.clearInterval(e.timeInterval))},0),{nodes:t,edges:n}}applyCalculate(e,t,n,i,a){const o=this;o.calRepulsive(e,n,a),t&&o.calAttractive(t,n,i)}calRepulsive(e,t,n){e.forEach((i,a)=>{t[a]={x:0,y:0},e.forEach((o,s)=>{if(a===s||!gt(i.x)||!gt(o.x)||!gt(i.y)||!gt(o.y))return;let u=i.x-o.x,l=i.y-o.y,c=u*u+l*l;if(c===0){c=1;const d=a>s?1:-1;u=.01*d,l=.01*d}const f=n/c;t[a].x+=u*f,t[a].y+=l*f})})}calAttractive(e,t,n){e.forEach(i=>{const a=Pr(i,"source"),o=Pr(i,"target");if(!a||!o)return;const s=this.nodeIdxMap[a],u=this.nodeIdxMap[o];if(s===u)return;const l=this.nodeMap[a],c=this.nodeMap[o];if(!gt(c.x)||!gt(l.x)||!gt(c.y)||!gt(l.y))return;const f=c.x-l.x,d=c.y-l.y,h=Math.sqrt(f*f+d*d),v=h*h/n;t[u].x-=f/h*v,t[u].y-=d/h*v,t[s].x+=f/h*v,t[s].y+=d/h*v})}stop(){this.timeInterval&&typeof window!="undefined"&&window.clearInterval(this.timeInterval)}destroy(){const e=this;e.stop(),e.tick=null,e.nodes=null,e.edges=null,e.destroyed=!0}getType(){return"fruchterman"}}function Pt(r,e,t,n){!t||Object.defineProperty(r,e,{enumerable:t.enumerable,configurable:t.configurable,writable:t.writable,value:t.initializer?t.initializer.call(n):void 0})}function Ct(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function WD(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function Gt(r,e,t){return e&&WD(r.prototype,e),t&&WD(r,t),r}function Rt(r,e,t,n,i){var a={};return Object.keys(n).forEach(function(o){a[o]=n[o]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=t.slice().reverse().reduce(function(o,s){return s(r,e,o)||o},a),i&&a.initializer!==void 0&&(a.value=a.initializer?a.initializer.call(i):void 0,a.initializer=void 0),a.initializer===void 0&&(Object.defineProperty(r,e,a),a=null),a}/*! *****************************************************************************
Copyright (C) Microsoft. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0

THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.

See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */var XD;(function(r){(function(e){var t=typeof sf=="object"?sf:typeof self=="object"?self:typeof this=="object"?this:Function("return this;")(),n=i(r);typeof t.Reflect=="undefined"?t.Reflect=r:n=i(t.Reflect,n),e(n);function i(a,o){return function(s,u){typeof a[s]!="function"&&Object.defineProperty(a,s,{configurable:!0,writable:!0,value:u}),o&&o(s,u)}}})(function(e){var t=Object.prototype.hasOwnProperty,n=typeof Symbol=="function",i=n&&typeof Symbol.toPrimitive!="undefined"?Symbol.toPrimitive:"@@toPrimitive",a=n&&typeof Symbol.iterator!="undefined"?Symbol.iterator:"@@iterator",o=typeof Object.create=="function",s={__proto__:[]}instanceof Array,u=!o&&!s,l={create:o?function(){return D(Object.create(null))}:s?function(){return D({__proto__:null})}:function(){return D({})},has:u?function(V,he){return t.call(V,he)}:function(V,he){return he in V},get:u?function(V,he){return t.call(V,he)?V[he]:void 0}:function(V,he){return V[he]}},c=Object.getPrototypeOf(Function),f=typeof process=="object"&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL==="true",d=!f&&typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:pt(),h=!f&&typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:ht(),v=!f&&typeof WeakMap=="function"?WeakMap:dt(),p=new v;function g(V,he,ye,Se){if(J(ye)){if(!st(V))throw new TypeError;if(!tr(he))throw new TypeError;return S(V,he)}else{if(!st(V))throw new TypeError;if(!oe(he))throw new TypeError;if(!oe(Se)&&!J(Se)&&!ne(Se))throw new TypeError;return ne(Se)&&(Se=void 0),ye=ct(ye),C(V,he,ye,Se)}}e("decorate",g);function y(V,he){function ye(Se,De){if(!oe(Se))throw new TypeError;if(!J(De)&&!$(De))throw new TypeError;K(V,he,Se,De)}return ye}e("metadata",y);function m(V,he,ye,Se){if(!oe(ye))throw new TypeError;return J(Se)||(Se=ct(Se)),K(V,he,ye,Se)}e("defineMetadata",m);function b(V,he,ye){if(!oe(he))throw new TypeError;return J(ye)||(ye=ct(ye)),k(V,he,ye)}e("hasMetadata",b);function w(V,he,ye){if(!oe(he))throw new TypeError;return J(ye)||(ye=ct(ye)),L(V,he,ye)}e("hasOwnMetadata",w);function x(V,he,ye){if(!oe(he))throw new TypeError;return J(ye)||(ye=ct(ye)),B(V,he,ye)}e("getMetadata",x);function _(V,he,ye){if(!oe(he))throw new TypeError;return J(ye)||(ye=ct(ye)),ee(V,he,ye)}e("getOwnMetadata",_);function A(V,he){if(!oe(V))throw new TypeError;return J(he)||(he=ct(he)),z(V,he)}e("getMetadataKeys",A);function I(V,he){if(!oe(V))throw new TypeError;return J(he)||(he=ct(he)),X(V,he)}e("getOwnMetadataKeys",I);function M(V,he,ye){if(!oe(he))throw new TypeError;J(ye)||(ye=ct(ye));var Se=T(he,ye,!1);if(J(Se)||!Se.delete(V))return!1;if(Se.size>0)return!0;var De=p.get(he);return De.delete(ye),De.size>0||p.delete(he),!0}e("deleteMetadata",M);function S(V,he){for(var ye=V.length-1;ye>=0;--ye){var Se=V[ye],De=Se(he);if(!J(De)&&!ne(De)){if(!tr(De))throw new TypeError;he=De}}return he}function C(V,he,ye,Se){for(var De=V.length-1;De>=0;--De){var At=V[De],ut=At(he,ye,Se);if(!J(ut)&&!ne(ut)){if(!oe(ut))throw new TypeError;Se=ut}}return Se}function T(V,he,ye){var Se=p.get(V);if(J(Se)){if(!ye)return;Se=new d,p.set(V,Se)}var De=Se.get(he);if(J(De)){if(!ye)return;De=new d,Se.set(he,De)}return De}function k(V,he,ye){var Se=L(V,he,ye);if(Se)return!0;var De=Ye(he);return ne(De)?!1:k(V,De,ye)}function L(V,he,ye){var Se=T(he,ye,!1);return J(Se)?!1:qe(Se.has(V))}function B(V,he,ye){var Se=L(V,he,ye);if(Se)return ee(V,he,ye);var De=Ye(he);if(!ne(De))return B(V,De,ye)}function ee(V,he,ye){var Se=T(he,ye,!1);if(!J(Se))return Se.get(V)}function K(V,he,ye,Se){var De=T(ye,Se,!0);De.set(V,he)}function z(V,he){var ye=X(V,he),Se=Ye(V);if(Se===null)return ye;var De=z(Se,he);if(De.length<=0)return ye;if(ye.length<=0)return De;for(var At=new h,ut=[],St=0,nt=ye;St<nt.length;St++){var Zt=nt[St],Dt=At.has(Zt);Dt||(At.add(Zt),ut.push(Zt))}for(var vr=0,Nr=De;vr<Nr.length;vr++){var Zt=Nr[vr],Dt=At.has(Zt);Dt||(At.add(Zt),ut.push(Zt))}return ut}function X(V,he){var ye=[],Se=T(V,he,!1);if(J(Se))return ye;for(var De=Se.keys(),At=W(De),ut=0;;){var St=yt(At);if(!St)return ye.length=ut,ye;var nt=Ze(St);try{ye[ut]=nt}catch(Zt){try{at(At)}finally{throw Zt}}ut++}}function H(V){if(V===null)return 1;switch(typeof V){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return V===null?1:6;default:return 6}}function J(V){return V===void 0}function ne(V){return V===null}function me(V){return typeof V=="symbol"}function oe(V){return typeof V=="object"?V!==null:typeof V=="function"}function Ae(V,he){switch(H(V)){case 0:return V;case 1:return V;case 2:return V;case 3:return V;case 4:return V;case 5:return V}var ye=he===3?"string":he===5?"number":"default",Se=se(V,i);if(Se!==void 0){var De=Se.call(V,ye);if(oe(De))throw new TypeError;return De}return ze(V,ye==="default"?"number":ye)}function ze(V,he){if(he==="string"){var ye=V.toString;if(gr(ye)){var Se=ye.call(V);if(!oe(Se))return Se}var De=V.valueOf;if(gr(De)){var Se=De.call(V);if(!oe(Se))return Se}}else{var De=V.valueOf;if(gr(De)){var Se=De.call(V);if(!oe(Se))return Se}var At=V.toString;if(gr(At)){var Se=At.call(V);if(!oe(Se))return Se}}throw new TypeError}function qe(V){return!!V}function ft(V){return""+V}function ct(V){var he=Ae(V,3);return me(he)?he:ft(he)}function st(V){return Array.isArray?Array.isArray(V):V instanceof Object?V instanceof Array:Object.prototype.toString.call(V)==="[object Array]"}function gr(V){return typeof V=="function"}function tr(V){return typeof V=="function"}function $(V){switch(H(V)){case 3:return!0;case 4:return!0;default:return!1}}function se(V,he){var ye=V[he];if(ye!=null){if(!gr(ye))throw new TypeError;return ye}}function W(V){var he=se(V,a);if(!gr(he))throw new TypeError;var ye=he.call(V);if(!oe(ye))throw new TypeError;return ye}function Ze(V){return V.value}function yt(V){var he=V.next();return he.done?!1:he}function at(V){var he=V.return;he&&he.call(V)}function Ye(V){var he=Object.getPrototypeOf(V);if(typeof V!="function"||V===c||he!==c)return he;var ye=V.prototype,Se=ye&&Object.getPrototypeOf(ye);if(Se==null||Se===Object.prototype)return he;var De=Se.constructor;return typeof De!="function"||De===V?he:De}function pt(){var V={},he=[],ye=function(){function ut(St,nt,Zt){this._index=0,this._keys=St,this._values=nt,this._selector=Zt}return ut.prototype["@@iterator"]=function(){return this},ut.prototype[a]=function(){return this},ut.prototype.next=function(){var St=this._index;if(St>=0&&St<this._keys.length){var nt=this._selector(this._keys[St],this._values[St]);return St+1>=this._keys.length?(this._index=-1,this._keys=he,this._values=he):this._index++,{value:nt,done:!1}}return{value:void 0,done:!0}},ut.prototype.throw=function(St){throw this._index>=0&&(this._index=-1,this._keys=he,this._values=he),St},ut.prototype.return=function(St){return this._index>=0&&(this._index=-1,this._keys=he,this._values=he),{value:St,done:!0}},ut}();return function(){function ut(){this._keys=[],this._values=[],this._cacheKey=V,this._cacheIndex=-2}return Object.defineProperty(ut.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),ut.prototype.has=function(St){return this._find(St,!1)>=0},ut.prototype.get=function(St){var nt=this._find(St,!1);return nt>=0?this._values[nt]:void 0},ut.prototype.set=function(St,nt){var Zt=this._find(St,!0);return this._values[Zt]=nt,this},ut.prototype.delete=function(St){var nt=this._find(St,!1);if(nt>=0){for(var Zt=this._keys.length,Dt=nt+1;Dt<Zt;Dt++)this._keys[Dt-1]=this._keys[Dt],this._values[Dt-1]=this._values[Dt];return this._keys.length--,this._values.length--,St===this._cacheKey&&(this._cacheKey=V,this._cacheIndex=-2),!0}return!1},ut.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=V,this._cacheIndex=-2},ut.prototype.keys=function(){return new ye(this._keys,this._values,Se)},ut.prototype.values=function(){return new ye(this._keys,this._values,De)},ut.prototype.entries=function(){return new ye(this._keys,this._values,At)},ut.prototype["@@iterator"]=function(){return this.entries()},ut.prototype[a]=function(){return this.entries()},ut.prototype._find=function(St,nt){return this._cacheKey!==St&&(this._cacheIndex=this._keys.indexOf(this._cacheKey=St)),this._cacheIndex<0&&nt&&(this._cacheIndex=this._keys.length,this._keys.push(St),this._values.push(void 0)),this._cacheIndex},ut}();function Se(ut,St){return ut}function De(ut,St){return St}function At(ut,St){return[ut,St]}}function ht(){return function(){function V(){this._map=new d}return Object.defineProperty(V.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),V.prototype.has=function(he){return this._map.has(he)},V.prototype.add=function(he){return this._map.set(he,he),this},V.prototype.delete=function(he){return this._map.delete(he)},V.prototype.clear=function(){this._map.clear()},V.prototype.keys=function(){return this._map.keys()},V.prototype.values=function(){return this._map.values()},V.prototype.entries=function(){return this._map.entries()},V.prototype["@@iterator"]=function(){return this.keys()},V.prototype[a]=function(){return this.keys()},V}()}function dt(){var V=16,he=l.create(),ye=Se();return function(){function nt(){this._key=Se()}return nt.prototype.has=function(Zt){var Dt=De(Zt,!1);return Dt!==void 0?l.has(Dt,this._key):!1},nt.prototype.get=function(Zt){var Dt=De(Zt,!1);return Dt!==void 0?l.get(Dt,this._key):void 0},nt.prototype.set=function(Zt,Dt){var vr=De(Zt,!0);return vr[this._key]=Dt,this},nt.prototype.delete=function(Zt){var Dt=De(Zt,!1);return Dt!==void 0?delete Dt[this._key]:!1},nt.prototype.clear=function(){this._key=Se()},nt}();function Se(){var nt;do nt="@@WeakMap@@"+St();while(l.has(he,nt));return he[nt]=!0,nt}function De(nt,Zt){if(!t.call(nt,ye)){if(!Zt)return;Object.defineProperty(nt,ye,{value:l.create()})}return nt[ye]}function At(nt,Zt){for(var Dt=0;Dt<Zt;++Dt)nt[Dt]=Math.random()*255|0;return nt}function ut(nt){return typeof Uint8Array=="function"?typeof crypto!="undefined"?crypto.getRandomValues(new Uint8Array(nt)):typeof msCrypto!="undefined"?msCrypto.getRandomValues(new Uint8Array(nt)):At(new Uint8Array(nt),nt):At(new Array(nt),nt)}function St(){var nt=ut(V);nt[6]=nt[6]&79|64,nt[8]=nt[8]&191|128;for(var Zt="",Dt=0;Dt<V;++Dt){var vr=nt[Dt];(Dt===4||Dt===6||Dt===8)&&(Zt+="-"),vr<16&&(Zt+="0"),Zt+=vr.toString(16).toLowerCase()}return Zt}}function D(V){return V.__=void 0,delete V.__,V}})})(XD||(XD={}));var YD={exports:{}};(function(r){var e=function(t){var n=Object.prototype,i=n.hasOwnProperty,a,o=typeof Symbol=="function"?Symbol:{},s=o.iterator||"@@iterator",u=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(z,X,H){return Object.defineProperty(z,X,{value:H,enumerable:!0,configurable:!0,writable:!0}),z[X]}try{c({},"")}catch{c=function(X,H,J){return X[H]=J}}function f(z,X,H,J){var ne=X&&X.prototype instanceof m?X:m,me=Object.create(ne.prototype),oe=new B(J||[]);return me._invoke=C(z,H,oe),me}t.wrap=f;function d(z,X,H){try{return{type:"normal",arg:z.call(X,H)}}catch(J){return{type:"throw",arg:J}}}var h="suspendedStart",v="suspendedYield",p="executing",g="completed",y={};function m(){}function b(){}function w(){}var x={};c(x,s,function(){return this});var _=Object.getPrototypeOf,A=_&&_(_(ee([])));A&&A!==n&&i.call(A,s)&&(x=A);var I=w.prototype=m.prototype=Object.create(x);b.prototype=w,c(I,"constructor",w),c(w,"constructor",b),b.displayName=c(w,l,"GeneratorFunction");function M(z){["next","throw","return"].forEach(function(X){c(z,X,function(H){return this._invoke(X,H)})})}t.isGeneratorFunction=function(z){var X=typeof z=="function"&&z.constructor;return X?X===b||(X.displayName||X.name)==="GeneratorFunction":!1},t.mark=function(z){return Object.setPrototypeOf?Object.setPrototypeOf(z,w):(z.__proto__=w,c(z,l,"GeneratorFunction")),z.prototype=Object.create(I),z},t.awrap=function(z){return{__await:z}};function S(z,X){function H(me,oe,Ae,ze){var qe=d(z[me],z,oe);if(qe.type==="throw")ze(qe.arg);else{var ft=qe.arg,ct=ft.value;return ct&&typeof ct=="object"&&i.call(ct,"__await")?X.resolve(ct.__await).then(function(st){H("next",st,Ae,ze)},function(st){H("throw",st,Ae,ze)}):X.resolve(ct).then(function(st){ft.value=st,Ae(ft)},function(st){return H("throw",st,Ae,ze)})}}var J;function ne(me,oe){function Ae(){return new X(function(ze,qe){H(me,oe,ze,qe)})}return J=J?J.then(Ae,Ae):Ae()}this._invoke=ne}M(S.prototype),c(S.prototype,u,function(){return this}),t.AsyncIterator=S,t.async=function(z,X,H,J,ne){ne===void 0&&(ne=Promise);var me=new S(f(z,X,H,J),ne);return t.isGeneratorFunction(X)?me:me.next().then(function(oe){return oe.done?oe.value:me.next()})};function C(z,X,H){var J=h;return function(me,oe){if(J===p)throw new Error("Generator is already running");if(J===g){if(me==="throw")throw oe;return K()}for(H.method=me,H.arg=oe;;){var Ae=H.delegate;if(Ae){var ze=T(Ae,H);if(ze){if(ze===y)continue;return ze}}if(H.method==="next")H.sent=H._sent=H.arg;else if(H.method==="throw"){if(J===h)throw J=g,H.arg;H.dispatchException(H.arg)}else H.method==="return"&&H.abrupt("return",H.arg);J=p;var qe=d(z,X,H);if(qe.type==="normal"){if(J=H.done?g:v,qe.arg===y)continue;return{value:qe.arg,done:H.done}}else qe.type==="throw"&&(J=g,H.method="throw",H.arg=qe.arg)}}}function T(z,X){var H=z.iterator[X.method];if(H===a){if(X.delegate=null,X.method==="throw"){if(z.iterator.return&&(X.method="return",X.arg=a,T(z,X),X.method==="throw"))return y;X.method="throw",X.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var J=d(H,z.iterator,X.arg);if(J.type==="throw")return X.method="throw",X.arg=J.arg,X.delegate=null,y;var ne=J.arg;if(!ne)return X.method="throw",X.arg=new TypeError("iterator result is not an object"),X.delegate=null,y;if(ne.done)X[z.resultName]=ne.value,X.next=z.nextLoc,X.method!=="return"&&(X.method="next",X.arg=a);else return ne;return X.delegate=null,y}M(I),c(I,l,"Generator"),c(I,s,function(){return this}),c(I,"toString",function(){return"[object Generator]"});function k(z){var X={tryLoc:z[0]};1 in z&&(X.catchLoc=z[1]),2 in z&&(X.finallyLoc=z[2],X.afterLoc=z[3]),this.tryEntries.push(X)}function L(z){var X=z.completion||{};X.type="normal",delete X.arg,z.completion=X}function B(z){this.tryEntries=[{tryLoc:"root"}],z.forEach(k,this),this.reset(!0)}t.keys=function(z){var X=[];for(var H in z)X.push(H);return X.reverse(),function J(){for(;X.length;){var ne=X.pop();if(ne in z)return J.value=ne,J.done=!1,J}return J.done=!0,J}};function ee(z){if(z){var X=z[s];if(X)return X.call(z);if(typeof z.next=="function")return z;if(!isNaN(z.length)){var H=-1,J=function ne(){for(;++H<z.length;)if(i.call(z,H))return ne.value=z[H],ne.done=!1,ne;return ne.value=a,ne.done=!0,ne};return J.next=J}}return{next:K}}t.values=ee;function K(){return{value:a,done:!0}}return B.prototype={constructor:B,reset:function(z){if(this.prev=0,this.next=0,this.sent=this._sent=a,this.done=!1,this.delegate=null,this.method="next",this.arg=a,this.tryEntries.forEach(L),!z)for(var X in this)X.charAt(0)==="t"&&i.call(this,X)&&!isNaN(+X.slice(1))&&(this[X]=a)},stop:function(){this.done=!0;var z=this.tryEntries[0],X=z.completion;if(X.type==="throw")throw X.arg;return this.rval},dispatchException:function(z){if(this.done)throw z;var X=this;function H(ze,qe){return me.type="throw",me.arg=z,X.next=ze,qe&&(X.method="next",X.arg=a),!!qe}for(var J=this.tryEntries.length-1;J>=0;--J){var ne=this.tryEntries[J],me=ne.completion;if(ne.tryLoc==="root")return H("end");if(ne.tryLoc<=this.prev){var oe=i.call(ne,"catchLoc"),Ae=i.call(ne,"finallyLoc");if(oe&&Ae){if(this.prev<ne.catchLoc)return H(ne.catchLoc,!0);if(this.prev<ne.finallyLoc)return H(ne.finallyLoc)}else if(oe){if(this.prev<ne.catchLoc)return H(ne.catchLoc,!0)}else if(Ae){if(this.prev<ne.finallyLoc)return H(ne.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(z,X){for(var H=this.tryEntries.length-1;H>=0;--H){var J=this.tryEntries[H];if(J.tryLoc<=this.prev&&i.call(J,"finallyLoc")&&this.prev<J.finallyLoc){var ne=J;break}}ne&&(z==="break"||z==="continue")&&ne.tryLoc<=X&&X<=ne.finallyLoc&&(ne=null);var me=ne?ne.completion:{};return me.type=z,me.arg=X,ne?(this.method="next",this.next=ne.finallyLoc,y):this.complete(me)},complete:function(z,X){if(z.type==="throw")throw z.arg;return z.type==="break"||z.type==="continue"?this.next=z.arg:z.type==="return"?(this.rval=this.arg=z.arg,this.method="return",this.next="end"):z.type==="normal"&&X&&(this.next=X),y},finish:function(z){for(var X=this.tryEntries.length-1;X>=0;--X){var H=this.tryEntries[X];if(H.finallyLoc===z)return this.complete(H.completion,H.afterLoc),L(H),y}},catch:function(z){for(var X=this.tryEntries.length-1;X>=0;--X){var H=this.tryEntries[X];if(H.tryLoc===z){var J=H.completion;if(J.type==="throw"){var ne=J.arg;L(H)}return ne}}throw new Error("illegal catch attempt")},delegateYield:function(z,X,H){return this.delegate={iterator:ee(z),resultName:X,nextLoc:H},this.method==="next"&&(this.arg=a),y}},t}(r.exports);try{regeneratorRuntime=e}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}})(YD);var _t=YD.exports;function HD(r,e,t,n,i,a,o){try{var s=r[a](o),u=s.value}catch(l){t(l);return}s.done?e(u):Promise.resolve(u).then(n,i)}function Rr(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(u){HD(a,n,i,o,s,"next",u)}function s(u){HD(a,n,i,o,s,"throw",u)}o(void 0)})}}var Lre=-1,Nre=1;function go(){return Nre++}var el=function r(e){Ct(this,r)},tl=function(){function r(e){Ct(this,r),this.clazz=void 0,this.components=[],this.entities=[],this.lookup={},this.clazz=e}return Gt(r,[{key:"clear",value:function(){this.components=[],this.entities=[],this.lookup={}}},{key:"contains",value:function(t){return this.lookup[t]>-1}},{key:"create",value:function(t,n){this.lookup[t]=this.components.length;var i=new this.clazz(n||{});return this.components.push(i),this.entities.push(t),i}},{key:"remove",value:function(t){var n=this.lookup[t];n>-1&&n<this.components.length-1&&(this.components[n]=this.components[this.components.length-1],this.entities[n]=this.entities[this.entities.length-1],this.lookup[this.entities[n]]=n),this.components.pop(),this.entities.pop(),delete this.lookup[t]}},{key:"removeKeepSorted",value:function(t){var n=this.lookup[t];if(n>-1){var i=this.entities[n];if(n<this.components.length-1){for(var a=n+1;a<this.components.length;++a)this.components[a-1]=this.components[a];for(var o=n+1;o<this.entities.length;++o)this.entities[o-1]=this.entities[o],this.lookup[this.entities[o-1]]=o-1}this.components.pop(),this.entities.pop(),delete this.lookup[i]}}},{key:"moveItem",value:function(t,n){if(t!==n){for(var i=this.components[t],a=this.entities[t],o=t<n?1:-1,s=t;s!==n;s+=o){var u=s+o;this.components[s]=this.components[u],this.entities[s]=this.entities[u],this.lookup[this.entities[s]]=s}this.components[n]=i,this.entities[n]=a,this.lookup[a]=n}}},{key:"getEntity",value:function(t){return this.entities[t]}},{key:"getComponent",value:function(t){return this.components[t]}},{key:"getComponentByEntity",value:function(t){var n=this.lookup[t];return n>-1?this.components[n]:null}},{key:"getCount",value:function(){return this.components.length}},{key:"getEntityByComponentIndex",value:function(t){for(var n=0,i=Object.keys(this.lookup);n<i.length;n++){var a=i[n],o=Number(a);if(this.lookup[o]===t)return o}return Lre}},{key:"find",value:function(t){for(var n=0;n<this.getCount();n++){var i=this.getComponent(n);if(t(i,n))return i}return null}},{key:"findIndex",value:function(t){for(var n=0;n<this.getCount();n++){var i=this.getComponent(n);if(t(i,n))return n}return-1}},{key:"forEach",value:function(t){for(var n=0,i=Object.keys(this.lookup);n<i.length;n++){var a=i[n],o=Number(a),s=this.lookup[o];t(o,this.getComponent(s))}}},{key:"forEachAsync",value:function(){var e=Rr(_t.mark(function n(i){var a,o,s,u,l;return _t.wrap(function(f){for(;;)switch(f.prev=f.next){case 0:a=0,o=Object.keys(this.lookup);case 1:if(!(a<o.length)){f.next=10;break}return s=o[a],u=Number(s),l=this.lookup[u],f.next=7,i(u,this.getComponent(l));case 7:a++,f.next=1;break;case 10:case"end":return f.stop()}},n,this)}));function t(n){return e.apply(this,arguments)}return t}()},{key:"map",value:function(t){for(var n=[],i=0,a=Object.keys(this.lookup);i<a.length;i++){var o=a[i],s=Number(o),u=this.lookup[s];n.push(t(s,this.getComponent(u)))}return n}}]),r}();function Ore(r){if(Array.isArray(r))return r}function Pre(r,e){var t=r==null?null:typeof Symbol!="undefined"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var n=[],i=!0,a=!1,o,s;try{for(t=t.call(r);!(i=(o=t.next()).done)&&(n.push(o.value),!(e&&n.length===e));i=!0);}catch(u){a=!0,s=u}finally{try{!i&&t.return!=null&&t.return()}finally{if(a)throw s}}return n}}function Lw(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function qD(r,e){if(!!r){if(typeof r=="string")return Lw(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Lw(r,e)}}function Rre(){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 Xg(r,e){return Ore(r)||Pre(r,e)||qD(r,e)||Rre()}var ja="named",KD="name",Nw="unmanaged",ZD="optional",Yg="inject",Uh="multi_inject",QD="inversify:tagged",JD="inversify:tagged_props",Ow="inversify:paramtypes",Bre="design:paramtypes",eL="post_construct";function Fre(){return[Yg,Uh,KD,Nw,ja,ZD]}var tL=Fre(),hi={Request:"Request",Singleton:"Singleton",Transient:"Transient"},di={ConstantValue:"ConstantValue",Constructor:"Constructor",DynamicValue:"DynamicValue",Factory:"Factory",Function:"Function",Instance:"Instance",Invalid:"Invalid",Provider:"Provider"},Zo={ClassProperty:"ClassProperty",ConstructorArgument:"ConstructorArgument",Variable:"Variable"},Ure=0;function Gh(){return Ure++}var Gre=function(){function r(e,t){this.id=Gh(),this.activated=!1,this.serviceIdentifier=e,this.scope=t,this.type=di.Invalid,this.constraint=function(n){return!0},this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.onActivation=null,this.dynamicValue=null}return r.prototype.clone=function(){var e=new r(this.serviceIdentifier,this.scope);return e.activated=e.scope===hi.Singleton?this.activated:!1,e.implementationType=this.implementationType,e.dynamicValue=this.dynamicValue,e.scope=this.scope,e.type=this.type,e.factory=this.factory,e.provider=this.provider,e.constraint=this.constraint,e.onActivation=this.onActivation,e.cache=this.cache,e},r}(),zre="Cannot apply @injectable decorator multiple times.",$re="Metadata key was used more than once in a parameter:",zh="NULL argument",rL="Key Not Found",Vre="Ambiguous match found for serviceIdentifier:",jre="Could not unbind serviceIdentifier:",Wre="No matching bindings found for serviceIdentifier:",Xre="Missing required @injectable annotation in:",Yre="Missing required @inject or @multiInject annotation in:",Hre=function(r){return"@inject called with undefined this could mean that the class "+r+" has a circular dependency problem. You can use a LazyServiceIdentifer to  overcome this limitation."},qre="Circular dependency found:",Kre="Invalid binding type:",Zre="No snapshot available to restore.",Qre="Invalid return type in middleware. Middleware must return!",Jre="Value provided to function binding must be a function!",ene="The toSelf function can only be applied when a constructor is used as service identifier",tne="The @inject @multiInject @tagged and @named decorators must be applied to the parameters of a class constructor or a class property.",rne=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return"The number of constructor arguments in the derived class "+(r[0]+" must be >= than the number of constructor arguments of its base class.")},nne="Invalid Container constructor argument. Container options must be an object.",ine="Invalid Container option. Default scope must be a string ('singleton' or 'transient').",ane="Invalid Container option. Auto bind injectable must be a boolean",one="Invalid Container option. Skip base check must be a boolean",sne=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return"@postConstruct error in class "+r[0]+": "+r[1]},une=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return"It looks like there is a circular dependency "+("in one of the '"+r[0]+"' bindings. Please investigate bindings with")+("service identifier '"+r[1]+"'.")},lne="Maximum call stack size exceeded",cne=function(){function r(){}return r.prototype.getConstructorMetadata=function(e){var t=Reflect.getMetadata(Ow,e),n=Reflect.getMetadata(QD,e);return{compilerGeneratedMetadata:t,userGeneratedMetadata:n||{}}},r.prototype.getPropertiesMetadata=function(e){var t=Reflect.getMetadata(JD,e)||[];return t},r}(),Hg={MultipleBindingsAvailable:2,NoBindingsAvailable:0,OnlyOneBindingAvailable:1};function nL(r){return r instanceof RangeError||r.message===lne}function $h(r){if(typeof r=="function"){var e=r;return e.name}else{if(typeof r=="symbol")return r.toString();var e=r;return e}}function iL(r,e,t){var n="",i=t(r,e);return i.length!==0&&(n=`
Registered bindings:`,i.forEach(function(a){var o="Object";a.implementationType!==null&&(o=qg(a.implementationType)),n=n+`
 `+o,a.constraint.metaData&&(n=n+" - "+a.constraint.metaData)})),n}function aL(r,e){return r.parentRequest===null?!1:r.parentRequest.serviceIdentifier===e?!0:aL(r.parentRequest,e)}function fne(r){function e(n,i){i===void 0&&(i=[]);var a=$h(n.serviceIdentifier);return i.push(a),n.parentRequest!==null?e(n.parentRequest,i):i}var t=e(r);return t.reverse().join(" --> ")}function oL(r){r.childRequests.forEach(function(e){if(aL(e,e.serviceIdentifier)){var t=fne(e);throw new Error(qre+" "+t)}else oL(e)})}function hne(r,e){if(e.isTagged()||e.isNamed()){var t="",n=e.getNamedTag(),i=e.getCustomTags();return n!==null&&(t+=n.toString()+`
`),i!==null&&i.forEach(function(a){t+=a.toString()+`
`})," "+r+`
 `+r+" - "+t}else return" "+r}function qg(r){if(r.name)return r.name;var e=r.toString(),t=e.match(/^function\s*([^\s(]+)/);return t?t[1]:"Anonymous function: "+e}var sL=function(){function r(e){this.id=Gh(),this.container=e}return r.prototype.addPlan=function(e){this.plan=e},r.prototype.setCurrentRequest=function(e){this.currentRequest=e},r}(),$s=function(){function r(e,t){this.key=e,this.value=t}return r.prototype.toString=function(){return this.key===ja?"named: "+this.value.toString()+" ":"tagged: { key:"+this.key.toString()+", value: "+this.value+" }"},r}(),dne=function(){function r(e,t){this.parentContext=e,this.rootRequest=t}return r}();function uL(r,e,t,n){var i=QD;cL(i,r,e,n,t)}function lL(r,e,t){var n=JD;cL(n,r.constructor,e,t)}function cL(r,e,t,n,i){var a={},o=typeof i=="number",s=i!==void 0&&o?i.toString():t;if(o&&t!==void 0)throw new Error(tne);Reflect.hasOwnMetadata(r,e)&&(a=Reflect.getMetadata(r,e));var u=a[s];if(!Array.isArray(u))u=[];else for(var l=0,c=u;l<c.length;l++){var f=c[l];if(f.key===n.key)throw new Error($re+" "+f.key.toString())}u.push(n),a[s]=u,Reflect.defineMetadata(r,a,e)}var vne=function(){function r(e){this._cb=e}return r.prototype.unwrap=function(){return this._cb()},r}();function Bt(r){return function(e,t,n){if(r===void 0)throw new Error(Hre(e.name));var i=new $s(Yg,r);typeof n=="number"?uL(e,t,n,i):lL(e,t,i)}}var pne=function(){function r(e){this.str=e}return r.prototype.startsWith=function(e){return this.str.indexOf(e)===0},r.prototype.endsWith=function(e){var t="",n=e.split("").reverse().join("");return t=this.str.split("").reverse().join(""),this.startsWith.call({str:t},n)},r.prototype.contains=function(e){return this.str.indexOf(e)!==-1},r.prototype.equals=function(e){return this.str===e},r.prototype.value=function(){return this.str},r}(),Kg=function(){function r(e,t,n,i){this.id=Gh(),this.type=e,this.serviceIdentifier=n,this.name=new pne(t||""),this.metadata=new Array;var a=null;typeof i=="string"?a=new $s(ja,i):i instanceof $s&&(a=i),a!==null&&this.metadata.push(a)}return r.prototype.hasTag=function(e){for(var t=0,n=this.metadata;t<n.length;t++){var i=n[t];if(i.key===e)return!0}return!1},r.prototype.isArray=function(){return this.hasTag(Uh)},r.prototype.matchesArray=function(e){return this.matchesTag(Uh)(e)},r.prototype.isNamed=function(){return this.hasTag(ja)},r.prototype.isTagged=function(){return this.metadata.some(function(e){return tL.every(function(t){return e.key!==t})})},r.prototype.isOptional=function(){return this.matchesTag(ZD)(!0)},r.prototype.getNamedTag=function(){return this.isNamed()?this.metadata.filter(function(e){return e.key===ja})[0]:null},r.prototype.getCustomTags=function(){return this.isTagged()?this.metadata.filter(function(e){return tL.every(function(t){return e.key!==t})}):null},r.prototype.matchesNamedTag=function(e){return this.matchesTag(ja)(e)},r.prototype.matchesTag=function(e){var t=this;return function(n){for(var i=0,a=t.metadata;i<a.length;i++){var o=a[i];if(o.key===e&&o.value===n)return!0}return!1}},r}(),Zg=globalThis&&globalThis.__spreadArray||function(r,e){for(var t=0,n=e.length,i=r.length;t<n;t++,i++)r[i]=e[t];return r};function gne(r,e){var t=qg(e),n=fL(r,t,e,!1);return n}function fL(r,e,t,n){var i=r.getConstructorMetadata(t),a=i.compilerGeneratedMetadata;if(a===void 0){var o=Xre+" "+e+".";throw new Error(o)}var s=i.userGeneratedMetadata,u=Object.keys(s),l=t.length===0&&u.length>0,c=u.length>t.length,f=l||c?u.length:t.length,d=mne(n,e,a,s,f),h=hL(r,t),v=Zg(Zg([],d),h);return v}function yne(r,e,t,n,i){var a=i[r.toString()]||[],o=vL(a),s=o.unmanaged!==!0,u=n[r],l=o.inject||o.multiInject;if(u=l||u,u instanceof vne&&(u=u.unwrap()),s){var c=u===Object,f=u===Function,d=u===void 0,h=c||f||d;if(!e&&h){var v=Yre+" argument "+r+" in class "+t+".";throw new Error(v)}var p=new Kg(Zo.ConstructorArgument,o.targetName,u);return p.metadata=a,p}return null}function mne(r,e,t,n,i){for(var a=[],o=0;o<i;o++){var s=o,u=yne(s,r,e,t,n);u!==null&&a.push(u)}return a}function hL(r,e){for(var t=r.getPropertiesMetadata(e),n=[],i=Object.keys(t),a=0,o=i;a<o.length;a++){var s=o[a],u=t[s],l=vL(t[s]),c=l.targetName||s,f=l.inject||l.multiInject,d=new Kg(Zo.ClassProperty,c,f);d.metadata=u,n.push(d)}var h=Object.getPrototypeOf(e.prototype).constructor;if(h!==Object){var v=hL(r,h);n=Zg(Zg([],n),v)}return n}function dL(r,e){var t=Object.getPrototypeOf(e.prototype).constructor;if(t!==Object){var n=qg(t),i=fL(r,n,t,!0),a=i.map(function(u){return u.metadata.filter(function(l){return l.key===Nw})}),o=[].concat.apply([],a).length,s=i.length-o;return s>0?s:dL(r,t)}else return 0}function vL(r){var e={};return r.forEach(function(t){e[t.key.toString()]=t.value}),{inject:e[Yg],multiInject:e[Uh],targetName:e[KD],unmanaged:e[Nw]}}var Pw=function(){function r(e,t,n,i,a){this.id=Gh(),this.serviceIdentifier=e,this.parentContext=t,this.parentRequest=n,this.target=a,this.childRequests=[],this.bindings=Array.isArray(i)?i:[i],this.requestScope=n===null?new Map:null}return r.prototype.addChildRequest=function(e,t,n){var i=new r(e,this.parentContext,this,t,n);return this.childRequests.push(i),i},r}();function Rw(r){return r._bindingDictionary}function bne(r,e,t,n,i,a){var o=r?Uh:Yg,s=new $s(o,t),u=new Kg(e,n,t,s);if(i!==void 0){var l=new $s(i,a);u.metadata.push(l)}return u}function pL(r,e,t,n,i){var a=Vh(t.container,i.serviceIdentifier),o=[];return a.length===Hg.NoBindingsAvailable&&t.container.options.autoBindInjectable&&typeof i.serviceIdentifier=="function"&&r.getConstructorMetadata(i.serviceIdentifier).compilerGeneratedMetadata&&(t.container.bind(i.serviceIdentifier).toSelf(),a=Vh(t.container,i.serviceIdentifier)),e?o=a:o=a.filter(function(s){var u=new Pw(s.serviceIdentifier,t,n,s,i);return s.constraint(u)}),wne(i.serviceIdentifier,o,i,t.container),o}function wne(r,e,t,n){switch(e.length){case Hg.NoBindingsAvailable:if(t.isOptional())return e;var i=$h(r),a=Wre;throw a+=hne(i,t),a+=iL(n,i,Vh),new Error(a);case Hg.OnlyOneBindingAvailable:if(!t.isArray())return e;case Hg.MultipleBindingsAvailable:default:if(t.isArray())return e;var i=$h(r),a=Vre+" "+i;throw a+=iL(n,i,Vh),new Error(a)}}function gL(r,e,t,n,i,a){var o,s;if(i===null){o=pL(r,e,n,null,a),s=new Pw(t,n,null,o,a);var u=new dne(n,s);n.addPlan(u)}else o=pL(r,e,n,i,a),s=i.addChildRequest(a.serviceIdentifier,o,a);o.forEach(function(l){var c=null;if(a.isArray())c=s.addChildRequest(l.serviceIdentifier,l,a);else{if(l.cache)return;c=s}if(l.type===di.Instance&&l.implementationType!==null){var f=gne(r,l.implementationType);if(!n.container.options.skipBaseClassChecks){var d=dL(r,l.implementationType);if(f.length<d){var h=rne(qg(l.implementationType));throw new Error(h)}}f.forEach(function(v){gL(r,!1,v.serviceIdentifier,n,c,v)})}})}function Vh(r,e){var t=[],n=Rw(r);return n.hasKey(e)?t=n.get(e):r.parent!==null&&(t=Vh(r.parent,e)),t}function xne(r,e,t,n,i,a,o,s){s===void 0&&(s=!1);var u=new sL(e),l=bne(t,n,i,"",a,o);try{return gL(r,s,i,u,null,l),u}catch(c){throw nL(c)&&u.plan&&oL(u.plan.rootRequest),c}}function _ne(r,e,t,n){var i=new Kg(Zo.Variable,"",e,new $s(t,n)),a=new sL(r),o=new Pw(e,a,null,[],i);return o}var Sne=globalThis&&globalThis.__spreadArray||function(r,e){for(var t=0,n=e.length,i=r.length;t<n;t++,i++)r[i]=e[t];return r};function Ene(r,e,t){var n=e.filter(function(a){return a.target!==null&&a.target.type===Zo.ClassProperty}),i=n.map(t);return n.forEach(function(a,o){var s="";s=a.target.name.value();var u=i[o];r[s]=u}),r}function Ane(r,e){return new(r.bind.apply(r,Sne([void 0],e)))}function Tne(r,e){if(Reflect.hasMetadata(eL,r)){var t=Reflect.getMetadata(eL,r);try{e[t.value]()}catch(n){throw new Error(sne(r.name,n.message))}}}function Ine(r,e,t){var n=null;if(e.length>0){var i=e.filter(function(o){return o.target!==null&&o.target.type===Zo.ConstructorArgument}),a=i.map(t);n=Ane(r,a),n=Ene(n,e,t)}else n=new r;return Tne(r,n),n}var Bw=function(r,e,t){try{return t()}catch(n){throw nL(n)?new Error(une(r,e.toString())):n}},Fw=function(r){return function(e){e.parentContext.setCurrentRequest(e);var t=e.bindings,n=e.childRequests,i=e.target&&e.target.isArray(),a=!e.parentRequest||!e.parentRequest.target||!e.target||!e.parentRequest.target.matchesArray(e.target.serviceIdentifier);if(i&&a)return n.map(function(f){var d=Fw(r);return d(f)});var o=null;if(e.target.isOptional()&&t.length===0)return;var s=t[0],u=s.scope===hi.Singleton,l=s.scope===hi.Request;if(u&&s.activated)return s.cache;if(l&&r!==null&&r.has(s.id))return r.get(s.id);if(s.type===di.ConstantValue)o=s.cache,s.activated=!0;else if(s.type===di.Function)o=s.cache,s.activated=!0;else if(s.type===di.Constructor)o=s.implementationType;else if(s.type===di.DynamicValue&&s.dynamicValue!==null)o=Bw("toDynamicValue",s.serviceIdentifier,function(){return s.dynamicValue(e.parentContext)});else if(s.type===di.Factory&&s.factory!==null)o=Bw("toFactory",s.serviceIdentifier,function(){return s.factory(e.parentContext)});else if(s.type===di.Provider&&s.provider!==null)o=Bw("toProvider",s.serviceIdentifier,function(){return s.provider(e.parentContext)});else if(s.type===di.Instance&&s.implementationType!==null)o=Ine(s.implementationType,n,Fw(r));else{var c=$h(e.serviceIdentifier);throw new Error(Kre+" "+c)}return typeof s.onActivation=="function"&&(o=s.onActivation(e.parentContext,o)),u&&(s.cache=o,s.activated=!0),l&&r!==null&&!r.has(s.id)&&r.set(s.id,o),o}};function Cne(r){var e=Fw(r.plan.rootRequest.requestScope);return e(r.plan.rootRequest)}var Qo=function(r,e){var t=r.parentRequest;return t!==null?e(t)?!0:Qo(t,e):!1},jh=function(r){return function(e){var t=function(n){return n!==null&&n.target!==null&&n.target.matchesTag(r)(e)};return t.metaData=new $s(r,e),t}},Qg=jh(ja),Uw=function(r){return function(e){var t=null;if(e!==null)if(t=e.bindings[0],typeof r=="string"){var n=t.serviceIdentifier;return n===r}else{var i=e.bindings[0].implementationType;return r===i}return!1}},Gw=function(){function r(e){this._binding=e}return r.prototype.when=function(e){return this._binding.constraint=e,new vi(this._binding)},r.prototype.whenTargetNamed=function(e){return this._binding.constraint=Qg(e),new vi(this._binding)},r.prototype.whenTargetIsDefault=function(){return this._binding.constraint=function(e){var t=e.target!==null&&!e.target.isNamed()&&!e.target.isTagged();return t},new vi(this._binding)},r.prototype.whenTargetTagged=function(e,t){return this._binding.constraint=jh(e)(t),new vi(this._binding)},r.prototype.whenInjectedInto=function(e){return this._binding.constraint=function(t){return Uw(e)(t.parentRequest)},new vi(this._binding)},r.prototype.whenParentNamed=function(e){return this._binding.constraint=function(t){return Qg(e)(t.parentRequest)},new vi(this._binding)},r.prototype.whenParentTagged=function(e,t){return this._binding.constraint=function(n){return jh(e)(t)(n.parentRequest)},new vi(this._binding)},r.prototype.whenAnyAncestorIs=function(e){return this._binding.constraint=function(t){return Qo(t,Uw(e))},new vi(this._binding)},r.prototype.whenNoAncestorIs=function(e){return this._binding.constraint=function(t){return!Qo(t,Uw(e))},new vi(this._binding)},r.prototype.whenAnyAncestorNamed=function(e){return this._binding.constraint=function(t){return Qo(t,Qg(e))},new vi(this._binding)},r.prototype.whenNoAncestorNamed=function(e){return this._binding.constraint=function(t){return!Qo(t,Qg(e))},new vi(this._binding)},r.prototype.whenAnyAncestorTagged=function(e,t){return this._binding.constraint=function(n){return Qo(n,jh(e)(t))},new vi(this._binding)},r.prototype.whenNoAncestorTagged=function(e,t){return this._binding.constraint=function(n){return!Qo(n,jh(e)(t))},new vi(this._binding)},r.prototype.whenAnyAncestorMatches=function(e){return this._binding.constraint=function(t){return Qo(t,e)},new vi(this._binding)},r.prototype.whenNoAncestorMatches=function(e){return this._binding.constraint=function(t){return!Qo(t,e)},new vi(this._binding)},r}(),vi=function(){function r(e){this._binding=e}return r.prototype.onActivation=function(e){return this._binding.onActivation=e,new Gw(this._binding)},r}(),Vs=function(){function r(e){this._binding=e,this._bindingWhenSyntax=new Gw(this._binding),this._bindingOnSyntax=new vi(this._binding)}return r.prototype.when=function(e){return this._bindingWhenSyntax.when(e)},r.prototype.whenTargetNamed=function(e){return this._bindingWhenSyntax.whenTargetNamed(e)},r.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},r.prototype.whenTargetTagged=function(e,t){return this._bindingWhenSyntax.whenTargetTagged(e,t)},r.prototype.whenInjectedInto=function(e){return this._bindingWhenSyntax.whenInjectedInto(e)},r.prototype.whenParentNamed=function(e){return this._bindingWhenSyntax.whenParentNamed(e)},r.prototype.whenParentTagged=function(e,t){return this._bindingWhenSyntax.whenParentTagged(e,t)},r.prototype.whenAnyAncestorIs=function(e){return this._bindingWhenSyntax.whenAnyAncestorIs(e)},r.prototype.whenNoAncestorIs=function(e){return this._bindingWhenSyntax.whenNoAncestorIs(e)},r.prototype.whenAnyAncestorNamed=function(e){return this._bindingWhenSyntax.whenAnyAncestorNamed(e)},r.prototype.whenAnyAncestorTagged=function(e,t){return this._bindingWhenSyntax.whenAnyAncestorTagged(e,t)},r.prototype.whenNoAncestorNamed=function(e){return this._bindingWhenSyntax.whenNoAncestorNamed(e)},r.prototype.whenNoAncestorTagged=function(e,t){return this._bindingWhenSyntax.whenNoAncestorTagged(e,t)},r.prototype.whenAnyAncestorMatches=function(e){return this._bindingWhenSyntax.whenAnyAncestorMatches(e)},r.prototype.whenNoAncestorMatches=function(e){return this._bindingWhenSyntax.whenNoAncestorMatches(e)},r.prototype.onActivation=function(e){return this._bindingOnSyntax.onActivation(e)},r}(),Mne=function(){function r(e){this._binding=e}return r.prototype.inRequestScope=function(){return this._binding.scope=hi.Request,new Vs(this._binding)},r.prototype.inSingletonScope=function(){return this._binding.scope=hi.Singleton,new Vs(this._binding)},r.prototype.inTransientScope=function(){return this._binding.scope=hi.Transient,new Vs(this._binding)},r}(),yL=function(){function r(e){this._binding=e,this._bindingWhenSyntax=new Gw(this._binding),this._bindingOnSyntax=new vi(this._binding),this._bindingInSyntax=new Mne(e)}return r.prototype.inRequestScope=function(){return this._bindingInSyntax.inRequestScope()},r.prototype.inSingletonScope=function(){return this._bindingInSyntax.inSingletonScope()},r.prototype.inTransientScope=function(){return this._bindingInSyntax.inTransientScope()},r.prototype.when=function(e){return this._bindingWhenSyntax.when(e)},r.prototype.whenTargetNamed=function(e){return this._bindingWhenSyntax.whenTargetNamed(e)},r.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},r.prototype.whenTargetTagged=function(e,t){return this._bindingWhenSyntax.whenTargetTagged(e,t)},r.prototype.whenInjectedInto=function(e){return this._bindingWhenSyntax.whenInjectedInto(e)},r.prototype.whenParentNamed=function(e){return this._bindingWhenSyntax.whenParentNamed(e)},r.prototype.whenParentTagged=function(e,t){return this._bindingWhenSyntax.whenParentTagged(e,t)},r.prototype.whenAnyAncestorIs=function(e){return this._bindingWhenSyntax.whenAnyAncestorIs(e)},r.prototype.whenNoAncestorIs=function(e){return this._bindingWhenSyntax.whenNoAncestorIs(e)},r.prototype.whenAnyAncestorNamed=function(e){return this._bindingWhenSyntax.whenAnyAncestorNamed(e)},r.prototype.whenAnyAncestorTagged=function(e,t){return this._bindingWhenSyntax.whenAnyAncestorTagged(e,t)},r.prototype.whenNoAncestorNamed=function(e){return this._bindingWhenSyntax.whenNoAncestorNamed(e)},r.prototype.whenNoAncestorTagged=function(e,t){return this._bindingWhenSyntax.whenNoAncestorTagged(e,t)},r.prototype.whenAnyAncestorMatches=function(e){return this._bindingWhenSyntax.whenAnyAncestorMatches(e)},r.prototype.whenNoAncestorMatches=function(e){return this._bindingWhenSyntax.whenNoAncestorMatches(e)},r.prototype.onActivation=function(e){return this._bindingOnSyntax.onActivation(e)},r}(),kne=function(){function r(e){this._binding=e}return r.prototype.to=function(e){return this._binding.type=di.Instance,this._binding.implementationType=e,new yL(this._binding)},r.prototype.toSelf=function(){if(typeof this._binding.serviceIdentifier!="function")throw new Error(""+ene);var e=this._binding.serviceIdentifier;return this.to(e)},r.prototype.toConstantValue=function(e){return this._binding.type=di.ConstantValue,this._binding.cache=e,this._binding.dynamicValue=null,this._binding.implementationType=null,this._binding.scope=hi.Singleton,new Vs(this._binding)},r.prototype.toDynamicValue=function(e){return this._binding.type=di.DynamicValue,this._binding.cache=null,this._binding.dynamicValue=e,this._binding.implementationType=null,new yL(this._binding)},r.prototype.toConstructor=function(e){return this._binding.type=di.Constructor,this._binding.implementationType=e,this._binding.scope=hi.Singleton,new Vs(this._binding)},r.prototype.toFactory=function(e){return this._binding.type=di.Factory,this._binding.factory=e,this._binding.scope=hi.Singleton,new Vs(this._binding)},r.prototype.toFunction=function(e){if(typeof e!="function")throw new Error(Jre);var t=this.toConstantValue(e);return this._binding.type=di.Function,this._binding.scope=hi.Singleton,t},r.prototype.toAutoFactory=function(e){return this._binding.type=di.Factory,this._binding.factory=function(t){var n=function(){return t.container.get(e)};return n},this._binding.scope=hi.Singleton,new Vs(this._binding)},r.prototype.toProvider=function(e){return this._binding.type=di.Provider,this._binding.provider=e,this._binding.scope=hi.Singleton,new Vs(this._binding)},r.prototype.toService=function(e){this.toDynamicValue(function(t){return t.container.get(e)})},r}(),Dne=function(){function r(){}return r.of=function(e,t){var n=new r;return n.bindings=e,n.middleware=t,n},r}(),mL=function(){function r(){this._map=new Map}return r.prototype.getMap=function(){return this._map},r.prototype.add=function(e,t){if(e==null)throw new Error(zh);if(t==null)throw new Error(zh);var n=this._map.get(e);n!==void 0?(n.push(t),this._map.set(e,n)):this._map.set(e,[t])},r.prototype.get=function(e){if(e==null)throw new Error(zh);var t=this._map.get(e);if(t!==void 0)return t;throw new Error(rL)},r.prototype.remove=function(e){if(e==null)throw new Error(zh);if(!this._map.delete(e))throw new Error(rL)},r.prototype.removeByCondition=function(e){var t=this;this._map.forEach(function(n,i){var a=n.filter(function(o){return!e(o)});a.length>0?t._map.set(i,a):t._map.delete(i)})},r.prototype.hasKey=function(e){if(e==null)throw new Error(zh);return this._map.has(e)},r.prototype.clone=function(){var e=new r;return this._map.forEach(function(t,n){t.forEach(function(i){return e.add(n,i.clone())})}),e},r.prototype.traverse=function(e){this._map.forEach(function(t,n){e(n,t)})},r}(),Lne=globalThis&&globalThis.__awaiter||function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function s(c){try{l(n.next(c))}catch(f){o(f)}}function u(c){try{l(n.throw(c))}catch(f){o(f)}}function l(c){c.done?a(c.value):i(c.value).then(s,u)}l((n=n.apply(r,e||[])).next())})},Nne=globalThis&&globalThis.__generator||function(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(l){return function(c){return u([l,c])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;t;)try{if(n=1,i&&(a=l[0]&2?i.return:l[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,l[1])).done)return a;switch(i=0,a&&(l=[l[0]&2,a.value]),l[0]){case 0:case 1:a=l;break;case 4:return t.label++,{value:l[1],done:!1};case 5:t.label++,i=l[1],l=[0];continue;case 7:l=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(l[0]===6||l[0]===2)){t=0;continue}if(l[0]===3&&(!a||l[1]>a[0]&&l[1]<a[3])){t.label=l[1];break}if(l[0]===6&&t.label<a[1]){t.label=a[1],a=l;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(l);break}a[2]&&t.ops.pop(),t.trys.pop();continue}l=e.call(r,t)}catch(c){l=[6,c],i=0}finally{n=a=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},One=globalThis&&globalThis.__spreadArray||function(r,e){for(var t=0,n=e.length,i=r.length;t<n;t++,i++)r[i]=e[t];return r},bL=function(){function r(e){this._appliedMiddleware=[];var t=e||{};if(typeof t!="object")throw new Error(""+nne);if(t.defaultScope===void 0)t.defaultScope=hi.Transient;else if(t.defaultScope!==hi.Singleton&&t.defaultScope!==hi.Transient&&t.defaultScope!==hi.Request)throw new Error(""+ine);if(t.autoBindInjectable===void 0)t.autoBindInjectable=!1;else if(typeof t.autoBindInjectable!="boolean")throw new Error(""+ane);if(t.skipBaseClassChecks===void 0)t.skipBaseClassChecks=!1;else if(typeof t.skipBaseClassChecks!="boolean")throw new Error(""+one);this.options={autoBindInjectable:t.autoBindInjectable,defaultScope:t.defaultScope,skipBaseClassChecks:t.skipBaseClassChecks},this.id=Gh(),this._bindingDictionary=new mL,this._snapshots=[],this._middleware=null,this.parent=null,this._metadataReader=new cne}return r.merge=function(e,t){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];var a=new r,o=One([e,t],n).map(function(l){return Rw(l)}),s=Rw(a);function u(l,c){l.traverse(function(f,d){d.forEach(function(h){c.add(h.serviceIdentifier,h.clone())})})}return o.forEach(function(l){u(l,s)}),a},r.prototype.load=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=this._getContainerModuleHelpersFactory(),i=0,a=e;i<a.length;i++){var o=a[i],s=n(o.id);o.registry(s.bindFunction,s.unbindFunction,s.isboundFunction,s.rebindFunction)}},r.prototype.loadAsync=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Lne(this,void 0,void 0,function(){var n,i,a,o,s;return Nne(this,function(u){switch(u.label){case 0:n=this._getContainerModuleHelpersFactory(),i=0,a=e,u.label=1;case 1:return i<a.length?(o=a[i],s=n(o.id),[4,o.registry(s.bindFunction,s.unbindFunction,s.isboundFunction,s.rebindFunction)]):[3,4];case 2:u.sent(),u.label=3;case 3:return i++,[3,1];case 4:return[2]}})})},r.prototype.unload=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i=function(a){return function(o){return o.moduleId===a}};t.forEach(function(a){var o=i(a.id);e._bindingDictionary.removeByCondition(o)})},r.prototype.bind=function(e){var t=this.options.defaultScope||hi.Transient,n=new Gre(e,t);return this._bindingDictionary.add(e,n),new kne(n)},r.prototype.rebind=function(e){return this.unbind(e),this.bind(e)},r.prototype.unbind=function(e){try{this._bindingDictionary.remove(e)}catch{throw new Error(jre+" "+$h(e))}},r.prototype.unbindAll=function(){this._bindingDictionary=new mL},r.prototype.isBound=function(e){var t=this._bindingDictionary.hasKey(e);return!t&&this.parent&&(t=this.parent.isBound(e)),t},r.prototype.isBoundNamed=function(e,t){return this.isBoundTagged(e,ja,t)},r.prototype.isBoundTagged=function(e,t,n){var i=!1;if(this._bindingDictionary.hasKey(e)){var a=this._bindingDictionary.get(e),o=_ne(this,e,t,n);i=a.some(function(s){return s.constraint(o)})}return!i&&this.parent&&(i=this.parent.isBoundTagged(e,t,n)),i},r.prototype.snapshot=function(){this._snapshots.push(Dne.of(this._bindingDictionary.clone(),this._middleware))},r.prototype.restore=function(){var e=this._snapshots.pop();if(e===void 0)throw new Error(Zre);this._bindingDictionary=e.bindings,this._middleware=e.middleware},r.prototype.createChild=function(e){var t=new r(e||this.options);return t.parent=this,t},r.prototype.applyMiddleware=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._appliedMiddleware=this._appliedMiddleware.concat(e);var n=this._middleware?this._middleware:this._planAndResolve();this._middleware=e.reduce(function(i,a){return a(i)},n)},r.prototype.applyCustomMetadataReader=function(e){this._metadataReader=e},r.prototype.get=function(e){return this._get(!1,!1,Zo.Variable,e)},r.prototype.getTagged=function(e,t,n){return this._get(!1,!1,Zo.Variable,e,t,n)},r.prototype.getNamed=function(e,t){return this.getTagged(e,ja,t)},r.prototype.getAll=function(e){return this._get(!0,!0,Zo.Variable,e)},r.prototype.getAllTagged=function(e,t,n){return this._get(!1,!0,Zo.Variable,e,t,n)},r.prototype.getAllNamed=function(e,t){return this.getAllTagged(e,ja,t)},r.prototype.resolve=function(e){var t=this.createChild();return t.bind(e).toSelf(),this._appliedMiddleware.forEach(function(n){t.applyMiddleware(n)}),t.get(e)},r.prototype._getContainerModuleHelpersFactory=function(){var e=this,t=function(s,u){s._binding.moduleId=u},n=function(s){return function(u){var l=e.bind.bind(e),c=l(u);return t(c,s),c}},i=function(s){return function(u){var l=e.unbind.bind(e);l(u)}},a=function(s){return function(u){var l=e.isBound.bind(e);return l(u)}},o=function(s){return function(u){var l=e.rebind.bind(e),c=l(u);return t(c,s),c}};return function(s){return{bindFunction:n(s),isboundFunction:a(s),rebindFunction:o(s),unbindFunction:i(s)}}},r.prototype._get=function(e,t,n,i,a,o){var s=null,u={avoidConstraints:e,contextInterceptor:function(l){return l},isMultiInject:t,key:a,serviceIdentifier:i,targetType:n,value:o};if(this._middleware){if(s=this._middleware(u),s==null)throw new Error(Qre)}else s=this._planAndResolve()(u);return s},r.prototype._planAndResolve=function(){var e=this;return function(t){var n=xne(e._metadataReader,e,t.isMultiInject,t.targetType,t.serviceIdentifier,t.key,t.value,t.avoidConstraints);n=t.contextInterceptor(n);var i=Cne(n);return i}},r}();function Gr(){return function(r){if(Reflect.hasOwnMetadata(Ow,r))throw new Error(zre);var e=Reflect.getMetadata(Bre,r)||[];return Reflect.defineMetadata(Ow,e,r),r}}function yo(r){return function(e,t,n){var i=new $s(ja,r);typeof n=="number"?uL(e,t,n,i):lL(e,t,i)}}var Pe={HierarchyComponentManager:Symbol("HierarchyComponentManager"),TransformComponentManager:Symbol("TransformComponentManager"),NameComponentManager:Symbol("NameComponentManager"),SceneGraphSystem:Symbol("SceneGraphSystem"),FrameGraphSystem:Symbol("FrameGraphSystem"),ResourcePool:Symbol("ResourcePool"),ResourceHandleComponentManager:Symbol("ResourceHandleComponentManager"),PassNodeComponentManager:Symbol("PassNodeComponentManager"),RendererSystem:Symbol("RendererSystem"),RenderPass:Symbol("RenderPass"),RenderPassFactory:Symbol("Factory<IRenderPass>"),Renderable:Symbol("Factory<IRenderPass>"),MeshSystem:Symbol("MeshSystem"),MeshComponentManager:Symbol("MeshComponentManager"),CullableComponentManager:Symbol("CullableComponentManager"),Geometry:Symbol("Geometry"),GeometrySystem:Symbol("GeometrySystem"),GeometryComponentManager:Symbol("GeometryComponentManager"),Material:Symbol("Material"),MaterialSystem:Symbol("MaterialSystem"),MaterialComponentManager:Symbol("MaterialComponentManager"),ForwardRenderPath:Symbol("ForwardRenderPath"),ComputeSystem:Symbol("ComputeSystem"),ComputeComponentManager:Symbol("ComputeComponentManager"),ComputeStrategy:Symbol("ComputeStrategy"),Systems:Symbol("Systems"),World:Symbol("World"),RenderEngine:Symbol("RenderEngine"),WebGPUEngine:Symbol("WebGPUEngine"),WebGLEngine:Symbol("WebGLEngine"),ShaderModuleService:Symbol("ShaderModuleService"),ConfigService:Symbol("ConfigService"),InteractorService:Symbol("InteractorService"),IEventEmitter:Symbol("IEventEmitter"),Light:Symbol("Light")},Pne=function r(){Ct(this,r),this.index=void 0},Rne=function r(){Ct(this,r),this.name=void 0,this.data=void 0,this.execute=void 0,this.tearDown=void 0},Bne=function(){function r(){Ct(this,r),this.name=void 0,this.refCount=0,this.hasSideEffect=!1,this.devirtualize=[],this.destroy=[],this.reads=[],this.writes=[]}return Gt(r,[{key:"read",value:function(t){return this.reads.find(function(n){return n.index===t.index})||this.reads.push(t),t}},{key:"sample",value:function(t){return this.read(t),t}},{key:"write",value:function(t,n){var i=this.writes.find(function(u){return u.index===n.index});if(i)return n;var a=t.getResourceNode(n);a.resource.version++,a.resource.imported&&(this.hasSideEffect=!0);var o=t.createResourceNode(a.resource),s=t.getResourceNode(o);return s.writer=this,this.writes.push(o),o}}]),r}();function zw(r,e){return zw=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},zw(r,e)}function wi(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&zw(r,e)}function mo(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?mo=function(t){return typeof t}:mo=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mo(r)}function wn(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function xi(r,e){if(e&&(mo(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return wn(r)}function zr(r){return zr=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},zr(r)}var Fne=function r(){Ct(this,r),this.first=void 0,this.last=void 0};function Une(r){var e=Gne();return function(){var n=zr(r),i;if(e){var a=zr(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return xi(this,i)}}function Gne(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}var wL=function(r){wi(t,r);var e=Une(t);function t(){var n;Ct(this,t);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return n=e.call.apply(e,[this].concat(a)),n.version=0,n.refs=0,n.name=void 0,n.imported=void 0,n.priority=void 0,n.discardStart=!0,n.discardEnd=!1,n.descriptor=void 0,n.resource=void 0,n}return Gt(t,[{key:"preExecuteDestroy",value:function(){this.discardEnd=!0}},{key:"postExecuteDestroy",value:function(){!this.imported}},{key:"postExecuteDevirtualize",value:function(){this.discardStart=!1}},{key:"preExecuteDevirtualize",value:function(){!this.imported}}]),t}(Fne),zne=function r(){Ct(this,r),this.resource=void 0,this.writer=void 0,this.readerCount=0,this.version=void 0},xL,_L,SL,$w,EL,AL;function ga(r,e){var t;if(typeof Symbol=="undefined"||r[Symbol.iterator]==null){if(Array.isArray(r)||(t=$ne(r))||e&&r&&typeof r.length=="number"){t&&(r=t);var n=0,i=function(){};return{s:i,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){t=r[Symbol.iterator]()},n:function(){var l=t.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&t.return!=null&&t.return()}finally{if(o)throw s}}}}function $ne(r,e){if(!!r){if(typeof r=="string")return TL(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return TL(r,e)}}function TL(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}var Vne=(xL=Gr(),_L=Bt(Pe.RenderEngine),xL(SL=($w=(AL=function(){function r(){Ct(this,r),this.passNodes=[],this.resourceNodes=[],this.frameGraphPasses=[],Pt(this,"engine",EL,this)}return Gt(r,[{key:"execute",value:function(){var e=Rr(_t.mark(function n(i){return _t.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return this.compile(),o.next=3,this.executePassNodes(i);case 3:case"end":return o.stop()}},n,this)}));function t(n){return e.apply(this,arguments)}return t}()},{key:"tearDown",value:function(){this.frameGraphPasses.forEach(function(t){t.tearDown&&t.tearDown()}),this.reset()}},{key:"addPass",value:function(t,n,i,a){var o=new Rne;o.execute=i,a&&(o.tearDown=a),o.name=t;var s=new Bne;return s.name=t,this.passNodes.push(s),this.frameGraphPasses.push(o),n(this,s,o),o}},{key:"getPass",value:function(t){return this.frameGraphPasses.find(function(n){return n.name===t})}},{key:"compile",value:function(){var t=this,n=ga(this.passNodes),i;try{for(n.s();!(i=n.n()).done;){var a=i.value;a.refCount=a.writes.length+(a.hasSideEffect?1:0),a.reads.forEach(function(z){t.resourceNodes[z.index].readerCount++})}}catch(z){n.e(z)}finally{n.f()}var o=[],s=ga(this.resourceNodes),u;try{for(s.s();!(u=s.n()).done;){var l=u.value;l.readerCount===0&&o.push(l)}}catch(z){s.e(z)}finally{s.f()}for(;o.length;){var c=o.pop(),f=c&&c.writer;if(f&&--f.refCount==0){var d=ga(f.reads),h;try{for(d.s();!(h=d.n()).done;){var v=h.value,p=this.resourceNodes[v.index];--p.readerCount==0&&o.push(p)}}catch(z){d.e(z)}finally{d.f()}}}this.resourceNodes.forEach(function(z){z.resource.refs+=z.readerCount});var g=ga(this.passNodes),y;try{for(g.s();!(y=g.n()).done;){var m=y.value;if(!!m.refCount){var b=ga(m.reads),w;try{for(b.s();!(w=b.n()).done;){var x=w.value,_=this.resourceNodes[x.index].resource;_.first=_.first?_.first:m,_.last=m}}catch(z){b.e(z)}finally{b.f()}var A=ga(m.writes),I;try{for(A.s();!(I=A.n()).done;){var M=I.value,S=this.resourceNodes[M.index].resource;S.first=S.first?S.first:m,S.last=m}}catch(z){A.e(z)}finally{A.f()}}}}catch(z){g.e(z)}finally{g.f()}for(var C=0;C<2;C++){var T=ga(this.resourceNodes),k;try{for(T.s();!(k=T.n()).done;){var L=k.value,B=L.resource;if(B.priority===C&&B.refs){var ee=B.first,K=B.last;ee&&K&&(ee.devirtualize.push(B),K.destroy.push(B))}}}catch(z){T.e(z)}finally{T.f()}}}},{key:"executePassNodes",value:function(){var e=Rr(_t.mark(function n(i){var a,o,s,u,l,c,f,d,h,v,p,g,y,m,b,w,x;return _t.wrap(function(A){for(;;)switch(A.prev=A.next){case 0:a=ga(this.passNodes.entries()),A.prev=1,a.s();case 3:if((o=a.n()).done){A.next=18;break}if(s=Xg(o.value,2),u=s[0],l=s[1],!l.refCount){A.next=16;break}c=ga(l.devirtualize);try{for(c.s();!(f=c.n()).done;)d=f.value,d.preExecuteDevirtualize(this.engine)}catch(I){c.e(I)}finally{c.f()}h=ga(l.destroy);try{for(h.s();!(v=h.n()).done;)p=v.value,p.preExecuteDestroy(this.engine)}catch(I){h.e(I)}finally{h.f()}return A.next=12,this.frameGraphPasses[u].execute(this,this.frameGraphPasses[u],i);case 12:g=ga(l.devirtualize);try{for(g.s();!(y=g.n()).done;)m=y.value,m.postExecuteDevirtualize(this.engine)}catch(I){g.e(I)}finally{g.f()}b=ga(l.destroy);try{for(b.s();!(w=b.n()).done;)x=w.value,x.postExecuteDestroy(this.engine)}catch(I){b.e(I)}finally{b.f()}case 16:A.next=3;break;case 18:A.next=23;break;case 20:A.prev=20,A.t0=A.catch(1),a.e(A.t0);case 23:return A.prev=23,a.f(),A.finish(23);case 26:this.reset();case 27:case"end":return A.stop()}},n,this,[[1,20,23,26]])}));function t(n){return e.apply(this,arguments)}return t}()},{key:"reset",value:function(){this.passNodes=[],this.resourceNodes=[],this.frameGraphPasses=[]}},{key:"getResourceNode",value:function(t){return this.resourceNodes[t.index]}},{key:"createResourceNode",value:function(t){var n=new zne;n.resource=t,n.version=t.version,this.resourceNodes.push(n);var i=new Pne;return i.index=this.resourceNodes.length-1,i}},{key:"createTexture",value:function(t,n,i){var a=new wL;return a.name=n,a.descriptor=i,this.createResourceNode(a)}},{key:"createRenderTarget",value:function(t,n,i){var a=new wL;return a.name=n,a.descriptor=i,this.createResourceNode(a)}},{key:"present",value:function(t){this.addPass("Present",function(n,i){i.read(t),i.hasSideEffect=!0},Rr(_t.mark(function n(){return _t.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:case"end":return a.stop()}},n)})))}}]),r}(),AL),EL=Rt($w.prototype,"engine",[_L],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),$w))||SL);function Ie(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}var jne=9007199254740991,Wne="[object Arguments]",Xne="[object Array]",Yne="[object Boolean]",Hne="[object Date]",qne="[object Error]",Kne="[object Function]",Zne="[object Map]",Qne="[object Number]",Jne="[object Object]",eie="[object RegExp]",tie="[object Set]",rie="[object String]",nie="[object WeakMap]",iie="[object ArrayBuffer]",aie="[object DataView]",oie="[object Float32Array]",sie="[object Float64Array]",uie="[object Int8Array]",lie="[object Int16Array]",cie="[object Int32Array]",fie="[object Uint8Array]",hie="[object Uint8ClampedArray]",die="[object Uint16Array]",vie="[object Uint32Array]",sn={};sn[oie]=sn[sie]=sn[uie]=sn[lie]=sn[cie]=sn[fie]=sn[hie]=sn[die]=sn[vie]=!0;sn[Wne]=sn[Xne]=sn[iie]=sn[Yne]=sn[aie]=sn[Hne]=sn[qne]=sn[Kne]=sn[Zne]=sn[Qne]=sn[Jne]=sn[eie]=sn[tie]=sn[rie]=sn[nie]=!1;var pie=Object.prototype,gie=pie.toString;function yie(r){return bie(r)&&mie(r.length)&&!!sn[gie.call(r)]}function mie(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=jne}function bie(r){return!!r&&mo(r)==="object"}var IL=yie;function CL(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ML(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?CL(Object(t),!0).forEach(function(n){Ie(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):CL(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function wie(r){var e=xie();return function(){var n=zr(r),i;if(e){var a=zr(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return xi(this,i)}}function xie(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}var _ie=function(r){wi(t,r);var e=wie(t);function t(n){var i;return Ct(this,t),i=e.call(this,n),i.dirty=!0,i.attributes=[],i.indices=void 0,i.indicesBuffer=void 0,i.vertexCount=0,i.maxInstancedCount=void 0,i.aabb=void 0,i.entity=void 0,Object.assign(wn(i),n),i}return Gt(t,[{key:"setAttribute",value:function(i,a,o,s){var u=this.attributes.find(function(l){return l.name===i});return u?(u.data=a,u.dirty=!0):this.attributes.push(ML(ML({dirty:!0,name:i,data:a},o),{},{bufferGetter:s})),this.dirty=!0,this}},{key:"setIndex",value:function(i){return this.indices=new Uint32Array(i.buffer?i.buffer:i),this.dirty=!0,this}},{key:"applyMatrix",value:function(i){var a=this.attributes.find(function(d){var h=d.name;return h==="position"}),o=this.attributes.find(function(d){var h=d.name;return h==="normal"});if(a&&(a.dirty=!0,a.data&&a.data.length))for(var s=0;s<a.data.length;s+=3){var u=eT(a.data[s],a.data[s+1],a.data[s+2],1);Jf(u,u,i),IL(a.data)?a.data.set([u[0],u[1],u[2]],s):(a.data[s]=u[0],a.data[s+1]=u[1],a.data[s+2]=u[2])}if(o){var l=HA(nc(),i);if(o.data&&o.data.length)for(var c=0;c<o.data.length;c+=3){var f=nr(o.data[c],o.data[c+1],o.data[c+2]);oc(f,f,l),Zf(f,f),IL(o.data)?o.data.set([f[0],f[1],f[2]],c):(o.data[c]=f[0],o.data[c+1]=f[1],o.data[c+2]=f[2])}}}}]),t}(el),le;(function(r){r[r.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",r[r.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",r[r.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN",r[r.ZERO=0]="ZERO",r[r.ONE=1]="ONE",r[r.SRC_COLOR=768]="SRC_COLOR",r[r.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",r[r.SRC_ALPHA=770]="SRC_ALPHA",r[r.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",r[r.DST_ALPHA=772]="DST_ALPHA",r[r.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",r[r.DST_COLOR=774]="DST_COLOR",r[r.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",r[r.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",r[r.FUNC_ADD=32774]="FUNC_ADD",r[r.BLEND_EQUATION=32777]="BLEND_EQUATION",r[r.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",r[r.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",r[r.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",r[r.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",r[r.MAX_EXT=32776]="MAX_EXT",r[r.MIN_EXT=32775]="MIN_EXT",r[r.BLEND_DST_RGB=32968]="BLEND_DST_RGB",r[r.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",r[r.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",r[r.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",r[r.CONSTANT_COLOR=32769]="CONSTANT_COLOR",r[r.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",r[r.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",r[r.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",r[r.BLEND_COLOR=32773]="BLEND_COLOR",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",r[r.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",r[r.STREAM_DRAW=35040]="STREAM_DRAW",r[r.STATIC_DRAW=35044]="STATIC_DRAW",r[r.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",r[r.BUFFER_SIZE=34660]="BUFFER_SIZE",r[r.BUFFER_USAGE=34661]="BUFFER_USAGE",r[r.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",r[r.FRONT=1028]="FRONT",r[r.BACK=1029]="BACK",r[r.FRONT_AND_BACK=1032]="FRONT_AND_BACK",r[r.CULL_FACE=2884]="CULL_FACE",r[r.BLEND=3042]="BLEND",r[r.DITHER=3024]="DITHER",r[r.STENCIL_TEST=2960]="STENCIL_TEST",r[r.DEPTH_TEST=2929]="DEPTH_TEST",r[r.SCISSOR_TEST=3089]="SCISSOR_TEST",r[r.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",r[r.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",r[r.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",r[r.NO_ERROR=0]="NO_ERROR",r[r.INVALID_ENUM=1280]="INVALID_ENUM",r[r.INVALID_VALUE=1281]="INVALID_VALUE",r[r.INVALID_OPERATION=1282]="INVALID_OPERATION",r[r.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",r[r.CW=2304]="CW",r[r.CCW=2305]="CCW",r[r.LINE_WIDTH=2849]="LINE_WIDTH",r[r.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",r[r.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",r[r.CULL_FACE_MODE=2885]="CULL_FACE_MODE",r[r.FRONT_FACE=2886]="FRONT_FACE",r[r.DEPTH_RANGE=2928]="DEPTH_RANGE",r[r.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",r[r.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",r[r.DEPTH_FUNC=2932]="DEPTH_FUNC",r[r.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",r[r.STENCIL_FUNC=2962]="STENCIL_FUNC",r[r.STENCIL_FAIL=2964]="STENCIL_FAIL",r[r.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",r[r.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",r[r.STENCIL_REF=2967]="STENCIL_REF",r[r.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",r[r.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",r[r.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",r[r.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",r[r.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",r[r.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",r[r.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",r[r.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",r[r.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",r[r.VIEWPORT=2978]="VIEWPORT",r[r.SCISSOR_BOX=3088]="SCISSOR_BOX",r[r.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",r[r.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",r[r.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",r[r.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",r[r.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",r[r.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",r[r.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",r[r.RED_BITS=3410]="RED_BITS",r[r.GREEN_BITS=3411]="GREEN_BITS",r[r.BLUE_BITS=3412]="BLUE_BITS",r[r.ALPHA_BITS=3413]="ALPHA_BITS",r[r.DEPTH_BITS=3414]="DEPTH_BITS",r[r.STENCIL_BITS=3415]="STENCIL_BITS",r[r.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",r[r.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",r[r.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",r[r.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",r[r.SAMPLES=32937]="SAMPLES",r[r.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",r[r.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",r[r.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",r[r.DONT_CARE=4352]="DONT_CARE",r[r.FASTEST=4353]="FASTEST",r[r.NICEST=4354]="NICEST",r[r.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",r[r.BYTE=5120]="BYTE",r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.SHORT=5122]="SHORT",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.INT=5124]="INT",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.FLOAT=5126]="FLOAT",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.ALPHA=6406]="ALPHA",r[r.RGB=6407]="RGB",r[r.RGBA=6408]="RGBA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",r[r.VERTEX_SHADER=35633]="VERTEX_SHADER",r[r.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",r[r.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",r[r.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",r[r.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",r[r.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",r[r.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",r[r.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",r[r.SHADER_TYPE=35663]="SHADER_TYPE",r[r.DELETE_STATUS=35712]="DELETE_STATUS",r[r.LINK_STATUS=35714]="LINK_STATUS",r[r.VALIDATE_STATUS=35715]="VALIDATE_STATUS",r[r.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",r[r.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",r[r.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",r[r.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",r[r.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",r[r.NEVER=512]="NEVER",r[r.LESS=513]="LESS",r[r.EQUAL=514]="EQUAL",r[r.LEQUAL=515]="LEQUAL",r[r.GREATER=516]="GREATER",r[r.NOTEQUAL=517]="NOTEQUAL",r[r.GEQUAL=518]="GEQUAL",r[r.ALWAYS=519]="ALWAYS",r[r.KEEP=7680]="KEEP",r[r.REPLACE=7681]="REPLACE",r[r.INCR=7682]="INCR",r[r.DECR=7683]="DECR",r[r.INVERT=5386]="INVERT",r[r.INCR_WRAP=34055]="INCR_WRAP",r[r.DECR_WRAP=34056]="DECR_WRAP",r[r.VENDOR=7936]="VENDOR",r[r.RENDERER=7937]="RENDERER",r[r.VERSION=7938]="VERSION",r[r.NEAREST=9728]="NEAREST",r[r.LINEAR=9729]="LINEAR",r[r.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",r[r.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",r[r.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",r[r.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",r[r.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",r[r.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",r[r.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",r[r.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE=5890]="TEXTURE",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r[r.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",r[r.TEXTURE0=33984]="TEXTURE0",r[r.TEXTURE1=33985]="TEXTURE1",r[r.TEXTURE2=33986]="TEXTURE2",r[r.TEXTURE3=33987]="TEXTURE3",r[r.TEXTURE4=33988]="TEXTURE4",r[r.TEXTURE5=33989]="TEXTURE5",r[r.TEXTURE6=33990]="TEXTURE6",r[r.TEXTURE7=33991]="TEXTURE7",r[r.TEXTURE8=33992]="TEXTURE8",r[r.TEXTURE9=33993]="TEXTURE9",r[r.TEXTURE10=33994]="TEXTURE10",r[r.TEXTURE11=33995]="TEXTURE11",r[r.TEXTURE12=33996]="TEXTURE12",r[r.TEXTURE13=33997]="TEXTURE13",r[r.TEXTURE14=33998]="TEXTURE14",r[r.TEXTURE15=33999]="TEXTURE15",r[r.TEXTURE16=34e3]="TEXTURE16",r[r.TEXTURE17=34001]="TEXTURE17",r[r.TEXTURE18=34002]="TEXTURE18",r[r.TEXTURE19=34003]="TEXTURE19",r[r.TEXTURE20=34004]="TEXTURE20",r[r.TEXTURE21=34005]="TEXTURE21",r[r.TEXTURE22=34006]="TEXTURE22",r[r.TEXTURE23=34007]="TEXTURE23",r[r.TEXTURE24=34008]="TEXTURE24",r[r.TEXTURE25=34009]="TEXTURE25",r[r.TEXTURE26=34010]="TEXTURE26",r[r.TEXTURE27=34011]="TEXTURE27",r[r.TEXTURE28=34012]="TEXTURE28",r[r.TEXTURE29=34013]="TEXTURE29",r[r.TEXTURE30=34014]="TEXTURE30",r[r.TEXTURE31=34015]="TEXTURE31",r[r.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",r[r.REPEAT=10497]="REPEAT",r[r.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r[r.FLOAT_VEC2=35664]="FLOAT_VEC2",r[r.FLOAT_VEC3=35665]="FLOAT_VEC3",r[r.FLOAT_VEC4=35666]="FLOAT_VEC4",r[r.INT_VEC2=35667]="INT_VEC2",r[r.INT_VEC3=35668]="INT_VEC3",r[r.INT_VEC4=35669]="INT_VEC4",r[r.BOOL=35670]="BOOL",r[r.BOOL_VEC2=35671]="BOOL_VEC2",r[r.BOOL_VEC3=35672]="BOOL_VEC3",r[r.BOOL_VEC4=35673]="BOOL_VEC4",r[r.FLOAT_MAT2=35674]="FLOAT_MAT2",r[r.FLOAT_MAT3=35675]="FLOAT_MAT3",r[r.FLOAT_MAT4=35676]="FLOAT_MAT4",r[r.SAMPLER_2D=35678]="SAMPLER_2D",r[r.SAMPLER_CUBE=35680]="SAMPLER_CUBE",r[r.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",r[r.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",r[r.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",r[r.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",r[r.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",r[r.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",r[r.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",r[r.COMPILE_STATUS=35713]="COMPILE_STATUS",r[r.LOW_FLOAT=36336]="LOW_FLOAT",r[r.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",r[r.HIGH_FLOAT=36338]="HIGH_FLOAT",r[r.LOW_INT=36339]="LOW_INT",r[r.MEDIUM_INT=36340]="MEDIUM_INT",r[r.HIGH_INT=36341]="HIGH_INT",r[r.FRAMEBUFFER=36160]="FRAMEBUFFER",r[r.RENDERBUFFER=36161]="RENDERBUFFER",r[r.RGBA4=32854]="RGBA4",r[r.RGB5_A1=32855]="RGB5_A1",r[r.RGB565=36194]="RGB565",r[r.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",r[r.STENCIL_INDEX=6401]="STENCIL_INDEX",r[r.STENCIL_INDEX8=36168]="STENCIL_INDEX8",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r[r.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",r[r.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",r[r.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",r[r.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",r[r.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",r[r.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",r[r.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",r[r.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",r[r.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",r[r.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",r[r.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",r[r.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",r[r.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",r[r.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",r[r.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",r[r.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",r[r.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",r[r.NONE=0]="NONE",r[r.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",r[r.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",r[r.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",r[r.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",r[r.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",r[r.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",r[r.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",r[r.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",r[r.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",r[r.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",r[r.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",r[r.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",r[r.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",r[r.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",r[r.COPY_SRC=1]="COPY_SRC",r[r.COPY_DST=2]="COPY_DST",r[r.SAMPLED=4]="SAMPLED",r[r.STORAGE=8]="STORAGE",r[r.RENDER_ATTACHMENT=16]="RENDER_ATTACHMENT"})(le||(le={}));var kL,DL,LL,NL,Jg,OL,PL,RL,Sie=(kL=Gr(),DL=Bt(Pe.GeometryComponentManager),LL=Bt(Pe.RenderEngine),kL(NL=(Jg=(RL=function(){function r(){Ct(this,r),Pt(this,"geometry",OL,this),Pt(this,"engine",PL,this)}return Gt(r,[{key:"execute",value:function(){var e=Rr(_t.mark(function n(){var i=this;return _t.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:this.geometry.forEach(function(s,u){u.dirty&&(u.attributes.forEach(function(l){if(l.dirty&&l.data){if(!l.buffer)l.buffer=i.engine.createBuffer({data:l.data,type:le.FLOAT});else{var c;(c=l.buffer)===null||c===void 0||c.subData({data:l.data,offset:0})}l.dirty=!1}}),u.indices&&(u.indicesBuffer?u.indicesBuffer.subData({data:u.indices,offset:0}):u.indicesBuffer=i.engine.createElements({data:u.indices,count:u.indices.length,type:le.UNSIGNED_INT,usage:le.STATIC_DRAW})),u.dirty=!1)});case 1:case"end":return o.stop()}},n,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:"tearDown",value:function(){this.geometry.forEach(function(t,n){n.indicesBuffer&&n.indicesBuffer.destroy(),n.attributes.forEach(function(i){i.buffer&&i.buffer.destroy()})}),this.geometry.clear()}},{key:"createBufferGeometry",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{vertexCount:3},n=t.vertexCount,i=go();return this.geometry.create(i,{vertexCount:n})}},{key:"createInstancedBufferGeometry",value:function(t){var n=t.maxInstancedCount,i=t.vertexCount,a=go();return this.geometry.create(a,{maxInstancedCount:n,vertexCount:i})}}]),r}(),RL),OL=Rt(Jg.prototype,"geometry",[DL],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),PL=Rt(Jg.prototype,"engine",[LL],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Jg))||NL);function BL(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function FL(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?BL(Object(t),!0).forEach(function(n){Ie(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):BL(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Eie(r){var e=Aie();return function(){var n=zr(r),i;if(e){var a=zr(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return xi(this,i)}}function Aie(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}var Tie=function(r){wi(t,r);var e=Eie(t);function t(n){var i;return Ct(this,t),i=e.call(this,n),i.vertexShaderGLSL=void 0,i.fragmentShaderGLSL=void 0,i.defines={},i.dirty=!0,i.uniforms=[],i.cull={enable:!0,face:le.BACK},i.depth={enable:!0},i.blend=void 0,i.entity=void 0,i.type=void 0,Object.assign(wn(i),n),i}return Gt(t,[{key:"setDefines",value:function(i){return this.defines=FL(FL({},this.defines),i),this}},{key:"setCull",value:function(i){return this.cull=i,this}},{key:"setDepth",value:function(i){return this.depth=i,this}},{key:"setBlend",value:function(i){return this.blend=i,this}},{key:"setUniform",value:function(i,a){var o=this;if(typeof i!="string")return Object.keys(i).forEach(function(u){return o.setUniform(u,i[u])}),this;var s=this.uniforms.find(function(u){return u.name===i});return s?(s.dirty=!0,s.data=a):this.uniforms.push({name:i,dirty:!0,data:a}),this.dirty=!0,this}}]),t}(el),UL,GL,zL,$L,VL,Wh,jL,WL,XL,YL;function HL(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function qL(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?HL(Object(t),!0).forEach(function(n){Ie(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):HL(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var Iie=(UL=Gr(),GL=Bt(Pe.MaterialComponentManager),zL=Bt(Pe.RenderEngine),$L=Bt(Pe.ShaderModuleService),UL(VL=(Wh=(YL=function(){function r(){Ct(this,r),Pt(this,"material",jL,this),Pt(this,"engine",WL,this),Pt(this,"shaderModule",XL,this)}return Gt(r,[{key:"execute",value:function(){var e=Rr(_t.mark(function n(){return _t.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:case"end":return a.stop()}},n)}));function t(){return e.apply(this,arguments)}return t}()},{key:"tearDown",value:function(){this.material.clear()}},{key:"createShaderMaterial",value:function(t){var n=go(),i=t.vertexShader,a=t.fragmentShader,o=[];if(!this.engine.supportWebGPU){var s="material-".concat(n);this.shaderModule.registerModule(s,{vs:t.vertexShader,fs:t.fragmentShader});var u=this.shaderModule.getModule(s);i=u.vs,a=u.fs,u.uniforms&&(o=Object.keys(u.uniforms).map(function(l){return{dirty:!0,name:l,data:u.uniforms[l]}}))}return this.material.create(n,qL(qL({vertexShaderGLSL:i,fragmentShaderGLSL:a},t),{},{uniforms:o}))}}]),r}(),YL),jL=Rt(Wh.prototype,"material",[GL],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),WL=Rt(Wh.prototype,"engine",[zL],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),XL=Rt(Wh.prototype,"shaderModule",[$L],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Wh))||VL);function Cie(r){var e=Mie();return function(){var n=zr(r),i;if(e){var a=zr(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return xi(this,i)}}function Mie(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}var Vw;(function(r){r[r.Standard=0]="Standard"})(Vw||(Vw={}));var kie=function(r){wi(t,r);var e=Cie(t);function t(n){var i;return Ct(this,t),i=e.call(this,n),i.strategy=Vw.Standard,i.visibilityPlaneMask=0,i.visible=!1,Object.assign(wn(i),n),i}return t}(el),jw=function(){function r(e,t){Ct(this,r),this.center=void 0,this.halfExtents=void 0,this.min=Vr(),this.max=Vr(),this.update(e,t)}return Gt(r,[{key:"update",value:function(t,n){this.center=t||Vr(),this.halfExtents=n||nr(.5,.5,.5),this.min=Eb(this.min,this.center,this.halfExtents),this.max=Vo(this.max,this.center,this.halfExtents)}},{key:"setMinMax",value:function(t,n){Vo(this.center,n,t),Kf(this.center,this.center,.5),Eb(this.halfExtents,n,t),Kf(this.halfExtents,this.halfExtents,.5),ui(this.min,t),ui(this.max,n)}},{key:"getMin",value:function(){return this.min}},{key:"getMax",value:function(){return this.max}},{key:"add",value:function(t){var n=this.center,i=n[0],a=n[1],o=n[2],s=this.halfExtents,u=s[0],l=s[1],c=s[2],f=i-u,d=i+u,h=a-l,v=a+l,p=o-c,g=o+c,y=t.center,m=y[0],b=y[1],w=y[2],x=t.halfExtents,_=x[0],A=x[1],I=x[2],M=m-_,S=m+_,C=b-A,T=b+A,k=w-I,L=w+I;M<f&&(f=M),S>d&&(d=S),C<h&&(h=C),T>v&&(v=T),k<p&&(p=k),L>g&&(g=L),n[0]=(f+d)*.5,n[1]=(h+v)*.5,n[2]=(p+g)*.5,s[0]=(d-f)*.5,s[1]=(v-h)*.5,s[2]=(g-p)*.5,this.min[0]=f,this.min[1]=h,this.min[2]=p,this.max[0]=d,this.max[1]=v,this.max[2]=g}},{key:"intersects",value:function(t){var n=this.getMax(),i=this.getMin(),a=t.getMax(),o=t.getMin();return i[0]<=a[0]&&n[0]>=o[0]&&i[1]<=a[1]&&n[1]>=o[1]&&i[2]<=a[2]&&n[2]>=o[2]}},{key:"containsPoint",value:function(t){var n=this.getMin(),i=this.getMax();return!(t[0]<n[0]||t[0]>i[0]||t[1]<n[1]||t[1]>i[1]||t[2]<n[2]||t[2]>i[2])}},{key:"getNegativeFarPoint",value:function(t){return t.pnVertexFlag===273?ui(Vr(),this.min):t.pnVertexFlag===272?nr(this.min[0],this.min[1],this.max[2]):t.pnVertexFlag===257?nr(this.min[0],this.max[1],this.min[2]):t.pnVertexFlag===256?nr(this.min[0],this.max[1],this.max[2]):t.pnVertexFlag===17?nr(this.max[0],this.min[1],this.min[2]):t.pnVertexFlag===16?nr(this.max[0],this.min[1],this.max[2]):t.pnVertexFlag===1?nr(this.max[0],this.max[1],this.min[2]):nr(this.max[0],this.max[1],this.max[2])}},{key:"getPositiveFarPoint",value:function(t){return t.pnVertexFlag===273?ui(Vr(),this.max):t.pnVertexFlag===272?nr(this.max[0],this.max[1],this.min[2]):t.pnVertexFlag===257?nr(this.max[0],this.min[1],this.max[2]):t.pnVertexFlag===256?nr(this.max[0],this.min[1],this.min[2]):t.pnVertexFlag===17?nr(this.min[0],this.max[1],this.max[2]):t.pnVertexFlag===16?nr(this.min[0],this.max[1],this.min[2]):t.pnVertexFlag===1?nr(this.min[0],this.min[1],this.max[2]):nr(this.min[0],this.min[1],this.min[2])}}]),r}();function Die(r){var e=Lie();return function(){var n=zr(r),i;if(e){var a=zr(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return xi(this,i)}}function Lie(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}var Nie=function(r){wi(t,r);var e=Die(t);function t(n){var i;return Ct(this,t),i=e.call(this,n),i.material=void 0,i.geometry=void 0,i.aabb=new jw,i.aabbDirty=!0,i.model=void 0,i.visible=!0,i.children=[],Object.assign(wn(i),n),i}return t}(el),Oie=function(){function r(e,t){Ct(this,r),this.distance=void 0,this.normal=void 0,this.pnVertexFlag=void 0,this.distance=e||0,this.normal=t||nr(0,1,0),this.updatePNVertexFlag()}return Gt(r,[{key:"updatePNVertexFlag",value:function(){this.pnVertexFlag=(Number(this.normal[0]>=0)<<8)+(Number(this.normal[1]>=0)<<4)+Number(this.normal[2]>=0)}},{key:"distanceToPoint",value:function(t){return cp(t,this.normal)-this.distance}},{key:"normalize",value:function(){var t=1/JA(this.normal);Kf(this.normal,this.normal,t),this.distance*=t}},{key:"intersectsLine",value:function(t,n,i){var a=this.distanceToPoint(t),o=this.distanceToPoint(n),s=a/(a-o),u=s>=0&&s<=1;return u&&i&&Ou(i,t,n,s),u}}]),r}(),js;(function(r){r[r.OUTSIDE=4294967295]="OUTSIDE",r[r.INSIDE=0]="INSIDE",r[r.INDETERMINATE=2147483647]="INDETERMINATE"})(js||(js={}));var Pie=function(){function r(e){if(Ct(this,r),this.planes=[],e)this.planes=e;else for(var t=0;t<6;t++)this.planes.push(new Oie)}return Gt(r,[{key:"extractFromVPMatrix",value:function(t){var n=Xg(t,16),i=n[0],a=n[1],o=n[2],s=n[3],u=n[4],l=n[5],c=n[6],f=n[7],d=n[8],h=n[9],v=n[10],p=n[11],g=n[12],y=n[13],m=n[14],b=n[15];ac(this.planes[0].normal,s-i,f-u,p-d),this.planes[0].distance=-(b-g),ac(this.planes[1].normal,s+i,f+u,p+d),this.planes[1].distance=-(b+g),ac(this.planes[2].normal,s+a,f+l,p+h),this.planes[2].distance=-(b+y),ac(this.planes[3].normal,s-a,f-l,p-h),this.planes[3].distance=-(b-y),ac(this.planes[4].normal,s-o,f-c,p-v),this.planes[4].distance=-(b-m),ac(this.planes[5].normal,s+o,f+c,p+v),this.planes[5].distance=-(b+m),this.planes.forEach(function(w){w.normalize(),w.updatePNVertexFlag()})}}]),r}();function Rie(r,e){return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[4],e[4]=r[5],e[5]=r[6],e[6]=r[8],e[7]=r[9],e[8]=r[10],e}function Bie(r){var e=Xg(r,3),t=e[0],n=e[1],i=e[2],a=t+n*256+i*65536-1;return a}var KL,ZL,QL,JL,eN,tN,rN,rl,nN,iN,aN,oN,sN,uN;function lN(r,e){var t;if(typeof Symbol=="undefined"||r[Symbol.iterator]==null){if(Array.isArray(r)||(t=Fie(r))||e&&r&&typeof r.length=="number"){t&&(r=t);var n=0,i=function(){};return{s:i,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){t=r[Symbol.iterator]()},n:function(){var l=t.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&t.return!=null&&t.return()}finally{if(o)throw s}}}}function Fie(r,e){if(!!r){if(typeof r=="string")return cN(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return cN(r,e)}}function cN(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}var Uie=(KL=Gr(),ZL=Bt(Pe.MeshComponentManager),QL=Bt(Pe.CullableComponentManager),JL=Bt(Pe.GeometryComponentManager),eN=Bt(Pe.HierarchyComponentManager),tN=Bt(Pe.TransformComponentManager),KL(rN=(rl=(uN=function(){function r(){Ct(this,r),Pt(this,"mesh",nN,this),Pt(this,"cullable",iN,this),Pt(this,"geometry",aN,this),Pt(this,"hierarchy",oN,this),Pt(this,"transform",sN,this),this.planes=void 0}return Gt(r,[{key:"setFrustumPlanes",value:function(t){this.planes=t}},{key:"execute",value:function(){var e=Rr(_t.mark(function n(i){var a,o,s,u,l,c,f,d,h,v,p,g,y,m,b,w,x,_,A,I,M;return _t.wrap(function(C){for(;;)switch(C.prev=C.next){case 0:a=lN(i);try{for(a.s();!(o=a.n()).done;){s=o.value,u=s.getScene(),l=s.getCamera(),c=lN(u.getEntities());try{for(c.s();!(f=c.n()).done;)d=f.value,h=this.mesh.getComponentByEntity(d),h&&(v=this.hierarchy.getComponentByEntity(d),p=this.cullable.getComponentByEntity(d),g=h.geometry,y=this.transform.getComponentByEntity(d),g&&g.aabb&&y&&h.aabbDirty&&(m=y.worldTransform,b=g.aabb,w=b.center,x=b.halfExtents,_=Sb(Vr(),w,m),A=Rie(m,nc()),I=oc(Vr(),x,A),h.aabb.update(_,I),h.aabbDirty=!1),p&&g&&(M=this.cullable.getComponentByEntity((v==null?void 0:v.parentID)||-1),p.visibilityPlaneMask=this.computeVisibilityWithPlaneMask(h.aabb,(M==null?void 0:M.visibilityPlaneMask)||js.INDETERMINATE,this.planes||l.getFrustum().planes),p.visible=p.visibilityPlaneMask!==js.OUTSIDE))}catch(T){c.e(T)}finally{c.f()}}}catch(T){a.e(T)}finally{a.f()}case 2:case"end":return C.stop()}},n,this)}));function t(n){return e.apply(this,arguments)}return t}()},{key:"tearDown",value:function(){this.cullable.clear(),this.mesh.clear()}},{key:"computeVisibilityWithPlaneMask",value:function(t,n,i){if(n===js.OUTSIDE||n===js.INSIDE)return n;for(var a=js.INSIDE,o=0,s=i.length;o<s;++o){var u=o<31?1<<o:0;if(!(o<31&&(n&u)==0)){var l=i[o],c=l.normal,f=l.distance;if(cp(c,t.getNegativeFarPoint(i[o]))+f>0)return js.OUTSIDE;cp(c,t.getPositiveFarPoint(i[o]))+f>0&&(a|=u)}}return a}}]),r}(),uN),nN=Rt(rl.prototype,"mesh",[ZL],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),iN=Rt(rl.prototype,"cullable",[QL],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),aN=Rt(rl.prototype,"geometry",[JL],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),oN=Rt(rl.prototype,"hierarchy",[eN],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),sN=Rt(rl.prototype,"transform",[tN],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),rl))||rN),fN,hN,dN,vN,pN,gN,yN,mN,bN,wN,xN,_N,Wa,SN,EN,AN,TN,IN,CN,MN,kN,DN,LN,NN;function ey(r,e){var t;if(typeof Symbol=="undefined"||r[Symbol.iterator]==null){if(Array.isArray(r)||(t=Gie(r))||e&&r&&typeof r.length=="number"){t&&(r=t);var n=0,i=function(){};return{s:i,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){t=r[Symbol.iterator]()},n:function(){var l=t.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&t.return!=null&&t.return()}finally{if(o)throw s}}}}function Gie(r,e){if(!!r){if(typeof r=="string")return ON(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return ON(r,e)}}function ON(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}var Sc=(fN=Gr(),hN=Bt(Pe.MeshComponentManager),dN=Bt(Pe.GeometryComponentManager),vN=Bt(Pe.MaterialComponentManager),pN=Bt(Pe.CullableComponentManager),gN=Bt(Pe.TransformComponentManager),yN=Bt(Pe.HierarchyComponentManager),mN=Bt(Pe.Systems),bN=yo(Pe.FrameGraphSystem),wN=Bt(Pe.RenderEngine),xN=Bt(Pe.ResourcePool),fN(_N=(Wa=(NN=LN=function(){function r(){var e=this;Ct(this,r),Pt(this,"mesh",SN,this),Pt(this,"geometry",EN,this),Pt(this,"material",AN,this),Pt(this,"cullable",TN,this),Pt(this,"transform",IN,this),Pt(this,"hierarchy",CN,this),Pt(this,"frameGraphSystem",MN,this),Pt(this,"engine",kN,this),Pt(this,"resourcePool",DN,this),this.modelCache={},this.setup=function(t,n,i){var a=t.createRenderTarget(n,"color buffer",{width:1,height:1,usage:le.RENDER_ATTACHMENT|le.SAMPLED|le.COPY_SRC});i.data={output:n.write(t,a)}},this.execute=function(){var t=Rr(_t.mark(function n(i,a,o){var s,u,l,c,f,d;return _t.wrap(function(v){for(;;)switch(v.prev=v.next){case 0:s=i.getResourceNode(a.data.output),u=e.resourcePool.getOrCreateResource(s.resource),l=ey(o),v.prev=3,l.s();case 5:if((c=l.n()).done){v.next=11;break}return f=c.value,v.next=9,e.initView(f);case 9:v.next=5;break;case 11:v.next=16;break;case 13:v.prev=13,v.t0=v.catch(3),l.e(v.t0);case 16:return v.prev=16,l.f(),v.finish(16);case 19:d=e.engine.getCanvas(),u.resize({width:d.width,height:d.height}),e.engine.setScissor({enable:!1}),e.engine.clear({framebuffer:u,color:o[0].getClearColor(),depth:1}),e.engine.useFramebuffer(u,function(){var p=ey(o),g;try{for(p.s();!(g=p.n()).done;){var y=g.value;e.renderView(y)}}catch(m){p.e(m)}finally{p.f()}});case 24:case"end":return v.stop()}},n,null,[[3,13,16,19]])}));return function(n,i,a){return t.apply(this,arguments)}}()}return Gt(r,[{key:"renderView",value:function(t){var n=t.getScene(),i=t.getCamera(),a=i.getViewTransform(),o=Nu(Fi(),i.getPerspective(),a);i.getFrustum().extractFromVPMatrix(o);var s=t.getViewport(),u=s.x,l=s.y,c=s.width,f=s.height;this.engine.viewport({x:u,y:l,width:c,height:f});var d=ey(n.getEntities()),h;try{for(d.s();!(h=d.n()).done;){var v=h.value;this.renderMesh(v,{camera:i,view:t,viewMatrix:a})}}catch(p){d.e(p)}finally{d.f()}}},{key:"renderMesh",value:function(t,n){var i=n.camera,a=n.view,o=n.viewMatrix,s=this.mesh.getComponentByEntity(t);if(!(!s||!s.visible)){var u=s.material,l=s.geometry;if(!(!l||l.dirty||!u)){var c=this.transform.getComponentByEntity(t),f=Nu(Fi(),o,c.worldTransform),d=a.getViewport(),h=d.width,v=d.height;u.setUniform({projectionMatrix:i.getPerspective(),modelViewMatrix:f,modelMatrix:c.worldTransform,viewMatrix:o,cameraPosition:i.getPosition(),u_viewport:[h,v]}),s.model&&(s.model.draw({uniforms:u.uniforms.reduce(function(p,g){return p[g.name]=g.data,p},{})}),u.uniforms.forEach(function(p){p.dirty=!1}),u.dirty=!1)}}}},{key:"initMesh",value:function(){var e=Rr(_t.mark(function n(i,a){var o,s,u,l,c,f,d,h;return _t.wrap(function(p){for(;;)switch(p.prev=p.next){case 0:if(o=this.mesh.getComponentByEntity(i),o){p.next=3;break}return p.abrupt("return");case 3:if(s=o.material,u=o.geometry,!(!u||u.dirty||!s)){p.next=7;break}return p.abrupt("return");case 7:if(o.model){p.next=24;break}if(l="m-".concat(s.entity,"-g-").concat(u.entity),!this.modelCache[l]){p.next=12;break}return o.model=this.modelCache[l],p.abrupt("return");case 12:return s.setUniform({projectionMatrix:1,modelViewMatrix:1,modelMatrix:1,viewMatrix:1,cameraPosition:1,u_viewport:1}),c=this.engine,f=c.createModel,d=c.createAttribute,h={vs:s.vertexShaderGLSL,fs:s.fragmentShaderGLSL,defines:s.defines,attributes:u.attributes.reduce(function(g,y){return y.data&&y.buffer&&(g[y.name]=d({buffer:y.buffer,attributes:y.attributes,arrayStride:y.arrayStride,stepMode:y.stepMode,divisor:y.stepMode==="vertex"?0:1})),g},{}),uniforms:s.uniforms.reduce(function(g,y){return g[y.name]=y.data,g},{}),scissor:{enable:!0,box:function(){return a.getViewport()}}},s.cull&&(h.cull=s.cull),s.depth&&(h.depth=s.depth),s.blend&&(h.blend=s.blend),u.indicesBuffer&&(h.elements=u.indicesBuffer),u.maxInstancedCount&&(h.instances=u.maxInstancedCount,h.count=u.vertexCount||3),p.next=22,f(h);case 22:o.model=p.sent,this.modelCache[l]=o.model;case 24:case"end":return p.stop()}},n,this)}));function t(n,i){return e.apply(this,arguments)}return t}()},{key:"initView",value:function(){var e=Rr(_t.mark(function n(i){var a,o,s,u;return _t.wrap(function(c){for(;;)switch(c.prev=c.next){case 0:a=i.getScene(),o=ey(a.getEntities()),c.prev=2,o.s();case 4:if((s=o.n()).done){c.next=10;break}return u=s.value,c.next=8,this.initMesh(u,i);case 8:c.next=4;break;case 10:c.next=15;break;case 12:c.prev=12,c.t0=c.catch(2),o.e(c.t0);case 15:return c.prev=15,o.f(),c.finish(15);case 18:case"end":return c.stop()}},n,this,[[2,12,15,18]])}));function t(n){return e.apply(this,arguments)}return t}()}]),r}(),LN.IDENTIFIER="Render Pass",NN),SN=Rt(Wa.prototype,"mesh",[hN],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),EN=Rt(Wa.prototype,"geometry",[dN],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),AN=Rt(Wa.prototype,"material",[vN],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),TN=Rt(Wa.prototype,"cullable",[pN],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),IN=Rt(Wa.prototype,"transform",[gN],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),CN=Rt(Wa.prototype,"hierarchy",[yN],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),MN=Rt(Wa.prototype,"frameGraphSystem",[mN,bN],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),kN=Rt(Wa.prototype,"engine",[wN],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),DN=Rt(Wa.prototype,"resourcePool",[xN],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Wa))||_N),PN,RN,BN,FN,UN,GN,Ec,zN,$N,VN,jN,WN,XN;function Ww(r,e){var t;if(typeof Symbol=="undefined"||r[Symbol.iterator]==null){if(Array.isArray(r)||(t=zie(r))||e&&r&&typeof r.length=="number"){t&&(r=t);var n=0,i=function(){};return{s:i,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){t=r[Symbol.iterator]()},n:function(){var l=t.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&t.return!=null&&t.return()}finally{if(o)throw s}}}}function zie(r,e){if(!!r){if(typeof r=="string")return YN(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return YN(r,e)}}function YN(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}var Xw={NONE:0,ENCODE:1,HIGHLIGHT:2},Yw=(PN=Gr(),RN=Bt(Pe.RenderEngine),BN=Bt(Pe.ResourcePool),FN=Bt(Pe.RenderPassFactory),UN=Bt(Pe.MeshComponentManager),PN(GN=(Ec=(XN=WN=function(){function r(){var e=this;Ct(this,r),Pt(this,"engine",zN,this),Pt(this,"resourcePool",$N,this),Pt(this,"renderPassFactory",VN,this),Pt(this,"mesh",jN,this),this.pickingFBO=void 0,this.views=void 0,this.highlightEnabled=!0,this.highlightColor=[255,0,0,255],this.alreadyInRendering=!1,this.setup=function(t,n,i){var a=t.createRenderTarget(n,"picking fbo",{width:1,height:1});i.data={output:n.write(t,a)},n.hasSideEffect=!0},this.execute=function(){var t=Rr(_t.mark(function n(i,a,o){var s,u,l;return _t.wrap(function(f){for(;;)switch(f.prev=f.next){case 0:if(e.views=o,!e.alreadyInRendering){f.next=3;break}return f.abrupt("return");case 3:s=Ww(o);try{for(l=function(){var h=u.value,v=h.getViewport(),p=v.width,g=v.height;e.alreadyInRendering=!0;var y=i.getResourceNode(a.data.output);e.pickingFBO=e.resourcePool.getOrCreateResource(y.resource),e.pickingFBO.resize({width:p,height:g}),e.engine.useFramebuffer(e.pickingFBO,function(){e.engine.clear({framebuffer:e.pickingFBO,color:[0,0,0,0],stencil:0,depth:1});var m=e.renderPassFactory(Sc.IDENTIFIER),b=[],w=h.getScene(),x=Ww(w.getEntities()),_;try{for(x.s();!(_=x.n()).done;){var A=_.value,I=e.mesh.getComponentByEntity(A),M=I.material;M.setUniform("u_PickingStage",Xw.ENCODE),b.push(I)}}catch(S){x.e(S)}finally{x.f()}m.renderView(h),b.forEach(function(S){var C=S.material;C.setUniform("u_PickingStage",Xw.HIGHLIGHT)}),e.alreadyInRendering=!1})},s.s();!(u=s.n()).done;)l()}catch(d){s.e(d)}finally{s.f()}case 5:case"end":return f.stop()}},n)}));return function(n,i,a){return t.apply(this,arguments)}}(),this.pick=function(t,n){var i=t.x,a=t.y,o=e.engine,s=o.readPixels,u=o.useFramebuffer,l=n.getViewport(),c=l.width,f=l.height,d=i*window.devicePixelRatio,h=a*window.devicePixelRatio;if(!(d>c||d<0||h>f||h<0)){var v,p;return u(e.pickingFBO,function(){v=s({x:Math.round(d),y:Math.round(f-(a+1)*window.devicePixelRatio),width:1,height:1,data:new Uint8Array(1*1*4),framebuffer:e.pickingFBO}),(v[0]!==0||v[1]!==0||v[2]!==0)&&(p=Bie(v),e.highlightEnabled&&e.highlightPickedFeature(v,n))}),p}}}return Gt(r,[{key:"enableHighlight",value:function(t){this.highlightEnabled=t}},{key:"setHighlightColor",value:function(t){this.highlightColor=t}},{key:"highlightPickedFeature",value:function(t,n){if(t){var i=Ww(n.getScene().getEntities()),a;try{for(i.s();!(a=i.n()).done;){var o=a.value,s=this.mesh.getComponentByEntity(o),u=s.material;u.setUniform("u_PickingStage",Xw.HIGHLIGHT),u.setUniform("u_PickingColor",[t[0],t[1],t[2]]),u.setUniform("u_HighlightColor",this.highlightColor)}}catch(l){i.e(l)}finally{i.f()}}}}]),r}(),WN.IDENTIFIER="PixelPicking Pass",XN),zN=Rt(Ec.prototype,"engine",[RN],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),$N=Rt(Ec.prototype,"resourcePool",[BN],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),VN=Rt(Ec.prototype,"renderPassFactory",[FN],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),jN=Rt(Ec.prototype,"mesh",[UN],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Ec))||GN),HN,qN,KN,ZN,ty,QN,JN,eO,tO,$ie=`varying vec2 v_UV;

uniform sampler2D u_Texture;

void main() {
  gl_FragColor = vec4(texture2D(u_Texture, v_UV));
}`,Vie=`attribute vec2 a_Position;

varying vec2 v_UV;

void main() {
  v_UV = 0.5 * (a_Position + 1.0);
  gl_Position = vec4(a_Position, 0., 1.);
}`,jie=`layout(set = 0, binding = 0) uniform sampler u_TextureSampler;
layout(set = 0, binding = 1) uniform texture2D u_Texture;

layout(location = 0) in vec2 v_UV;
layout(location = 0) out vec4 outColor;

void main() {
  outColor = texture(sampler2D(u_Texture, u_TextureSampler), v_UV);
}`,Wie=`layout(location = 0) in vec2 a_Position;
layout(location = 0) out vec2 v_UV;

void main() {
  v_UV = 0.5 * (a_Position + 1.0);
  gl_Position = vec4(a_Position, 0., 1.);
}`,ry=(HN=Gr(),qN=Bt(Pe.RenderEngine),KN=Bt(Pe.ResourcePool),HN(ZN=(ty=(tO=eO=function r(){var e=this;Ct(this,r),Pt(this,"engine",QN,this),Pt(this,"resourcePool",JN,this),this.model=void 0,this.setup=function(t,n,i){var a=t.getPass(Sc.IDENTIFIER);if(a){var o=t.createRenderTarget(n,"render to screen",{width:1,height:1});i.data={input:n.read(a.data.output),output:n.write(t,o)}}},this.execute=function(){var t=Rr(_t.mark(function n(i,a){var o,s,u,l,c,f,d;return _t.wrap(function(v){for(;;)switch(v.prev=v.next){case 0:if(o=e.engine,s=o.createModel,u=o.createAttribute,l=o.createBuffer,e.model){v.next=6;break}return v.next=4,s({vs:e.engine.supportWebGPU?Wie:Vie,fs:e.engine.supportWebGPU?jie:$ie,attributes:{a_Position:u({buffer:l({data:[-4,-4,4,-4,0,4],type:le.FLOAT}),size:2,arrayStride:2*4,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float2"}]})},uniforms:{u_Texture:null},depth:{enable:!1},count:3,blend:{enable:!0}});case 4:c=v.sent,e.model=c;case 6:f=i.getResourceNode(a.data.input),d=e.resourcePool.getOrCreateResource(f.resource),e.engine.useFramebuffer(null,function(){e.engine.clear({framebuffer:null,color:[0,0,0,0],depth:1,stencil:0}),e.model.draw({uniforms:{u_Texture:d}})});case 9:case"end":return v.stop()}},n)}));return function(n,i){return t.apply(this,arguments)}}(),this.tearDown=function(){e.model=void 0}},eO.IDENTIFIER="Copy Pass",tO),QN=Rt(ty.prototype,"engine",[qN],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),JN=Rt(ty.prototype,"resourcePool",[KN],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),ty))||ZN),rO,nO,iO,aO,oO,sO,uO,Ac,lO,cO,fO,hO,dO,Xie=(rO=Gr(),nO=Bt(Pe.Systems),iO=yo(Pe.FrameGraphSystem),aO=Bt(Pe.RenderPassFactory),oO=Bt(Pe.ConfigService),sO=Bt(Pe.ResourcePool),rO(uO=(Ac=(dO=function(){function r(){Ct(this,r),Pt(this,"frameGraphSystem",lO,this),Pt(this,"renderPassFactory",cO,this),Pt(this,"configService",fO,this),Pt(this,"resourcePool",hO,this)}return Gt(r,[{key:"execute",value:function(){var e=Rr(_t.mark(function n(i){var a,o,s,u,l,c,f,d;return _t.wrap(function(v){for(;;)switch(v.prev=v.next){case 0:a=this.renderPassFactory(Sc.IDENTIFIER),o=a.setup,s=a.execute,this.frameGraphSystem.addPass(Sc.IDENTIFIER,o,s),u=this.renderPassFactory(ry.IDENTIFIER),l=u.setup,c=u.execute,f=u.tearDown,d=this.frameGraphSystem.addPass(ry.IDENTIFIER,l,c,f),this.frameGraphSystem.present(d.data.output);case 5:case"end":return v.stop()}},n,this)}));function t(n){return e.apply(this,arguments)}return t}()},{key:"tearDown",value:function(){this.resourcePool.clean()}},{key:"pick",value:function(t,n){var i=this.renderPassFactory(Yw.IDENTIFIER);return i.pick(t,n)}}]),r}(),dO),lO=Rt(Ac.prototype,"frameGraphSystem",[nO,iO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),cO=Rt(Ac.prototype,"renderPassFactory",[aO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),fO=Rt(Ac.prototype,"configService",[oO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),hO=Rt(Ac.prototype,"resourcePool",[sO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Ac))||uO);function Yie(r){var e=Hie();return function(){var n=zr(r),i;if(e){var a=zr(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return xi(this,i)}}function Hie(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}var qie=function(r){wi(t,r);var e=Yie(t);function t(n){var i;return Ct(this,t),i=e.call(this,n),i.parentID=void 0,Object.assign(wn(i),n),i}return t}(el),vO,pO,gO,yO,mO,Xh,bO,wO,xO,_O,Kie=(vO=Gr(),pO=Bt(Pe.HierarchyComponentManager),gO=Bt(Pe.TransformComponentManager),yO=Bt(Pe.MeshComponentManager),vO(mO=(Xh=(_O=function(){function r(){Ct(this,r),Pt(this,"hierarchy",bO,this),Pt(this,"transform",wO,this),Pt(this,"mesh",xO,this)}return Gt(r,[{key:"execute",value:function(){var e=Rr(_t.mark(function n(){return _t.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:this.runTransformUpdateSystem(),this.runHierarchyUpdateSystem();case 2:case"end":return a.stop()}},n,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:"tearDown",value:function(){this.hierarchy.clear(),this.transform.clear()}},{key:"getHierarchyComponentManager",value:function(){return this.hierarchy}},{key:"getTransformComponentManager",value:function(){return this.transform}},{key:"runTransformUpdateSystem",value:function(){var t=this;this.transform.forEach(function(n,i){(i.isDirty()||i.isLocalDirty())&&(t.setMeshAABBDirty(t.mesh.getComponentByEntity(n)),i.updateTransform())})}},{key:"runHierarchyUpdateSystem",value:function(){var t=this;this.hierarchy.forEach(function(n,i){var a=t.transform.getComponentByEntity(n),o=t.transform.getComponentByEntity(i.parentID);a!==null&&o!==null&&a.updateTransformWithParent(o)})}},{key:"attach",value:function(t,n,i){this.hierarchy.contains(t)&&this.detach(t),this.hierarchy.create(t,{parentID:n});var a=this.mesh.getComponentByEntity(n);if(this.setMeshAABBDirty(a),a&&a.children.indexOf(t)===-1&&a.children.push(t),this.hierarchy.getCount()>1)for(var o=this.hierarchy.getCount()-1;o>0;--o)for(var s=this.hierarchy.getEntity(o),u=0;u<o;++u){var l=this.hierarchy.getComponent(u);if(l.parentID===s){this.hierarchy.moveItem(o,u),++o;break}}this.hierarchy.getComponentByEntity(t);var c=this.transform.getComponentByEntity(n);c===null&&(c=this.transform.create(n));var f=this.transform.getComponentByEntity(t);f===null&&(f=this.transform.create(t),c=this.transform.getComponentByEntity(n)),f.parent=c,!i&&c&&(f.matrixTransform(up(Fi(),c.worldTransform)),f.updateTransform()),c&&f.updateTransformWithParent(c)}},{key:"detach",value:function(t){var n=this.hierarchy.getComponentByEntity(t);if(n!==null){var i=this.transform.getComponentByEntity(t);i!==null&&(i.parent=null,i.applyTransform()),this.hierarchy.removeKeepSorted(t);var a=this.mesh.getComponentByEntity(n.parentID);if(a){var o=a.children.indexOf(t);a.children.splice(o,1)}this.setMeshAABBDirty(a)}}},{key:"detachChildren",value:function(t){var n=this.mesh.getComponentByEntity(t);n&&(n.children=[]);for(var i=0;i<this.hierarchy.getCount();){var a;if(((a=this.hierarchy.getComponent(i))===null||a===void 0?void 0:a.parentID)===t){var o=this.hierarchy.getEntity(i);this.detach(o)}else++i}}},{key:"setMeshAABBDirty",value:function(t){t&&(t.aabbDirty=!0)}}]),r}(),_O),bO=Rt(Xh.prototype,"hierarchy",[pO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),wO=Rt(Xh.prototype,"transform",[gO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),xO=Rt(Xh.prototype,"mesh",[yO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Xh))||mO);function Zie(r){var e=Qie();return function(){var n=zr(r),i;if(e){var a=zr(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return xi(this,i)}}function Qie(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}var SO=function(r){wi(t,r);var e=Zie(t);function t(n){var i;return Ct(this,t),i=e.call(this,n),i.dirtyFlag=void 0,i.localDirtyFlag=void 0,i.parent=null,i.localPosition=nr(0,0,0),i.localRotation=Tb(0,0,0,1),i.localScale=nr(1,1,1),i.localTransform=Fi(),i.position=nr(0,0,0),i.rotation=Tb(0,0,0,1),i.scaling=nr(1,1,1),i.worldTransform=Fi(),i.matrixTransform=function(){var a=Fi();return function(o){Nu(a,i.getLocalTransform(),o),ic(i.localScale,a),Hf(i.localPosition,a),qf(i.localRotation,a)}}(),i.rotateRollPitchYaw=function(){var a=Vn(),o=Vn(),s=Vn();return function(u,l,c){i.setDirty(),Ab(a,u,0,0),Ab(o,0,l,0),Ab(s,0,0,c),da(i.localRotation,a,i.localRotation),da(i.localRotation,i.localRotation,o),da(i.localRotation,s,i.localRotation),sc(i.localRotation,i.localRotation)}}(),i.lerp=function(){var a=Vr(),o=Vn(),s=Vr(),u=Vr(),l=Vn(),c=Vr();return function(f,d,h){i.setDirty(),ic(a,f.worldTransform),Hf(s,f.worldTransform),qf(o,f.worldTransform),ic(u,d.worldTransform),Hf(c,d.worldTransform),qf(l,d.worldTransform),Ou(i.localScale,a,u,h),fp(i.localRotation,o,l,h),Ou(i.localPosition,s,c,h)}}(),i.translate=function(){var a=Vr();return function(o){return Vo(a,i.getPosition(),o),i.setPosition(a),i.setDirty(!0),wn(i)}}(),i.translateLocal=function(){return function(a){return aW(a,a,i.localRotation),Vo(i.localPosition,i.localPosition,a),i.setLocalDirty(!0),wn(i)}}(),i.setPosition=function(){var a=Fi();return function(o){return i.position=o,i.setLocalDirty(!0),i.parent===null?ui(i.localPosition,o):(wb(a,i.parent.worldTransform),up(a,a),Sb(i.localPosition,o,a)),wn(i)}}(),i.rotate=function(){var a=Vn();return function(o){if(i.parent===null)da(i.localRotation,i.localRotation,o),sc(i.localRotation,i.localRotation);else{var s=i.getRotation(),u=i.parent.getRotation();eh(a,u),tT(a,a),da(a,a,o),da(i.localRotation,o,s),sc(i.localRotation,i.localRotation)}return i.setLocalDirty(),wn(i)}}(),i.rotateLocal=function(){return function(a){return da(i.localRotation,i.localRotation,a),sc(i.localRotation,i.localRotation),i.setLocalDirty(!0),wn(i)}}(),i.setRotation=function(){var a=Vn();return function(o){return i.parent===null?eh(i.localRotation,o):(eh(a,i.parent.getRotation()),tT(a,a),eh(i.localRotation,a),lW(i.localRotation,i.localRotation,o)),i.setLocalDirty(!0),wn(i)}}(),i}return Gt(t,[{key:"setLocalPosition",value:function(i){ui(this.localPosition,i),this.setLocalDirty(!0)}},{key:"setLocalScale",value:function(i){ui(this.localScale,i),this.setLocalDirty(!0)}},{key:"setLocalRotation",value:function(i){return eh(this.localRotation,i),this.setLocalDirty(!0),this}},{key:"isDirty",value:function(){return this.dirtyFlag}},{key:"setDirty",value:function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;i?this.dirtyFlag|=t.DIRTY:this.dirtyFlag&=~t.DIRTY}},{key:"isLocalDirty",value:function(){return this.localDirtyFlag}},{key:"setLocalDirty",value:function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;i?(this.localDirtyFlag|=t.DIRTY,this.setDirty(!0)):this.localDirtyFlag&=~t.DIRTY}},{key:"updateTransform",value:function(){this.isLocalDirty()&&this.getLocalTransform(),this.isDirty()&&this.parent===null&&(wb(this.worldTransform,this.getLocalTransform()),this.setDirty(!1))}},{key:"updateTransformWithParent",value:function(i){Nu(this.worldTransform,i.worldTransform,this.getLocalTransform())}},{key:"applyTransform",value:function(){this.setDirty(),ic(this.localScale,this.worldTransform),Hf(this.localPosition,this.worldTransform),qf(this.localRotation,this.worldTransform)}},{key:"clearTransform",value:function(){this.setDirty(),this.localPosition=nr(0,0,0),this.localRotation=Tb(0,0,0,1),this.localScale=nr(1,1,1)}},{key:"scaleLocal",value:function(i){return this.setLocalDirty(),nW(this.localScale,this.localScale,i),this}},{key:"getLocalPosition",value:function(){return this.localPosition}},{key:"getLocalRotation",value:function(){return this.localRotation}},{key:"getLocalScale",value:function(){return this.localScale}},{key:"getLocalTransform",value:function(){return this.localDirtyFlag&&(Zj(this.localTransform,this.localRotation,this.localPosition,this.localScale),this.setLocalDirty(!1)),this.localTransform}},{key:"getWorldTransform",value:function(){return!this.isLocalDirty()&&!this.isDirty()?this.worldTransform:(this.parent&&this.parent.getWorldTransform(),this.updateTransform(),this.worldTransform)}},{key:"getPosition",value:function(){return Hf(this.position,this.worldTransform),this.position}},{key:"getRotation",value:function(){return qf(this.rotation,this.worldTransform),this.rotation}},{key:"getScale",value:function(){return ic(this.scaling,this.worldTransform),this.scaling}}]),t}(el);SO.DIRTY=1<<0;var EO,AO,TO,Hw,IO,CO,Jie=(EO=Gr(),AO=Bt(Pe.RenderEngine),EO(TO=(Hw=(CO=function(){function r(){Ct(this,r),Pt(this,"engine",IO,this),this.resourcePool={}}return Gt(r,[{key:"getOrCreateResource",value:function(t){if(!this.resourcePool[t.name]){var n=t.descriptor,i=n.width,a=n.height,o=n.usage;this.resourcePool[t.name]=this.engine.createFramebuffer({color:this.engine.createTexture2D({width:i,height:a,wrapS:le.CLAMP_TO_EDGE,wrapT:le.CLAMP_TO_EDGE,usage:o})})}return this.resourcePool[t.name]}},{key:"clean",value:function(){this.resourcePool={}}}]),r}(),CO),IO=Rt(Hw.prototype,"engine",[AO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Hw))||TO);function eae(r){var e=tae();return function(){var n=zr(r),i;if(e){var a=zr(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return xi(this,i)}}function tae(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}var rae=function(r){wi(t,r);var e=eae(t);function t(n){var i;return Ct(this,t),i=e.call(this,n),i.name=void 0,i.name=n.name||"",i}return t}(el),MO,kO,DO,nae=(MO=Gr(),MO(kO=(DO=function(){function r(){Ct(this,r),this.config=void 0}return Gt(r,[{key:"get",value:function(){return this.config}},{key:"set",value:function(t){this.config=t}}]),r}(),DO))||kO),LO,NO,OO;(function(r){r.PANSTART="PANSTART",r.PANEND="PANEND",r.PANMOVE="PANMOVE",r.PINCH="PINCH",r.KEYDOWN="KEYDOWN",r.KEYUP="KEYUP",r.HOVER="HOVER"})(OO||(OO={}));var iae=(LO=Gr(),LO(NO=function(){function r(){Ct(this,r)}return Gt(r,[{key:"listen",value:function(t){}},{key:"on",value:function(t,n){}},{key:"connect",value:function(){}},{key:"disconnect",value:function(){}},{key:"destroy",value:function(){}}]),r}())||NO);function aae(r){var e=0;switch(r){case"vec2":case"ivec2":e=2;break;case"vec3":case"ivec3":e=3;break;case"vec4":case"ivec4":case"mat2":e=4;break;case"mat3":e=9;break;case"mat4":e=16;break}return e}var oae=/uniform\s+(bool|float|int|vec2|vec3|vec4|ivec2|ivec3|ivec4|mat2|mat3|mat4|sampler2D|samplerCube)\s+([\s\S]*?);/g;function PO(r){var e={};return r=r.replace(oae,function(t,n,i){var a=i.split(":"),o=a[0].trim(),s="";switch(a.length>1&&(s=a[1].trim()),n){case"bool":s=s==="true";break;case"float":case"int":s=Number(s);break;case"vec2":case"vec3":case"vec4":case"ivec2":case"ivec3":case"ivec4":case"mat2":case"mat3":case"mat4":s?s=s.replace("[","").replace("]","").split(",").reduce(function(u,l){return u.push(Number(l.trim())),u},[]):s=new Array(aae(n)).fill(0);break}return e[o]=s,"uniform ".concat(n," ").concat(o,`;
`)}),{content:r,uniforms:e}}function sae(r){return r.filter(function(e,t,n){return n.indexOf(e)===t})}var RO,BO,FO;function UO(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Yh(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?UO(Object(t),!0).forEach(function(n){Ie(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):UO(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var uae=`varying vec4 v_PickingResult;
uniform vec4 u_HighlightColor : [0, 0, 0, 0];
uniform float u_PickingStage : 0.0;

#define PICKING_ENCODE 1.0
#define PICKING_HIGHLIGHT 2.0
#define COLOR_SCALE 1. / 255.

/*
 * Returns highlight color if this item is selected.
 */
vec4 filterHighlightColor(vec4 color) {
  bool selected = bool(v_PickingResult.a);

  if (selected) {
    vec4 highLightColor = u_HighlightColor * COLOR_SCALE;

    float highLightAlpha = highLightColor.a;
    float highLightRatio = highLightAlpha / (highLightAlpha + color.a * (1.0 - highLightAlpha));

    vec3 resultRGB = mix(color.rgb, highLightColor.rgb, highLightRatio);
    return vec4(resultRGB, color.a);
  } else {
    return color;
  }
}

/*
 * Returns picking color if picking enabled else unmodified argument.
 */
vec4 filterPickingColor(vec4 color) {
  vec3 pickingColor = v_PickingResult.rgb;
  if (u_PickingStage == PICKING_ENCODE && length(pickingColor) < 0.001) {
    discard;
  }
  return u_PickingStage == PICKING_ENCODE ? vec4(pickingColor, step(0.001,color.a)): color;
}

/*
 * Returns picking color if picking is enabled if not
 * highlight color if this item is selected, otherwise unmodified argument.
 */
vec4 filterColor(vec4 color) {
  return filterPickingColor(filterHighlightColor(color));
}
`,lae=`attribute vec3 a_PickingColor;
varying vec4 v_PickingResult;

uniform vec3 u_PickingColor : [0, 0, 0];
uniform vec4 u_HighlightColor : [0, 0, 0, 0];
uniform float u_PickingStage : 0.0;
uniform float u_PickingThreshold : 1.0;
uniform float u_PickingBuffer: 0.0;

#define PICKING_ENCODE 1.0
#define PICKING_HIGHLIGHT 2.0
#define COLOR_SCALE 1. / 255.

bool isVertexPicked(vec3 vertexColor) {
  return
    abs(vertexColor.r - u_PickingColor.r) < u_PickingThreshold &&
    abs(vertexColor.g - u_PickingColor.g) < u_PickingThreshold &&
    abs(vertexColor.b - u_PickingColor.b) < u_PickingThreshold;
}

void setPickingColor(vec3 pickingColor) {
  // compares only in highlight stage
  v_PickingResult.a = float((u_PickingStage == PICKING_HIGHLIGHT) && isVertexPicked(pickingColor));

  // Stores the picking color so that the fragment shader can render it during picking
  v_PickingResult.rgb = pickingColor * COLOR_SCALE;
}

float setPickingSize(float x) {
   return u_PickingStage == PICKING_ENCODE ? x + u_PickingBuffer : x;
}`,cae=`/**
 * 2D signed distance field functions
 * @see http://www.iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
 */

float ndot(vec2 a, vec2 b ) { return a.x*b.x - a.y*b.y; }

float sdCircle(vec2 p, float r) {
  return length(p) - r;
}

float sdEquilateralTriangle(vec2 p) {
  float k = sqrt(3.0);
  p.x = abs(p.x) - 1.0;
  p.y = p.y + 1.0/k;
  if( p.x + k*p.y > 0.0 ) p = vec2(p.x-k*p.y,-k*p.x-p.y)/2.0;
  p.x -= clamp( p.x, -2.0, 0.0 );
  return -length(p)*sign(p.y);
}

float sdBox(vec2 p, vec2 b) {
  vec2 d = abs(p)-b;
  return length(max(d,vec2(0))) + min(max(d.x,d.y),0.0);
}

float sdPentagon(vec2 p, float r) {
  vec3 k = vec3(0.809016994,0.587785252,0.726542528);
  p.x = abs(p.x);
  p -= 2.0*min(dot(vec2(-k.x,k.y),p),0.0)*vec2(-k.x,k.y);
  p -= 2.0*min(dot(vec2( k.x,k.y),p),0.0)*vec2( k.x,k.y);
  p -= vec2(clamp(p.x,-r*k.z,r*k.z),r);
  return length(p)*sign(p.y);
}

float sdHexagon(vec2 p, float r) {
  vec3 k = vec3(-0.866025404,0.5,0.577350269);
  p = abs(p);
  p -= 2.0*min(dot(k.xy,p),0.0)*k.xy;
  p -= vec2(clamp(p.x, -k.z*r, k.z*r), r);
  return length(p)*sign(p.y);
}

float sdOctogon(vec2 p, float r) {
  vec3 k = vec3(-0.9238795325, 0.3826834323, 0.4142135623 );
  p = abs(p);
  p -= 2.0*min(dot(vec2( k.x,k.y),p),0.0)*vec2( k.x,k.y);
  p -= 2.0*min(dot(vec2(-k.x,k.y),p),0.0)*vec2(-k.x,k.y);
  p -= vec2(clamp(p.x, -k.z*r, k.z*r), r);
  return length(p)*sign(p.y);
}

float sdHexagram(vec2 p, float r) {
  vec4 k=vec4(-0.5,0.8660254038,0.5773502692,1.7320508076);
  p = abs(p);
  p -= 2.0*min(dot(k.xy,p),0.0)*k.xy;
  p -= 2.0*min(dot(k.yx,p),0.0)*k.yx;
  p -= vec2(clamp(p.x,r*k.z,r*k.w),r);
  return length(p)*sign(p.y);
}

float sdRhombus(vec2 p, vec2 b) {
  vec2 q = abs(p);
  float h = clamp((-2.0*ndot(q,b)+ndot(b,b))/dot(b,b),-1.0,1.0);
  float d = length( q - 0.5*b*vec2(1.0-h,1.0+h) );
  return d * sign( q.x*b.y + q.y*b.x - b.x*b.y );
}

float sdVesica(vec2 p, float r, float d) {
  p = abs(p);
  float b = sqrt(r*r-d*d); // can delay this sqrt
  return ((p.y-b)*d>p.x*b)
          ? length(p-vec2(0.0,b))
          : length(p-vec2(-d,0.0))-r;
}`,fae=/precision\s+(high|low|medium)p\s+float/,hae=`#ifdef GL_FRAGMENT_PRECISION_HIGH
 precision highp float;
 #else
 precision mediump float;
#endif
`,dae=/#pragma include (["^+"]?["\ "[a-zA-Z_0-9](.*)"]*?)/g,vae=(RO=Gr(),RO(BO=(FO=function(){function r(){Ct(this,r),this.moduleCache={},this.rawContentCache={}}return Gt(r,[{key:"registerBuiltinModules",value:function(){this.destroy(),this.registerModule("picking",{vs:lae,fs:uae}),this.registerModule("sdf2d",{vs:"",fs:cae})}},{key:"registerModule",value:function(t,n){if(!this.rawContentCache[t]){var i=n.vs,a=i===void 0?"":i,o=n.fs,s=o===void 0?"":o,u=n.uniforms,l=PO(a),c=l.content,f=l.uniforms,d=PO(s),h=d.content,v=d.uniforms;this.rawContentCache[t]={fs:h,uniforms:Yh(Yh(Yh({},f),v),u),vs:c}}}},{key:"destroy",value:function(){this.moduleCache={},this.rawContentCache={}}},{key:"getModule",value:function(t){var n=this;if(this.moduleCache[t])return this.moduleCache[t];var i=this.rawContentCache[t].vs||"",a=this.rawContentCache[t].fs||"",o=this.processModule(i,[],"vs"),s=o.content,u=o.includeList,l=this.processModule(a,[],"fs"),c=l.content,f=l.includeList,d=c,h=sae(u.concat(f).concat(t)).reduce(function(v,p){return Yh(Yh({},v),n.rawContentCache[p].uniforms)},{});return fae.test(c)||(d=hae+c),this.moduleCache[t]={fs:d.trim(),uniforms:h,vs:s.trim()},this.moduleCache[t]}},{key:"processModule",value:function(t,n,i){var a=this,o=t.replace(dae,function(s,u){var l=u.split(" "),c=l[0].replace(/"/g,"");if(n.indexOf(c)>-1)return"";var f=a.rawContentCache[c][i];n.push(c);var d=a.processModule(f||"",n,i),h=d.content;return h});return{content:o,includeList:n}}}]),r}(),FO))||BO),Jo=new bL;Jo.bind(Pe.ShaderModuleService).to(vae).inSingletonScope();Jo.bind(Pe.NameComponentManager).toConstantValue(new tl(rae));Jo.bind(Pe.HierarchyComponentManager).toConstantValue(new tl(qie));Jo.bind(Pe.TransformComponentManager).toConstantValue(new tl(SO));Jo.bind(Pe.MeshComponentManager).toConstantValue(new tl(Nie));Jo.bind(Pe.CullableComponentManager).toConstantValue(new tl(kie));Jo.bind(Pe.GeometryComponentManager).toConstantValue(new tl(_ie));Jo.bind(Pe.MaterialComponentManager).toConstantValue(new tl(Tie));function pae(){var r=new bL;return r.parent=Jo,r.bind(Pe.Systems).to(Kie).inSingletonScope().whenTargetNamed(Pe.SceneGraphSystem),r.bind(Pe.Systems).to(Vne).inSingletonScope().whenTargetNamed(Pe.FrameGraphSystem),r.bind(Pe.Systems).to(Uie).inSingletonScope().whenTargetNamed(Pe.MeshSystem),r.bind(Pe.Systems).to(Sie).inSingletonScope().whenTargetNamed(Pe.GeometrySystem),r.bind(Pe.Systems).to(Iie).inSingletonScope().whenTargetNamed(Pe.MaterialSystem),r.bind(Pe.Systems).to(Xie).inSingletonScope().whenTargetNamed(Pe.RendererSystem),r.bind(Pe.ResourcePool).to(Jie).inSingletonScope(),r.bind(Pe.ConfigService).to(nae).inSingletonScope(),r.bind(Pe.InteractorService).to(iae).inSingletonScope(),r.bind(Pe.RenderPass).to(Sc).inSingletonScope().whenTargetNamed(Sc.IDENTIFIER),r.bind(Pe.RenderPass).to(ry).inSingletonScope().whenTargetNamed(ry.IDENTIFIER),r.bind(Pe.RenderPass).to(Yw).inSingletonScope().whenTargetNamed(Yw.IDENTIFIER),r.bind(Pe.RenderPassFactory).toFactory(function(e){return function(t){return e.container.getNamed(Pe.RenderPass,t)}}),r}function qw(r){for(var e=new jw,t=nr(r[0],r[1],r[2]),n=nr(r[0],r[1],r[2]),i=3;i<r.length;){var a=r[i++],o=r[i++],s=r[i++];a<t[0]&&(t[0]=a),o<t[1]&&(t[1]=o),s<t[2]&&(t[2]=s),a>n[0]&&(n[0]=a),o>n[1]&&(n[1]=o),s>n[2]&&(n[2]=s)}return e.setMinMax(t,n),e}var $i=typeof navigator!="undefined"&&/Version\/[\d\.]+.*Safari/.test(navigator.userAgent);Vr();Vr();Vr();Vr();Vr();Vr();var GO;(function(r){r.Normal="normal",r.PostProcessing="post-processing"})(GO||(GO={}));var nl;(function(r){r.Void="Void",r.Boolean="Boolean",r.Float="Float",r.Uint32="Uint32",r.Int32="Int32",r.Vector="Vector",r.Vector2Float="vec2<f32>",r.Vector3Float="vec3<f32>",r.Vector4Float="vec4<f32>",r.Vector2Boolean="vec2<bool>",r.Vector3Boolean="vec3<bool>",r.Vector4Boolean="vec4<bool>",r.Vector2Uint="vec2<u32>",r.Vector3Uint="vec3<u32>",r.Vector4Uint="vec4<u32>",r.Vector2Int="vec2<i32>",r.Vector3Int="vec3<i32>",r.Vector4Int="vec4<i32>",r.Matrix="Matrix",r.Matrix3x3Float="mat3x3<f32>",r.Matrix4x4Float="mat4x4<i32>",r.Struct="Struct",r.FloatArray="Float[]",r.Vector4FloatArray="vec4<f32>[]"})(nl||(nl={}));var zO;(function(r){r.Program="Program",r.Identifier="Identifier",r.VariableDeclaration="VariableDeclaration",r.BlockStatement="BlockStatement",r.ReturnStatement="ReturnStatement",r.FunctionDeclaration="FunctionDeclaration",r.VariableDeclarator="VariableDeclarator",r.AssignmentExpression="AssignmentExpression",r.LogicalExpression="LogicalExpression",r.BinaryExpression="BinaryExpression",r.ArrayExpression="ArrayExpression",r.UnaryExpression="UnaryExpression",r.UpdateExpression="UpdateExpression",r.FunctionExpression="FunctionExpression",r.MemberExpression="MemberExpression",r.ConditionalExpression="ConditionalExpression",r.ExpressionStatement="ExpressionStatement",r.CallExpression="CallExpression",r.NumThreadStatement="NumThreadStatement",r.StorageStatement="StorageStatement",r.DoWhileStatement="DoWhileStatement",r.WhileStatement="WhileStatement",r.ForStatement="ForStatement",r.BreakStatement="BreakStatement",r.ContinueStatement="ContinueStatement",r.IfStatement="IfStatement",r.ImportedFunctionStatement="ImportedFunctionStatement"})(zO||(zO={}));var Ws;(function(r){r.Input="Input",r.Output="Output",r.Uniform="Uniform",r.Workgroup="Workgroup",r.UniformConstant="UniformConstant",r.Image="Image",r.StorageBuffer="StorageBuffer",r.Private="Private",r.Function="Function"})(Ws||(Ws={}));var Hh;(function(r){r.GLSL100="GLSL100",r.GLSL450="GLSL450",r.WGSL="WGSL"})(Hh||(Hh={}));var gae="__DefineValuePlaceholder__";function Kw(r){return typeof r=="number"}function es(r){return r===void 0?0:r>360||r<-360?r%360:r}function il(r,e,t){return Kw(r)?nr(r,e,t):r.length===3?$o(r):nr(r[0],r[1],r[2])}var $O=function(){function r(e,t){Ct(this,r),this.name=void 0,this.matrix=void 0,this.right=void 0,this.up=void 0,this.forward=void 0,this.position=void 0,this.focalPoint=void 0,this.distanceVector=void 0,this.distance=void 0,this.dollyingStep=void 0,this.azimuth=0,this.elevation=0,this.roll=0,this.relAzimuth=0,this.relElevation=0,this.relRoll=0,this.name=e,this.matrix=Hj(t.matrix),this.right=$o(t.right),this.up=$o(t.up),this.forward=$o(t.forward),this.position=$o(t.position),this.focalPoint=$o(t.focalPoint),this.distanceVector=$o(t.distanceVector),this.azimuth=t.azimuth,this.elevation=t.elevation,this.roll=t.roll,this.relAzimuth=t.relAzimuth,this.relElevation=t.relElevation,this.relRoll=t.relRoll,this.dollyingStep=t.dollyingStep,this.distance=t.distance}return Gt(r,[{key:"getPosition",value:function(){return this.position}},{key:"getFocalPoint",value:function(){return this.focalPoint}},{key:"getRoll",value:function(){return this.roll}},{key:"retrieve",value:function(t){t.matrix=wb(t.matrix,this.matrix),t.right=ui(t.right,this.right),t.up=ui(t.up,this.up),t.forward=ui(t.forward,this.forward),t.position=ui(t.position,this.position),t.focalPoint=ui(t.focalPoint,this.focalPoint),t.distanceVector=ui(t.distanceVector,this.distanceVector),t.azimuth=this.azimuth,t.elevation=this.elevation,t.roll=this.roll,t.relAzimuth=this.relAzimuth,t.relElevation=this.relElevation,t.relRoll=this.relRoll,t.dollyingStep=this.dollyingStep,t.distance=this.distance}}]),r}(),VO,jO,WO,Zw,XO,YO,HO,Yr;(function(r){r.ORBITING="ORBITING",r.EXPLORING="EXPLORING",r.TRACKING="TRACKING"})(Yr||(Yr={}));var ny;(function(r){r.DEFAULT="DEFAULT",r.ROTATIONAL="ROTATIONAL",r.TRANSLATIONAL="TRANSLATIONAL",r.CINEMATIC="CINEMATIC"})(ny||(ny={}));var al;(function(r){r.ORTHOGRAPHIC="ORTHOGRAPHIC",r.PERSPECTIVE="PERSPECTIVE"})(al||(al={}));var ts=Math.PI/180,Xs=180/Math.PI,qO=(VO=Gr(),jO=Bt(Pe.InteractorService),VO(WO=(Zw=(HO=YO=function(){function r(){Ct(this,r),this.matrix=Fi(),this.right=nr(1,0,0),this.up=nr(0,1,0),this.forward=nr(0,0,1),this.position=nr(0,0,1),this.focalPoint=nr(0,0,0),this.distanceVector=nr(0,0,0),this.distance=1,this.azimuth=0,this.elevation=0,this.roll=0,this.relAzimuth=0,this.relElevation=0,this.relRoll=0,this.dollyingStep=0,this.maxDistance=1/0,this.minDistance=-1/0,this.rotateWorld=!1,Pt(this,"interactor",XO,this),this.fov=30,this.near=.1,this.far=1e4,this.aspect=1,this.left=void 0,this.rright=void 0,this.top=void 0,this.bottom=void 0,this.zoom=1,this.perspective=Fi(),this.view=void 0,this.following=void 0,this.type=Yr.EXPLORING,this.trackingMode=ny.DEFAULT,this.projectionMode=al.PERSPECTIVE,this.frustum=new Pie,this.landmarks=[],this.landmarkAnimationID=void 0}return Gt(r,[{key:"clone",value:function(){var t=new r;return t.setType(this.type,void 0),t.interactor=this.interactor,t}},{key:"getProjectionMode",value:function(){return this.projectionMode}},{key:"getPerspective",value:function(){return this.perspective}},{key:"getFrustum",value:function(){return this.frustum}},{key:"getPosition",value:function(){return this.position}},{key:"setType",value:function(t,n){return this.type=t,this.type===Yr.EXPLORING?this.setWorldRotation(!0):this.setWorldRotation(!1),this._getAngles(),this.type===Yr.TRACKING&&n!==void 0&&this.setTrackingMode(n),this}},{key:"setProjectionMode",value:function(t){return this.projectionMode=t,this}},{key:"setTrackingMode",value:function(t){if(this.type!==Yr.TRACKING)throw new Error("Impossible to set a tracking mode if the camera is not of tracking type");return this.trackingMode=t,this}},{key:"setWorldRotation",value:function(t){this.rotateWorld=t,this._getAngles()}},{key:"getViewTransform",value:function(){return up(Fi(),this.matrix)}},{key:"getWorldTransform",value:function(){return this.matrix}},{key:"setMatrix",value:function(t){return this.matrix=t,this._update(),this}},{key:"setAspect",value:function(t){return this.setPerspective(this.near,this.far,this.fov,t),this}},{key:"setViewOffset",value:function(t,n,i,a,o,s){return this.aspect=t/n,this.view===void 0&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=n,this.view.offsetX=i,this.view.offsetY=a,this.view.width=o,this.view.height=s,this.projectionMode===al.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this}},{key:"clearViewOffset",value:function(){return this.view!==void 0&&(this.view.enabled=!1),this.projectionMode===al.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this}},{key:"setPerspective",value:function(t,n,i,a){return this.projectionMode=al.PERSPECTIVE,this.fov=i,this.near=t,this.far=n,this.aspect=a,Jj(this.perspective,this.fov*ts,this.aspect,this.near,this.far),this}},{key:"setOrthographic",value:function(t,n,i,a,o,s){this.projectionMode=al.ORTHOGRAPHIC,this.rright=n,this.left=t,this.top=i,this.bottom=a,this.near=o,this.far=s;var u=(this.rright-this.left)/(2*this.zoom),l=(this.top-this.bottom)/(2*this.zoom),c=(this.rright+this.left)/2,f=(this.top+this.bottom)/2,d=c-u,h=c+u,v=f+l,p=f-l;if(this.view!==void 0&&this.view.enabled){var g=(this.rright-this.left)/this.view.fullWidth/this.zoom,y=(this.top-this.bottom)/this.view.fullHeight/this.zoom;d+=g*this.view.offsetX,h=d+g*this.view.width,v-=y*this.view.offsetY,p=v-y*this.view.height}return tW(this.perspective,d,h,v,p,o,s),this}},{key:"setPosition",value:function(t,n,i){return this._setPosition(t,n,i),this.setFocalPoint(this.focalPoint),this}},{key:"setFocalPoint",value:function(t,n,i){var a=nr(0,1,0);if(this.focalPoint=il(t,n,i),this.trackingMode===ny.CINEMATIC){var o=xb(Vr(),this.focalPoint,this.position);t=o[0],n=o[1],i=o[2];var s=lp(o),u=Math.asin(n/s)*Xs,l=90+Math.atan2(i,t)*Xs,c=Fi();Kj(c,c,l*ts),qj(c,c,u*ts),a=Sb(Vr(),[0,1,0],c)}return up(this.matrix,rW(Fi(),this.position,this.focalPoint,a)),this._getAxes(),this._getDistance(),this._getAngles(),this}},{key:"setDistance",value:function(t){if(!(this.distance===t||t<0)){this.distance=t,this.distance<2e-4&&(this.distance=2e-4),this.dollyingStep=this.distance/100;var n=Vr();t=this.distance;var i=this.forward,a=this.focalPoint;return n[0]=t*i[0]+a[0],n[1]=t*i[1]+a[1],n[2]=t*i[2]+a[2],this._setPosition(n),this}}},{key:"setMaxDistance",value:function(t){return this.maxDistance=t,this}},{key:"setMinDistance",value:function(t){return this.minDistance=t,this}},{key:"changeAzimuth",value:function(t){return this.setAzimuth(this.azimuth+t),this}},{key:"changeElevation",value:function(t){return this.setElevation(this.elevation+t),this}},{key:"changeRoll",value:function(t){return this.setRoll(this.roll+t),this}},{key:"setAzimuth",value:function(t){return this.azimuth=es(t),this.computeMatrix(),this._getAxes(),this.type===Yr.ORBITING||this.type===Yr.EXPLORING?this._getPosition():this.type===Yr.TRACKING&&this._getFocalPoint(),this}},{key:"getAzimuth",value:function(){return this.azimuth}},{key:"setElevation",value:function(t){return this.elevation=es(t),this.computeMatrix(),this._getAxes(),this.type===Yr.ORBITING||this.type===Yr.EXPLORING?this._getPosition():this.type===Yr.TRACKING&&this._getFocalPoint(),this}},{key:"setRoll",value:function(t){return this.roll=es(t),this.computeMatrix(),this._getAxes(),this.type===Yr.ORBITING||this.type===Yr.EXPLORING?this._getPosition():this.type===Yr.TRACKING&&this._getFocalPoint(),this}},{key:"rotate",value:function(t,n,i){if(this.type===Yr.EXPLORING){t=es(t),n=es(n),i=es(i);var a=Pu(Vn(),[1,0,0],(this.rotateWorld?1:-1)*n*ts),o=Pu(Vn(),[0,1,0],(this.rotateWorld?1:-1)*t*ts),s=Pu(Vn(),[0,0,1],i*ts),u=da(Vn(),o,a);u=da(Vn(),u,s);var l=ZA(Fi(),u);Yf(this.matrix,this.matrix,[0,0,-this.distance]),Nu(this.matrix,this.matrix,l),Yf(this.matrix,this.matrix,[0,0,this.distance])}else{if(Math.abs(this.elevation+n)>90)return;this.relElevation=es(n),this.relAzimuth=es(t),this.relRoll=es(i),this.elevation+=this.relElevation,this.azimuth+=this.relAzimuth,this.roll+=this.relRoll,this.computeMatrix()}return this._getAxes(),this.type===Yr.ORBITING||this.type===Yr.EXPLORING?this._getPosition():this.type===Yr.TRACKING&&this._getFocalPoint(),this._update(),this}},{key:"pan",value:function(t,n){var i=il(t,n,0),a=$o(this.position);return Vo(a,a,Kf(Vr(),this.right,i[0])),Vo(a,a,Kf(Vr(),this.up,i[1])),this._setPosition(a),this}},{key:"dolly",value:function(t){var n=this.forward,i=$o(this.position),a=t*this.dollyingStep,o=this.distance+t*this.dollyingStep;return a=Math.max(Math.min(o,this.maxDistance),this.minDistance)-this.distance,i[0]+=a*n[0],i[1]+=a*n[1],i[2]+=a*n[2],this._setPosition(i),this.type===Yr.ORBITING||this.type===Yr.EXPLORING?this._getDistance():this.type===Yr.TRACKING&&Vo(this.focalPoint,i,this.distanceVector),this}},{key:"createLandmark",value:function(t,n){var i=this.clone();i.setPosition(n.position),i.setFocalPoint(n.focalPoint),n.roll!==void 0&&i.setRoll(n.roll);var a=new $O(t,i);return this.landmarks.push(a),a}},{key:"setLandmark",value:function(t){var n=new $O(t,this);return this.landmarks.push(n),this}},{key:"gotoLandmark",value:function(t){var n=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e3,a=this.landmarks.find(function(f){return f.name===t});if(a){if(i===0){a.retrieve(this);return}this.landmarkAnimationID!==void 0&&window.cancelAnimationFrame(this.landmarkAnimationID),this.interactor.disconnect();var o=a.getPosition(),s=a.getFocalPoint(),u=a.getRoll(),l,c=function f(d){l===void 0&&(l=d);var h=d-l,v=(1-Math.cos(h/i*Math.PI))/2,p=Vr(),g=Vr(),y=0;Ou(p,n.focalPoint,s,v),Ou(g,n.position,o,v),y=n.roll*(1-v)+u*v,n.setFocalPoint(p),n.setPosition(g),n.setRoll(y),n.computeMatrix();var m=QA(p,s)+QA(g,o);if(!(m>.01)){n.setFocalPoint(p),n.setPosition(g),n.setRoll(y),n.computeMatrix(),n.interactor.connect();return}h<i&&(n.landmarkAnimationID=window.requestAnimationFrame(f))};window.requestAnimationFrame(c)}}},{key:"_update",value:function(){this._getAxes(),this._getPosition(),this._getDistance(),this._getAngles()}},{key:"computeMatrix",value:function(){var t,n,i=Pu(Vn(),[0,0,1],this.roll*ts);KA(this.matrix),t=Pu(Vn(),[1,0,0],(this.rotateWorld&&this.type!==Yr.TRACKING||this.type===Yr.TRACKING?1:-1)*this.elevation*ts),n=Pu(Vn(),[0,1,0],(this.rotateWorld&&this.type!==Yr.TRACKING||this.type===Yr.TRACKING?1:-1)*this.azimuth*ts);var a=da(Vn(),n,t);a=da(Vn(),a,i);var o=ZA(Fi(),a);this.type===Yr.ORBITING||this.type===Yr.EXPLORING?(Yf(this.matrix,this.matrix,this.focalPoint),Nu(this.matrix,this.matrix,o),Yf(this.matrix,this.matrix,[0,0,this.distance])):this.type===Yr.TRACKING&&(Yf(this.matrix,this.matrix,this.position),Nu(this.matrix,this.matrix,o))}},{key:"_setPosition",value:function(t,n,i){this.position=il(t,n,i);var a=this.matrix;a[12]=this.position[0],a[13]=this.position[1],a[14]=this.position[2],a[15]=1}},{key:"_getAxes",value:function(){ui(this.right,il(Jf(Qf(),[1,0,0,0],this.matrix))),ui(this.up,il(Jf(Qf(),[0,1,0,0],this.matrix))),ui(this.forward,il(Jf(Qf(),[0,0,1,0],this.matrix))),Zf(this.right,this.right),Zf(this.up,this.up),Zf(this.forward,this.forward)}},{key:"_getAngles",value:function(){var t=this.distanceVector[0],n=this.distanceVector[1],i=this.distanceVector[2],a=lp(this.distanceVector);if(a===0){this.elevation=0,this.azimuth=0;return}this.type===Yr.TRACKING?(this.elevation=Math.asin(n/a)*Xs,this.azimuth=Math.atan2(-t,-i)*Xs):this.rotateWorld?(this.elevation=Math.asin(n/a)*Xs,this.azimuth=Math.atan2(-t,-i)*Xs):(this.elevation=-Math.asin(n/a)*Xs,this.azimuth=-Math.atan2(-t,-i)*Xs)}},{key:"_getPosition",value:function(){ui(this.position,il(Jf(Qf(),[0,0,0,1],this.matrix))),this._getDistance()}},{key:"_getFocalPoint",value:function(){oc(this.distanceVector,[0,0,-this.distance],YA(nc(),this.matrix)),Vo(this.focalPoint,this.position,this.distanceVector),this._getDistance()}},{key:"_getDistance",value:function(){this.distanceVector=xb(Vr(),this.focalPoint,this.position),this.distance=lp(this.distanceVector),this.dollyingStep=this.distance/100}}]),r}(),YO.ProjectionMode={ORTHOGRAPHIC:"ORTHOGRAPHIC",PERSPECTIVE:"PERSPECTIVE"},HO),XO=Rt(Zw.prototype,"interactor",[jO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Zw))||WO),KO,ZO,QO,Qw,JO,qh,eP,Ys=(KO=Gr(),ZO=Bt(Pe.GeometryComponentManager),KO(QO=(Qw=(eP=qh=function(){function r(){Ct(this,r),this.config=void 0,Pt(this,"geometry",JO,this),this.entity=void 0,this.component=void 0}return Gt(r,[{key:"getEntity",value:function(){return this.entity}},{key:"getComponent",value:function(){return this.component}},{key:"setConfig",value:function(t){this.config=t}},{key:"setEntity",value:function(t){this.entity=t,this.component=this.geometry.create(t),this.component.entity=t,this.onEntityCreated()}},{key:"onEntityCreated",value:function(){}}]),r}(),qh.BOX="box",qh.SPHERE="sphere",qh.PLANE="plane",qh.MERGED="merged",eP),JO=Rt(Qw.prototype,"geometry",[ZO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Qw))||QO),rt={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),function(e){e.TextureCompressionBC="texture-compression-bc"}(r.ExtensionName||(r.ExtensionName={})),function(e){e.ClampToEdge="clamp-to-edge",e.Repeat="repeat",e.MirrorRepeat="mirror-repeat"}(r.AddressMode||(r.AddressMode={})),function(e){e.UniformBuffer="uniform-buffer",e.StorageBuffer="storage-buffer",e.ReadonlyStorageBuffer="readonly-storage-buffer",e.Sampler="sampler",e.ComparisonSampler="comparison-sampler",e.SampledTexture="sampled-texture",e.ReadonlyStorageTexture="readonly-storage-texture",e.WriteonlyStorageTexture="writeonly-storage-texture"}(r.BindingType||(r.BindingType={})),function(e){e.Zero="zero",e.One="one",e.SrcColor="src-color",e.OneMinusSrcColor="one-minus-src-color",e.SrcAlpha="src-alpha",e.OneMinusSrcAlpha="one-minus-src-alpha",e.DstColor="dst-color",e.OneMinusDstColor="one-minus-dst-color",e.DstAlpha="dst-alpha",e.OneMinusDstAlpha="one-minus-dst-alpha",e.SrcAlphaSaturated="src-alpha-saturated",e.BlendColor="blend-color",e.OneMinusBlendColor="one-minus-blend-color"}(r.BlendFactor||(r.BlendFactor={})),function(e){e.Add="add",e.Subtract="subtract",e.ReverseSubtract="reverse-subtract",e.Min="min",e.Max="max"}(r.BlendOperation||(r.BlendOperation={})),function(e){e.Never="never",e.Less="less",e.Equal="equal",e.LessEqual="less-equal",e.Greater="greater",e.NotEqual="not-equal",e.GreaterEqual="greater-equal",e.Always="always"}(r.CompareFunction||(r.CompareFunction={})),function(e){e.None="none",e.Front="front",e.Back="back"}(r.CullMode||(r.CullMode={})),function(e){e.Nearest="nearest",e.Linear="linear"}(r.FilterMode||(r.FilterMode={})),function(e){e.CCW="ccw",e.CW="cw"}(r.FrontFace||(r.FrontFace={})),function(e){e.Uint16="uint16",e.Uint32="uint32"}(r.IndexFormat||(r.IndexFormat={})),function(e){e.Vertex="vertex",e.Instance="instance"}(r.InputStepMode||(r.InputStepMode={})),function(e){e.Load="load"}(r.LoadOp||(r.LoadOp={})),function(e){e.PointList="point-list",e.LineList="line-list",e.LineStrip="line-strip",e.TriangleList="triangle-list",e.TriangleStrip="triangle-strip"}(r.PrimitiveTopology||(r.PrimitiveTopology={})),function(e){e.Keep="keep",e.Zero="zero",e.Replace="replace",e.Invert="invert",e.IncrementClamp="increment-clamp",e.DecrementClamp="decrement-clamp",e.IncrementWrap="increment-wrap",e.DecrementWrap="decrement-wrap"}(r.StencilOperation||(r.StencilOperation={})),function(e){e.Store="store",e.Clear="clear"}(r.StoreOp||(r.StoreOp={})),function(e){e.E1d="1d",e.E2d="2d",e.E3d="3d"}(r.TextureDimension||(r.TextureDimension={})),function(e){e.R8Unorm="r8unorm",e.R8Snorm="r8snorm",e.R8Uint="r8uint",e.R8Sint="r8sint",e.R16Uint="r16uint",e.R16Sint="r16sint",e.R16Float="r16float",e.RG8Unorm="rg8unorm",e.RG8Snorm="rg8snorm",e.RG8Uint="rg8uint",e.RG8Sint="rg8sint",e.R32Uint="r32uint",e.R32Sint="r32sint",e.R32Float="r32float",e.RG16Uint="rg16uint",e.RG16Sint="rg16sint",e.RG16Float="rg16float",e.RGBA8Unorm="rgba8unorm",e.RGBA8UnormSRGB="rgba8unorm-srgb",e.RGBA8Snorm="rgba8snorm",e.RGBA8Uint="rgba8uint",e.RGBA8Sint="rgba8sint",e.BGRA8Unorm="bgra8unorm",e.BGRA8UnormSRGB="bgra8unorm-srgb",e.RGB10A2Unorm="rgb10a2unorm",e.RG11B10Float="rg11b10float",e.RG32Uint="rg32uint",e.RG32Sint="rg32sint",e.RG32Float="rg32float",e.RGBA16Uint="rgba16uint",e.RGBA16Sint="rgba16sint",e.RGBA16Float="rgba16float",e.RGBA32Uint="rgba32uint",e.RGBA32Sint="rgba32sint",e.RGBA32Float="rgba32float",e.Depth32Float="depth32float",e.Depth24Plus="depth24plus",e.Depth24PlusStencil8="depth24plus-stencil8"}(r.TextureFormat||(r.TextureFormat={})),function(e){e.Float="float",e.Sint="sint",e.Uint="uint"}(r.TextureComponentType||(r.TextureComponentType={})),function(e){e.E1d="1d",e.E2d="2d",e.E2dArray="2d-array",e.Cube="cube",e.CubeArray="cube-array",e.E3d="3d"}(r.TextureViewDimension||(r.TextureViewDimension={})),function(e){e.Uchar2="uchar2",e.Uchar4="uchar4",e.Char2="char2",e.Char4="char4",e.Uchar2Norm="uchar2norm",e.Uchar4Norm="uchar4norm",e.Char2Norm="char2norm",e.Char4Norm="char4norm",e.Ushort2="ushort2",e.Ushort4="ushort4",e.Short2="short2",e.Short4="short4",e.Ushort2Norm="ushort2norm",e.Ushort4Norm="ushort4norm",e.Short2Norm="short2norm",e.Short4Norm="short4norm",e.Half2="half2",e.Half4="half4",e.Float="float",e.Float2="float2",e.Float3="float3",e.Float4="float4",e.Uint="uint",e.Uint2="uint2",e.Uint3="uint3",e.Uint4="uint4",e.Int="int",e.Int2="int2",e.Int3="int3",e.Int4="int4"}(r.VertexFormat||(r.VertexFormat={})),function(e){e.All="all",e.StencilOnly="stencil-only",e.DepthOnly="depth-only"}(r.TextureAspect||(r.TextureAspect={})),function(e){e.Error="error",e.Warning="warning",e.Info="info"}(r.CompilationMessageType||(r.CompilationMessageType={})),function(e){e.Occlusion="occlusion"}(r.QueryType||(r.QueryType={})),function(e){e[e.MapRead=1]="MapRead",e[e.MapWrite=2]="MapWrite",e[e.CopySrc=4]="CopySrc",e[e.CopyDst=8]="CopyDst",e[e.Index=16]="Index",e[e.Vertex=32]="Vertex",e[e.Uniform=64]="Uniform",e[e.Storage=128]="Storage",e[e.Indirect=256]="Indirect",e[e.QueryResolve=512]="QueryResolve"}(r.BufferUsage||(r.BufferUsage={})),function(e){e[e.Red=1]="Red",e[e.Green=2]="Green",e[e.Blue=4]="Blue",e[e.Alpha=8]="Alpha",e[e.All=15]="All"}(r.ColorWrite||(r.ColorWrite={})),function(e){e[e.Vertex=1]="Vertex",e[e.Fragment=2]="Fragment",e[e.Compute=4]="Compute"}(r.ShaderStage||(r.ShaderStage={})),function(e){e[e.CopySrc=1]="CopySrc",e[e.CopyDst=2]="CopyDst",e[e.Sampled=4]="Sampled",e[e.Storage=8]="Storage",e[e.OutputAttachment=16]="OutputAttachment"}(r.TextureUsage||(r.TextureUsage={})),function(e){e[e.Read=1]="Read",e[e.Write=2]="Write"}(r.MapMode||(r.MapMode={}))})(rt);function tP(){if(typeof document!="undefined")return document.createElement("canvas");throw new Error("Cannot create a canvas in this context")}var yae={}.toString,mae=function(e,t){return yae.call(e)==="[object "+t+"]"},bae=function(r){return Array.isArray?Array.isArray(r):mae(r,"Array")},wae=9007199254740991,xae="[object Arguments]",_ae="[object Array]",Sae="[object Boolean]",Eae="[object Date]",Aae="[object Error]",Tae="[object Function]",Iae="[object Map]",Cae="[object Number]",Mae="[object Object]",kae="[object RegExp]",Dae="[object Set]",Lae="[object String]",Nae="[object WeakMap]",Oae="[object ArrayBuffer]",Pae="[object DataView]",Rae="[object Float32Array]",Bae="[object Float64Array]",Fae="[object Int8Array]",Uae="[object Int16Array]",Gae="[object Int32Array]",zae="[object Uint8Array]",$ae="[object Uint8ClampedArray]",Vae="[object Uint16Array]",jae="[object Uint32Array]",un={};un[Rae]=un[Bae]=un[Fae]=un[Uae]=un[Gae]=un[zae]=un[$ae]=un[Vae]=un[jae]=!0;un[xae]=un[_ae]=un[Oae]=un[Sae]=un[Pae]=un[Eae]=un[Aae]=un[Tae]=un[Iae]=un[Cae]=un[Mae]=un[kae]=un[Dae]=un[Lae]=un[Nae]=!1;var Wae=Object.prototype,Xae=Wae.toString;function Yae(r){return qae(r)&&Hae(r.length)&&!!un[Xae.call(r)]}function Hae(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=wae}function qae(r){return!!r&&mo(r)==="object"}var rP=Yae,nP,iP,aP,oP,iy,sP,uP,lP;function cP(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function fP(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?cP(Object(t),!0).forEach(function(n){Ie(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):cP(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var hP=(nP=Gr(),iP=Bt(Pe.RenderEngine),aP=Bt(Pe.ConfigService),nP(oP=(iy=(lP=function(){function r(){Ct(this,r),Pt(this,"engine",sP,this),Pt(this,"configService",uP,this),this.entity=go(),this.model=void 0,this.dirty=!0,this.compiledBundle=void 0,this.initPromise=void 0}return Gt(r,[{key:"init",value:function(){var t=this.configService.get(),n=t.canvas,i=t.engineOptions;this.initPromise=this.engine.init(fP({canvas:n||tP(),swapChainFormat:rt.TextureFormat.BGRA8Unorm,antialiasing:!1},i))}},{key:"setBundle",value:function(t){this.compiledBundle=JSON.parse(JSON.stringify(t))}},{key:"setDispatch",value:function(t){return this.compiledBundle.context&&(this.compiledBundle.context.dispatch=t),this}},{key:"setMaxIteration",value:function(t){return this.compiledBundle.context&&(this.compiledBundle.context.maxIteration=t),this}},{key:"setBinding",value:function(t,n){var i=this;if(typeof t=="string"){var a=Kw(n)||rP(n)||bae(n);if(this.compiledBundle&&this.compiledBundle.context){var o=this.compiledBundle.context.defines.find(function(u){return u.name===t});if(o)return o.value=n,this;var s=this.compiledBundle.context.uniforms.find(function(u){return u.name===t});s&&(a?(s.data=n,s.isReferer=!1,s.storageClass===Ws.Uniform?this.model&&this.model.updateUniform(t,n):this.model&&this.model.updateBuffer(t,n)):(s.isReferer=!0,s.data=n))}}else Object.keys(t).forEach(function(u){i.setBinding(u,t[u])});return this}},{key:"execute",value:function(){var e=Rr(_t.mark(function n(){var i=this,a,o,s=arguments;return _t.wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(a=s.length>0&&s[0]!==void 0?s[0]:1,!this.dirty){l.next=6;break}return this.compiledBundle.context&&(a>1?this.compiledBundle.context.maxIteration=a:this.compiledBundle.context.maxIteration++),l.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(c){var f=c.isReferer;return f}).forEach(function(c){var f=c.data,d=c.name;i.model.confirmInput(f.model,d)}),o=0;o<a;o++)this.model.run();return this.engine.endFrame(),l.abrupt("return",this);case 12:case"end":return l.stop()}},n,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:"getOutput",value:function(){var e=Rr(_t.mark(function n(){return _t.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",this.model.readData());case 1:case"end":return a.stop()}},n,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:"compile",value:function(){var e=Rr(_t.mark(function n(){var i,a,o;return _t.wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,this.initPromise;case 2:return i=fP({},this.compiledBundle.context),a=this.engine.supportWebGPU?this.engine.useWGSL?Hh.WGSL:Hh.GLSL450:Hh.GLSL100,o=this.compiledBundle.shaders[a],i.defines.filter(function(l){return l.runtime}).forEach(function(l){var c="".concat(gae).concat(l.name);o=o.replace(c,"".concat(l.value))}),i.shader=o,i.uniforms.forEach(function(l){if(!l.data&&l.storageClass===Ws.StorageBuffer){var c=1;l.type===nl.FloatArray?c=1:l.type===nl.Vector4FloatArray&&(c=4),l.data=new Float32Array(i.output.length*c).fill(0)}}),this.compiledBundle.context=i,u.next=11,this.engine.createComputeModel(this.compiledBundle.context);case 11:this.model=u.sent;case 12:case"end":return u.stop()}},n,this)}));function t(){return e.apply(this,arguments)}return t}()}]),r}(),lP),sP=Rt(iy.prototype,"engine",[iP],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),uP=Rt(iy.prototype,"configService",[aP],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),iy))||oP),dP,vP,pP,Jw,gP,yP,mP,bP=(dP=Gr(),vP=Bt(Pe.MaterialComponentManager),dP(pP=(Jw=(mP=yP=function(){function r(){Ct(this,r),this.config=void 0,Pt(this,"material",gP,this),this.entity=void 0,this.component=void 0}return Gt(r,[{key:"getEntity",value:function(){return this.entity}},{key:"getComponent",value:function(){return this.component}},{key:"setConfig",value:function(t){this.config=t}},{key:"setEntity",value:function(t,n){this.entity=t,this.component=this.material.create(t),this.component.entity=t,this.component.type=n,this.onEntityCreated()}},{key:"onEntityCreated",value:function(){}}]),r}(),yP.BASIC="basic",mP),gP=Rt(Jw.prototype,"material",[vP],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Jw))||pP),wP,xP,_P,SP,EP,AP,TP,Tc,IP,CP,MP,kP,ay,DP,Hs=(wP=Gr(),xP=Bt(Pe.MeshComponentManager),_P=Bt(Pe.CullableComponentManager),SP=Bt(Pe.TransformComponentManager),EP=Bt(Pe.Systems),AP=yo(Pe.SceneGraphSystem),wP(TP=(Tc=(DP=ay=function(){function r(){Ct(this,r),this.attributes={},this.config=void 0,Pt(this,"mesh",IP,this),Pt(this,"cullable",CP,this),Pt(this,"transform",MP,this),Pt(this,"sceneGraphSystem",kP,this),this.meshComponent=void 0,this.transformComponent=void 0,this.entity=void 0}return Gt(r,[{key:"getEntity",value:function(){return this.entity}},{key:"getTransformComponent",value:function(){return this.transformComponent}},{key:"getMeshComponent",value:function(){return this.meshComponent}},{key:"setConfig",value:function(t){this.config=t}},{key:"setEntity",value:function(t){this.entity=t,this.cullable.create(t),this.meshComponent=this.mesh.create(t),this.transformComponent=this.transform.create(t),this.onEntityCreated()}},{key:"setMaterial",value:function(t){return this.meshComponent.material=t,this}},{key:"setGeometry",value:function(t){return this.meshComponent.geometry=t,this}},{key:"setAttributes",value:function(t){var n=this;Object.keys(t).forEach(function(i){t[i]!==void 0&&t[i]!==n.attributes[i]&&(n.onAttributeChanged({name:i,data:t[i]}),n.attributes[i]=t[i])})}},{key:"setVisible",value:function(t){var n=this;return this.meshComponent.visible=t,this.meshComponent.children.forEach(function(i){var a=n.mesh.getComponentByEntity(i);a&&(a.visible=t)}),this}},{key:"isVisible",value:function(){return this.meshComponent.visible}},{key:"attach",value:function(t){return this.sceneGraphSystem.attach(this.entity,t.entity),this}},{key:"detach",value:function(){return this.sceneGraphSystem.detach(this.entity),this}},{key:"detachChildren",value:function(){return this.sceneGraphSystem.detachChildren(this.entity),this}},{key:"onEntityCreated",value:function(){}},{key:"onAttributeChanged",value:function(t){var n=t.name,i=t.data;this.meshComponent&&this.meshComponent.material&&this.meshComponent.material.setUniform(this.convertAttributeName2UniformName(n),i)}},{key:"convertAttributeName2UniformName",value:function(t){return t}}]),r}(),ay.POINT="point",ay.LINE="line",ay.GRID="grid",DP),IP=Rt(Tc.prototype,"mesh",[xP],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),CP=Rt(Tc.prototype,"cullable",[_P],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),MP=Rt(Tc.prototype,"transform",[SP],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),kP=Rt(Tc.prototype,"sceneGraphSystem",[EP,AP],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Tc))||TP),LP={exports:{}};(function(r,e){(function(t,n){r.exports=n()})(sf,function(){var t=function(E){return E instanceof Uint8Array||E instanceof Uint16Array||E instanceof Uint32Array||E instanceof Int8Array||E instanceof Int16Array||E instanceof Int32Array||E instanceof Float32Array||E instanceof Float64Array||E instanceof Uint8ClampedArray},n=function(E,O){for(var j=Object.keys(O),pe=0;pe<j.length;++pe)E[j[pe]]=O[j[pe]];return E},i=`
`;function a(E){return typeof atob!="undefined"?atob(E):"base64:"+E}function o(E){var O=new Error("(regl) "+E);throw console.error(O),O}function s(E,O){E||o(O)}function u(E){return E?": "+E:""}function l(E,O,j){E in O||o("unknown parameter ("+E+")"+u(j)+". possible values: "+Object.keys(O).join())}function c(E,O){t(E)||o("invalid parameter type"+u(O)+". must be a typed array")}function f(E,O){switch(O){case"number":return typeof E=="number";case"object":return typeof E=="object";case"string":return typeof E=="string";case"boolean":return typeof E=="boolean";case"function":return typeof E=="function";case"undefined":return typeof E=="undefined";case"symbol":return typeof E=="symbol"}}function d(E,O,j){f(E,O)||o("invalid parameter type"+u(j)+". expected "+O+", got "+typeof E)}function h(E,O){E>=0&&(E|0)===E||o("invalid parameter type, ("+E+")"+u(O)+". must be a nonnegative integer")}function v(E,O,j){O.indexOf(E)<0&&o("invalid value"+u(j)+". must be one of: "+O)}var p=["gl","canvas","container","attributes","pixelRatio","extensions","optionalExtensions","profile","onDone"];function g(E){Object.keys(E).forEach(function(O){p.indexOf(O)<0&&o('invalid regl constructor argument "'+O+'". must be one of '+p)})}function y(E,O){for(E=E+"";E.length<O;)E=" "+E;return E}function m(){this.name="unknown",this.lines=[],this.index={},this.hasErrors=!1}function b(E,O){this.number=E,this.line=O,this.errors=[]}function w(E,O,j){this.file=E,this.line=O,this.message=j}function x(){var E=new Error,O=(E.stack||E).toString(),j=/compileProcedure.*\n\s*at.*\((.*)\)/.exec(O);if(j)return j[1];var pe=/compileProcedure.*\n\s*at\s+(.*)(\n|$)/.exec(O);return pe?pe[1]:"unknown"}function _(){var E=new Error,O=(E.stack||E).toString(),j=/at REGLCommand.*\n\s+at.*\((.*)\)/.exec(O);if(j)return j[1];var pe=/at REGLCommand.*\n\s+at\s+(.*)\n/.exec(O);return pe?pe[1]:"unknown"}function A(E,O){var j=E.split(`
`),pe=1,Ce=0,ve={unknown:new m,0:new m};ve.unknown.name=ve[0].name=O||x(),ve.unknown.lines.push(new b(0,""));for(var be=0;be<j.length;++be){var Re=j[be],Ue=/^\s*#\s*(\w+)\s+(.+)\s*$/.exec(Re);if(Ue)switch(Ue[1]){case"line":var je=/(\d+)(\s+\d+)?/.exec(Ue[2]);je&&(pe=je[1]|0,je[2]&&(Ce=je[2]|0,Ce in ve||(ve[Ce]=new m)));break;case"define":var Ge=/SHADER_NAME(_B64)?\s+(.*)$/.exec(Ue[2]);Ge&&(ve[Ce].name=Ge[1]?a(Ge[2]):Ge[2]);break}ve[Ce].lines.push(new b(pe++,Re))}return Object.keys(ve).forEach(function(He){var et=ve[He];et.lines.forEach(function(Be){et.index[Be.number]=Be})}),ve}function I(E){var O=[];return E.split(`
`).forEach(function(j){if(!(j.length<5)){var pe=/^ERROR:\s+(\d+):(\d+):\s*(.*)$/.exec(j);pe?O.push(new w(pe[1]|0,pe[2]|0,pe[3].trim())):j.length>0&&O.push(new w("unknown",0,j))}}),O}function M(E,O){O.forEach(function(j){var pe=E[j.file];if(pe){var Ce=pe.index[j.line];if(Ce){Ce.errors.push(j),pe.hasErrors=!0;return}}E.unknown.hasErrors=!0,E.unknown.lines[0].errors.push(j)})}function S(E,O,j,pe,Ce){if(!E.getShaderParameter(O,E.COMPILE_STATUS)){var ve=E.getShaderInfoLog(O),be=pe===E.FRAGMENT_SHADER?"fragment":"vertex";K(j,"string",be+" shader source must be a string",Ce);var Re=A(j,Ce),Ue=I(ve);M(Re,Ue),Object.keys(Re).forEach(function(je){var Ge=Re[je];if(!Ge.hasErrors)return;var He=[""],et=[""];function Be(Ke,ae){He.push(Ke),et.push(ae||"")}Be("file number "+je+": "+Ge.name+`
`,"color:red;text-decoration:underline;font-weight:bold"),Ge.lines.forEach(function(Ke){if(Ke.errors.length>0){Be(y(Ke.number,4)+"|  ","background-color:yellow; font-weight:bold"),Be(Ke.line+i,"color:red; background-color:yellow; font-weight:bold");var ae=0;Ke.errors.forEach(function(we){var Ve=we.message,it=/^\s*'(.*)'\s*:\s*(.*)$/.exec(Ve);if(it){var Le=it[1];switch(Ve=it[2],Le){case"assign":Le="=";break}ae=Math.max(Ke.line.indexOf(Le,ae),0)}else ae=0;Be(y("| ",6)),Be(y("^^^",ae+3)+i,"font-weight:bold"),Be(y("| ",6)),Be(Ve+i,"font-weight:bold")}),Be(y("| ",6)+i)}else Be(y(Ke.number,4)+"|  "),Be(Ke.line+i,"color:red")}),typeof document!="undefined"&&!window.chrome?(et[0]=He.join("%c"),console.log.apply(console,et)):console.log(He.join(""))}),s.raise("Error compiling "+be+" shader, "+Re[0].name)}}function C(E,O,j,pe,Ce){if(!E.getProgramParameter(O,E.LINK_STATUS)){var ve=E.getProgramInfoLog(O),be=A(j,Ce),Re=A(pe,Ce),Ue='Error linking program with vertex shader, "'+Re[0].name+'", and fragment shader "'+be[0].name+'"';typeof document!="undefined"?console.log("%c"+Ue+i+"%c"+ve,"color:red;text-decoration:underline;font-weight:bold","color:red"):console.log(Ue+i+ve),s.raise(Ue)}}function T(E){E._commandRef=x()}function k(E,O,j,pe){T(E);function Ce(Ue){return Ue?pe.id(Ue):0}E._fragId=Ce(E.static.frag),E._vertId=Ce(E.static.vert);function ve(Ue,je){Object.keys(je).forEach(function(Ge){Ue[pe.id(Ge)]=!0})}var be=E._uniformSet={};ve(be,O.static),ve(be,O.dynamic);var Re=E._attributeSet={};ve(Re,j.static),ve(Re,j.dynamic),E._hasCount="count"in E.static||"count"in E.dynamic||"elements"in E.static||"elements"in E.dynamic}function L(E,O){var j=_();o(E+" in command "+(O||x())+(j==="unknown"?"":" called from "+j))}function B(E,O,j){E||L(O,j||x())}function ee(E,O,j,pe){E in O||L("unknown parameter ("+E+")"+u(j)+". possible values: "+Object.keys(O).join(),pe||x())}function K(E,O,j,pe){f(E,O)||L("invalid parameter type"+u(j)+". expected "+O+", got "+typeof E,pe||x())}function z(E){E()}function X(E,O,j){E.texture?v(E.texture._texture.internalformat,O,"unsupported texture format for attachment"):v(E.renderbuffer._renderbuffer.format,j,"unsupported renderbuffer format for attachment")}var H=33071,J=9728,ne=9984,me=9985,oe=9986,Ae=9987,ze=5120,qe=5121,ft=5122,ct=5123,st=5124,gr=5125,tr=5126,$=32819,se=32820,W=33635,Ze=34042,yt=36193,at={};at[ze]=at[qe]=1,at[ft]=at[ct]=at[yt]=at[W]=at[$]=at[se]=2,at[st]=at[gr]=at[tr]=at[Ze]=4;function Ye(E,O){return E===se||E===$||E===W?2:E===Ze?4:at[E]*O}function pt(E){return!(E&E-1)&&!!E}function ht(E,O,j){var pe,Ce=O.width,ve=O.height,be=O.channels;s(Ce>0&&Ce<=j.maxTextureSize&&ve>0&&ve<=j.maxTextureSize,"invalid texture shape"),(E.wrapS!==H||E.wrapT!==H)&&s(pt(Ce)&&pt(ve),"incompatible wrap mode for texture, both width and height must be power of 2"),O.mipmask===1?Ce!==1&&ve!==1&&s(E.minFilter!==ne&&E.minFilter!==oe&&E.minFilter!==me&&E.minFilter!==Ae,"min filter requires mipmap"):(s(pt(Ce)&&pt(ve),"texture must be a square power of 2 to support mipmapping"),s(O.mipmask===(Ce<<1)-1,"missing or incomplete mipmap data")),O.type===tr&&(j.extensions.indexOf("oes_texture_float_linear")<0&&s(E.minFilter===J&&E.magFilter===J,"filter not supported, must enable oes_texture_float_linear"),s(!E.genMipmaps,"mipmap generation not supported with float textures"));var Re=O.images;for(pe=0;pe<16;++pe)if(Re[pe]){var Ue=Ce>>pe,je=ve>>pe;s(O.mipmask&1<<pe,"missing mipmap data");var Ge=Re[pe];if(s(Ge.width===Ue&&Ge.height===je,"invalid shape for mip images"),s(Ge.format===O.format&&Ge.internalformat===O.internalformat&&Ge.type===O.type,"incompatible type for mip image"),!Ge.compressed)if(Ge.data){var He=Math.ceil(Ye(Ge.type,be)*Ue/Ge.unpackAlignment)*Ge.unpackAlignment;s(Ge.data.byteLength===He*je,"invalid data for image, buffer size is inconsistent with image format")}else Ge.element||Ge.copy}else E.genMipmaps||s((O.mipmask&1<<pe)==0,"extra mipmap data");O.compressed&&s(!E.genMipmaps,"mipmap generation for compressed images not supported")}function dt(E,O,j,pe){var Ce=E.width,ve=E.height,be=E.channels;s(Ce>0&&Ce<=pe.maxTextureSize&&ve>0&&ve<=pe.maxTextureSize,"invalid texture shape"),s(Ce===ve,"cube map must be square"),s(O.wrapS===H&&O.wrapT===H,"wrap mode not supported by cube map");for(var Re=0;Re<j.length;++Re){var Ue=j[Re];s(Ue.width===Ce&&Ue.height===ve,"inconsistent cube map face shape"),O.genMipmaps&&(s(!Ue.compressed,"can not generate mipmap for compressed textures"),s(Ue.mipmask===1,"can not specify mipmaps and generate mipmaps"));for(var je=Ue.images,Ge=0;Ge<16;++Ge){var He=je[Ge];if(He){var et=Ce>>Ge,Be=ve>>Ge;s(Ue.mipmask&1<<Ge,"missing mipmap data"),s(He.width===et&&He.height===Be,"invalid shape for mip images"),s(He.format===E.format&&He.internalformat===E.internalformat&&He.type===E.type,"incompatible type for mip image"),He.compressed||(He.data?s(He.data.byteLength===et*Be*Math.max(Ye(He.type,be),He.unpackAlignment),"invalid data for image, buffer size is inconsistent with image format"):He.element||He.copy)}}}}var D=n(s,{optional:z,raise:o,commandRaise:L,command:B,parameter:l,commandParameter:ee,constructor:g,type:d,commandType:K,isTypedArray:c,nni:h,oneOf:v,shaderError:S,linkError:C,callSite:_,saveCommandRef:T,saveDrawInfo:k,framebufferFormat:X,guessCommand:x,texture2D:ht,textureCube:dt}),V=0,he=0,ye=5,Se=6;function De(E,O){this.id=V++,this.type=E,this.data=O}function At(E){return E.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function ut(E){if(E.length===0)return[];var O=E.charAt(0),j=E.charAt(E.length-1);if(E.length>1&&O===j&&(O==='"'||O==="'"))return['"'+At(E.substr(1,E.length-2))+'"'];var pe=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(E);if(pe)return ut(E.substr(0,pe.index)).concat(ut(pe[1])).concat(ut(E.substr(pe.index+pe[0].length)));var Ce=E.split(".");if(Ce.length===1)return['"'+At(E)+'"'];for(var ve=[],be=0;be<Ce.length;++be)ve=ve.concat(ut(Ce[be]));return ve}function St(E){return"["+ut(E).join("][")+"]"}function nt(E,O){return new De(E,St(O+""))}function Zt(E){return typeof E=="function"&&!E._reglType||E instanceof De}function Dt(E,O){if(typeof E=="function")return new De(he,E);if(typeof E=="number"||typeof E=="boolean")return new De(ye,E);if(Array.isArray(E))return new De(Se,E.map((j,pe)=>Dt(j,O+"["+pe+"]")));if(E instanceof De)return E;D(!1,"invalid option type in uniform "+O)}var vr={DynamicVariable:De,define:nt,isDynamic:Zt,unbox:Dt,accessor:St},Nr={next:typeof requestAnimationFrame=="function"?function(E){return requestAnimationFrame(E)}:function(E){return setTimeout(E,16)},cancel:typeof cancelAnimationFrame=="function"?function(E){return cancelAnimationFrame(E)}:clearTimeout},qn=typeof performance!="undefined"&&performance.now?function(){return performance.now()}:function(){return+new Date};function kr(){var E={"":0},O=[""];return{id:function(j){var pe=E[j];return pe||(pe=E[j]=O.length,O.push(j),pe)},str:function(j){return O[j]}}}function Tn(E,O,j){var pe=document.createElement("canvas");n(pe.style,{border:0,margin:0,padding:0,top:0,left:0}),E.appendChild(pe),E===document.body&&(pe.style.position="absolute",n(E.style,{margin:0,padding:0}));function Ce(){var Re=window.innerWidth,Ue=window.innerHeight;if(E!==document.body){var je=E.getBoundingClientRect();Re=je.right-je.left,Ue=je.bottom-je.top}pe.width=j*Re,pe.height=j*Ue,n(pe.style,{width:Re+"px",height:Ue+"px"})}var ve;E!==document.body&&typeof ResizeObserver=="function"?(ve=new ResizeObserver(function(){setTimeout(Ce)}),ve.observe(E)):window.addEventListener("resize",Ce,!1);function be(){ve?ve.disconnect():window.removeEventListener("resize",Ce),E.removeChild(pe)}return Ce(),{canvas:pe,onDestroy:be}}function ba(E,O){function j(pe){try{return E.getContext(pe,O)}catch{return null}}return j("webgl")||j("experimental-webgl")||j("webgl-experimental")}function Un(E){return typeof E.nodeName=="string"&&typeof E.appendChild=="function"&&typeof E.getBoundingClientRect=="function"}function nu(E){return typeof E.drawArrays=="function"||typeof E.drawElements=="function"}function hl(E){return typeof E=="string"?E.split():(D(Array.isArray(E),"invalid extension array"),E)}function dl(E){return typeof E=="string"?(D(typeof document!="undefined","not supported outside of DOM"),document.querySelector(E)):E}function Uc(E){var O=E||{},j,pe,Ce,ve,be={},Re=[],Ue=[],je=typeof window=="undefined"?1:window.devicePixelRatio,Ge=!1,He=function(Ke){Ke&&D.raise(Ke)},et=function(){};if(typeof O=="string"?(D(typeof document!="undefined","selector queries only supported in DOM enviroments"),j=document.querySelector(O),D(j,"invalid query string for element")):typeof O=="object"?Un(O)?j=O:nu(O)?(ve=O,Ce=ve.canvas):(D.constructor(O),"gl"in O?ve=O.gl:"canvas"in O?Ce=dl(O.canvas):"container"in O&&(pe=dl(O.container)),"attributes"in O&&(be=O.attributes,D.type(be,"object","invalid context attributes")),"extensions"in O&&(Re=hl(O.extensions)),"optionalExtensions"in O&&(Ue=hl(O.optionalExtensions)),"onDone"in O&&(D.type(O.onDone,"function","invalid or missing onDone callback"),He=O.onDone),"profile"in O&&(Ge=!!O.profile),"pixelRatio"in O&&(je=+O.pixelRatio,D(je>0,"invalid pixel ratio"))):D.raise("invalid arguments to regl"),j&&(j.nodeName.toLowerCase()==="canvas"?Ce=j:pe=j),!ve){if(!Ce){D(typeof document!="undefined","must manually specify webgl context outside of DOM environments");var Be=Tn(pe||document.body,He,je);if(!Be)return null;Ce=Be.canvas,et=Be.onDestroy}be.premultipliedAlpha===void 0&&(be.premultipliedAlpha=!0),ve=ba(Ce,be)}return ve?{gl:ve,canvas:Ce,container:pe,extensions:Re,optionalExtensions:Ue,pixelRatio:je,profile:Ge,onDone:He,onDestroy:et}:(et(),He("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function Io(E,O){var j={};function pe(be){D.type(be,"string","extension name must be string");var Re=be.toLowerCase(),Ue;try{Ue=j[Re]=E.getExtension(Re)}catch{}return!!Ue}for(var Ce=0;Ce<O.extensions.length;++Ce){var ve=O.extensions[Ce];if(!pe(ve))return O.onDestroy(),O.onDone('"'+ve+'" extension is not supported by the current WebGL context, try upgrading your system or a different browser'),null}return O.optionalExtensions.forEach(pe),{extensions:j,restore:function(){Object.keys(j).forEach(function(be){if(j[be]&&!pe(be))throw new Error("(regl): error restoring extension "+be)})}}}function Ln(E,O){for(var j=Array(E),pe=0;pe<E;++pe)j[pe]=O(pe);return j}var Gc=5120,zc=5121,$c=5122,wa=5123,In=5124,xa=5125,zt=5126;function Hr(E){for(var O=16;O<=1<<28;O*=16)if(E<=O)return O;return 0}function pr(E){var O,j;return O=(E>65535)<<4,E>>>=O,j=(E>255)<<3,E>>>=j,O|=j,j=(E>15)<<2,E>>>=j,O|=j,j=(E>3)<<1,E>>>=j,O|=j,O|E>>1}function cn(){var E=Ln(8,function(){return[]});function O(ve){var be=Hr(ve),Re=E[pr(be)>>2];return Re.length>0?Re.pop():new ArrayBuffer(be)}function j(ve){E[pr(ve.byteLength)>>2].push(ve)}function pe(ve,be){var Re=null;switch(ve){case Gc:Re=new Int8Array(O(be),0,be);break;case zc:Re=new Uint8Array(O(be),0,be);break;case $c:Re=new Int16Array(O(2*be),0,be);break;case wa:Re=new Uint16Array(O(2*be),0,be);break;case In:Re=new Int32Array(O(4*be),0,be);break;case xa:Re=new Uint32Array(O(4*be),0,be);break;case zt:Re=new Float32Array(O(4*be),0,be);break;default:return null}return Re.length!==be?Re.subarray(0,be):Re}function Ce(ve){j(ve.buffer)}return{alloc:O,free:j,allocType:pe,freeType:Ce}}var Sr=cn();Sr.zero=cn();var iu=3408,au=3410,Co=3411,ou=3412,su=3413,uu=3414,OF=3415,PF=33901,RF=33902,BF=3379,FF=3386,UF=34921,GF=36347,zF=36348,$F=35661,VF=35660,jF=34930,WF=36349,XF=34076,YF=34024,HF=7936,qF=7937,KF=7938,ZF=35724,QF=34047,JF=36063,e4=34852,wd=3553,Bx=34067,t4=34069,r4=33984,Vc=6408,By=5126,Fx=5121,Fy=36160,n4=36053,i4=36064,a4=16384,o4=function(E,O){var j=1;O.ext_texture_filter_anisotropic&&(j=E.getParameter(QF));var pe=1,Ce=1;O.webgl_draw_buffers&&(pe=E.getParameter(e4),Ce=E.getParameter(JF));var ve=!!O.oes_texture_float;if(ve){var be=E.createTexture();E.bindTexture(wd,be),E.texImage2D(wd,0,Vc,1,1,0,Vc,By,null);var Re=E.createFramebuffer();if(E.bindFramebuffer(Fy,Re),E.framebufferTexture2D(Fy,i4,wd,be,0),E.bindTexture(wd,null),E.checkFramebufferStatus(Fy)!==n4)ve=!1;else{E.viewport(0,0,1,1),E.clearColor(1,0,0,1),E.clear(a4);var Ue=Sr.allocType(By,4);E.readPixels(0,0,1,1,Vc,By,Ue),E.getError()?ve=!1:(E.deleteFramebuffer(Re),E.deleteTexture(be),ve=Ue[0]===1),Sr.freeType(Ue)}}var je=typeof navigator!="undefined"&&(/MSIE/.test(navigator.userAgent)||/Trident\//.test(navigator.appVersion)||/Edge/.test(navigator.userAgent)),Ge=!0;if(!je){var He=E.createTexture(),et=Sr.allocType(Fx,36);E.activeTexture(r4),E.bindTexture(Bx,He),E.texImage2D(t4,0,Vc,3,3,0,Vc,Fx,et),Sr.freeType(et),E.bindTexture(Bx,null),E.deleteTexture(He),Ge=!E.getError()}return{colorBits:[E.getParameter(au),E.getParameter(Co),E.getParameter(ou),E.getParameter(su)],depthBits:E.getParameter(uu),stencilBits:E.getParameter(OF),subpixelBits:E.getParameter(iu),extensions:Object.keys(O).filter(function(Be){return!!O[Be]}),maxAnisotropic:j,maxDrawbuffers:pe,maxColorAttachments:Ce,pointSizeDims:E.getParameter(PF),lineWidthDims:E.getParameter(RF),maxViewportDims:E.getParameter(FF),maxCombinedTextureUnits:E.getParameter($F),maxCubeMapSize:E.getParameter(XF),maxRenderbufferSize:E.getParameter(YF),maxTextureUnits:E.getParameter(jF),maxTextureSize:E.getParameter(BF),maxAttributes:E.getParameter(UF),maxVertexUniforms:E.getParameter(GF),maxVertexTextureUnits:E.getParameter(VF),maxVaryingVectors:E.getParameter(zF),maxFragmentUniforms:E.getParameter(WF),glsl:E.getParameter(ZF),renderer:E.getParameter(qF),vendor:E.getParameter(HF),version:E.getParameter(KF),readFloat:ve,npotTextureCube:Ge}};function _a(E){return!!E&&typeof E=="object"&&Array.isArray(E.shape)&&Array.isArray(E.stride)&&typeof E.offset=="number"&&E.shape.length===E.stride.length&&(Array.isArray(E.data)||t(E.data))}var ji=function(E){return Object.keys(E).map(function(O){return E[O]})},xd={shape:c4,flatten:l4};function s4(E,O,j){for(var pe=0;pe<O;++pe)j[pe]=E[pe]}function u4(E,O,j,pe){for(var Ce=0,ve=0;ve<O;++ve)for(var be=E[ve],Re=0;Re<j;++Re)pe[Ce++]=be[Re]}function Ux(E,O,j,pe,Ce,ve){for(var be=ve,Re=0;Re<O;++Re)for(var Ue=E[Re],je=0;je<j;++je)for(var Ge=Ue[je],He=0;He<pe;++He)Ce[be++]=Ge[He]}function Gx(E,O,j,pe,Ce){for(var ve=1,be=j+1;be<O.length;++be)ve*=O[be];var Re=O[j];if(O.length-j==4){var Ue=O[j+1],je=O[j+2],Ge=O[j+3];for(be=0;be<Re;++be)Ux(E[be],Ue,je,Ge,pe,Ce),Ce+=ve}else for(be=0;be<Re;++be)Gx(E[be],O,j+1,pe,Ce),Ce+=ve}function l4(E,O,j,pe){var Ce=1;if(O.length)for(var ve=0;ve<O.length;++ve)Ce*=O[ve];else Ce=0;var be=pe||Sr.allocType(j,Ce);switch(O.length){case 0:break;case 1:s4(E,O[0],be);break;case 2:u4(E,O[0],O[1],be);break;case 3:Ux(E,O[0],O[1],O[2],be,0);break;default:Gx(E,O,0,be,0)}return be}function c4(E){for(var O=[],j=E;j.length;j=j[0])O.push(j.length);return O}var Uy={"[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},f4=5120,h4=5122,d4=5124,v4=5121,p4=5123,g4=5125,y4=5126,m4=5126,lu={int8:f4,int16:h4,int32:d4,uint8:v4,uint16:p4,uint32:g4,float:y4,float32:m4},b4=35048,w4=35040,_d={dynamic:b4,stream:w4,static:35044},Gy=xd.flatten,zx=xd.shape,$x=35044,x4=35040,zy=5121,$y=5126,ls=[];ls[5120]=1,ls[5122]=2,ls[5124]=4,ls[5121]=1,ls[5123]=2,ls[5125]=4,ls[5126]=4;function Sd(E){return Uy[Object.prototype.toString.call(E)]|0}function Vx(E,O){for(var j=0;j<O.length;++j)E[j]=O[j]}function jx(E,O,j,pe,Ce,ve,be){for(var Re=0,Ue=0;Ue<j;++Ue)for(var je=0;je<pe;++je)E[Re++]=O[Ce*Ue+ve*je+be]}function _4(E,O,j,pe){var Ce=0,ve={};function be(ae){this.id=Ce++,this.buffer=E.createBuffer(),this.type=ae,this.usage=$x,this.byteLength=0,this.dimension=1,this.dtype=zy,this.persistentData=null,j.profile&&(this.stats={size:0})}be.prototype.bind=function(){E.bindBuffer(this.type,this.buffer)},be.prototype.destroy=function(){et(this)};var Re=[];function Ue(ae,we){var Ve=Re.pop();return Ve||(Ve=new be(ae)),Ve.bind(),He(Ve,we,x4,0,1,!1),Ve}function je(ae){Re.push(ae)}function Ge(ae,we,Ve){ae.byteLength=we.byteLength,E.bufferData(ae.type,we,Ve)}function He(ae,we,Ve,it,Le,ot){var Oe;if(ae.usage=Ve,Array.isArray(we)){if(ae.dtype=it||$y,we.length>0){var Qe;if(Array.isArray(we[0])){Oe=zx(we);for(var Ne=1,Je=1;Je<Oe.length;++Je)Ne*=Oe[Je];ae.dimension=Ne,Qe=Gy(we,Oe,ae.dtype),Ge(ae,Qe,Ve),ot?ae.persistentData=Qe:Sr.freeType(Qe)}else if(typeof we[0]=="number"){ae.dimension=Le;var Tt=Sr.allocType(ae.dtype,we.length);Vx(Tt,we),Ge(ae,Tt,Ve),ot?ae.persistentData=Tt:Sr.freeType(Tt)}else t(we[0])?(ae.dimension=we[0].length,ae.dtype=it||Sd(we[0])||$y,Qe=Gy(we,[we.length,we[0].length],ae.dtype),Ge(ae,Qe,Ve),ot?ae.persistentData=Qe:Sr.freeType(Qe)):D.raise("invalid buffer data")}}else if(t(we))ae.dtype=it||Sd(we),ae.dimension=Le,Ge(ae,we,Ve),ot&&(ae.persistentData=new Uint8Array(new Uint8Array(we.buffer)));else if(_a(we)){Oe=we.shape;var $t=we.stride,tt=we.offset,Xe=0,ke=0,Ut=0,Ht=0;Oe.length===1?(Xe=Oe[0],ke=1,Ut=$t[0],Ht=0):Oe.length===2?(Xe=Oe[0],ke=Oe[1],Ut=$t[0],Ht=$t[1]):D.raise("invalid shape"),ae.dtype=it||Sd(we.data)||$y,ae.dimension=ke;var mt=Sr.allocType(ae.dtype,Xe*ke);jx(mt,we.data,Xe,ke,Ut,Ht,tt),Ge(ae,mt,Ve),ot?ae.persistentData=mt:Sr.freeType(mt)}else we instanceof ArrayBuffer?(ae.dtype=zy,ae.dimension=Le,Ge(ae,we,Ve),ot&&(ae.persistentData=new Uint8Array(new Uint8Array(we)))):D.raise("invalid buffer data")}function et(ae){O.bufferCount--,pe(ae);var we=ae.buffer;D(we,"buffer must not be deleted already"),E.deleteBuffer(we),ae.buffer=null,delete ve[ae.id]}function Be(ae,we,Ve,it){O.bufferCount++;var Le=new be(we);ve[Le.id]=Le;function ot(Ne){var Je=$x,Tt=null,$t=0,tt=0,Xe=1;return Array.isArray(Ne)||t(Ne)||_a(Ne)||Ne instanceof ArrayBuffer?Tt=Ne:typeof Ne=="number"?$t=Ne|0:Ne&&(D.type(Ne,"object","buffer arguments must be an object, a number or an array"),"data"in Ne&&(D(Tt===null||Array.isArray(Tt)||t(Tt)||_a(Tt),"invalid data for buffer"),Tt=Ne.data),"usage"in Ne&&(D.parameter(Ne.usage,_d,"invalid buffer usage"),Je=_d[Ne.usage]),"type"in Ne&&(D.parameter(Ne.type,lu,"invalid buffer type"),tt=lu[Ne.type]),"dimension"in Ne&&(D.type(Ne.dimension,"number","invalid dimension"),Xe=Ne.dimension|0),"length"in Ne&&(D.nni($t,"buffer length must be a nonnegative integer"),$t=Ne.length|0)),Le.bind(),Tt?He(Le,Tt,Je,tt,Xe,it):($t&&E.bufferData(Le.type,$t,Je),Le.dtype=tt||zy,Le.usage=Je,Le.dimension=Xe,Le.byteLength=$t),j.profile&&(Le.stats.size=Le.byteLength*ls[Le.dtype]),ot}function Oe(Ne,Je){D(Je+Ne.byteLength<=Le.byteLength,"invalid buffer subdata call, buffer is too small.  Can't write data of size "+Ne.byteLength+" starting from offset "+Je+" to a buffer of size "+Le.byteLength),E.bufferSubData(Le.type,Je,Ne)}function Qe(Ne,Je){var Tt=(Je||0)|0,$t;if(Le.bind(),t(Ne)||Ne instanceof ArrayBuffer)Oe(Ne,Tt);else if(Array.isArray(Ne)){if(Ne.length>0)if(typeof Ne[0]=="number"){var tt=Sr.allocType(Le.dtype,Ne.length);Vx(tt,Ne),Oe(tt,Tt),Sr.freeType(tt)}else if(Array.isArray(Ne[0])||t(Ne[0])){$t=zx(Ne);var Xe=Gy(Ne,$t,Le.dtype);Oe(Xe,Tt),Sr.freeType(Xe)}else D.raise("invalid buffer data")}else if(_a(Ne)){$t=Ne.shape;var ke=Ne.stride,Ut=0,Ht=0,mt=0,Jt=0;$t.length===1?(Ut=$t[0],Ht=1,mt=ke[0],Jt=0):$t.length===2?(Ut=$t[0],Ht=$t[1],mt=ke[0],Jt=ke[1]):D.raise("invalid shape");var Vt=Array.isArray(Ne.data)?Le.dtype:Sd(Ne.data),Qt=Sr.allocType(Vt,Ut*Ht);jx(Qt,Ne.data,Ut,Ht,mt,Jt,Ne.offset),Oe(Qt,Tt),Sr.freeType(Qt)}else D.raise("invalid data for buffer subdata");return ot}return Ve||ot(ae),ot._reglType="buffer",ot._buffer=Le,ot.subdata=Qe,j.profile&&(ot.stats=Le.stats),ot.destroy=function(){et(Le)},ot}function Ke(){ji(ve).forEach(function(ae){ae.buffer=E.createBuffer(),E.bindBuffer(ae.type,ae.buffer),E.bufferData(ae.type,ae.persistentData||ae.byteLength,ae.usage)})}return j.profile&&(O.getTotalBufferSize=function(){var ae=0;return Object.keys(ve).forEach(function(we){ae+=ve[we].stats.size}),ae}),{create:Be,createStream:Ue,destroyStream:je,clear:function(){ji(ve).forEach(et),Re.forEach(et)},getBuffer:function(ae){return ae&&ae._buffer instanceof be?ae._buffer:null},restore:Ke,_initBuffer:He}}var S4=0,E4=0,A4=1,T4=1,I4=4,C4=4,vl={points:S4,point:E4,lines:A4,line:T4,triangles:I4,triangle:C4,"line loop":2,"line strip":3,"triangle strip":5,"triangle fan":6},M4=0,k4=1,jc=4,D4=5120,pl=5121,Wx=5122,gl=5123,Xx=5124,cu=5125,Vy=34963,L4=35040,N4=35044;function O4(E,O,j,pe){var Ce={},ve=0,be={uint8:pl,uint16:gl};O.oes_element_index_uint&&(be.uint32=cu);function Re(Ke){this.id=ve++,Ce[this.id]=this,this.buffer=Ke,this.primType=jc,this.vertCount=0,this.type=0}Re.prototype.bind=function(){this.buffer.bind()};var Ue=[];function je(Ke){var ae=Ue.pop();return ae||(ae=new Re(j.create(null,Vy,!0,!1)._buffer)),He(ae,Ke,L4,-1,-1,0,0),ae}function Ge(Ke){Ue.push(Ke)}function He(Ke,ae,we,Ve,it,Le,ot){Ke.buffer.bind();var Oe;if(ae){var Qe=ot;!ot&&(!t(ae)||_a(ae)&&!t(ae.data))&&(Qe=O.oes_element_index_uint?cu:gl),j._initBuffer(Ke.buffer,ae,we,Qe,3)}else E.bufferData(Vy,Le,we),Ke.buffer.dtype=Oe||pl,Ke.buffer.usage=we,Ke.buffer.dimension=3,Ke.buffer.byteLength=Le;if(Oe=ot,!ot){switch(Ke.buffer.dtype){case pl:case D4:Oe=pl;break;case gl:case Wx:Oe=gl;break;case cu:case Xx:Oe=cu;break;default:D.raise("unsupported type for element array")}Ke.buffer.dtype=Oe}Ke.type=Oe,D(Oe!==cu||!!O.oes_element_index_uint,"32 bit element buffers not supported, enable oes_element_index_uint first");var Ne=it;Ne<0&&(Ne=Ke.buffer.byteLength,Oe===gl?Ne>>=1:Oe===cu&&(Ne>>=2)),Ke.vertCount=Ne;var Je=Ve;if(Ve<0){Je=jc;var Tt=Ke.buffer.dimension;Tt===1&&(Je=M4),Tt===2&&(Je=k4),Tt===3&&(Je=jc)}Ke.primType=Je}function et(Ke){pe.elementsCount--,D(Ke.buffer!==null,"must not double destroy elements"),delete Ce[Ke.id],Ke.buffer.destroy(),Ke.buffer=null}function Be(Ke,ae){var we=j.create(null,Vy,!0),Ve=new Re(we._buffer);pe.elementsCount++;function it(Le){if(!Le)we(),Ve.primType=jc,Ve.vertCount=0,Ve.type=pl;else if(typeof Le=="number")we(Le),Ve.primType=jc,Ve.vertCount=Le|0,Ve.type=pl;else{var ot=null,Oe=N4,Qe=-1,Ne=-1,Je=0,Tt=0;Array.isArray(Le)||t(Le)||_a(Le)?ot=Le:(D.type(Le,"object","invalid arguments for elements"),"data"in Le&&(ot=Le.data,D(Array.isArray(ot)||t(ot)||_a(ot),"invalid data for element buffer")),"usage"in Le&&(D.parameter(Le.usage,_d,"invalid element buffer usage"),Oe=_d[Le.usage]),"primitive"in Le&&(D.parameter(Le.primitive,vl,"invalid element buffer primitive"),Qe=vl[Le.primitive]),"count"in Le&&(D(typeof Le.count=="number"&&Le.count>=0,"invalid vertex count for elements"),Ne=Le.count|0),"type"in Le&&(D.parameter(Le.type,be,"invalid buffer type"),Tt=be[Le.type]),"length"in Le?Je=Le.length|0:(Je=Ne,Tt===gl||Tt===Wx?Je*=2:(Tt===cu||Tt===Xx)&&(Je*=4))),He(Ve,ot,Oe,Qe,Ne,Je,Tt)}return it}return it(Ke),it._reglType="elements",it._elements=Ve,it.subdata=function(Le,ot){return we.subdata(Le,ot),it},it.destroy=function(){et(Ve)},it}return{create:Be,createStream:je,destroyStream:Ge,getElements:function(Ke){return typeof Ke=="function"&&Ke._elements instanceof Re?Ke._elements:null},clear:function(){ji(Ce).forEach(et)}}}var Yx=new Float32Array(1),P4=new Uint32Array(Yx.buffer),R4=5123;function Hx(E){for(var O=Sr.allocType(R4,E.length),j=0;j<E.length;++j)if(isNaN(E[j]))O[j]=65535;else if(E[j]===1/0)O[j]=31744;else if(E[j]===-1/0)O[j]=64512;else{Yx[0]=E[j];var pe=P4[0],Ce=pe>>>31<<15,ve=(pe<<1>>>24)-127,be=pe>>13&(1<<10)-1;if(ve<-24)O[j]=Ce;else if(ve<-14){var Re=-14-ve;O[j]=Ce+(be+(1<<10)>>Re)}else ve>15?O[j]=Ce+31744:O[j]=Ce+(ve+15<<10)+be}return O}function pn(E){return Array.isArray(E)||t(E)}var qx=function(E){return!(E&E-1)&&!!E},B4=34467,Ya=3553,jy=34067,Ed=34069,fu=6408,Wy=6406,Ad=6407,Wc=6409,Td=6410,Kx=32854,Xy=32855,Zx=36194,F4=32819,U4=32820,G4=33635,z4=34042,Yy=6402,Id=34041,Hy=35904,qy=35906,yl=36193,Ky=33776,Zy=33777,Qy=33778,Jy=33779,Qx=35986,Jx=35987,e_=34798,t_=35840,r_=35841,n_=35842,i_=35843,a_=36196,ml=5121,em=5123,tm=5125,Xc=5126,$4=10242,V4=10243,j4=10497,rm=33071,W4=33648,X4=10240,Y4=10241,nm=9728,H4=9729,im=9984,o_=9985,s_=9986,am=9987,q4=33170,Cd=4352,K4=4353,Z4=4354,Q4=34046,J4=3317,e5=37440,t5=37441,r5=37443,u_=37444,Yc=33984,n5=[im,s_,o_,am],Md=[0,Wc,Td,Ad,fu],oa={};oa[Wc]=oa[Wy]=oa[Yy]=1,oa[Id]=oa[Td]=2,oa[Ad]=oa[Hy]=3,oa[fu]=oa[qy]=4;function bl(E){return"[object "+E+"]"}var l_=bl("HTMLCanvasElement"),c_=bl("OffscreenCanvas"),f_=bl("CanvasRenderingContext2D"),h_=bl("ImageBitmap"),d_=bl("HTMLImageElement"),v_=bl("HTMLVideoElement"),i5=Object.keys(Uy).concat([l_,c_,f_,h_,d_,v_]),wl=[];wl[ml]=1,wl[Xc]=4,wl[yl]=2,wl[em]=2,wl[tm]=4;var Kn=[];Kn[Kx]=2,Kn[Xy]=2,Kn[Zx]=2,Kn[Id]=4,Kn[Ky]=.5,Kn[Zy]=.5,Kn[Qy]=1,Kn[Jy]=1,Kn[Qx]=.5,Kn[Jx]=1,Kn[e_]=1,Kn[t_]=.5,Kn[r_]=.25,Kn[n_]=.5,Kn[i_]=.25,Kn[a_]=.5;function p_(E){return Array.isArray(E)&&(E.length===0||typeof E[0]=="number")}function g_(E){if(!Array.isArray(E))return!1;var O=E.length;return!(O===0||!pn(E[0]))}function hu(E){return Object.prototype.toString.call(E)}function y_(E){return hu(E)===l_}function m_(E){return hu(E)===c_}function a5(E){return hu(E)===f_}function o5(E){return hu(E)===h_}function s5(E){return hu(E)===d_}function u5(E){return hu(E)===v_}function om(E){if(!E)return!1;var O=hu(E);return i5.indexOf(O)>=0?!0:p_(E)||g_(E)||_a(E)}function b_(E){return Uy[Object.prototype.toString.call(E)]|0}function l5(E,O){var j=O.length;switch(E.type){case ml:case em:case tm:case Xc:var pe=Sr.allocType(E.type,j);pe.set(O),E.data=pe;break;case yl:E.data=Hx(O);break;default:D.raise("unsupported texture type, must specify a typed array")}}function w_(E,O){return Sr.allocType(E.type===yl?Xc:E.type,O)}function x_(E,O){E.type===yl?(E.data=Hx(O),Sr.freeType(O)):E.data=O}function c5(E,O,j,pe,Ce,ve){for(var be=E.width,Re=E.height,Ue=E.channels,je=be*Re*Ue,Ge=w_(E,je),He=0,et=0;et<Re;++et)for(var Be=0;Be<be;++Be)for(var Ke=0;Ke<Ue;++Ke)Ge[He++]=O[j*Be+pe*et+Ce*Ke+ve];x_(E,Ge)}function kd(E,O,j,pe,Ce,ve){var be;if(typeof Kn[E]!="undefined"?be=Kn[E]:be=oa[E]*wl[O],ve&&(be*=6),Ce){for(var Re=0,Ue=j;Ue>=1;)Re+=be*Ue*Ue,Ue/=2;return Re}else return be*j*pe}function f5(E,O,j,pe,Ce,ve,be){var Re={"don't care":Cd,"dont care":Cd,nice:Z4,fast:K4},Ue={repeat:j4,clamp:rm,mirror:W4},je={nearest:nm,linear:H4},Ge=n({mipmap:am,"nearest mipmap nearest":im,"linear mipmap nearest":o_,"nearest mipmap linear":s_,"linear mipmap linear":am},je),He={none:0,browser:u_},et={uint8:ml,rgba4:F4,rgb565:G4,"rgb5 a1":U4},Be={alpha:Wy,luminance:Wc,"luminance alpha":Td,rgb:Ad,rgba:fu,rgba4:Kx,"rgb5 a1":Xy,rgb565:Zx},Ke={};O.ext_srgb&&(Be.srgb=Hy,Be.srgba=qy),O.oes_texture_float&&(et.float32=et.float=Xc),O.oes_texture_half_float&&(et.float16=et["half float"]=yl),O.webgl_depth_texture&&(n(Be,{depth:Yy,"depth stencil":Id}),n(et,{uint16:em,uint32:tm,"depth stencil":z4})),O.webgl_compressed_texture_s3tc&&n(Ke,{"rgb s3tc dxt1":Ky,"rgba s3tc dxt1":Zy,"rgba s3tc dxt3":Qy,"rgba s3tc dxt5":Jy}),O.webgl_compressed_texture_atc&&n(Ke,{"rgb atc":Qx,"rgba atc explicit alpha":Jx,"rgba atc interpolated alpha":e_}),O.webgl_compressed_texture_pvrtc&&n(Ke,{"rgb pvrtc 4bppv1":t_,"rgb pvrtc 2bppv1":r_,"rgba pvrtc 4bppv1":n_,"rgba pvrtc 2bppv1":i_}),O.webgl_compressed_texture_etc1&&(Ke["rgb etc1"]=a_);var ae=Array.prototype.slice.call(E.getParameter(B4));Object.keys(Ke).forEach(function(G){var ge=Ke[G];ae.indexOf(ge)>=0&&(Be[G]=ge)});var we=Object.keys(Be);j.textureFormats=we;var Ve=[];Object.keys(Be).forEach(function(G){var ge=Be[G];Ve[ge]=G});var it=[];Object.keys(et).forEach(function(G){var ge=et[G];it[ge]=G});var Le=[];Object.keys(je).forEach(function(G){var ge=je[G];Le[ge]=G});var ot=[];Object.keys(Ge).forEach(function(G){var ge=Ge[G];ot[ge]=G});var Oe=[];Object.keys(Ue).forEach(function(G){var ge=Ue[G];Oe[ge]=G});var Qe=we.reduce(function(G,ge){var de=Be[ge];return de===Wc||de===Wy||de===Wc||de===Td||de===Yy||de===Id||O.ext_srgb&&(de===Hy||de===qy)?G[de]=de:de===Xy||ge.indexOf("rgba")>=0?G[de]=fu:G[de]=Ad,G},{});function Ne(){this.internalformat=fu,this.format=fu,this.type=ml,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=u_,this.width=0,this.height=0,this.channels=0}function Je(G,ge){G.internalformat=ge.internalformat,G.format=ge.format,G.type=ge.type,G.compressed=ge.compressed,G.premultiplyAlpha=ge.premultiplyAlpha,G.flipY=ge.flipY,G.unpackAlignment=ge.unpackAlignment,G.colorSpace=ge.colorSpace,G.width=ge.width,G.height=ge.height,G.channels=ge.channels}function Tt(G,ge){if(!(typeof ge!="object"||!ge)){if("premultiplyAlpha"in ge&&(D.type(ge.premultiplyAlpha,"boolean","invalid premultiplyAlpha"),G.premultiplyAlpha=ge.premultiplyAlpha),"flipY"in ge&&(D.type(ge.flipY,"boolean","invalid texture flip"),G.flipY=ge.flipY),"alignment"in ge&&(D.oneOf(ge.alignment,[1,2,4,8],"invalid texture unpack alignment"),G.unpackAlignment=ge.alignment),"colorSpace"in ge&&(D.parameter(ge.colorSpace,He,"invalid colorSpace"),G.colorSpace=He[ge.colorSpace]),"type"in ge){var de=ge.type;D(O.oes_texture_float||!(de==="float"||de==="float32"),"you must enable the OES_texture_float extension in order to use floating point textures."),D(O.oes_texture_half_float||!(de==="half float"||de==="float16"),"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures."),D(O.webgl_depth_texture||!(de==="uint16"||de==="uint32"||de==="depth stencil"),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),D.parameter(de,et,"invalid texture type"),G.type=et[de]}var lt=G.width,er=G.height,F=G.channels,N=!1;"shape"in ge?(D(Array.isArray(ge.shape)&&ge.shape.length>=2,"shape must be an array"),lt=ge.shape[0],er=ge.shape[1],ge.shape.length===3&&(F=ge.shape[2],D(F>0&&F<=4,"invalid number of channels"),N=!0),D(lt>=0&&lt<=j.maxTextureSize,"invalid width"),D(er>=0&&er<=j.maxTextureSize,"invalid height")):("radius"in ge&&(lt=er=ge.radius,D(lt>=0&&lt<=j.maxTextureSize,"invalid radius")),"width"in ge&&(lt=ge.width,D(lt>=0&&lt<=j.maxTextureSize,"invalid width")),"height"in ge&&(er=ge.height,D(er>=0&&er<=j.maxTextureSize,"invalid height")),"channels"in ge&&(F=ge.channels,D(F>0&&F<=4,"invalid number of channels"),N=!0)),G.width=lt|0,G.height=er|0,G.channels=F|0;var q=!1;if("format"in ge){var ie=ge.format;D(O.webgl_depth_texture||!(ie==="depth"||ie==="depth stencil"),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),D.parameter(ie,Be,"invalid texture format");var ce=G.internalformat=Be[ie];G.format=Qe[ce],ie in et&&("type"in ge||(G.type=et[ie])),ie in Ke&&(G.compressed=!0),q=!0}!N&&q?G.channels=oa[G.format]:N&&!q?G.channels!==Md[G.format]&&(G.format=G.internalformat=Md[G.channels]):q&&N&&D(G.channels===oa[G.format],"number of channels inconsistent with specified format")}}function $t(G){E.pixelStorei(e5,G.flipY),E.pixelStorei(t5,G.premultiplyAlpha),E.pixelStorei(r5,G.colorSpace),E.pixelStorei(J4,G.unpackAlignment)}function tt(){Ne.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function Xe(G,ge){var de=null;if(om(ge)?de=ge:ge&&(D.type(ge,"object","invalid pixel data type"),Tt(G,ge),"x"in ge&&(G.xOffset=ge.x|0),"y"in ge&&(G.yOffset=ge.y|0),om(ge.data)&&(de=ge.data)),D(!G.compressed||de instanceof Uint8Array,"compressed texture data must be stored in a uint8array"),ge.copy){D(!de,"can not specify copy and data field for the same texture");var lt=Ce.viewportWidth,er=Ce.viewportHeight;G.width=G.width||lt-G.xOffset,G.height=G.height||er-G.yOffset,G.needsCopy=!0,D(G.xOffset>=0&&G.xOffset<lt&&G.yOffset>=0&&G.yOffset<er&&G.width>0&&G.width<=lt&&G.height>0&&G.height<=er,"copy texture read out of bounds")}else if(!de)G.width=G.width||1,G.height=G.height||1,G.channels=G.channels||4;else if(t(de))G.channels=G.channels||4,G.data=de,!("type"in ge)&&G.type===ml&&(G.type=b_(de));else if(p_(de))G.channels=G.channels||4,l5(G,de),G.alignment=1,G.needsFree=!0;else if(_a(de)){var F=de.data;!Array.isArray(F)&&G.type===ml&&(G.type=b_(F));var N=de.shape,q=de.stride,ie,ce,Q,Z,te,U;N.length===3?(Q=N[2],U=q[2]):(D(N.length===2,"invalid ndarray pixel data, must be 2 or 3D"),Q=1,U=1),ie=N[0],ce=N[1],Z=q[0],te=q[1],G.alignment=1,G.width=ie,G.height=ce,G.channels=Q,G.format=G.internalformat=Md[Q],G.needsFree=!0,c5(G,F,Z,te,U,de.offset)}else if(y_(de)||m_(de)||a5(de))y_(de)||m_(de)?G.element=de:G.element=de.canvas,G.width=G.element.width,G.height=G.element.height,G.channels=4;else if(o5(de))G.element=de,G.width=de.width,G.height=de.height,G.channels=4;else if(s5(de))G.element=de,G.width=de.naturalWidth,G.height=de.naturalHeight,G.channels=4;else if(u5(de))G.element=de,G.width=de.videoWidth,G.height=de.videoHeight,G.channels=4;else if(g_(de)){var Y=G.width||de[0].length,R=G.height||de.length,re=G.channels;pn(de[0][0])?re=re||de[0][0].length:re=re||1;for(var fe=xd.shape(de),Te=1,Me=0;Me<fe.length;++Me)Te*=fe[Me];var _e=w_(G,Te);xd.flatten(de,fe,"",_e),x_(G,_e),G.alignment=1,G.width=Y,G.height=R,G.channels=re,G.format=G.internalformat=Md[re],G.needsFree=!0}G.type===Xc?D(j.extensions.indexOf("oes_texture_float")>=0,"oes_texture_float extension not enabled"):G.type===yl&&D(j.extensions.indexOf("oes_texture_half_float")>=0,"oes_texture_half_float extension not enabled")}function ke(G,ge,de){var lt=G.element,er=G.data,F=G.internalformat,N=G.format,q=G.type,ie=G.width,ce=G.height;$t(G),lt?E.texImage2D(ge,de,N,N,q,lt):G.compressed?E.compressedTexImage2D(ge,de,F,ie,ce,0,er):G.needsCopy?(pe(),E.copyTexImage2D(ge,de,N,G.xOffset,G.yOffset,ie,ce,0)):E.texImage2D(ge,de,N,ie,ce,0,N,q,er||null)}function Ut(G,ge,de,lt,er){var F=G.element,N=G.data,q=G.internalformat,ie=G.format,ce=G.type,Q=G.width,Z=G.height;$t(G),F?E.texSubImage2D(ge,er,de,lt,ie,ce,F):G.compressed?E.compressedTexSubImage2D(ge,er,de,lt,q,Q,Z,N):G.needsCopy?(pe(),E.copyTexSubImage2D(ge,er,de,lt,G.xOffset,G.yOffset,Q,Z)):E.texSubImage2D(ge,er,de,lt,Q,Z,ie,ce,N)}var Ht=[];function mt(){return Ht.pop()||new tt}function Jt(G){G.needsFree&&Sr.freeType(G.data),tt.call(G),Ht.push(G)}function Vt(){Ne.call(this),this.genMipmaps=!1,this.mipmapHint=Cd,this.mipmask=0,this.images=Array(16)}function Qt(G,ge,de){var lt=G.images[0]=mt();G.mipmask=1,lt.width=G.width=ge,lt.height=G.height=de,lt.channels=G.channels=4}function Er(G,ge){var de=null;if(om(ge))de=G.images[0]=mt(),Je(de,G),Xe(de,ge),G.mipmask=1;else if(Tt(G,ge),Array.isArray(ge.mipmap))for(var lt=ge.mipmap,er=0;er<lt.length;++er)de=G.images[er]=mt(),Je(de,G),de.width>>=er,de.height>>=er,Xe(de,lt[er]),G.mipmask|=1<<er;else de=G.images[0]=mt(),Je(de,G),Xe(de,ge),G.mipmask=1;Je(G,G.images[0]),G.compressed&&(G.internalformat===Ky||G.internalformat===Zy||G.internalformat===Qy||G.internalformat===Jy)&&D(G.width%4==0&&G.height%4==0,"for compressed texture formats, mipmap level 0 must have width and height that are a multiple of 4")}function _n(G,ge){for(var de=G.images,lt=0;lt<de.length;++lt){if(!de[lt])return;ke(de[lt],ge,lt)}}var Nn=[];function ir(){var G=Nn.pop()||new Vt;Ne.call(G),G.mipmask=0;for(var ge=0;ge<16;++ge)G.images[ge]=null;return G}function Cn(G){for(var ge=G.images,de=0;de<ge.length;++de)ge[de]&&Jt(ge[de]),ge[de]=null;Nn.push(G)}function Jr(){this.minFilter=nm,this.magFilter=nm,this.wrapS=rm,this.wrapT=rm,this.anisotropic=1,this.genMipmaps=!1,this.mipmapHint=Cd}function Sn(G,ge){if("min"in ge){var de=ge.min;D.parameter(de,Ge),G.minFilter=Ge[de],n5.indexOf(G.minFilter)>=0&&!("faces"in ge)&&(G.genMipmaps=!0)}if("mag"in ge){var lt=ge.mag;D.parameter(lt,je),G.magFilter=je[lt]}var er=G.wrapS,F=G.wrapT;if("wrap"in ge){var N=ge.wrap;typeof N=="string"?(D.parameter(N,Ue),er=F=Ue[N]):Array.isArray(N)&&(D.parameter(N[0],Ue),D.parameter(N[1],Ue),er=Ue[N[0]],F=Ue[N[1]])}else{if("wrapS"in ge){var q=ge.wrapS;D.parameter(q,Ue),er=Ue[q]}if("wrapT"in ge){var ie=ge.wrapT;D.parameter(ie,Ue),F=Ue[ie]}}if(G.wrapS=er,G.wrapT=F,"anisotropic"in ge){var ce=ge.anisotropic;D(typeof ce=="number"&&ce>=1&&ce<=j.maxAnisotropic,"aniso samples must be between 1 and "),G.anisotropic=ge.anisotropic}if("mipmap"in ge){var Q=!1;switch(typeof ge.mipmap){case"string":D.parameter(ge.mipmap,Re,"invalid mipmap hint"),G.mipmapHint=Re[ge.mipmap],G.genMipmaps=!0,Q=!0;break;case"boolean":Q=G.genMipmaps=ge.mipmap;break;case"object":D(Array.isArray(ge.mipmap),"invalid mipmap type"),G.genMipmaps=!1,Q=!0;break;default:D.raise("invalid mipmap type")}Q&&!("min"in ge)&&(G.minFilter=im)}}function Mn(G,ge){E.texParameteri(ge,Y4,G.minFilter),E.texParameteri(ge,X4,G.magFilter),E.texParameteri(ge,$4,G.wrapS),E.texParameteri(ge,V4,G.wrapT),O.ext_texture_filter_anisotropic&&E.texParameteri(ge,Q4,G.anisotropic),G.genMipmaps&&(E.hint(q4,G.mipmapHint),E.generateMipmap(ge))}var kn=0,Gn={},Zn=j.maxTextureUnits,gn=Array(Zn).map(function(){return null});function qt(G){Ne.call(this),this.mipmask=0,this.internalformat=fu,this.id=kn++,this.refCount=1,this.target=G,this.texture=E.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new Jr,be.profile&&(this.stats={size:0})}function Qn(G){E.activeTexture(Yc),E.bindTexture(G.target,G.texture)}function Or(){var G=gn[0];G?E.bindTexture(G.target,G.texture):E.bindTexture(Ya,null)}function Lt(G){var ge=G.texture;D(ge,"must not double destroy texture");var de=G.unit,lt=G.target;de>=0&&(E.activeTexture(Yc+de),E.bindTexture(lt,null),gn[de]=null),E.deleteTexture(ge),G.texture=null,G.params=null,G.pixels=null,G.refCount=0,delete Gn[G.id],ve.textureCount--}n(qt.prototype,{bind:function(){var G=this;G.bindCount+=1;var ge=G.unit;if(ge<0){for(var de=0;de<Zn;++de){var lt=gn[de];if(lt){if(lt.bindCount>0)continue;lt.unit=-1}gn[de]=G,ge=de;break}ge>=Zn&&D.raise("insufficient number of texture units"),be.profile&&ve.maxTextureUnits<ge+1&&(ve.maxTextureUnits=ge+1),G.unit=ge,E.activeTexture(Yc+ge),E.bindTexture(G.target,G.texture)}return ge},unbind:function(){this.bindCount-=1},decRef:function(){--this.refCount<=0&&Lt(this)}});function rr(G,ge){var de=new qt(Ya);Gn[de.id]=de,ve.textureCount++;function lt(N,q){var ie=de.texInfo;Jr.call(ie);var ce=ir();return typeof N=="number"?typeof q=="number"?Qt(ce,N|0,q|0):Qt(ce,N|0,N|0):N?(D.type(N,"object","invalid arguments to regl.texture"),Sn(ie,N),Er(ce,N)):Qt(ce,1,1),ie.genMipmaps&&(ce.mipmask=(ce.width<<1)-1),de.mipmask=ce.mipmask,Je(de,ce),D.texture2D(ie,ce,j),de.internalformat=ce.internalformat,lt.width=ce.width,lt.height=ce.height,Qn(de),_n(ce,Ya),Mn(ie,Ya),Or(),Cn(ce),be.profile&&(de.stats.size=kd(de.internalformat,de.type,ce.width,ce.height,ie.genMipmaps,!1)),lt.format=Ve[de.internalformat],lt.type=it[de.type],lt.mag=Le[ie.magFilter],lt.min=ot[ie.minFilter],lt.wrapS=Oe[ie.wrapS],lt.wrapT=Oe[ie.wrapT],lt}function er(N,q,ie,ce){D(!!N,"must specify image data");var Q=q|0,Z=ie|0,te=ce|0,U=mt();return Je(U,de),U.width=0,U.height=0,Xe(U,N),U.width=U.width||(de.width>>te)-Q,U.height=U.height||(de.height>>te)-Z,D(de.type===U.type&&de.format===U.format&&de.internalformat===U.internalformat,"incompatible format for texture.subimage"),D(Q>=0&&Z>=0&&Q+U.width<=de.width&&Z+U.height<=de.height,"texture.subimage write out of bounds"),D(de.mipmask&1<<te,"missing mipmap data"),D(U.data||U.element||U.needsCopy,"missing image data"),Qn(de),Ut(U,Ya,Q,Z,te),Or(),Jt(U),lt}function F(N,q){var ie=N|0,ce=q|0||ie;if(ie===de.width&&ce===de.height)return lt;lt.width=de.width=ie,lt.height=de.height=ce,Qn(de);for(var Q=0;de.mipmask>>Q;++Q){var Z=ie>>Q,te=ce>>Q;if(!Z||!te)break;E.texImage2D(Ya,Q,de.format,Z,te,0,de.format,de.type,null)}return Or(),be.profile&&(de.stats.size=kd(de.internalformat,de.type,ie,ce,!1,!1)),lt}return lt(G,ge),lt.subimage=er,lt.resize=F,lt._reglType="texture2d",lt._texture=de,be.profile&&(lt.stats=de.stats),lt.destroy=function(){de.decRef()},lt}function mr(G,ge,de,lt,er,F){var N=new qt(jy);Gn[N.id]=N,ve.cubeCount++;var q=new Array(6);function ie(Z,te,U,Y,R,re){var fe,Te=N.texInfo;for(Jr.call(Te),fe=0;fe<6;++fe)q[fe]=ir();if(typeof Z=="number"||!Z){var Me=Z|0||1;for(fe=0;fe<6;++fe)Qt(q[fe],Me,Me)}else if(typeof Z=="object")if(te)Er(q[0],Z),Er(q[1],te),Er(q[2],U),Er(q[3],Y),Er(q[4],R),Er(q[5],re);else if(Sn(Te,Z),Tt(N,Z),"faces"in Z){var _e=Z.faces;for(D(Array.isArray(_e)&&_e.length===6,"cube faces must be a length 6 array"),fe=0;fe<6;++fe)D(typeof _e[fe]=="object"&&!!_e[fe],"invalid input for cube map face"),Je(q[fe],N),Er(q[fe],_e[fe])}else for(fe=0;fe<6;++fe)Er(q[fe],Z);else D.raise("invalid arguments to cube map");for(Je(N,q[0]),j.npotTextureCube||D(qx(N.width)&&qx(N.height),"your browser does not support non power or two texture dimensions"),Te.genMipmaps?N.mipmask=(q[0].width<<1)-1:N.mipmask=q[0].mipmask,D.textureCube(N,Te,q,j),N.internalformat=q[0].internalformat,ie.width=q[0].width,ie.height=q[0].height,Qn(N),fe=0;fe<6;++fe)_n(q[fe],Ed+fe);for(Mn(Te,jy),Or(),be.profile&&(N.stats.size=kd(N.internalformat,N.type,ie.width,ie.height,Te.genMipmaps,!0)),ie.format=Ve[N.internalformat],ie.type=it[N.type],ie.mag=Le[Te.magFilter],ie.min=ot[Te.minFilter],ie.wrapS=Oe[Te.wrapS],ie.wrapT=Oe[Te.wrapT],fe=0;fe<6;++fe)Cn(q[fe]);return ie}function ce(Z,te,U,Y,R){D(!!te,"must specify image data"),D(typeof Z=="number"&&Z===(Z|0)&&Z>=0&&Z<6,"invalid face");var re=U|0,fe=Y|0,Te=R|0,Me=mt();return Je(Me,N),Me.width=0,Me.height=0,Xe(Me,te),Me.width=Me.width||(N.width>>Te)-re,Me.height=Me.height||(N.height>>Te)-fe,D(N.type===Me.type&&N.format===Me.format&&N.internalformat===Me.internalformat,"incompatible format for texture.subimage"),D(re>=0&&fe>=0&&re+Me.width<=N.width&&fe+Me.height<=N.height,"texture.subimage write out of bounds"),D(N.mipmask&1<<Te,"missing mipmap data"),D(Me.data||Me.element||Me.needsCopy,"missing image data"),Qn(N),Ut(Me,Ed+Z,re,fe,Te),Or(),Jt(Me),ie}function Q(Z){var te=Z|0;if(te!==N.width){ie.width=N.width=te,ie.height=N.height=te,Qn(N);for(var U=0;U<6;++U)for(var Y=0;N.mipmask>>Y;++Y)E.texImage2D(Ed+U,Y,N.format,te>>Y,te>>Y,0,N.format,N.type,null);return Or(),be.profile&&(N.stats.size=kd(N.internalformat,N.type,ie.width,ie.height,!1,!0)),ie}}return ie(G,ge,de,lt,er,F),ie.subimage=ce,ie.resize=Q,ie._reglType="textureCube",ie._texture=N,be.profile&&(ie.stats=N.stats),ie.destroy=function(){N.decRef()},ie}function yn(){for(var G=0;G<Zn;++G)E.activeTexture(Yc+G),E.bindTexture(Ya,null),gn[G]=null;ji(Gn).forEach(Lt),ve.cubeCount=0,ve.textureCount=0}be.profile&&(ve.getTotalTextureSize=function(){var G=0;return Object.keys(Gn).forEach(function(ge){G+=Gn[ge].stats.size}),G});function qa(){for(var G=0;G<Zn;++G){var ge=gn[G];ge&&(ge.bindCount=0,ge.unit=-1,gn[G]=null)}ji(Gn).forEach(function(de){de.texture=E.createTexture(),E.bindTexture(de.target,de.texture);for(var lt=0;lt<32;++lt)if((de.mipmask&1<<lt)!=0)if(de.target===Ya)E.texImage2D(Ya,lt,de.internalformat,de.width>>lt,de.height>>lt,0,de.internalformat,de.type,null);else for(var er=0;er<6;++er)E.texImage2D(Ed+er,lt,de.internalformat,de.width>>lt,de.height>>lt,0,de.internalformat,de.type,null);Mn(de.texInfo,de.target)})}function bu(){for(var G=0;G<Zn;++G){var ge=gn[G];ge&&(ge.bindCount=0,ge.unit=-1,gn[G]=null),E.activeTexture(Yc+G),E.bindTexture(Ya,null),E.bindTexture(jy,null)}}return{create2D:rr,createCube:mr,clear:yn,getTexture:function(G){return null},restore:qa,refresh:bu}}var cs=36161,Dd=32854,__=32855,S_=36194,E_=33189,A_=36168,T_=34041,I_=35907,C_=34836,M_=34842,k_=34843,Sa=[];Sa[Dd]=2,Sa[__]=2,Sa[S_]=2,Sa[E_]=2,Sa[A_]=1,Sa[T_]=4,Sa[I_]=4,Sa[C_]=16,Sa[M_]=8,Sa[k_]=6;function D_(E,O,j){return Sa[E]*O*j}var h5=function(E,O,j,pe,Ce){var ve={rgba4:Dd,rgb565:S_,"rgb5 a1":__,depth:E_,stencil:A_,"depth stencil":T_};O.ext_srgb&&(ve.srgba=I_),O.ext_color_buffer_half_float&&(ve.rgba16f=M_,ve.rgb16f=k_),O.webgl_color_buffer_float&&(ve.rgba32f=C_);var be=[];Object.keys(ve).forEach(function(Be){var Ke=ve[Be];be[Ke]=Be});var Re=0,Ue={};function je(Be){this.id=Re++,this.refCount=1,this.renderbuffer=Be,this.format=Dd,this.width=0,this.height=0,Ce.profile&&(this.stats={size:0})}je.prototype.decRef=function(){--this.refCount<=0&&Ge(this)};function Ge(Be){var Ke=Be.renderbuffer;D(Ke,"must not double destroy renderbuffer"),E.bindRenderbuffer(cs,null),E.deleteRenderbuffer(Ke),Be.renderbuffer=null,Be.refCount=0,delete Ue[Be.id],pe.renderbufferCount--}function He(Be,Ke){var ae=new je(E.createRenderbuffer());Ue[ae.id]=ae,pe.renderbufferCount++;function we(it,Le){var ot=0,Oe=0,Qe=Dd;if(typeof it=="object"&&it){var Ne=it;if("shape"in Ne){var Je=Ne.shape;D(Array.isArray(Je)&&Je.length>=2,"invalid renderbuffer shape"),ot=Je[0]|0,Oe=Je[1]|0}else"radius"in Ne&&(ot=Oe=Ne.radius|0),"width"in Ne&&(ot=Ne.width|0),"height"in Ne&&(Oe=Ne.height|0);"format"in Ne&&(D.parameter(Ne.format,ve,"invalid renderbuffer format"),Qe=ve[Ne.format])}else typeof it=="number"?(ot=it|0,typeof Le=="number"?Oe=Le|0:Oe=ot):it?D.raise("invalid arguments to renderbuffer constructor"):ot=Oe=1;if(D(ot>0&&Oe>0&&ot<=j.maxRenderbufferSize&&Oe<=j.maxRenderbufferSize,"invalid renderbuffer size"),!(ot===ae.width&&Oe===ae.height&&Qe===ae.format))return we.width=ae.width=ot,we.height=ae.height=Oe,ae.format=Qe,E.bindRenderbuffer(cs,ae.renderbuffer),E.renderbufferStorage(cs,Qe,ot,Oe),D(E.getError()===0,"invalid render buffer format"),Ce.profile&&(ae.stats.size=D_(ae.format,ae.width,ae.height)),we.format=be[ae.format],we}function Ve(it,Le){var ot=it|0,Oe=Le|0||ot;return ot===ae.width&&Oe===ae.height||(D(ot>0&&Oe>0&&ot<=j.maxRenderbufferSize&&Oe<=j.maxRenderbufferSize,"invalid renderbuffer size"),we.width=ae.width=ot,we.height=ae.height=Oe,E.bindRenderbuffer(cs,ae.renderbuffer),E.renderbufferStorage(cs,ae.format,ot,Oe),D(E.getError()===0,"invalid render buffer format"),Ce.profile&&(ae.stats.size=D_(ae.format,ae.width,ae.height))),we}return we(Be,Ke),we.resize=Ve,we._reglType="renderbuffer",we._renderbuffer=ae,Ce.profile&&(we.stats=ae.stats),we.destroy=function(){ae.decRef()},we}Ce.profile&&(pe.getTotalRenderbufferSize=function(){var Be=0;return Object.keys(Ue).forEach(function(Ke){Be+=Ue[Ke].stats.size}),Be});function et(){ji(Ue).forEach(function(Be){Be.renderbuffer=E.createRenderbuffer(),E.bindRenderbuffer(cs,Be.renderbuffer),E.renderbufferStorage(cs,Be.format,Be.width,Be.height)}),E.bindRenderbuffer(cs,null)}return{create:He,clear:function(){ji(Ue).forEach(Ge)},restore:et}},Mo=36160,sm=36161,du=3553,Ld=34069,L_=36064,N_=36096,O_=36128,P_=33306,R_=36053,d5=36054,v5=36055,p5=36057,g5=36061,y5=36193,m5=5121,b5=5126,B_=6407,F_=6408,w5=6402,x5=[B_,F_],um=[];um[F_]=4,um[B_]=3;var Nd=[];Nd[m5]=1,Nd[b5]=4,Nd[y5]=2;var _5=32854,S5=32855,E5=36194,A5=33189,T5=36168,U_=34041,I5=35907,C5=34836,M5=34842,k5=34843,D5=[_5,S5,E5,I5,M5,k5,C5],xl={};xl[R_]="complete",xl[d5]="incomplete attachment",xl[p5]="incomplete dimensions",xl[v5]="incomplete, missing attachment",xl[g5]="unsupported";function L5(E,O,j,pe,Ce,ve){var be={cur:null,next:null,dirty:!1,setFBO:null},Re=["rgba"],Ue=["rgba4","rgb565","rgb5 a1"];O.ext_srgb&&Ue.push("srgba"),O.ext_color_buffer_half_float&&Ue.push("rgba16f","rgb16f"),O.webgl_color_buffer_float&&Ue.push("rgba32f");var je=["uint8"];O.oes_texture_half_float&&je.push("half float","float16"),O.oes_texture_float&&je.push("float","float32");function Ge(tt,Xe,ke){this.target=tt,this.texture=Xe,this.renderbuffer=ke;var Ut=0,Ht=0;Xe?(Ut=Xe.width,Ht=Xe.height):ke&&(Ut=ke.width,Ht=ke.height),this.width=Ut,this.height=Ht}function He(tt){tt&&(tt.texture&&tt.texture._texture.decRef(),tt.renderbuffer&&tt.renderbuffer._renderbuffer.decRef())}function et(tt,Xe,ke){if(!!tt)if(tt.texture){var Ut=tt.texture._texture,Ht=Math.max(1,Ut.width),mt=Math.max(1,Ut.height);D(Ht===Xe&&mt===ke,"inconsistent width/height for supplied texture"),Ut.refCount+=1}else{var Jt=tt.renderbuffer._renderbuffer;D(Jt.width===Xe&&Jt.height===ke,"inconsistent width/height for renderbuffer"),Jt.refCount+=1}}function Be(tt,Xe){Xe&&(Xe.texture?E.framebufferTexture2D(Mo,tt,Xe.target,Xe.texture._texture.texture,0):E.framebufferRenderbuffer(Mo,tt,sm,Xe.renderbuffer._renderbuffer.renderbuffer))}function Ke(tt){var Xe=du,ke=null,Ut=null,Ht=tt;typeof tt=="object"&&(Ht=tt.data,"target"in tt&&(Xe=tt.target|0)),D.type(Ht,"function","invalid attachment data");var mt=Ht._reglType;return mt==="texture2d"?(ke=Ht,D(Xe===du)):mt==="textureCube"?(ke=Ht,D(Xe>=Ld&&Xe<Ld+6,"invalid cube map target")):mt==="renderbuffer"?(Ut=Ht,Xe=sm):D.raise("invalid regl object for attachment"),new Ge(Xe,ke,Ut)}function ae(tt,Xe,ke,Ut,Ht){if(ke){var mt=pe.create2D({width:tt,height:Xe,format:Ut,type:Ht});return mt._texture.refCount=0,new Ge(du,mt,null)}else{var Jt=Ce.create({width:tt,height:Xe,format:Ut});return Jt._renderbuffer.refCount=0,new Ge(sm,null,Jt)}}function we(tt){return tt&&(tt.texture||tt.renderbuffer)}function Ve(tt,Xe,ke){tt&&(tt.texture?tt.texture.resize(Xe,ke):tt.renderbuffer&&tt.renderbuffer.resize(Xe,ke),tt.width=Xe,tt.height=ke)}var it=0,Le={};function ot(){this.id=it++,Le[this.id]=this,this.framebuffer=E.createFramebuffer(),this.width=0,this.height=0,this.colorAttachments=[],this.depthAttachment=null,this.stencilAttachment=null,this.depthStencilAttachment=null}function Oe(tt){tt.colorAttachments.forEach(He),He(tt.depthAttachment),He(tt.stencilAttachment),He(tt.depthStencilAttachment)}function Qe(tt){var Xe=tt.framebuffer;D(Xe,"must not double destroy framebuffer"),E.deleteFramebuffer(Xe),tt.framebuffer=null,ve.framebufferCount--,delete Le[tt.id]}function Ne(tt){var Xe;E.bindFramebuffer(Mo,tt.framebuffer);var ke=tt.colorAttachments;for(Xe=0;Xe<ke.length;++Xe)Be(L_+Xe,ke[Xe]);for(Xe=ke.length;Xe<j.maxColorAttachments;++Xe)E.framebufferTexture2D(Mo,L_+Xe,du,null,0);E.framebufferTexture2D(Mo,P_,du,null,0),E.framebufferTexture2D(Mo,N_,du,null,0),E.framebufferTexture2D(Mo,O_,du,null,0),Be(N_,tt.depthAttachment),Be(O_,tt.stencilAttachment),Be(P_,tt.depthStencilAttachment);var Ut=E.checkFramebufferStatus(Mo);!E.isContextLost()&&Ut!==R_&&D.raise("framebuffer configuration not supported, status = "+xl[Ut]),E.bindFramebuffer(Mo,be.next?be.next.framebuffer:null),be.cur=be.next,E.getError()}function Je(tt,Xe){var ke=new ot;ve.framebufferCount++;function Ut(mt,Jt){var Vt;D(be.next!==ke,"can not update framebuffer which is currently in use");var Qt=0,Er=0,_n=!0,Nn=!0,ir=null,Cn=!0,Jr="rgba",Sn="uint8",Mn=1,kn=null,Gn=null,Zn=null,gn=!1;if(typeof mt=="number")Qt=mt|0,Er=Jt|0||Qt;else if(!mt)Qt=Er=1;else{D.type(mt,"object","invalid arguments for framebuffer");var qt=mt;if("shape"in qt){var Qn=qt.shape;D(Array.isArray(Qn)&&Qn.length>=2,"invalid shape for framebuffer"),Qt=Qn[0],Er=Qn[1]}else"radius"in qt&&(Qt=Er=qt.radius),"width"in qt&&(Qt=qt.width),"height"in qt&&(Er=qt.height);("color"in qt||"colors"in qt)&&(ir=qt.color||qt.colors,Array.isArray(ir)&&D(ir.length===1||O.webgl_draw_buffers,"multiple render targets not supported")),ir||("colorCount"in qt&&(Mn=qt.colorCount|0,D(Mn>0,"invalid color buffer count")),"colorTexture"in qt&&(Cn=!!qt.colorTexture,Jr="rgba4"),"colorType"in qt&&(Sn=qt.colorType,Cn?(D(O.oes_texture_float||!(Sn==="float"||Sn==="float32"),"you must enable OES_texture_float in order to use floating point framebuffer objects"),D(O.oes_texture_half_float||!(Sn==="half float"||Sn==="float16"),"you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects")):Sn==="half float"||Sn==="float16"?(D(O.ext_color_buffer_half_float,"you must enable EXT_color_buffer_half_float to use 16-bit render buffers"),Jr="rgba16f"):(Sn==="float"||Sn==="float32")&&(D(O.webgl_color_buffer_float,"you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers"),Jr="rgba32f"),D.oneOf(Sn,je,"invalid color type")),"colorFormat"in qt&&(Jr=qt.colorFormat,Re.indexOf(Jr)>=0?Cn=!0:Ue.indexOf(Jr)>=0?Cn=!1:Cn?D.oneOf(qt.colorFormat,Re,"invalid color format for texture"):D.oneOf(qt.colorFormat,Ue,"invalid color format for renderbuffer"))),("depthTexture"in qt||"depthStencilTexture"in qt)&&(gn=!!(qt.depthTexture||qt.depthStencilTexture),D(!gn||O.webgl_depth_texture,"webgl_depth_texture extension not supported")),"depth"in qt&&(typeof qt.depth=="boolean"?_n=qt.depth:(kn=qt.depth,Nn=!1)),"stencil"in qt&&(typeof qt.stencil=="boolean"?Nn=qt.stencil:(Gn=qt.stencil,_n=!1)),"depthStencil"in qt&&(typeof qt.depthStencil=="boolean"?_n=Nn=qt.depthStencil:(Zn=qt.depthStencil,_n=!1,Nn=!1))}var Or=null,Lt=null,rr=null,mr=null;if(Array.isArray(ir))Or=ir.map(Ke);else if(ir)Or=[Ke(ir)];else for(Or=new Array(Mn),Vt=0;Vt<Mn;++Vt)Or[Vt]=ae(Qt,Er,Cn,Jr,Sn);D(O.webgl_draw_buffers||Or.length<=1,"you must enable the WEBGL_draw_buffers extension in order to use multiple color buffers."),D(Or.length<=j.maxColorAttachments,"too many color attachments, not supported"),Qt=Qt||Or[0].width,Er=Er||Or[0].height,kn?Lt=Ke(kn):_n&&!Nn&&(Lt=ae(Qt,Er,gn,"depth","uint32")),Gn?rr=Ke(Gn):Nn&&!_n&&(rr=ae(Qt,Er,!1,"stencil","uint8")),Zn?mr=Ke(Zn):!kn&&!Gn&&Nn&&_n&&(mr=ae(Qt,Er,gn,"depth stencil","depth stencil")),D(!!kn+!!Gn+!!Zn<=1,"invalid framebuffer configuration, can specify exactly one depth/stencil attachment");var yn=null;for(Vt=0;Vt<Or.length;++Vt)if(et(Or[Vt],Qt,Er),D(!Or[Vt]||Or[Vt].texture&&x5.indexOf(Or[Vt].texture._texture.format)>=0||Or[Vt].renderbuffer&&D5.indexOf(Or[Vt].renderbuffer._renderbuffer.format)>=0,"framebuffer color attachment "+Vt+" is invalid"),Or[Vt]&&Or[Vt].texture){var qa=um[Or[Vt].texture._texture.format]*Nd[Or[Vt].texture._texture.type];yn===null?yn=qa:D(yn===qa,"all color attachments much have the same number of bits per pixel.")}return et(Lt,Qt,Er),D(!Lt||Lt.texture&&Lt.texture._texture.format===w5||Lt.renderbuffer&&Lt.renderbuffer._renderbuffer.format===A5,"invalid depth attachment for framebuffer object"),et(rr,Qt,Er),D(!rr||rr.renderbuffer&&rr.renderbuffer._renderbuffer.format===T5,"invalid stencil attachment for framebuffer object"),et(mr,Qt,Er),D(!mr||mr.texture&&mr.texture._texture.format===U_||mr.renderbuffer&&mr.renderbuffer._renderbuffer.format===U_,"invalid depth-stencil attachment for framebuffer object"),Oe(ke),ke.width=Qt,ke.height=Er,ke.colorAttachments=Or,ke.depthAttachment=Lt,ke.stencilAttachment=rr,ke.depthStencilAttachment=mr,Ut.color=Or.map(we),Ut.depth=we(Lt),Ut.stencil=we(rr),Ut.depthStencil=we(mr),Ut.width=ke.width,Ut.height=ke.height,Ne(ke),Ut}function Ht(mt,Jt){D(be.next!==ke,"can not resize a framebuffer which is currently in use");var Vt=Math.max(mt|0,1),Qt=Math.max(Jt|0||Vt,1);if(Vt===ke.width&&Qt===ke.height)return Ut;for(var Er=ke.colorAttachments,_n=0;_n<Er.length;++_n)Ve(Er[_n],Vt,Qt);return Ve(ke.depthAttachment,Vt,Qt),Ve(ke.stencilAttachment,Vt,Qt),Ve(ke.depthStencilAttachment,Vt,Qt),ke.width=Ut.width=Vt,ke.height=Ut.height=Qt,Ne(ke),Ut}return Ut(tt,Xe),n(Ut,{resize:Ht,_reglType:"framebuffer",_framebuffer:ke,destroy:function(){Qe(ke),Oe(ke)},use:function(mt){be.setFBO({framebuffer:Ut},mt)}})}function Tt(tt){var Xe=Array(6);function ke(Ht){var mt;D(Xe.indexOf(be.next)<0,"can not update framebuffer which is currently in use");var Jt={color:null},Vt=0,Qt=null,Er="rgba",_n="uint8",Nn=1;if(typeof Ht=="number")Vt=Ht|0;else if(!Ht)Vt=1;else{D.type(Ht,"object","invalid arguments for framebuffer");var ir=Ht;if("shape"in ir){var Cn=ir.shape;D(Array.isArray(Cn)&&Cn.length>=2,"invalid shape for framebuffer"),D(Cn[0]===Cn[1],"cube framebuffer must be square"),Vt=Cn[0]}else"radius"in ir&&(Vt=ir.radius|0),"width"in ir?(Vt=ir.width|0,"height"in ir&&D(ir.height===Vt,"must be square")):"height"in ir&&(Vt=ir.height|0);("color"in ir||"colors"in ir)&&(Qt=ir.color||ir.colors,Array.isArray(Qt)&&D(Qt.length===1||O.webgl_draw_buffers,"multiple render targets not supported")),Qt||("colorCount"in ir&&(Nn=ir.colorCount|0,D(Nn>0,"invalid color buffer count")),"colorType"in ir&&(D.oneOf(ir.colorType,je,"invalid color type"),_n=ir.colorType),"colorFormat"in ir&&(Er=ir.colorFormat,D.oneOf(ir.colorFormat,Re,"invalid color format for texture"))),"depth"in ir&&(Jt.depth=ir.depth),"stencil"in ir&&(Jt.stencil=ir.stencil),"depthStencil"in ir&&(Jt.depthStencil=ir.depthStencil)}var Jr;if(Qt)if(Array.isArray(Qt))for(Jr=[],mt=0;mt<Qt.length;++mt)Jr[mt]=Qt[mt];else Jr=[Qt];else{Jr=Array(Nn);var Sn={radius:Vt,format:Er,type:_n};for(mt=0;mt<Nn;++mt)Jr[mt]=pe.createCube(Sn)}for(Jt.color=Array(Jr.length),mt=0;mt<Jr.length;++mt){var Mn=Jr[mt];D(typeof Mn=="function"&&Mn._reglType==="textureCube","invalid cube map"),Vt=Vt||Mn.width,D(Mn.width===Vt&&Mn.height===Vt,"invalid cube map shape"),Jt.color[mt]={target:Ld,data:Jr[mt]}}for(mt=0;mt<6;++mt){for(var kn=0;kn<Jr.length;++kn)Jt.color[kn].target=Ld+mt;mt>0&&(Jt.depth=Xe[0].depth,Jt.stencil=Xe[0].stencil,Jt.depthStencil=Xe[0].depthStencil),Xe[mt]?Xe[mt](Jt):Xe[mt]=Je(Jt)}return n(ke,{width:Vt,height:Vt,color:Jr})}function Ut(Ht){var mt,Jt=Ht|0;if(D(Jt>0&&Jt<=j.maxCubeMapSize,"invalid radius for cube fbo"),Jt===ke.width)return ke;var Vt=ke.color;for(mt=0;mt<Vt.length;++mt)Vt[mt].resize(Jt);for(mt=0;mt<6;++mt)Xe[mt].resize(Jt);return ke.width=ke.height=Jt,ke}return ke(tt),n(ke,{faces:Xe,resize:Ut,_reglType:"framebufferCube",destroy:function(){Xe.forEach(function(Ht){Ht.destroy()})}})}function $t(){be.cur=null,be.next=null,be.dirty=!0,ji(Le).forEach(function(tt){tt.framebuffer=E.createFramebuffer(),Ne(tt)})}return n(be,{getFramebuffer:function(tt){if(typeof tt=="function"&&tt._reglType==="framebuffer"){var Xe=tt._framebuffer;if(Xe instanceof ot)return Xe}return null},create:Je,createCube:Tt,clear:function(){ji(Le).forEach(Qe)},restore:$t})}var N5=5126,G_=34962;function lm(){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=N5,this.offset=0,this.stride=0,this.divisor=0}function O5(E,O,j,pe,Ce){for(var ve=j.maxAttributes,be=new Array(ve),Re=0;Re<ve;++Re)be[Re]=new lm;var Ue=0,je={},Ge={Record:lm,scope:{},state:be,currentVAO:null,targetVAO:null,restore:et()?Le:function(){},createVAO:ot,getVAO:Ke,destroyBuffer:He,setVAO:et()?ae:we,clear:et()?Ve:function(){}};function He(Oe){for(var Qe=0;Qe<be.length;++Qe){var Ne=be[Qe];Ne.buffer===Oe&&(E.disableVertexAttribArray(Qe),Ne.buffer=null)}}function et(){return O.oes_vertex_array_object}function Be(){return O.angle_instanced_arrays}function Ke(Oe){return typeof Oe=="function"&&Oe._vao?Oe._vao:null}function ae(Oe){if(Oe!==Ge.currentVAO){var Qe=et();Oe?Qe.bindVertexArrayOES(Oe.vao):Qe.bindVertexArrayOES(null),Ge.currentVAO=Oe}}function we(Oe){if(Oe!==Ge.currentVAO){if(Oe)Oe.bindAttrs();else for(var Qe=Be(),Ne=0;Ne<be.length;++Ne){var Je=be[Ne];Je.buffer?(E.enableVertexAttribArray(Ne),E.vertexAttribPointer(Ne,Je.size,Je.type,Je.normalized,Je.stride,Je.offfset),Qe&&Je.divisor&&Qe.vertexAttribDivisorANGLE(Ne,Je.divisor)):(E.disableVertexAttribArray(Ne),E.vertexAttrib4f(Ne,Je.x,Je.y,Je.z,Je.w))}Ge.currentVAO=Oe}}function Ve(){ji(je).forEach(function(Oe){Oe.destroy()})}function it(){this.id=++Ue,this.attributes=[];var Oe=et();Oe?this.vao=Oe.createVertexArrayOES():this.vao=null,je[this.id]=this,this.buffers=[]}it.prototype.bindAttrs=function(){for(var Oe=Be(),Qe=this.attributes,Ne=0;Ne<Qe.length;++Ne){var Je=Qe[Ne];Je.buffer?(E.enableVertexAttribArray(Ne),E.bindBuffer(G_,Je.buffer.buffer),E.vertexAttribPointer(Ne,Je.size,Je.type,Je.normalized,Je.stride,Je.offset),Oe&&Je.divisor&&Oe.vertexAttribDivisorANGLE(Ne,Je.divisor)):(E.disableVertexAttribArray(Ne),E.vertexAttrib4f(Ne,Je.x,Je.y,Je.z,Je.w))}for(var Tt=Qe.length;Tt<ve;++Tt)E.disableVertexAttribArray(Tt)},it.prototype.refresh=function(){var Oe=et();Oe&&(Oe.bindVertexArrayOES(this.vao),this.bindAttrs(),Ge.currentVAO=this)},it.prototype.destroy=function(){if(this.vao){var Oe=et();this===Ge.currentVAO&&(Ge.currentVAO=null,Oe.bindVertexArrayOES(null)),Oe.deleteVertexArrayOES(this.vao),this.vao=null}je[this.id]&&(delete je[this.id],pe.vaoCount-=1)};function Le(){var Oe=et();Oe&&ji(je).forEach(function(Qe){Qe.refresh()})}function ot(Oe){var Qe=new it;pe.vaoCount+=1;function Ne(Je){D(Array.isArray(Je),"arguments to vertex array constructor must be an array"),D(Je.length<ve,"too many attributes"),D(Je.length>0,"must specify at least one attribute");var Tt={},$t=Qe.attributes;$t.length=Je.length;for(var tt=0;tt<Je.length;++tt){var Xe=Je[tt],ke=$t[tt]=new lm,Ut=Xe.data||Xe;if(Array.isArray(Ut)||t(Ut)||_a(Ut)){var Ht;Qe.buffers[tt]&&(Ht=Qe.buffers[tt],t(Ut)&&Ht._buffer.byteLength>=Ut.byteLength?Ht.subdata(Ut):(Ht.destroy(),Qe.buffers[tt]=null)),Qe.buffers[tt]||(Ht=Qe.buffers[tt]=Ce.create(Xe,G_,!1,!0)),ke.buffer=Ce.getBuffer(Ht),ke.size=ke.buffer.dimension|0,ke.normalized=!1,ke.type=ke.buffer.dtype,ke.offset=0,ke.stride=0,ke.divisor=0,ke.state=1,Tt[tt]=1}else Ce.getBuffer(Xe)?(ke.buffer=Ce.getBuffer(Xe),ke.size=ke.buffer.dimension|0,ke.normalized=!1,ke.type=ke.buffer.dtype,ke.offset=0,ke.stride=0,ke.divisor=0,ke.state=1):Ce.getBuffer(Xe.buffer)?(ke.buffer=Ce.getBuffer(Xe.buffer),ke.size=(+Xe.size||ke.buffer.dimension)|0,ke.normalized=!!Xe.normalized||!1,"type"in Xe?(D.parameter(Xe.type,lu,"invalid buffer type"),ke.type=lu[Xe.type]):ke.type=ke.buffer.dtype,ke.offset=(Xe.offset||0)|0,ke.stride=(Xe.stride||0)|0,ke.divisor=(Xe.divisor||0)|0,ke.state=1,D(ke.size>=1&&ke.size<=4,"size must be between 1 and 4"),D(ke.offset>=0,"invalid offset"),D(ke.stride>=0&&ke.stride<=255,"stride must be between 0 and 255"),D(ke.divisor>=0,"divisor must be positive"),D(!ke.divisor||!!O.angle_instanced_arrays,"ANGLE_instanced_arrays must be enabled to use divisor")):"x"in Xe?(D(tt>0,"first attribute must not be a constant"),ke.x=+Xe.x||0,ke.y=+Xe.y||0,ke.z=+Xe.z||0,ke.w=+Xe.w||0,ke.state=2):D(!1,"invalid attribute spec for location "+tt)}for(var mt=0;mt<Qe.buffers.length;++mt)!Tt[mt]&&Qe.buffers[mt]&&(Qe.buffers[mt].destroy(),Qe.buffers[mt]=null);return Qe.refresh(),Ne}return Ne.destroy=function(){for(var Je=0;Je<Qe.buffers.length;++Je)Qe.buffers[Je]&&Qe.buffers[Je].destroy();Qe.buffers.length=0,Qe.destroy()},Ne._vao=Qe,Ne._reglType="vao",Ne(Oe)}return Ge}var z_=35632,P5=35633,R5=35718,B5=35721;function F5(E,O,j,pe){var Ce={},ve={};function be(ae,we,Ve,it){this.name=ae,this.id=we,this.location=Ve,this.info=it}function Re(ae,we){for(var Ve=0;Ve<ae.length;++Ve)if(ae[Ve].id===we.id){ae[Ve].location=we.location;return}ae.push(we)}function Ue(ae,we,Ve){var it=ae===z_?Ce:ve,Le=it[we];if(!Le){var ot=O.str(we);Le=E.createShader(ae),E.shaderSource(Le,ot),E.compileShader(Le),D.shaderError(E,Le,ot,ae,Ve),it[we]=Le}return Le}var je={},Ge=[],He=0;function et(ae,we){this.id=He++,this.fragId=ae,this.vertId=we,this.program=null,this.uniforms=[],this.attributes=[],this.refCount=1,pe.profile&&(this.stats={uniformsCount:0,attributesCount:0})}function Be(ae,we,Ve){var it,Le,ot=Ue(z_,ae.fragId),Oe=Ue(P5,ae.vertId),Qe=ae.program=E.createProgram();if(E.attachShader(Qe,ot),E.attachShader(Qe,Oe),Ve)for(it=0;it<Ve.length;++it){var Ne=Ve[it];E.bindAttribLocation(Qe,Ne[0],Ne[1])}E.linkProgram(Qe),D.linkError(E,Qe,O.str(ae.fragId),O.str(ae.vertId),we);var Je=E.getProgramParameter(Qe,R5);pe.profile&&(ae.stats.uniformsCount=Je);var Tt=ae.uniforms;for(it=0;it<Je;++it)if(Le=E.getActiveUniform(Qe,it),Le)if(Le.size>1)for(var $t=0;$t<Le.size;++$t){var tt=Le.name.replace("[0]","["+$t+"]");Re(Tt,new be(tt,O.id(tt),E.getUniformLocation(Qe,tt),Le))}else Re(Tt,new be(Le.name,O.id(Le.name),E.getUniformLocation(Qe,Le.name),Le));var Xe=E.getProgramParameter(Qe,B5);pe.profile&&(ae.stats.attributesCount=Xe);var ke=ae.attributes;for(it=0;it<Xe;++it)Le=E.getActiveAttrib(Qe,it),Le&&Re(ke,new be(Le.name,O.id(Le.name),E.getAttribLocation(Qe,Le.name),Le))}pe.profile&&(j.getMaxUniformsCount=function(){var ae=0;return Ge.forEach(function(we){we.stats.uniformsCount>ae&&(ae=we.stats.uniformsCount)}),ae},j.getMaxAttributesCount=function(){var ae=0;return Ge.forEach(function(we){we.stats.attributesCount>ae&&(ae=we.stats.attributesCount)}),ae});function Ke(){Ce={},ve={};for(var ae=0;ae<Ge.length;++ae)Be(Ge[ae],null,Ge[ae].attributes.map(function(we){return[we.location,we.name]}))}return{clear:function(){var ae=E.deleteShader.bind(E);ji(Ce).forEach(ae),Ce={},ji(ve).forEach(ae),ve={},Ge.forEach(function(we){E.deleteProgram(we.program)}),Ge.length=0,je={},j.shaderCount=0},program:function(ae,we,Ve,it){D.command(ae>=0,"missing vertex shader",Ve),D.command(we>=0,"missing fragment shader",Ve);var Le=je[we];Le||(Le=je[we]={});var ot=Le[ae];if(ot&&(ot.refCount++,!it))return ot;var Oe=new et(we,ae);return j.shaderCount++,Be(Oe,Ve,it),ot||(Le[ae]=Oe),Ge.push(Oe),n(Oe,{destroy:function(){if(Oe.refCount--,Oe.refCount<=0){E.deleteProgram(Oe.program);var Qe=Ge.indexOf(Oe);Ge.splice(Qe,1),j.shaderCount--}Le[Oe.vertId].refCount<=0&&(E.deleteShader(ve[Oe.vertId]),delete ve[Oe.vertId],delete je[Oe.fragId][Oe.vertId]),Object.keys(je[Oe.fragId]).length||(E.deleteShader(Ce[Oe.fragId]),delete Ce[Oe.fragId],delete je[Oe.fragId])}})},restore:Ke,shader:Ue,frag:-1,vert:-1}}var U5=6408,Hc=5121,G5=3333,Od=5126;function z5(E,O,j,pe,Ce,ve,be){function Re(Ge){var He;O.next===null?(D(Ce.preserveDrawingBuffer,'you must create a webgl context with "preserveDrawingBuffer":true in order to read pixels from the drawing buffer'),He=Hc):(D(O.next.colorAttachments[0].texture!==null,"You cannot read from a renderbuffer"),He=O.next.colorAttachments[0].texture._texture.type,ve.oes_texture_float?(D(He===Hc||He===Od,"Reading from a framebuffer is only allowed for the types 'uint8' and 'float'"),He===Od&&D(be.readFloat,"Reading 'float' values is not permitted in your browser. For a fallback, please see: https://www.npmjs.com/package/glsl-read-float")):D(He===Hc,"Reading from a framebuffer is only allowed for the type 'uint8'"));var et=0,Be=0,Ke=pe.framebufferWidth,ae=pe.framebufferHeight,we=null;t(Ge)?we=Ge:Ge&&(D.type(Ge,"object","invalid arguments to regl.read()"),et=Ge.x|0,Be=Ge.y|0,D(et>=0&&et<pe.framebufferWidth,"invalid x offset for regl.read"),D(Be>=0&&Be<pe.framebufferHeight,"invalid y offset for regl.read"),Ke=(Ge.width||pe.framebufferWidth-et)|0,ae=(Ge.height||pe.framebufferHeight-Be)|0,we=Ge.data||null),we&&(He===Hc?D(we instanceof Uint8Array,"buffer must be 'Uint8Array' when reading from a framebuffer of type 'uint8'"):He===Od&&D(we instanceof Float32Array,"buffer must be 'Float32Array' when reading from a framebuffer of type 'float'")),D(Ke>0&&Ke+et<=pe.framebufferWidth,"invalid width for read pixels"),D(ae>0&&ae+Be<=pe.framebufferHeight,"invalid height for read pixels"),j();var Ve=Ke*ae*4;return we||(He===Hc?we=new Uint8Array(Ve):He===Od&&(we=we||new Float32Array(Ve))),D.isTypedArray(we,"data buffer for regl.read() must be a typedarray"),D(we.byteLength>=Ve,"data buffer for regl.read() too small"),E.pixelStorei(G5,4),E.readPixels(et,Be,Ke,ae,U5,He,we),we}function Ue(Ge){var He;return O.setFBO({framebuffer:Ge.framebuffer},function(){He=Re(Ge)}),He}function je(Ge){return!Ge||!("framebuffer"in Ge)?Re(Ge):Ue(Ge)}return je}function _l(E){return Array.prototype.slice.call(E)}function Sl(E){return _l(E).join("")}function $5(){var E=0,O=[],j=[];function pe(He){for(var et=0;et<j.length;++et)if(j[et]===He)return O[et];var Be="g"+E++;return O.push(Be),j.push(He),Be}function Ce(){var He=[];function et(){He.push.apply(He,_l(arguments))}var Be=[];function Ke(){var ae="v"+E++;return Be.push(ae),arguments.length>0&&(He.push(ae,"="),He.push.apply(He,_l(arguments)),He.push(";")),ae}return n(et,{def:Ke,toString:function(){return Sl([Be.length>0?"var "+Be.join(",")+";":"",Sl(He)])}})}function ve(){var He=Ce(),et=Ce(),Be=He.toString,Ke=et.toString;function ae(we,Ve){et(we,Ve,"=",He.def(we,Ve),";")}return n(function(){He.apply(He,_l(arguments))},{def:He.def,entry:He,exit:et,save:ae,set:function(we,Ve,it){ae(we,Ve),He(we,Ve,"=",it,";")},toString:function(){return Be()+Ke()}})}function be(){var He=Sl(arguments),et=ve(),Be=ve(),Ke=et.toString,ae=Be.toString;return n(et,{then:function(){return et.apply(et,_l(arguments)),this},else:function(){return Be.apply(Be,_l(arguments)),this},toString:function(){var we=ae();return we&&(we="else{"+we+"}"),Sl(["if(",He,"){",Ke(),"}",we])}})}var Re=Ce(),Ue={};function je(He,et){var Be=[];function Ke(){var Le="a"+Be.length;return Be.push(Le),Le}et=et||0;for(var ae=0;ae<et;++ae)Ke();var we=ve(),Ve=we.toString,it=Ue[He]=n(we,{arg:Ke,toString:function(){return Sl(["function(",Be.join(),"){",Ve(),"}"])}});return it}function Ge(){var He=['"use strict";',Re,"return {"];Object.keys(Ue).forEach(function(Ke){He.push('"',Ke,'":',Ue[Ke].toString(),",")}),He.push("}");var et=Sl(He).replace(/;/g,`;
`).replace(/}/g,`}
`).replace(/{/g,`{
`),Be=Function.apply(null,O.concat(et));return Be.apply(null,j)}return{global:Re,link:pe,block:Ce,proc:je,scope:ve,cond:be,compile:Ge}}var El="xyzw".split(""),$_=5121,Al=1,cm=2,fm=0,hm=1,dm=2,vm=3,Pd=4,V_=5,j_=6,W_="dither",X_="blend.enable",Y_="blend.color",pm="blend.equation",gm="blend.func",H_="depth.enable",q_="depth.func",K_="depth.range",Z_="depth.mask",ym="colorMask",Q_="cull.enable",J_="cull.face",mm="frontFace",bm="lineWidth",eS="polygonOffset.enable",wm="polygonOffset.offset",tS="sample.alpha",rS="sample.enable",xm="sample.coverage",nS="stencil.enable",iS="stencil.mask",_m="stencil.func",Sm="stencil.opFront",qc="stencil.opBack",aS="scissor.enable",Rd="scissor.box",ko="viewport",Kc="profile",vu="framebuffer",Zc="vert",Qc="frag",pu="elements",gu="primitive",yu="count",Bd="offset",Fd="instances",Jc="vao",Em="Width",Am="Height",Tl=vu+Em,Il=vu+Am,V5=ko+Em,j5=ko+Am,oS="drawingBuffer",sS=oS+Em,uS=oS+Am,W5=[gm,pm,_m,Sm,qc,xm,ko,Rd,wm],Cl=34962,X5=34963,Y5=35632,H5=35633,lS=3553,q5=34067,K5=2884,Z5=3042,Q5=3024,J5=2960,eU=2929,tU=3089,rU=32823,nU=32926,iU=32928,Tm=5126,Ud=35664,Gd=35665,zd=35666,Im=5124,$d=35667,Vd=35668,jd=35669,Cm=35670,Wd=35671,Xd=35672,Yd=35673,ef=35674,tf=35675,rf=35676,nf=35678,af=35680,cS=4,of=1028,mu=1029,fS=2304,Mm=2305,aU=32775,oU=32776,sU=519,fs=7680,hS=0,dS=1,vS=32774,uU=513,pS=36160,lU=36064,Ha={"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},gS=["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"],Ml={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},hs={"0":0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},yS={frag:Y5,vert:H5},km={cw:fS,ccw:Mm};function Hd(E){return Array.isArray(E)||t(E)||_a(E)}function mS(E){return E.sort(function(O,j){return O===ko?-1:j===ko?1:O<j?-1:1})}function _i(E,O,j,pe){this.thisDep=E,this.contextDep=O,this.propDep=j,this.append=pe}function ds(E){return E&&!(E.thisDep||E.contextDep||E.propDep)}function xn(E){return new _i(!1,!1,!1,E)}function Ni(E,O){var j=E.type;if(j===fm){var pe=E.data.length;return new _i(!0,pe>=1,pe>=2,O)}else if(j===Pd){var Ce=E.data;return new _i(Ce.thisDep,Ce.contextDep,Ce.propDep,O)}else{if(j===V_)return new _i(!1,!1,!1,O);if(j===j_){for(var ve=!1,be=!1,Re=!1,Ue=0;Ue<E.data.length;++Ue){var je=E.data[Ue];if(je.type===hm)Re=!0;else if(je.type===dm)be=!0;else if(je.type===vm)ve=!0;else if(je.type===fm){ve=!0;var Ge=je.data;Ge>=1&&(be=!0),Ge>=2&&(Re=!0)}else je.type===Pd&&(ve=ve||je.data.thisDep,be=be||je.data.contextDep,Re=Re||je.data.propDep)}return new _i(ve,be,Re,O)}else return new _i(j===vm,j===dm,j===hm,O)}}var bS=new _i(!1,!1,!1,function(){});function cU(E,O,j,pe,Ce,ve,be,Re,Ue,je,Ge,He,et,Be,Ke){var ae=je.Record,we={add:32774,subtract:32778,"reverse subtract":32779};j.ext_blend_minmax&&(we.min=aU,we.max=oU);var Ve=j.angle_instanced_arrays,it=j.webgl_draw_buffers,Le={dirty:!0,profile:Ke.profile},ot={},Oe=[],Qe={},Ne={};function Je(F){return F.replace(".","_")}function Tt(F,N,q){var ie=Je(F);Oe.push(F),ot[ie]=Le[ie]=!!q,Qe[ie]=N}function $t(F,N,q){var ie=Je(F);Oe.push(F),Array.isArray(q)?(Le[ie]=q.slice(),ot[ie]=q.slice()):Le[ie]=ot[ie]=q,Ne[ie]=N}Tt(W_,Q5),Tt(X_,Z5),$t(Y_,"blendColor",[0,0,0,0]),$t(pm,"blendEquationSeparate",[vS,vS]),$t(gm,"blendFuncSeparate",[dS,hS,dS,hS]),Tt(H_,eU,!0),$t(q_,"depthFunc",uU),$t(K_,"depthRange",[0,1]),$t(Z_,"depthMask",!0),$t(ym,ym,[!0,!0,!0,!0]),Tt(Q_,K5),$t(J_,"cullFace",mu),$t(mm,mm,Mm),$t(bm,bm,1),Tt(eS,rU),$t(wm,"polygonOffset",[0,0]),Tt(tS,nU),Tt(rS,iU),$t(xm,"sampleCoverage",[1,!1]),Tt(nS,J5),$t(iS,"stencilMask",-1),$t(_m,"stencilFunc",[sU,0,-1]),$t(Sm,"stencilOpSeparate",[of,fs,fs,fs]),$t(qc,"stencilOpSeparate",[mu,fs,fs,fs]),Tt(aS,tU),$t(Rd,"scissor",[0,0,E.drawingBufferWidth,E.drawingBufferHeight]),$t(ko,ko,[0,0,E.drawingBufferWidth,E.drawingBufferHeight]);var tt={gl:E,context:et,strings:O,next:ot,current:Le,draw:He,elements:ve,buffer:Ce,shader:Ge,attributes:je.state,vao:je,uniforms:Ue,framebuffer:Re,extensions:j,timer:Be,isBufferArgs:Hd},Xe={primTypes:vl,compareFuncs:Ml,blendFuncs:Ha,blendEquations:we,stencilOps:hs,glTypes:lu,orientationType:km};D.optional(function(){tt.isArrayLike=pn}),it&&(Xe.backBuffer=[mu],Xe.drawBuffer=Ln(pe.maxDrawbuffers,function(F){return F===0?[0]:Ln(F,function(N){return lU+N})}));var ke=0;function Ut(){var F=$5(),N=F.link,q=F.global;F.id=ke++,F.batchId="0";var ie=N(tt),ce=F.shared={props:"a0"};Object.keys(tt).forEach(function(Y){ce[Y]=q.def(ie,".",Y)}),D.optional(function(){F.CHECK=N(D),F.commandStr=D.guessCommand(),F.command=N(F.commandStr),F.assert=function(Y,R,re){Y("if(!(",R,"))",this.CHECK,".commandRaise(",N(re),",",this.command,");")},Xe.invalidBlendCombinations=gS});var Q=F.next={},Z=F.current={};Object.keys(Ne).forEach(function(Y){Array.isArray(Le[Y])&&(Q[Y]=q.def(ce.next,".",Y),Z[Y]=q.def(ce.current,".",Y))});var te=F.constants={};Object.keys(Xe).forEach(function(Y){te[Y]=q.def(JSON.stringify(Xe[Y]))}),F.invoke=function(Y,R){switch(R.type){case fm:var re=["this",ce.context,ce.props,F.batchId];return Y.def(N(R.data),".call(",re.slice(0,Math.max(R.data.length+1,4)),")");case hm:return Y.def(ce.props,R.data);case dm:return Y.def(ce.context,R.data);case vm:return Y.def("this",R.data);case Pd:return R.data.append(F,Y),R.data.ref;case V_:return R.data.toString();case j_:return R.data.map(function(fe){return F.invoke(Y,fe)})}},F.attribCache={};var U={};return F.scopeAttrib=function(Y){var R=O.id(Y);if(R in U)return U[R];var re=je.scope[R];re||(re=je.scope[R]=new ae);var fe=U[R]=N(re);return fe},F}function Ht(F){var N=F.static,q=F.dynamic,ie;if(Kc in N){var ce=!!N[Kc];ie=xn(function(Z,te){return ce}),ie.enable=ce}else if(Kc in q){var Q=q[Kc];ie=Ni(Q,function(Z,te){return Z.invoke(te,Q)})}return ie}function mt(F,N){var q=F.static,ie=F.dynamic;if(vu in q){var ce=q[vu];return ce?(ce=Re.getFramebuffer(ce),D.command(ce,"invalid framebuffer object"),xn(function(Z,te){var U=Z.link(ce),Y=Z.shared;te.set(Y.framebuffer,".next",U);var R=Y.context;return te.set(R,"."+Tl,U+".width"),te.set(R,"."+Il,U+".height"),U})):xn(function(Z,te){var U=Z.shared;te.set(U.framebuffer,".next","null");var Y=U.context;return te.set(Y,"."+Tl,Y+"."+sS),te.set(Y,"."+Il,Y+"."+uS),"null"})}else if(vu in ie){var Q=ie[vu];return Ni(Q,function(Z,te){var U=Z.invoke(te,Q),Y=Z.shared,R=Y.framebuffer,re=te.def(R,".getFramebuffer(",U,")");D.optional(function(){Z.assert(te,"!"+U+"||"+re,"invalid framebuffer object")}),te.set(R,".next",re);var fe=Y.context;return te.set(fe,"."+Tl,re+"?"+re+".width:"+fe+"."+sS),te.set(fe,"."+Il,re+"?"+re+".height:"+fe+"."+uS),re})}else return null}function Jt(F,N,q){var ie=F.static,ce=F.dynamic;function Q(U){if(U in ie){var Y=ie[U];D.commandType(Y,"object","invalid "+U,q.commandStr);var R=!0,re=Y.x|0,fe=Y.y|0,Te,Me;return"width"in Y?(Te=Y.width|0,D.command(Te>=0,"invalid "+U,q.commandStr)):R=!1,"height"in Y?(Me=Y.height|0,D.command(Me>=0,"invalid "+U,q.commandStr)):R=!1,new _i(!R&&N&&N.thisDep,!R&&N&&N.contextDep,!R&&N&&N.propDep,function(Et,Kt){var bt=Et.shared.context,Nt=Te;"width"in Y||(Nt=Kt.def(bt,".",Tl,"-",re));var jt=Me;return"height"in Y||(jt=Kt.def(bt,".",Il,"-",fe)),[re,fe,Nt,jt]})}else if(U in ce){var _e=ce[U],$e=Ni(_e,function(Et,Kt){var bt=Et.invoke(Kt,_e);D.optional(function(){Et.assert(Kt,bt+"&&typeof "+bt+'==="object"',"invalid "+U)});var Nt=Et.shared.context,jt=Kt.def(bt,".x|0"),Ar=Kt.def(bt,".y|0"),fn=Kt.def('"width" in ',bt,"?",bt,".width|0:","(",Nt,".",Tl,"-",jt,")"),Si=Kt.def('"height" in ',bt,"?",bt,".height|0:","(",Nt,".",Il,"-",Ar,")");return D.optional(function(){Et.assert(Kt,fn+">=0&&"+Si+">=0","invalid "+U)}),[jt,Ar,fn,Si]});return N&&($e.thisDep=$e.thisDep||N.thisDep,$e.contextDep=$e.contextDep||N.contextDep,$e.propDep=$e.propDep||N.propDep),$e}else return N?new _i(N.thisDep,N.contextDep,N.propDep,function(Et,Kt){var bt=Et.shared.context;return[0,0,Kt.def(bt,".",Tl),Kt.def(bt,".",Il)]}):null}var Z=Q(ko);if(Z){var te=Z;Z=new _i(Z.thisDep,Z.contextDep,Z.propDep,function(U,Y){var R=te.append(U,Y),re=U.shared.context;return Y.set(re,"."+V5,R[2]),Y.set(re,"."+j5,R[3]),R})}return{viewport:Z,scissor_box:Q(Rd)}}function Vt(F,N){var q=F.static,ie=typeof q[Qc]=="string"&&typeof q[Zc]=="string";if(ie){if(Object.keys(N.dynamic).length>0)return null;var ce=N.static,Q=Object.keys(ce);if(Q.length>0&&typeof ce[Q[0]]=="number"){for(var Z=[],te=0;te<Q.length;++te)D(typeof ce[Q[te]]=="number","must specify all vertex attribute locations when using vaos"),Z.push([ce[Q[te]]|0,Q[te]]);return Z}}return null}function Qt(F,N,q){var ie=F.static,ce=F.dynamic;function Q(R){if(R in ie){var re=O.id(ie[R]);D.optional(function(){Ge.shader(yS[R],re,D.guessCommand())});var fe=xn(function(){return re});return fe.id=re,fe}else if(R in ce){var Te=ce[R];return Ni(Te,function(Me,_e){var $e=Me.invoke(_e,Te),Et=_e.def(Me.shared.strings,".id(",$e,")");return D.optional(function(){_e(Me.shared.shader,".shader(",yS[R],",",Et,",",Me.command,");")}),Et})}return null}var Z=Q(Qc),te=Q(Zc),U=null,Y;return ds(Z)&&ds(te)?(U=Ge.program(te.id,Z.id,null,q),Y=xn(function(R,re){return R.link(U)})):Y=new _i(Z&&Z.thisDep||te&&te.thisDep,Z&&Z.contextDep||te&&te.contextDep,Z&&Z.propDep||te&&te.propDep,function(R,re){var fe=R.shared.shader,Te;Z?Te=Z.append(R,re):Te=re.def(fe,".",Qc);var Me;te?Me=te.append(R,re):Me=re.def(fe,".",Zc);var _e=fe+".program("+Me+","+Te;return D.optional(function(){_e+=","+R.command}),re.def(_e+")")}),{frag:Z,vert:te,progVar:Y,program:U}}function Er(F,N){var q=F.static,ie=F.dynamic;function ce(){if(pu in q){var R=q[pu];Hd(R)?R=ve.getElements(ve.create(R,!0)):R&&(R=ve.getElements(R),D.command(R,"invalid elements",N.commandStr));var re=xn(function(Te,Me){if(R){var _e=Te.link(R);return Te.ELEMENTS=_e,_e}return Te.ELEMENTS=null,null});return re.value=R,re}else if(pu in ie){var fe=ie[pu];return Ni(fe,function(Te,Me){var _e=Te.shared,$e=_e.isBufferArgs,Et=_e.elements,Kt=Te.invoke(Me,fe),bt=Me.def("null"),Nt=Me.def($e,"(",Kt,")"),jt=Te.cond(Nt).then(bt,"=",Et,".createStream(",Kt,");").else(bt,"=",Et,".getElements(",Kt,");");return D.optional(function(){Te.assert(jt.else,"!"+Kt+"||"+bt,"invalid elements")}),Me.entry(jt),Me.exit(Te.cond(Nt).then(Et,".destroyStream(",bt,");")),Te.ELEMENTS=bt,bt})}return null}var Q=ce();function Z(){if(gu in q){var R=q[gu];return D.commandParameter(R,vl,"invalid primitve",N.commandStr),xn(function(fe,Te){return vl[R]})}else if(gu in ie){var re=ie[gu];return Ni(re,function(fe,Te){var Me=fe.constants.primTypes,_e=fe.invoke(Te,re);return D.optional(function(){fe.assert(Te,_e+" in "+Me,"invalid primitive, must be one of "+Object.keys(vl))}),Te.def(Me,"[",_e,"]")})}else if(Q)return ds(Q)?Q.value?xn(function(fe,Te){return Te.def(fe.ELEMENTS,".primType")}):xn(function(){return cS}):new _i(Q.thisDep,Q.contextDep,Q.propDep,function(fe,Te){var Me=fe.ELEMENTS;return Te.def(Me,"?",Me,".primType:",cS)});return null}function te(R,re){if(R in q){var fe=q[R]|0;return D.command(!re||fe>=0,"invalid "+R,N.commandStr),xn(function(Me,_e){return re&&(Me.OFFSET=fe),fe})}else if(R in ie){var Te=ie[R];return Ni(Te,function(Me,_e){var $e=Me.invoke(_e,Te);return re&&(Me.OFFSET=$e,D.optional(function(){Me.assert(_e,$e+">=0","invalid "+R)})),$e})}else if(re&&Q)return xn(function(Me,_e){return Me.OFFSET="0",0});return null}var U=te(Bd,!0);function Y(){if(yu in q){var R=q[yu]|0;return D.command(typeof R=="number"&&R>=0,"invalid vertex count",N.commandStr),xn(function(){return R})}else if(yu in ie){var re=ie[yu];return Ni(re,function(Me,_e){var $e=Me.invoke(_e,re);return D.optional(function(){Me.assert(_e,"typeof "+$e+'==="number"&&'+$e+">=0&&"+$e+"===("+$e+"|0)","invalid vertex count")}),$e})}else if(Q)if(ds(Q)){if(Q)return U?new _i(U.thisDep,U.contextDep,U.propDep,function(Me,_e){var $e=_e.def(Me.ELEMENTS,".vertCount-",Me.OFFSET);return D.optional(function(){Me.assert(_e,$e+">=0","invalid vertex offset/element buffer too small")}),$e}):xn(function(Me,_e){return _e.def(Me.ELEMENTS,".vertCount")});var fe=xn(function(){return-1});return D.optional(function(){fe.MISSING=!0}),fe}else{var Te=new _i(Q.thisDep||U.thisDep,Q.contextDep||U.contextDep,Q.propDep||U.propDep,function(Me,_e){var $e=Me.ELEMENTS;return Me.OFFSET?_e.def($e,"?",$e,".vertCount-",Me.OFFSET,":-1"):_e.def($e,"?",$e,".vertCount:-1")});return D.optional(function(){Te.DYNAMIC=!0}),Te}return null}return{elements:Q,primitive:Z(),count:Y(),instances:te(Fd,!1),offset:U}}function _n(F,N){var q=F.static,ie=F.dynamic,ce={};return Oe.forEach(function(Q){var Z=Je(Q);function te(U,Y){if(Q in q){var R=U(q[Q]);ce[Z]=xn(function(){return R})}else if(Q in ie){var re=ie[Q];ce[Z]=Ni(re,function(fe,Te){return Y(fe,Te,fe.invoke(Te,re))})}}switch(Q){case Q_:case X_:case W_:case nS:case H_:case aS:case eS:case tS:case rS:case Z_:return te(function(U){return D.commandType(U,"boolean",Q,N.commandStr),U},function(U,Y,R){return D.optional(function(){U.assert(Y,"typeof "+R+'==="boolean"',"invalid flag "+Q,U.commandStr)}),R});case q_:return te(function(U){return D.commandParameter(U,Ml,"invalid "+Q,N.commandStr),Ml[U]},function(U,Y,R){var re=U.constants.compareFuncs;return D.optional(function(){U.assert(Y,R+" in "+re,"invalid "+Q+", must be one of "+Object.keys(Ml))}),Y.def(re,"[",R,"]")});case K_:return te(function(U){return D.command(pn(U)&&U.length===2&&typeof U[0]=="number"&&typeof U[1]=="number"&&U[0]<=U[1],"depth range is 2d array",N.commandStr),U},function(U,Y,R){D.optional(function(){U.assert(Y,U.shared.isArrayLike+"("+R+")&&"+R+".length===2&&typeof "+R+'[0]==="number"&&typeof '+R+'[1]==="number"&&'+R+"[0]<="+R+"[1]","depth range must be a 2d array")});var re=Y.def("+",R,"[0]"),fe=Y.def("+",R,"[1]");return[re,fe]});case gm:return te(function(U){D.commandType(U,"object","blend.func",N.commandStr);var Y="srcRGB"in U?U.srcRGB:U.src,R="srcAlpha"in U?U.srcAlpha:U.src,re="dstRGB"in U?U.dstRGB:U.dst,fe="dstAlpha"in U?U.dstAlpha:U.dst;return D.commandParameter(Y,Ha,Z+".srcRGB",N.commandStr),D.commandParameter(R,Ha,Z+".srcAlpha",N.commandStr),D.commandParameter(re,Ha,Z+".dstRGB",N.commandStr),D.commandParameter(fe,Ha,Z+".dstAlpha",N.commandStr),D.command(gS.indexOf(Y+", "+re)===-1,"unallowed blending combination (srcRGB, dstRGB) = ("+Y+", "+re+")",N.commandStr),[Ha[Y],Ha[re],Ha[R],Ha[fe]]},function(U,Y,R){var re=U.constants.blendFuncs;D.optional(function(){U.assert(Y,R+"&&typeof "+R+'==="object"',"invalid blend func, must be an object")});function fe(bt,Nt){var jt=Y.def('"',bt,Nt,'" in ',R,"?",R,".",bt,Nt,":",R,".",bt);return D.optional(function(){U.assert(Y,jt+" in "+re,"invalid "+Q+"."+bt+Nt+", must be one of "+Object.keys(Ha))}),jt}var Te=fe("src","RGB"),Me=fe("dst","RGB");D.optional(function(){var bt=U.constants.invalidBlendCombinations;U.assert(Y,bt+".indexOf("+Te+'+", "+'+Me+") === -1 ","unallowed blending combination for (srcRGB, dstRGB)")});var _e=Y.def(re,"[",Te,"]"),$e=Y.def(re,"[",fe("src","Alpha"),"]"),Et=Y.def(re,"[",Me,"]"),Kt=Y.def(re,"[",fe("dst","Alpha"),"]");return[_e,Et,$e,Kt]});case pm:return te(function(U){if(typeof U=="string")return D.commandParameter(U,we,"invalid "+Q,N.commandStr),[we[U],we[U]];if(typeof U=="object")return D.commandParameter(U.rgb,we,Q+".rgb",N.commandStr),D.commandParameter(U.alpha,we,Q+".alpha",N.commandStr),[we[U.rgb],we[U.alpha]];D.commandRaise("invalid blend.equation",N.commandStr)},function(U,Y,R){var re=U.constants.blendEquations,fe=Y.def(),Te=Y.def(),Me=U.cond("typeof ",R,'==="string"');return D.optional(function(){function _e($e,Et,Kt){U.assert($e,Kt+" in "+re,"invalid "+Et+", must be one of "+Object.keys(we))}_e(Me.then,Q,R),U.assert(Me.else,R+"&&typeof "+R+'==="object"',"invalid "+Q),_e(Me.else,Q+".rgb",R+".rgb"),_e(Me.else,Q+".alpha",R+".alpha")}),Me.then(fe,"=",Te,"=",re,"[",R,"];"),Me.else(fe,"=",re,"[",R,".rgb];",Te,"=",re,"[",R,".alpha];"),Y(Me),[fe,Te]});case Y_:return te(function(U){return D.command(pn(U)&&U.length===4,"blend.color must be a 4d array",N.commandStr),Ln(4,function(Y){return+U[Y]})},function(U,Y,R){return D.optional(function(){U.assert(Y,U.shared.isArrayLike+"("+R+")&&"+R+".length===4","blend.color must be a 4d array")}),Ln(4,function(re){return Y.def("+",R,"[",re,"]")})});case iS:return te(function(U){return D.commandType(U,"number",Z,N.commandStr),U|0},function(U,Y,R){return D.optional(function(){U.assert(Y,"typeof "+R+'==="number"',"invalid stencil.mask")}),Y.def(R,"|0")});case _m:return te(function(U){D.commandType(U,"object",Z,N.commandStr);var Y=U.cmp||"keep",R=U.ref||0,re="mask"in U?U.mask:-1;return D.commandParameter(Y,Ml,Q+".cmp",N.commandStr),D.commandType(R,"number",Q+".ref",N.commandStr),D.commandType(re,"number",Q+".mask",N.commandStr),[Ml[Y],R,re]},function(U,Y,R){var re=U.constants.compareFuncs;D.optional(function(){function _e(){U.assert(Y,Array.prototype.join.call(arguments,""),"invalid stencil.func")}_e(R+"&&typeof ",R,'==="object"'),_e('!("cmp" in ',R,")||(",R,".cmp in ",re,")")});var fe=Y.def('"cmp" in ',R,"?",re,"[",R,".cmp]",":",fs),Te=Y.def(R,".ref|0"),Me=Y.def('"mask" in ',R,"?",R,".mask|0:-1");return[fe,Te,Me]});case Sm:case qc:return te(function(U){D.commandType(U,"object",Z,N.commandStr);var Y=U.fail||"keep",R=U.zfail||"keep",re=U.zpass||"keep";return D.commandParameter(Y,hs,Q+".fail",N.commandStr),D.commandParameter(R,hs,Q+".zfail",N.commandStr),D.commandParameter(re,hs,Q+".zpass",N.commandStr),[Q===qc?mu:of,hs[Y],hs[R],hs[re]]},function(U,Y,R){var re=U.constants.stencilOps;D.optional(function(){U.assert(Y,R+"&&typeof "+R+'==="object"',"invalid "+Q)});function fe(Te){return D.optional(function(){U.assert(Y,'!("'+Te+'" in '+R+")||("+R+"."+Te+" in "+re+")","invalid "+Q+"."+Te+", must be one of "+Object.keys(hs))}),Y.def('"',Te,'" in ',R,"?",re,"[",R,".",Te,"]:",fs)}return[Q===qc?mu:of,fe("fail"),fe("zfail"),fe("zpass")]});case wm:return te(function(U){D.commandType(U,"object",Z,N.commandStr);var Y=U.factor|0,R=U.units|0;return D.commandType(Y,"number",Z+".factor",N.commandStr),D.commandType(R,"number",Z+".units",N.commandStr),[Y,R]},function(U,Y,R){D.optional(function(){U.assert(Y,R+"&&typeof "+R+'==="object"',"invalid "+Q)});var re=Y.def(R,".factor|0"),fe=Y.def(R,".units|0");return[re,fe]});case J_:return te(function(U){var Y=0;return U==="front"?Y=of:U==="back"&&(Y=mu),D.command(!!Y,Z,N.commandStr),Y},function(U,Y,R){return D.optional(function(){U.assert(Y,R+'==="front"||'+R+'==="back"',"invalid cull.face")}),Y.def(R,'==="front"?',of,":",mu)});case bm:return te(function(U){return D.command(typeof U=="number"&&U>=pe.lineWidthDims[0]&&U<=pe.lineWidthDims[1],"invalid line width, must be a positive number between "+pe.lineWidthDims[0]+" and "+pe.lineWidthDims[1],N.commandStr),U},function(U,Y,R){return D.optional(function(){U.assert(Y,"typeof "+R+'==="number"&&'+R+">="+pe.lineWidthDims[0]+"&&"+R+"<="+pe.lineWidthDims[1],"invalid line width")}),R});case mm:return te(function(U){return D.commandParameter(U,km,Z,N.commandStr),km[U]},function(U,Y,R){return D.optional(function(){U.assert(Y,R+'==="cw"||'+R+'==="ccw"',"invalid frontFace, must be one of cw,ccw")}),Y.def(R+'==="cw"?'+fS+":"+Mm)});case ym:return te(function(U){return D.command(pn(U)&&U.length===4,"color.mask must be length 4 array",N.commandStr),U.map(function(Y){return!!Y})},function(U,Y,R){return D.optional(function(){U.assert(Y,U.shared.isArrayLike+"("+R+")&&"+R+".length===4","invalid color.mask")}),Ln(4,function(re){return"!!"+R+"["+re+"]"})});case xm:return te(function(U){D.command(typeof U=="object"&&U,Z,N.commandStr);var Y="value"in U?U.value:1,R=!!U.invert;return D.command(typeof Y=="number"&&Y>=0&&Y<=1,"sample.coverage.value must be a number between 0 and 1",N.commandStr),[Y,R]},function(U,Y,R){D.optional(function(){U.assert(Y,R+"&&typeof "+R+'==="object"',"invalid sample.coverage")});var re=Y.def('"value" in ',R,"?+",R,".value:1"),fe=Y.def("!!",R,".invert");return[re,fe]})}}),ce}function Nn(F,N){var q=F.static,ie=F.dynamic,ce={};return Object.keys(q).forEach(function(Q){var Z=q[Q],te;if(typeof Z=="number"||typeof Z=="boolean")te=xn(function(){return Z});else if(typeof Z=="function"){var U=Z._reglType;U==="texture2d"||U==="textureCube"?te=xn(function(Y){return Y.link(Z)}):U==="framebuffer"||U==="framebufferCube"?(D.command(Z.color.length>0,'missing color attachment for framebuffer sent to uniform "'+Q+'"',N.commandStr),te=xn(function(Y){return Y.link(Z.color[0])})):D.commandRaise('invalid data for uniform "'+Q+'"',N.commandStr)}else pn(Z)?te=xn(function(Y){var R=Y.global.def("[",Ln(Z.length,function(re){return D.command(typeof Z[re]=="number"||typeof Z[re]=="boolean","invalid uniform "+Q,Y.commandStr),Z[re]}),"]");return R}):D.commandRaise('invalid or missing data for uniform "'+Q+'"',N.commandStr);te.value=Z,ce[Q]=te}),Object.keys(ie).forEach(function(Q){var Z=ie[Q];ce[Q]=Ni(Z,function(te,U){return te.invoke(U,Z)})}),ce}function ir(F,N){var q=F.static,ie=F.dynamic,ce={};return Object.keys(q).forEach(function(Q){var Z=q[Q],te=O.id(Q),U=new ae;if(Hd(Z))U.state=Al,U.buffer=Ce.getBuffer(Ce.create(Z,Cl,!1,!0)),U.type=0;else{var Y=Ce.getBuffer(Z);if(Y)U.state=Al,U.buffer=Y,U.type=0;else if(D.command(typeof Z=="object"&&Z,"invalid data for attribute "+Q,N.commandStr),"constant"in Z){var R=Z.constant;U.buffer="null",U.state=cm,typeof R=="number"?U.x=R:(D.command(pn(R)&&R.length>0&&R.length<=4,"invalid constant for attribute "+Q,N.commandStr),El.forEach(function(Et,Kt){Kt<R.length&&(U[Et]=R[Kt])}))}else{Hd(Z.buffer)?Y=Ce.getBuffer(Ce.create(Z.buffer,Cl,!1,!0)):Y=Ce.getBuffer(Z.buffer),D.command(!!Y,'missing buffer for attribute "'+Q+'"',N.commandStr);var re=Z.offset|0;D.command(re>=0,'invalid offset for attribute "'+Q+'"',N.commandStr);var fe=Z.stride|0;D.command(fe>=0&&fe<256,'invalid stride for attribute "'+Q+'", must be integer betweeen [0, 255]',N.commandStr);var Te=Z.size|0;D.command(!("size"in Z)||Te>0&&Te<=4,'invalid size for attribute "'+Q+'", must be 1,2,3,4',N.commandStr);var Me=!!Z.normalized,_e=0;"type"in Z&&(D.commandParameter(Z.type,lu,"invalid type for attribute "+Q,N.commandStr),_e=lu[Z.type]);var $e=Z.divisor|0;"divisor"in Z&&(D.command($e===0||Ve,'cannot specify divisor for attribute "'+Q+'", instancing not supported',N.commandStr),D.command($e>=0,'invalid divisor for attribute "'+Q+'"',N.commandStr)),D.optional(function(){var Et=N.commandStr,Kt=["buffer","offset","divisor","normalized","type","size","stride"];Object.keys(Z).forEach(function(bt){D.command(Kt.indexOf(bt)>=0,'unknown parameter "'+bt+'" for attribute pointer "'+Q+'" (valid parameters are '+Kt+")",Et)})}),U.buffer=Y,U.state=Al,U.size=Te,U.normalized=Me,U.type=_e||Y.dtype,U.offset=re,U.stride=fe,U.divisor=$e}}ce[Q]=xn(function(Et,Kt){var bt=Et.attribCache;if(te in bt)return bt[te];var Nt={isStream:!1};return Object.keys(U).forEach(function(jt){Nt[jt]=U[jt]}),U.buffer&&(Nt.buffer=Et.link(U.buffer),Nt.type=Nt.type||Nt.buffer+".dtype"),bt[te]=Nt,Nt})}),Object.keys(ie).forEach(function(Q){var Z=ie[Q];function te(U,Y){var R=U.invoke(Y,Z),re=U.shared,fe=U.constants,Te=re.isBufferArgs,Me=re.buffer;D.optional(function(){U.assert(Y,R+"&&(typeof "+R+'==="object"||typeof '+R+'==="function")&&('+Te+"("+R+")||"+Me+".getBuffer("+R+")||"+Me+".getBuffer("+R+".buffer)||"+Te+"("+R+'.buffer)||("constant" in '+R+"&&(typeof "+R+'.constant==="number"||'+re.isArrayLike+"("+R+".constant))))",'invalid dynamic attribute "'+Q+'"')});var _e={isStream:Y.def(!1)},$e=new ae;$e.state=Al,Object.keys($e).forEach(function(Nt){_e[Nt]=Y.def(""+$e[Nt])});var Et=_e.buffer,Kt=_e.type;Y("if(",Te,"(",R,")){",_e.isStream,"=true;",Et,"=",Me,".createStream(",Cl,",",R,");",Kt,"=",Et,".dtype;","}else{",Et,"=",Me,".getBuffer(",R,");","if(",Et,"){",Kt,"=",Et,".dtype;",'}else if("constant" in ',R,"){",_e.state,"=",cm,";","if(typeof "+R+'.constant === "number"){',_e[El[0]],"=",R,".constant;",El.slice(1).map(function(Nt){return _e[Nt]}).join("="),"=0;","}else{",El.map(function(Nt,jt){return _e[Nt]+"="+R+".constant.length>"+jt+"?"+R+".constant["+jt+"]:0;"}).join(""),"}}else{","if(",Te,"(",R,".buffer)){",Et,"=",Me,".createStream(",Cl,",",R,".buffer);","}else{",Et,"=",Me,".getBuffer(",R,".buffer);","}",Kt,'="type" in ',R,"?",fe.glTypes,"[",R,".type]:",Et,".dtype;",_e.normalized,"=!!",R,".normalized;");function bt(Nt){Y(_e[Nt],"=",R,".",Nt,"|0;")}return bt("size"),bt("offset"),bt("stride"),bt("divisor"),Y("}}"),Y.exit("if(",_e.isStream,"){",Me,".destroyStream(",Et,");","}"),_e}ce[Q]=Ni(Z,te)}),ce}function Cn(F,N){var q=F.static,ie=F.dynamic;if(Jc in q){var ce=q[Jc];return ce!==null&&je.getVAO(ce)===null&&(ce=je.createVAO(ce)),xn(function(Z){return Z.link(je.getVAO(ce))})}else if(Jc in ie){var Q=ie[Jc];return Ni(Q,function(Z,te){var U=Z.invoke(te,Q);return te.def(Z.shared.vao+".getVAO("+U+")")})}return null}function Jr(F){var N=F.static,q=F.dynamic,ie={};return Object.keys(N).forEach(function(ce){var Q=N[ce];ie[ce]=xn(function(Z,te){return typeof Q=="number"||typeof Q=="boolean"?""+Q:Z.link(Q)})}),Object.keys(q).forEach(function(ce){var Q=q[ce];ie[ce]=Ni(Q,function(Z,te){return Z.invoke(te,Q)})}),ie}function Sn(F,N,q,ie,ce){var Q=F.static,Z=F.dynamic;D.optional(function(){var bt=[vu,Zc,Qc,pu,gu,Bd,yu,Fd,Kc,Jc].concat(Oe);function Nt(jt){Object.keys(jt).forEach(function(Ar){D.command(bt.indexOf(Ar)>=0,'unknown parameter "'+Ar+'"',ce.commandStr)})}Nt(Q),Nt(Z)});var te=Vt(F,N),U=mt(F),Y=Jt(F,U,ce),R=Er(F,ce),re=_n(F,ce),fe=Qt(F,ce,te);function Te(bt){var Nt=Y[bt];Nt&&(re[bt]=Nt)}Te(ko),Te(Je(Rd));var Me=Object.keys(re).length>0,_e={framebuffer:U,draw:R,shader:fe,state:re,dirty:Me,scopeVAO:null,drawVAO:null,useVAO:!1,attributes:{}};if(_e.profile=Ht(F),_e.uniforms=Nn(q,ce),_e.drawVAO=_e.scopeVAO=Cn(F),!_e.drawVAO&&fe.program&&!te&&j.angle_instanced_arrays){var $e=!0,Et=fe.program.attributes.map(function(bt){var Nt=N.static[bt];return $e=$e&&!!Nt,Nt});if($e&&Et.length>0){var Kt=je.getVAO(je.createVAO(Et));_e.drawVAO=new _i(null,null,null,function(bt,Nt){return bt.link(Kt)}),_e.useVAO=!0}}return te?_e.useVAO=!0:_e.attributes=ir(N,ce),_e.context=Jr(ie),_e}function Mn(F,N,q){var ie=F.shared,ce=ie.context,Q=F.scope();Object.keys(q).forEach(function(Z){N.save(ce,"."+Z);var te=q[Z],U=te.append(F,N);Array.isArray(U)?Q(ce,".",Z,"=[",U.join(),"];"):Q(ce,".",Z,"=",U,";")}),N(Q)}function kn(F,N,q,ie){var ce=F.shared,Q=ce.gl,Z=ce.framebuffer,te;it&&(te=N.def(ce.extensions,".webgl_draw_buffers"));var U=F.constants,Y=U.drawBuffer,R=U.backBuffer,re;q?re=q.append(F,N):re=N.def(Z,".next"),ie||N("if(",re,"!==",Z,".cur){"),N("if(",re,"){",Q,".bindFramebuffer(",pS,",",re,".framebuffer);"),it&&N(te,".drawBuffersWEBGL(",Y,"[",re,".colorAttachments.length]);"),N("}else{",Q,".bindFramebuffer(",pS,",null);"),it&&N(te,".drawBuffersWEBGL(",R,");"),N("}",Z,".cur=",re,";"),ie||N("}")}function Gn(F,N,q){var ie=F.shared,ce=ie.gl,Q=F.current,Z=F.next,te=ie.current,U=ie.next,Y=F.cond(te,".dirty");Oe.forEach(function(R){var re=Je(R);if(!(re in q.state)){var fe,Te;if(re in Z){fe=Z[re],Te=Q[re];var Me=Ln(Le[re].length,function($e){return Y.def(fe,"[",$e,"]")});Y(F.cond(Me.map(function($e,Et){return $e+"!=="+Te+"["+Et+"]"}).join("||")).then(ce,".",Ne[re],"(",Me,");",Me.map(function($e,Et){return Te+"["+Et+"]="+$e}).join(";"),";"))}else{fe=Y.def(U,".",re);var _e=F.cond(fe,"!==",te,".",re);Y(_e),re in Qe?_e(F.cond(fe).then(ce,".enable(",Qe[re],");").else(ce,".disable(",Qe[re],");"),te,".",re,"=",fe,";"):_e(ce,".",Ne[re],"(",fe,");",te,".",re,"=",fe,";")}}}),Object.keys(q.state).length===0&&Y(te,".dirty=false;"),N(Y)}function Zn(F,N,q,ie){var ce=F.shared,Q=F.current,Z=ce.current,te=ce.gl;mS(Object.keys(q)).forEach(function(U){var Y=q[U];if(!(ie&&!ie(Y))){var R=Y.append(F,N);if(Qe[U]){var re=Qe[U];ds(Y)?R?N(te,".enable(",re,");"):N(te,".disable(",re,");"):N(F.cond(R).then(te,".enable(",re,");").else(te,".disable(",re,");")),N(Z,".",U,"=",R,";")}else if(pn(R)){var fe=Q[U];N(te,".",Ne[U],"(",R,");",R.map(function(Te,Me){return fe+"["+Me+"]="+Te}).join(";"),";")}else N(te,".",Ne[U],"(",R,");",Z,".",U,"=",R,";")}})}function gn(F,N){Ve&&(F.instancing=N.def(F.shared.extensions,".angle_instanced_arrays"))}function qt(F,N,q,ie,ce){var Q=F.shared,Z=F.stats,te=Q.current,U=Q.timer,Y=q.profile;function R(){return typeof performance=="undefined"?"Date.now()":"performance.now()"}var re,fe;function Te(bt){re=N.def(),bt(re,"=",R(),";"),typeof ce=="string"?bt(Z,".count+=",ce,";"):bt(Z,".count++;"),Be&&(ie?(fe=N.def(),bt(fe,"=",U,".getNumPendingQueries();")):bt(U,".beginQuery(",Z,");"))}function Me(bt){bt(Z,".cpuTime+=",R(),"-",re,";"),Be&&(ie?bt(U,".pushScopeStats(",fe,",",U,".getNumPendingQueries(),",Z,");"):bt(U,".endQuery();"))}function _e(bt){var Nt=N.def(te,".profile");N(te,".profile=",bt,";"),N.exit(te,".profile=",Nt,";")}var $e;if(Y){if(ds(Y)){Y.enable?(Te(N),Me(N.exit),_e("true")):_e("false");return}$e=Y.append(F,N),_e($e)}else $e=N.def(te,".profile");var Et=F.block();Te(Et),N("if(",$e,"){",Et,"}");var Kt=F.block();Me(Kt),N.exit("if(",$e,"){",Kt,"}")}function Qn(F,N,q,ie,ce){var Q=F.shared;function Z(U){switch(U){case Ud:case $d:case Wd:return 2;case Gd:case Vd:case Xd:return 3;case zd:case jd:case Yd:return 4;default:return 1}}function te(U,Y,R){var re=Q.gl,fe=N.def(U,".location"),Te=N.def(Q.attributes,"[",fe,"]"),Me=R.state,_e=R.buffer,$e=[R.x,R.y,R.z,R.w],Et=["buffer","normalized","offset","stride"];function Kt(){N("if(!",Te,".buffer){",re,".enableVertexAttribArray(",fe,");}");var Nt=R.type,jt;if(R.size?jt=N.def(R.size,"||",Y):jt=Y,N("if(",Te,".type!==",Nt,"||",Te,".size!==",jt,"||",Et.map(function(fn){return Te+"."+fn+"!=="+R[fn]}).join("||"),"){",re,".bindBuffer(",Cl,",",_e,".buffer);",re,".vertexAttribPointer(",[fe,jt,Nt,R.normalized,R.stride,R.offset],");",Te,".type=",Nt,";",Te,".size=",jt,";",Et.map(function(fn){return Te+"."+fn+"="+R[fn]+";"}).join(""),"}"),Ve){var Ar=R.divisor;N("if(",Te,".divisor!==",Ar,"){",F.instancing,".vertexAttribDivisorANGLE(",[fe,Ar],");",Te,".divisor=",Ar,";}")}}function bt(){N("if(",Te,".buffer){",re,".disableVertexAttribArray(",fe,");",Te,".buffer=null;","}if(",El.map(function(Nt,jt){return Te+"."+Nt+"!=="+$e[jt]}).join("||"),"){",re,".vertexAttrib4f(",fe,",",$e,");",El.map(function(Nt,jt){return Te+"."+Nt+"="+$e[jt]+";"}).join(""),"}")}Me===Al?Kt():Me===cm?bt():(N("if(",Me,"===",Al,"){"),Kt(),N("}else{"),bt(),N("}"))}ie.forEach(function(U){var Y=U.name,R=q.attributes[Y],re;if(R){if(!ce(R))return;re=R.append(F,N)}else{if(!ce(bS))return;var fe=F.scopeAttrib(Y);D.optional(function(){F.assert(N,fe+".state","missing attribute "+Y)}),re={},Object.keys(new ae).forEach(function(Te){re[Te]=N.def(fe,".",Te)})}te(F.link(U),Z(U.info.type),re)})}function Or(F,N,q,ie,ce){for(var Q=F.shared,Z=Q.gl,te,U=0;U<ie.length;++U){var Y=ie[U],R=Y.name,re=Y.info.type,fe=q.uniforms[R],Te=F.link(Y),Me=Te+".location",_e;if(fe){if(!ce(fe))continue;if(ds(fe)){var $e=fe.value;if(D.command($e!==null&&typeof $e!="undefined",'missing uniform "'+R+'"',F.commandStr),re===nf||re===af){D.command(typeof $e=="function"&&(re===nf&&($e._reglType==="texture2d"||$e._reglType==="framebuffer")||re===af&&($e._reglType==="textureCube"||$e._reglType==="framebufferCube")),"invalid texture for uniform "+R,F.commandStr);var Et=F.link($e._texture||$e.color[0]._texture);N(Z,".uniform1i(",Me,",",Et+".bind());"),N.exit(Et,".unbind();")}else if(re===ef||re===tf||re===rf){D.optional(function(){D.command(pn($e),"invalid matrix for uniform "+R,F.commandStr),D.command(re===ef&&$e.length===4||re===tf&&$e.length===9||re===rf&&$e.length===16,"invalid length for matrix uniform "+R,F.commandStr)});var Kt=F.global.def("new Float32Array(["+Array.prototype.slice.call($e)+"])"),bt=2;re===tf?bt=3:re===rf&&(bt=4),N(Z,".uniformMatrix",bt,"fv(",Me,",false,",Kt,");")}else{switch(re){case Tm:D.commandType($e,"number","uniform "+R,F.commandStr),te="1f";break;case Ud:D.command(pn($e)&&$e.length===2,"uniform "+R,F.commandStr),te="2f";break;case Gd:D.command(pn($e)&&$e.length===3,"uniform "+R,F.commandStr),te="3f";break;case zd:D.command(pn($e)&&$e.length===4,"uniform "+R,F.commandStr),te="4f";break;case Cm:D.commandType($e,"boolean","uniform "+R,F.commandStr),te="1i";break;case Im:D.commandType($e,"number","uniform "+R,F.commandStr),te="1i";break;case Wd:D.command(pn($e)&&$e.length===2,"uniform "+R,F.commandStr),te="2i";break;case $d:D.command(pn($e)&&$e.length===2,"uniform "+R,F.commandStr),te="2i";break;case Xd:D.command(pn($e)&&$e.length===3,"uniform "+R,F.commandStr),te="3i";break;case Vd:D.command(pn($e)&&$e.length===3,"uniform "+R,F.commandStr),te="3i";break;case Yd:D.command(pn($e)&&$e.length===4,"uniform "+R,F.commandStr),te="4i";break;case jd:D.command(pn($e)&&$e.length===4,"uniform "+R,F.commandStr),te="4i";break}N(Z,".uniform",te,"(",Me,",",pn($e)?Array.prototype.slice.call($e):$e,");")}continue}else _e=fe.append(F,N)}else{if(!ce(bS))continue;_e=N.def(Q.uniforms,"[",O.id(R),"]")}re===nf?(D(!Array.isArray(_e),"must specify a scalar prop for textures"),N("if(",_e,"&&",_e,'._reglType==="framebuffer"){',_e,"=",_e,".color[0];","}")):re===af&&(D(!Array.isArray(_e),"must specify a scalar prop for cube maps"),N("if(",_e,"&&",_e,'._reglType==="framebufferCube"){',_e,"=",_e,".color[0];","}")),D.optional(function(){function Si(Ea,TS){F.assert(N,Ea,'bad data or missing for uniform "'+R+'".  '+TS)}function Dm(Ea){D(!Array.isArray(_e),"must not specify an array type for uniform"),Si("typeof "+_e+'==="'+Ea+'"',"invalid type, expected "+Ea)}function sa(Ea,TS){Array.isArray(_e)?D(_e.length===Ea,"must have length "+Ea):Si(Q.isArrayLike+"("+_e+")&&"+_e+".length==="+Ea,"invalid vector, should have length "+Ea,F.commandStr)}function AS(Ea){D(!Array.isArray(_e),"must not specify a value type"),Si("typeof "+_e+'==="function"&&'+_e+'._reglType==="texture'+(Ea===lS?"2d":"Cube")+'"',"invalid texture type",F.commandStr)}switch(re){case Im:Dm("number");break;case $d:sa(2);break;case Vd:sa(3);break;case jd:sa(4);break;case Tm:Dm("number");break;case Ud:sa(2);break;case Gd:sa(3);break;case zd:sa(4);break;case Cm:Dm("boolean");break;case Wd:sa(2);break;case Xd:sa(3);break;case Yd:sa(4);break;case ef:sa(4);break;case tf:sa(9);break;case rf:sa(16);break;case nf:AS(lS);break;case af:AS(q5);break}});var Nt=1;switch(re){case nf:case af:var jt=N.def(_e,"._texture");N(Z,".uniform1i(",Me,",",jt,".bind());"),N.exit(jt,".unbind();");continue;case Im:case Cm:te="1i";break;case $d:case Wd:te="2i",Nt=2;break;case Vd:case Xd:te="3i",Nt=3;break;case jd:case Yd:te="4i",Nt=4;break;case Tm:te="1f";break;case Ud:te="2f",Nt=2;break;case Gd:te="3f",Nt=3;break;case zd:te="4f",Nt=4;break;case ef:te="Matrix2fv";break;case tf:te="Matrix3fv";break;case rf:te="Matrix4fv";break}if(N(Z,".uniform",te,"(",Me,","),te.charAt(0)==="M"){var Ar=Math.pow(re-ef+2,2),fn=F.global.def("new Float32Array(",Ar,")");Array.isArray(_e)?N("false,(",Ln(Ar,function(Si){return fn+"["+Si+"]="+_e[Si]}),",",fn,")"):N("false,(Array.isArray(",_e,")||",_e," instanceof Float32Array)?",_e,":(",Ln(Ar,function(Si){return fn+"["+Si+"]="+_e+"["+Si+"]"}),",",fn,")")}else Nt>1?N(Ln(Nt,function(Si){return Array.isArray(_e)?_e[Si]:_e+"["+Si+"]"})):(D(!Array.isArray(_e),"uniform value must not be an array"),N(_e));N(");")}}function Lt(F,N,q,ie){var ce=F.shared,Q=ce.gl,Z=ce.draw,te=ie.draw;function U(){var jt=te.elements,Ar,fn=N;return jt?((jt.contextDep&&ie.contextDynamic||jt.propDep)&&(fn=q),Ar=jt.append(F,fn)):Ar=fn.def(Z,".",pu),Ar&&fn("if("+Ar+")"+Q+".bindBuffer("+X5+","+Ar+".buffer.buffer);"),Ar}function Y(){var jt=te.count,Ar,fn=N;return jt?((jt.contextDep&&ie.contextDynamic||jt.propDep)&&(fn=q),Ar=jt.append(F,fn),D.optional(function(){jt.MISSING&&F.assert(N,"false","missing vertex count"),jt.DYNAMIC&&F.assert(fn,Ar+">=0","missing vertex count")})):(Ar=fn.def(Z,".",yu),D.optional(function(){F.assert(fn,Ar+">=0","missing vertex count")})),Ar}var R=U();function re(jt){var Ar=te[jt];return Ar?Ar.contextDep&&ie.contextDynamic||Ar.propDep?Ar.append(F,q):Ar.append(F,N):N.def(Z,".",jt)}var fe=re(gu),Te=re(Bd),Me=Y();if(typeof Me=="number"){if(Me===0)return}else q("if(",Me,"){"),q.exit("}");var _e,$e;Ve&&(_e=re(Fd),$e=F.instancing);var Et=R+".type",Kt=te.elements&&ds(te.elements);function bt(){function jt(){q($e,".drawElementsInstancedANGLE(",[fe,Me,Et,Te+"<<(("+Et+"-"+$_+")>>1)",_e],");")}function Ar(){q($e,".drawArraysInstancedANGLE(",[fe,Te,Me,_e],");")}R?Kt?jt():(q("if(",R,"){"),jt(),q("}else{"),Ar(),q("}")):Ar()}function Nt(){function jt(){q(Q+".drawElements("+[fe,Me,Et,Te+"<<(("+Et+"-"+$_+")>>1)"]+");")}function Ar(){q(Q+".drawArrays("+[fe,Te,Me]+");")}R?Kt?jt():(q("if(",R,"){"),jt(),q("}else{"),Ar(),q("}")):Ar()}Ve&&(typeof _e!="number"||_e>=0)?typeof _e=="string"?(q("if(",_e,">0){"),bt(),q("}else if(",_e,"<0){"),Nt(),q("}")):bt():Nt()}function rr(F,N,q,ie,ce){var Q=Ut(),Z=Q.proc("body",ce);return D.optional(function(){Q.commandStr=N.commandStr,Q.command=Q.link(N.commandStr)}),Ve&&(Q.instancing=Z.def(Q.shared.extensions,".angle_instanced_arrays")),F(Q,Z,q,ie),Q.compile().body}function mr(F,N,q,ie){gn(F,N),q.useVAO?q.drawVAO?N(F.shared.vao,".setVAO(",q.drawVAO.append(F,N),");"):N(F.shared.vao,".setVAO(",F.shared.vao,".targetVAO);"):(N(F.shared.vao,".setVAO(null);"),Qn(F,N,q,ie.attributes,function(){return!0})),Or(F,N,q,ie.uniforms,function(){return!0}),Lt(F,N,N,q)}function yn(F,N){var q=F.proc("draw",1);gn(F,q),Mn(F,q,N.context),kn(F,q,N.framebuffer),Gn(F,q,N),Zn(F,q,N.state),qt(F,q,N,!1,!0);var ie=N.shader.progVar.append(F,q);if(q(F.shared.gl,".useProgram(",ie,".program);"),N.shader.program)mr(F,q,N,N.shader.program);else{q(F.shared.vao,".setVAO(null);");var ce=F.global.def("{}"),Q=q.def(ie,".id"),Z=q.def(ce,"[",Q,"]");q(F.cond(Z).then(Z,".call(this,a0);").else(Z,"=",ce,"[",Q,"]=",F.link(function(te){return rr(mr,F,N,te,1)}),"(",ie,");",Z,".call(this,a0);"))}Object.keys(N.state).length>0&&q(F.shared.current,".dirty=true;")}function qa(F,N,q,ie){F.batchId="a1",gn(F,N);function ce(){return!0}Qn(F,N,q,ie.attributes,ce),Or(F,N,q,ie.uniforms,ce),Lt(F,N,N,q)}function bu(F,N,q,ie){gn(F,N);var ce=q.contextDep,Q=N.def(),Z="a0",te="a1",U=N.def();F.shared.props=U,F.batchId=Q;var Y=F.scope(),R=F.scope();N(Y.entry,"for(",Q,"=0;",Q,"<",te,";++",Q,"){",U,"=",Z,"[",Q,"];",R,"}",Y.exit);function re(Et){return Et.contextDep&&ce||Et.propDep}function fe(Et){return!re(Et)}if(q.needsContext&&Mn(F,R,q.context),q.needsFramebuffer&&kn(F,R,q.framebuffer),Zn(F,R,q.state,re),q.profile&&re(q.profile)&&qt(F,R,q,!1,!0),ie)q.useVAO?q.drawVAO?re(q.drawVAO)?R(F.shared.vao,".setVAO(",q.drawVAO.append(F,R),");"):Y(F.shared.vao,".setVAO(",q.drawVAO.append(F,Y),");"):Y(F.shared.vao,".setVAO(",F.shared.vao,".targetVAO);"):(Y(F.shared.vao,".setVAO(null);"),Qn(F,Y,q,ie.attributes,fe),Qn(F,R,q,ie.attributes,re)),Or(F,Y,q,ie.uniforms,fe),Or(F,R,q,ie.uniforms,re),Lt(F,Y,R,q);else{var Te=F.global.def("{}"),Me=q.shader.progVar.append(F,R),_e=R.def(Me,".id"),$e=R.def(Te,"[",_e,"]");R(F.shared.gl,".useProgram(",Me,".program);","if(!",$e,"){",$e,"=",Te,"[",_e,"]=",F.link(function(Et){return rr(qa,F,q,Et,2)}),"(",Me,");}",$e,".call(this,a0[",Q,"],",Q,");")}}function G(F,N){var q=F.proc("batch",2);F.batchId="0",gn(F,q);var ie=!1,ce=!0;Object.keys(N.context).forEach(function(Te){ie=ie||N.context[Te].propDep}),ie||(Mn(F,q,N.context),ce=!1);var Q=N.framebuffer,Z=!1;Q?(Q.propDep?ie=Z=!0:Q.contextDep&&ie&&(Z=!0),Z||kn(F,q,Q)):kn(F,q,null),N.state.viewport&&N.state.viewport.propDep&&(ie=!0);function te(Te){return Te.contextDep&&ie||Te.propDep}Gn(F,q,N),Zn(F,q,N.state,function(Te){return!te(Te)}),(!N.profile||!te(N.profile))&&qt(F,q,N,!1,"a1"),N.contextDep=ie,N.needsContext=ce,N.needsFramebuffer=Z;var U=N.shader.progVar;if(U.contextDep&&ie||U.propDep)bu(F,q,N,null);else{var Y=U.append(F,q);if(q(F.shared.gl,".useProgram(",Y,".program);"),N.shader.program)bu(F,q,N,N.shader.program);else{q(F.shared.vao,".setVAO(null);");var R=F.global.def("{}"),re=q.def(Y,".id"),fe=q.def(R,"[",re,"]");q(F.cond(fe).then(fe,".call(this,a0,a1);").else(fe,"=",R,"[",re,"]=",F.link(function(Te){return rr(bu,F,N,Te,2)}),"(",Y,");",fe,".call(this,a0,a1);"))}}Object.keys(N.state).length>0&&q(F.shared.current,".dirty=true;")}function ge(F,N){var q=F.proc("scope",3);F.batchId="a2";var ie=F.shared,ce=ie.current;Mn(F,q,N.context),N.framebuffer&&N.framebuffer.append(F,q),mS(Object.keys(N.state)).forEach(function(Z){var te=N.state[Z],U=te.append(F,q);pn(U)?U.forEach(function(Y,R){q.set(F.next[Z],"["+R+"]",Y)}):q.set(ie.next,"."+Z,U)}),qt(F,q,N,!0,!0),[pu,Bd,yu,Fd,gu].forEach(function(Z){var te=N.draw[Z];!te||q.set(ie.draw,"."+Z,""+te.append(F,q))}),Object.keys(N.uniforms).forEach(function(Z){var te=N.uniforms[Z].append(F,q);Array.isArray(te)&&(te="["+te.join()+"]"),q.set(ie.uniforms,"["+O.id(Z)+"]",te)}),Object.keys(N.attributes).forEach(function(Z){var te=N.attributes[Z].append(F,q),U=F.scopeAttrib(Z);Object.keys(new ae).forEach(function(Y){q.set(U,"."+Y,te[Y])})}),N.scopeVAO&&q.set(ie.vao,".targetVAO",N.scopeVAO.append(F,q));function Q(Z){var te=N.shader[Z];te&&q.set(ie.shader,"."+Z,te.append(F,q))}Q(Zc),Q(Qc),Object.keys(N.state).length>0&&(q(ce,".dirty=true;"),q.exit(ce,".dirty=true;")),q("a1(",F.shared.context,",a0,",F.batchId,");")}function de(F){if(!(typeof F!="object"||pn(F))){for(var N=Object.keys(F),q=0;q<N.length;++q)if(vr.isDynamic(F[N[q]]))return!0;return!1}}function lt(F,N,q){var ie=N.static[q];if(!ie||!de(ie))return;var ce=F.global,Q=Object.keys(ie),Z=!1,te=!1,U=!1,Y=F.global.def("{}");Q.forEach(function(re){var fe=ie[re];if(vr.isDynamic(fe)){typeof fe=="function"&&(fe=ie[re]=vr.unbox(fe));var Te=Ni(fe,null);Z=Z||Te.thisDep,U=U||Te.propDep,te=te||Te.contextDep}else{switch(ce(Y,".",re,"="),typeof fe){case"number":ce(fe);break;case"string":ce('"',fe,'"');break;case"object":Array.isArray(fe)&&ce("[",fe.join(),"]");break;default:ce(F.link(fe));break}ce(";")}});function R(re,fe){Q.forEach(function(Te){var Me=ie[Te];if(!!vr.isDynamic(Me)){var _e=re.invoke(fe,Me);fe(Y,".",Te,"=",_e,";")}})}N.dynamic[q]=new vr.DynamicVariable(Pd,{thisDep:Z,contextDep:te,propDep:U,ref:Y,append:R}),delete N.static[q]}function er(F,N,q,ie,ce){var Q=Ut();Q.stats=Q.link(ce),Object.keys(N.static).forEach(function(te){lt(Q,N,te)}),W5.forEach(function(te){lt(Q,F,te)});var Z=Sn(F,N,q,ie,Q);return yn(Q,Z),ge(Q,Z),G(Q,Z),n(Q.compile(),{destroy:function(){Z.shader.program.destroy()}})}return{next:ot,current:Le,procs:function(){var F=Ut(),N=F.proc("poll"),q=F.proc("refresh"),ie=F.block();N(ie),q(ie);var ce=F.shared,Q=ce.gl,Z=ce.next,te=ce.current;ie(te,".dirty=false;"),kn(F,N),kn(F,q,null,!0);var U;Ve&&(U=F.link(Ve)),j.oes_vertex_array_object&&q(F.link(j.oes_vertex_array_object),".bindVertexArrayOES(null);");for(var Y=0;Y<pe.maxAttributes;++Y){var R=q.def(ce.attributes,"[",Y,"]"),re=F.cond(R,".buffer");re.then(Q,".enableVertexAttribArray(",Y,");",Q,".bindBuffer(",Cl,",",R,".buffer.buffer);",Q,".vertexAttribPointer(",Y,",",R,".size,",R,".type,",R,".normalized,",R,".stride,",R,".offset);").else(Q,".disableVertexAttribArray(",Y,");",Q,".vertexAttrib4f(",Y,",",R,".x,",R,".y,",R,".z,",R,".w);",R,".buffer=null;"),q(re),Ve&&q(U,".vertexAttribDivisorANGLE(",Y,",",R,".divisor);")}return q(F.shared.vao,".currentVAO=null;",F.shared.vao,".setVAO(",F.shared.vao,".targetVAO);"),Object.keys(Qe).forEach(function(fe){var Te=Qe[fe],Me=ie.def(Z,".",fe),_e=F.block();_e("if(",Me,"){",Q,".enable(",Te,")}else{",Q,".disable(",Te,")}",te,".",fe,"=",Me,";"),q(_e),N("if(",Me,"!==",te,".",fe,"){",_e,"}")}),Object.keys(Ne).forEach(function(fe){var Te=Ne[fe],Me=Le[fe],_e,$e,Et=F.block();if(Et(Q,".",Te,"("),pn(Me)){var Kt=Me.length;_e=F.global.def(Z,".",fe),$e=F.global.def(te,".",fe),Et(Ln(Kt,function(bt){return _e+"["+bt+"]"}),");",Ln(Kt,function(bt){return $e+"["+bt+"]="+_e+"["+bt+"];"}).join("")),N("if(",Ln(Kt,function(bt){return _e+"["+bt+"]!=="+$e+"["+bt+"]"}).join("||"),"){",Et,"}")}else _e=ie.def(Z,".",fe),$e=ie.def(te,".",fe),Et(_e,");",te,".",fe,"=",_e,";"),N("if(",_e,"!==",$e,"){",Et,"}");q(Et)}),F.compile()}(),compile:er}}function fU(){return{vaoCount:0,bufferCount:0,elementsCount:0,framebufferCount:0,shaderCount:0,textureCount:0,cubeCount:0,renderbufferCount:0,maxTextureUnits:0}}var hU=34918,dU=34919,wS=35007,vU=function(E,O){if(!O.ext_disjoint_timer_query)return null;var j=[];function pe(){return j.pop()||O.ext_disjoint_timer_query.createQueryEXT()}function Ce(Ve){j.push(Ve)}var ve=[];function be(Ve){var it=pe();O.ext_disjoint_timer_query.beginQueryEXT(wS,it),ve.push(it),Be(ve.length-1,ve.length,Ve)}function Re(){O.ext_disjoint_timer_query.endQueryEXT(wS)}function Ue(){this.startQueryIndex=-1,this.endQueryIndex=-1,this.sum=0,this.stats=null}var je=[];function Ge(){return je.pop()||new Ue}function He(Ve){je.push(Ve)}var et=[];function Be(Ve,it,Le){var ot=Ge();ot.startQueryIndex=Ve,ot.endQueryIndex=it,ot.sum=0,ot.stats=Le,et.push(ot)}var Ke=[],ae=[];function we(){var Ve,it,Le=ve.length;if(Le!==0){ae.length=Math.max(ae.length,Le+1),Ke.length=Math.max(Ke.length,Le+1),Ke[0]=0,ae[0]=0;var ot=0;for(Ve=0,it=0;it<ve.length;++it){var Oe=ve[it];O.ext_disjoint_timer_query.getQueryObjectEXT(Oe,dU)?(ot+=O.ext_disjoint_timer_query.getQueryObjectEXT(Oe,hU),Ce(Oe)):ve[Ve++]=Oe,Ke[it+1]=ot,ae[it+1]=Ve}for(ve.length=Ve,Ve=0,it=0;it<et.length;++it){var Qe=et[it],Ne=Qe.startQueryIndex,Je=Qe.endQueryIndex;Qe.sum+=Ke[Je]-Ke[Ne];var Tt=ae[Ne],$t=ae[Je];$t===Tt?(Qe.stats.gpuTime+=Qe.sum/1e6,He(Qe)):(Qe.startQueryIndex=Tt,Qe.endQueryIndex=$t,et[Ve++]=Qe)}et.length=Ve}}return{beginQuery:be,endQuery:Re,pushScopeStats:Be,update:we,getNumPendingQueries:function(){return ve.length},clear:function(){j.push.apply(j,ve);for(var Ve=0;Ve<j.length;Ve++)O.ext_disjoint_timer_query.deleteQueryEXT(j[Ve]);ve.length=0,j.length=0},restore:function(){ve.length=0,j.length=0}}},pU=16384,gU=256,yU=1024,mU=34962,xS="webglcontextlost",_S="webglcontextrestored",SS=1,bU=2,wU=3;function ES(E,O){for(var j=0;j<E.length;++j)if(E[j]===O)return j;return-1}function xU(E){var O=Uc(E);if(!O)return null;var j=O.gl,pe=j.getContextAttributes(),Ce=j.isContextLost(),ve=Io(j,O);if(!ve)return null;var be=kr(),Re=fU(),Ue=ve.extensions,je=vU(j,Ue),Ge=qn(),He=j.drawingBufferWidth,et=j.drawingBufferHeight,Be={tick:0,time:0,viewportWidth:He,viewportHeight:et,framebufferWidth:He,framebufferHeight:et,drawingBufferWidth:He,drawingBufferHeight:et,pixelRatio:O.pixelRatio},Ke={},ae={elements:null,primitive:4,count:-1,offset:0,instances:-1},we=o4(j,Ue),Ve=_4(j,Re,O,Le),it=O5(j,Ue,we,Re,Ve);function Le(Lt){return it.destroyBuffer(Lt)}var ot=O4(j,Ue,Ve,Re),Oe=F5(j,be,Re,O),Qe=f5(j,Ue,we,function(){Tt.procs.poll()},Be,Re,O),Ne=h5(j,Ue,we,Re,O),Je=L5(j,Ue,we,Qe,Ne,Re),Tt=cU(j,be,Ue,we,Ve,ot,Qe,Je,Ke,it,Oe,ae,Be,je,O),$t=z5(j,Je,Tt.procs.poll,Be,pe,Ue,we),tt=Tt.next,Xe=j.canvas,ke=[],Ut=[],Ht=[],mt=[O.onDestroy],Jt=null;function Vt(){if(ke.length===0){je&&je.update(),Jt=null;return}Jt=Nr.next(Vt),Zn();for(var Lt=ke.length-1;Lt>=0;--Lt){var rr=ke[Lt];rr&&rr(Be,null,0)}j.flush(),je&&je.update()}function Qt(){!Jt&&ke.length>0&&(Jt=Nr.next(Vt))}function Er(){Jt&&(Nr.cancel(Vt),Jt=null)}function _n(Lt){Lt.preventDefault(),Ce=!0,Er(),Ut.forEach(function(rr){rr()})}function Nn(Lt){j.getError(),Ce=!1,ve.restore(),Oe.restore(),Ve.restore(),Qe.restore(),Ne.restore(),Je.restore(),it.restore(),je&&je.restore(),Tt.procs.refresh(),Qt(),Ht.forEach(function(rr){rr()})}Xe&&(Xe.addEventListener(xS,_n,!1),Xe.addEventListener(_S,Nn,!1));function ir(){ke.length=0,Er(),Xe&&(Xe.removeEventListener(xS,_n),Xe.removeEventListener(_S,Nn)),Oe.clear(),Je.clear(),Ne.clear(),Qe.clear(),ot.clear(),Ve.clear(),it.clear(),je&&je.clear(),mt.forEach(function(Lt){Lt()})}function Cn(Lt){D(!!Lt,"invalid args to regl({...})"),D.type(Lt,"object","invalid args to regl({...})");function rr(ce){var Q=n({},ce);delete Q.uniforms,delete Q.attributes,delete Q.context,delete Q.vao,"stencil"in Q&&Q.stencil.op&&(Q.stencil.opBack=Q.stencil.opFront=Q.stencil.op,delete Q.stencil.op);function Z(te){if(te in Q){var U=Q[te];delete Q[te],Object.keys(U).forEach(function(Y){Q[te+"."+Y]=U[Y]})}}return Z("blend"),Z("depth"),Z("cull"),Z("stencil"),Z("polygonOffset"),Z("scissor"),Z("sample"),"vao"in ce&&(Q.vao=ce.vao),Q}function mr(ce,Q){var Z={},te={};return Object.keys(ce).forEach(function(U){var Y=ce[U];if(vr.isDynamic(Y)){te[U]=vr.unbox(Y,U);return}else if(Q&&Array.isArray(Y)){for(var R=0;R<Y.length;++R)if(vr.isDynamic(Y[R])){te[U]=vr.unbox(Y,U);return}}Z[U]=Y}),{dynamic:te,static:Z}}var yn=mr(Lt.context||{},!0),qa=mr(Lt.uniforms||{},!0),bu=mr(Lt.attributes||{},!1),G=mr(rr(Lt),!1),ge={gpuTime:0,cpuTime:0,count:0},de=Tt.compile(G,bu,qa,yn,ge),lt=de.draw,er=de.batch,F=de.scope,N=[];function q(ce){for(;N.length<ce;)N.push(null);return N}function ie(ce,Q){var Z;if(Ce&&D.raise("context lost"),typeof ce=="function")return F.call(this,null,ce,0);if(typeof Q=="function")if(typeof ce=="number")for(Z=0;Z<ce;++Z)F.call(this,null,Q,Z);else if(Array.isArray(ce))for(Z=0;Z<ce.length;++Z)F.call(this,ce[Z],Q,Z);else return F.call(this,ce,Q,0);else if(typeof ce=="number"){if(ce>0)return er.call(this,q(ce|0),ce|0)}else if(Array.isArray(ce)){if(ce.length)return er.call(this,ce,ce.length)}else return lt.call(this,ce)}return n(ie,{stats:ge,destroy:function(){de.destroy()}})}var Jr=Je.setFBO=Cn({framebuffer:vr.define.call(null,SS,"framebuffer")});function Sn(Lt,rr){var mr=0;Tt.procs.poll();var yn=rr.color;yn&&(j.clearColor(+yn[0]||0,+yn[1]||0,+yn[2]||0,+yn[3]||0),mr|=pU),"depth"in rr&&(j.clearDepth(+rr.depth),mr|=gU),"stencil"in rr&&(j.clearStencil(rr.stencil|0),mr|=yU),D(!!mr,"called regl.clear with no buffer specified"),j.clear(mr)}function Mn(Lt){if(D(typeof Lt=="object"&&Lt,"regl.clear() takes an object as input"),"framebuffer"in Lt)if(Lt.framebuffer&&Lt.framebuffer_reglType==="framebufferCube")for(var rr=0;rr<6;++rr)Jr(n({framebuffer:Lt.framebuffer.faces[rr]},Lt),Sn);else Jr(Lt,Sn);else Sn(null,Lt)}function kn(Lt){D.type(Lt,"function","regl.frame() callback must be a function"),ke.push(Lt);function rr(){var mr=ES(ke,Lt);D(mr>=0,"cannot cancel a frame twice");function yn(){var qa=ES(ke,yn);ke[qa]=ke[ke.length-1],ke.length-=1,ke.length<=0&&Er()}ke[mr]=yn}return Qt(),{cancel:rr}}function Gn(){var Lt=tt.viewport,rr=tt.scissor_box;Lt[0]=Lt[1]=rr[0]=rr[1]=0,Be.viewportWidth=Be.framebufferWidth=Be.drawingBufferWidth=Lt[2]=rr[2]=j.drawingBufferWidth,Be.viewportHeight=Be.framebufferHeight=Be.drawingBufferHeight=Lt[3]=rr[3]=j.drawingBufferHeight}function Zn(){Be.tick+=1,Be.time=qt(),Gn(),Tt.procs.poll()}function gn(){Qe.refresh(),Gn(),Tt.procs.refresh(),je&&je.update()}function qt(){return(qn()-Ge)/1e3}gn();function Qn(Lt,rr){D.type(rr,"function","listener callback must be a function");var mr;switch(Lt){case"frame":return kn(rr);case"lost":mr=Ut;break;case"restore":mr=Ht;break;case"destroy":mr=mt;break;default:D.raise("invalid event, must be one of frame,lost,restore,destroy")}return mr.push(rr),{cancel:function(){for(var yn=0;yn<mr.length;++yn)if(mr[yn]===rr){mr[yn]=mr[mr.length-1],mr.pop();return}}}}var Or=n(Cn,{clear:Mn,prop:vr.define.bind(null,SS),context:vr.define.bind(null,bU),this:vr.define.bind(null,wU),draw:Cn({}),buffer:function(Lt){return Ve.create(Lt,mU,!1,!1)},elements:function(Lt){return ot.create(Lt,!1)},texture:Qe.create2D,cube:Qe.createCube,renderbuffer:Ne.create,framebuffer:Je.create,framebufferCube:Je.createCube,vao:it.createVAO,attributes:pe,frame:kn,on:Qn,limits:we,hasExtension:function(Lt){return we.extensions.indexOf(Lt.toLowerCase())>=0},read:$t,destroy:ir,_gl:j,_refresh:gn,poll:function(){Zn(),je&&je.update()},now:qt,stats:Re});return O.onDone(null,Or),Or}return xU})})(LP);var Kae=LP.exports,Zae=function(){function r(e,t){Ct(this,r),this.attribute=void 0,this.buffer=void 0;var n=t.buffer,i=t.offset,a=t.stride,o=t.normalized,s=t.size,u=t.divisor;this.buffer=n,this.attribute={buffer:n.get(),offset:i||0,stride:a||0,normalized:o||!1,divisor:u||0},s&&(this.attribute.size=s)}return Gt(r,[{key:"get",value:function(){return this.attribute}},{key:"updateBuffer",value:function(t){this.buffer.subData(t)}},{key:"destroy",value:function(){this.buffer.destroy()}}]),r}(),rs,Kh,ns,ya,Zh,qs,Qh,oy,bo,ol,pi,wo,xo,sy,Qae=(rs={},Ie(rs,le.POINTS,"points"),Ie(rs,le.LINES,"lines"),Ie(rs,le.LINE_LOOP,"line loop"),Ie(rs,le.LINE_STRIP,"line strip"),Ie(rs,le.TRIANGLES,"triangles"),Ie(rs,le.TRIANGLE_FAN,"triangle fan"),Ie(rs,le.TRIANGLE_STRIP,"triangle strip"),rs),NP=(Kh={},Ie(Kh,le.STATIC_DRAW,"static"),Ie(Kh,le.DYNAMIC_DRAW,"dynamic"),Ie(Kh,le.STREAM_DRAW,"stream"),Kh),ex=(ns={},Ie(ns,le.BYTE,"int8"),Ie(ns,le.UNSIGNED_INT,"int16"),Ie(ns,le.INT,"int32"),Ie(ns,le.UNSIGNED_BYTE,"uint8"),Ie(ns,le.UNSIGNED_SHORT,"uint16"),Ie(ns,le.UNSIGNED_INT,"uint32"),Ie(ns,le.FLOAT,"float"),ns),Jae=(ya={},Ie(ya,le.ALPHA,"alpha"),Ie(ya,le.LUMINANCE,"luminance"),Ie(ya,le.LUMINANCE_ALPHA,"luminance alpha"),Ie(ya,le.RGB,"rgb"),Ie(ya,le.RGBA,"rgba"),Ie(ya,le.RGBA4,"rgba4"),Ie(ya,le.RGB5_A1,"rgb5 a1"),Ie(ya,le.RGB565,"rgb565"),Ie(ya,le.DEPTH_COMPONENT,"depth"),Ie(ya,le.DEPTH_STENCIL,"depth stencil"),ya),eoe=(Zh={},Ie(Zh,le.DONT_CARE,"dont care"),Ie(Zh,le.NICEST,"nice"),Ie(Zh,le.FASTEST,"fast"),Zh),OP=(qs={},Ie(qs,le.NEAREST,"nearest"),Ie(qs,le.LINEAR,"linear"),Ie(qs,le.LINEAR_MIPMAP_LINEAR,"mipmap"),Ie(qs,le.NEAREST_MIPMAP_LINEAR,"nearest mipmap linear"),Ie(qs,le.LINEAR_MIPMAP_NEAREST,"linear mipmap nearest"),Ie(qs,le.NEAREST_MIPMAP_NEAREST,"nearest mipmap nearest"),qs),PP=(Qh={},Ie(Qh,le.REPEAT,"repeat"),Ie(Qh,le.CLAMP_TO_EDGE,"clamp"),Ie(Qh,le.MIRRORED_REPEAT,"mirror"),Qh),toe=(oy={},Ie(oy,le.NONE,"none"),Ie(oy,le.BROWSER_DEFAULT_WEBGL,"browser"),oy),roe=(bo={},Ie(bo,le.NEVER,"never"),Ie(bo,le.ALWAYS,"always"),Ie(bo,le.LESS,"less"),Ie(bo,le.LEQUAL,"lequal"),Ie(bo,le.GREATER,"greater"),Ie(bo,le.GEQUAL,"gequal"),Ie(bo,le.EQUAL,"equal"),Ie(bo,le.NOTEQUAL,"notequal"),bo),RP=(ol={},Ie(ol,le.FUNC_ADD,"add"),Ie(ol,le.MIN_EXT,"min"),Ie(ol,le.MAX_EXT,"max"),Ie(ol,le.FUNC_SUBTRACT,"subtract"),Ie(ol,le.FUNC_REVERSE_SUBTRACT,"reverse subtract"),ol),uy=(pi={},Ie(pi,le.ZERO,"zero"),Ie(pi,le.ONE,"one"),Ie(pi,le.SRC_COLOR,"src color"),Ie(pi,le.ONE_MINUS_SRC_COLOR,"one minus src color"),Ie(pi,le.SRC_ALPHA,"src alpha"),Ie(pi,le.ONE_MINUS_SRC_ALPHA,"one minus src alpha"),Ie(pi,le.DST_COLOR,"dst color"),Ie(pi,le.ONE_MINUS_DST_COLOR,"one minus dst color"),Ie(pi,le.DST_ALPHA,"dst alpha"),Ie(pi,le.ONE_MINUS_DST_ALPHA,"one minus dst alpha"),Ie(pi,le.CONSTANT_COLOR,"constant color"),Ie(pi,le.ONE_MINUS_CONSTANT_COLOR,"one minus constant color"),Ie(pi,le.CONSTANT_ALPHA,"constant alpha"),Ie(pi,le.ONE_MINUS_CONSTANT_ALPHA,"one minus constant alpha"),Ie(pi,le.SRC_ALPHA_SATURATE,"src alpha saturate"),pi),noe=(wo={},Ie(wo,le.NEVER,"never"),Ie(wo,le.ALWAYS,"always"),Ie(wo,le.LESS,"less"),Ie(wo,le.LEQUAL,"lequal"),Ie(wo,le.GREATER,"greater"),Ie(wo,le.GEQUAL,"gequal"),Ie(wo,le.EQUAL,"equal"),Ie(wo,le.NOTEQUAL,"notequal"),wo),Ic=(xo={},Ie(xo,le.ZERO,"zero"),Ie(xo,le.KEEP,"keep"),Ie(xo,le.REPLACE,"replace"),Ie(xo,le.INVERT,"invert"),Ie(xo,le.INCR,"increment"),Ie(xo,le.DECR,"decrement"),Ie(xo,le.INCR_WRAP,"increment wrap"),Ie(xo,le.DECR_WRAP,"decrement wrap"),xo),ioe=(sy={},Ie(sy,le.FRONT,"front"),Ie(sy,le.BACK,"back"),sy),aoe=function(){function r(e,t){Ct(this,r),this.buffer=void 0;var n=t.data,i=t.usage,a=t.type;this.buffer=e.buffer({data:n,usage:NP[i||le.STATIC_DRAW],type:ex[a||le.UNSIGNED_BYTE]})}return Gt(r,[{key:"get",value:function(){return this.buffer}},{key:"destroy",value:function(){}},{key:"subData",value:function(t){var n=t.data,i=t.offset;this.buffer.subdata(n,i)}}]),r}();function ooe(r){if(Array.isArray(r))return Lw(r)}function soe(r){if(typeof Symbol!="undefined"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function uoe(){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 Dn(r){return ooe(r)||soe(r)||qD(r)||uoe()}var loe=9007199254740991,coe="[object Arguments]",foe="[object Array]",hoe="[object Boolean]",doe="[object Date]",voe="[object Error]",poe="[object Function]",goe="[object Map]",yoe="[object Number]",moe="[object Object]",boe="[object RegExp]",woe="[object Set]",xoe="[object String]",_oe="[object WeakMap]",Soe="[object ArrayBuffer]",Eoe="[object DataView]",Aoe="[object Float32Array]",Toe="[object Float64Array]",Ioe="[object Int8Array]",Coe="[object Int16Array]",Moe="[object Int32Array]",koe="[object Uint8Array]",Doe="[object Uint8ClampedArray]",Loe="[object Uint16Array]",Noe="[object Uint32Array]",ln={};ln[Aoe]=ln[Toe]=ln[Ioe]=ln[Coe]=ln[Moe]=ln[koe]=ln[Doe]=ln[Loe]=ln[Noe]=!0;ln[coe]=ln[foe]=ln[Soe]=ln[hoe]=ln[Eoe]=ln[doe]=ln[voe]=ln[poe]=ln[goe]=ln[yoe]=ln[moe]=ln[boe]=ln[woe]=ln[xoe]=ln[_oe]=!1;var Ooe=Object.prototype,Poe=Ooe.toString;function Roe(r){return Foe(r)&&Boe(r.length)&&!!ln[Poe.call(r)]}function Boe(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=loe}function Foe(r){return!!r&&mo(r)==="object"}var tx=Roe;function BP(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function FP(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?BP(Object(t),!0).forEach(function(n){Ie(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):BP(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}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;
}`,UP=0,Goe=function(){function r(e,t){var n=this;Ct(this,r),this.reGl=e,this.context=t,this.entity=go(),this.texFBO=void 0,this.computeCommand=void 0,this.textureCache={},this.outputTextureName=void 0,this.swapOutputTextureName=void 0,this.compiledPingpong=void 0,this.dynamicPingpong=void 0;var i={};this.context.uniforms.forEach(function(l){var c=l.name,f=l.type,d=l.data,h=l.isReferer,v=l.storageClass;if(v===Ws.StorageBuffer){if(h)n.textureCache[c]={data:void 0},i["".concat(c,"Size")]=function(){return d.compiledBundle.context.output.textureSize};else{n.textureCache[c]=n.calcDataTexture(c,f,d);var p=n.textureCache[c],g=p.textureWidth,y=p.isOutput;i["".concat(c,"Size")]=[g,g],y&&(n.outputTextureName=c,n.context.needPingpong&&(n.outputTextureName="".concat(c,"Output"),n.textureCache[n.outputTextureName]=n.calcDataTexture(c,f,d)))}i[c]=function(){return n.textureCache[c].texture}}else if(v===Ws.Uniform){if(d&&(Array.isArray(d)||tx(d))&&d.length>16)throw new Error("invalid data type ".concat(f));i[c]=function(){return l.data}}});var a=this.getOuputDataTexture(),o=a.textureWidth,s=a.texelCount;i.u_OutputTextureSize=[o,o],i.u_OutputTexelCount=s,this.context.output.textureSize=[o,o];var u={attributes:{a_Position:[[-1,1,0],[-1,-1,0],[1,1,0],[1,-1,0]],a_TexCoord:[[0,1],[0,0],[1,1],[1,0]]},frag:`#ifdef GL_FRAGMENT_PRECISION_HIGH
  precision highp float;
#else
  precision mediump float;
#endif
`.concat(this.context.shader),uniforms:i,vert:Uoe,primitive:"triangle strip",count:4};this.computeCommand=this.reGl(u)}return Gt(r,[{key:"run",value:function(){var t=this;this.context.maxIteration>1&&this.context.needPingpong&&(this.compiledPingpong=!0),(this.compiledPingpong||this.dynamicPingpong)&&this.swap(),this.texFBO=this.reGl.framebuffer({color:this.getOuputDataTexture().texture}),this.texFBO.use(function(){t.computeCommand()})}},{key:"readData",value:function(){var e=Rr(_t.mark(function n(){var i=this,a,o,s,u,l,c,f,d;return _t.wrap(function(v){for(;;)switch(v.prev=v.next){case 0:if(this.reGl({framebuffer:this.texFBO})(function(){a=i.reGl.read()}),!a){v.next=6;break}if(o=this.getOuputDataTexture(),s=o.originalDataLength,u=o.elementsPerTexel,l=o.typedArrayConstructor,c=l===void 0?Float32Array:l,f=[],u!==4)for(d=0;d<a.length;d+=4)u===1?f.push(a[d]):u===2?f.push(a[d],a[d+1]):f.push(a[d],a[d+1],a[d+2]);else f=a;return v.abrupt("return",new c(f.slice(0,s)));case 6:return v.abrupt("return",new Float32Array);case 7:case"end":return v.stop()}},n,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:"confirmInput",value:function(t,n){var i;this.entity===t.entity?(this.dynamicPingpong=!0,i=this):i=t,this.textureCache[n].id=i.getOuputDataTexture().id,this.textureCache[n].texture=i.getOuputDataTexture().texture}},{key:"updateUniform",value:function(){}},{key:"updateBuffer",value:function(t,n){var i=this.context.uniforms.find(function(u){var l=u.name;return l===t});if(i){var a=this.calcDataTexture(t,i.type,n),o=a.texture,s=a.data;this.textureCache[t].data=s,this.textureCache[t].texture=o}}},{key:"destroy",value:function(){}},{key:"swap",value:function(){if(this.swapOutputTextureName||this.createSwapOutputDataTexture(),this.compiledPingpong){var t=this.context.output.name;this.textureCache[t].id=this.getOuputDataTexture().id,this.textureCache[t].texture=this.getOuputDataTexture().texture}var n=this.outputTextureName;this.outputTextureName=this.swapOutputTextureName,this.swapOutputTextureName=n}},{key:"getOuputDataTexture",value:function(){return this.textureCache[this.outputTextureName]}},{key:"createSwapOutputDataTexture",value:function(){var t=this.cloneDataTexture(this.getOuputDataTexture());this.swapOutputTextureName="".concat(this.entity,"-swap"),this.textureCache[this.swapOutputTextureName]=t}},{key:"cloneDataTexture",value:function(t){var n=t.data,i=t.textureWidth;return FP(FP({},t),{},{id:UP++,texture:this.reGl.texture({width:i,height:i,data:n,type:"float"})})}},{key:"calcDataTexture",value:function(t,n,i){var a=1;n===nl.Vector4FloatArray&&(a=4);for(var o=[],s=0;s<i.length;s+=a)a===1?o.push(i[s],0,0,0):a===2?o.push(i[s],i[s+1],0,0):a===3?o.push(i[s],i[s+1],i[s+2],0):a===4&&o.push(i[s],i[s+1],i[s+2],i[s+3]);var u=i.length,l=Math.ceil(u/a),c=Math.ceil(Math.sqrt(l)),f=c*c;l<f&&o.push.apply(o,Dn(new Array((f-l)*4).fill(0)));var d=this.reGl.texture({width:c,height:c,data:o,type:"float"});return{id:UP++,data:o,originalDataLength:u,typedArrayConstructor:tx(i)?i.constructor:void 0,textureWidth:c,texture:d,texelCount:l,elementsPerTexel:a,isOutput:t===this.context.output.name}}}]),r}(),zoe=function(){function r(e,t){Ct(this,r),this.elements=void 0;var n=t.data,i=t.usage,a=t.type,o=t.count;this.elements=e.elements({data:n,usage:NP[i||le.STATIC_DRAW],type:ex[a||le.UNSIGNED_BYTE],count:o})}return Gt(r,[{key:"get",value:function(){return this.elements}},{key:"subData",value:function(t){var n=t.data;this.elements.subdata(n)}},{key:"destroy",value:function(){this.elements.destroy()}}]),r}(),$oe=function(){function r(e,t){Ct(this,r),this.framebuffer=void 0;var n=t.width,i=t.height,a=t.color,o=t.colors;t.depth,t.stencil;var s={width:n,height:i};Array.isArray(o)&&(s.colors=o.map(function(u){return u.get()})),a&&typeof a!="boolean"&&(s.color=a.get()),this.framebuffer=e.framebuffer(s)}return Gt(r,[{key:"get",value:function(){return this.framebuffer}},{key:"destroy",value:function(){this.framebuffer.destroy()}},{key:"resize",value:function(t){var n=t.width,i=t.height;this.framebuffer.resize(n,i)}}]),r}();function Voe(r){var e=mo(r);return r!=null&&(e==="object"||e==="function")}function Jh(r){var e={};return Object.keys(r).forEach(function(t){rx(t,r[t],e,"")}),e}function rx(r,e,t,n){if(e===null||typeof e=="number"||typeof e=="boolean"||Array.isArray(e)&&typeof e[0]=="number"||tx(e)||e===""||e.resize!==void 0){t["".concat(n&&n+".").concat(r)]=e;return}Voe(e)&&Object.keys(e).forEach(function(i){rx(i,e[i],t,"".concat(n&&n+".").concat(r))}),Array.isArray(e)&&e.forEach(function(i,a){Object.keys(i).forEach(function(o){rx(o,i[o],t,"".concat(n&&n+".").concat(r,"[").concat(a,"]"))})})}function GP(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Cc(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?GP(Object(t),!0).forEach(function(n){Ie(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):GP(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var joe=function(){function r(e,t){Ct(this,r),this.reGl=void 0,this.drawCommand=void 0,this.uniforms={},this.reGl=e;var n=t.vs,i=t.fs,a=t.defines,o=t.attributes,s=t.uniforms,u=t.primitive,l=t.count,c=t.elements,f=t.depth,d=t.blend,h=t.stencil,v=t.cull,p=t.instances,g=t.scissor,y=t.viewport,m={};s&&(this.uniforms=Jh(s),Object.keys(s).forEach(function(_){m[_]=e.prop(_)}));var b={};Object.keys(o).forEach(function(_){b[_]=o[_].get()});var w=a&&this.generateDefines(a)||"",x={attributes:b,frag:`#ifdef GL_FRAGMENT_PRECISION_HIGH
  precision highp float;
#else
  precision mediump float;
#endif
`.concat(w,`
`).concat(i),uniforms:m,vert:`
`.concat(w,`
`).concat(n),primitive:Qae[u===void 0?le.TRIANGLES:u]};p&&(x.instances=p),l&&(x.count=l),c&&(x.elements=c.get()),g&&(x.scissor=g),y&&(x.viewport=y),this.initDepthDrawParams({depth:f},x),this.initBlendDrawParams({blend:d},x),this.initStencilDrawParams({stencil:h},x),this.initCullDrawParams({cull:v},x),this.drawCommand=e(x)}return Gt(r,[{key:"addUniforms",value:function(t){this.uniforms=Cc(Cc({},this.uniforms),Jh(t))}},{key:"draw",value:function(t){var n=Cc(Cc({},this.uniforms),Jh(t.uniforms||{})),i={};Object.keys(n).forEach(function(a){var o=mo(n[a]);o==="boolean"||o==="number"||Array.isArray(n[a])||n[a].BYTES_PER_ELEMENT?i[a]=n[a]:o==="string"||(i[a]=n[a].get())}),this.drawCommand(i)}},{key:"destroy",value:function(){}},{key:"initDepthDrawParams",value:function(t,n){var i=t.depth;i&&(n.depth={enable:i.enable===void 0?!0:!!i.enable,mask:i.mask===void 0?!0:!!i.mask,func:roe[i.func||le.LESS],range:i.range||[0,1]})}},{key:"initBlendDrawParams",value:function(t,n){var i=t.blend;if(i){var a=i.enable,o=i.func,s=i.equation,u=i.color,l=u===void 0?[0,0,0,0]:u;n.blend={enable:!!a,func:{srcRGB:uy[o&&o.srcRGB||le.SRC_ALPHA],srcAlpha:uy[o&&o.srcAlpha||le.SRC_ALPHA],dstRGB:uy[o&&o.dstRGB||le.ONE_MINUS_SRC_ALPHA],dstAlpha:uy[o&&o.dstAlpha||le.ONE_MINUS_SRC_ALPHA]},equation:{rgb:RP[s&&s.rgb||le.FUNC_ADD],alpha:RP[s&&s.alpha||le.FUNC_ADD]},color:l}}}},{key:"initStencilDrawParams",value:function(t,n){var i=t.stencil;if(i){var a=i.enable,o=i.mask,s=o===void 0?-1:o,u=i.func,l=u===void 0?{cmp:le.ALWAYS,ref:0,mask:-1}:u,c=i.opFront,f=c===void 0?{fail:le.KEEP,zfail:le.KEEP,zpass:le.KEEP}:c,d=i.opBack,h=d===void 0?{fail:le.KEEP,zfail:le.KEEP,zpass:le.KEEP}:d;n.stencil={enable:!!a,mask:s,func:Cc(Cc({},l),{},{cmp:noe[l.cmp]}),opFront:{fail:Ic[f.fail],zfail:Ic[f.zfail],zpass:Ic[f.zpass]},opBack:{fail:Ic[h.fail],zfail:Ic[h.zfail],zpass:Ic[h.zpass]}}}}},{key:"initCullDrawParams",value:function(t,n){var i=t.cull;if(i){var a=i.enable,o=i.face,s=o===void 0?le.BACK:o;n.cull={enable:!!a,face:ioe[s]}}}},{key:"generateDefines",value:function(t){return Object.keys(t).map(function(n){return"#define ".concat(n," ").concat(Number(t[n]))}).join(`
`)}}]),r}(),Woe=function(){function r(e,t){Ct(this,r),this.texture=void 0,this.width=void 0,this.height=void 0;var n=t.data,i=t.type,a=i===void 0?le.UNSIGNED_BYTE:i,o=t.width,s=t.height,u=t.flipY,l=u===void 0?!1:u,c=t.format,f=c===void 0?le.RGBA:c,d=t.mipmap,h=d===void 0?!1:d,v=t.wrapS,p=v===void 0?le.CLAMP_TO_EDGE:v,g=t.wrapT,y=g===void 0?le.CLAMP_TO_EDGE:g,m=t.aniso,b=m===void 0?0:m,w=t.alignment,x=w===void 0?1:w,_=t.premultiplyAlpha,A=_===void 0?!1:_,I=t.mag,M=I===void 0?le.NEAREST:I,S=t.min,C=S===void 0?le.NEAREST:S,T=t.colorSpace,k=T===void 0?le.BROWSER_DEFAULT_WEBGL:T;this.width=o,this.height=s;var L={width:o,height:s,type:ex[a],format:Jae[f],wrapS:PP[p],wrapT:PP[y],mag:OP[M],min:OP[C],alignment:x,flipY:l,colorSpace:toe[k],premultiplyAlpha:A,aniso:b};n&&(L.data=n),typeof h=="number"?L.mipmap=eoe[h]:typeof h=="boolean"&&(L.mipmap=h),this.texture=e.texture(L)}return Gt(r,[{key:"get",value:function(){return this.texture}},{key:"update",value:function(){this.texture._texture.bind()}},{key:"resize",value:function(t){var n=t.width,i=t.height;this.texture.resize(n,i),this.width=n,this.height=i}},{key:"destroy",value:function(){this.texture.destroy()}}]),r}(),zP,$P,VP,Xoe=(zP=Gr(),zP($P=(VP=function(){function r(){var e=this;Ct(this,r),this.supportWebGPU=!1,this.useWGSL=!1,this.$canvas=void 0,this.gl=void 0,this.inited=void 0,this.createModel=function(){var t=Rr(_t.mark(function n(i){return _t.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(!i.uniforms){o.next=3;break}return o.next=3,Promise.all(Object.keys(i.uniforms).map(function(){var s=Rr(_t.mark(function u(l){var c;return _t.wrap(function(d){for(;;)switch(d.prev=d.next){case 0:if(!(i.uniforms[l]&&i.uniforms[l].load!==void 0)){d.next=5;break}return d.next=3,i.uniforms[l].load();case 3:c=d.sent,i.uniforms[l]=c;case 5:case"end":return d.stop()}},u)}));return function(u){return s.apply(this,arguments)}}()));case 3:return o.abrupt("return",new joe(e.gl,i));case 4:case"end":return o.stop()}},n)}));return function(n){return t.apply(this,arguments)}}(),this.createAttribute=function(t){return new Zae(e.gl,t)},this.createBuffer=function(t){return new aoe(e.gl,t)},this.createElements=function(t){return new zoe(e.gl,t)},this.createTexture2D=function(t){return new Woe(e.gl,t)},this.createFramebuffer=function(t){return new $oe(e.gl,t)},this.useFramebuffer=function(t,n){e.gl({framebuffer:t?t.get():null})(n)},this.createComputeModel=function(){var t=Rr(_t.mark(function n(i){return _t.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.abrupt("return",new Goe(e.gl,i));case 1:case"end":return o.stop()}},n)}));return function(n){return t.apply(this,arguments)}}(),this.clear=function(t){var n=t.color,i=t.depth,a=t.stencil,o=t.framebuffer,s=o===void 0?null:o,u={color:n,depth:i,stencil:a};u.framebuffer=s===null?s:s.get(),e.gl.clear(u)},this.setScissor=function(t){e.gl&&e.gl._gl&&(t.enable&&t.box?(e.gl._gl.enable(le.SCISSOR_TEST),e.gl._gl.scissor(t.box.x,t.box.y,t.box.width,t.box.height)):e.gl._gl.disable(le.SCISSOR_TEST),e.gl._refresh())},this.viewport=function(t){var n=t.x,i=t.y,a=t.width,o=t.height;e.gl&&e.gl._gl&&(e.gl._gl.viewport(n,i,a,o),e.gl._refresh())},this.readPixels=function(t){var n=t.framebuffer,i=t.x,a=t.y,o=t.width,s=t.height,u={x:i,y:a,width:o,height:s};return n&&(u.framebuffer=n.get()),e.gl.read(u)},this.getCanvas=function(){return e.$canvas},this.getGLContext=function(){return e.gl._gl},this.destroy=function(){e.gl&&(e.gl.destroy(),e.inited=!1)}}return Gt(r,[{key:"init",value:function(){var e=Rr(_t.mark(function n(i){return _t.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(!this.inited){o.next=2;break}return o.abrupt("return");case 2:return this.$canvas=i.canvas,o.next=5,new Promise(function(s,u){Kae({canvas:i.canvas,attributes:{alpha:!0,antialias:i.antialias,premultipliedAlpha:!0},pixelRatio:1,extensions:["OES_element_index_uint","OES_texture_float","OES_standard_derivatives","angle_instanced_arrays"],optionalExtensions:["EXT_texture_filter_anisotropic","EXT_blend_minmax","WEBGL_depth_texture"],profile:!0,onDone:function(c,f){(c||!f)&&u(c),s(f)}})});case 5:this.gl=o.sent,this.inited=!0;case 7:case"end":return o.stop()}},n,this)}));function t(n){return e.apply(this,arguments)}return t}()},{key:"isFloatSupported",value:function(){return this.gl.limits.readFloat}},{key:"beginFrame",value:function(){}},{key:"endFrame",value:function(){}}]),r}(),VP))||$P);function Yoe(){return typeof window!="undefined"}function Hoe(r,e,t,n){if(!!Yoe()){var i=document.getElementsByTagName("head")[0],a=document.createElement("script");a.setAttribute("type","text/javascript"),a.setAttribute("src",r),n&&(a.id=n),a.onload=function(){e&&e()},a.onerror=function(o){t&&t("Unable to load script '".concat(r,"'"),o)},i.appendChild(a)}}function qoe(r,e){return new Promise(function(t,n){Hoe(r,function(){t()},function(i,a){n(a)})})}var ly;function Koe(){return nx.apply(this,arguments)}function nx(){return nx=Rr(_t.mark(function r(){return _t.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!ly){t.next=2;break}return t.abrupt("return",ly);case 2:return t.next=4,qoe("https://preview.babylonjs.com/glslang/glslang.js");case 4:return ly=window.glslang("https://preview.babylonjs.com/glslang/glslang.wasm"),t.abrupt("return",ly);case 6:case"end":return t.stop()}},r)})),nx.apply(this,arguments)}var Zoe=function(){function r(e,t){Ct(this,r),this.engine=e,this.options=t,this.attribute=void 0,this.buffer=void 0;var n=t,i=n.buffer,a=n.offset,o=n.stride,s=n.normalized,u=n.size,l=n.divisor,c=n.arrayStride,f=n.attributes,d=n.stepMode;this.buffer=i,this.attribute={buffer:i.get(),offset:a||0,stride:o||0,normalized:s||!1,divisor:l||0,arrayStride:c||0,attributes:f,stepMode:d||"vertex"},u&&(this.attribute.size=u)}return Gt(r,[{key:"get",value:function(){return this.attribute}},{key:"updateBuffer",value:function(t){this.buffer.subData(t)}},{key:"destroy",value:function(){this.buffer.destroy()}}]),r}(),Mc=function(){function r(e,t){Ct(this,r),this.engine=e,this.options=t,this.buffer=void 0;var n=t,i=n.data,a=n.usage;n.type,this.buffer=this.createBuffer(i instanceof Array?new Float32Array(i):i,a||rt.BufferUsage.Vertex|rt.BufferUsage.CopyDst)}return Gt(r,[{key:"get",value:function(){return this.buffer}},{key:"destroy",value:function(){this.buffer.destroy()}},{key:"subData",value:function(t){var n=t.data,i=t.offset;this.setSubData(this.buffer,i,n instanceof Array?new Float32Array(n):n)}},{key:"createBuffer",value:function(t,n){var i=t.byteLength%4,a={size:t.byteLength+i,usage:n},o=this.engine.device.createBuffer(a);return this.setSubData(o,0,t),o}},{key:"setSubData",value:function(t,n,i){var a=$i?this.engine.device.getQueue():this.engine.device.defaultQueue;a.writeBuffer(t,n,i)}}]),r}();function Qoe(r){return typeof r=="number"}var Joe=function(){function r(e,t){Ct(this,r),this.engine=e,this.context=t,this.entity=go(),this.uniformGPUBufferLayout=[],this.uniformBuffer=void 0,this.vertexBuffers={},this.outputBuffer=void 0,this.bindGroupEntries=void 0,this.bindGroup=void 0,this.computePipeline=void 0}return Gt(r,[{key:"init",value:function(){var e=Rr(_t.mark(function n(){var i=this,a,o,s,u,l,c,f;return _t.wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return h.next=2,this.compileComputePipelineStageDescriptor(this.context.shader);case 2:a=h.sent,o=a.computeStage,s=this.context.uniforms.filter(function(v){return v.storageClass===Ws.StorageBuffer}),u=this.context.uniforms.filter(function(v){return v.storageClass===Ws.Uniform}),l=u.length?1:0,this.bindGroupEntries=[],l&&(c=0,f=[],u.forEach(function(v){if(Qoe(v.data))i.uniformGPUBufferLayout.push({name:v.name,offset:c}),c+=4,f.push(v.data);else{var p,g=((p=v.data)===null||p===void 0?void 0:p.length)||1;g===3&&(g=4,v.data.push(0));var y=c/4%4;if(y>0){var m=4-y;if(g>1&&g<=m)g===2&&(m===3&&(c+=4,f.push(0)),f.push.apply(f,Dn(v.data)),i.uniformGPUBufferLayout.push({name:v.name,offset:c}));else{for(var b=0;b<m;b++)c+=4,f.push(0);f.push.apply(f,Dn(v.data)),i.uniformGPUBufferLayout.push({name:v.name,offset:c})}}c+=4*g}}),this.uniformBuffer=new Mc(this.engine,{data:f instanceof Array?new Float32Array(f):f,usage:rt.BufferUsage.Uniform|rt.BufferUsage.CopyDst}),this.bindGroupEntries.push({binding:0,resource:{buffer:this.uniformBuffer.get()}})),s.forEach(function(v){if(v.data!==null&&(v.type===nl.Vector4FloatArray||v.type===nl.FloatArray)){var p;v.name===i.context.output.name?(p=new Mc(i.engine,{data:isFinite(Number(v.data))?[v.data]:v.data,usage:rt.BufferUsage.Storage|rt.BufferUsage.CopyDst|rt.BufferUsage.CopySrc}),i.outputBuffer=p,i.context.output={name:v.name,length:isFinite(Number(v.data))?1:v.data.length,typedArrayConstructor:Float32Array,gpuBuffer:p.get()}):v.isReferer?v.data.model&&v.data.model.outputBuffer&&(p=v.data.model.outputBuffer):p=new Mc(i.engine,{data:isFinite(Number(v.data))?[v.data]:v.data,usage:rt.BufferUsage.Storage|rt.BufferUsage.CopyDst|rt.BufferUsage.CopySrc}),i.vertexBuffers[v.name]=p,i.bindGroupEntries.push({binding:l,resource:{name:v.name,refer:p?void 0:v.data,buffer:p?p.get():void 0}}),l++}}),this.computePipeline=this.engine.device.createComputePipeline({computeStage:o}),console.log(this.bindGroupEntries),this.bindGroup=this.engine.device.createBindGroup({layout:this.computePipeline.getBindGroupLayout(0),entries:this.bindGroupEntries});case 13:case"end":return h.stop()}},n,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:"destroy",value:function(){var t=this;this.uniformBuffer&&this.uniformBuffer.destroy(),Object.keys(this.vertexBuffers).forEach(function(n){return t.vertexBuffers[n].destroy()})}},{key:"readData",value:function(){var e=Rr(_t.mark(function n(){var i,a,o,s,u,l,c,f,d,h;return _t.wrap(function(p){for(;;)switch(p.prev=p.next){case 0:if(i=this.context.output,!i){p.next=16;break}if(a=i.length,o=i.typedArrayConstructor,s=i.gpuBuffer,!s){p.next=16;break}return u=a*o.BYTES_PER_ELEMENT,l=this.engine.device.createBuffer({size:u,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ}),c=this.engine.device.createCommandEncoder(),c.copyBufferToBuffer(s,0,l,0,u),f=$i?this.engine.device.getQueue():this.engine.device.defaultQueue,f.submit([c.finish()]),p.next=12,l.mapAsync(rt.MapMode.Read);case 12:return d=l.getMappedRange(),h=new o(d.slice(0)),l.unmap(),p.abrupt("return",h);case 16:return p.abrupt("return",new Float32Array);case 17:case"end":return p.stop()}},n,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:"run",value:function(){if(this.engine.currentComputePass){var t;this.engine.currentComputePass.setPipeline(this.computePipeline),this.engine.currentComputePass.setBindGroup(0,this.bindGroup),(t=this.engine.currentComputePass).dispatch.apply(t,Dn(this.context.dispatch))}}},{key:"updateBuffer",value:function(t,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=this.vertexBuffers[t];a&&a.subData({data:n,offset:i})}},{key:"updateUniform",value:function(t,n){var i=this.uniformGPUBufferLayout.find(function(a){return a.name===t});i&&this.uniformBuffer.subData({data:Number.isFinite(n)?new Float32Array([n]):new Float32Array(n),offset:i.offset})}},{key:"confirmInput",value:function(t,n){var i=this.vertexBuffers[n],a=t.outputBuffer;if(i&&a&&i!==a){var o=this.engine.device.createCommandEncoder(),s=t.context.output,u=s.length,l=s.typedArrayConstructor,c=u*l.BYTES_PER_ELEMENT;o.copyBufferToBuffer(a.get(),0,i.get(),0,c);var f=$i?this.engine.device.getQueue():this.engine.device.defaultQueue;f.submit([o.finish()])}}},{key:"compileShaderToSpirV",value:function(t,n,i){return this.compileRawShaderToSpirV(i+t,n)}},{key:"compileRawShaderToSpirV",value:function(t,n){return this.engine.glslang.compileGLSL(t,n)}},{key:"compileComputePipelineStageDescriptor",value:function(){var e=Rr(_t.mark(function n(i){var a,o;return _t.wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(a=i,o=`#version 450
`,this.engine.options.useWGSL){u.next=6;break}return u.next=5,this.compileShaderToSpirV(i,"compute",o);case 5:a=u.sent;case 6:return u.abrupt("return",{computeStage:{module:this.engine.device.createShaderModule({code:a,isWHLSL:$i}),entryPoint:"main"}});case 7:case"end":return u.stop()}},n,this)}));function t(n){return e.apply(this,arguments)}return t}()}]),r}(),ese=function(){function r(e,t){Ct(this,r),this.engine=e,this.options=t,this.indexCount=void 0,this.buffer=void 0;var n=t,i=n.data;n.usage,n.type;var a=n.count;this.indexCount=a||0,this.buffer=new Mc(e,{data:i instanceof Array?new Uint16Array(i):i,usage:rt.BufferUsage.Index|rt.BufferUsage.CopyDst})}return Gt(r,[{key:"get",value:function(){return this.buffer}},{key:"subData",value:function(t){this.buffer.subData(t)}},{key:"destroy",value:function(){this.buffer.destroy()}}]),r}(),tse=function(){function r(e,t){Ct(this,r),this.engine=e,this.options=t,this.colorTexture=void 0,this.depthTexture=void 0,this.width=0,this.height=0;var n=t;n.width,n.height;var i=n.color;n.colors;var a=n.depth;n.stencil,i&&(this.colorTexture=i),a&&(this.depthTexture=a)}return Gt(r,[{key:"get",value:function(){var t,n;return{color:(t=this.colorTexture)===null||t===void 0?void 0:t.get(),depth:(n=this.depthTexture)===null||n===void 0?void 0:n.get()}}},{key:"destroy",value:function(){var t,n;(t=this.colorTexture)===null||t===void 0||t.destroy(),(n=this.depthTexture)===null||n===void 0||n.destroy()}},{key:"resize",value:function(t){var n=t.width,i=t.height;if(n!==this.width||i!==this.height){var a,o;(a=this.colorTexture)===null||a===void 0||a.resize({width:n,height:i}),(o=this.depthTexture)===null||o===void 0||o.resize({width:n,height:i})}this.width=n,this.height=i}}]),r}(),is,_o,sl,Li,kc,cy,ed,rse=(is={},Ie(is,le.POINTS,rt.PrimitiveTopology.PointList),Ie(is,le.LINES,rt.PrimitiveTopology.LineList),Ie(is,le.LINE_LOOP,rt.PrimitiveTopology.LineList),Ie(is,le.LINE_STRIP,rt.PrimitiveTopology.LineStrip),Ie(is,le.TRIANGLES,rt.PrimitiveTopology.TriangleList),Ie(is,le.TRIANGLE_FAN,rt.PrimitiveTopology.TriangleList),Ie(is,le.TRIANGLE_STRIP,rt.PrimitiveTopology.TriangleStrip),is),nse=(_o={},Ie(_o,le.NEVER,rt.CompareFunction.Never),Ie(_o,le.ALWAYS,rt.CompareFunction.Always),Ie(_o,le.LESS,rt.CompareFunction.Less),Ie(_o,le.LEQUAL,rt.CompareFunction.LessEqual),Ie(_o,le.GREATER,rt.CompareFunction.Greater),Ie(_o,le.GEQUAL,rt.CompareFunction.GreaterEqual),Ie(_o,le.EQUAL,rt.CompareFunction.Equal),Ie(_o,le.NOTEQUAL,rt.CompareFunction.NotEqual),_o),jP=(sl={},Ie(sl,le.FUNC_ADD,rt.BlendOperation.Add),Ie(sl,le.MIN_EXT,rt.BlendOperation.Min),Ie(sl,le.MAX_EXT,rt.BlendOperation.Max),Ie(sl,le.FUNC_SUBTRACT,rt.BlendOperation.Subtract),Ie(sl,le.FUNC_REVERSE_SUBTRACT,rt.BlendOperation.ReverseSubtract),sl),fy=(Li={},Ie(Li,le.ZERO,rt.BlendFactor.Zero),Ie(Li,le.ONE,rt.BlendFactor.One),Ie(Li,le.SRC_COLOR,rt.BlendFactor.SrcColor),Ie(Li,le.ONE_MINUS_SRC_COLOR,rt.BlendFactor.OneMinusSrcColor),Ie(Li,le.SRC_ALPHA,rt.BlendFactor.SrcAlpha),Ie(Li,le.ONE_MINUS_SRC_ALPHA,rt.BlendFactor.OneMinusSrcAlpha),Ie(Li,le.DST_COLOR,rt.BlendFactor.DstColor),Ie(Li,le.ONE_MINUS_DST_COLOR,rt.BlendFactor.OneMinusDstColor),Ie(Li,le.DST_ALPHA,rt.BlendFactor.DstAlpha),Ie(Li,le.ONE_MINUS_DST_ALPHA,rt.BlendFactor.OneMinusDstAlpha),Ie(Li,le.CONSTANT_COLOR,rt.BlendFactor.BlendColor),Ie(Li,le.ONE_MINUS_CONSTANT_COLOR,rt.BlendFactor.OneMinusBlendColor),Ie(Li,le.SRC_ALPHA_SATURATE,rt.BlendFactor.SrcAlphaSaturated),Li),ise=(kc={},Ie(kc,le.ALPHA,"r8unorm"),Ie(kc,le.RGBA,"rgba8unorm"),Ie(kc,le.DEPTH_COMPONENT,"depth32float"),Ie(kc,le.DEPTH_STENCIL,"depth24plus-stencil8"),kc),WP=(cy={},Ie(cy,le.NEAREST,"nearest"),Ie(cy,le.LINEAR,"linear"),cy),ix=(ed={},Ie(ed,le.REPEAT,"repeat"),Ie(ed,le.CLAMP_TO_EDGE,"clamp-to-edge"),Ie(ed,le.MIRRORED_REPEAT,"mirror-repeat"),ed);function ase(r){var e=r.cull;if(!e||!e.enable)return rt.CullMode.None;if(e.face)return e.face===le.FRONT?rt.CullMode.Front:rt.CullMode.Back}function ose(r){var e=r.depth;r.stencil;var t={compare:rt.CompareFunction.Always,depthFailOp:rt.StencilOperation.Keep,failOp:rt.StencilOperation.Keep,passOp:rt.StencilOperation.Keep};return{depthWriteEnabled:e&&e.enable,depthCompare:nse[(e==null?void 0:e.func)||le.ALWAYS],format:rt.TextureFormat.Depth24PlusStencil8,stencilFront:t,stencilBack:t,stencilReadMask:4294967295,stencilWriteMask:4294967295}}function sse(r,e){var t=r.blend;return[{format:e,alphaBlend:{srcFactor:fy[t&&t.func&&t.func.srcAlpha||le.ONE],dstFactor:fy[t&&t.func&&t.func.dstAlpha||le.ZERO],operation:jP[t&&t.equation&&t.equation.alpha||le.FUNC_ADD]},colorBlend:{srcFactor:fy[t&&t.func&&t.func.srcRGB||le.ONE],dstFactor:fy[t&&t.func&&t.func.dstRGB||le.ZERO],operation:jP[t&&t.equation&&t.equation.rgb||le.FUNC_ADD]},writeMask:rt.ColorWrite.All}]}function XP(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Dc(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?XP(Object(t),!0).forEach(function(n){Ie(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):XP(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function use(r){for(var e=0,t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];for(var a=0,o=n;a<o.length;a++){var s=o[a];e+=s.length}for(var u=new r(e),l=0,c=0,f=n;c<f.length;c++){var d=f[c];u.set(d,l),l+=d.length}return u}var lse=function(){function r(e,t){Ct(this,r),this.engine=e,this.options=t,this.pipelineLayout=void 0,this.renderPipeline=void 0,this.uniformsBindGroupLayout=void 0,this.uniformBindGroup=void 0,this.uniformBuffer=void 0,this.uniforms={},this.uniformGPUBufferLayout=[],this.attributeCache={},this.indexBuffer=void 0,this.indexCount=void 0}return Gt(r,[{key:"init",value:function(){var e=Rr(_t.mark(function n(){var i=this,a,o,s,u,l,c,f,d,h,v,p,g,y,m,b,w;return _t.wrap(function(_){for(;;)switch(_.prev=_.next){case 0:return a=this.options,o=a.vs,s=a.fs,u=a.attributes,l=a.uniforms,c=a.primitive,f=a.elements,d=a.depth,h=a.blend,v=a.stencil,p=a.cull,_.next=3,this.compilePipelineStageDescriptor(o,s,null);case 3:g=_.sent,y=g.vertexStage,m=g.fragmentStage,l&&this.buildUniformBindGroup(l),f&&(this.indexBuffer=f.get(),this.indexCount=f.indexCount),b={vertexBuffers:Object.keys(u).map(function(A,I){var M=u[A],S=M.get(),C=S.arrayStride,T=S.stepMode,k=S.attributes;return i.attributeCache[A]=M,{arrayStride:C,stepMode:T,attributes:k}})},w={sampleCount:this.engine.mainPassSampleCount,primitiveTopology:rse[c||le.TRIANGLES],rasterizationState:Dc(Dc({},this.getDefaultRasterizationStateDescriptor()),{},{cullMode:ase({cull:p})}),depthStencilState:ose({depth:d,stencil:v}),colorStates:sse({blend:h},this.engine.options.swapChainFormat),layout:this.pipelineLayout,vertexStage:y,fragmentStage:m,vertexState:b},this.renderPipeline=this.engine.device.createRenderPipeline(w);case 11:case"end":return _.stop()}},n,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:"addUniforms",value:function(t){this.uniforms=Dc(Dc({},this.uniforms),Jh(t))}},{key:"draw",value:function(t){var n=this,i=this.engine.getCurrentRenderPass(),a=Dc(Dc({},this.uniforms),Jh(t.uniforms||{})),o=[];Object.keys(a).forEach(function(s){var u=mo(a[s]);if(u==="boolean"||u==="number"||Array.isArray(a[s])||a[s].BYTES_PER_ELEMENT){var l,c=(l=n.uniformGPUBufferLayout.find(function(y){var m=y.name;return m===s}))===null||l===void 0?void 0:l.offset;c!==null&&n.uniformBuffer.subData({data:a[s],offset:c})}else{var f,d=(f=n.uniformGPUBufferLayout.find(function(y){var m=y.name;return m===s}))===null||f===void 0?void 0:f.offset;if(d!==null){var h=a[s].get(),v=h.color||h,p=v.texture,g=v.sampler;g&&(o.push({binding:d,resource:g}),d++),o.push({binding:d,resource:p.createView()})}}}),this.uniformBuffer&&(o[0]={binding:0,resource:{buffer:this.uniformBuffer.get()}}),this.uniformBindGroup=this.engine.device.createBindGroup({layout:this.uniformsBindGroupLayout,entries:o}),this.renderPipeline&&i.setPipeline(this.renderPipeline),i.setBindGroup(0,this.uniformBindGroup),this.indexBuffer&&i.setIndexBuffer(this.indexBuffer.get(),rt.IndexFormat.Uint32,0),Object.keys(this.attributeCache).forEach(function(s,u){i.setVertexBuffer(0+u,n.attributeCache[s].get().buffer,0)}),this.indexBuffer?i.drawIndexed(this.indexCount,this.options.instances||1,0,0,0):i.draw(this.options.count||0,this.options.instances||0,0,0)}},{key:"destroy",value:function(){throw new Error("Method not implemented.")}},{key:"compilePipelineStageDescriptor",value:function(){var e=Rr(_t.mark(function n(i,a,o){var s,u,l;return _t.wrap(function(f){for(;;)switch(f.prev=f.next){case 0:if(s=`#version 450
`,u=i,l=a,this.engine.options.useWGSL){f.next=10;break}return f.next=6,this.compileShaderToSpirV(i,"vertex",s);case 6:return u=f.sent,f.next=9,this.compileShaderToSpirV(a,"fragment",s);case 9:l=f.sent;case 10:return f.abrupt("return",this.createPipelineStageDescriptor(u,l));case 11:case"end":return f.stop()}},n,this)}));function t(n,i,a){return e.apply(this,arguments)}return t}()},{key:"compileShaderToSpirV",value:function(t,n,i){return this.compileRawShaderToSpirV(i+t,n)}},{key:"compileRawShaderToSpirV",value:function(t,n){return this.engine.glslang.compileGLSL(t,n)}},{key:"createPipelineStageDescriptor",value:function(t,n){return{vertexStage:{module:this.engine.device.createShaderModule({code:t,isWHLSL:$i}),entryPoint:"main"},fragmentStage:{module:this.engine.device.createShaderModule({code:n,isWHLSL:$i}),entryPoint:"main"}}}},{key:"getDefaultRasterizationStateDescriptor",value:function(){return{frontFace:rt.FrontFace.CCW,cullMode:rt.CullMode.None,depthBias:0,depthBiasSlopeScale:0,depthBiasClamp:0}}},{key:"buildUniformBindGroup",value:function(t){var n=this,i=0,a=use.apply(void 0,[Float32Array].concat(Dn(Object.keys(t).map(function(u){return t[u]?(n.uniformGPUBufferLayout.push({name:u,offset:i}),i+=(t[u].length||1)*4,t[u]):[]})))),o=[],s=!1;a.length&&(s=!0,o.push({binding:0,visibility:rt.ShaderStage.Fragment|rt.ShaderStage.Vertex,type:rt.BindingType.UniformBuffer})),Object.keys(t).filter(function(u){return t[u]===null}).forEach(function(u,l){n.uniformGPUBufferLayout.push({name:u,offset:l*2+(s?1:0)}),o.push({binding:l*2+(s?1:0),visibility:rt.ShaderStage.Fragment,type:rt.BindingType.Sampler},{binding:l*2+(s?1:0)+1,visibility:rt.ShaderStage.Fragment,type:rt.BindingType.SampledTexture})}),this.uniformsBindGroupLayout=this.engine.device.createBindGroupLayout({entries:o}),this.pipelineLayout=this.engine.device.createPipelineLayout({bindGroupLayouts:[this.uniformsBindGroupLayout]}),s&&(this.uniformBuffer=new Mc(this.engine,{data:a instanceof Array?new Float32Array(a):a,usage:rt.BufferUsage.Uniform|rt.BufferUsage.CopyDst}))}}]),r}(),cse=function(){function r(e,t){Ct(this,r),this.engine=e,this.options=t,this.texture=void 0,this.sampler=void 0,this.width=void 0,this.height=void 0,this.createTexture()}return Gt(r,[{key:"get",value:function(){return{texture:this.texture,sampler:this.sampler}}},{key:"update",value:function(){}},{key:"resize",value:function(t){var n=t.width,i=t.height;(n!==this.width||i!==this.height)&&(this.destroy(),this.createTexture()),this.width=n,this.height=i}},{key:"destroy",value:function(){this.texture&&this.texture.destroy()}},{key:"createTexture",value:function(){var t=this.options;t.data;var n=t.type;n===void 0&&le.UNSIGNED_BYTE;var i=t.width,a=t.height;t.flipY;var o=t.format,s=o===void 0?le.RGBA:o;t.mipmap;var u=t.wrapS,l=u===void 0?le.CLAMP_TO_EDGE:u,c=t.wrapT,f=c===void 0?le.CLAMP_TO_EDGE:c,d=t.aniso,h=d===void 0?0:d;t.alignment,t.premultiplyAlpha;var v=t.mag,p=v===void 0?le.NEAREST:v,g=t.min,y=g===void 0?le.NEAREST:g,m=t.colorSpace;m===void 0&&le.BROWSER_DEFAULT_WEBGL;var b=t.usage;this.width=i,this.height=a,this.texture=this.engine.device.createTexture({size:[i,a,1],mipLevelCount:1,sampleCount:1,dimension:rt.TextureDimension.E2d,format:ise[s],usage:b||rt.TextureUsage.Sampled|rt.TextureUsage.CopyDst}),(!b||b&rt.TextureUsage.Sampled)&&(this.sampler=this.engine.device.createSampler({addressModeU:ix[l],addressModeV:ix[f],addressModeW:ix[l],magFilter:WP[p],minFilter:WP[y],maxAnisotropy:h}))}}]),r}(),YP,HP,qP,fse=(YP=Gr(),YP(HP=(qP=function(){function r(){var e=this;Ct(this,r),this.supportWebGPU=!0,this.useWGSL=!1,this.options=void 0,this.canvas=void 0,this.context=void 0,this.glslang=void 0,this.adapter=void 0,this.device=void 0,this.swapChain=void 0,this.mainPassSampleCount=void 0,this.mainTexture=void 0,this.depthTexture=void 0,this.mainColorAttachments=void 0,this.mainTextureExtends=void 0,this.mainDepthAttachment=void 0,this.uploadEncoder=void 0,this.renderEncoder=void 0,this.computeEncoder=void 0,this.renderTargetEncoder=void 0,this.commandBuffers=new Array(4).fill(void 0),this.currentRenderPass=null,this.mainRenderPass=null,this.currentRenderTargetViewDescriptor=void 0,this.currentComputePass=null,this.bundleEncoder=void 0,this.tempBuffers=[],this.currentRenderTarget=null,this.uploadEncoderDescriptor={label:"upload"},this.renderEncoderDescriptor={label:"render"},this.renderTargetEncoderDescriptor={label:"renderTarget"},this.computeEncoderDescriptor={label:"compute"},this.pipelines={},this.computePipelines={},this.defaultSampleCount=4,this.clearDepthValue=1,this.clearStencilValue=0,this.transientViewport={x:1/0,y:0,width:0,height:0},this.cachedViewport={x:0,y:0,width:0,height:0},this.clear=function(t){t.framebuffer;var n=t.color,i=t.depth,a=t.stencil;e.options.supportCompute&&e.startComputePass(),e.currentRenderTarget?(e.currentRenderPass&&e.endRenderTargetRenderPass(),e.startRenderTargetRenderPass(e.currentRenderTarget,n||null,!!i,!!a)):(e.mainColorAttachments[0].loadValue=n||rt.LoadOp.Load,e.mainDepthAttachment.depthLoadValue=i||rt.LoadOp.Load,e.mainDepthAttachment.stencilLoadValue=a?e.clearStencilValue:rt.LoadOp.Load,e.mainRenderPass&&e.endMainRenderPass(),e.startMainRenderPass())},this.createModel=function(){var t=Rr(_t.mark(function n(i){var a;return _t.wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return a=new lse(e,i),s.next=3,a.init();case 3:return s.abrupt("return",a);case 4:case"end":return s.stop()}},n)}));return function(n){return t.apply(this,arguments)}}(),this.createAttribute=function(t){return new Zoe(e,t)},this.createBuffer=function(t){return new Mc(e,t)},this.createElements=function(t){return new ese(e,t)},this.createTexture2D=function(t){return new cse(e,t)},this.createFramebuffer=function(t){return new tse(e,t)},this.useFramebuffer=function(t,n){e.currentRenderTarget&&e.unbindFramebuffer(e.currentRenderTarget),e.currentRenderTarget=t,e.currentRenderTargetViewDescriptor={dimension:rt.TextureViewDimension.E2d,arrayLayerCount:1,aspect:rt.TextureAspect.All},e.currentRenderPass=null,n()},this.createComputeModel=function(){var t=Rr(_t.mark(function n(i){var a;return _t.wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return a=new Joe(e,i),s.next=3,a.init();case 3:return s.abrupt("return",a);case 4:case"end":return s.stop()}},n)}));return function(n){return t.apply(this,arguments)}}(),this.getCanvas=function(){return e.canvas},this.getGLContext=function(){throw new Error("Method not implemented.")},this.viewport=function(t){var n=t.x,i=t.y,a=t.width,o=t.height;if(!e.currentRenderPass)e.transientViewport={x:n,y:i,width:a,height:o};else if(e.transientViewport.x!==1/0){var s=e.getCurrentRenderPass();s.setViewport(e.transientViewport.x,e.transientViewport.y,e.transientViewport.width,e.transientViewport.height,0,1)}else if(n!==e.cachedViewport.x||i!==e.cachedViewport.y||a!==e.cachedViewport.width||o!==e.cachedViewport.height){e.cachedViewport={x:n,y:i,width:a,height:o};var u=e.getCurrentRenderPass();u.setViewport(n,i,a,o,0,1)}},this.readPixels=function(t){throw new Error("Method not implemented.")}}return Gt(r,[{key:"isFloatSupported",value:function(){return!0}},{key:"init",value:function(){var e=Rr(_t.mark(function n(i){return _t.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return this.canvas=i.canvas,this.options=i,this.useWGSL=!!i.useWGSL,this.mainPassSampleCount=i.antialiasing?this.defaultSampleCount:1,o.next=6,this.initGlslang();case 6:this.initContextAndSwapChain(),this.initMainAttachments();case 8:case"end":return o.stop()}},n,this)}));function t(n){return e.apply(this,arguments)}return t}()},{key:"setScissor",value:function(t){throw new Error("Method not implemented.")}},{key:"destroy",value:function(){this.mainTexture&&this.mainTexture.destroy(),this.depthTexture&&this.depthTexture.destroy(),this.tempBuffers.forEach(function(t){return t.destroy()}),this.tempBuffers=[]}},{key:"beginFrame",value:function(){this.uploadEncoder=this.device.createCommandEncoder(this.uploadEncoderDescriptor),this.renderEncoder=this.device.createCommandEncoder(this.renderEncoderDescriptor),this.renderTargetEncoder=this.device.createCommandEncoder(this.renderTargetEncoderDescriptor),this.options.supportCompute&&(this.computeEncoder=this.device.createCommandEncoder(this.computeEncoderDescriptor))}},{key:"endFrame",value:function(){this.options.supportCompute&&this.endComputePass(),this.endMainRenderPass(),this.commandBuffers[0]=this.uploadEncoder.finish(),this.commandBuffers[1]=this.renderEncoder.finish(),this.options.supportCompute&&(this.commandBuffers[2]=this.computeEncoder.finish()),this.commandBuffers[3]=this.renderTargetEncoder.finish(),$i?this.device.getQueue().submit(this.commandBuffers.filter(function(t){return t})):this.device.defaultQueue.submit(this.commandBuffers.filter(function(t){return t}))}},{key:"getCurrentRenderPass",value:function(){return this.currentRenderTarget&&!this.currentRenderPass?this.startRenderTargetRenderPass(this.currentRenderTarget,null,!1,!1):this.currentRenderPass||this.startMainRenderPass(),this.currentRenderPass}},{key:"initGlslang",value:function(){var e=Rr(_t.mark(function n(){var i,a;return _t.wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return s.next=2,Koe();case 2:return this.glslang=s.sent,s.next=5,(i=navigator)===null||i===void 0||(a=i.gpu)===null||a===void 0?void 0:a.requestAdapter();case 5:return this.adapter=s.sent,s.next=8,this.adapter.requestDevice();case 8:this.device=s.sent;case 9:case"end":return s.stop()}},n,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:"initContextAndSwapChain",value:function(){this.context=this.canvas.getContext($i?"gpu":"gpupresent"),this.swapChain=this.context.configureSwapChain({device:this.device,format:this.options.swapChainFormat,usage:rt.TextureUsage.OutputAttachment|rt.TextureUsage.CopySrc})}},{key:"initMainAttachments",value:function(){if(this.mainTextureExtends={width:this.canvas.width,height:this.canvas.height,depth:1},this.options.antialiasing){var t={size:this.mainTextureExtends,mipLevelCount:1,sampleCount:this.mainPassSampleCount,dimension:rt.TextureDimension.E2d,format:rt.TextureFormat.BGRA8Unorm,usage:rt.TextureUsage.OutputAttachment};this.mainTexture&&this.mainTexture.destroy(),this.mainTexture=this.device.createTexture(t),this.mainColorAttachments=[{attachment:$i?this.mainTexture.createDefaultView():this.mainTexture.createView(),loadValue:[0,0,0,1],storeOp:rt.StoreOp.Store}]}else this.mainColorAttachments=[{attachment:$i?this.swapChain.getCurrentTexture().createDefaultView():this.swapChain.getCurrentTexture().createView(),loadValue:[0,0,0,1],storeOp:rt.StoreOp.Store}];var n={size:this.mainTextureExtends,mipLevelCount:1,sampleCount:this.mainPassSampleCount,dimension:rt.TextureDimension.E2d,format:$i?"depth32float-stencil8":rt.TextureFormat.Depth24PlusStencil8,usage:rt.TextureUsage.OutputAttachment};this.depthTexture&&this.depthTexture.destroy(),this.depthTexture=this.device.createTexture(n),this.mainDepthAttachment={attachment:$i?this.depthTexture.createDefaultView():this.depthTexture.createView(),depthLoadValue:this.clearDepthValue,depthStoreOp:rt.StoreOp.Store,stencilLoadValue:this.clearStencilValue,stencilStoreOp:rt.StoreOp.Store}}},{key:"startComputePass",value:function(){this.currentComputePass&&this.endComputePass(),this.currentComputePass=this.computeEncoder.beginComputePass()}},{key:"startMainRenderPass",value:function(){this.currentRenderPass&&!this.currentRenderTarget&&this.endMainRenderPass(),this.options.antialiasing?this.mainColorAttachments[0].resolveTarget=$i?this.swapChain.getCurrentTexture().createDefaultView():this.swapChain.getCurrentTexture().createView():this.mainColorAttachments[0].attachment=$i?this.swapChain.getCurrentTexture().createDefaultView():this.swapChain.getCurrentTexture().createView(),this.currentRenderPass=this.renderEncoder.beginRenderPass({colorAttachments:this.mainColorAttachments,depthStencilAttachment:this.mainDepthAttachment}),this.mainRenderPass=this.currentRenderPass,this.cachedViewport&&this.viewport(this.cachedViewport)}},{key:"startRenderTargetRenderPass",value:function(t,n,i){var a,o,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,u=(a=t.get().color)===null||a===void 0?void 0:a.texture,l;u&&(l=u.createView(this.currentRenderTargetViewDescriptor));var c=(o=t.get().depth)===null||o===void 0?void 0:o.texture,f;c&&(f=c.createView());var d=this.renderTargetEncoder.beginRenderPass({colorAttachments:[{attachment:l,loadValue:n!==null?n:rt.LoadOp.Load,storeOp:rt.StoreOp.Store}],depthStencilAttachment:c&&f?{attachment:f,depthLoadValue:i?this.clearDepthValue:rt.LoadOp.Load,depthStoreOp:rt.StoreOp.Store,stencilLoadValue:s?this.clearStencilValue:rt.LoadOp.Load,stencilStoreOp:rt.StoreOp.Store}:void 0});this.currentRenderPass=d,this.cachedViewport&&this.viewport(this.cachedViewport)}},{key:"endMainRenderPass",value:function(){this.currentRenderPass===this.mainRenderPass&&this.currentRenderPass!==null&&(this.currentRenderPass.endPass(),this.resetCachedViewport(),this.currentRenderPass=null,this.mainRenderPass=null)}},{key:"endComputePass",value:function(){this.currentComputePass&&(this.currentComputePass.endPass(),this.currentComputePass=null)}},{key:"endRenderTargetRenderPass",value:function(){this.currentRenderPass&&(this.currentRenderPass.endPass(),this.resetCachedViewport())}},{key:"resetCachedViewport",value:function(){this.cachedViewport={x:0,y:0,width:0,height:0}}},{key:"unbindFramebuffer",value:function(t){this.currentRenderPass&&this.currentRenderPass!==this.mainRenderPass&&this.endRenderTargetRenderPass(),this.transientViewport.x=1/0,this.currentRenderTarget=null,this.currentRenderPass=this.mainRenderPass}}]),r}(),qP))||HP),KP,ZP;function hse(r){var e=dse();return function(){var n=zr(r),i;if(e){var a=zr(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return xi(this,i)}}function dse(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}var ax=4/64,QP=1-ax*2,vse=(KP=Gr(),KP(ZP=function(r){wi(t,r);var e=hse(t);function t(){return Ct(this,t),e.apply(this,arguments)}return Gt(t,[{key:"onEntityCreated",value:function(){var i=this.config,a=i.widthSegments,o=a===void 0?1:a,s=i.heightSegments,u=s===void 0?1:s,l=i.depthSegments,c=l===void 0?1:l,f=i.halfExtents,d=f===void 0?nr(.5,.5,.5):f,h=o,v=u,p=c,g=Xg(d,3),y=g[0],m=g[1],b=g[2],w=[nr(-y,-m,b),nr(y,-m,b),nr(y,m,b),nr(-y,m,b),nr(y,-m,-b),nr(-y,-m,-b),nr(-y,m,-b),nr(y,m,-b)],x=[[0,1,3],[4,5,7],[3,2,6],[1,0,4],[1,4,2],[5,0,6]],_=[[0,0,1],[0,0,-1],[0,1,0],[0,-1,0],[1,0,0],[-1,0,0]],A={FRONT:0,BACK:1,TOP:2,BOTTOM:3,RIGHT:4,LEFT:5},I=[],M=[],S=[],C=[],T=0,k=function(K,z,X){var H,J,ne,me;for(ne=0;ne<=z;ne++)for(me=0;me<=X;me++){var oe=Vr(),Ae=Vr(),ze=Vr(),qe=Vr();Ou(oe,w[x[K][0]],w[x[K][1]],ne/z),Ou(Ae,w[x[K][0]],w[x[K][2]],me/X),Eb(ze,Ae,w[x[K][0]]),Vo(qe,oe,ze),H=ne/z,J=me/X,I.push(qe[0],qe[1],qe[2]),M.push(_[K][0],_[K][1],_[K][2]),S.push(H,J),H/=3,J/=3,H=H*QP+ax,J=J*QP+ax,H+=K%3/3,J+=Math.floor(K/3)/3,ne<z&&me<X&&(C.push(T+X+1,T+1,T),C.push(T+X+1,T+X+2,T+1)),T++}};k(A.FRONT,h,v),k(A.BACK,h,v),k(A.TOP,h,p),k(A.BOTTOM,h,p),k(A.RIGHT,p,v),k(A.LEFT,p,v);var L=qw(I),B=this.getComponent();B.indices=Uint32Array.from(C),B.aabb=L,B.vertexCount=T,B.attributes=[{dirty:!0,name:"position",data:Float32Array.from(I),arrayStride:4*3,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float3"}]},{dirty:!0,name:"normal",data:Float32Array.from(M),arrayStride:4*3,stepMode:"vertex",attributes:[{shaderLocation:1,offset:0,format:"float3"}]},{dirty:!0,name:"uv",data:Float32Array.from(S),arrayStride:4*2,stepMode:"vertex",attributes:[{shaderLocation:2,offset:0,format:"float2"}]}]}}]),t}(Ys))||ZP);function pse(r,e){if(!r&&!e)throw new Error("Please specify valid arguments for parameters a and b.");if(!e||e.length===0)return r;if(!r||r.length===0)return e;if(Object.prototype.toString.call(r)!==Object.prototype.toString.call(e))throw new Error("The types of the two arguments passed for parameters a and b do not match.");var t=new r.constructor(r.length+e.length);return t.set(r),t.set(e,r.length),t}var JP,eR;function gse(r){var e=yse();return function(){var n=zr(r),i;if(e){var a=zr(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return xi(this,i)}}function yse(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}var mse=(JP=Gr(),JP(eR=function(r){wi(t,r);var e=gse(t);function t(){return Ct(this,t),e.apply(this,arguments)}return Gt(t,[{key:"onEntityCreated",value:function(){var i=this.config.geometries,a=i===void 0?[]:i,o=this.getComponent();o.aabb=new jw;var s=[],u=[],l=0;a.forEach(function(c){var f=c.aabb,d=c.indices,h=c.vertexCount,v=c.attributes;o.aabb.add(f),o.vertexCount+=h,d&&u.push.apply(u,Dn(d.map(function(p){return p+l}))),l+=h,v.forEach(function(p,g){s[g]?p.data&&(Kw(p.data)?s[g].push(p.data):rP(p.data)?s[g].data=pse(s[g].data,p.data):s[g].data=s[g].data.concat(p.data)):(s[g]=p,s[g].dirty=!0)})}),o.attributes=s,o.indices=Uint32Array.from(u),o.dirty=!0}}]),t}(Ys))||eR),tR,rR;function bse(r){var e=wse();return function(){var n=zr(r),i;if(e){var a=zr(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return xi(this,i)}}function wse(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}var xse=(tR=Gr(),tR(rR=function(r){wi(t,r);var e=bse(t);function t(){return Ct(this,t),e.apply(this,arguments)}return Gt(t,[{key:"onEntityCreated",value:function(){for(var i=this.config,a=i.halfExtents,o=a===void 0?[.5,.5]:a,s=i.widthSegments,u=s===void 0?5:s,l=i.lengthSegments,c=l===void 0?5:l,f=[],d=[],h=[],v=[],p=0,g=0;g<=u;g++)for(var y=0;y<=c;y++){var m=-o[0]+2*o[0]*g/u,b=0,w=-(-o[1]+2*o[1]*y/c),x=g/u,_=y/c;f.push(m,b,w),d.push(0,1,0),h.push(x,_),g<u&&y<c&&(v.push(p+c+1,p+1,p),v.push(p+c+1,p+c+2,p+1)),p++}var A=qw(f),I=this.getComponent();I.indices=Uint32Array.from(v),I.aabb=A,I.vertexCount=p,I.attributes=[{dirty:!0,name:"position",data:Float32Array.from(f),arrayStride:4*3,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float3"}]},{dirty:!0,name:"normal",data:Float32Array.from(d),arrayStride:4*3,stepMode:"vertex",attributes:[{shaderLocation:1,offset:0,format:"float3"}]},{dirty:!0,name:"uv",data:Float32Array.from(h),arrayStride:4*2,stepMode:"vertex",attributes:[{shaderLocation:2,offset:0,format:"float2"}]}]}}]),t}(Ys))||rR),nR,iR;function _se(r){var e=Sse();return function(){var n=zr(r),i;if(e){var a=zr(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return xi(this,i)}}function Sse(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}var Ese=(nR=Gr(),nR(iR=function(r){wi(t,r);var e=_se(t);function t(){return Ct(this,t),e.apply(this,arguments)}return Gt(t,[{key:"onEntityCreated",value:function(){for(var i=this.config,a=i.radius,o=a===void 0?.5:a,s=i.latitudeBands,u=s===void 0?16:s,l=i.longitudeBands,c=l===void 0?16:l,f=[],d=[],h=[],v=[],p=0;p<=u;p++)for(var g=p*Math.PI/u,y=Math.sin(g),m=Math.cos(g),b=0;b<=c;b++){var w=b*2*Math.PI/c-Math.PI/2,x=Math.sin(w),_=Math.cos(w),A=_*y,I=m,M=x*y,S=1-b/c,C=1-p/u;f.push(A*o,I*o,M*o),d.push(A,I,M),h.push(S,C)}for(var T=0;T<u;++T)for(var k=0;k<c;++k){var L=T*(c+1)+k,B=L+c+1;v.push(L+1,B,L),v.push(L+1,B+1,B)}var ee=qw(f),K=this.getComponent();K.indices=Uint32Array.from(v),K.aabb=ee,K.vertexCount=f.length/3,K.attributes=[{dirty:!0,name:"position",data:Float32Array.from(f),arrayStride:4*3,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float3"}]},{dirty:!0,name:"normal",data:Float32Array.from(d),arrayStride:4*3,stepMode:"vertex",attributes:[{shaderLocation:1,offset:0,format:"float3"}]},{dirty:!0,name:"uv",data:Float32Array.from(h),arrayStride:4*2,stepMode:"vertex",attributes:[{shaderLocation:2,offset:0,format:"float2"}]}]}}]),t}(Ys))||iR),aR,oR,sR,uR,hy,lR,cR,fR;function Ase(r){var e=Tse();return function(){var n=zr(r),i;if(e){var a=zr(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return xi(this,i)}}function Tse(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}var Ise=`varying vec4 fragColor;

#pragma include "uv.frag.declaration"
#pragma include "map.frag.declaration"

void main() {
  vec4 diffuseColor = fragColor;

  #pragma include "map.frag.main"

  gl_FragColor = diffuseColor;
}`,Cse=`attribute vec3 position;
attribute vec3 normal;

uniform mat4 projectionMatrix;
uniform mat4 modelViewMatrix;
uniform vec4 color;

varying vec4 fragColor;

#pragma include "uv.vert.declaration"

void main() {
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
  fragColor = color;

  #pragma include "uv.vert.main"
}`,Mse=`// layout(set = 0, binding = 1) uniform WireframeUniforms {
//   float lineWidth;
//   vec4 lineColor;
// } wireframe;

layout(location = 0) in vec4 fragColor;
// layout(location = 1) in vec3 v_Barycentric;

layout(location = 0) out vec4 outColor;

// wireframe
// float edgeFactor() {
//   vec3 d = fwidth(v_Barycentric);
//   vec3 a3 = smoothstep(vec3(0.0), d * wireframe.lineWidth, v_Barycentric);
//   return min(min(a3.x, a3.y), a3.z);
// }

void main() {
  // outColor = mix(fragColor, wireframe.lineColor, (1.0 - edgeFactor()));
  outColor = fragColor;
}`,kse=`layout(set = 0, binding = 0) uniform Uniforms {
  vec4 color;
  mat4 projectionMatrix;
  mat4 modelViewMatrix;
} uniforms;

layout(location = 0) in vec3 position;
// layout(location = 1) in vec3 barycentric;

layout(location = 0) out vec4 fragColor;
// layout(location = 1) out vec3 v_Barycentric;

void main() {
  gl_Position = uniforms.projectionMatrix * uniforms.modelViewMatrix * vec4(position, 1.0);
  fragColor = uniforms.color;
  // v_Barycentric = barycentric;
}`,Dse=(aR=Gr(),oR=Bt(Pe.RenderEngine),sR=Bt(Pe.ShaderModuleService),aR(uR=(hy=(fR=function(r){wi(t,r);var e=Ase(t);function t(){var n;Ct(this,t);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return n=e.call.apply(e,[this].concat(a)),Pt(n,"engine",lR,wn(n)),Pt(n,"shaderModuleService",cR,wn(n)),n}return Gt(t,[{key:"onEntityCreated",value:function(){var i=this.getComponent(),a=this.engine.supportWebGPU?kse:Cse,o=this.engine.supportWebGPU?Mse:Ise;this.shaderModuleService.registerModule("material-basic",{vs:a,fs:o});var s=this.shaderModuleService.getModule("material-basic"),u=s.vs,l=s.fs,c=s.uniforms;i.vertexShaderGLSL=u,i.fragmentShaderGLSL=l,i.setUniform(c),this.config.map&&(i.setDefines({USE_UV:1,USE_MAP:1}),i.setUniform({map:this.config.map,uvTransform:nc()}))}}]),t}(bP),fR),lR=Rt(hy.prototype,"engine",[oR],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),cR=Rt(hy.prototype,"shaderModuleService",[sR],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),hy))||uR),hR,dR,vR,pR,gR,yR,mR,td,bR,wR,xR,_R;function Lse(r){var e=Nse();return function(){var n=zr(r),i;if(e){var a=zr(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return xi(this,i)}}function Nse(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}var Ose=`// generate grid, borrow from clay.gl viewer
// @see https://github.com/pissang/clay-viewer/blob/master/src/graphic/ground.glsl
#extension GL_OES_standard_derivatives : enable

varying vec3 v_Position;
// varying vec3 v_Normal;

uniform float u_GridSize : 5;
uniform float u_GridSize2 : .5;
uniform vec4 u_GridColor : [0, 0, 0, 1];
uniform vec4 u_GridColor2 : [0.3, 0.3, 0.3, 1];
uniform bool u_GridEnabled : true;

// uniform vec3 u_LightDirection;
// uniform vec3 u_LightColor;
// uniform vec3 u_Camera;

void main() {
  // vec3 n = v_Normal;
  // vec3 l = normalize(u_LightDirection);
  // float NdotL = clamp(dot(n, l), 0.001, 1.0);

  gl_FragColor = vec4(1.);

  if (u_GridEnabled) {
    float wx = v_Position.x;
    float wz = v_Position.z;
    // float x0 = abs(fract(wx / u_GridSize - 0.5) - 0.5) / fwidth(wx) * u_GridSize / 2.0;
    // float z0 = abs(fract(wz / u_GridSize - 0.5) - 0.5) / fwidth(wz) * u_GridSize / 2.0;

    float x1 = abs(fract(wx / u_GridSize2 - 0.5) - 0.5) / fwidth(wx) * u_GridSize2;
    float z1 = abs(fract(wz / u_GridSize2 - 0.5) - 0.5) / fwidth(wz) * u_GridSize2;

    // float v0 = 1.0 - clamp(min(x0, z0), 0.0, 1.0);
    float v1 = 1.0 - clamp(min(x1, z1), 0.0, 1.0);
    // if (v0 > 0.1) {
        // gl_FragColor = mix(gl_FragColor, u_GridColor, v0);
    // }
    // else {
        gl_FragColor = mix(gl_FragColor, u_GridColor2, v1);
    // }
  }

  // float shadowFactor = calcShadow(u_ShadowMap, v_PositionFromLight, l, n);
  // vec3 diffuseColor = u_LightColor * NdotL * shadowFactor;

  // gl_FragColor.rgb *= diffuseColor;
}`,Pse=`attribute vec3 a_Position;

varying vec3 v_Position;

uniform mat4 projectionMatrix;
uniform mat4 modelViewMatrix;

void main() {
  v_Position = a_Position;
  gl_Position = projectionMatrix * modelViewMatrix * vec4(a_Position, 1.);
}`,Rse=(hR=Gr(),dR=Bt(Pe.Systems),vR=yo(Pe.MaterialSystem),pR=Bt(Pe.Systems),gR=yo(Pe.GeometrySystem),yR=Bt(Pe.ShaderModuleService),hR(mR=(td=(_R=function(r){wi(t,r);var e=Lse(t);function t(){var n;Ct(this,t);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return n=e.call.apply(e,[this].concat(a)),Pt(n,"materialSystem",bR,wn(n)),Pt(n,"geometrySystem",wR,wn(n)),Pt(n,"shaderModuleService",xR,wn(n)),n}return Gt(t,[{key:"onAttributeChanged",value:function(i){var a=i.name,o=i.data,s=this.getMeshComponent();s&&s.material&&(a==="gridColor"?(s.material.setUniform("u_GridColor",o),s.material.setUniform("u_GridColor2",o)):a==="gridSize"&&(s.material.setUniform("u_GridSize",o),s.material.setUniform("u_GridSize2",o)))}},{key:"onEntityCreated",value:function(){this.shaderModuleService.registerModule("grid",{vs:Pse,fs:Ose});var i=this.shaderModuleService.getModule("grid"),a=i.vs,o=i.fs,s=i.uniforms,u=this.materialSystem.createShaderMaterial({vertexShader:a,fragmentShader:o});this.setMaterial(u);var l=this.geometrySystem.createBufferGeometry({vertexCount:4});this.setGeometry(l),u.setCull({enable:!1,face:le.BACK}).setDepth({enable:!0,func:le.LESS}),u.setUniform(s),this.setAttributes({gridColor:this.config.gridColor,gridSize:this.config.gridSize}),l.setIndex([0,3,2,2,1,0]),l.setAttribute("a_Position",Float32Array.from([-4,-1,-4,4,-1,-4,4,-1,4,-4,-1,4]),{arrayStride:4*2,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float2"}]})}}]),t}(Hs),_R),bR=Rt(td.prototype,"materialSystem",[dR,vR],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),wR=Rt(td.prototype,"geometrySystem",[pR,gR],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),xR=Rt(td.prototype,"shaderModuleService",[yR],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),td))||mR),SR=1e-6,ER=Bse;function Bse(){var r=new Float32Array(2);return r[0]=0,r[1]=0,r}var Fse=Use;function Use(r){var e=new Float32Array(2);return e[0]=r[0],e[1]=r[1],e}var Gse=zse;function zse(r,e){var t=new Float32Array(2);return t[0]=r,t[1]=e,t}var $se=Vse;function Vse(r,e){return r[0]=e[0],r[1]=e[1],r}var AR=jse;function jse(r,e,t){return r[0]=e,r[1]=t,r}var Wse=Xse,TR=SR;function Xse(r,e){var t=r[0],n=r[1],i=e[0],a=e[1];return Math.abs(t-i)<=TR*Math.max(1,Math.abs(t),Math.abs(i))&&Math.abs(n-a)<=TR*Math.max(1,Math.abs(n),Math.abs(a))}var Yse=Hse;function Hse(r,e){return r[0]===e[0]&&r[1]===e[1]}var IR=qse;function qse(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r}var ox=Kse;function Kse(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r}var Zse=ox,CR=Qse;function Qse(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r}var Jse=CR,MR=eue;function eue(r,e,t){return r[0]=e[0]/t[0],r[1]=e[1]/t[1],r}var tue=MR,rue=nue;function nue(r,e){return r[0]=1/e[0],r[1]=1/e[1],r}var iue=aue;function aue(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r}var oue=sue;function sue(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r}var uue=lue;function lue(r,e,t){var n=Math.cos(t),i=Math.sin(t),a=e[0],o=e[1];return r[0]=a*n-o*i,r[1]=a*i+o*n,r}var cue=fue;function fue(r,e){return r[0]=Math.floor(e[0]),r[1]=Math.floor(e[1]),r}var hue=due;function due(r,e){return r[0]=Math.ceil(e[0]),r[1]=Math.ceil(e[1]),r}var vue=pue;function pue(r,e){return r[0]=Math.round(e[0]),r[1]=Math.round(e[1]),r}var gue=yue;function yue(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r}var mue=bue;function bue(r,e,t,n){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r}var kR=wue;function wue(r,e){var t=e[0]-r[0],n=e[1]-r[1];return Math.sqrt(t*t+n*n)}var xue=kR,DR=_ue;function _ue(r,e){var t=e[0]-r[0],n=e[1]-r[1];return t*t+n*n}var Sue=DR,LR=Eue;function Eue(r){var e=r[0],t=r[1];return Math.sqrt(e*e+t*t)}var Aue=LR,NR=Tue;function Tue(r){var e=r[0],t=r[1];return e*e+t*t}var Iue=NR,Cue=Mue;function Mue(r,e){return r[0]=-e[0],r[1]=-e[1],r}var OR=kue;function kue(r,e){var t=e[0],n=e[1],i=t*t+n*n;return i>0&&(i=1/Math.sqrt(i),r[0]=e[0]*i,r[1]=e[1]*i),r}var PR=Due;function Due(r,e){return r[0]*e[0]+r[1]*e[1]}var Lue=Nue;function Nue(r,e,t){var n=e[0]*t[1]-e[1]*t[0];return r[0]=r[1]=0,r[2]=n,r}var Oue=Pue;function Pue(r,e,t,n){var i=e[0],a=e[1];return r[0]=i+n*(t[0]-i),r[1]=a+n*(t[1]-a),r}var Rue=Bue;function Bue(r,e){e=e||1;var t=Math.random()*2*Math.PI;return r[0]=Math.cos(t)*e,r[1]=Math.sin(t)*e,r}var Fue=Uue;function Uue(r,e,t){var n=e[0],i=e[1];return r[0]=t[0]*n+t[2]*i,r[1]=t[1]*n+t[3]*i,r}var Gue=zue;function zue(r,e,t){var n=e[0],i=e[1];return r[0]=t[0]*n+t[2]*i+t[4],r[1]=t[1]*n+t[3]*i+t[5],r}var $ue=Vue;function Vue(r,e,t){var n=e[0],i=e[1];return r[0]=t[0]*n+t[3]*i+t[6],r[1]=t[1]*n+t[4]*i+t[7],r}var jue=Wue;function Wue(r,e,t){var n=e[0],i=e[1];return r[0]=t[0]*n+t[4]*i+t[12],r[1]=t[1]*n+t[5]*i+t[13],r}var Xue=Yue,Lc=ER();function Yue(r,e,t,n,i,a){var o,s;for(e||(e=2),t||(t=0),n?s=Math.min(n*e+t,r.length):s=r.length,o=t;o<s;o+=e)Lc[0]=r[o],Lc[1]=r[o+1],i(Lc,Lc,a),r[o]=Lc[0],r[o+1]=Lc[1];return r}var Hue=que;function que(r,e,t){var n=e[0]*e[0]+e[1]*e[1];if(n>t*t){var i=Math.sqrt(n);r[0]=e[0]/i*t,r[1]=e[1]/i*t}else r[0]=e[0],r[1]=e[1];return r}var dy={EPSILON:SR,create:ER,clone:Fse,fromValues:Gse,copy:$se,set:AR,equals:Wse,exactEquals:Yse,add:IR,subtract:ox,sub:Zse,multiply:CR,mul:Jse,divide:MR,div:tue,inverse:rue,min:iue,max:oue,rotate:uue,floor:cue,ceil:hue,round:vue,scale:gue,scaleAndAdd:mue,distance:kR,dist:xue,squaredDistance:DR,sqrDist:Sue,length:LR,len:Aue,squaredLength:NR,sqrLen:Iue,negate:Cue,normalize:OR,dot:PR,cross:Lue,lerp:Oue,random:Rue,transformMat2:Fue,transformMat2d:Gue,transformMat3:$ue,transformMat4:jue,forEach:Xue,limit:Hue},Kue=IR,sx=AR,RR=OR,Zue=ox,Que=PR,BR=[0,0],Jue=function(e,t,n,i,a){return Kue(e,n,i),RR(e,e),sx(t,-e[1],e[0]),sx(BR,-n[1],n[0]),a/Que(t,BR)},vy=function(e,t){return sx(e,-t[1],t[0]),e},FR=function(e,t,n){return Zue(e,t,n),RR(e,e),e};function py(r,e,t,n,i){rd(e,n,-i),rd(e,n,i),r.push(t),r.push(t)}function rd(r,e,t){r.push([[e[0],e[1]],t])}function ele(r,e,t){var n=[0,0],i=[0,0],a=[0,0],o=[0,0],s=-1,u=!1,l=null,c=dy.create(),f=t||0,d=3,h=[],v=[],p=[],g=[0,0];e&&(r=r.slice(),r.push(r[0]));for(var y=r.length,m=1;m<y;m++){var b=f,w=r[m-1],x=r[m],_=m<r.length-1?r[m+1]:null;if(g.push(m/y,m/y),FR(n,x,w),l||(l=[0,0],vy(l,n)),u||(u=!0,py(v,h,w,l,1)),p.push([b+0,b+1,b+2]),!_)vy(l,n),py(v,h,x,l,1),p.push(s===1?[b,b+2,b+3]:[b+2,b+1,b+3]),f+=2;else{FR(i,_,x);var A=Jue(a,o,n,i,1),I=dy.dot(a,l)<0?-1:1,M=A>d;if(!isFinite(A)){vy(l,n),py(v,h,x,l,1),p.push(s===1?[b,b+2,b+3]:[b+2,b+1,b+3]),f+=2,s=I;continue}M?(A=d,g.push(m/y),rd(h,l,-I),v.push(x),rd(h,o,A*I),v.push(x),p.push(s!==-I?[b,b+2,b+3]:[b+2,b+1,b+3]),p.push([b+2,b+3,b+4]),vy(c,i),dy.copy(l,c),rd(h,l,-I),v.push(x),f+=3):(py(v,h,x,o,A),p.push(s===1?[b,b+2,b+3]:[b+2,b+1,b+3]),I=-1,dy.copy(l,o),f+=2),s=I}}return{normals:h,attrIndex:p,attrPos:v,attrCounters:g}}var UR,GR,zR,$R,VR,jR,WR,nd,XR,YR,HR,qR;function tle(r){var e=rle();return function(){var n=zr(r),i;if(e){var a=zr(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return xi(this,i)}}function rle(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}var nle=`uniform float u_dash_array : 0.02;
uniform float u_dash_offset : 0;
uniform float u_dash_ratio : 0;
uniform float u_thickness : 0.02;

varying vec4 v_color;
varying vec2 v_normal;
varying float v_counters;

void main() {
    float blur = 1. - smoothstep(0.98, 1., length(v_normal));

    gl_FragColor = v_color;
    gl_FragColor.a *= blur * ceil(mod(v_counters + u_dash_offset, u_dash_array) - (u_dash_array * u_dash_ratio));
}`,ile=`attribute vec2 a_pos;
attribute vec4 a_color;
attribute float a_line_miter;
attribute vec2 a_line_normal;
attribute float a_counters;

uniform mat4 projectionMatrix;
uniform mat4 modelViewMatrix;
uniform float u_thickness : 0.02;
uniform vec2 u_viewport;

varying vec4 v_color;
varying vec2 v_normal;
varying float v_counters;

void main() {
  v_color = a_color;
  v_counters = a_counters;

  vec3 normal = normalize(vec3(a_line_normal, 0.0));

  vec4 offset = vec4(normal * u_thickness / 2.0 * a_line_miter, 0.0);

  v_normal = vec2(normal * sign(a_line_miter));

  gl_Position = projectionMatrix * modelViewMatrix * vec4(a_pos, 0.0, 1.0) + offset;
}
`,ale=(UR=Gr(),GR=Bt(Pe.Systems),zR=yo(Pe.MaterialSystem),$R=Bt(Pe.Systems),VR=yo(Pe.GeometrySystem),jR=Bt(Pe.ShaderModuleService),UR(WR=(nd=(qR=function(r){wi(t,r);var e=tle(t);function t(){var n;Ct(this,t);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return n=e.call.apply(e,[this].concat(a)),Pt(n,"materialSystem",XR,wn(n)),Pt(n,"geometrySystem",YR,wn(n)),Pt(n,"shaderModuleService",HR,wn(n)),n.vertexCount=void 0,n}return Gt(t,[{key:"onAttributeChanged",value:function(i){var a=i.name,o=i.data,s=this.getMeshComponent();if(s&&s.material)switch(a){case"dashArray":s.material.setUniform("u_dash_array",o);break;case"dashOffset":s.material.setUniform("u_dash_offset",o);break;case"dashRatio":s.material.setUniform("u_dash_ratio",o);break;case"thickness":s.material.setUniform("u_thickness",o);break;case"color":var u=new Array(this.vertexCount).fill(void 0).map(function(){return o}).reduce(function(l,c){return[].concat(Dn(l),Dn(c))},[]);s.geometry.setAttribute("a_color",Float32Array.from(u),{arrayStride:4*4,stepMode:"vertex",attributes:[{shaderLocation:1,offset:0,format:"float4"}]});break}}},{key:"onEntityCreated",value:function(){var i=this;this.shaderModuleService.registerModule("line",{vs:ile,fs:nle});var a=this.shaderModuleService.getModule("line"),o=a.vs,s=a.fs,u=a.uniforms,l=this.materialSystem.createShaderMaterial({vertexShader:o,fragmentShader:s}),c=ele(this.config.points,!1),f=c.normals,d=c.attrIndex,h=c.attrPos,v=c.attrCounters,p=h.length;this.vertexCount=p;var g=this.geometrySystem.createBufferGeometry({vertexCount:p});this.setMaterial(l),this.setGeometry(g),l.setCull({enable:!1,face:le.BACK}).setUniform(u),this.setAttributes({dashArray:this.config.dashArray,dashOffset:this.config.dashOffset,dashRatio:this.config.dashRatio,thickness:this.config.thickness});var y=[],m=[];f.forEach(function(w){var x=w[0],_=w[1];y.push([x[0],x[1]]),m.push(_)}),g.setIndex(d.reduce(function(w,x){return[].concat(Dn(w),Dn(x))},[])),g.setAttribute("a_pos",Float32Array.from(h.reduce(function(w,x){return[].concat(Dn(w),Dn(x))},[])),{arrayStride:4*2,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float2"}]});var b=new Array(p).fill(void 0).map(function(){return Dn(i.config.color)}).reduce(function(w,x){return[].concat(Dn(w),Dn(x))},[]);g.setAttribute("a_color",Float32Array.from(b),{arrayStride:4*4,stepMode:"vertex",attributes:[{shaderLocation:1,offset:0,format:"float4"}]}),g.setAttribute("a_line_miter",Float32Array.from(m),{arrayStride:4*1,stepMode:"vertex",attributes:[{shaderLocation:2,offset:0,format:"float"}]}),g.setAttribute("a_line_normal",Float32Array.from(y.reduce(function(w,x){return[].concat(Dn(w),Dn(x))},[])),{arrayStride:4*2,stepMode:"vertex",attributes:[{shaderLocation:3,offset:0,format:"float2"}]}),g.setAttribute("a_counters",Float32Array.from(v),{arrayStride:4*1,stepMode:"vertex",attributes:[{shaderLocation:4,offset:0,format:"float"}]})}}]),t}(Hs),qR),XR=Rt(nd.prototype,"materialSystem",[GR,zR],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),YR=Rt(nd.prototype,"geometrySystem",[$R,VR],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),HR=Rt(nd.prototype,"shaderModuleService",[jR],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),nd))||WR);function ole(r){return[r+1&255,r+1>>8&255,r+1>>8>>8&255]}var KR,ZR,QR,JR,eB,tB,rB,id,nB,iB,aB,oB;function sB(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function sle(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?sB(Object(t),!0).forEach(function(n){Ie(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):sB(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function ule(r){var e=lle();return function(){var n=zr(r),i;if(e){var a=zr(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return xi(this,i)}}function lle(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}var cle=`uniform float u_blur : 0.05;
uniform float u_opacity : 0.7;
uniform float u_stroke_width : 0.01;
uniform vec4 u_stroke_color : [0, 0, 0, 0];
uniform float u_stroke_opacity : 1;

varying vec4 v_color;
varying vec4 v_data;
varying float v_radius;

#pragma include "sdf2d"
#pragma include "picking"

void main() {
  int shape = int(floor(v_data.w + 0.5));

  float antialiasblur = v_data.z;
  float antialiased_blur = -max(u_blur, antialiasblur);
  float r = v_radius / (v_radius + u_stroke_width);

  float outer_df;
  float inner_df;
  // 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica'
  // if (shape == 0) {
    outer_df = sdCircle(v_data.xy, 1.0);
    inner_df = sdCircle(v_data.xy, r);
  // } else if (shape == 1) {
  //   outer_df = sdEquilateralTriangle(1.1 * v_data.xy);
  //   inner_df = sdEquilateralTriangle(1.1 / r * v_data.xy);
  // } else if (shape == 2) {
  //   outer_df = sdBox(v_data.xy, vec2(1.));
  //   inner_df = sdBox(v_data.xy, vec2(r));
  // } else if (shape == 3) {
  //   outer_df = sdPentagon(v_data.xy, 0.8);
  //   inner_df = sdPentagon(v_data.xy, r * 0.8);
  // } else if (shape == 4) {
  //   outer_df = sdHexagon(v_data.xy, 0.8);
  //   inner_df = sdHexagon(v_data.xy, r * 0.8);
  // } else if (shape == 5) {
  //   outer_df = sdOctogon(v_data.xy, 1.0);
  //   inner_df = sdOctogon(v_data.xy, r);
  // } else if (shape == 6) {
  //   outer_df = sdHexagram(v_data.xy, 0.52);
  //   inner_df = sdHexagram(v_data.xy, r * 0.52);
  // } else if (shape == 7) {
  //   outer_df = sdRhombus(v_data.xy, vec2(1.0));
  //   inner_df = sdRhombus(v_data.xy, vec2(r));
  // } else if (shape == 8) {
  //   outer_df = sdVesica(v_data.xy, 1.1, 0.8);
  //   inner_df = sdVesica(v_data.xy, r * 1.1, r * 0.8);
  // }

  float opacity_t = smoothstep(0.0, antialiased_blur, outer_df);

  float color_t = u_stroke_width < 0.01 ? 0.0 : smoothstep(
    antialiased_blur,
    0.0,
    inner_df
  );
  vec4 strokeColor = u_stroke_color == vec4(0) ? v_color : u_stroke_color;

  gl_FragColor = mix(vec4(v_color.rgb, v_color.a * u_opacity), strokeColor * u_stroke_opacity, color_t);
  gl_FragColor.a = gl_FragColor.a * opacity_t;

  gl_FragColor = filterColor(gl_FragColor);
}`,fle=`attribute vec2 position;
attribute vec4 color;
attribute float shape;
attribute vec2 offset;
attribute float size;

uniform mat4 projectionMatrix;
uniform mat4 modelViewMatrix;

uniform float u_stroke_width : 0.01;
uniform float u_device_pixel_ratio;
uniform vec2 u_viewport;

varying vec4 v_color;
varying vec4 v_data;
varying float v_radius;

#pragma include "picking"

void main() {
  v_color = color;
  v_radius = size;

  lowp float antialiasblur = 1.0 / u_device_pixel_ratio * (size + u_stroke_width);

  // construct point coords
  v_data = vec4(position, antialiasblur, shape);

  gl_Position = projectionMatrix * modelViewMatrix
    * vec4(position * size + offset, 0.0, 1.0);

  setPickingColor(a_PickingColor);
}`,hle=["circle","triangle","square","pentagon","hexagon","octogon","hexagram","rhombus","vesica"],dle=(KR=Gr(),ZR=Bt(Pe.Systems),QR=yo(Pe.MaterialSystem),JR=Bt(Pe.Systems),eB=yo(Pe.GeometrySystem),tB=Bt(Pe.ShaderModuleService),KR(rB=(id=(oB=function(r){wi(t,r);var e=ule(t);function t(){var n;Ct(this,t);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return n=e.call.apply(e,[this].concat(a)),Pt(n,"materialSystem",nB,wn(n)),Pt(n,"geometrySystem",iB,wn(n)),Pt(n,"shaderModuleService",aB,wn(n)),n}return Gt(t,[{key:"onAttributeChanged",value:function(i){var a=i.name,o=i.data,s=this.getMeshComponent();s&&s.material&&(a==="strokeWidth"?s.material.setUniform("u_stroke_width",o):a==="strokeColor"?s.material.setUniform("u_stroke_color",o):a==="strokeOpacity"?s.material.setUniform("u_stroke_opacity",o):a==="opacity"?s.material.setUniform("u_opacity",o):a==="blur"&&s.material.setUniform("u_blur",o))}},{key:"onEntityCreated",value:function(){this.shaderModuleService.registerModule("grid",{vs:fle,fs:cle});var i=this.shaderModuleService.getModule("grid"),a=i.vs,o=i.fs,s=i.uniforms,u=this.materialSystem.createShaderMaterial({vertexShader:a,fragmentShader:o,cull:{enable:!1},depth:{enable:!1},blend:{enable:!0,func:{srcRGB:le.SRC_ALPHA,dstRGB:le.ONE_MINUS_SRC_ALPHA,srcAlpha:1,dstAlpha:1}}});u.setUniform(sle({u_device_pixel_ratio:window.devicePixelRatio},s));var l=this.buildAttributes(),c=this.geometrySystem.createInstancedBufferGeometry({maxInstancedCount:l.instancedOffsets.length/2,vertexCount:6});c.setIndex([0,2,1,0,3,2]),c.setAttribute("position",Float32Array.from(l.positions),{arrayStride:4*2,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float2"}]}),c.setAttribute("offset",Float32Array.from(l.instancedOffsets),{arrayStride:4*2,stepMode:"instance",attributes:[{shaderLocation:1,offset:0,format:"float2"}]}),c.setAttribute("color",Float32Array.from(l.instancedColors),{arrayStride:4*4,stepMode:"instance",attributes:[{shaderLocation:2,offset:0,format:"float4"}]}),c.setAttribute("size",Float32Array.from(l.instancedSizes),{arrayStride:4,stepMode:"instance",attributes:[{shaderLocation:3,offset:0,format:"float"}]}),c.setAttribute("shape",Float32Array.from(l.instancedShapes),{arrayStride:4,stepMode:"instance",attributes:[{shaderLocation:4,offset:0,format:"float"}]}),c.setAttribute("a_PickingColor",Float32Array.from(l.instancedPickingColors),{arrayStride:4*3,stepMode:"instance",attributes:[{shaderLocation:6,offset:0,format:"float3"}]}),this.setMaterial(u),this.setGeometry(c)}},{key:"buildAttribute",value:function(i,a,o){var s,u,l,c;(s=a.instancedPickingColors).push.apply(s,Dn(ole(i.id||o))),a.instancedShapes.push(hle.indexOf(i.shape||"circle")),(u=a.instancedColors).push.apply(u,Dn(i.color||[1,0,0,1])),(l=a.instancedOffsets).push.apply(l,Dn(i.position||[0,0])),(c=a.instancedSizes).push.apply(c,Dn(i.size||[.2,.2]))}},{key:"buildAttributes",value:function(){var i=this,a={positions:[1,1,1,-1,-1,-1,-1,1],instancedOffsets:[],instancedColors:[],instancedSizes:[],instancedShapes:[],instancedPickingColors:[]};return Array.isArray(this.config)?this.config.forEach(function(o,s){i.buildAttribute(o,a,s)}):this.buildAttribute(this.config,a,0),a}}]),t}(Hs),oB),nB=Rt(id.prototype,"materialSystem",[ZR,QR],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),iB=Rt(id.prototype,"geometrySystem",[JR,eB],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),aB=Rt(id.prototype,"shaderModuleService",[tB],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),id))||rB),uB,lB,cB,fB,hB,ad,dB,vB,pB,gB;function yB(r,e){var t;if(typeof Symbol=="undefined"||r[Symbol.iterator]==null){if(Array.isArray(r)||(t=vle(r))||e&&r&&typeof r.length=="number"){t&&(r=t);var n=0,i=function(){};return{s:i,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){t=r[Symbol.iterator]()},n:function(){var l=t.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&t.return!=null&&t.return()}finally{if(o)throw s}}}}function vle(r,e){if(!!r){if(typeof r=="string")return mB(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return mB(r,e)}}function mB(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}var ple=`#ifdef USE_MAP
  uniform sampler2D map;
#endif`,gle=`#ifdef USE_MAP
  vec4 texelColor = texture2D(map, vUv);
  // texelColor = mapTexelToLinear(texelColor);
  diffuseColor *= texelColor;
#endif`,yle=`#if (defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ))
  varying vec2 vUv;
#endif`,mle=`#ifdef USE_UV
  attribute vec2 uv;
	#ifdef UVS_VERTEX_ONLY
    vec2 vUv;
	#else
		varying vec2 vUv;
	#endif
	uniform mat3 uvTransform;
#endif`,ble=`#ifdef USE_UV
  vUv = (uvTransform * vec3(uv, 1)).xy;
#endif`,bB=(uB=Gr(),lB=Bt(Pe.RenderEngine),cB=Bt(Pe.ShaderModuleService),fB=Bt(Pe.ConfigService),uB(hB=(ad=(gB=function(){function r(){Ct(this,r),this.container=void 0,Pt(this,"engine",dB,this),Pt(this,"shaderModule",vB,this),Pt(this,"configService",pB,this),this.inited=!1,this.rendering=!1,this.pendings=[],this.views=[],this.size=void 0}return Gt(r,[{key:"init",value:function(){var e=Rr(_t.mark(function n(){var i,a,o,s,u;return _t.wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(this.shaderModule.registerBuiltinModules(),this.shaderModule.registerModule("uv.vert.declaration",{vs:mle}),this.shaderModule.registerModule("uv.vert.main",{vs:ble}),this.shaderModule.registerModule("uv.frag.declaration",{fs:yle}),this.shaderModule.registerModule("map.frag.declaration",{fs:ple}),this.shaderModule.registerModule("map.frag.main",{fs:gle}),i=this.container.getAll(Pe.Systems),a=this.configService.get(),!a.canvas){c.next=30;break}return c.next=11,this.engine.init({canvas:a.canvas,swapChainFormat:rt.TextureFormat.BGRA8Unorm,antialiasing:!1});case 11:o=yB(i),c.prev=12,o.s();case 14:if((s=o.n()).done){c.next=21;break}if(u=s.value,!u.initialize){c.next=19;break}return c.next=19,u.initialize();case 19:c.next=14;break;case 21:c.next=26;break;case 23:c.prev=23,c.t0=c.catch(12),o.e(c.t0);case 26:return c.prev=26,o.f(),c.finish(26);case 29:this.inited=!0;case 30:case"end":return c.stop()}},n,this,[[12,23,26,29]])}));function t(){return e.apply(this,arguments)}return t}()},{key:"render",value:function(){var e=Rr(_t.mark(function n(){var i,a,o,s,u,l,c,f=arguments;return _t.wrap(function(h){for(;;)switch(h.prev=h.next){case 0:if(!(!this.inited||this.rendering)){h.next=2;break}return h.abrupt("return");case 2:for(this.pendings.length&&this.pendings.forEach(function(v){v()}),this.rendering=!0,this.engine.beginFrame(),i=this.container.getAll(Pe.Systems),a=f.length,o=new Array(a),s=0;s<a;s++)o[s]=f[s];u=yB(i),h.prev=8,u.s();case 10:if((l=u.n()).done){h.next=17;break}if(c=l.value,!c.execute){h.next=15;break}return h.next=15,c.execute(o);case 15:h.next=10;break;case 17:h.next=22;break;case 19:h.prev=19,h.t0=h.catch(8),u.e(h.t0);case 22:return h.prev=22,u.f(),h.finish(22);case 25:this.engine.endFrame(),this.rendering=!1;case 27:case"end":return h.stop()}},n,this,[[8,19,22,25]])}));function t(){return e.apply(this,arguments)}return t}()},{key:"clear",value:function(t){var n=this;return this.inited?this.engine.clear(t):this.pendings.unshift(function(){n.engine.clear(t),n.pendings.shift()}),this}},{key:"setSize",value:function(t){var n=t.width,i=t.height,a=this.engine.getCanvas();return this.size={width:n,height:i},a.width=n,a.height=i,this}},{key:"getSize",value:function(){return this.size}}]),r}(),gB),dB=Rt(ad.prototype,"engine",[lB],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),vB=Rt(ad.prototype,"shaderModule",[cB],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),pB=Rt(ad.prototype,"configService",[fB],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),ad))||hB),wB,xB,_B,SB=(wB=Gr(),wB(xB=(_B=function(){function r(){Ct(this,r),this.entities=[]}return Gt(r,[{key:"getEntities",value:function(){return this.entities}},{key:"addRenderable",value:function(t){return this.addEntity(t.getEntity()),this}},{key:"removeRenderable",value:function(t){return this.removeEntity(t.getEntity()),this}},{key:"addLight",value:function(){}},{key:"addEntity",value:function(t){return this.entities.indexOf(t)===-1&&this.entities.push(t),this}},{key:"removeEntity",value:function(t){var n=this.entities.indexOf(t);return this.entities.splice(n,1),this}}]),r}(),_B))||xB),EB,AB,TB,IB=(EB=Gr(),EB(AB=(TB=function(){function r(){Ct(this,r),this.cache={}}return Gt(r,[{key:"get",value:function(t){return this.cache[t]}},{key:"set",value:function(t,n){this.cache[t]=n}}]),r}(),TB))||AB),CB,MB,kB,DB,gy,LB,NB,OB;function PB(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function RB(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?PB(Object(t),!0).forEach(function(n){Ie(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):PB(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var BB=(CB=Gr(),MB=Bt(IB),kB=Bt(Pe.RenderEngine),CB(DB=(gy=(OB=function(){function r(){Ct(this,r),Pt(this,"textureCache",LB,this),Pt(this,"engine",NB,this),this.config=void 0,this.loaded=!1,this.texture=void 0}return Gt(r,[{key:"setConfig",value:function(t){this.config=t}},{key:"isLoaded",value:function(){return this.loaded}},{key:"load",value:function(){var e=Rr(_t.mark(function n(){var i=this;return _t.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(!this.config.url){o.next=4;break}return o.abrupt("return",new Promise(function(s,u){var l=i.textureCache.get(i.config.url);if(l)s(l);else{var c=new Image;c.crossOrigin="Anonymous",c.src=i.config.url,c.onload=function(){var f=i.engine.createTexture2D(RB(RB({},i.config),{},{data:c,width:c.width,height:c.height,flipY:!0}));i.textureCache.set(i.config.url,f),i.texture=f,i.loaded=!0,s(f)},c.onerror=function(){u()}}}));case 4:return this.loaded=!0,this.texture=this.engine.createTexture2D(this.config),o.abrupt("return",this.texture);case 7:case"end":return o.stop()}},n,this)}));function t(){return e.apply(this,arguments)}return t}()}]),r}(),OB),LB=Rt(gy.prototype,"textureCache",[MB],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),NB=Rt(gy.prototype,"engine",[kB],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),gy))||DB),FB,UB,GB,zB,ux,$B,VB,jB=(FB=Gr(),UB=Bt(Pe.Systems),GB=yo(Pe.RendererSystem),FB(zB=(ux=(VB=function(){function r(){Ct(this,r),Pt(this,"rendererSystem",$B,this),this.camera=void 0,this.scene=void 0,this.viewport={x:0,y:0,width:0,height:0},this.clearColor=[1,1,1,1]}return Gt(r,[{key:"getCamera",value:function(){return this.camera}},{key:"getScene",value:function(){return this.scene}},{key:"getViewport",value:function(){return this.viewport}},{key:"getClearColor",value:function(){return this.clearColor}},{key:"setCamera",value:function(t){return this.camera=t,this}},{key:"setScene",value:function(t){return this.scene=t,this}},{key:"setViewport",value:function(t){return this.viewport=t,this}},{key:"setClearColor",value:function(t){return this.clearColor=t,this}},{key:"pick",value:function(t){return this.rendererSystem.pick(t,this)}}]),r}(),VB),$B=Rt(ux.prototype,"rendererSystem",[UB,GB],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),ux))||zB),WB,XB,YB,lx,HB,qB;function KB(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function wle(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?KB(Object(t),!0).forEach(function(n){Ie(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):KB(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var yy=(WB=Gr(),XB=Bt(Pe.ConfigService),WB(YB=(lx=(qB=function(){function r(){Ct(this,r),Pt(this,"configService",HB,this),this.container=void 0}return Gt(r,[{key:"getEngine",value:function(){var e=Rr(_t.mark(function n(){var i,a,o,s;return _t.wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return i=this.container.get(Pe.RenderEngine),a=this.configService.get(),o=a.canvas,s=a.engineOptions,l.next=4,i.init(wle({canvas:o||tP(),swapChainFormat:rt.TextureFormat.BGRA8Unorm,antialiasing:!1},s));case 4:return l.abrupt("return",i);case 5:case"end":return l.stop()}},n,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:"getTransformComponent",value:function(t){var n=this.container.get(Pe.TransformComponentManager);return n.getComponentByEntity(t)}},{key:"getMeshComponent",value:function(t){var n=this.container.get(Pe.MeshComponentManager);return n.getComponentByEntity(t)}},{key:"setConfig",value:function(t){this.configService.set(t)}},{key:"setContainer",value:function(t){this.container=t}},{key:"getContainer",value:function(){return this.container}},{key:"createEntity",value:function(){return go()}},{key:"createScene",value:function(){return this.container.get(SB)}},{key:"createCamera",value:function(){return this.container.get(qO)}},{key:"createView",value:function(){return this.container.get(jB)}},{key:"createRenderable",value:function(t,n){var i=t?this.container.getNamed(Pe.Renderable,t):this.container.get(Hs),a=go();return i.setConfig(n||{}),i.setEntity(a),i}},{key:"createGeometry",value:function(t,n){var i=this.container.getNamed(Pe.Geometry,t),a=go();return i.setConfig(n||{}),i.setEntity(a),i.getComponent()}},{key:"createMaterial",value:function(t,n){var i=this.container.getNamed(Pe.Material,t),a=go();return i.setConfig(n||{}),i.setEntity(a,t),i.getComponent()}},{key:"createTexture2D",value:function(t){var n=this.container.get(BB);return n.setConfig(t),n}},{key:"createBufferGeometry",value:function(t){var n=this.container.getNamed(Pe.Systems,Pe.GeometrySystem);return n.createBufferGeometry(t)}},{key:"createInstancedBufferGeometry",value:function(t){var n=this.container.getNamed(Pe.Systems,Pe.GeometrySystem);return n.createInstancedBufferGeometry(t)}},{key:"createShaderMaterial",value:function(t){var n=this.container.getNamed(Pe.Systems,Pe.MaterialSystem);return n.createShaderMaterial(t)}},{key:"createKernel",value:function(t){var n=this.container.get(hP);return typeof t=="string"?n.setBundle(JSON.parse(t)):n.setBundle(t),n.init(),n}},{key:"createRenderer",value:function(){var t=this.container.get(bB);return t.container=this.container,t.init(),t}},{key:"destroy",value:function(){var t=this.container.getAll(Pe.Systems);t.forEach(function(a){a.tearDown&&a.tearDown()});var n=this.container.get(Pe.RenderEngine);n.destroy();var i=this.container.get(Pe.InteractorService);i.destroy()}}],[{key:"create",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=pae(),i=navigator.gpu?fse:Xoe;n.isBound(Pe.RenderEngine)||n.bind(Pe.RenderEngine).to(i).inSingletonScope(),n.bind(bB).toSelf(),n.bind(hP).toSelf(),n.bind(Hs).toSelf(),n.bind(jB).toSelf(),n.bind(qO).toSelf(),n.bind(SB).toSelf(),n.bind(r).toSelf(),n.bind(IB).toSelf(),n.bind(BB).toSelf(),n.bind(Pe.Geometry).to(vse).whenTargetNamed(Ys.BOX),n.bind(Pe.Geometry).to(Ese).whenTargetNamed(Ys.SPHERE),n.bind(Pe.Geometry).to(xse).whenTargetNamed(Ys.PLANE),n.bind(Pe.Geometry).to(mse).whenTargetNamed(Ys.MERGED),n.bind(Pe.Material).to(Dse).whenTargetNamed(bP.BASIC),n.bind(Pe.Renderable).to(dle).whenTargetNamed(Hs.POINT),n.bind(Pe.Renderable).to(ale).whenTargetNamed(Hs.LINE),n.bind(Pe.Renderable).to(Rse).whenTargetNamed(Hs.GRID);var a=n.get(r);return a.setContainer(n),a.setConfig(t),a}}]),r}(),qB),HB=Rt(lx.prototype,"configService",[XB],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),lx))||YB);const Nc=(r,e)=>{let t;return r?gt(r)?t=()=>r:t=r:t=()=>e||1,t},xle=(r,e)=>{const t=[],n=[],i={};let a=0;for(a=0;a<r.length;a++){const s=r[a];i[s.id]=a,t.push(s.x),t.push(s.y),t.push(0),t.push(0),n.push([])}for(a=0;a<e.length;a++){const s=e[a],u=Pr(s,"source"),l=Pr(s,"target");n[i[u]].push(i[l]),n[i[l]].push(i[u])}let o=0;for(a=0;a<r.length;a++){const s=t.length,u=n[a],l=u.length;t[a*4+2]=s,t[a*4+3]=u.length,o=Math.max(o,u.length);for(let c=0;c<l;++c){const f=u[c];t.push(+f)}}for(;t.length%4!=0;)t.push(0);return{maxEdgePerVetex:o,array:new Float32Array(t)}},_le=(r,e,t,n)=>{const i=[],a=[],o={};let s=0;for(s=0;s<r.length;s++){const l=r[s];o[l.id]=s,i.push(l.x),i.push(l.y),i.push(0),i.push(0),a.push([])}for(s=0;s<e.length;s++){const l=e[s],c=Pr(l,"source"),f=Pr(l,"target");a[o[c]].push(o[f]),a[o[c]].push(t(l)),a[o[c]].push(n(l)),a[o[c]].push(0),a[o[f]].push(o[c]),a[o[f]].push(t(l)),a[o[f]].push(n(l)),a[o[f]].push(0)}let u=0;for(s=0;s<r.length;s++){const l=i.length,c=a[s],f=c.length;i[s*4+2]=l+1048576*f/4,i[s*4+3]=0,u=Math.max(u,f/4);for(let d=0;d<f;++d){const h=c[d];i.push(+h)}}for(;i.length%4!=0;)i.push(0);return{maxEdgePerVetex:u,array:new Float32Array(i)}},Sle=(r,e)=>{const t=[],n=r.length,i={};return e.forEach(a=>{r.forEach((o,s)=>{if(i[a[o]]===void 0&&(i[a[o]]=Object.keys(i).length),t.push(i[a[o]]),s===n-1)for(;t.length%4!=0;)t.push(0)})}),{array:new Float32Array(t),count:Object.keys(i).length}},ZB=r=>{const e=[],t=r.length,n=r[0].length;for(let i=0;i<n;i++)r.forEach((a,o)=>{if(e.push(a[i]),o===t-1)for(;e.length%4!=0;)e.push(0)});return new Float32Array(e)},Ele='{"shaders":{"WGSL":"import \\"GLSL.std.450\\" as std;\\n\\n\\n# var gWebGPUDebug : bool = false;\\n# var gWebGPUDebugOutput : vec4<f32> = vec4<f32>(0.0);\\n\\n[[builtin global_invocation_id]] var<in> globalInvocationID : vec3<u32>;\\n# [[builtin work_group_size]] var<in> workGroupSize : vec3<u32>;\\n# [[builtin work_group_id]] var<in> workGroupID : vec3<u32>;\\n[[builtin local_invocation_id]] var<in> localInvocationID : vec3<u32>;\\n# [[builtin num_work_groups]] var<in> numWorkGroups : vec3<u32>;\\n[[builtin local_invocation_idx]] var<in> localInvocationIndex : u32;\\n\\ntype GWebGPUParams = [[block]] struct {\\n  [[offset 0]] u_K : f32;\\n  [[offset 4]] u_K2 : f32;\\n  [[offset 8]] u_Center : vec2<f32>;\\n  [[offset 16]] u_Gravity : f32;\\n  [[offset 20]] u_ClusterGravity : f32;\\n  [[offset 24]] u_Speed : f32;\\n  [[offset 28]] u_MaxDisplace : f32;\\n  [[offset 32]] u_Clustering : f32;\\n};\\n[[binding 0, set 0]] var<uniform> gWebGPUUniformParams : GWebGPUParams;\\ntype GWebGPUBuffer0 = [[block]] struct {\\n  [[offset 0]] u_Data : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 1, set 0]] var<storage_buffer> gWebGPUBuffer0 : GWebGPUBuffer0;\\ntype GWebGPUBuffer1 = [[block]] struct {\\n  [[offset 0]] u_AttributeArray : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 2, set 0]] var<storage_buffer> gWebGPUBuffer1 : GWebGPUBuffer1;\\ntype GWebGPUBuffer2 = [[block]] struct {\\n  [[offset 0]] u_ClusterCenters : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 3, set 0]] var<storage_buffer> gWebGPUBuffer2 : GWebGPUBuffer2;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nfn calcRepulsive(i : i32, currentNode : vec4<f32>) -> vec2<f32> {var dx : f32 = 0.0;\\nvar dy : f32 = 0.0;\\nfor (var j : i32 = 0; j < __DefineValuePlaceholder__VERTEX_COUNT; j = j + 1) {if (i != j) {var nextNode : vec4<f32> = gWebGPUBuffer0.u_Data[j];\\nvar xDist : f32 = currentNode.x - nextNode.x;\\nvar yDist : f32 = currentNode.y - nextNode.y;\\nvar dist : f32 = ((xDist * xDist) + (yDist * yDist)) + 0.01;\\nvar param : f32 = gWebGPUUniformParams.u_K2 / dist;\\nif (dist > 0.0) {dx = dx + param * xDist;\\ndy = dy + param * yDist;\\nif ((xDist == 0.0) && (yDist == 0.0)) {var sign : f32 = select(1.0, -1.0, i < j);\\ndx = dx + param * std::sign;\\ndy = dy + param * std::sign;}}}}\\nreturn vec2<f32>(dx, dy);}\\nfn calcGravity(currentNode : vec4<f32>, nodeAttributes : vec4<f32>) -> vec2<f32> {var dx : f32 = 0.0;\\nvar dy : f32 = 0.0;\\nvar vx : f32 = currentNode.x - gWebGPUUniformParams.u_Center.x;\\nvar vy : f32 = currentNode.y - gWebGPUUniformParams.u_Center.y;\\nvar gf : f32 = (0.01 * gWebGPUUniformParams.u_K) * gWebGPUUniformParams.u_Gravity;\\ndx = gf * vx;\\ndy = gf * vy;\\nif (gWebGPUUniformParams.u_Clustering == 1.0) {var clusterIdx : i32 = i32(nodeAttributes.x);\\nvar center : vec4<f32> = gWebGPUBuffer2.u_ClusterCenters[clusterIdx];\\nvar cvx : f32 = currentNode.x - center.x;\\nvar cvy : f32 = currentNode.y - center.y;\\nvar dist : f32 = std::sqrt((cvx * cvx) + (cvy * cvy)) + 0.01;\\nvar parma : f32 = (gWebGPUUniformParams.u_K * gWebGPUUniformParams.u_ClusterGravity) / dist;\\ndx = dx + parma * cvx;\\ndy = dy + parma * cvy;}\\nreturn vec2<f32>(dx, dy);}\\nfn calcAttractive(i : i32, currentNode : vec4<f32>) -> vec2<f32> {var dx : f32 = 0.0;\\nvar dy : f32 = 0.0;\\nvar arr_offset : i32 = i32(std::floor(currentNode.z + 0.5));\\nvar length : i32 = i32(std::floor(currentNode.w + 0.5));\\nvar node_buffer : vec4<f32>;\\nfor (var p : i32 = 0; p < __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX; p = p + 1) {if (p >= length) {break;}\\nvar arr_idx : i32 = arr_offset + i32(p);\\nvar buf_offset : i32 = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = gWebGPUBuffer0.u_Data[i32(arr_idx / 4)];}\\nvar float_j : f32 = select(node_buffer.x, select(node_buffer.y, select(node_buffer.z, node_buffer.w, buf_offset == 2), buf_offset == 1), buf_offset == 0);\\nvar nextNode : vec4<f32> = gWebGPUBuffer0.u_Data[i32(float_j)];\\nvar xDist : f32 = currentNode.x - nextNode.x;\\nvar yDist : f32 = currentNode.y - nextNode.y;\\nvar dist : f32 = std::sqrt((xDist * xDist) + (yDist * yDist)) + 0.01;\\nvar attractiveF : f32 = dist / gWebGPUUniformParams.u_K;\\nif (dist > 0.0) {dx = dx - xDist * attractiveF;\\ndy = dy - yDist * attractiveF;\\nif ((xDist == 0.0) && (yDist == 0.0)) {var sign : f32 = select(1.0, -1.0, i < i32(float_j));\\ndx = dx - std::sign * attractiveF;\\ndy = dy - std::sign * attractiveF;}}}\\nreturn vec2<f32>(dx, dy);}\\nfn main() -> void {var i : i32 = globalInvocationID.x;\\nvar currentNode : vec4<f32> = gWebGPUBuffer0.u_Data[i];\\nvar dx : f32 = 0.0;\\nvar dy : f32 = 0.0;\\nif (i >= __DefineValuePlaceholder__VERTEX_COUNT) {gWebGPUBuffer0.u_Data[i] = currentNode;\\nreturn ;}\\nvar nodeAttributes : vec4<f32> = gWebGPUBuffer1.u_AttributeArray[i];\\nif ((nodeAttributes.y != 0.0) && (nodeAttributes.z != 0.0)) {gWebGPUBuffer0.u_Data[i] = vec4<f32>(nodeAttributes.y, nodeAttributes.z, currentNode.z, currentNode.w);\\nreturn ;}\\nvar repulsive : vec2<f32> = calcRepulsive(i, currentNode);\\ndx = dx + repulsive.x;\\ndy = dy + repulsive.y;\\nvar attractive : vec2<f32> = calcAttractive(i, currentNode);\\ndx = dx + attractive.x;\\ndy = dy + attractive.y;\\nvar gravity : vec2<f32> = calcGravity(currentNode, nodeAttributes);\\ndx = dx - gravity.x;\\ndy = dy - gravity.y;\\ndx = dx * gWebGPUUniformParams.u_Speed;\\ndy = dy * gWebGPUUniformParams.u_Speed;\\nvar distLength : f32 = std::sqrt((dx * dx) + (dy * dy));\\nif (distLength > 0.0) {var limitedDist : f32 = std::min(gWebGPUUniformParams.u_MaxDisplace * gWebGPUUniformParams.u_Speed, distLength);\\ngWebGPUBuffer0.u_Data[i] = vec4<f32>(currentNode.x + ((dx / distLength) * limitedDist), currentNode.y + ((dy / distLength) * limitedDist), currentNode.z, currentNode.w);}\\nreturn;}\\n\\nentry_point compute as \\"main\\" = main;\\n","GLSL450":"\\n\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\nivec3 globalInvocationID = ivec3(gl_GlobalInvocationID);\\nivec3 workGroupSize = ivec3(1,1,1);\\nivec3 workGroupID = ivec3(gl_WorkGroupID);\\nivec3 localInvocationID = ivec3(gl_LocalInvocationID);\\nivec3 numWorkGroups = ivec3(gl_NumWorkGroups);\\nint localInvocationIndex = int(gl_LocalInvocationIndex);\\n\\nlayout(std140, set = 0, binding = 0) uniform GWebGPUParams {\\n  float u_K;\\n  float u_K2;\\n  vec2 u_Center;\\n  float u_Gravity;\\n  float u_ClusterGravity;\\n  float u_Speed;\\n  float u_MaxDisplace;\\n  float u_Clustering;\\n} gWebGPUUniformParams;\\nlayout(std430, set = 0, binding = 1) buffer   GWebGPUBuffer0 {\\n  vec4 u_Data[];\\n} gWebGPUBuffer0;\\n\\nlayout(std430, set = 0, binding = 2) buffer readonly  GWebGPUBuffer1 {\\n  vec4 u_AttributeArray[];\\n} gWebGPUBuffer1;\\n\\nlayout(std430, set = 0, binding = 3) buffer readonly  GWebGPUBuffer2 {\\n  vec4 u_ClusterCenters[];\\n} gWebGPUBuffer2;\\n\\n\\n\\n#define MAX_EDGE_PER_VERTEX __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\nlayout (\\n  local_size_x = 1,\\n  local_size_y = 1,\\n  local_size_z = 1\\n) in;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nvec2 calcRepulsive(int i, vec4 currentNode) {float dx = 0.0;\\nfloat dy = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {if (i != j) {vec4 nextNode = gWebGPUBuffer0.u_Data[j];\\nfloat xDist = currentNode.x - nextNode.x;\\nfloat yDist = currentNode.y - nextNode.y;\\nfloat dist = ((xDist * xDist) + (yDist * yDist)) + 0.01;\\nfloat param = gWebGPUUniformParams.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) {float dx = 0.0;\\nfloat dy = 0.0;\\nfloat vx = currentNode.x - gWebGPUUniformParams.u_Center.x;\\nfloat vy = currentNode.y - gWebGPUUniformParams.u_Center.y;\\nfloat gf = (0.01 * gWebGPUUniformParams.u_K) * gWebGPUUniformParams.u_Gravity;\\ndx = gf * vx;\\ndy = gf * vy;\\nif (gWebGPUUniformParams.u_Clustering == 1.0) {int clusterIdx = int(nodeAttributes.x);\\nvec4 center = gWebGPUBuffer2.u_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 = (gWebGPUUniformParams.u_K * gWebGPUUniformParams.u_ClusterGravity) / dist;\\ndx += parma * cvx;\\ndy += parma * cvy;}\\nreturn vec2(dx, dy);}\\nvec2 calcAttractive(int i, vec4 currentNode) {float 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 = gWebGPUBuffer0.u_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 = gWebGPUBuffer0.u_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 / gWebGPUUniformParams.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() {int i = globalInvocationID.x;\\nvec4 currentNode = gWebGPUBuffer0.u_Data[i];\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nif (i >= VERTEX_COUNT) {gWebGPUBuffer0.u_Data[i] = currentNode;\\nreturn ;}\\nvec4 nodeAttributes = gWebGPUBuffer1.u_AttributeArray[i];\\nif ((nodeAttributes.y != 0.0) && (nodeAttributes.z != 0.0)) {gWebGPUBuffer0.u_Data[i] = 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 *= gWebGPUUniformParams.u_Speed;\\ndy *= gWebGPUUniformParams.u_Speed;\\nfloat distLength = sqrt((dx * dx) + (dy * dy));\\nif (distLength > 0.0) {float limitedDist = min(gWebGPUUniformParams.u_MaxDisplace * gWebGPUUniformParams.u_Speed, distLength);\\ngWebGPUBuffer0.u_Data[i] = vec4(currentNode.x + ((dx / distLength) * limitedDist), currentNode.y + ((dy / distLength) * limitedDist), currentNode.z, currentNode.w);}}\\n","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}}',Ale='{"shaders":{"WGSL":"import \\"GLSL.std.450\\" as std;\\n\\n\\n# var gWebGPUDebug : bool = false;\\n# var gWebGPUDebugOutput : vec4<f32> = vec4<f32>(0.0);\\n\\n[[builtin global_invocation_id]] var<in> globalInvocationID : vec3<u32>;\\n# [[builtin work_group_size]] var<in> workGroupSize : vec3<u32>;\\n# [[builtin work_group_id]] var<in> workGroupID : vec3<u32>;\\n[[builtin local_invocation_id]] var<in> localInvocationID : vec3<u32>;\\n# [[builtin num_work_groups]] var<in> numWorkGroups : vec3<u32>;\\n[[builtin local_invocation_idx]] var<in> localInvocationIndex : u32;\\n\\n\\ntype GWebGPUBuffer0 = [[block]] struct {\\n  [[offset 0]] u_Data : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 0, set 0]] var<storage_buffer> gWebGPUBuffer0 : GWebGPUBuffer0;\\ntype GWebGPUBuffer1 = [[block]] struct {\\n  [[offset 0]] u_NodeAttributes : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 1, set 0]] var<storage_buffer> gWebGPUBuffer1 : GWebGPUBuffer1;\\ntype GWebGPUBuffer2 = [[block]] struct {\\n  [[offset 0]] u_ClusterCenters : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 2, set 0]] var<storage_buffer> gWebGPUBuffer2 : GWebGPUBuffer2;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nfn main() -> void {var i : i32 = globalInvocationID.x;\\nvar center : vec4<f32> = gWebGPUBuffer2.u_ClusterCenters[i];\\nvar sumx : f32 = 0.0;\\nvar sumy : f32 = 0.0;\\nvar count : f32 = 0.0;\\nfor (var j : i32 = 0; j < __DefineValuePlaceholder__VERTEX_COUNT; j = j + 1) {var attributes : vec4<f32> = gWebGPUBuffer1.u_NodeAttributes[j];\\nvar clusterIdx : i32 = i32(attributes.x);\\nvar vertex : vec4<f32> = gWebGPUBuffer0.u_Data[j];\\nif (clusterIdx == i) {sumx = sumx + vertex.x;\\nsumy = sumy + vertex.y;\\ncount = count + 1.0;}}\\ngWebGPUBuffer2.u_ClusterCenters[i] = vec4<f32>(sumx / count, sumy / count, count, i);\\nreturn;}\\n\\nentry_point compute as \\"main\\" = main;\\n","GLSL450":"\\n\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\nivec3 globalInvocationID = ivec3(gl_GlobalInvocationID);\\nivec3 workGroupSize = ivec3(1,1,1);\\nivec3 workGroupID = ivec3(gl_WorkGroupID);\\nivec3 localInvocationID = ivec3(gl_LocalInvocationID);\\nivec3 numWorkGroups = ivec3(gl_NumWorkGroups);\\nint localInvocationIndex = int(gl_LocalInvocationIndex);\\n\\n\\nlayout(std430, set = 0, binding = 0) buffer readonly  GWebGPUBuffer0 {\\n  vec4 u_Data[];\\n} gWebGPUBuffer0;\\n\\nlayout(std430, set = 0, binding = 1) buffer readonly  GWebGPUBuffer1 {\\n  vec4 u_NodeAttributes[];\\n} gWebGPUBuffer1;\\n\\nlayout(std430, set = 0, binding = 2) buffer   GWebGPUBuffer2 {\\n  vec4 u_ClusterCenters[];\\n} gWebGPUBuffer2;\\n\\n\\n\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n#define CLUSTER_COUNT __DefineValuePlaceholder__CLUSTER_COUNT\\nlayout (\\n  local_size_x = 1,\\n  local_size_y = 1,\\n  local_size_z = 1\\n) in;\\n\\n\\n\\nvoid main() {int i = globalInvocationID.x;\\nvec4 center = gWebGPUBuffer2.u_ClusterCenters[i];\\nfloat sumx = 0.0;\\nfloat sumy = 0.0;\\nfloat count = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {vec4 attributes = gWebGPUBuffer1.u_NodeAttributes[j];\\nint clusterIdx = int(attributes.x);\\nvec4 vertex = gWebGPUBuffer0.u_Data[j];\\nif (clusterIdx == i) {sumx += vertex.x;\\nsumy += vertex.y;\\ncount += 1.0;}}\\ngWebGPUBuffer2.u_ClusterCenters[i] = vec4(sumx / count, sumy / count, count, i);}\\n","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 my=globalThis&&globalThis.__awaiter||function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function s(c){try{l(n.next(c))}catch(f){o(f)}}function u(c){try{l(n.throw(c))}catch(f){o(f)}}function l(c){c.done?a(c.value):i(c.value).then(s,u)}l((n=n.apply(r,e||[])).next())})};class Tle extends Ci{constructor(e){super();this.maxIteration=1e3,this.gravity=10,this.speed=1,this.clustering=!1,this.clusterField="cluster",this.clusterGravity=10,this.workerEnabled=!1,this.nodes=[],this.edges=[],this.width=300,this.height=300,this.nodeMap={},this.nodeIdxMap={},this.updateCfg(e)}getDefaultCfg(){return{maxIteration:1e3,gravity:10,speed:1,clustering:!1,clusterGravity:10}}execute(){return my(this,void 0,void 0,function*(){const e=this,t=e.nodes;if(!t||t.length===0){e.onLayoutEnd&&e.onLayoutEnd();return}!e.width&&typeof window!="undefined"&&(e.width=window.innerWidth),!e.height&&typeof window!="undefined"&&(e.height=window.innerHeight),e.center||(e.center=[e.width/2,e.height/2]);const n=e.center;if(t.length===1){t[0].x=n[0],t[0].y=n[1],e.onLayoutEnd&&e.onLayoutEnd();return}const i={},a={};t.forEach((o,s)=>{gt(o.x)||(o.x=Math.random()*this.width),gt(o.y)||(o.y=Math.random()*this.height),i[o.id]=o,a[o.id]=s}),e.nodeMap=i,e.nodeIdxMap=a,yield e.run()})}executeWithWorker(e,t){return my(this,void 0,void 0,function*(){const n=this,i=n.nodes,a=n.center;if(!i||i.length===0)return;if(i.length===1){i[0].x=a[0],i[0].y=a[1];return}const o={},s={};i.forEach((u,l)=>{gt(u.x)||(u.x=Math.random()*this.width),gt(u.y)||(u.y=Math.random()*this.height),o[u.id]=u,s[u.id]=l}),n.nodeMap=o,n.nodeIdxMap=s,yield n.run(e,t)})}run(e,t){return my(this,void 0,void 0,function*(){const n=this,i=n.nodes,a=n.edges,o=n.maxIteration,s=n.center,u=n.height*n.width;let l=Math.sqrt(u)/10;const c=u/(i.length+1),f=Math.sqrt(c),d=n.speed,h=n.clustering,{array:v,count:p}=Sle([n.clusterField],i);i.forEach((S,C)=>{let T=0,k=0;gt(S.fx)&&gt(S.fy)&&(T=S.fx||.001,k=S.fy||.001),v[4*C+1]=T,v[4*C+2]=k});const g=i.length,{maxEdgePerVetex:y,array:m}=xle(i,a),b=n.workerEnabled;let w;b?w=yy.create({canvas:e,engineOptions:{supportCompute:!0}}):w=yy.create({engineOptions:{supportCompute:!0}});const x=n.onLayoutEnd,_=[];for(let S=0;S<p;S++)_.push(0,0,0,0);const A=w.createKernel(Ele).setDispatch([g,1,1]).setBinding({u_Data:m,u_K:f,u_K2:c,u_Gravity:n.gravity,u_ClusterGravity:n.clusterGravity||n.gravity||1,u_Speed:d,u_MaxDisplace:l,u_Clustering:h?1:0,u_Center:s,u_AttributeArray:v,u_ClusterCenters:_,MAX_EDGE_PER_VERTEX:y,VERTEX_COUNT:g});let I;h&&(I=w.createKernel(Ale).setDispatch([p,1,1]).setBinding({u_Data:m,u_NodeAttributes:v,u_ClusterCenters:_,VERTEX_COUNT:g,CLUSTER_COUNT:p})),yield(()=>my(this,void 0,void 0,function*(){for(let C=0;C<o;C++)yield A.execute(),h&&(I.setBinding({u_Data:A}),yield I.execute(),A.setBinding({u_ClusterCenters:I})),A.setBinding({u_MaxDisplace:l*=.99});const S=yield A.getOutput();e?t.postMessage({type:bw.GPUEND,vertexEdgeData:S}):i.forEach((C,T)=>{const k=S[4*T],L=S[4*T+1];C.x=k,C.y=L}),x&&x()}))()})}getType(){return"fruchterman-gpu"}}const Ile='{"shaders":{"WGSL":"import \\"GLSL.std.450\\" as std;\\n\\n\\n# var gWebGPUDebug : bool = false;\\n# var gWebGPUDebugOutput : vec4<f32> = vec4<f32>(0.0);\\n\\n[[builtin global_invocation_id]] var<in> globalInvocationID : vec3<u32>;\\n# [[builtin work_group_size]] var<in> workGroupSize : vec3<u32>;\\n# [[builtin work_group_id]] var<in> workGroupID : vec3<u32>;\\n[[builtin local_invocation_id]] var<in> localInvocationID : vec3<u32>;\\n# [[builtin num_work_groups]] var<in> numWorkGroups : vec3<u32>;\\n[[builtin local_invocation_idx]] var<in> localInvocationIndex : u32;\\n\\ntype GWebGPUParams = [[block]] struct {\\n  [[offset 0]] u_damping : f32;\\n  [[offset 4]] u_maxSpeed : f32;\\n  [[offset 8]] u_minMovement : f32;\\n  \\n  [[offset 12]] u_coulombDisScale : f32;\\n  [[offset 16]] u_factor : f32;\\n  \\n  \\n  [[offset 20]] u_interval : f32;\\n};\\n[[binding 0, set 0]] var<uniform> gWebGPUUniformParams : GWebGPUParams;\\ntype GWebGPUBuffer0 = [[block]] struct {\\n  [[offset 0]] u_Data : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 1, set 0]] var<storage_buffer> gWebGPUBuffer0 : GWebGPUBuffer0;\\ntype GWebGPUBuffer1 = [[block]] struct {\\n  [[offset 0]] u_AveMovement : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 2, set 0]] var<storage_buffer> gWebGPUBuffer1 : GWebGPUBuffer1;\\ntype GWebGPUBuffer2 = [[block]] struct {\\n  [[offset 0]] u_NodeAttributeArray1 : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 3, set 0]] var<storage_buffer> gWebGPUBuffer2 : GWebGPUBuffer2;\\ntype GWebGPUBuffer3 = [[block]] struct {\\n  [[offset 0]] u_NodeAttributeArray2 : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 4, set 0]] var<storage_buffer> gWebGPUBuffer3 : GWebGPUBuffer3;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nfn unpack_float(packedValue : f32) -> vec2<i32> {var packedIntValue : i32 = i32(packedValue);\\nvar v0 : i32 = packedIntValue / 1048576;\\nreturn vec2<i32>(v0, packedIntValue - (v0 * 1048576));}\\nfn calcRepulsive(i : i32, currentNode : vec4<f32>) -> vec2<f32> {var ax : f32 = 0.0;\\nvar ay : f32 = 0.0;\\nfor (var j : i32 = 0; j < __DefineValuePlaceholder__VERTEX_COUNT; j = j + 1) {if (i != j) {var nextNode : vec4<f32> = gWebGPUBuffer0.u_Data[j];\\nvar vx : f32 = currentNode.x - nextNode.x;\\nvar vy : f32 = currentNode.y - nextNode.y;\\nvar dist : f32 = std::sqrt((vx * vx) + (vy * vy)) + 0.01;\\nvar n_dist : f32 = (dist + 0.1) * gWebGPUUniformParams.u_coulombDisScale;\\nvar direx : f32 = vx / dist;\\nvar direy : f32 = vy / dist;\\nvar attributesi : vec4<f32> = gWebGPUBuffer2.u_NodeAttributeArray1[i];\\nvar attributesj : vec4<f32> = gWebGPUBuffer2.u_NodeAttributeArray1[j];\\nvar massi : f32 = attributesi.x;\\nvar nodeStrengthi : f32 = attributesi.z;\\nvar nodeStrengthj : f32 = attributesj.z;\\nvar nodeStrength : f32 = (nodeStrengthi + nodeStrengthj) / 2.0;\\nvar param : f32 = (nodeStrength * gWebGPUUniformParams.u_factor) / (n_dist * n_dist);\\nax = ax + direx * param;\\nay = ay + direy * param;}}\\nreturn vec2<f32>(ax, ay);}\\nfn calcGravity(i : i32, currentNode : vec4<f32>, attributes2 : vec4<f32>) -> vec2<f32> {var vx : f32 = currentNode.x - attributes2.x;\\nvar vy : f32 = currentNode.y - attributes2.y;\\nvar ax : f32 = vx * attributes2.z;\\nvar ay : f32 = vy * attributes2.z;\\nreturn vec2<f32>(ax, ay);}\\nfn calcAttractive(i : i32, currentNode : vec4<f32>, attributes1 : vec4<f32>) -> vec2<f32> {var mass : f32 = attributes1.x;\\nvar ax : f32 = 0.0;\\nvar ay : f32 = 0.0;\\nvar compressed : vec2<i32> = unpack_float(currentNode.z);\\nvar length : i32 = compressed.x;\\nvar arr_offset : i32 = compressed.y;\\nvar node_buffer : vec4<f32>;\\nfor (var p : i32 = 0; p < __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX; p = p + 1) {if (p >= length) {break;}\\nvar arr_idx : i32 = arr_offset + (4 * p);\\nvar buf_offset : i32 = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = gWebGPUBuffer0.u_Data[i32(arr_idx / 4)];}\\nvar float_j : f32 = node_buffer.x;\\nvar nextNode : vec4<f32> = gWebGPUBuffer0.u_Data[i32(float_j)];\\nvar vx : f32 = nextNode.x - currentNode.x;\\nvar vy : f32 = nextNode.y - currentNode.y;\\nvar dist : f32 = std::sqrt((vx * vx) + (vy * vy)) + 0.01;\\nvar direx : f32 = vx / dist;\\nvar direy : f32 = vy / dist;\\nvar edgeLength : f32 = node_buffer.y;\\nvar edgeStrength : f32 = node_buffer.z;\\nvar diff : f32 = edgeLength - dist;\\nvar param : f32 = (diff * edgeStrength) / mass;\\nax = ax - direx * param;\\nay = ay - direy * param;}\\nreturn vec2<f32>(ax, ay);}\\nfn main() -> void {var i : i32 = globalInvocationID.x;\\nvar currentNode : vec4<f32> = gWebGPUBuffer0.u_Data[i];\\nvar movement : vec4<f32> = gWebGPUBuffer1.u_AveMovement[0];\\nvar ax : f32 = 0.0;\\nvar ay : f32 = 0.0;\\nif ((i >= __DefineValuePlaceholder__VERTEX_COUNT) || (movement.x < gWebGPUUniformParams.u_minMovement)) {gWebGPUBuffer0.u_Data[i] = currentNode;\\nreturn ;}\\nvar nodeAttributes1 : vec4<f32> = gWebGPUBuffer2.u_NodeAttributeArray1[i];\\nvar nodeAttributes2 : vec4<f32> = gWebGPUBuffer3.u_NodeAttributeArray2[i];\\nvar repulsive : vec2<f32> = calcRepulsive(i, currentNode);\\nax = ax + repulsive.x;\\nay = ay + repulsive.y;\\nvar attractive : vec2<f32> = calcAttractive(i, currentNode, nodeAttributes1);\\nax = ax + attractive.x;\\nay = ay + attractive.y;\\nvar gravity : vec2<f32> = calcGravity(i, currentNode, nodeAttributes2);\\nax = ax - gravity.x;\\nay = ay - gravity.y;\\nvar param : f32 = gWebGPUUniformParams.u_interval * gWebGPUUniformParams.u_damping;\\nvar vx : f32 = ax * param;\\nvar vy : f32 = ay * param;\\nvar vlength : f32 = std::sqrt((vx * vx) + (vy * vy)) + 0.0001;\\nif (vlength > gWebGPUUniformParams.u_maxSpeed) {var param2 : f32 = gWebGPUUniformParams.u_maxSpeed / vlength;\\nvx = param2 * vx;\\nvy = param2 * vy;}\\nvar distx : f32 = vx * gWebGPUUniformParams.u_interval;\\nvar disty : f32 = vy * gWebGPUUniformParams.u_interval;\\nvar distLength : f32 = std::sqrt((distx * distx) + (disty * disty));\\nif ((nodeAttributes1.w != 0.0) && (nodeAttributes2.w != 0.0)) {gWebGPUBuffer0.u_Data[i] = vec4<f32>(nodeAttributes1.w, nodeAttributes2.w, currentNode.z, 0.0);}else {gWebGPUBuffer0.u_Data[i] = vec4<f32>(currentNode.x + distx, currentNode.y + disty, currentNode.z, distLength);}\\nreturn;}\\n\\nentry_point compute as \\"main\\" = main;\\n","GLSL450":"\\n\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\nivec3 globalInvocationID = ivec3(gl_GlobalInvocationID);\\nivec3 workGroupSize = ivec3(1,1,1);\\nivec3 workGroupID = ivec3(gl_WorkGroupID);\\nivec3 localInvocationID = ivec3(gl_LocalInvocationID);\\nivec3 numWorkGroups = ivec3(gl_NumWorkGroups);\\nint localInvocationIndex = int(gl_LocalInvocationIndex);\\n\\nlayout(std140, set = 0, binding = 0) uniform GWebGPUParams {\\n  float u_damping;\\n  float u_maxSpeed;\\n  float u_minMovement;\\n  \\n  float u_coulombDisScale;\\n  float u_factor;\\n  \\n  \\n  float u_interval;\\n} gWebGPUUniformParams;\\nlayout(std430, set = 0, binding = 1) buffer   GWebGPUBuffer0 {\\n  vec4 u_Data[];\\n} gWebGPUBuffer0;\\n\\nlayout(std430, set = 0, binding = 2) buffer readonly  GWebGPUBuffer1 {\\n  vec4 u_AveMovement[];\\n} gWebGPUBuffer1;\\n\\nlayout(std430, set = 0, binding = 3) buffer readonly  GWebGPUBuffer2 {\\n  vec4 u_NodeAttributeArray1[];\\n} gWebGPUBuffer2;\\n\\nlayout(std430, set = 0, binding = 4) buffer readonly  GWebGPUBuffer3 {\\n  vec4 u_NodeAttributeArray2[];\\n} gWebGPUBuffer3;\\n\\n\\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\\nlayout (\\n  local_size_x = 1,\\n  local_size_y = 1,\\n  local_size_z = 1\\n) in;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nivec2 unpack_float(float packedValue) {int packedIntValue = int(packedValue);\\nint v0 = packedIntValue / int(SHIFT_20);\\nreturn ivec2(v0, packedIntValue - (v0 * int(SHIFT_20)));}\\nvec2 calcRepulsive(int i, vec4 currentNode) {float ax = 0.0;\\nfloat ay = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {if (i != j) {vec4 nextNode = gWebGPUBuffer0.u_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) * gWebGPUUniformParams.u_coulombDisScale;\\nfloat direx = vx / dist;\\nfloat direy = vy / dist;\\nvec4 attributesi = gWebGPUBuffer2.u_NodeAttributeArray1[i];\\nvec4 attributesj = gWebGPUBuffer2.u_NodeAttributeArray1[j];\\nfloat massi = attributesi.x;\\nfloat nodeStrengthi = attributesi.z;\\nfloat nodeStrengthj = attributesj.z;\\nfloat nodeStrength = (nodeStrengthi + nodeStrengthj) / 2.0;\\nfloat param = (nodeStrength * gWebGPUUniformParams.u_factor) / (n_dist * n_dist);\\nax += direx * param;\\nay += direy * param;}}\\nreturn vec2(ax, ay);}\\nvec2 calcGravity(int i, vec4 currentNode, vec4 attributes2) {float 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) {float 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 = gWebGPUBuffer0.u_Data[int(arr_idx / 4)];}\\nfloat float_j = node_buffer.x;\\nvec4 nextNode = gWebGPUBuffer0.u_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() {int i = globalInvocationID.x;\\nvec4 currentNode = gWebGPUBuffer0.u_Data[i];\\nvec4 movement = gWebGPUBuffer1.u_AveMovement[0];\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nif ((i >= VERTEX_COUNT) || (movement.x < gWebGPUUniformParams.u_minMovement)) {gWebGPUBuffer0.u_Data[i] = currentNode;\\nreturn ;}\\nvec4 nodeAttributes1 = gWebGPUBuffer2.u_NodeAttributeArray1[i];\\nvec4 nodeAttributes2 = gWebGPUBuffer3.u_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 = gWebGPUUniformParams.u_interval * gWebGPUUniformParams.u_damping;\\nfloat vx = ax * param;\\nfloat vy = ay * param;\\nfloat vlength = sqrt((vx * vx) + (vy * vy)) + 0.0001;\\nif (vlength > gWebGPUUniformParams.u_maxSpeed) {float param2 = gWebGPUUniformParams.u_maxSpeed / vlength;\\nvx = param2 * vx;\\nvy = param2 * vy;}\\nfloat distx = vx * gWebGPUUniformParams.u_interval;\\nfloat disty = vy * gWebGPUUniformParams.u_interval;\\nfloat distLength = sqrt((distx * distx) + (disty * disty));\\nif ((nodeAttributes1.w != 0.0) && (nodeAttributes2.w != 0.0)) {gWebGPUBuffer0.u_Data[i] = vec4(nodeAttributes1.w, nodeAttributes2.w, currentNode.z, 0.0);}else {gWebGPUBuffer0.u_Data[i] = vec4(currentNode.x + distx, currentNode.y + disty, currentNode.z, distLength);}}\\n","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;}\\nfloat distx = vx * u_interval;\\nfloat disty = vy * u_interval;\\nfloat distLength = sqrt((distx * distx) + (disty * disty));\\nif ((nodeAttributes1.w != 0.0) && (nodeAttributes2.w != 0.0)) {gl_FragColor = vec4(vec4(nodeAttributes1.w, nodeAttributes2.w, currentNode.z, 0.0));}else {gl_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}}',Cle='{"shaders":{"WGSL":"import \\"GLSL.std.450\\" as std;\\n\\n\\n# var gWebGPUDebug : bool = false;\\n# var gWebGPUDebugOutput : vec4<f32> = vec4<f32>(0.0);\\n\\n[[builtin global_invocation_id]] var<in> globalInvocationID : vec3<u32>;\\n# [[builtin work_group_size]] var<in> workGroupSize : vec3<u32>;\\n# [[builtin work_group_id]] var<in> workGroupID : vec3<u32>;\\n[[builtin local_invocation_id]] var<in> localInvocationID : vec3<u32>;\\n# [[builtin num_work_groups]] var<in> numWorkGroups : vec3<u32>;\\n[[builtin local_invocation_idx]] var<in> localInvocationIndex : u32;\\n\\ntype GWebGPUParams = [[block]] struct {\\n  [[offset 0]] u_iter : f32;\\n};\\n[[binding 0, set 0]] var<uniform> gWebGPUUniformParams : GWebGPUParams;\\ntype GWebGPUBuffer0 = [[block]] struct {\\n  [[offset 0]] u_Data : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 1, set 0]] var<storage_buffer> gWebGPUBuffer0 : GWebGPUBuffer0;\\ntype GWebGPUBuffer1 = [[block]] struct {\\n  [[offset 0]] u_AveMovement : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 2, set 0]] var<storage_buffer> gWebGPUBuffer1 : GWebGPUBuffer1;\\n\\n\\n\\n\\n\\n\\n\\n\\nfn main() -> void {var movement : f32 = 0.0;\\nfor (var j : i32 = 0; j < __DefineValuePlaceholder__VERTEX_COUNT; j = j + 1) {var vertex : vec4<f32> = gWebGPUBuffer0.u_Data[j];\\nmovement = movement + vertex.w;}\\nmovement = movement / f32(__DefineValuePlaceholder__VERTEX_COUNT);\\ngWebGPUBuffer1.u_AveMovement[0] = vec4<f32>(movement, 0.0, 0.0, 0.0);\\nreturn;}\\n\\nentry_point compute as \\"main\\" = main;\\n","GLSL450":"\\n\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\nivec3 globalInvocationID = ivec3(gl_GlobalInvocationID);\\nivec3 workGroupSize = ivec3(1,1,1);\\nivec3 workGroupID = ivec3(gl_WorkGroupID);\\nivec3 localInvocationID = ivec3(gl_LocalInvocationID);\\nivec3 numWorkGroups = ivec3(gl_NumWorkGroups);\\nint localInvocationIndex = int(gl_LocalInvocationIndex);\\n\\nlayout(std140, set = 0, binding = 0) uniform GWebGPUParams {\\n  float u_iter;\\n} gWebGPUUniformParams;\\nlayout(std430, set = 0, binding = 1) buffer readonly  GWebGPUBuffer0 {\\n  vec4 u_Data[];\\n} gWebGPUBuffer0;\\n\\nlayout(std430, set = 0, binding = 2) buffer   GWebGPUBuffer1 {\\n  vec4 u_AveMovement[];\\n} gWebGPUBuffer1;\\n\\n\\n\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\nlayout (\\n  local_size_x = 1,\\n  local_size_y = 1,\\n  local_size_z = 1\\n) in;\\n\\n\\n\\nvoid main() {float movement = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {vec4 vertex = gWebGPUBuffer0.u_Data[j];\\nmovement += vertex.w;}\\nmovement = movement / float(VERTEX_COUNT);\\ngWebGPUBuffer1.u_AveMovement[0] = vec4(movement, 0.0, 0.0, 0.0);}\\n","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 cx=globalThis&&globalThis.__awaiter||function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function s(c){try{l(n.next(c))}catch(f){o(f)}}function u(c){try{l(n.throw(c))}catch(f){o(f)}}function l(c){c.done?a(c.value):i(c.value).then(s,u)}l((n=n.apply(r,e||[])).next())})};class Mle extends Ci{constructor(e){super();this.maxIteration=1e3,this.edgeStrength=200,this.nodeStrength=1e3,this.coulombDisScale=.005,this.damping=.9,this.maxSpeed=1e3,this.minMovement=.5,this.interval=.02,this.factor=1,this.linkDistance=1,this.gravity=10,this.workerEnabled=!1,this.nodes=[],this.edges=[],this.width=300,this.height=300,this.nodeMap={},this.nodeIdxMap={},this.updateCfg(e)}getDefaultCfg(){return{maxIteration:2e3,gravity:10,clustering:!1,clusterGravity:10}}execute(){return cx(this,void 0,void 0,function*(){const e=this,t=e.nodes;if(!t||t.length===0){e.onLayoutEnd&&e.onLayoutEnd();return}!e.width&&typeof window!="undefined"&&(e.width=window.innerWidth),!e.height&&typeof window!="undefined"&&(e.height=window.innerHeight),e.center||(e.center=[e.width/2,e.height/2]);const n=e.center;if(t.length===1){t[0].x=n[0],t[0].y=n[1],e.onLayoutEnd&&e.onLayoutEnd();return}const i={},a={};t.forEach((o,s)=>{gt(o.x)||(o.x=Math.random()*e.width),gt(o.y)||(o.y=Math.random()*e.height),i[o.id]=o,a[o.id]=s}),e.nodeMap=i,e.nodeIdxMap=a,e.nodeStrength=Nc(e.nodeStrength,1),e.edgeStrength=Nc(e.edgeStrength,1),yield e.run()})}executeWithWorker(e,t){const n=this,i=n.nodes,a=n.center;if(!i||i.length===0)return;if(i.length===1){i[0].x=a[0],i[0].y=a[1];return}const o={},s={};i.forEach((u,l)=>{gt(u.x)||(u.x=Math.random()*n.width),gt(u.y)||(u.y=Math.random()*n.height),o[u.id]=u,s[u.id]=l}),n.nodeMap=o,n.nodeIdxMap=s,n.nodeStrength=Nc(n.nodeStrength,1),n.edgeStrength=Nc(n.edgeStrength,1),n.run(e,t)}run(e,t){return cx(this,void 0,void 0,function*(){const n=this,i=n.nodes,a=n.edges,o=n.maxIteration;!n.width&&typeof window!="undefined"&&(n.width=window.innerWidth),!n.height&&typeof window!="undefined"&&(n.height=window.innerHeight);const s=i.length;n.linkDistance=Nc(n.linkDistance),n.edgeStrength=Nc(n.edgeStrength);const{maxEdgePerVetex:u,array:l}=_le(i,a,n.linkDistance,n.edgeStrength);n.degrees=Oh(i.length,n.nodeIdxMap,a);const c=[],f=[],d=[],h=[],v=[],p=[],g=[];n.getMass||(n.getMass=T=>n.degrees[n.nodeIdxMap[T.id]]||1);const y=n.gravity,m=n.center;i.forEach((T,k)=>{c.push(n.getMass(T)),f.push(n.nodeStrength(T)),n.degrees[k]||(n.degrees[k]=0);let L=[m[0],m[1],y];if(n.getCenter){const B=n.getCenter(T,n.degrees[k]);B&&gt(B[0])&&gt(B[1])&&gt(B[2])&&(L=B)}d.push(L[0]),h.push(L[1]),v.push(L[2]),gt(T.fx)&&gt(T.fy)?(p.push(T.fx||.001),g.push(T.fy||.001)):(p.push(0),g.push(0))});const b=ZB([c,n.degrees,f,p]),w=ZB([d,h,v,g]),x=n.workerEnabled;let _;x?_=yy.create({canvas:e,engineOptions:{supportCompute:!0}}):_=yy.create({engineOptions:{supportCompute:!0}});const A=n.onLayoutEnd,I=[];l.forEach(T=>{I.push(T)});for(let T=0;T<4;T++)I.push(0);const M=_.createKernel(Ile).setDispatch([s,1,1]).setBinding({u_Data:l,u_damping:n.damping,u_maxSpeed:n.maxSpeed,u_minMovement:n.minMovement,u_coulombDisScale:n.coulombDisScale,u_factor:n.factor,u_NodeAttributeArray1:b,u_NodeAttributeArray2:w,MAX_EDGE_PER_VERTEX:u,VERTEX_COUNT:s,u_AveMovement:I,u_interval:n.interval}),S=_.createKernel(Cle).setDispatch([1,1,1]).setBinding({u_Data:l,VERTEX_COUNT:s,u_AveMovement:[0,0,0,0]});yield(()=>cx(this,void 0,void 0,function*(){for(let k=0;k<o;k++){yield M.execute(),S.setBinding({u_Data:M}),yield S.execute();const L=Math.max(.02,n.interval-k*.002);M.setBinding({u_interval:L,u_AveMovement:S})}const T=yield M.getOutput();e?t.postMessage({type:bw.GPUEND,vertexEdgeData:T}):i.forEach((k,L)=>{const B=T[4*L],ee=T[4*L+1];k.x=B,k.y=ee}),A&&A()}))()})}getType(){return"gForce-gpu"}}class kle extends Ci{constructor(e){super();this.center=[0,0],this.maxIteration=100,this.gravity=10,this.comboGravity=10,this.linkDistance=10,this.alpha=1,this.alphaMin=.001,this.alphaDecay=1-Math.pow(this.alphaMin,1/300),this.alphaTarget=0,this.velocityDecay=.6,this.edgeStrength=.6,this.nodeStrength=30,this.preventOverlap=!1,this.preventNodeOverlap=!1,this.preventComboOverlap=!1,this.collideStrength=void 0,this.nodeCollideStrength=.5,this.comboCollideStrength=.5,this.comboSpacing=20,this.comboPadding=10,this.optimizeRangeFactor=1,this.onTick=()=>{},this.onLayoutEnd=()=>{},this.depthAttractiveForceScale=1,this.depthRepulsiveForceScale=2,this.nodes=[],this.edges=[],this.combos=[],this.comboTrees=[],this.width=300,this.height=300,this.bias=[],this.nodeMap={},this.oriComboMap={},this.indexMap={},this.comboMap={},this.previousLayouted=!1,this.updateCfg(e)}getDefaultCfg(){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}}execute(){const e=this,t=e.nodes,n=e.center;if(e.comboTree={id:"comboTreeRoot",depth:-1,children:e.comboTrees},!t||t.length===0){e.onLayoutEnd&&e.onLayoutEnd();return}if(t.length===1){t[0].x=n[0],t[0].y=n[1],e.onLayoutEnd&&e.onLayoutEnd();return}e.initVals(),e.run(),e.onLayoutEnd&&e.onLayoutEnd()}run(){const e=this,t=e.nodes,n=e.previousLayouted?e.maxIteration/5:e.maxIteration;!e.width&&typeof window!="undefined"&&(e.width=window.innerWidth),!e.height&&typeof window!="undefined"&&(e.height=window.innerHeight);const i=e.center,a=e.velocityDecay,o=e.comboMap;e.previousLayouted||e.initPos(o);for(let l=0;l<n;l++){const c=[];t.forEach((f,d)=>{c[d]={x:0,y:0}}),e.applyCalculate(c),e.applyComboCenterForce(c),t.forEach((f,d)=>{!gt(f.x)||!gt(f.y)||(f.x+=c[d].x*a,f.y+=c[d].y*a)}),e.alpha+=(e.alphaTarget-e.alpha)*e.alphaDecay,e.onTick()}const s=[0,0];t.forEach(l=>{!gt(l.x)||!gt(l.y)||(s[0]+=l.x,s[1]+=l.y)}),s[0]/=t.length,s[1]/=t.length;const u=[i[0]-s[0],i[1]-s[1]];t.forEach((l,c)=>{!gt(l.x)||!gt(l.y)||(l.x+=u[0],l.y+=u[1])}),e.combos.forEach(l=>{const c=o[l.id];c&&c.empty&&(l.x=c.cx||l.x,l.y=c.cy||l.y)}),e.previousLayouted=!0}initVals(){const e=this,t=e.edges,n=e.nodes,i=e.combos,a={},o={},s={};n.forEach((S,C)=>{o[S.id]=S,s[S.id]=C}),e.nodeMap=o,e.indexMap=s;const u={};i.forEach(S=>{u[S.id]=S}),e.oriComboMap=u,e.comboMap=e.getComboMap();const l=e.preventOverlap;e.preventComboOverlap=e.preventComboOverlap||l,e.preventNodeOverlap=e.preventNodeOverlap||l;const c=e.collideStrength;c&&(e.comboCollideStrength=c,e.nodeCollideStrength=c),e.comboCollideStrength=e.comboCollideStrength?e.comboCollideStrength:0,e.nodeCollideStrength=e.nodeCollideStrength?e.nodeCollideStrength:0;for(let S=0;S<t.length;++S){const C=Pr(t[S],"source"),T=Pr(t[S],"target");a[C]?a[C]++:a[C]=1,a[T]?a[T]++:a[T]=1}const f=[];for(let S=0;S<t.length;++S){const C=Pr(t[S],"source"),T=Pr(t[S],"target");f[S]=a[C]/(a[C]+a[T])}this.bias=f;const d=e.nodeSize,h=e.nodeSpacing;let v,p;if(gt(h)?p=()=>h:Rs(h)?p=h:p=()=>0,this.nodeSpacing=p,!d)v=S=>S.size?fi(S.size)?(S.size[0]>S.size[1]?S.size[0]:S.size[1])/2:vo(S.size)?(S.size.width>S.size.height?S.size.width:S.size.height)/2:S.size/2:10;else if(Rs(d))v=S=>d(S);else if(fi(d)){const C=(d[0]>d[1]?d[0]:d[1])/2;v=T=>C}else{const S=d/2;v=C=>S}this.nodeSize=v;const g=e.comboSpacing;let y;gt(g)?y=()=>g:Rs(g)?y=g:y=()=>0,this.comboSpacing=y;const m=e.comboPadding;let b;gt(m)?b=()=>m:fi(m)?b=()=>Math.max.apply(null,m):Rs(m)?b=m:b=()=>0,this.comboPadding=b;let w=this.linkDistance,x;w||(w=10),gt(w)?x=S=>w:x=w,this.linkDistance=x;let _=this.edgeStrength,A;_||(_=1),gt(_)?A=S=>_:A=_,this.edgeStrength=A;let I=this.nodeStrength,M;I||(I=30),gt(I)?M=S=>I:M=I,this.nodeStrength=M}initPos(e){this.nodes.forEach((i,a)=>{const o=i.comboId,s=e[o];o&&s?(i.x=s.cx+100/(a+1),i.y=s.cy+100/(a+1)):(i.x=100/(a+1),i.y=100/(a+1))})}getComboMap(){const e=this,t=e.nodeMap,n=e.indexMap,i=e.comboTrees,a=e.oriComboMap,o={};return(i||[]).forEach(s=>{const u=[];Dg(s,l=>{if(l.itemType==="node"||!a[l.id])return!0;if(o[l.id]===void 0){const d={id:l.id,name:l.id,cx:0,cy:0,count:0,depth:e.oriComboMap[l.id].depth||0,children:[]};o[l.id]=d}const c=l.children;c&&c.forEach(d=>{if(!o[d.id]&&!t[d.id])return!0;u.push(d)});const f=o[l.id];if(f.cx=0,f.cy=0,u.length===0){f.empty=!0;const d=a[l.id],h=Object.keys(t).length,v=`${l.id}-visual-child-${h}`,p={id:v,x:d.x,y:d.y,depth:f.depth+1,itemType:"node"};e.nodes.push(p),t[v]=p,n[v]=h,f.cx=d.x,f.cy=d.y,u.push(p)}return u.forEach(d=>{if(f.count++,d.itemType!=="node"){const v=o[d.id];gt(v.cx)&&(f.cx+=v.cx),gt(v.cy)&&(f.cy+=v.cy);return}const h=t[d.id];!h||(gt(h.x)&&(f.cx+=h.x),gt(h.y)&&(f.cy+=h.y))}),f.cx/=f.count,f.cy/=f.count,f.children=u,!0})}),o}applyComboCenterForce(e){const t=this,n=t.gravity,i=t.comboGravity||n,a=this.alpha,o=t.comboTrees,s=t.indexMap,u=t.nodeMap,l=t.comboMap;(o||[]).forEach(c=>{Dg(c,f=>{if(f.itemType==="node"||!l[f.id])return!0;const h=l[f.id],v=(h.depth+1)/10*.5,p=h.cx,g=h.cy;return h.cx=0,h.cy=0,h.children.forEach(y=>{if(y.itemType!=="node"){const I=l[y.id];I&&gt(I.cx)&&(h.cx+=I.cx),I&&gt(I.cy)&&(h.cy+=I.cy);return}const m=u[y.id],b=m.x-p||.005,w=m.y-g||.005,x=Math.sqrt(b*b+w*w),_=s[m.id],A=i*a/x*v;e[_].x-=b*A,e[_].y-=w*A,gt(m.x)&&(h.cx+=m.x),gt(m.y)&&(h.cy+=m.y)}),h.cx/=h.count,h.cy/=h.count,!0})})}applyCalculate(e){const t=this,n=t.comboMap,i=t.nodes,a={};i.forEach((s,u)=>{i.forEach((l,c)=>{if(u<c)return;const f=s.x-l.x||.005,d=s.y-l.y||.005;let h=f*f+d*d;const v=Math.sqrt(h);h<1&&(h=v),a[`${s.id}-${l.id}`]={vx:f,vy:d,vl2:h,vl:v},a[`${l.id}-${s.id}`]={vl2:h,vl:v,vx:-f,vy:-d}})}),t.updateComboSizes(n),t.calRepulsive(e,a),t.calAttractive(e,a),t.preventComboOverlap&&t.comboNonOverlapping(e,n)}updateComboSizes(e){const t=this,n=t.comboTrees,i=t.nodeMap,a=t.nodeSize,o=t.comboSpacing,s=t.comboPadding;(n||[]).forEach(u=>{const l=[];Dg(u,c=>{if(c.itemType==="node")return!0;const f=e[c.id];if(!f)return!1;const d=c.children;d&&d.forEach(p=>{!e[p.id]&&!i[p.id]||l.push(p)}),f.minX=1/0,f.minY=1/0,f.maxX=-1/0,f.maxY=-1/0,l.forEach(p=>{if(p.itemType!=="node")return!0;const g=i[p.id];if(!g)return!0;const y=a(g),m=g.x-y,b=g.y-y,w=g.x+y,x=g.y+y;f.minX>m&&(f.minX=m),f.minY>b&&(f.minY=b),f.maxX<w&&(f.maxX=w),f.maxY<x&&(f.maxY=x)});let h=t.oriComboMap[c.id].size||10;fi(h)&&(h=h[0]);const v=Math.max(f.maxX-f.minX,f.maxY-f.minY,h);return f.r=v/2+o(f)/2+s(f),!0})})}comboNonOverlapping(e,t){const n=this,i=n.comboTree,a=n.comboCollideStrength,o=n.indexMap,s=n.nodeMap;Dg(i,u=>{if(!t[u.id]&&!s[u.id]&&u.id!=="comboTreeRoot")return!1;const l=u.children;return l&&l.length>1&&l.forEach((c,f)=>{if(c.itemType==="node")return!1;const d=t[c.id];!d||l.forEach((h,v)=>{if(f<=v||h.itemType==="node")return!1;const p=t[h.id];if(!p)return!1;const g=d.cx-p.cx||.005,y=d.cy-p.cy||.005,m=g*g+y*y,b=d.r||1,w=p.r||1,x=b+w,_=w*w,A=b*b;if(m<x*x){const I=c.children;if(!I||I.length===0)return!1;const M=h.children;if(!M||M.length===0)return!1;const S=Math.sqrt(m),C=(x-S)/S*a,T=g*C,k=y*C,L=_/(A+_),B=1-L;I.forEach(ee=>{if(ee.itemType!=="node")return!1;if(!s[ee.id])return;const K=o[ee.id];M.forEach(z=>{if(z.itemType!=="node"||!s[z.id])return!1;const X=o[z.id];e[K].x+=T*L,e[K].y+=k*L,e[X].x-=T*B,e[X].y-=k*B})})}})}),!0})}calRepulsive(e,t){const n=this,i=n.nodes,a=n.width*n.optimizeRangeFactor,o=n.nodeStrength,s=n.alpha,u=n.nodeCollideStrength,l=n.preventNodeOverlap,c=n.nodeSize,f=n.nodeSpacing,d=n.depthRepulsiveForceScale,h=n.center;i.forEach((v,p)=>{if(!(!v.x||!v.y)){if(h){const g=n.gravity,y=v.x-h[0]||.005,m=v.y-h[1]||.005,b=Math.sqrt(y*y+m*m);e[p].x-=y*g*s/b,e[p].y-=m*g*s/b}i.forEach((g,y)=>{if(p===y||!g.x||!g.y)return;const{vl2:m,vl:b}=t[`${v.id}-${g.id}`];if(b>a)return;const{vx:w,vy:x}=t[`${v.id}-${g.id}`];let _=Math.log(Math.abs(g.depth-v.depth)/10)+1||1;_=_<1?1:_,g.comboId!==v.comboId&&(_+=1);const A=_?Math.pow(d,_):1,I=o(g)*s/m*A;if(e[p].x+=w*I,e[p].y+=x*I,p<y&&l){const M=c(v)+f(v)||1,S=c(g)+f(g)||1,C=M+S;if(m<C*C){const T=(C-b)/b*u,k=S*S;let L=k/(M*M+k);const B=w*T,ee=x*T;e[p].x+=B*L,e[p].y+=ee*L,L=1-L,e[y].x-=B*L,e[y].y-=ee*L}}})}})}calAttractive(e,t){const n=this,i=n.edges,a=n.linkDistance,o=n.alpha,s=n.edgeStrength,u=n.bias,l=n.depthAttractiveForceScale;i.forEach((c,f)=>{const d=Pr(c,"source"),h=Pr(c,"target");if(!d||!h||d===h)return;const v=n.indexMap[d],p=n.indexMap[h],g=n.nodeMap[d],y=n.nodeMap[h];if(!g||!y)return;let m=g.depth===y.depth?0:Math.log(Math.abs(g.depth-y.depth)/10);g.comboId===y.comboId&&(m=m/2);let b=m?Math.pow(l,m):1;if(g.comboId!==y.comboId&&b===1?b=l/2:g.comboId===y.comboId&&(b=2),!gt(y.x)||!gt(g.x)||!gt(y.y)||!gt(g.y))return;const{vl:w,vx:x,vy:_}=t[`${h}-${d}`],A=(w-a(c))/w*o*s(c)*b,I=x*A,M=_*A,S=u[f];e[p].x-=I*S,e[p].y-=M*S,e[v].x+=I*(1-S),e[v].y+=M*(1-S)})}getType(){return"comboForce"}}class fx{constructor(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}distanceTo(e){const t=this.rx-e.rx,n=this.ry-e.ry;return Math.hypot(t,n)}setPos(e,t){this.rx=e,this.ry=t}resetForce(){this.fx=0,this.fy=0}addForce(e){const t=e.rx-this.rx,n=e.ry-this.ry;let i=Math.hypot(t,n);i=i<1e-4?1e-4:i;const a=this.g*(this.degree+1)*(e.degree+1)/i;this.fx+=a*t/i,this.fy+=a*n/i}in(e){return e.contains(this.rx,this.ry)}add(e){const t=this.mass+e.mass,n=(this.rx*this.mass+e.rx*e.mass)/t,i=(this.ry*this.mass+e.ry*e.mass)/t,a=this.degree+e.degree,o={rx:n,ry:i,mass:t,degree:a};return new fx(o)}}class Oc{constructor(e){this.xmid=e.xmid,this.ymid=e.ymid,this.length=e.length,this.massCenter=e.massCenter||[0,0],this.mass=e.mass||1}getLength(){return this.length}contains(e,t){const n=this.length/2;return e<=this.xmid+n&&e>=this.xmid-n&&t<=this.ymid+n&&t>=this.ymid-n}NW(){const e=this.xmid-this.length/4,t=this.ymid+this.length/4,n=this.length/2,i={xmid:e,ymid:t,length:n};return new Oc(i)}NE(){const e=this.xmid+this.length/4,t=this.ymid+this.length/4,n=this.length/2,i={xmid:e,ymid:t,length:n};return new Oc(i)}SW(){const e=this.xmid-this.length/4,t=this.ymid-this.length/4,n=this.length/2,i={xmid:e,ymid:t,length:n};return new Oc(i)}SE(){const e=this.xmid+this.length/4,t=this.ymid-this.length/4,n=this.length/2,i={xmid:e,ymid:t,length:n};return new Oc(i)}}class Pc{constructor(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)}insert(e){if(this.body==null){this.body=e;return}this._isExternal()?(this.quad&&(this.NW=new Pc(this.quad.NW()),this.NE=new Pc(this.quad.NE()),this.SW=new Pc(this.quad.SW()),this.SE=new Pc(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))}_putBody(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))}_isExternal(){return this.NW==null&&this.NE==null&&this.SW==null&&this.SE==null}updateForce(e){if(!(this.body==null||e===this.body))if(this._isExternal())e.addForce(this.body);else{const t=this.quad?this.quad.getLength():0,n=this.body.distanceTo(e);t/n<this.theta?e.addForce(this.body):(this.NW&&this.NW.updateForce(e),this.NE&&this.NE.updateForce(e),this.SW&&this.SW.updateForce(e),this.SE&&this.SE.updateForce(e))}}}class Dle extends Ci{constructor(e){super();this.center=[0,0],this.width=300,this.height=300,this.nodes=[],this.edges=[],this.kr=5,this.kg=1,this.mode="normal",this.preventOverlap=!1,this.dissuadeHubs=!1,this.barnesHut=void 0,this.maxIteration=0,this.ks=.1,this.ksmax=10,this.tao=.1,this.onLayoutEnd=()=>{},this.prune=void 0,this.updateCfg(e)}getDefaultCfg(){return{}}execute(){const e=this,{nodes:t,onLayoutEnd:n,prune:i}=e;let a=e.maxIteration;!e.width&&typeof window!="undefined"&&(e.width=window.innerWidth),!e.height&&typeof window!="undefined"&&(e.height=window.innerHeight);const o=[],s=t.length;for(let u=0;u<s;u+=1){const l=t[u];let c=10,f=10;gt(l.size)&&(c=l.size,f=l.size),fi(l.size)?(isNaN(l.size[0])||(c=l.size[0]),isNaN(l.size[1])||(f=l.size[1])):vo(l.size)&&(c=l.size.width,f=l.size.height),e.getWidth&&!isNaN(e.getWidth(l))&&(f=e.getWidth(l)),e.getHeight&&!isNaN(e.getHeight(l))&&(c=e.getHeight(l));const d=Math.max(c,f);o.push(d)}e.barnesHut===void 0&&s>250&&(e.barnesHut=!0),e.prune===void 0&&s>100&&(e.prune=!0),this.maxIteration===0&&!e.prune?(a=250,s<=200&&s>100?a=1e3:s>200&&(a=1200),this.maxIteration=a):this.maxIteration===0&&i&&(a=100,s<=200&&s>100?a=500:s>200&&(a=950),this.maxIteration=a),e.kr||(e.kr=50,s>100&&s<=500?e.kr=20:s>500&&(e.kr=1)),e.kg||(e.kg=20,s>100&&s<=500?e.kg=10:s>500&&(e.kg=1)),this.nodes=e.updateNodesByForces(o),n()}updateNodesByForces(e){const t=this,{edges:n,maxIteration:i}=t;let a=t.nodes;const o=n.filter(v=>{const p=Pr(v,"source"),g=Pr(v,"target");return p!==g}),s=a.length,u=o.length,l=[],c={},f={},d=[];for(let v=0;v<s;v+=1)c[a[v].id]=v,l[v]=0,(a[v].x===void 0||isNaN(a[v].x))&&(a[v].x=Math.random()*1e3),(a[v].y===void 0||isNaN(a[v].y))&&(a[v].y=Math.random()*1e3),d.push({x:a[v].x,y:a[v].y});for(let v=0;v<u;v+=1){let p,g,y=0,m=0;for(let b=0;b<s;b+=1){const w=Pr(o[v],"source"),x=Pr(o[v],"target");a[b].id===w?(p=a[b],y=b):a[b].id===x&&(g=a[b],m=b),f[v]={sourceIdx:y,targetIdx:m}}p&&(l[c[p.id]]+=1),g&&(l[c[g.id]]+=1)}let h=i;if(a=this.iterate(h,c,f,u,l,e),t.prune){for(let v=0;v<u;v+=1)l[f[v].sourceIdx]<=1?(a[f[v].sourceIdx].x=a[f[v].targetIdx].x,a[f[v].sourceIdx].y=a[f[v].targetIdx].y):l[f[v].targetIdx]<=1&&(a[f[v].targetIdx].x=a[f[v].sourceIdx].x,a[f[v].targetIdx].y=a[f[v].sourceIdx].y);t.prune=!1,t.barnesHut=!1,h=100,a=this.iterate(h,c,f,u,l,e)}return a}iterate(e,t,n,i,a,o){const s=this;let{nodes:u}=s;const{kr:l,preventOverlap:c}=s,{barnesHut:f}=s,d=u.length;let h=0;const v=100;let p=e;const g=50;let y=[];const m=[],b=[];for(let w=0;w<d;w+=1)if(y[2*w]=0,y[2*w+1]=0,f){const x={id:w,rx:u[w].x,ry:u[w].y,mass:1,g:l,degree:a[w]};b[w]=new fx(x)}for(;p>0;){for(let x=0;x<d;x+=1)m[2*x]=y[2*x],m[2*x+1]=y[2*x+1],y[2*x]=0,y[2*x+1]=0;y=this.getAttrForces(p,g,i,t,n,a,o,y),f&&(c&&p>g||!c)?y=this.getOptRepGraForces(y,b,a):y=this.getRepGraForces(p,g,y,v,o,a);const w=this.updatePos(y,m,h,a);u=w.nodes,h=w.sg,p--,s.tick&&s.tick()}return u}getAttrForces(e,t,n,i,a,o,s,u){const l=this,{nodes:c,preventOverlap:f,dissuadeHubs:d,mode:h,prune:v}=l;for(let p=0;p<n;p+=1){const g=c[a[p].sourceIdx],y=a[p].sourceIdx,m=c[a[p].targetIdx],b=a[p].targetIdx;if(v&&(o[y]<=1||o[b]<=1))continue;const w=[m.x-g.x,m.y-g.y];let x=Math.hypot(w[0],w[1]);x=x<1e-4?1e-4:x,w[0]=w[0]/x,w[1]=w[1]/x,f&&e<t&&(x=x-s[y]-s[b]);let _=x,A=_;h==="linlog"&&(_=Math.log(1+x),A=_),d&&(_=x/o[y],A=x/o[b]),f&&e<t&&x<=0?(_=0,A=0):f&&e<t&&x>0&&(_=x,A=x),u[2*i[g.id]]+=_*w[0],u[2*i[m.id]]-=A*w[0],u[2*i[g.id]+1]+=_*w[1],u[2*i[m.id]+1]-=A*w[1]}return u}getRepGraForces(e,t,n,i,a,o){const s=this,{nodes:u,preventOverlap:l,kr:c,kg:f,center:d,prune:h}=s,v=u.length;for(let p=0;p<v;p+=1){for(let b=p+1;b<v;b+=1){if(h&&(o[p]<=1||o[b]<=1))continue;const w=[u[b].x-u[p].x,u[b].y-u[p].y];let x=Math.hypot(w[0],w[1]);x=x<1e-4?1e-4:x,w[0]=w[0]/x,w[1]=w[1]/x,l&&e<t&&(x=x-a[p]-a[b]);let _=c*(o[p]+1)*(o[b]+1)/x;l&&e<t&&x<0?_=i*(o[p]+1)*(o[b]+1):l&&e<t&&x===0?_=0:l&&e<t&&x>0&&(_=c*(o[p]+1)*(o[b]+1)/x),n[2*p]-=_*w[0],n[2*b]+=_*w[0],n[2*p+1]-=_*w[1],n[2*b+1]+=_*w[1]}const g=[u[p].x-d[0],u[p].y-d[1]],y=Math.hypot(g[0],g[1]);g[0]=g[0]/y,g[1]=g[1]/y;const m=f*(o[p]+1);n[2*p]-=m*g[0],n[2*p+1]-=m*g[1]}return n}getOptRepGraForces(e,t,n){const i=this,{nodes:a,kg:o,center:s,prune:u}=i,l=a.length;let c=9e10,f=-9e10,d=9e10,h=-9e10;for(let m=0;m<l;m+=1)u&&n[m]<=1||(t[m].setPos(a[m].x,a[m].y),a[m].x>=f&&(f=a[m].x),a[m].x<=c&&(c=a[m].x),a[m].y>=h&&(h=a[m].y),a[m].y<=d&&(d=a[m].y));const v=Math.max(f-c,h-d),p={xmid:(f+c)/2,ymid:(h+d)/2,length:v,massCenter:s,mass:l},g=new Oc(p),y=new Pc(g);for(let m=0;m<l;m+=1)u&&n[m]<=1||t[m].in(g)&&y.insert(t[m]);for(let m=0;m<l;m+=1){if(u&&n[m]<=1)continue;t[m].resetForce(),y.updateForce(t[m]),e[2*m]-=t[m].fx,e[2*m+1]-=t[m].fy;const b=[a[m].x-s[0],a[m].y-s[1]];let w=Math.hypot(b[0],b[1]);w=w<1e-4?1e-4:w,b[0]=b[0]/w,b[1]=b[1]/w;const x=o*(n[m]+1);e[2*m]-=x*b[0],e[2*m+1]-=x*b[1]}return e}updatePos(e,t,n,i){const a=this,{nodes:o,ks:s,tao:u,prune:l,ksmax:c}=a,f=o.length,d=[],h=[];let v=0,p=0;for(let y=0;y<f;y+=1){if(l&&i[y]<=1)continue;const m=[e[2*y]-t[2*y],e[2*y+1]-t[2*y+1]],b=Math.hypot(m[0],m[1]),w=[e[2*y]+t[2*y],e[2*y+1]+t[2*y+1]],x=Math.hypot(w[0],w[1]);d[y]=b,h[y]=x/2,v+=(i[y]+1)*d[y],p+=(i[y]+1)*h[y]}const g=n;n=u*p/v,g!==0&&(n=n>1.5*g?1.5*g:n);for(let y=0;y<f;y+=1){if(l&&i[y]<=1)continue;let m=s*n/(1+n*Math.sqrt(d[y])),b=Math.hypot(e[2*y],e[2*y+1]);b=b<1e-4?1e-4:b;const w=c/b;m=m>w?w:m;const x=m*e[2*y],_=m*e[2*y+1];o[y].x+=x,o[y].y+=_}return{nodes:o,sg:n}}}const hx=new Proxy({},{get:(r,e)=>aQ(e),set:(r,e,t)=>(bi(e,t),!0)});var Lle=U1,Nle=Lle.mix,ul={assign:Nle},QB=ul,dx=18,Ole=dx*2,JB=dx,Ple={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||JB},getVGap:function(e){return e.vgap||JB},getChildren:function(e){return e.children},getHeight:function(e){return e.height||Ole},getWidth:function(e){var t=e.label||" ";return e.width||t.split("").length*dx}};function by(r,e){var t=this;if(t.vgap=t.hgap=0,r instanceof by)return r;t.data=r;var n=e.getHGap(r),i=e.getVGap(r);return t.preH=e.getPreH(r),t.preV=e.getPreV(r),t.width=e.getWidth(r),t.height=e.getHeight(r),t.width+=t.preH,t.height+=t.preV,t.id=e.getId(r),t.x=t.y=0,t.depth=0,t.children||(t.children=[]),t.addGap(n,i),t}QB.assign(by.prototype,{isRoot:function(){return this.depth===0},isLeaf:function(){return this.children.length===0},addGap:function(e,t){var n=this;n.hgap+=e,n.vgap+=t,n.width+=2*e,n.height+=2*t},eachNode:function(e){for(var t=this,n=[t],i;i=n.shift();)e(i),n=i.children.concat(n)},DFTraverse:function(e){this.eachNode(e)},BFTraverse:function(e){for(var t=this,n=[t],i;i=n.shift();)e(i),n=n.concat(i.children)},getBoundingBox:function(){var e={left:Number.MAX_VALUE,top:Number.MAX_VALUE,width:0,height:0};return this.eachNode(function(t){e.left=Math.min(e.left,t.x),e.top=Math.min(e.top,t.y),e.width=Math.max(e.width,t.x+t.width),e.height=Math.max(e.height,t.y+t.height)}),e},translate:function(e,t){e===void 0&&(e=0),t===void 0&&(t=0),this.eachNode(function(n){n.x+=e,n.y+=t,n.x+=n.preH,n.y+=n.preV})},right2left:function(){var e=this,t=e.getBoundingBox();e.eachNode(function(n){n.x=n.x-(n.x-t.left)*2-n.width}),e.translate(t.width,0)},bottom2top:function(){var e=this,t=e.getBoundingBox();e.eachNode(function(n){n.y=n.y-(n.y-t.top)*2-n.height}),e.translate(0,t.height)}});function Rle(r,e,t){e===void 0&&(e={}),e=QB.assign({},Ple,e);var n=new by(r,e),i=[n],a;if(!t&&!r.collapsed){for(;a=i.shift();)if(!a.data.collapsed){var o=e.getChildren(a.data),s=o?o.length:0;if(a.children=new Array(s),o&&s)for(var u=0;u<s;u++){var l=new by(o[u],e);a.children[u]=l,i.push(l),l.parent=a,l.depth=a.depth+1}}}return n}var e3=Rle,Ble=e3,Fle=function(){function r(t,n){n===void 0&&(n={});var i=this;i.options=n,i.rootNode=Ble(t,n)}var e=r.prototype;return e.execute=function(){throw new Error("please override this method")},r}(),wy=Fle;function od(r,e,t,n){n===void 0&&(n=[]);var i=this;i.w=r||0,i.h=e||0,i.y=t||0,i.x=0,i.c=n||[],i.cs=n.length,i.prelim=0,i.mod=0,i.shift=0,i.change=0,i.tl=null,i.tr=null,i.el=null,i.er=null,i.msel=0,i.mser=0}od.fromNode=function(r,e){if(!r)return null;var t=[];return r.children.forEach(function(n){t.push(od.fromNode(n,e))}),e?new od(r.height,r.width,r.x,t):new od(r.width,r.height,r.y,t)};function t3(r,e,t){t?r.y+=e:r.x+=e,r.children.forEach(function(n){t3(n,e,t)})}function r3(r,e){var t=e?r.y:r.x;return r.children.forEach(function(n){t=Math.min(r3(n,e),t)}),t}function Ule(r,e){var t=r3(r,e);t3(r,-t,e)}function n3(r,e,t){t?e.y=r.x:e.x=r.x,r.c.forEach(function(n,i){n3(n,e.children[i],t)})}function i3(r,e,t){t===void 0&&(t=0),e?(r.x=t,t+=r.width):(r.y=t,t+=r.height),r.children.forEach(function(n){i3(n,e,t)})}var Gle=function(r,e){e===void 0&&(e={});var t=e.isHorizontal;function n(m){if(m.cs===0){i(m);return}n(m.c[0]);for(var b=g(l(m.c[0].el),0,null),w=1;w<m.cs;++w){n(m.c[w]);var x=l(m.c[w].er);a(m,w,b),b=g(x,w,b)}d(m),i(m)}function i(m){m.cs===0?(m.el=m,m.er=m,m.msel=m.mser=0):(m.el=m.c[0].el,m.msel=m.c[0].msel,m.er=m.c[m.cs-1].er,m.mser=m.c[m.cs-1].mser)}function a(m,b,w){for(var x=m.c[b-1],_=x.mod,A=m.c[b],I=A.mod;x!==null&&A!==null;){l(x)>w.low&&(w=w.nxt);var M=_+x.prelim+x.w-(I+A.prelim);M>0&&(I+=M,o(m,b,w.index,M));var S=l(x),C=l(A);S<=C&&(x=u(x),x!==null&&(_+=x.mod)),S>=C&&(A=s(A),A!==null&&(I+=A.mod))}!x&&!!A?c(m,b,A,I):!!x&&!A&&f(m,b,x,_)}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 l(m){return m.y+m.h}function c(m,b,w,x){var _=m.c[0].el;_.tl=w;var A=x-w.mod-m.c[0].msel;_.mod+=A,_.prelim-=A,m.c[0].el=m.c[b].el,m.c[0].msel=m.c[b].msel}function f(m,b,w,x){var _=m.c[b].er;_.tr=w;var A=x-w.mod-m.c[b].mser;_.mod+=A,_.prelim-=A,m.c[b].er=m.c[b-1].er,m.c[b].mser=m.c[b-1].mser}function d(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 h(m,b){b+=m.mod,m.x=m.prelim+b,p(m);for(var w=0;w<m.cs;w++)h(m.c[w],b)}function v(m,b,w,x){if(w!==b-1){var _=b-w;m.c[w+1].shift+=x/_,m.c[b].shift-=x/_,m.c[b].change-=x-x/_}}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}}i3(r,t);var y=od.fromNode(r,t);return n(y),h(y,0),n3(y,r,t),Ule(r,t),r},a3=e3,o3=function(r,e){for(var t=a3(r.data,e,!0),n=a3(r.data,e,!0),i=r.children.length,a=Math.round(i/2),o=e.getSide||function(c,f){return f<a?"right":"left"},s=0;s<i;s++){var u=r.children[s],l=o(u,s);l==="right"?n.children.push(u):t.children.push(u)}return t.eachNode(function(c){c.isRoot()||(c.side="left")}),n.eachNode(function(c){c.isRoot()||(c.side="right")}),{left:t,right:n}},zle=o3,Ks=["LR","RL","TB","BT","H","V"],$le=["LR","RL","H"],Vle=function(e){return $le.indexOf(e)>-1},jle=Ks[0],vx=function(r,e,t){var n=e.direction||jle;if(e.isHorizontal=Vle(n),n&&Ks.indexOf(n)===-1)throw new TypeError("Invalid direction: "+n);if(n===Ks[0])t(r,e);else if(n===Ks[1])t(r,e),r.right2left();else if(n===Ks[2])t(r,e);else if(n===Ks[3])t(r,e),r.bottom2top();else if(n===Ks[4]||n===Ks[5]){var i=zle(r,e),a=i.left,o=i.right;t(a,e),t(o,e),e.isHorizontal?a.right2left():a.bottom2top(),o.translate(a.x-o.x,a.y-o.y),r.x=a.x,r.y=o.y;var s=r.getBoundingBox();e.isHorizontal?s.top<0&&r.translate(0,-s.top):s.left<0&&r.translate(-s.left,0)}var u=e.fixedRoot;return u===void 0&&(u=!0),u&&r.translate(-(r.x+r.width/2+r.hgap),-(r.y+r.height/2+r.vgap)),r};function Wle(r,e){r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.__proto__=e}var Xle=wy,Yle=Gle,Hle=vx,qle=ul,Kle=function(r){Wle(e,r);function e(){return r.apply(this,arguments)||this}var t=e.prototype;return t.execute=function(){var i=this;return Hle(i.rootNode,i.options,Yle)},e}(Xle),Zle={};function Qle(r,e){return e=qle.assign({},Zle,e),new Kle(r,e).execute()}var Jle=Qle,ece=ul;function tce(r,e){e===void 0&&(e=[]);var t=this;t.x=t.y=0,t.leftChild=t.rightChild=null,t.height=0,t.children=e}var rce={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function s3(r,e,t){t?(e.x=r.x,e.y=r.y):(e.x=r.y,e.y=r.x),r.children.forEach(function(n,i){s3(n,e.children[i],t)})}var nce=function(r,e){e===void 0&&(e={}),e=ece.assign({},rce,e);var t=0;function n(u){if(!u)return null;u.width=0,u.depth&&u.depth>t&&(t=u.depth);var l=u.children,c=l.length,f=new tce(u.height,[]);return l.forEach(function(d,h){var v=n(d);f.children.push(v),h===0&&(f.leftChild=v),h===c-1&&(f.rightChild=v)}),f.originNode=u,f.isLeaf=u.isLeaf(),f}function i(u){if(u.isLeaf||u.children.length===0)u.drawingDepth=t;else{var l=u.children.map(function(f){return i(f)}),c=Math.min.apply(null,l);u.drawingDepth=c-1}return u.drawingDepth}var a;function o(u){u.x=u.drawingDepth*e.rankSep,u.isLeaf?(u.y=0,a&&(u.y=a.y+a.height+e.nodeSep,u.originNode.parent!==a.originNode.parent&&(u.y+=e.subTreeSep)),a=u):(u.children.forEach(function(l){o(l)}),u.y=(u.leftChild.y+u.rightChild.y)/2)}var s=n(r);return i(s),o(s),s3(s,r,e.isHorizontal),r};function ice(r,e){r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.__proto__=e}var ace=wy,oce=nce,sce=vx,uce=ul,lce=function(r){ice(e,r);function e(){return r.apply(this,arguments)||this}var t=e.prototype;return t.execute=function(){var i=this;return i.rootNode.width=0,sce(i.rootNode,i.options,oce)},e}(ace),cce={};function fce(r,e){return e=uce.assign({},cce,e),new lce(r,e).execute()}var hce=fce;function dce(r,e,t,n){var i=typeof t=="function"?t(r):t*r.depth;if(!n)try{if(r.id===r.parent.children[0].id){r.x+=i,r.y=e?e.y:0;return}}catch{}r.x+=i,r.y=e?e.y+e.height:0}var vce=function(r,e,t){var n=null;r.eachNode(function(i){dce(i,n,e,t),n=i})};function pce(r,e){r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.__proto__=e}var gce=wy,xy=vce,yce=o3,mce=ul,sd=["LR","RL","H"],bce=sd[0],wce=function(r){pce(e,r);function e(){return r.apply(this,arguments)||this}var t=e.prototype;return t.execute=function(){var i=this,a=i.options,o=i.rootNode;a.isHorizontal=!0;var s=a.indent,u=s===void 0?20:s,l=a.dropCap,c=l===void 0?!0:l,f=a.direction||bce;if(f&&sd.indexOf(f)===-1)throw new TypeError("Invalid direction: "+f);if(f===sd[0])xy(o,u,c);else if(f===sd[1])xy(o,u,c),o.right2left();else if(f===sd[2]){var d=yce(o,a),h=d.left,v=d.right;xy(h,u,c),h.right2left(),xy(v,u,c);var p=h.getBoundingBox();v.translate(p.width,0),o.x=v.x-o.width/2}return o},e}(gce),xce={};function _ce(r,e){return e=mce.assign({},xce,e),new wce(r,e).execute()}var Sce=_ce,Ece=ul;function u3(r,e){var t=0;return r.children.length?r.children.forEach(function(n){t+=u3(n,e)}):t=r.height,r._subTreeSep=e.getSubTreeSep(r.data),r.totalHeight=Math.max(r.height,t)+2*r._subTreeSep,r.totalHeight}function l3(r){var e=r.children,t=e.length;if(t){e.forEach(function(u){l3(u)});var n=e[0],i=e[t-1],a=i.y-n.y+i.height,o=0;if(e.forEach(function(u){o+=u.totalHeight}),a>r.height)r.y=n.y+a/2-r.height/2;else if(e.length!==1||r.height>o){var s=r.y+(r.height-a)/2-n.y;e.forEach(function(u){u.translate(0,s)})}else r.y=(n.y+n.height/2+i.y+i.height/2)/2-r.height/2}}var Ace={getSubTreeSep:function(){return 0}},Tce=function(r,e){e===void 0&&(e={}),e=Ece.assign({},Ace,e),r.parent={x:0,width:0,height:0,y:0},r.BFTraverse(function(t){t.x=t.parent.x+t.parent.width}),r.parent=null,u3(r,e),r.startY=0,r.y=r.totalHeight/2-r.height/2,r.eachNode(function(t){var n=t.children,i=n.length;if(i){var a=n[0];if(a.startY=t.startY+t._subTreeSep,i===1)a.y=t.y+t.height/2-a.height/2;else{a.y=a.startY+a.totalHeight/2-a.height/2;for(var o=1;o<i;o++){var s=n[o];s.startY=n[o-1].startY+n[o-1].totalHeight,s.y=s.startY+s.totalHeight/2-s.height/2}}}}),l3(r)};function Ice(r,e){r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.__proto__=e}var Cce=wy,Mce=Tce,kce=vx,Dce=ul,Lce=function(r){Ice(e,r);function e(){return r.apply(this,arguments)||this}var t=e.prototype;return t.execute=function(){var i=this;return kce(i.rootNode,i.options,Mce)},e}(Cce),Nce={};function Oce(r,e){return e=Dce.assign({},Nce,e),new Lce(r,e).execute()}var Pce=Oce,Rce={compactBox:Jle,dendrogram:hce,indented:Sce,mindmap:Pce},_y=Rce,c3=Ua.traverseTree,Bce=function(e,t){var n;return e?Ft(e)?n=function(a){return e}:n=e:n=function(a){return t||1},n},Fce=function(e,t){var n=[],i=[],a={},o=0;for(o=0;o<e.length;o++){var s=e[o];a[s.id]=o,n.push(s.x),n.push(s.y),n.push(0),n.push(0),i.push([])}for(o=0;o<t.length;o++){var u=t[o];i[a[u.source]].push(a[u.target]),i[a[u.target]].push(a[u.source])}var l=0;for(o=0;o<e.length;o++){var c=n.length,f=i[o],d=f.length;n[o*4+2]=c,n[o*4+3]=f.length,l=Math.max(l,f.length);for(var h=0;h<d;++h){var v=f[h];n.push(+v)}}for(;n.length%4!=0;)n.push(0);return{array:new Float32Array(n),maxEdgePerVetex:l}},Uce=function(e,t,n){var i=[],a=[],o={},s=0;for(s=0;s<e.length;s++){var u=e[s];o[u.id]=s,i.push(u.x),i.push(u.y),i.push(0),i.push(0),a.push([])}for(s=0;s<t.length;s++){var l=t[s];a[o[l.source]].push(o[l.target]),a[o[l.source]].push(n(l)),a[o[l.target]].push(o[l.source]),a[o[l.target]].push(n(l))}var c=0;for(s=0;s<e.length;s++){var f=i.length,d=a[s],h=d.length;i[s*4+2]=f,i[s*4+3]=h/2,c=Math.max(c,h/2);for(var v=0;v<h;++v){var p=d[v];i.push(+p)}}for(;i.length%4!=0;)i.push(0);return{array:new Float32Array(i),maxEdgePerVetex:c}},Gce=function(e,t,n,i){var a=[],o=[],s={},u=0;for(u=0;u<e.length;u++){var l=e[u];s[l.id]=u,a.push(l.x),a.push(l.y),a.push(0),a.push(0),o.push([])}for(u=0;u<t.length;u++){var c=t[u];o[s[c.source]].push(s[c.target]),o[s[c.source]].push(n(c)),o[s[c.source]].push(i(c)),o[s[c.source]].push(0),o[s[c.target]].push(s[c.source]),o[s[c.target]].push(n(c)),o[s[c.target]].push(i(c)),o[s[c.target]].push(0)}var f=0;for(u=0;u<e.length;u++){var d=a.length,h=o[u],v=h.length;a[u*4+2]=d+1048576*v/4,a[u*4+3]=0,f=Math.max(f,v/4);for(var p=0;p<v;++p){var g=h[p];a.push(+g)}}for(;a.length%4!=0;)a.push(0);return{array:new Float32Array(a),maxEdgePerVetex:f}},zce=function(e,t){var n=[],i=e.length,a={};return t.forEach(function(o){e.forEach(function(s,u){if(a[o[s]]===void 0&&(a[o[s]]=Object.keys(a).length),n.push(a[o[s]]),u===i-1)for(;n.length%4!=0;)n.push(0)})}),{array:new Float32Array(n),count:Object.keys(a).length}},$ce=function(e){for(var t=[],n=e.length,i=e[0].length,a=function(u){e.forEach(function(l,c){if(t.push(l[u]),c===n-1)for(;t.length%4!=0;)t.push(0)})},o=0;o<i;o++)a(o);return new Float32Array(t)},Vce=function(e,t){var n=["V","TB","BT"],i={x:1/0,y:1/0},a={x:-1/0,y:-1/0},o="x",s="y";t&&n.indexOf(t)>=0&&(s="x",o="y");var u=0;c3(e,function(f){return u++,f.x>a.x&&(a.x=f.x),f.x<i.x&&(i.x=f.x),f.y>a.y&&(a.y=f.y),f.y<i.y&&(i.y=f.y),!0});var l=Math.PI*2/u,c=a[s]-i[s];return c===0||c3(e,function(f){var d=(f[s]-i[s])/c*(Math.PI*2-l)+l,h=Math.abs(o==="x"?f.x-e.x:f.y-e.y);return f.x=h*Math.cos(d),f.y=h*Math.sin(d),!0}),e},jce=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",proccessToFunc:Bce,buildTextureData:Fce,buildTextureDataWithOneEdgeAttr:Uce,buildTextureDataWithTwoEdgeAttr:Gce,attributesToTextureData:zce,arrayToTextureData:$ce,radialLayout:Vce}),f3=function r(){return typeof window=="undefined"||typeof document=="undefined"?{}:{canvas:!!window.CanvasRenderingContext2D,webgl:function(){try{var e=document.createElement("canvas");return!!(window.WebGLRenderingContext&&(e.getContext("webgl")||e.getContext("experimental-webgl")))}catch{return!1}}(),workers:!!window.Worker,fileapi:window.File&&window.FileReader&&window.FileList&&window.Blob,getWebGLErrorMessage:function(){var t=document.createElement("div");return t.id="webgl-error-message",t.style.fontFamily="monospace",t.style.fontSize="13px",t.style.fontWeight="normal",t.style.textAlign="center",t.style.background="#fff",t.style.color="#000",t.style.padding="1.5em",t.style.width="400px",t.style.margin="5em auto 0",this.webgl||(t.innerHTML=window.WebGLRenderingContext?['Your graphics card does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" rel="external nofollow" rel="external nofollow" style="color:#000">WebGL</a>.<br />','Find out how to get it <a href="http://get.webgl.org/" rel="external nofollow" rel="external nofollow" style="color:#000">here</a>.'].join(`
`):['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(`
`)),t},addGetWebGLMessage:function(t){t=t||{};var n=t.parent!==void 0?t.parent:document.body,i=t.id!==void 0?t.id:"oldie",a=r().getWebGLErrorMessage();a.id=i,n.appendChild(a)}}},Wce=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",gpuDetector:f3}),as=P(P(P(P({},Ua),ZZ),jce),Wce),Xce=as.radialLayout,Yce=function(){function r(e){this.type=e.type,this.radial=e.radial,this.config=e}return r.prototype.init=function(e){var t=this;if(this.data=e,this.radial){this.layoutMethod=function(n){var i=_y[t.type](n,t.config);return Xce(i),i};return}this.layoutMethod=function(n){return _y[t.type](n,t.config)}},r.prototype.execute=function(){return this.layoutMethod(this.data,this.config)},r.prototype.layout=function(e){return this.init(e),this.execute()},r}();bi("grid",oQ);bi("random",sQ);bi("force",$Q);bi("circular",HQ);bi("dagre",Xte);bi("radial",Ire);bi("concentric",Cre);bi("mds",Mre);bi("fruchterman",Dre);bi("fruchterman-gpu",Tle);bi("gForce",uQ);bi("gForce-gpu",Mle);bi("comboForce",kle);bi("forceAtlas2",Dle);var Hce=function(e,t){t.isCustomLayout=!0,bi(e,t)},qce=function(){function r(e,t){var n=e.toString(),i=new Blob(["importScripts('"+t+"');("+n+")()"],{type:"text/javascript"});return new Worker(URL.createObjectURL(i))}return r}(),Kce=function(e){e===void 0&&(e="https://unpkg.com/@antv/layout@latest/dist/layout.min.js");function t(){var i={RUN:"LAYOUT_RUN",END:"LAYOUT_END",ERROR:"LAYOUT_ERROR",TICK:"LAYOUT_TICK",GPURUN:"GPU_LAYOUT_RUN",GPUEND:"GPU_LAYOUT_END"};layout.registerLayout("grid",layout.GridLayout),layout.registerLayout("random",layout.RandomLayout),layout.registerLayout("force",layout.ForceLayout),layout.registerLayout("circular",layout.CircularLayout),layout.registerLayout("dagre",layout.DagreLayout),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("forceAtlas2",layout.ForceAtlas2Layout);function a(s){var u=s.data.type;return u===i.RUN||u===i.GPURUN}function o(s){var u=this,l=s.data.type;switch(l){case i.RUN:{var c=s.data,f=c.nodes,d=c.edges,h=c.layoutCfg,v=h===void 0?{}:h,p=v.type,g=layout.getLayoutByName(p);if(!g){this.postMessage({type:i.ERROR,message:"layout "+p+" not found"});break}var y;v.onLayoutEnd=function(){u.postMessage({type:i.END,nodes:f}),y==null||y.destroy()},y=new g(v),y.init({nodes:f,edges:d}),y.execute();break}case i.GPURUN:{var m=s.data,b=m.nodes,d=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:i.ERROR,message:"layout "+p+" not found"});break}if(p.split("-")[1]!=="gpu"){this.postMessage({type:i.ERROR,message:"layout "+p+" does not support GPU"});break}var _=new g(v);_.init({nodes:b,edges:d}),_.executeWithWorker(x,this);break}}}onmessage=function(u){a(u)&&o(u)}}var n=new qce(t,e);return n},Rc={RUN:"LAYOUT_RUN",END:"LAYOUT_END",ERROR:"LAYOUT_ERROR",TICK:"LAYOUT_TICK",GPURUN:"GPU_LAYOUT_RUN",GPUEND:"GPU_LAYOUT_END"};function Sy(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Sy=function(t){return typeof t}:Sy=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Sy(r)}var h3=function(e){return setTimeout(e,16)},d3=function(e){return clearTimeout(e)},Ey={requestAnimationFrame:function(e){var t=typeof window!="undefined"&&(window.requestAnimationFrame||window.webkitRequestAnimationFrame)||h3;return t(e)},cancelAnimationFrame:function(e){var t=typeof window!="undefined"&&(window.cancelAnimationFrame||window.webkitCancelAnimationFrame)||d3;return t(e)}},Zce=["fruchterman","gForce"],Qce=["force","grid","circular"],Jce=function(r){Wt(e,r);function e(t){var n=r.call(this,t)||this;return n.graph=t,n.layoutCfg=t.get("layout")||{},n.layoutType=n.getLayoutType(),n.worker=null,n.workerData={},n.initLayout(),n}return e.prototype.initLayout=function(){},e.prototype.getWorker=function(){return this.worker?this.worker:(typeof Worker=="undefined"?(console.warn("Web worker is not supported in current browser."),this.worker=null):this.worker=Kce(this.layoutCfg.workerScriptURL),this.worker)},e.prototype.stopWorker=function(){var t=this.workerData;!this.worker||(this.worker.terminate(),this.worker=null,t.requestId&&(Ey.cancelAnimationFrame(t.requestId),t.requestId=null),t.requestId2&&(Ey.cancelAnimationFrame(t.requestId2),t.requestId2=null))},e.prototype.execLayoutMethod=function(t,n){var i=this;return new Promise(function(a,o){return Uo(i,void 0,void 0,function(){var s,u,l,c,f,d,h,v,f,p;return Go(this,function(g){switch(g.label){case 0:if(s=this.graph,s.get("destroyed"))return[2];u=t.type,t.onLayoutEnd=function(){s.emit("aftersublayout",{type:u}),a()},u&&this.isGPU&&(this.hasGPUVersion(u)?u=u+"-gpu":console.warn("The '"+u+"' layout does not support GPU calculation for now, it will run in CPU.")),l=u==="force"||u==="g6force"||u==="gForce",l?(c=t.onTick,f=function(){c&&c(),s.refreshPositions()},t.tick=f):t.type==="comboForce"&&(t.comboTrees=s.get("comboTrees")),d=!1;try{h=new hx[u](t)}catch{console.warn("The layout method: '"+u+"' does not exist! Please specify it first."),o()}return d=h.enableTick,d&&(v=t.onTick,f=function(){v&&v(),s.refreshPositions()},h.tick=f),p=this.filterLayoutData(this.data,t),rfe(p,n),h.init(p),s.emit("beforesublayout",{type:u}),[4,h.execute()];case 1:return g.sent(),h.isCustomLayout&&t.onLayoutEnd&&t.onLayoutEnd(),this.layoutMethods[n]=h,[2]}})})})},e.prototype.updateLayoutMethod=function(t,n){var i=this;return new Promise(function(a,o){return Uo(i,void 0,void 0,function(){var s,u,l;return Go(this,function(c){switch(c.label){case 0:return s=this.graph,u=n==null?void 0:n.type,n.onLayoutEnd=function(){s.emit("aftersublayout",{type:u}),a()},l=this.filterLayoutData(this.data,n),t.init(l),t.updateCfg(n),s.emit("beforesublayout",{type:u}),[4,t.execute()];case 1:return c.sent(),t.isCustomLayout&&n.onLayoutEnd&&n.onLayoutEnd(),[2]}})})})},e.prototype.layout=function(t){var n=this,i=this.graph;this.data=this.setDataFromGraph();var a=this.data,o=a.nodes,s=a.hiddenNodes;if(!o)return!1;var u=i.get("width"),l=i.get("height"),c={};Object.assign(c,{width:u,height:l,center:[u/2,l/2]},this.layoutCfg),this.layoutCfg=c,this.destoryLayoutMethods(),i.emit("beforelayout"),this.initPositions(c.center,o),this.initPositions(c.center,s);var f=c.type;f&&f.split("-")[1]==="gpu"&&(f=f.split("-")[0],c.gpuEnabled=!0);var d=!1;c.gpuEnabled&&(d=!0,f3().webgl||(console.warn("Your browser does not support webGL or GPGPU. The layout will run in CPU."),d=!1)),this.isGPU=d;var h=c.onLayoutEnd,v=c.layoutEndFormatted,p=c.adjust;if(v||(c.layoutEndFormatted=!0,c.onAllLayoutEnd=function(){return Uo(n,void 0,void 0,function(){return Go(this,function(y){switch(y.label){case 0:return h&&h(),this.refreshLayout(),p&&c.pipes?[4,this.adjustPipesBox(this.data,p)]:[3,2];case 1:y.sent(),this.refreshLayout(),y.label=2;case 2:return i.emit("afterlayout"),[2]}})})}),this.stopWorker(),c.workerEnabled&&this.layoutWithWorker(this.data))return!0;var g=Promise.resolve();return c.type?g=g.then(function(){return Uo(n,void 0,void 0,function(){return Go(this,function(y){switch(y.label){case 0:return[4,this.execLayoutMethod(c,0)];case 1:return[2,y.sent()]}})})}):c.pipes&&c.pipes.forEach(function(y,m){g=g.then(function(){return Uo(n,void 0,void 0,function(){return Go(this,function(b){switch(b.label){case 0:return[4,this.execLayoutMethod(y,m)];case 1:return[2,b.sent()]}})})})}),g.then(function(){c.onAllLayoutEnd&&c.onAllLayoutEnd(),t&&t()}).catch(function(y){console.warn("graph layout failed,",y)}),!1},e.prototype.layoutWithWorker=function(t){var n=this,i=this,a=i.layoutCfg,o=i.graph,s=this.getWorker(),u=this.workerData;if(!s)return!1;u.requestId=null,u.requestId2=null,u.currentTick=null,u.currentTickData=null,o.emit("beforelayout");var l=Promise.resolve();if(a.type)l=l.then(function(){return n.runWebworker(s,t,a)});else if(a.pipes)for(var c=function(p){l=l.then(function(){return n.runWebworker(s,t,p)})},f=0,d=a.pipes;f<d.length;f++){var h=d[f];c(h)}return l.then(function(){a.onAllLayoutEnd&&a.onAllLayoutEnd()}).catch(function(v){console.error("layout failed",v)}),!0},e.prototype.runWebworker=function(t,n,i){var a=this,o=this.isGPU,s=this.filterLayoutData(n,i),u=s.nodes,l=s.edges,c=document.createElement("canvas"),f=o&&typeof window!="undefined"&&window.navigator&&!navigator.gpu&&"OffscreenCanvas"in window&&"transferControlToOffscreen"in c,d=efe(i,function(v){return typeof v!="function"});if(!f)t.postMessage({type:Rc.RUN,nodes:u,edges:l,layoutCfg:d});else{var h=c.transferControlToOffscreen();d.type=d.type+"-gpu",t.postMessage({type:Rc.GPURUN,nodes:u,edges:l,layoutCfg:d,canvas:h},[h])}return new Promise(function(v,p){t.onmessage=function(g){a.handleWorkerMessage(v,p,g,s,i)}})},e.prototype.handleWorkerMessage=function(t,n,i,a,o){var s=this,u=s.graph,l=s.workerData,c=i.data,f=c.type,d=function(){o.onTick&&o.onTick()};switch(f){case Rc.TICK:l.currentTick=c.currentTick,l.currentTickData=c,l.requestId||(l.requestId=Ey.requestAnimationFrame(function(){px(a,c),u.refreshPositions(),d(),c.currentTick===c.totalTicks?t():l.currentTick===c.totalTicks&&(l.requestId2=Ey.requestAnimationFrame(function(){px(a,l.currentTickData),u.refreshPositions(),l.requestId2=null,d(),t()})),l.requestId=null}));break;case Rc.END:l.currentTick==null&&(px(a,c),t());break;case Rc.GPUEND:l.currentTick==null&&(tfe(a,c),t());break;case Rc.ERROR:console.warn("Web-Worker layout error!",c.message),n();break;default:n();break}},e.prototype.updateLayoutCfg=function(t){var n=this,i=this,a=i.graph,o=i.layoutMethods,s=It({},this.layoutCfg,t);if(this.layoutCfg=s,!(o==null?void 0:o.length)){this.layout();return}if(this.data=this.setDataFromGraph(),this.stopWorker(),!(t.workerEnabled&&this.layoutWithWorker(this.data))){a.emit("beforelayout");var u=Promise.resolve();o.length===1?u=u.then(function(){return Uo(n,void 0,void 0,function(){return Go(this,function(l){switch(l.label){case 0:return[4,this.updateLayoutMethod(o[0],s)];case 1:return[2,l.sent()]}})})}):o==null||o.forEach(function(l,c){var f=s.pipes[c];u=u.then(function(){return Uo(n,void 0,void 0,function(){return Go(this,function(d){switch(d.label){case 0:return[4,this.updateLayoutMethod(l,f)];case 1:return[2,d.sent()]}})})})}),u.then(function(){s.onAllLayoutEnd&&s.onAllLayoutEnd()}).catch(function(l){console.warn("layout failed",l)})}},e.prototype.adjustPipesBox=function(t,n){var i=this;return new Promise(function(a){var o=t.nodes;(o==null?void 0:o.length)||a(),Qce.includes(n)||(console.warn("The adjust type "+n+" is not supported yet, please assign it with 'force', 'grid', or 'circular'."),a());var s={center:i.layoutCfg.center,nodeSize:function(v){return Math.max(v.height,v.width)},preventOverlap:!0,onLayoutEnd:function(){}},u=i.getLayoutBBox(o),l=u.groupNodes,c=u.layoutNodes,f=Ur(c);s.onLayoutEnd=function(){c==null||c.forEach(function(h,v){var p,g,y,m=h.x-((p=f[v])===null||p===void 0?void 0:p.x),b=h.y-((g=f[v])===null||g===void 0?void 0:g.y);(y=l[v])===null||y===void 0||y.forEach(function(w){w.x+=m,w.y+=b})}),a()};var d=new hx[n](s);d.layout({nodes:c})})},e.prototype.hasGPUVersion=function(t){return Zce.includes(t)},e.prototype.destroy=function(){this.destoryLayoutMethods();var t=this.worker;t&&(t.terminate(),this.worker=null),this.destroyed=!0,this.graph.set("layout",void 0),this.layoutCfg=void 0,this.layoutType=void 0,this.layoutMethods=void 0,this.graph=null},e}(MH);function px(r,e){for(var t=r.nodes,n=e.nodes,i=t.length,a=0;a<i;a++){var o=t[a];o.x=n[a].x,o.y=n[a].y}}function efe(r,e){var t={};return r&&Sy(r)==="object"?(Object.keys(r).forEach(function(n){r.hasOwnProperty(n)&&e(r[n])&&(t[n]=r[n])}),t):r}function tfe(r,e){for(var t=r.nodes,n=e.vertexEdgeData,i=t.length,a=0;a<i;a++){var o=t[a],s=n[4*a],u=n[4*a+1];o.x=s,o.y=u}}function rfe(r,e){var t;if(!!((t=r==null?void 0:r.nodes)===null||t===void 0?void 0:t.length)){var n=r.nodes;n.forEach(function(i){i.layoutOrder=e})}}var v3=Up,nfe="svg",p3=function(r){Wt(e,r);function e(t){var n=r.call(this,t)||this,i=n.get("defaultNode");return i||n.set("defaultNode",{type:"circle"}),i.type||(i.type="circle",n.set("defaultNode",i)),n.destroyed=!1,n}return e.prototype.initLayoutController=function(){var t=new Jce(this);this.set({layoutController:t})},e.prototype.initEventController=function(){var t=new nQ(this);this.set({eventController:t})},e.prototype.initCanvas=function(){var t=this.get("container");if(typeof t=="string"&&(t=document.getElementById(t),this.set("container",t)),!t)throw new Error("invalid container");var n=t.clientWidth,i=t.clientHeight,a=this.get("width")||n,o=this.get("height")||i;!this.get("width")&&!this.get("height")&&(this.set("width",n),this.set("height",i));var s=this.get("renderer"),u;if(s===nfe)u=new Ih({container:t,width:a,height:o});else{var l={container:t,width:a,height:o},c=this.get("pixelRatio");c&&(l.pixelRatio=c),u=new Os(l)}this.set("canvas",u)},e.prototype.initPlugins=function(){var t=this;xe(t.get("plugins"),function(n){!n.destroyed&&n.initPlugin&&n.initPlugin(t)})},e.prototype.downloadImageWatermark=function(t,n,i,a){return Uo(this,void 0,void 0,function(){var o,s,u;return Go(this,function(l){switch(l.label){case 0:return o=t.style.backgroundImage,s=o.slice(5,o.length-2),u=new Image,u.src=s,[4,new Promise(function(c){u.onload=function(){var f=n.createPattern(u,"repeat");n.rect(0,0,i,a),n.fillStyle=f,n.fill(),c("")}})];case 1:return l.sent(),[2]}})})},e.prototype.asyncToDataUrl=function(t,n,i,a,o,s){var u=this,l=document.querySelector(".g6-graph-watermarker"),c=this.get("canvas"),f=c.getRenderer(),d=s||c.get("el"),h="";t||(t="image/png"),setTimeout(function(){return Uo(u,void 0,void 0,function(){var v,p,g,y,m,b,w,x,_,A;return Go(this,function(I){switch(I.label){case 0:return f!=="svg"?[3,1]:(v=d.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),h="data:image/svg+xml;charset=utf8,"+encodeURIComponent(y),[3,4]);case 1:return m=void 0,b=d.getContext("2d"),w=a||this.get("width"),x=o||this.get("height"),_=void 0,l?[4,this.downloadImageWatermark(l,b,w,x)]:[3,3];case 2:I.sent(),I.label=3;case 3:if(n){A=typeof window!="undefined"?window.devicePixelRatio:1;try{m=b.getImageData(0,0,w*A,x*A),_=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")}}h=d.toDataURL(t),n&&(b.clearRect(0,0,w,x),b.putImageData(m,0,0),b.globalCompositeOperation=_),I.label=4;case 4:return i&&i(h),[2]}})})},16)},e.prototype.toDataURL=function(t,n){var i=this.get("canvas"),a=i.getRenderer(),o=i.get("el");t||(t="image/png");var s="";if(a==="svg"){var u=o.cloneNode(!0),l=document.implementation.createDocumentType("svg","-//W3C//DTD SVG 1.1//EN","http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"),c=document.implementation.createDocument("http://www.w3.org/2000/svg","svg",l);c.replaceChild(u,c.documentElement);var f=new XMLSerializer().serializeToString(c);s="data:image/svg+xml;charset=utf8,"+encodeURIComponent(f)}else{var d=void 0,h=o.getContext("2d"),v=this.get("width"),p=this.get("height"),g=void 0;if(n){var y=typeof window!="undefined"?window.devicePixelRatio:1;try{d=h.getImageData(0,0,v*y,p*y),g=h.globalCompositeOperation,h.globalCompositeOperation="destination-over",h.fillStyle=n,h.fillRect(0,0,v,p)}catch{console.error("Download image failed. Out of memory at ImageData creation")}}s=o.toDataURL(t),n&&(h.clearRect(0,0,v,p),h.putImageData(d,0,0),h.globalCompositeOperation=g)}return s},e.prototype.toFullDataURL=function(t,n,i){var a=this.get("group").getCanvasBBox(),o=a.height,s=a.width,u=this.get("renderer"),l=An('<id="virtual-image"></div>'),c=i?i.backgroundColor:void 0,f=i?i.padding:void 0;f?Ft(f)&&(f=[f,f,f,f]):f=[0,0,0,0];var d=o+f[0]+f[2],h=s+f[1]+f[3],v={container:l,height:d,width:h,quickHit:!0},p=u==="svg"?new Ih(v):new Os(v),g=this.get("group"),y=g.clone(),m=Ur(y.getMatrix());m||(m=[1,0,0,0,1,0,0,0,1]);var b=(a.maxX+a.minX)/2,w=(a.maxY+a.minY)/2;m=v3(m,[["t",-b,-w],["t",s/2+f[3],o/2+f[0]]]),y.resetMatrix(),y.setMatrix(m),p.add(y);var x=p.get("el"),_="";n||(n="image/png"),setTimeout(function(){if(u==="svg"){var A=x.cloneNode(!0),I=document.implementation.createDocumentType("svg","-//W3C//DTD SVG 1.1//EN","http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"),M=document.implementation.createDocument("http://www.w3.org/2000/svg","svg",I);M.replaceChild(A,M.documentElement);var S=new XMLSerializer().serializeToString(M);_="data:image/svg+xml;charset=utf8,"+encodeURIComponent(S)}else{var C=void 0,T=x.getContext("2d"),k=void 0;if(c){var L=typeof window!="undefined"?window.devicePixelRatio:1;try{C=T.getImageData(0,0,h*L,d*L),k=T.globalCompositeOperation,T.globalCompositeOperation="destination-over",T.fillStyle=c,T.fillRect(0,0,h,d)}catch{console.error("Download image failed. Out of memory at ImageData creation")}}_=x.toDataURL(n),c&&(T.clearRect(0,0,h,d),T.putImageData(C,0,0),T.globalCompositeOperation=k)}t&&t(_)},16)},e.prototype.downloadFullImage=function(t,n,i){var a=this,o=this.get("group").getCanvasBBox(),s=o.height,u=o.width,l=this.get("renderer"),c=An('<id="virtual-image"></div>'),f=document.querySelector(".g6-graph-watermarker"),d=i?i.backgroundColor:void 0,h=i?i.padding:void 0;h?Ft(h)&&(h=[h,h,h,h]):h=[0,0,0,0];var v=s+h[0]+h[2],p=u+h[1]+h[3];if(f){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:c,height:v,width:p},w=l==="svg"?new Ih(b):new Os(b),x=this.get("group"),_=x.clone(),A=Ur(_.getMatrix());A||(A=[1,0,0,0,1,0,0,0,1]);var I=(o.maxX+o.minX)/2,M=(o.maxY+o.minY)/2;A=v3(A,[["t",-I,-M],["t",u/2+h[3],s/2+h[0]]]),_.resetMatrix(),_.setMatrix(A),w.add(_);var S=w.get("el");n||(n="image/png"),this.asyncToDataUrl(n,d,function(C){var T=document.createElement("a"),k=(t||"graph")+(l==="svg"?".svg":"."+n.split("/")[1]);a.dataURLToImage(C,l,T,k);var L=document.createEvent("MouseEvents");L.initEvent("click",!1,!1),T.dispatchEvent(L)},p,v,S)},e.prototype.downloadImage=function(t,n,i){var a=this,o=this;o.isAnimating()&&o.stopAnimate();var s=o.get("canvas"),u=s.getRenderer();n||(n="image/png");var l=(t||"graph")+(u==="svg"?".svg":n.split("/")[1]),c=document.createElement("a");o.asyncToDataUrl(n,i,function(f){a.dataURLToImage(f,u,c,l);var d=document.createEvent("MouseEvents");d.initEvent("click",!1,!1),c.dispatchEvent(d)})},e.prototype.dataURLToImage=function(t,n,i,a){if(!t||t==="data:"){console.error("Download image failed. The graph is too large or there is invalid attribute values in graph items");return}if(typeof window!="undefined")if(window.Blob&&window.URL&&n!=="svg"){var o=t.split(","),s="";if(o&&o.length>0){var u=o[0].match(/:(.*?);/);u&&u.length>=2&&(s=u[1])}for(var l=atob(o[1]),c=l.length,f=new Uint8Array(c);c--;)f[c]=l.charCodeAt(c);var d=new Blob([f],{type:s});window.navigator.msSaveBlob?window.navigator.msSaveBlob(d,a):i.addEventListener("click",function(){i.download=a,i.href=window.URL.createObjectURL(d)})}else i.addEventListener("click",function(){i.download=a,i.href=t})},e.prototype.addPlugin=function(t){var n=this;t.destroyed||(n.get("plugins").push(t),t.initPlugin(n))},e.prototype.removePlugin=function(t){var n=this.get("plugins"),i=n.indexOf(t);i>=0&&(t.destroyPlugin(),n.splice(i,1))},e.prototype.setImageWaterMarker=function(t,n){t===void 0&&(t=Zu.waterMarkerImage);var i=this.get("container");We(i)&&(i=document.getElementById(i)),i.style.position||(i.style.position="relative");var a=this.get("graphWaterMarker"),o=tn({},Zu.imageWaterMarkerConfig,n),s=o.width,u=o.height,l=o.compatible,c=o.image;if(!a){var f={container:i,width:s,height:u,capture:!1},d=this.get("pixelRatio");d&&(f.pixelRatio=d),a=new Os(f),this.set("graphWaterMarker",a)}a.get("el").style.display="none";var h=a.get("context"),v=c.rotate,p=c.x,g=c.y;h.rotate(-v*Math.PI/180);var y=new Image;y.crossOrigin="anonymous",y.src=t,y.onload=function(){if(h.drawImage(y,p,g,c.width,c.height),h.rotate(v*Math.PI/180),l)i.style.cssText="background-image: url("+a.get("el").toDataURL("image/png")+");background-repeat:repeat;";else{var m=document.querySelector(".g6-graph-watermarker");m||(m=document.createElement("div"),m.className="g6-graph-watermarker"),m.className="g6-graph-watermarker",a.destroyed||(m.style.cssText="background-image: url("+a.get("el").toDataURL("image/png")+");background-repeat:repeat;position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none;z-index:-1;",i.appendChild(m))}}},e.prototype.setTextWaterMarker=function(t,n){var i=this.get("container");We(i)&&(i=document.getElementById(i)),i.style.position||(i.style.position="relative");var a=this.get("graphWaterMarker"),o=tn({},Zu.textWaterMarkerConfig,n),s=o.width,u=o.height,l=o.compatible,c=o.text;if(!a){var f={container:i,width:s,height:u,capture:!1},d=this.get("pixelRatio");d&&(f.pixelRatio=d),a=new Os(f),this.set("graphWaterMarker",a)}a.get("el").style.display="none";var h=a.get("context"),v=c.rotate,p=c.fill,g=c.fontFamily,y=c.fontSize,m=c.baseline,b=c.x,w=c.y,x=c.lineHeight;h.rotate(-v*Math.PI/180),h.font=y+"px "+g,h.fillStyle=p,h.textBaseline=m;for(var _=t.length-1;_>=0;_--)h.fillText(t[_],b,w+_*x);if(h.rotate(v*Math.PI/180),l)i.style.cssText="background-image: url("+a.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("+a.get("el").toDataURL("image/png")+");background-repeat:repeat;position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none;z-index:99;",i.appendChild(A)}},e.prototype.destroy=function(){var t,n,i,a;xe(this.get("plugins"),function(c){c.destroyPlugin()});var o=this.get("tooltips");if(o)for(var s=0;s<o.length;s++){var u=o[s];if(!!u){var l=u.parentElement;!l||l.removeChild(u)}}(t=this.get("eventController"))===null||t===void 0||t.destroy(),(n=this.get("layoutController"))===null||n===void 0||n.destroy(),(i=this.get("graphWaterMarker"))===null||i===void 0||i.destroy(),(a=document.querySelector(".g6-graph-watermarker"))===null||a===void 0||a.remove(),r.prototype.destroy.call(this)},e}(vH),ife=as.radialLayout,afe=as.traverseTree,ofe=function(r){Wt(e,r);function e(t){var n=r.call(this,t)||this;return n.layoutAnimating=!1,n.set("removeList",[]),n.set("layoutMethod",n.getLayout()),n}return e.prototype.getLayout=function(){var t=this.get("layout");return t?typeof t=="function"?t:(t.type||(t.type="dendrogram"),t.direction||(t.direction="TB"),t.radial?function(n){var i=_y[t.type](n,t);return ife(i),i}:function(n){return _y[t.type](n,t)}):null},e.indexOfChild=function(t,n){var i=-1;return xe(t,function(a,o){if(n===a.id)return i=o,!1}),i},e.prototype.getDefaultCfg=function(){var t=r.prototype.getDefaultCfg.call(this);return t.animate=!0,t},e.prototype.innerAddChild=function(t,n,i){var a=this,o=t.data;o&&(o.x=t.x,o.y=t.y,o.depth=t.depth);var s=a.addItem("node",o,!1);if(n){if(s.set("parent",n),i){var u=n.get("originAttrs");if(u)s.set("originAttrs",u);else{var l=n.getModel();s.set("originAttrs",{x:l.x,y:l.y})}}var c=n.get("children");c?c.push(s):n.set("children",[s]),a.addItem("edge",{source:n.get("id"),target:s.get("id"),id:n.get("id")+":"+s.get("id")},!1)}return xe(t.children||[],function(f){a.innerAddChild(f,s,i)}),a.emit("afteraddchild",{item:s,parent:n}),s},e.prototype.innerUpdateChild=function(t,n,i){var a=this,o=a.findById(t.id);if(!o){a.innerAddChild(t,n,i);return}xe(t.children||[],function(v){a.innerUpdateChild(v,o,i)});var s=o.get("children");if(s){var u=s.length;if(u>0)for(var l=s.length-1;l>=0;l--){var c=s[l].getModel();e.indexOfChild(t.children||[],c.id)===-1&&(a.innerRemoveChild(c.id,{x:t.x,y:t.y},i),s.splice(l,1))}}var f,d;o.get("originAttrs")&&(f=o.get("originAttrs").x,d=o.get("originAttrs").y);var h=o.getModel();i&&o.set("originAttrs",{x:h.x,y:h.y}),o.set("model",t.data),(f!==t.x||d!==t.y)&&o.updatePosition({x:t.x,y:t.y})},e.prototype.innerRemoveChild=function(t,n,i){var a=this,o=a.findById(t);if(!!o)if(xe(o.get("children"),function(u){a.innerRemoveChild(u.getModel().id,n,i)}),i){var s=o.getModel();o.set("to",n),o.set("originAttrs",{x:s.x,y:s.y}),a.get("removeList").push(o)}else a.removeItem(o,!1)},e.prototype.changeData=function(t){var n=this;this.getNodes().map(function(i){return n.clearItemStates(i)}),this.getEdges().map(function(i){return n.clearItemStates(i)}),t?(n.data(t),n.render()):n.layout(this.get("fitView"))},e.prototype.changeLayout=function(t){console.warn("Please call updateLayout instead of changeLayout. changeLayout will be discarded soon");var n=this;n.updateLayout(t)},e.prototype.updateLayout=function(t){var n=this;if(!t){console.warn("layout cannot be null");return}n.set("layout",t),n.set("layoutMethod",n.getLayout()),n.layout()},e.prototype.refreshLayout=function(t){console.warn("Please call layout instead of refreshLayout. refreshLayout will be discarded soon");var n=this;n.layout(t)},e.prototype.layout=function(t){var n=this,i=n.get("data"),a=n.get("layoutMethod"),o=a?a(i,n.get("layout")):i,s=n.get("animate");if(n.emit("beforerefreshlayout",{data:i,layoutData:o}),n.emit("beforelayout"),n.innerUpdateChild(o,void 0,s),t){var u=n.get("viewController");u.fitView()}s?n.layoutAnimate(o):(n.refresh(),n.paint()),n.emit("afterrefreshlayout",{data:i,layoutData:o}),n.emit("afterlayout")},e.prototype.addChild=function(t,n){var i=this;i.emit("beforeaddchild",{model:t,parent:n}),We(n)||(n=n.get("id"));var a=i.findDataById(n);a&&(a.children||(a.children=[]),a.children.push(t),i.changeData())},e.prototype.updateChildren=function(t,n){var i=this;if(!n||!i.findById(n)){console.warn("Update children failed! There is no node with id '"+n+"'");return}var a=i.findDataById(n);a.children=t,i.changeData()},e.prototype.updateChild=function(t,n){var i=this;if(!n||!i.findById(n)){i.changeData(t);return}var a=i.findDataById(n),o=i.findById(t.id);if(a.children||(a.children=[]),!o)a.children.push(t);else{var s=e.indexOfChild(a.children,t.id);a.children[s]=t}i.changeData()},e.prototype.removeChild=function(t){var n=this,i=n.findById(t);if(!!i){var a=i.get("parent");if(a&&!a.destroyed){var o=n.findDataById(a.get("id")),s=o&&o.children||[],u=i.getModel(),l=e.indexOfChild(s,u.id);s.splice(l,1)}n.changeData()}},e.prototype.findDataById=function(t,n){var i=this;if(n||(n=i.get("data")),t===n.id)return n;var a=null;return xe(n.children||[],function(o){if(o.id===t)return a=o,!1;if(a=i.findDataById(t,o),a)return!1}),a},e.prototype.layoutAnimate=function(t,n){var i=this,a=this.get("animateCfg");i.emit("beforeanimate",{data:t}),i.getEdges().forEach(function(o){var s=o.get("model");s.sourceAnchor||(s.sourceAnchor=o.get("sourceAnchorIndex"))}),this.get("canvas").animate(function(o){afe(t,function(s){var u=i.findById(s.id);if(u){var l=u.get("originAttrs"),c=u.get("model");if(l||(l={x:c.x,y:c.y},u.set("originAttrs",l)),n){var f=n(u,o,l,t);u.set("model",Object.assign(c,f))}else c.x=l.x+(s.x-l.x)*o,c.y=l.y+(s.y-l.y)*o}return!0}),xe(i.get("removeList"),function(s){var u=s.getModel(),l=s.get("originAttrs"),c=s.get("to");u.x=l.x+(c.x-l.x)*o,u.y=l.y+(c.y-l.y)*o}),i.refreshPositions()},{duration:a.duration,easing:a.ease,callback:function(){xe(i.getNodes(),function(s){s.set("originAttrs",null)}),xe(i.get("removeList"),function(s){i.removeItem(s)}),i.set("removeList",[]),a.callback&&a.callback(),i.emit("afteranimate",{data:t})},delay:a.delay})},e.prototype.stopLayoutAnimate=function(){this.get("canvas").stopAnimate(),this.emit("layoutanimateend",{data:this.get("data")}),this.layoutAnimating=!1},e.prototype.isLayoutAnimating=function(){return this.layoutAnimating},e.prototype.render=function(){var t=this,n=t.get("data");if(!n||!gi(n)||!Object.keys(n).length)throw new Error("data must be defined first");t.clear(),t.emit("beforerender"),t.layout(this.get("fitView")),t.emit("afterrender")},e.prototype.save=function(){return this.get("data")},e}(p3),sfe=function(){function r(e){this._cfgs=tn(this.getDefaultCfgs(),e),this._events={},this.destroyed=!1}return r.prototype.getDefaultCfgs=function(){return{}},r.prototype.initPlugin=function(e){var t=this;t.set("graph",e);var n=t.getEvents(),i={};xe(n,function(a,o){var s=ec(t,a);i[o]=s,e.on(o,s)}),this._events=i,this.init()},r.prototype.getEvents=function(){return{}},r.prototype.get=function(e){var t;return(t=this._cfgs)===null||t===void 0?void 0:t[e]},r.prototype.set=function(e,t){this._cfgs[e]=t},r.prototype.destroy=function(){},r.prototype.destroyPlugin=function(){this.destroy();var e=this.get("graph"),t=this._events;xe(t,function(n,i){e.off(i,n)}),this._events=null,this._cfgs=null,this.destroyed=!0},r}(),aa=sfe,ufe=globalThis&&globalThis.__extends||function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),g3="url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PHBhdHRlcm4gaWQ9ImdyaWQiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcGF0dGVyblVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHBhdGggZD0iTSAwIDEwIEwgNDAgMTAgTSAxMCAwIEwgMTAgNDAgTSAwIDIwIEwgNDAgMjAgTSAyMCAwIEwgMjAgNDAgTSAwIDMwIEwgNDAgMzAgTSAzMCAwIEwgMzAgNDAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2UwZTBlMCIgb3BhY2l0eT0iMC4yIiBzdHJva2Utd2lkdGg9IjEiLz48cGF0aCBkPSJNIDQwIDAgTCAwIDAgMCA0MCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZTBlMGUwIiBzdHJva2Utd2lkdGg9IjEiLz48L3BhdHRlcm4+PC9kZWZzPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JpZCkiLz48L3N2Zz4=)",lfe=function(r){ufe(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{img:g3,follow:!0}},e.prototype.init=function(){var t=this.get("graph"),n=t.get("container"),i=t.get("canvas").get("el"),a=this.get("img")||g3,o=An(`<div class='g6-grid-container' style="position:absolute;overflow:hidden;z-index: -1;"></div>`),s=An(`<div
        class='g6-grid'
        style='position:absolute;
        background-image: `+a+`;
        user-select: none
        '></div>`);this.set("container",o),this.set("gridContainer",s),this.positionInit(),o.appendChild(s),n.insertBefore(o,i)},e.prototype.positionInit=function(){var t=this.get("graph"),n=t.get("minZoom"),i=t.get("width"),a=t.get("height");jr(this.get("container"),{width:i+"px",height:a+"px"});var o=i*80/n,s=a*80/n;jr(this.get("gridContainer"),{width:o+"px",height:s+"px",left:"-"+o/2+"px",top:"-"+s/2+"px"})},e.prototype.getEvents=function(){return{viewportchange:"updateGrid"}},e.prototype.updateGrid=function(t){var n=this.get("gridContainer"),i=t.matrix;i||(i=[1,0,0,0,1,0,0,0,1]);var a=this.get("follow"),o="matrix("+i[0]+", "+i[1]+", "+i[3]+", "+i[4]+", "+(a?i[6]:"0")+", "+(a?i[7]:"0")+")";jr(n,{transform:o})},e.prototype.getContainer=function(){return this.get("container")},e.prototype.destroy=function(){var t=this.get("graph"),n=t.get("container"),i=this.get("container");n.removeChild(i)},e}(aa),cfe=lfe,gx={exports:{}},y3=[],ud=[],ffe="insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).";function m3(r,e){if(e=e||{},r===void 0)throw new Error(ffe);var t=e.prepend===!0?"prepend":"append",n=e.container!==void 0?e.container:document.querySelector("head"),i=y3.indexOf(n);i===-1&&(i=y3.push(n)-1,ud[i]={});var a;return ud[i]!==void 0&&ud[i][t]!==void 0?a=ud[i][t]:(a=ud[i][t]=hfe(),t==="prepend"?n.insertBefore(a,n.childNodes[0]):n.appendChild(a)),r.charCodeAt(0)===65279&&(r=r.substr(1,r.length)),a.styleSheet?a.styleSheet.cssText+=r:a.textContent+=r,a}function hfe(){var r=document.createElement("style");return r.setAttribute("type","text/css"),r}gx.exports=m3;gx.exports.insertCss=m3;var yx=gx.exports,dfe=globalThis&&globalThis.__extends||function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();typeof document!="undefined"&&yx(`
  .g6-component-contextmenu {
    border: 1px solid #e2e2e2;
    border-radius: 4px;
    font-size: 12px;
    color: #545454;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 10px 8px;
    box-shadow: rgb(174, 174, 174) 0px 0px 10px;
  }
  .g6-contextmenu-ul {
    padding: 0;
    margin: 0;
    list-style: none;
  }

`);var vfe=function(r){dfe(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{offsetX:6,offsetY:6,handleMenuClick:void 0,getContent:function(n){return`
          <ul class='g6-contextmenu-ul'>
            <li>\u83DC\u5355\u98791</li>
            <li>\u83DC\u5355\u98792</li>
          </ul>
        `},shouldBegin:function(n){return!0},onHide:function(){return!0},itemTypes:["node","edge","combo"],trigger:"contextmenu"}},e.prototype.getEvents=function(){return this.get("trigger")==="click"?{click:"onMenuShow"}:{contextmenu:"onMenuShow"}},e.prototype.init=function(){var t=this.get("className"),n=An("<div class="+(t||"g6-component-contextmenu")+"></div>");jr(n,{top:"0px",position:"absolute",visibility:"hidden"});var i=this.get("container");i||(i=this.get("graph").get("container")),We(i)&&(i=document.getElementById(i)),i.appendChild(n),this.set("menu",n)},e.prototype.onMenuShow=function(t){var n=this;t.preventDefault();var i=this.get("itemTypes");if(t.item){if(t.item&&t.item.getType&&i.indexOf(t.item.getType())===-1){n.onMenuHide();return}}else if(i.indexOf("canvas")===-1){n.onMenuHide();return}var a=this.get("shouldBegin");if(!!a(t)){var o=this.get("menu"),s=this.get("getContent"),u=this.get("graph"),l=s(t,u);We(l)?o.innerHTML=l:o.innerHTML=l.outerHTML,this.removeMenuEventListener();var c=this.get("handleMenuClick");if(c){var f=function(I){c(I.target,t.item,u)};this.set("handleMenuClickWrapper",f),o.addEventListener("click",f)}var d=u.get("width"),h=u.get("height"),v=o.getBoundingClientRect(),p=this.get("offsetX")||0,g=this.get("offsetY")||0,y=u.getContainer().offsetTop,m=u.getContainer().offsetLeft,b=t.canvasX+m+p,w=t.canvasY+y+g;b+v.width>d&&(b=t.canvasX-v.width-p+m),w+v.height>h&&(w=t.canvasY-v.height-g+y),jr(o,{top:w+"px",left:b+"px",visibility:"visible"});var x=this.get("trigger")==="click",_=function(I){if(x){x=!1;return}n.onMenuHide()};document.body.addEventListener("click",_),this.set("handler",_)}},e.prototype.removeMenuEventListener=function(){var t=this.get("handleMenuClickWrapper"),n=this.get("handler");if(t){var i=this.get("menu");i.removeEventListener("click",t),this.set("handleMenuClickWrapper",null)}n&&document.body.removeEventListener("click",n)},e.prototype.onMenuHide=function(){var t=this.get("menu");t&&jr(t,{visibility:"hidden"}),this.removeMenuEventListener()},e.prototype.destroy=function(){var t=this.get("menu");if(this.removeMenuEventListener(),t){var n=this.get("container");n||(n=this.get("graph").get("container")),We(n)&&(n=document.getElementById(n)),n.removeChild(t)}},e}(aa),pfe=vfe,gfe=globalThis&&globalThis.__extends||function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),mx=globalThis&&globalThis.__assign||function(){return mx=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},mx.apply(this,arguments)},b3=Math.max,yfe=Up,mfe="default",bfe="keyShape",wfe="delegate",w3="svg",xfe=function(r){gfe(e,r);function e(t){var n=r.call(this,t)||this;return n.handleUpdateCanvas=gb(function(i){var a=n;a.destroyed||a.updateCanvas()},100,!1),n}return e.prototype.getDefaultCfgs=function(){return{container:null,className:"g6-minimap",viewportClassName:"g6-minimap-viewport",type:"default",padding:50,size:[200,120],delegateStyle:{fill:"#40a9ff",stroke:"#096dd9"},refresh:!0}},e.prototype.getEvents=function(){return{beforepaint:"updateViewport",beforeanimate:"disableRefresh",afteranimate:"enableRefresh",viewportchange:"disableOneRefresh"}},e.prototype.disableRefresh=function(){this.set("refresh",!1)},e.prototype.enableRefresh=function(){this.set("refresh",!0),this.updateCanvas()},e.prototype.disableOneRefresh=function(){this.set("viewportChange",!0)},e.prototype.initViewport=function(){var t=this,n=this._cfgs,i=n.size,a=n.graph;if(!this.destroyed){var o=this.get("canvas"),s=o.get("container"),u=An(`
      <div
        class=`+n.viewportClassName+`
        style='position:absolute;
          left:0;
          top:0;
          box-sizing:border-box;
          outline: 2px solid #1980ff'
        draggable=true>
      </div>`),l=navigator.userAgent.toLowerCase().indexOf("firefox")>-1,c=0,f=0,d=!1,h=0,v=0,p=0,g=0,y=0,m=0;u.addEventListener("dragstart",function(b){var w,x;if(b.dataTransfer){var _=new Image;_.src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' %3E%3Cpath /%3E%3C/svg%3E",(x=(w=b.dataTransfer).setDragImage)===null||x===void 0||x.call(w,_,0,0);try{b.dataTransfer.setData("text/html","view-port-minimap")}catch{b.dataTransfer.setData("text","view-port-minimap")}}if(n.refresh=!1,b.target===u){var A=u.style;h=parseInt(A.left,10),v=parseInt(A.top,10),p=parseInt(A.width,10),g=parseInt(A.height,10),!(p>i[0]||g>i[1])&&(m=a.getZoom(),y=t.get("ratio"),d=!0,c=b.clientX,f=b.clientY)}},!1),u.addEventListener(l?"dragover":"drag",function(b){if(!(!d||xt(b.clientX)||xt(b.clientY))){var w=c-b.clientX,x=f-b.clientY;(h-w<0||h-w+p>=i[0])&&(w=0),(v-x<0||v-x+g>=i[1])&&(x=0),h-=w,v-=x,jr(u,{left:h+"px",top:v+"px"}),a.translate(w*m/y,x*m/y),c=b.clientX,f=b.clientY}},!1),u.addEventListener("dragend",function(){d=!1,n.refresh=!0},!1),this.set("viewport",u),s.appendChild(u)}},e.prototype.updateViewport=function(){if(!this.destroyed){var t=this.get("ratio");this.get("dx"),this.get("dy");var n=this.get("totaldx"),i=this.get("totaldy"),a=this.get("graph"),o=this.get("size"),s=a.get("width"),u=a.get("height"),l=a.getPointByCanvas(0,0),c=a.getPointByCanvas(s,u),f=this.get("viewport");f||this.initViewport();var d=(c.x-l.x)*t,h=(c.y-l.y)*t,v=l.x*t+n,p=l.y*t+i,g=v+d,y=p+h;v<0&&(d+=v,v=0),g>o[0]&&(d=d-(g-o[0])),p<0&&(h+=p,p=0),y>o[1]&&(h=h-(y-o[1])),this.set("ratio",t);var m=v+"px",b=p+"px";jr(f,{left:m,top:b,width:d+"px",height:h+"px"})}},e.prototype.updateGraphShapes=function(){var t=this._cfgs.graph,n=this.get("canvas"),i=t.get("group");if(!i.destroyed){var a=i.clone();a.resetMatrix(),n.clear(),n.add(a);var o=t.get("renderer");o===w3&&this.updateVisible(a)}},e.prototype.updateVisible=function(t){var n=this;if(!t.isGroup()&&!t.get("visible"))t.hide();else{var i=t.get("children");if(!i||!i.length)return;i.forEach(function(a){a.get("visible")||a.hide(),n.updateVisible(a)})}},e.prototype.updateKeyShapes=function(){var t=this,n=this._cfgs.graph,i=this.get("canvas"),a=i.get("children")[0]||i.addGroup();xe(n.getEdges(),function(u){t.updateOneEdgeKeyShape(u,a)}),xe(n.getNodes(),function(u){t.updateOneNodeKeyShape(u,a)});var o=n.getCombos();if(o&&o.length){var s=a.find(function(u){return u.get("name")==="comboGroup"})||a.addGroup({name:"comboGroup"});setTimeout(function(){t.destroyed||(xe(o,function(u){t.updateOneComboKeyShape(u,s)}),s==null||s.sort(),s==null||s.toBack(),t.updateCanvas())},250)}this.clearDestroyedShapes()},e.prototype.updateOneComboKeyShape=function(t,n){if(!this.destroyed){var i=this.get("itemMap")||{},a=i[t.get("id")],o=t.getBBox(),s=t.get("keyShape").clone(),u=s.attr(),l={x:o.centerX,y:o.centerY};a?l=Object.assign(u,l):(a=s,n.add(a));var c=a.get("type");(c==="rect"||c==="image")&&(l.x=o.minX,l.y=o.minY),a.attr(l),t.isVisible()?a.show():a.hide(),a.exist=!0;var f=t.getModel().depth;isNaN(f)||a.set("zIndex",f),i[t.get("id")]=a,this.set("itemMap",i)}},e.prototype.updateOneNodeKeyShape=function(t,n){var i=this.get("itemMap")||{},a=i[t.get("id")],o=t.getBBox(),s=t.get("keyShape").clone(),u=s.attr(),l={x:o.centerX,y:o.centerY};a?l=Object.assign(u,l):(a=s,n.add(a));var c=a.get("type");(c==="rect"||c==="image")&&(l.x=o.minX,l.y=o.minY),a.attr(l),t.isVisible()?a.show():a.hide(),a.exist=!0;var f=t.getModel().depth;isNaN(f)||a.set("zIndex",f),i[t.get("id")]=a,this.set("itemMap",i)},e.prototype.updateDelegateShapes=function(){var t=this,n=this._cfgs.graph,i=this.get("canvas"),a=i.get("children")[0]||i.addGroup();xe(n.getEdges(),function(u){t.updateOneEdgeKeyShape(u,a)}),xe(n.getNodes(),function(u){t.updateOneNodeDelegateShape(u,a)});var o=n.getCombos();if(o&&o.length){var s=a.find(function(u){return u.get("name")==="comboGroup"})||a.addGroup({name:"comboGroup"});setTimeout(function(){t.destroyed||(xe(o,function(u){t.updateOneComboKeyShape(u,s)}),s==null||s.sort(),s==null||s.toBack(),t.updateCanvas())},250)}this.clearDestroyedShapes()},e.prototype.clearDestroyedShapes=function(){var t=this.get("itemMap")||{},n=Object.keys(t);if(!(!n||n.length===0))for(var i=n.length-1;i>=0;i--){var a=t[n[i]],o=a.exist;a.exist=!1,o||(a.remove(),delete t[n[i]])}},e.prototype.updateOneEdgeKeyShape=function(t,n){var i=this.get("itemMap")||{},a=i[t.get("id")];if(a){var o=t.get("keyShape").attr("path");a.attr("path",o)}else a=t.get("keyShape").clone(),n.add(a);t.isVisible()?a.show():a.hide(),a.exist=!0,i[t.get("id")]=a,this.set("itemMap",i)},e.prototype.updateOneNodeDelegateShape=function(t,n){var i=this.get("delegateStyle"),a=this.get("itemMap")||{},o=a[t.get("id")],s=t.getBBox();if(o){var u={x:s.minX,y:s.minY,width:s.width,height:s.height};o.attr(u)}else o=n.addShape("rect",{attrs:mx({x:s.minX,y:s.minY,width:s.width,height:s.height},i),name:"minimap-node-shape"});t.isVisible()?o.show():o.hide(),o.exist=!0,a[t.get("id")]=o,this.set("itemMap",a)},e.prototype.init=function(){this.initContainer(),this.get("graph").on("afterupdateitem",this.handleUpdateCanvas),this.get("graph").on("afteritemstatechange",this.handleUpdateCanvas),this.get("graph").on("afteradditem",this.handleUpdateCanvas),this.get("graph").on("afterremoveitem",this.handleUpdateCanvas),this.get("graph").on("afterrender",this.handleUpdateCanvas),this.get("graph").on("afterlayout",this.handleUpdateCanvas)},e.prototype.initContainer=function(){var t=this,n=t.get("graph"),i=t.get("size"),a=t.get("className"),o=t.get("container"),s=An("<div class='"+a+"' style='width: "+i[0]+"px; height: "+i[1]+"px; overflow: hidden'></div>");We(o)&&(o=document.getElementById(o)),o?o.appendChild(s):n.get("container").appendChild(s),t.set("container",s);var u=An('<div class="g6-minimap-container" style="position: relative;"></div>');s.appendChild(u),u.addEventListener("dragenter",function(f){f.preventDefault()}),u.addEventListener("dragover",function(f){f.preventDefault()});var l,c=n.get("renderer");c===w3?l=new Ih({container:u,width:i[0],height:i[1]}):l=new Os({container:u,width:i[0],height:i[1]}),t.set("canvas",l),t.updateCanvas()},e.prototype.updateCanvas=function(){if(!this.destroyed){var t=this.get("refresh");if(!!t){var n=this.get("graph");if(!n.get("destroyed")){this.get("viewportChange")&&(this.set("viewportChange",!1),this.updateViewport());var i=this.get("size"),a=this.get("canvas"),o=this.get("type"),s=this.get("padding");if(!a.destroyed){switch(o){case mfe:this.updateGraphShapes();break;case bfe:this.updateKeyShapes();break;case wfe:this.updateDelegateShapes();break}var u=a.get("children")[0];if(!!u){u.resetMatrix();var l=u.getCanvasBBox(),c=n.get("canvas").getCanvasBBox(),f=n.getZoom()||1,d=c.width/f,h=c.height/f;Number.isFinite(l.width)&&(d=b3(l.width,d),h=b3(l.height,h)),d+=2*s,h+=2*s;var v=Math.min(i[0]/d,i[1]/h),p=[1,0,0,0,1,0,0,0,1],g=0,y=0;Number.isFinite(l.minX)&&(g=-l.minX),Number.isFinite(l.minY)&&(y=-l.minY);var m=(i[0]-(d-2*s)*v)/2,b=(i[1]-(h-2*s)*v)/2;p=yfe(p,[["t",g,y],["s",v,v],["t",m,b]]),u.setMatrix(p),this.set("ratio",v),this.set("totaldx",m+g*v),this.set("totaldy",b+y*v),this.set("dx",m),this.set("dy",b),this.updateViewport()}}}}}},e.prototype.getCanvas=function(){return this.get("canvas")},e.prototype.getViewport=function(){return this.get("viewport")},e.prototype.getContainer=function(){return this.get("container")},e.prototype.destroy=function(){this.get("canvas").destroy();var t=this.get("container");t.parentNode.removeChild(t)},e}(aa),_fe=xfe,Sfe=globalThis&&globalThis.__extends||function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();function So(r,e,t){var n=r.x-e.x,i=r.y-e.y;return!t||Math.abs(n)>t||Math.abs(i)>t?Math.sqrt(n*n+i*i):t}function Efe(r,e){return r.x*e.x+r.y*e.y}function x3(r,e){var t=(e.source.y-e.target.y)/(e.source.x-e.target.x),n=(t*t*e.source.x+t*(r.y-e.source.y)+r.x)/(t*t+1),i=t*(n-e.source.x)+e.source.y;return{x:n,y:i}}var Afe=function(r){Sfe(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{edgeBundles:[],edgePoints:[],K:.1,lambda:.1,divisions:1,divRate:2,cycles:6,iterations:90,iterRate:.6666667,bundleThreshold:.6,eps:1e-6,onLayoutEnd:function(){},onTick:function(){}}},e.prototype.init=function(){var t=this.get("graph"),n=this.get("onTick"),i=function(){n&&n(),t.refreshPositions()};this.set("tick",i)},e.prototype.bundling=function(t){var n=this;if(n.set("data",t),!n.isTicking()){var i=t.edges||[],a=t.nodes||[],o={},s=!1;if(a.forEach(function(w){(w.x===null||!w.y===null||w.x===void 0||!w.y===void 0)&&(s=!0),o[w.id]=w}),s)throw new Error("please layout the graph or assign x and y for nodes first");n.set("nodeIdMap",o);var u=n.get("divisions"),l=n.get("divRate"),c=n.divideEdges(u);n.set("edgePoints",c);var f=n.getEdgeBundles();n.set("edgeBundles",f);for(var d=n.get("cycles"),h=n.get("iterations"),v=n.get("iterRate"),p=n.get("lambda"),g=0;g<d;g++){for(var y=function(x){var _=[];i.forEach(function(A,I){if(A.source!==A.target){var M=o[A.source],S=o[A.target];_[I]=n.getEdgeForces({source:M,target:S},I,u,p);for(var C=0;C<u+1;C++)c[I][C].x+=_[I][C].x,c[I][C].y+=_[I][C].y}})},m=0;m<h;m++)y(m);p=p/2,u*=l,h*=v,c=n.divideEdges(u),n.set("edgePoints",c)}i.forEach(function(w,x){w.source!==w.target&&(w.type="polyline",w.controlPoints=c[x].slice(1,c[x].length-1))});var b=n.get("graph");b.refresh()}},e.prototype.updateBundling=function(t){var n=this,i=t.data;if(i&&n.set("data",i),n.get("ticking")&&n.set("ticking",!1),Object.keys(t).forEach(function(o){n.set(o,t[o])}),t.onTick){var a=this.get("graph");n.set("tick",function(){t.onTick(),a.refresh()})}n.bundling(i)},e.prototype.divideEdges=function(t){var n=this,i=n.get("data").edges,a=n.get("nodeIdMap"),o=n.get("edgePoints");return(!o||o===void 0)&&(o=[]),i.forEach(function(s,u){(!o[u]||o[u]===void 0)&&(o[u]=[]);var l=a[s.source],c=a[s.target];if(t===1)o[u].push({x:l.x,y:l.y}),o[u].push({x:.5*(l.x+c.x),y:.5*(l.y+c.y)}),o[u].push({x:c.x,y:c.y});else{var f=0;!o[u]||o[u]===[]?f=So({x:l.x,y:l.y},{x:c.x,y:c.y}):f=n.getEdgeLength(o[u]);var d=f/(t+1),h=d,v=[{x:l.x,y:l.y}];o[u].forEach(function(p,g){if(g!==0){for(var y=So(p,o[u][g-1]);y>h;){var m=h/y,b={x:o[u][g-1].x,y:o[u][g-1].y};b.x+=m*(p.x-o[u][g-1].x),b.y+=m*(p.y-o[u][g-1].y),v.push(b),y-=h,h=d}h-=y}}),v.push({x:c.x,y:c.y}),o[u]=v}}),o},e.prototype.getEdgeLength=function(t){var n=0;return t.forEach(function(i,a){a!==0&&(n+=So(i,t[a-1]))}),n},e.prototype.getEdgeBundles=function(){var t=this,n=t.get("data"),i=n.edges||[],a=t.get("bundleThreshold"),o=t.get("nodeIdMap"),s=t.get("edgeBundles");return s||(s=[]),i.forEach(function(u,l){(!s[l]||s[l]===void 0)&&(s[l]=[])}),i.forEach(function(u,l){var c=o[u.source],f=o[u.target];i.forEach(function(d,h){if(!(h<=l)){var v=o[d.source],p=o[d.target],g=t.getBundleScore({source:c,target:f},{source:v,target:p});g>=a&&(s[l].push(h),s[h].push(l))}})}),s},e.prototype.getBundleScore=function(t,n){var i=this;t.vx=t.target.x-t.source.x,t.vy=t.target.y-t.source.y,n.vx=n.target.x-n.source.x,n.vy=n.target.y-n.source.y,t.length=So({x:t.source.x,y:t.source.y},{x:t.target.x,y:t.target.y}),n.length=So({x:n.source.x,y:n.source.y},{x:n.target.x,y:n.target.y});var a=i.getAngleScore(t,n),o=i.getScaleScore(t,n),s=i.getPositionScore(t,n),u=i.getVisibilityScore(t,n);return a*o*s*u},e.prototype.getAngleScore=function(t,n){var i=Efe({x:t.vx,y:t.vy},{x:n.vx,y:n.vy});return i/(t.length*n.length)},e.prototype.getScaleScore=function(t,n){var i=(t.length+n.length)/2,a=2/(i/Math.min(t.length,n.length)+Math.max(t.length,n.length)/i);return a},e.prototype.getPositionScore=function(t,n){var i=(t.length+n.length)/2,a={x:(t.source.x+t.target.x)/2,y:(t.source.y+t.target.y)/2},o={x:(n.source.x+n.target.x)/2,y:(n.source.y+n.target.y)/2},s=So(a,o);return i/(i+s)},e.prototype.getVisibilityScore=function(t,n){var i=this.getEdgeVisibility(t,n),a=this.getEdgeVisibility(n,t);return i<a?i:a},e.prototype.getEdgeVisibility=function(t,n){var i=x3(n.source,t),a=x3(n.target,t),o={x:(i.x+a.x)/2,y:(i.y+a.y)/2},s={x:(t.source.x+t.target.x)/2,y:(t.source.y+t.target.y)/2};return Math.max(0,1-2*So(o,s)/So(i,a))},e.prototype.getEdgeForces=function(t,n,i,a){for(var o=this,s=o.get("edgePoints"),u=o.get("K"),l=u/(So(t.source,t.target)*(i+1)),c=[{x:0,y:0}],f=1;f<i;f++){var d={x:0,y:0},h=o.getSpringForce({pre:s[n][f-1],cur:s[n][f],next:s[n][f+1]},l),v=o.getElectrostaticForce(f,n);d.x=a*(h.x+v.x),d.y=a*(h.y+v.y),c.push(d)}return c.push({x:0,y:0}),c},e.prototype.getSpringForce=function(t,n){var i=t.pre.x+t.next.x-2*t.cur.x,a=t.pre.y+t.next.y-2*t.cur.y;return i*=n,a*=n,{x:i,y:a}},e.prototype.getElectrostaticForce=function(t,n){var i=this,a=i.get("eps"),o=i.get("edgeBundles"),s=i.get("edgePoints"),u=o[n],l={x:0,y:0};return u.forEach(function(c){var f={x:s[c][t].x-s[n][t].x,y:s[c][t].y-s[n][t].y};if(Math.abs(f.x)>a||Math.abs(f.y)>a){var d=So(s[c][t],s[n][t]),h=1/d;l.x+=f.x*h,l.y+=f.y*h}}),l},e.prototype.isTicking=function(){return this.get("ticking")},e.prototype.getSimulation=function(){return this.get("forceSimulation")},e.prototype.destroy=function(){this.get("ticking")&&this.getSimulation().stop(),r.prototype.destroy.call(this)},e}(aa),Tfe=Afe,Ife=globalThis&&globalThis.__extends||function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),bx=globalThis&&globalThis.__assign||function(){return bx=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},bx.apply(this,arguments)},Ay=.05,_3={stroke:"#000",strokeOpacity:.8,lineWidth:2,fillOpacity:.1,fill:"#ccc"},Cfe=function(r){Ife(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{trigger:"mousemove",d:1.5,r:300,delegateStyle:Ur(_3),showLabel:!1,maxD:5,minD:0,scaleRBy:"unset",scaleDBy:"unset",showDPercent:!0}},e.prototype.getEvents=function(){var t;switch(this.get("trigger")){case"click":t={click:"magnify"};break;case"drag":t={click:"createDelegate"};break;default:t={mousemove:"magnify"};break}return t},e.prototype.init=function(){var t=this,n=t.get("r");t.set("cachedMagnifiedModels",[]),t.set("cachedOriginPositions",{}),t.set("r2",n*n);var i=t.get("d");t.set("molecularParam",(i+1)*n)},e.prototype.createDelegate=function(t){var n=this,i=this,a=i.get("delegate");(!a||a.destroyed)&&(i.magnify(t),a=i.get("delegate"),a.on("dragstart",function(o){i.set("delegateCenterDiff",{x:a.attr("x")-o.x,y:a.attr("y")-o.y})}),a.on("drag",function(o){i.magnify(o)}),this.get("scaleDBy")==="wheel"&&a.on("mousewheel",function(o){n.scaleDByWheel(o)}),this.get("scaleRBy")==="wheel"&&a.on("mousewheel",function(o){i.scaleRByWheel(o)}))},e.prototype.scaleRByWheel=function(t){var n=this;if(!(!t||!t.originalEvent)){t.preventDefault&&t.preventDefault();var i=n.get("graph"),a,o=n.get("delegate"),s=o?{x:o.attr("x"),y:o.attr("y")}:void 0,u=s||i.getPointByClient(t.clientX,t.clientY);t.originalEvent.wheelDelta<0?a=1-Ay:a=1/(1-Ay);var l=n.get("maxR"),c=n.get("minR"),f=n.get("r");(f>(l||i.get("height"))&&a>1||f<(c||i.get("height")*.05)&&a<1)&&(a=1),f*=a,n.set("r",f),n.set("r2",f*f);var d=n.get("d");n.set("molecularParam",(d+1)*f),n.set("delegateCenterDiff",void 0),n.magnify(t,u)}},e.prototype.scaleRByDrag=function(t){var n=this;if(!!t){var i=n.get("dragPrePos"),a=n.get("graph"),o,s=a.getPointByClient(t.clientX,t.clientY);t.x-i.x<0?o=1-Ay:o=1/(1-Ay);var u=n.get("maxR"),l=n.get("minR"),c=n.get("r");(c>(u||a.get("height"))&&o>1||c<(l||a.get("height")*.05)&&o<1)&&(o=1),c*=o,n.set("r",c),n.set("r2",c*c);var f=n.get("d");n.set("molecularParam",(f+1)*c),n.magnify(t,s),n.set("dragPrePos",{x:t.x,y:t.y})}},e.prototype.scaleDByWheel=function(t){var n=this;if(!(!t&&!t.originalEvent)){t.preventDefault&&t.preventDefault();var i=0;t.originalEvent.wheelDelta<0?i=-.1:i=.1;var a=n.get("d"),o=a+i,s=n.get("maxD"),u=n.get("minD");if(o<s&&o>u){n.set("d",o);var l=n.get("r");n.set("molecularParam",(o+1)*l);var c=n.get("delegate"),f=c?{x:c.attr("x"),y:c.attr("y")}:void 0;n.set("delegateCenterDiff",void 0),n.magnify(t,f)}}},e.prototype.scaleDByDrag=function(t){var n=this,i=n.get("dragPrePos"),a=t.x-i.x>0?.1:-.1,o=n.get("d"),s=o+a,u=n.get("maxD"),l=n.get("minD");if(s<u&&s>l){n.set("d",s);var c=n.get("r");n.set("molecularParam",(s+1)*c),n.magnify(t)}n.set("dragPrePos",{x:t.x,y:t.y})},e.prototype.magnify=function(t,n){var i=this;i.restoreCache();var a=i.get("graph"),o=i.get("cachedMagnifiedModels"),s=i.get("cachedOriginPositions"),u=i.get("showLabel"),l=i.get("r"),c=i.get("r2"),f=i.get("d"),d=i.get("molecularParam"),h=a.getNodes(),v=h.length,p=n?{x:n.x,y:n.y}:{x:t.x,y:t.y};i.get("dragging")&&(i.get("trigger")==="mousemove"||i.get("trigger")==="click")&&(p=i.get("cacheCenter"));var g=i.get("delegateCenterDiff");g&&(p.x+=g.x,p.y+=g.y),i.updateDelegate(p,l);for(var y=0;y<v;y++){var m=h[y].getModel(),b=m.x,w=m.y;if(!(isNaN(b)||isNaN(w))){var x=(b-p.x)*(b-p.x)+(w-p.y)*(w-p.y);if(!isNaN(x)&&x<c&&x!==0){var _=Math.sqrt(x),A=d*_/(f*_+l),I=(b-p.x)/_,M=(w-p.y)/_;if(m.x=I*A+p.x,m.y=M*A+p.y,s[m.id]||(s[m.id]={x:b,y:w,texts:[]}),o.push(m),u&&2*_<l)for(var S=h[y],C=S.getContainer(),T=C.getChildren(),k=T.length,L=0;L<k;L++){var B=T[L];B.get("type")==="text"&&(s[m.id].texts.push({visible:B.get("visible"),shape:B}),B.set("visible",!0))}}}}a.refreshPositions()},e.prototype.restoreCache=function(){for(var t=this,n=t.get("cachedMagnifiedModels"),i=t.get("cachedOriginPositions"),a=n.length,o=0;o<a;o++){var s=n[o],u=s.id,l=i[u];s.x=l.x,s.y=l.y;for(var c=l.texts.length,f=0;f<c;f++){var d=l.texts[f];d.shape.set("visible",d.visible)}}t.set("cachedMagnifiedModels",[]),t.set("cachedOriginPositions",{})},e.prototype.updateParams=function(t){var n=this,i=t.r,a=t.d,o=t.trigger,s=t.minD,u=t.maxD,l=t.minR,c=t.maxR,f=t.scaleDBy,d=t.scaleRBy;isNaN(t.r)||(n.set("r",i),n.set("r2",i*i)),isNaN(a)||n.set("d",a),isNaN(u)||n.set("maxD",u),isNaN(s)||n.set("minD",s),isNaN(c)||n.set("maxR",c),isNaN(l)||n.set("minR",l);var h=n.get("d"),v=n.get("r");if(n.set("molecularParam",(h+1)*v),(o==="mousemove"||o==="click"||o==="drag")&&n.set("trigger",o),f==="drag"||f==="wheel"||f==="unset"){n.set("scaleDBy",f),n.get("delegate").remove(),n.get("delegate").destroy();var p=n.get("dPercentText");p&&(p.remove(),p.destroy())}if(d==="drag"||d==="wheel"||d==="unset"){n.set("scaleRBy",d),n.get("delegate").remove(),n.get("delegate").destroy();var p=n.get("dPercentText");p&&(p.remove(),p.destroy())}},e.prototype.updateDelegate=function(t,n){var i=this,a=this,o=a.get("graph"),s=a.get("delegate");if(!s||s.destroyed){var u=o.get("group"),l=a.get("delegateStyle")||_3;s=u.addShape("circle",{attrs:bx({r:n/1.5,x:t.x,y:t.y},l),name:"lens-shape",draggable:!0}),this.get("trigger")!=="drag"&&(this.get("scaleRBy")==="wheel"?s.on("mousewheel",function(v){a.scaleRByWheel(v)}):this.get("scaleRBy")==="drag"&&(s.on("dragstart",function(v){a.set("dragging",!0),a.set("cacheCenter",{x:v.x,y:v.y}),a.set("dragPrePos",{x:v.x,y:v.y})}),s.on("drag",function(v){a.scaleRByDrag(v)}),s.on("dragend",function(v){a.set("dragging",!1)})),this.get("scaleDBy")==="wheel"?s.on("mousewheel",function(v){i.scaleDByWheel(v)}):this.get("scaleDBy")==="drag"&&(s.on("dragstart",function(v){a.set("dragging",!0),a.set("cacheCenter",{x:v.x,y:v.y}),a.set("dragPrePos",{x:v.x,y:v.y})}),s.on("drag",function(v){i.scaleDByDrag(v)}),s.on("dragend",function(v){a.set("dragging",!1)})))}else s.attr({x:t.x,y:t.y,r:n/1.5});if(a.get("showDPercent")){var c=Math.round((a.get("d")-a.get("minD"))/(a.get("maxD")-a.get("minD"))*100),f=a.get("dPercentText"),d=t.y+n/1.5+16;if(!f||f.destroyed){var h=o.get("group");f=h.addShape("text",{attrs:{text:c+"%",x:t.x,y:d,fill:"#aaa",stroke:"#fff",lineWidth:1,fontSize:12}}),a.set("dPercentText",f)}else f.attr({text:c+"%",x:t.x,y:d})}a.set("delegate",s)},e.prototype.clear=function(){var t=this.get("graph");this.restoreCache(),t.refreshPositions();var n=this.get("delegate");n&&!n.destroyed&&(n.remove(),n.destroy());var i=this.get("dPercentText");i&&!i.destroyed&&(i.remove(),i.destroy())},e.prototype.destroy=function(){this.clear()},e}(aa),Mfe=Cfe,kfe=globalThis&&globalThis.__extends||function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),S3=.05;typeof document!="undefined"&&yx(`
  .g6-component-toolbar {
    position: absolute;
    list-style-type: none;
    padding: 6px;
    left: 0px;
    top: 0px;
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid #e2e2e2;
    border-radius: 4px;
    font-size: 12px;
    color: #545454;
    margin: 0;
  }
  .g6-component-toolbar li {
    float: left;
    text-align: center;
    width: 35px;
    height: 24px;
    cursor: pointer;
		list-style-type:none;
    list-style: none;
    margin-left: 0px;
  }
  .g6-component-toolbar li .icon {
    opacity: 0.7;
  }
  .g6-component-toolbar li .icon:hover {
    opacity: 1;
  }
`);var Dfe=function(e){if(!e)return[];if(e.composedPath)return e.composedPath();for(var t=[],n=e.target;n;){if(t.push(n),n.tagName==="HTML")return t.push(document,window),t;n=n.parentElement}return t},Lfe=function(r){kfe(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{handleClick:void 0,getContent:function(n){return`
          <ul class='g6-component-toolbar'>
            <li code='redo'>
              <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="24">
                <path d="M256 682.666667c0-102.741333 66.730667-213.333333 213.333333-213.333334 107.008 0 190.762667 56.576 230.570667 125.354667L611.968 682.666667H853.333333v-241.365334l-91.562666 91.562667C704.768 448.469333 601.130667 384 469.333333 384c-196.096 0-298.666667 150.229333-298.666666 298.666667h85.333333z" fill="" p-id="2041"></path>
              </svg>
            </li>
            <li code='undo'>
              <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="24">
                <path d="M170.666667 682.666667h241.365333l-87.936-87.978667C363.904 525.909333 447.658667 469.333333 554.666667 469.333333c146.602667 0 213.333333 110.592 213.333333 213.333334h85.333333c0-148.437333-102.570667-298.666667-298.666666-298.666667-131.797333 0-235.392 64.469333-292.48 148.821333L170.666667 441.301333V682.666667z" fill="" p-id="2764"></path>
              </svg>
            </li>
            <li  code='zoomOut'>
              <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="24">
                <path d="M658.432 428.736a33.216 33.216 0 0 1-33.152 33.152H525.824v99.456a33.216 33.216 0 0 1-66.304 0V461.888H360.064a33.152 33.152 0 0 1 0-66.304H459.52V296.128a33.152 33.152 0 0 1 66.304 0V395.52H625.28c18.24 0 33.152 14.848 33.152 33.152z m299.776 521.792a43.328 43.328 0 0 1-60.864-6.912l-189.248-220.992a362.368 362.368 0 0 1-215.36 70.848 364.8 364.8 0 1 1 364.8-364.736 363.072 363.072 0 0 1-86.912 235.968l192.384 224.64a43.392 43.392 0 0 1-4.8 61.184z m-465.536-223.36a298.816 298.816 0 0 0 298.432-298.432 298.816 298.816 0 0 0-298.432-298.432A298.816 298.816 0 0 0 194.24 428.8a298.816 298.816 0 0 0 298.432 298.432z"></path>
              </svg>
            </li>
            <li code='zoomIn'>
              <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="24">
                <path d="M639.936 416a32 32 0 0 1-32 32h-256a32 32 0 0 1 0-64h256a32 32 0 0 1 32 32z m289.28 503.552a41.792 41.792 0 0 1-58.752-6.656l-182.656-213.248A349.76 349.76 0 0 1 480 768 352 352 0 1 1 832 416a350.4 350.4 0 0 1-83.84 227.712l185.664 216.768a41.856 41.856 0 0 1-4.608 59.072zM479.936 704c158.784 0 288-129.216 288-288S638.72 128 479.936 128a288.32 288.32 0 0 0-288 288c0 158.784 129.216 288 288 288z" p-id="3853"></path>
              </svg>
            </li>
            <li code='realZoom'>
              <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="24">
                <path d="M384 320v384H320V320h64z m256 0v384H576V320h64zM512 576v64H448V576h64z m0-192v64H448V384h64z m355.968 576H92.032A28.16 28.16 0 0 1 64 931.968V28.032C64 12.608 76.608 0 95.168 0h610.368L896 192v739.968a28.16 28.16 0 0 1-28.032 28.032zM704 64v128h128l-128-128z m128 192h-190.464V64H128v832h704V256z"></path>
              </svg>
            </li>
            <li code='autoZoom'>
              <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="24">
                <path d="M684.288 305.28l0.128-0.64-0.128-0.64V99.712c0-19.84 15.552-35.904 34.496-35.712a35.072 35.072 0 0 1 34.56 35.776v171.008h170.944c19.648 0 35.84 15.488 35.712 34.432a35.072 35.072 0 0 1-35.84 34.496h-204.16l-0.64-0.128a32.768 32.768 0 0 1-20.864-7.552c-1.344-1.024-2.816-1.664-3.968-2.816-0.384-0.32-0.512-0.768-0.832-1.088a33.472 33.472 0 0 1-9.408-22.848zM305.28 64a35.072 35.072 0 0 0-34.56 35.776v171.008H99.776A35.072 35.072 0 0 0 64 305.216c0 18.944 15.872 34.496 35.84 34.496h204.16l0.64-0.128a32.896 32.896 0 0 0 20.864-7.552c1.344-1.024 2.816-1.664 3.904-2.816 0.384-0.32 0.512-0.768 0.768-1.088a33.024 33.024 0 0 0 9.536-22.848l-0.128-0.64 0.128-0.704V99.712A35.008 35.008 0 0 0 305.216 64z m618.944 620.288h-204.16l-0.64 0.128-0.512-0.128c-7.808 0-14.72 3.2-20.48 7.68-1.28 1.024-2.752 1.664-3.84 2.752-0.384 0.32-0.512 0.768-0.832 1.088a33.664 33.664 0 0 0-9.408 22.912l0.128 0.64-0.128 0.704v204.288c0 19.712 15.552 35.904 34.496 35.712a35.072 35.072 0 0 0 34.56-35.776V753.28h170.944c19.648 0 35.84-15.488 35.712-34.432a35.072 35.072 0 0 0-35.84-34.496z m-593.92 11.52c-0.256-0.32-0.384-0.768-0.768-1.088-1.088-1.088-2.56-1.728-3.84-2.688a33.088 33.088 0 0 0-20.48-7.68l-0.512 0.064-0.64-0.128H99.84a35.072 35.072 0 0 0-35.84 34.496 35.072 35.072 0 0 0 35.712 34.432H270.72v171.008c0 19.84 15.552 35.84 34.56 35.776a35.008 35.008 0 0 0 34.432-35.712V720l-0.128-0.64 0.128-0.704a33.344 33.344 0 0 0-9.472-22.848zM512 374.144a137.92 137.92 0 1 0 0.128 275.84A137.92 137.92 0 0 0 512 374.08z"></path>
              </svg>
            </li>
          </ul>
        `},zoomSensitivity:2}},e.prototype.init=function(){var t=this,n=this.get("graph"),i=this.get("getContent"),a=i(n),o=a;We(a)&&(o=An(a));var s=this.get("className");o.setAttribute("class",s||"g6-component-toolbar");var u=this.get("container");u||(u=this.get("graph").get("container")),We(u)&&(u=document.getElementById(u)),u.appendChild(o),this.set("toolBar",o);var l=this.get("handleClick");o.addEventListener("click",function(f){var d=Dfe(f).filter(function(v){return v.nodeName==="LI"});if(d.length!==0){var h=d[0].getAttribute("code");!h||(l?l(h,n):t.handleDefaultOperator(h,n))}});var c=this.get("position");c&&jr(o,{top:c.y+"px",left:c.x+"px"}),this.bindUndoRedo()},e.prototype.bindUndoRedo=function(){var t=this.get("graph"),n=document.querySelector('.g6-component-toolbar li[code="undo"]'),i=document.querySelector('.g6-component-toolbar li[code="undo"] svg'),a=document.querySelector('.g6-component-toolbar li[code="redo"]'),o=document.querySelector('.g6-component-toolbar li[code="redo"] svg');!n||!i||!a||!o||t.on("stackchange",function(s){var u=s.undoStack,l=s.redoStack,c=u.length,f=l.length;c===1?(n.setAttribute("style","cursor: not-allowed"),i.setAttribute("style","opacity: 0.4")):(n.removeAttribute("style"),i.removeAttribute("style")),f===0?(a.setAttribute("style","cursor: not-allowed"),o.setAttribute("style","opacity: 0.4")):(a.removeAttribute("style"),o.removeAttribute("style"))})},e.prototype.undo=function(){var t=this.get("graph"),n=t.getUndoStack();if(!(!n||n.length===1)){var i=n.pop();if(i){var a=i.action;t.pushStack(a,Ur(i.data),"redo");var o=i.data.before;if(a==="add"&&(o=i.data.after),!o)return;switch(a){case"visible":{Object.keys(o).forEach(function(s){var u=o[s];!u||u.forEach(function(l){var c=t.findById(l.id);l.visible?t.showItem(c,!1):t.hideItem(c,!1)})});break}case"render":case"update":Object.keys(o).forEach(function(s){var u=o[s];!u||u.forEach(function(l){t.updateItem(l.id,l,!1)})});break;case"changedata":t.changeData(o,!1);break;case"delete":{Object.keys(o).forEach(function(s){var u=o[s];!u||u.forEach(function(l){var c=l.itemType;delete l.itemType,t.addItem(c,l,!1)})});break}case"add":Object.keys(o).forEach(function(s){var u=o[s];!u||u.forEach(function(l){t.removeItem(l.id,!1)})});break;case"updateComboTree":Object.keys(o).forEach(function(s){var u=o[s];!u||u.forEach(function(l){t.updateComboTree(l.id,l.parentId,!1)})});break}}}},e.prototype.redo=function(){var t=this.get("graph"),n=t.getRedoStack();if(!(!n||n.length===0)){var i=n.pop();if(i){var a=i.action,o=i.data.after;if(t.pushStack(a,Ur(i.data)),a==="delete"&&(o=i.data.before),!o)return;switch(a){case"visible":{Object.keys(o).forEach(function(s){var u=o[s];!u||u.forEach(function(l){var c=t.findById(l.id);l.visible?t.showItem(c,!1):t.hideItem(c,!1)})});break}case"render":case"update":Object.keys(o).forEach(function(s){var u=o[s];!u||u.forEach(function(l){t.updateItem(l.id,l,!1)})});break;case"changedata":t.changeData(o,!1);break;case"delete":o.edges&&o.edges.forEach(function(s){t.removeItem(s.id,!1)}),o.nodes&&o.nodes.forEach(function(s){t.removeItem(s.id,!1)}),o.combos&&o.combos.forEach(function(s){t.removeItem(s.id,!1)});break;case"add":{Object.keys(o).forEach(function(s){var u=o[s];!u||u.forEach(function(l){var c=l.itemType;delete l.itemType,t.addItem(c,l,!1)})});break}case"updateComboTree":Object.keys(o).forEach(function(s){var u=o[s];!u||u.forEach(function(l){t.updateComboTree(l.id,l.parentId,!1)})});break}}}},e.prototype.handleDefaultOperator=function(t,n){var i=n.getZoom();switch(t){case"redo":this.redo();break;case"undo":this.undo();break;case"zoomOut":{var a=1/(1-S3*this.get("zoomSensitivity")),o=this.get("maxZoom")||n.get("maxZoom");if(a*i>o)return;n.zoomTo(i*a);break}case"zoomIn":{var s=1-S3*this.get("zoomSensitivity"),u=this.get("minZoom")||n.get("minZoom");if(s*i<u)return;n.zoomTo(i*s);break}case"realZoom":n.zoomTo(1);break;case"autoZoom":n.fitView([20,20]);break}},e.prototype.destroy=function(){var t=this.get("toolBar");if(t){var n=this.get("container");n||(n=this.get("graph").get("container")),We(n)&&(n=document.getElementById(n)),n.removeChild(t)}var i=this.get("handleClick");i&&t.removeEventListener("click",i)},e}(aa),Nfe=Lfe,Ofe=globalThis&&globalThis.__extends||function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();typeof document!="undefined"&&yx(`
  .g6-component-tooltip {
    border: 1px solid #e2e2e2;
    border-radius: 4px;
    font-size: 12px;
    color: #545454;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 10px 8px;
    box-shadow: rgb(174, 174, 174) 0px 0px 10px;
  }
  .tooltip-type {
    padding: 0;
    margin: 0;
  }
  .tooltip-id {
    color: #531dab;
  }
`);var Pfe=function(r){Ofe(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{offsetX:6,offsetY:6,getContent:function(n){return`
          <h4 class='tooltip-type'>\u7C7B\u578B\uFF1A`+n.item.getType()+`</h4>
          <span class='tooltip-id'>ID\uFF1A`+n.item.getID()+`</span>
        `},shouldBegin:function(n){return!0},itemTypes:["node","edge","combo"],trigger:"mouseenter",fixToNode:void 0}},e.prototype.getEvents=function(){return this.get("trigger")==="click"?{"node:click":"onClick","edge:click":"onClick","combo:click":"onClick","canvas:click":"onMouseLeave",afterremoveitem:"onMouseLeave",contextmenu:"onMouseLeave",drag:"onMouseLeave"}:{"node:mouseenter":"onMouseEnter","node:mouseleave":"onMouseLeave","node:mousemove":"onMouseMove","edge:mouseenter":"onMouseEnter","edge:mouseleave":"onMouseLeave","edge:mousemove":"onMouseMove","combo:mouseenter":"onMouseEnter","combo:mouseleave":"onMouseLeave","combo:mousemove":"onMouseMove",afterremoveitem:"onMouseLeave",contextmenu:"onMouseLeave","node:drag":"onMouseLeave"}},e.prototype.init=function(){var t=this,n=t.get("className")||"g6-component-tooltip",i=An("<div class="+n+"></div>"),a=t.get("container");a||(a=t.get("graph").get("container")),We(a)&&(a=document.getElementById(a)),jr(i,{position:"absolute",visibility:"hidden",display:"none"}),a.appendChild(i),t.get("trigger")!=="click"&&(i.addEventListener("mouseenter",function(o){jr(i,{visibility:"visible",display:"unset"})}),i.addEventListener("mouseleave",function(o){t.hideTooltip()})),t.set("tooltip",i)},e.prototype.onClick=function(t){var n=this.get("itemTypes");if(!(t.item&&t.item.getType&&n.indexOf(t.item.getType())===-1)){var i=t.item,a=this.get("graph");this.currentTarget===i?(this.currentTarget=null,this.hideTooltip(),a.emit("tooltipchange",{item:t.item,action:"hide"})):(this.currentTarget=i,this.showTooltip(t),a.emit("tooltipchange",{item:t.item,action:"show"}))}},e.prototype.onMouseEnter=function(t){var n=this.get("itemTypes");if(!(t.item&&t.item.getType&&n.indexOf(t.item.getType())===-1)){var i=t.item,a=this.get("graph");this.currentTarget=i,this.showTooltip(t),a.emit("tooltipchange",{item:t.item,action:"show"})}},e.prototype.onMouseMove=function(t){var n=this.get("itemTypes");t.item&&t.item.getType&&n.indexOf(t.item.getType())===-1||!this.currentTarget||t.item!==this.currentTarget||this.showTooltip(t)},e.prototype.onMouseLeave=function(){this.hideTooltip();var t=this.get("graph");t.emit("tooltipchange",{item:this.currentTarget,action:"hide"}),this.currentTarget=null},e.prototype.showTooltip=function(t){if(!!t.item){var n=this.get("itemTypes");if(!(t.item.getType&&n.indexOf(t.item.getType())===-1)){var i=this.get("tooltip"),a=this.get("getContent"),o=a(t);We(o)?i.innerHTML=o:i.innerHTML=o.outerHTML,this.updatePosition(t)}}},e.prototype.hideTooltip=function(){var t=this.get("tooltip");t&&jr(t,{visibility:"hidden",display:"none"})},e.prototype.updatePosition=function(t){var n=this.get("shouldBegin"),i=this.get("tooltip");if(!n(t)){jr(i,{visibility:"hidden",display:"none"});return}var a=this.get("graph"),o=a.get("width"),s=a.get("height"),u=this.get("offsetX")||0,l=this.get("offsetY")||0,c=a.getPointByClient(t.clientX,t.clientY),f=this.get("fixToNode"),d=t.item;if(d.getType&&d.getType()==="node"&&f&&Mt(f)&&f.length>=2){var h=d.getBBox();c={x:h.minX+h.width*f[0],y:h.minY+h.height*f[1]}}var v=a.getCanvasByPoint(c.x,c.y),p=v.x,g=v.y,y=a.getContainer(),m={x:p+y.offsetLeft+u,y:g+y.offsetTop+l};jr(i,{visibility:"visible",display:"unset"});var b=i.getBoundingClientRect();p+b.width+u>o&&(m.x-=b.width+u),g+b.height+l>s&&(m.y-=b.height+l),jr(i,{left:m.x+"px",top:m.y+"px"})},e.prototype.hide=function(){this.onMouseLeave()},e.prototype.destroy=function(){var t=this.get("tooltip");if(t){var n=this.get("container");n||(n=this.get("graph").get("container")),We(n)&&(n=document.getElementById(n)),n.removeChild(t)}},e}(aa),Rfe=Pfe,E3={};function Bfe(r){return E3[r]}function Eo(r,e){E3[r]=e}var wx=function(){function r(e){this.type="base",this.isCategory=!1,this.isLinear=!1,this.isContinuous=!1,this.isIdentity=!1,this.values=[],this.range=[0,1],this.ticks=[],this.__cfg__=e,this.initCfg(),this.init()}return r.prototype.translate=function(e){return e},r.prototype.change=function(e){It(this.__cfg__,e),this.init()},r.prototype.clone=function(){return this.constructor(this.__cfg__)},r.prototype.getTicks=function(){var e=this;return Lu(this.ticks,function(t,n){return gi(t)?t:{text:e.getText(t,n),tickValue:t,value:e.scale(t)}})},r.prototype.getText=function(e,t){var n=this.formatter,i=n?n(e,t):e;return xt(i)||!on(i.toString)?"":i.toString()},r.prototype.getConfig=function(e){return this.__cfg__[e]},r.prototype.init=function(){It(this,this.__cfg__),this.setDomain(),VA(this.getConfig("ticks"))&&(this.ticks=this.calculateTicks())},r.prototype.initCfg=function(){},r.prototype.setDomain=function(){},r.prototype.calculateTicks=function(){var e=this.tickMethod,t=[];if(We(e)){var n=Bfe(e);if(!n)throw new Error("There is no method to to calculate ticks!");t=n(this)}else on(e)&&(t=e(this));return t},r.prototype.rangeMin=function(){return this.range[0]},r.prototype.rangeMax=function(){return this.range[1]},r.prototype.calcPercent=function(e,t,n){return Ft(e)?(e-t)/(n-t):NaN},r.prototype.calcValue=function(e,t,n){return t+e*(n-t)},r}(),ld=function(r){Wt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="cat",t.isCategory=!0,t}return e.prototype.buildIndexMap=function(){if(!this.translateIndexMap){this.translateIndexMap=new Map;for(var t=0;t<this.values.length;t++)this.translateIndexMap.set(this.values[t],t)}},e.prototype.translate=function(t){this.buildIndexMap();var n=this.translateIndexMap.get(t);return n===void 0&&(n=Ft(t)?t:NaN),n},e.prototype.scale=function(t){var n=this.translate(t),i=this.calcPercent(n,this.min,this.max);return this.calcValue(i,this.rangeMin(),this.rangeMax())},e.prototype.invert=function(t){var n=this.max-this.min,i=this.calcPercent(t,this.rangeMin(),this.rangeMax()),a=Math.round(n*i)+this.min;return a<this.min||a>this.max?NaN:this.values[a]},e.prototype.getText=function(t){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var a=t;return Ft(t)&&!this.values.includes(t)&&(a=this.values[a]),r.prototype.getText.apply(this,no([a],n,!1))},e.prototype.initCfg=function(){this.tickMethod="cat"},e.prototype.setDomain=function(){if(xt(this.getConfig("min"))&&(this.min=0),xt(this.getConfig("max"))){var t=this.values.length;this.max=t>1?t-1:t}this.translateIndexMap&&(this.translateIndexMap=void 0)},e}(wx),A3=/d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|Z|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g,Zs="[1-9]\\d?",Qs="\\d\\d",Ffe="\\d{3}",Ufe="\\d{4}",cd="[^\\s]+",T3=/\[([^]*?)\]/gm;function I3(r,e){for(var t=[],n=0,i=r.length;n<i;n++)t.push(r[n].substr(0,e));return t}var C3=function(r){return function(e,t){var n=t[r].map(function(a){return a.toLowerCase()}),i=n.indexOf(e.toLowerCase());return i>-1?i:null}};function Js(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var n=0,i=e;n<i.length;n++){var a=i[n];for(var o in a)r[o]=a[o]}return r}var M3=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],k3=["January","February","March","April","May","June","July","August","September","October","November","December"],Gfe=I3(k3,3),zfe=I3(M3,3),xx={dayNamesShort:zfe,dayNames:M3,monthNamesShort:Gfe,monthNames:k3,amPm:["am","pm"],DoFn:function(r){return r+["th","st","nd","rd"][r%10>3?0:(r-r%10!=10?1:0)*r%10]}},Ty=Js({},xx),D3=function(r){return Ty=Js(Ty,r)},L3=function(r){return r.replace(/[|\\{()[^$+*?.-]/g,"\\$&")},Vi=function(r,e){for(e===void 0&&(e=2),r=String(r);r.length<e;)r="0"+r;return r},$fe={D:function(r){return String(r.getDate())},DD:function(r){return Vi(r.getDate())},Do:function(r,e){return e.DoFn(r.getDate())},d:function(r){return String(r.getDay())},dd:function(r){return Vi(r.getDay())},ddd:function(r,e){return e.dayNamesShort[r.getDay()]},dddd:function(r,e){return e.dayNames[r.getDay()]},M:function(r){return String(r.getMonth()+1)},MM:function(r){return Vi(r.getMonth()+1)},MMM:function(r,e){return e.monthNamesShort[r.getMonth()]},MMMM:function(r,e){return e.monthNames[r.getMonth()]},YY:function(r){return Vi(String(r.getFullYear()),4).substr(2)},YYYY:function(r){return Vi(r.getFullYear(),4)},h:function(r){return String(r.getHours()%12||12)},hh:function(r){return Vi(r.getHours()%12||12)},H:function(r){return String(r.getHours())},HH:function(r){return Vi(r.getHours())},m:function(r){return String(r.getMinutes())},mm:function(r){return Vi(r.getMinutes())},s:function(r){return String(r.getSeconds())},ss:function(r){return Vi(r.getSeconds())},S:function(r){return String(Math.round(r.getMilliseconds()/100))},SS:function(r){return Vi(Math.round(r.getMilliseconds()/10),2)},SSS:function(r){return Vi(r.getMilliseconds(),3)},a:function(r,e){return r.getHours()<12?e.amPm[0]:e.amPm[1]},A:function(r,e){return r.getHours()<12?e.amPm[0].toUpperCase():e.amPm[1].toUpperCase()},ZZ:function(r){var e=r.getTimezoneOffset();return(e>0?"-":"+")+Vi(Math.floor(Math.abs(e)/60)*100+Math.abs(e)%60,4)},Z:function(r){var e=r.getTimezoneOffset();return(e>0?"-":"+")+Vi(Math.floor(Math.abs(e)/60),2)+":"+Vi(Math.abs(e)%60,2)}},N3=function(r){return+r-1},O3=[null,Zs],P3=[null,cd],R3=["isPm",cd,function(r,e){var t=r.toLowerCase();return t===e.amPm[0]?0:t===e.amPm[1]?1:null}],B3=["timezoneOffset","[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z?",function(r){var e=(r+"").match(/([+-]|\d\d)/gi);if(e){var t=+e[1]*60+parseInt(e[2],10);return e[0]==="+"?t:-t}return 0}],Vfe={D:["day",Zs],DD:["day",Qs],Do:["day",Zs+cd,function(r){return parseInt(r,10)}],M:["month",Zs,N3],MM:["month",Qs,N3],YY:["year",Qs,function(r){var e=new Date,t=+(""+e.getFullYear()).substr(0,2);return+(""+(+r>68?t-1:t)+r)}],h:["hour",Zs,void 0,"isPm"],hh:["hour",Qs,void 0,"isPm"],H:["hour",Zs],HH:["hour",Qs],m:["minute",Zs],mm:["minute",Qs],s:["second",Zs],ss:["second",Qs],YYYY:["year",Ufe],S:["millisecond","\\d",function(r){return+r*100}],SS:["millisecond",Qs,function(r){return+r*10}],SSS:["millisecond",Ffe],d:O3,dd:O3,ddd:P3,dddd:P3,MMM:["month",cd,C3("monthNamesShort")],MMMM:["month",cd,C3("monthNames")],a:R3,A:R3,ZZ:B3,Z:B3},Iy={default:"ddd MMM DD YYYY HH:mm:ss",shortDate:"M/D/YY",mediumDate:"MMM D, YYYY",longDate:"MMMM D, YYYY",fullDate:"dddd, MMMM D, YYYY",isoDate:"YYYY-MM-DD",isoDateTime:"YYYY-MM-DDTHH:mm:ssZ",shortTime:"HH:mm",mediumTime:"HH:mm:ss",longTime:"HH:mm:ss.SSS"},F3=function(r){return Js(Iy,r)},U3=function(r,e,t){if(e===void 0&&(e=Iy.default),t===void 0&&(t={}),typeof r=="number"&&(r=new Date(r)),Object.prototype.toString.call(r)!=="[object Date]"||isNaN(r.getTime()))throw new Error("Invalid Date pass to format");e=Iy[e]||e;var n=[];e=e.replace(T3,function(a,o){return n.push(o),"@@@"});var i=Js(Js({},Ty),t);return e=e.replace(A3,function(a){return $fe[a](r,i)}),e.replace(/@@@/g,function(){return n.shift()})};function G3(r,e,t){if(t===void 0&&(t={}),typeof e!="string")throw new Error("Invalid format in fecha parse");if(e=Iy[e]||e,r.length>1e3)return null;var n=new Date,i={year:n.getFullYear(),month:0,day:1,hour:0,minute:0,second:0,millisecond:0,isPm:null,timezoneOffset:null},a=[],o=[],s=e.replace(T3,function(w,x){return o.push(L3(x)),"@@@"}),u={},l={};s=L3(s).replace(A3,function(w){var x=Vfe[w],_=x[0],A=x[1],I=x[3];if(u[_])throw new Error("Invalid format. "+_+" specified twice in format");return u[_]=!0,I&&(l[I]=!0),a.push(x),"("+A+")"}),Object.keys(l).forEach(function(w){if(!u[w])throw new Error("Invalid format. "+w+" is required in specified format")}),s=s.replace(/@@@/g,function(){return o.shift()});var c=r.match(new RegExp(s,"i"));if(!c)return null;for(var f=Js(Js({},Ty),t),d=1;d<c.length;d++){var h=a[d-1],v=h[0],p=h[2],g=p?p(c[d],f):+c[d];if(g==null)return null;i[v]=g}i.isPm===1&&i.hour!=null&&+i.hour!=12?i.hour=+i.hour+12:i.isPm===0&&+i.hour==12&&(i.hour=0);for(var y=new Date(i.year,i.month,i.day,i.hour,i.minute,i.second,i.millisecond),m=[["month","getMonth"],["day","getDate"],["hour","getHours"],["minute","getMinutes"],["second","getSeconds"]],d=0,b=m.length;d<b;d++)if(u[m[d][0]]&&i[m[d][0]]!==y[m[d][1]]())return null;return i.timezoneOffset==null?y:new Date(Date.UTC(i.year,i.month,i.day,i.hour,i.minute-i.timezoneOffset,i.second,i.millisecond))}var z3={format:U3,parse:G3,defaultI18n:xx,setGlobalDateI18n:D3,setGlobalDateMasks:F3},jfe=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",default:z3,assign:Js,format:U3,parse:G3,defaultI18n:xx,setGlobalDateI18n:D3,setGlobalDateMasks:F3});function Wfe(r){return function(e,t,n,i){for(var a=xt(n)?0:n,o=xt(i)?e.length:i;a<o;){var s=a+o>>>1;r(e[s])>t?o=s:a=s+1}return a}}var $3="format";function V3(r,e){var t=jfe[$3]||z3[$3];return t(r,e)}function Cy(r){return We(r)&&(r.indexOf("T")>0?r=new Date(r).getTime():r=new Date(r.replace(/-/gi,"/")).getTime()),vb(r)&&(r=r.getTime()),r}var Xa=1e3,ll=60*Xa,cl=60*ll,os=24*cl,fd=os*31,j3=os*365,hd=[["HH:mm:ss",Xa],["HH:mm:ss",Xa*10],["HH:mm:ss",Xa*30],["HH:mm",ll],["HH:mm",ll*10],["HH:mm",ll*30],["HH",cl],["HH",cl*6],["HH",cl*12],["YYYY-MM-DD",os],["YYYY-MM-DD",os*4],["YYYY-WW",os*7],["YYYY-MM",fd],["YYYY-MM",fd*4],["YYYY-MM",fd*6],["YYYY",os*380]];function Xfe(r,e,t){var n=(e-r)/t,i=Wfe(function(o){return o[1]})(hd,n)-1,a=hd[i];return i<0?a=hd[0]:i>=hd.length&&(a=ha(hd)),a}var Yfe=function(r){Wt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="timeCat",t}return e.prototype.translate=function(t){t=Cy(t);var n=this.values.indexOf(t);return n===-1&&(Ft(t)&&t<this.values.length?n=t:n=NaN),n},e.prototype.getText=function(t,n){var i=this.translate(t);if(i>-1){var a=this.values[i],o=this.formatter;return a=o?o(a,n):V3(a,this.mask),a}return t},e.prototype.initCfg=function(){this.tickMethod="time-cat",this.mask="YYYY-MM-DD",this.tickCount=7},e.prototype.setDomain=function(){var t=this.values;xe(t,function(n,i){t[i]=Cy(n)}),t.sort(function(n,i){return n-i}),r.prototype.setDomain.call(this)},e}(ld),My=function(r){Wt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.isContinuous=!0,t}return e.prototype.scale=function(t){if(xt(t))return NaN;var n=this.rangeMin(),i=this.rangeMax(),a=this.max,o=this.min;if(a===o)return n;var s=this.getScalePercent(t);return n+s*(i-n)},e.prototype.init=function(){r.prototype.init.call(this);var t=this.ticks,n=io(t),i=ha(t);n<this.min&&(this.min=n),i>this.max&&(this.max=i),xt(this.minLimit)||(this.min=n),xt(this.maxLimit)||(this.max=i)},e.prototype.setDomain=function(){var t=CA(this.values),n=t.min,i=t.max;xt(this.min)&&(this.min=n),xt(this.max)&&(this.max=i),this.min>this.max&&(this.min=n,this.max=i)},e.prototype.calculateTicks=function(){var t=this,n=r.prototype.calculateTicks.call(this);return this.nice||(n=zf(n,function(i){return i>=t.min&&i<=t.max})),n},e.prototype.getScalePercent=function(t){var n=this.max,i=this.min;return(t-i)/(n-i)},e.prototype.getInvertPercent=function(t){return(t-this.rangeMin())/(this.rangeMax()-this.rangeMin())},e}(wx),Hfe=function(r){Wt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="linear",t.isLinear=!0,t}return e.prototype.invert=function(t){var n=this.getInvertPercent(t);return this.min+n*(this.max-this.min)},e.prototype.initCfg=function(){this.tickMethod="wilkinson-extended",this.nice=!1},e}(My),dd=Hfe;function eu(r,e){var t=Math.E,n;return e>=0?n=Math.pow(t,Math.log(e)/r):n=Math.pow(t,Math.log(-e)/r)*-1,n}function ma(r,e){return r===1?1:Math.log(e)/Math.log(r)}function W3(r,e,t){xt(t)&&(t=Math.max.apply(null,r));var n=t;return xe(r,function(i){i>0&&i<n&&(n=i)}),n===t&&(n=t/e),n>1&&(n=1),n}var qfe=function(r){Wt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="log",t}return e.prototype.invert=function(t){var n=this.base,i=ma(n,this.max),a=this.rangeMin(),o=this.rangeMax()-a,s,u=this.positiveMin;if(u){if(t===0)return 0;s=ma(n,u/n);var l=1/(i-s)*o;if(t<l)return t/l*u}else s=ma(n,this.min);var c=(t-a)/o,f=c*(i-s)+s;return Math.pow(n,f)},e.prototype.initCfg=function(){this.tickMethod="log",this.base=10,this.tickCount=6,this.nice=!0},e.prototype.setDomain=function(){r.prototype.setDomain.call(this);var t=this.min;if(t<0)throw new Error("When you use log scale, the minimum value must be greater than zero!");t===0&&(this.positiveMin=W3(this.values,this.base,this.max))},e.prototype.getScalePercent=function(t){var n=this.max,i=this.min;if(n===i||t<=0)return 0;var a=this.base,o=this.positiveMin;o&&(i=o*1/a);var s;return t<o?s=t/o/(ma(a,n)-ma(a,i)):s=(ma(a,t)-ma(a,i))/(ma(a,n)-ma(a,i)),s},e}(My),Kfe=function(r){Wt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="pow",t}return e.prototype.invert=function(t){var n=this.getInvertPercent(t),i=this.exponent,a=eu(i,this.max),o=eu(i,this.min),s=n*(a-o)+o,u=s>=0?1:-1;return Math.pow(s,i)*u},e.prototype.initCfg=function(){this.tickMethod="pow",this.exponent=2,this.tickCount=5,this.nice=!0},e.prototype.getScalePercent=function(t){var n=this.max,i=this.min;if(n===i)return 0;var a=this.exponent,o=(eu(a,t)-eu(a,i))/(eu(a,n)-eu(a,i));return o},e}(My),Zfe=function(r){Wt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="time",t}return e.prototype.getText=function(t,n){var i=this.translate(t),a=this.formatter;return a?a(i,n):V3(i,this.mask)},e.prototype.scale=function(t){var n=t;return(We(n)||vb(n))&&(n=this.translate(n)),r.prototype.scale.call(this,n)},e.prototype.translate=function(t){return Cy(t)},e.prototype.initCfg=function(){this.tickMethod="time-pretty",this.mask="YYYY-MM-DD",this.tickCount=7,this.nice=!1},e.prototype.setDomain=function(){var t=this.values,n=this.getConfig("min"),i=this.getConfig("max");if((!xt(n)||!Ft(n))&&(this.min=this.translate(this.min)),(!xt(i)||!Ft(i))&&(this.max=this.translate(this.max)),t&&t.length){var a=[],o=1/0,s=o,u=0;xe(t,function(l){var c=Cy(l);if(isNaN(c))throw new TypeError("Invalid Time: "+l+" in time scale!");o>c?(s=o,o=c):s>c&&(s=c),u<c&&(u=c),a.push(c)}),t.length>1&&(this.minTickInterval=s-o),xt(n)&&(this.min=o),xt(i)&&(this.max=u)}},e}(dd),X3=function(r){Wt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="quantize",t}return e.prototype.invert=function(t){var n=this.ticks,i=n.length,a=this.getInvertPercent(t),o=Math.floor(a*(i-1));if(o>=i-1)return ha(n);if(o<0)return io(n);var s=n[o],u=n[o+1],l=o/(i-1),c=(o+1)/(i-1);return s+(a-l)/(c-l)*(u-s)},e.prototype.initCfg=function(){this.tickMethod="r-pretty",this.tickCount=5,this.nice=!0},e.prototype.calculateTicks=function(){var t=r.prototype.calculateTicks.call(this);return this.nice||(ha(t)!==this.max&&t.push(this.max),io(t)!==this.min&&t.unshift(this.min)),t},e.prototype.getScalePercent=function(t){var n=this.ticks;if(t<io(n))return 0;if(t>ha(n))return 1;var i=0;return xe(n,function(a,o){if(t>=a)i=o;else return!1}),i/(n.length-1)},e}(My),Qfe=function(r){Wt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="quantile",t}return e.prototype.initCfg=function(){this.tickMethod="quantile",this.tickCount=5,this.nice=!0},e}(X3),Y3={};function Jfe(r){return Y3[r]}function Ao(r,e){if(Jfe(r))throw new Error("type '"+r+"' existed.");Y3[r]=e}var ehe=function(r){Wt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="identity",t.isIdentity=!0,t}return e.prototype.calculateTicks=function(){return this.values},e.prototype.scale=function(t){return this.values[0]!==t&&Ft(t)?t:this.range[0]},e.prototype.invert=function(t){var n=this.range;return t<n[0]||t>n[1]?NaN:this.values[0]},e}(wx);function Bc(r){return Math.abs(r)<1e-15?r:parseFloat(r.toFixed(15))}var the=[1,5,2,2.5,4,3],H3=Number.EPSILON*100;function rhe(r,e){return(r%e+e)%e}function nhe(r){return Math.round(r*1e12)/1e12}function ihe(r,e,t,n,i,a){var o=op(e),s=yb(e,r),u=0,l=rhe(n,a);return(l<H3||a-l<H3)&&n<=0&&i>=0&&(u=1),1-s/(o-1)-t+u}function ahe(r,e,t){var n=op(e),i=yb(e,r),a=1;return 1-i/(n-1)-t+a}function ohe(r,e,t,n,i,a){var o=(r-1)/(a-i),s=(e-1)/(Math.max(a,n)-Math.min(t,i));return 2-Math.max(o/s,s/o)}function she(r,e){return r>=e?2-(r-1)/(e-1):1}function uhe(r,e,t,n){var i=e-r;return 1-.5*(Math.pow(e-n,2)+Math.pow(r-t,2))/Math.pow(.1*i,2)}function lhe(r,e,t){var n=e-r;if(t>n){var i=(t-n)/2;return 1-Math.pow(i,2)/Math.pow(.1*n,2)}return 1}function che(){return 1}function q3(r,e,t,n,i,a){t===void 0&&(t=5),n===void 0&&(n=!0),i===void 0&&(i=the),a===void 0&&(a=[.25,.2,.5,.05]);var o=t<0?0:Math.round(t);if(Number.isNaN(r)||Number.isNaN(e)||typeof r!="number"||typeof e!="number"||!o)return{min:0,max:0,ticks:[]};if(e-r<1e-15||o===1)return{min:r,max:e,ticks:[r]};for(var s={score:-2,lmin:0,lmax:0,lstep:0},u=1;u<1/0;){for(var l=0;l<i.length;l+=1){var c=i[l],f=ahe(c,i,u);if(a[0]*f+a[1]+a[2]+a[3]<s.score){u=1/0;break}for(var d=2;d<1/0;){var h=she(d,o);if(a[0]*f+a[1]+a[2]*h+a[3]<s.score)break;for(var v=(e-r)/(d+1)/u/c,p=Math.ceil(Math.log10(v));p<1/0;){var g=u*c*Math.pow(10,p),y=lhe(r,e,g*(d-1));if(a[0]*f+a[1]*y+a[2]*h+a[3]<s.score)break;var m=Math.floor(e/g)*u-(d-1)*u,b=Math.ceil(r/g)*u;if(m<=b)for(var w=b-m,x=0;x<=w;x+=1){var _=m+x,A=_*(g/u),I=A+g*(d-1),M=g,S=ihe(c,i,u,A,I,M),C=uhe(r,e,A,I),T=ohe(d,o,r,e,A,I),k=che(),L=a[0]*S+a[1]*C+a[2]*T+a[3]*k;L>s.score&&(!n||A<=r&&I>=e)&&(s.lmin=A,s.lmax=I,s.lstep=M,s.score=L)}p+=1}d+=1}}u+=1}var B=Bc(s.lmax),ee=Bc(s.lmin),K=Bc(s.lstep),z=Math.floor(nhe((B-ee)/K))+1,X=new Array(z);X[0]=Bc(ee);for(var l=1;l<z;l++)X[l]=Bc(X[l-1]+K);return{min:Math.min(r,io(X)),max:Math.max(e,ha(X)),ticks:X}}function K3(r){var e=r.values,t=r.tickInterval,n=r.tickCount,i=e;if(Ft(t))return zf(i,function(l,c){return c%t==0});var a=r.min,o=r.max;if(xt(a)&&(a=0),xt(o)&&(o=e.length-1),Ft(n)&&n<o-a){var s=q3(a,o,n,!1,[1,2,5,3,4,7,6,8,9]).ticks,u=zf(s,function(l){return l>=a&&l<=o});return u.map(function(l){return e[l]})}return e.slice(a,o+1)}function fhe(r){var e=r.min,t=r.max,n=r.nice,i=r.tickCount,a=new hhe;return a.domain([e,t]),n&&a.nice(i),a.ticks(i)}var _x=5,Z3=Math.sqrt(50),Q3=Math.sqrt(10),J3=Math.sqrt(2),hhe=function(){function r(){this._domain=[0,1]}return r.prototype.domain=function(e){return e?(this._domain=Array.from(e,Number),this):this._domain.slice()},r.prototype.nice=function(e){var t,n;e===void 0&&(e=_x);var i=this._domain.slice(),a=0,o=this._domain.length-1,s=this._domain[a],u=this._domain[o],l;return u<s&&(t=[u,s],s=t[0],u=t[1],n=[o,a],a=n[0],o=n[1]),l=ky(s,u,e),l>0?(s=Math.floor(s/l)*l,u=Math.ceil(u/l)*l,l=ky(s,u,e)):l<0&&(s=Math.ceil(s*l)/l,u=Math.floor(u*l)/l,l=ky(s,u,e)),l>0?(i[a]=Math.floor(s/l)*l,i[o]=Math.ceil(u/l)*l,this.domain(i)):l<0&&(i[a]=Math.ceil(s*l)/l,i[o]=Math.floor(u*l)/l,this.domain(i)),this},r.prototype.ticks=function(e){return e===void 0&&(e=_x),dhe(this._domain[0],this._domain[this._domain.length-1],e||_x)},r}();function dhe(r,e,t){var n,i=-1,a,o,s;if(e=+e,r=+r,t=+t,r===e&&t>0)return[r];if((n=e<r)&&(a=r,r=e,e=a),(s=ky(r,e,t))===0||!isFinite(s))return[];if(s>0)for(r=Math.ceil(r/s),e=Math.floor(e/s),o=new Array(a=Math.ceil(e-r+1));++i<a;)o[i]=(r+i)*s;else for(r=Math.floor(r*s),e=Math.ceil(e*s),o=new Array(a=Math.ceil(r-e+1));++i<a;)o[i]=(r-i)/s;return n&&o.reverse(),o}function ky(r,e,t){var n=(e-r)/Math.max(0,t),i=Math.floor(Math.log(n)/Math.LN10),a=n/Math.pow(10,i);return i>=0?(a>=Z3?10:a>=Q3?5:a>=J3?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(a>=Z3?10:a>=Q3?5:a>=J3?2:1)}function eF(r,e,t){var n;return t==="ceil"?n=Math.ceil(r/e):t==="floor"?n=Math.floor(r/e):n=Math.round(r/e),n*e}function Sx(r,e,t){var n=eF(r,t,"floor"),i=eF(e,t,"ceil");n=rp(n,t),i=rp(i,t);for(var a=[],o=n;o<=i;o=o+t){var s=rp(o,t);a.push(s)}return{min:n,max:i,ticks:a}}function Ex(r,e,t){var n,i=r.minLimit,a=r.maxLimit,o=r.min,s=r.max,u=r.tickCount,l=u===void 0?5:u,c=xt(i)?xt(e)?o:e:i,f=xt(a)?xt(t)?s:t:a;if(c>f&&(n=[c,f],f=n[0],c=n[1]),l<=2)return[c,f];for(var d=(f-c)/(l-1),h=[],v=0;v<l;v++)h.push(c+d*v);return h}function vhe(r){var e=r.min,t=r.max,n=r.tickInterval,i=r.minLimit,a=r.maxLimit,o=fhe(r);return!xt(i)||!xt(a)?Ex(r,io(o),ha(o)):n?Sx(e,t,n).ticks:o}function phe(r){var e=r.min,t=r.max,n=r.tickCount,i=r.nice,a=r.tickInterval,o=r.minLimit,s=r.maxLimit,u=q3(e,t,n,i).ticks;return!xt(o)||!xt(s)?Ex(r,io(u),ha(u)):a?Sx(e,t,a).ticks:u}function ghe(r){var e=r.base,t=r.tickCount,n=r.min,i=r.max,a=r.values,o,s=ma(e,i);if(n>0)o=Math.floor(ma(e,n));else{var u=W3(a,e,i);o=Math.floor(ma(e,u))}for(var l=s-o,c=Math.ceil(l/t),f=[],d=o;d<s+c;d=d+c)f.push(Math.pow(e,d));return n<=0&&f.unshift(0),f}function tF(r,e,t){if(t===void 0&&(t=5),r===e)return{max:e,min:r,ticks:[r]};var n=t<0?0:Math.round(t);if(n===0)return{max:e,min:r,ticks:[]};var i=1.5,a=.5+1.5*i,o=e-r,s=o/n,u=Math.pow(10,Math.floor(Math.log10(s))),l=u;2*u-s<i*(s-l)&&(l=2*u,5*u-s<a*(s-l)&&(l=5*u,10*u-s<i*(s-l)&&(l=10*u)));for(var c=Math.ceil(e/l),f=Math.floor(r/l),d=Math.max(c*l,e),h=Math.min(f*l,r),v=Math.floor((d-h)/l)+1,p=new Array(v),g=0;g<v;g++)p[g]=Bc(h+g*l);return{min:h,max:d,ticks:p}}function yhe(r){var e=r.exponent,t=r.tickCount,n=Math.ceil(eu(e,r.max)),i=Math.floor(eu(e,r.min)),a=tF(i,n,t).ticks;return a.map(function(o){var s=o>=0?1:-1;return Math.pow(o,e)*s})}function mhe(r,e){var t=r.length*e;return e===1?r[r.length-1]:e===0?r[0]:t%1!=0?r[Math.ceil(t)-1]:r.length%2==0?(r[t-1]+r[t])/2:r[t]}function bhe(r){var e=r.tickCount,t=r.values;if(!t||!t.length)return[];for(var n=t.slice().sort(function(s,u){return s-u}),i=[],a=0;a<e;a++){var o=a/(e-1);i.push(mhe(n,o))}return i}function whe(r){var e=r.min,t=r.max,n=r.tickCount,i=r.tickInterval,a=r.minLimit,o=r.maxLimit,s=tF(e,t,n).ticks;return!xt(a)||!xt(o)?Ex(r,io(s),ha(s)):i?Sx(e,t,i).ticks:s}function xhe(r){var e=r.min,t=r.max,n=r.minTickInterval,i=r.tickInterval,a=r.tickCount;if(i)a=Math.ceil((t-e)/i);else{i=Xfe(e,t,a)[1];var o=(t-e)/i,s=o/a;s>1&&(i=i*Math.ceil(s)),n&&i<n&&(i=n)}for(var u=[],l=e;l<t+i;l+=i)u.push(l);return u}function _he(r){var e=K3(r),t=ha(r.values);return t!==ha(e)&&e.push(t),e}function Dy(r){return new Date(r).getFullYear()}function She(r){return new Date(r,0,1).getTime()}function Ax(r){return new Date(r).getMonth()}function Ehe(r,e){var t=Dy(r),n=Dy(e),i=Ax(r),a=Ax(e);return(n-t)*12+(a-i)%12}function Ahe(r,e){return new Date(r,e,1).getTime()}function The(r,e){return Math.ceil((e-r)/os)}function Ihe(r,e){return Math.ceil((e-r)/cl)}function Che(r,e){return Math.ceil((e-r)/(60*1e3))}function Mhe(r){var e=r.min,t=r.max,n=r.minTickInterval,i=r.tickCount,a=r.tickInterval,o=[];a||(a=(t-e)/i,n&&a<n&&(a=n));var s=Dy(e);if(a>j3)for(var u=Dy(t),l=Math.ceil(a/j3),c=s;c<=u+l;c=c+l)o.push(She(c));else if(a>fd)for(var f=Math.ceil(a/fd),d=Ax(e),h=Ehe(e,t),c=0;c<=h+f;c=c+f)o.push(Ahe(s,c+d));else if(a>os)for(var v=new Date(e),p=v.getFullYear(),g=v.getMonth(),y=v.getDate(),m=Math.ceil(a/os),b=The(e,t),c=0;c<b+m;c=c+m)o.push(new Date(p,g,y+c).getTime());else if(a>cl)for(var v=new Date(e),p=v.getFullYear(),g=v.getMonth(),m=v.getDate(),w=v.getHours(),x=Math.ceil(a/cl),_=Ihe(e,t),c=0;c<=_+x;c=c+x)o.push(new Date(p,g,m,w+c).getTime());else if(a>ll)for(var A=Che(e,t),I=Math.ceil(a/ll),c=0;c<=A+I;c=c+I)o.push(e+c*ll);else{var M=a;M<Xa&&(M=Xa);for(var S=Math.floor(e/Xa)*Xa,C=Math.ceil((t-e)/Xa),T=Math.ceil(M/Xa),c=0;c<C+T;c=c+T)o.push(S+c*Xa)}return o.length>=512&&console.warn("Notice: current ticks length("+o.length+') >= 512, may cause performance issues, even out of memory. Because of the configure "tickInterval"(in milliseconds, current is '+a+") is too small, increase the value to solve the problem!"),o}Eo("cat",K3);Eo("time-cat",_he);Eo("wilkinson-extended",phe);Eo("r-pretty",whe);Eo("time",xhe);Eo("time-pretty",Mhe);Eo("log",ghe);Eo("pow",yhe);Eo("quantile",bhe);Eo("d3-linear",vhe);Ao("cat",ld);Ao("category",ld);Ao("identity",ehe);Ao("linear",dd);Ao("log",qfe);Ao("pow",Kfe);Ao("time",Zfe);Ao("timeCat",Yfe);Ao("quantize",X3);Ao("quantile",Qfe);var khe=globalThis&&globalThis.__spreadArray||function(r,e){for(var t=0,n=e.length,i=r.length;t<n;t++,i++)r[i]=e[t];return r};function Dhe(r){return Lu(r,function(e,t){var n=t===0?"M":"L",i=e[0],a=e[1];return[n,i,a]})}function rF(r){return Dhe(r)}function Lhe(r){if(r.length<=2)return rF(r);var e=[];xe(r,function(o){Du(o,e.slice(e.length-2))||e.push(o[0],o[1])});var t=UC(e,!1),n=io(r),i=n[0],a=n[1];return t.unshift(["M",i,a]),t}function Nhe(r,e,t,n){n===void 0&&(n=!0);var i=new dd({values:r}),a=new ld({values:Lu(r,function(s,u){return u})}),o=Lu(r,function(s,u){return[a.scale(u)*e,t-i.scale(s)*t]});return n?Lhe(o):rF(o)}function Ohe(r,e,t,n){n===void 0&&(n=5);for(var i=new dd({values:r}),a=new ld({values:Lu(r,function(d,h){return h})}),o=Lu(r,function(d,h){return[a.scale(h)*e,t-i.scale(d)*t]}),s=[],u=0;u<o.length;u++){var l=o[u],c={x:l[0],y:l[1],y0:t,size:n},f=Bhe(c);s.push.apply(s,f)}return Fhe(s)}function Phe(r,e){var t=new dd({values:r}),n=Math.max(0,t.min);return e-t.scale(n)*e}function Rhe(r,e,t,n){var i=khe([],r),a=Phe(n,t);return i.push(["L",e,a]),i.push(["L",0,a]),i.push(["Z"]),i}function Bhe(r){var e=r.x,t=r.y,n=r.y0,i=r.size,a,o;Mt(t)?(a=t[0],o=t[1]):(a=n,o=t);var s,u;Mt(e)?(s=e[0],u=e[1]):(s=e-i/2,u=e+i/2);var l=[{x:s,y:a},{x:s,y:o}];return l.push({x:u,y:o},{x:u,y:a}),l}function Fhe(r,e){e===void 0&&(e=!0);var t=[],n=r[0];t.push(["M",n.x,n.y]);for(var i=1,a=r.length;i<a;i++)t.push(["L",r[i].x,r[i].y]);return e&&(t.push(["L",n.x,n.y]),t.push(["z"])),t}var vd=globalThis&&globalThis.__assign||function(){return vd=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},vd.apply(this,arguments)},Uhe={stroke:"#C5C5C5",strokeOpacity:.85},Ghe={fill:"#CACED4",opacity:.85},zhe=function(){function r(e){var t=e.x,n=t===void 0?0:t,i=e.y,a=i===void 0?0:i,o=e.width,s=o===void 0?200:o,u=e.height,l=u===void 0?26:u,c=e.smooth,f=c===void 0?!0:c,d=e.isArea,h=d===void 0?!1:d,v=e.data,p=v===void 0?[]:v,g=e.lineStyle,y=e.areaStyle,m=e.group,b=e.interval,w=b===void 0?null:b;this.group=m,this.x=n,this.y=a,this.width=s,this.height=l,this.data=p,this.smooth=f,this.isArea=h,this.lineStyle=Object.assign({},Uhe,g),this.areaStyle=Object.assign({},Ghe,y),this.intervalConfig=w,this.renderLine()}return r.prototype.renderLine=function(){var e=this,t=e.x,n=e.y,i=e.width,a=e.height;e.barWidth;var o=e.data,s=e.smooth,u=e.isArea,l=e.lineStyle,c=e.areaStyle,f=this.group.addGroup({name:"trend-group"});if(o){var d=Nhe(o,i,a,s);if(f.addShape("path",{attrs:vd({path:d},l)}),u){var h=Rhe(d,i,a,o);f.addShape("path",{attrs:vd({path:h},c)})}}this.intervalConfig&&f.addShape("path",{attrs:vd({path:Ohe(this.intervalConfig.data,i,a,this.intervalConfig.style.barWidth)},this.intervalConfig.style)}),f.move(t,n)},r.prototype.destory=function(){this.group.destroy()},r}(),$he=zhe,Fc=globalThis&&globalThis.__assign||function(){return Fc=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},Fc.apply(this,arguments)},Vhe={fill:"#1890ff",stroke:"#1890ff",type:"trend",radius:2,opacity:1,cursor:"ew-resize",highLightFill:"#0050b3"},jhe={fill:"#fff",stroke:"#1890ff",radius:2,opacity:1,cursor:"ew-resize"},Whe=function(){function r(e){var t=e.group,n=e.name,i=e.type,a=e.x,o=a===void 0?0:a,s=e.y,u=s===void 0?0:s,l=e.width,c=l===void 0?2:l,f=e.height,d=f===void 0?24:f,h=e.style,v=h===void 0?{}:h;this.group=t,this.name=n,this.handleType=i,this.x=o,this.y=u,this.width=c,this.height=d,i==="trend"?this.style=Fc(Fc({},Vhe),v):i==="simple"&&(this.style=Fc(Fc({},jhe),v)),this.renderHandle()}return r.prototype.setX=function(e){this.setXY(e,void 0)},r.prototype.setY=function(e){this.setXY(void 0,e)},r.prototype.setXY=function(e,t){Ft(e)&&(this.x=e),Ft(t)&&(this.y=t),this.updateXY()},r.prototype.renderHandle=function(){var e=this,t=e.width,n=e.height,i=e.style,a=e.name,o=i.fill,s=i.stroke,u=i.radius,l=i.opacity,c=i.cursor;this.handleGroup=this.group.addGroup(),this.handleType==="trend"?(this.verticalLine=this.handleGroup.addShape("rect",{attrs:{x:0,y:0,width:t,height:n,fill:o,stroke:s,radius:u,opacity:l,cursor:c},name:a+"-handler"}),this.topCircle=this.handleGroup.addShape("circle",{attrs:{x:t/2,y:0,r:2*t,fill:o,stroke:s,radius:u,opacity:l,cursor:c},name:a+"-handler"}),this.bottomCircle=this.handleGroup.addShape("circle",{attrs:{x:t/2,y:n,r:2*t,fill:o,stroke:s,radius:u,opacity:l,cursor:c},name:a+"-handler"})):this.handleType==="simple"&&(this.topCircle=this.handleGroup.addShape("circle",{attrs:{x:t/2,y:n/2,r:2*t,fill:o,stroke:s,radius:u,opacity:l,cursor:c,lineWidth:2},name:a+"-handler"})),this.updateXY(),this.handleType==="trend"?this.bindTrendEvents():this.handleType==="simple"&&this.bindSimpleEvents()},r.prototype.bindSimpleEvents=function(){var e=this,t=this.name;this.handleGroup.on(t+"-handler:mouseenter",function(){var n=e.style.highLightFill;e.topCircle.attr("fill",n)}),this.handleGroup.on(t+"-handler:mouseleave",function(){var n=e.style.fill;e.topCircle.attr("fill",n)})},r.prototype.bindTrendEvents=function(){var e=this,t=this.name;this.handleGroup.on(t+"-handler:mouseenter",function(){var n=e.style.highLightFill;e.verticalLine.attr("fill",n),e.topCircle.attr("fill",n),e.bottomCircle.attr("fill",n)}),this.handleGroup.on(t+"-handler:mouseleave",function(){var n=e.style.fill;e.verticalLine.attr("fill",n),e.topCircle.attr("fill",n),e.bottomCircle.attr("fill",n)})},r.prototype.show=function(){this.handleGroup.show()},r.prototype.hide=function(){this.handleGroup.hide()},r.prototype.updateXY=function(){this.handleGroup.setMatrix([1,0,0,0,1,0,this.x,this.y,1])},r}(),nF=Whe,iF="timebarstartplay",aF="timebarendplay",To="valuechange",fl="timebarConfigChanged",tu="playPauseBtn",pd="nextStepBtn",gd="preStepBtn",Tx=globalThis&&globalThis.__assign||function(){return Tx=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},Tx.apply(this,arguments)},Xhe=function(){function r(e){this.config=tn({},e),this.init()}return r.prototype.update=function(e){this.config=tn({},this.config,e),this.updateElement(),this.renderMarker()},r.prototype.init=function(){this.initElement(),this.renderMarker()},r.prototype.initElement=function(){var e=this.config,t=e.group,n=e.style,i=n.scale,a=i===void 0?1:i,o=n.offsetX,s=o===void 0?0:o,u=n.offsetY,l=u===void 0?0:u,c=this.config.x+s,f=this.config.y+l,d=t.addGroup({name:tu});this.startMarkerGroup=d.addGroup({name:tu}),this.circle=t.addShape("circle",{attrs:Tx({x:c,y:f,r:this.config.r*a},n),name:tu}),this.startMarker=this.startMarkerGroup.addShape("path",{attrs:{path:this.getStartMarkerPath(c,f,a),fill:n.stroke||"#aaa"}}),this.pauseMarkerGroup=d.addGroup({name:tu});var h=.25*this.config.r*a,v=.5*this.config.r*Math.sqrt(3)*a;this.pauseLeftMarker=this.pauseMarkerGroup.addShape("rect",{attrs:{x:c-.375*this.config.r*a,y:f-v/2,width:h,height:v,fill:n.stroke||"#aaa",lineWidth:0}}),this.pauseRightMarker=this.pauseMarkerGroup.addShape("rect",{attrs:{x:c+1/8*this.config.r*a,y:f-v/2,width:h,height:v,fill:n.stroke||"#aaa",lineWidth:0}})},r.prototype.updateElement=function(){var e=this.config.style,t=e.scale,n=t===void 0?1:t,i=e.offsetX,a=i===void 0?0:i,o=e.offsetY,s=o===void 0?0:o,u=this.config.x+a,l=this.config.y+s;this.circle.attr("x",u),this.circle.attr("y",l),this.circle.attr("r",this.config.r*n),this.startMarker.attr("path",this.getStartMarkerPath(u,l,n));var c=.25*this.config.r*n,f=.5*this.config.r*Math.sqrt(3)*n;this.pauseLeftMarker.attr("x",u-(1/4+1/8)*this.config.r*n),this.pauseLeftMarker.attr("y",l-f/2),this.pauseLeftMarker.attr("width",c),this.pauseLeftMarker.attr("height",f),this.pauseRightMarker.attr("x",u+1/8*this.config.r*n),this.pauseRightMarker.attr("y",l-f/2),this.pauseRightMarker.attr("width",c),this.pauseRightMarker.attr("height",f)},r.prototype.renderMarker=function(){this.config.isPlay?(this.startMarkerGroup.hide(),this.pauseMarkerGroup.show()):(this.startMarkerGroup.show(),this.pauseMarkerGroup.hide())},r.prototype.getStartMarkerPath=function(e,t,n){var i=.5*this.config.r*Math.sqrt(3)*n;return[["M",e-i/Math.sqrt(3)/2,t-i/2],["L",e+i/Math.sqrt(3),t],["L",e-i/Math.sqrt(3)/2,t+i/2]]},r}(),Yhe=Xhe,Fn=globalThis&&globalThis.__assign||function(){return Fn=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},Fn.apply(this,arguments)},yd=Up,Hhe="#aaa",qhe="green",Khe={fill:"#aaa",fillOpacity:.35,stroke:"#aaa"},Zhe={fill:"#fff"},Qhe={fill:"green"},oF={pointer:{fill:"#aaa",lineWidth:0},scroller:{stroke:"#aaa",fill:"#aaa",lineWidth:1,lineAppendWidth:5,cursor:"pointer"},text:{fill:"#aaa",textBaseline:"top"}},sF={check:{stroke:"green",lineWidth:3},box:{fill:"#fff",stroke:"#aaa",lineWidth:2,radius:3,width:12,height:12},text:{fill:"#aaa",fontSize:12,textBaseline:"top"}},Jhe={speed:1,loop:!1,fill:"#fff",stroke:"#fff",hideTimeTypeController:!1,preBtnStyle:{fill:"#aaa",stroke:"#aaa"},nextBtnStyle:{fill:"#aaa",stroke:"#aaa"},playBtnStyle:{fill:"#aaa",stroke:"#aaa",fillOpacity:.05},speedControllerStyle:oF,timeTypeControllerStyle:sF},Ix=110,ru=50,ede=function(){function r(e){this.controllerCfg=tn({},Jhe,e),this.group=e.group,this.controllerGroup=this.group.addGroup({name:"controller-group"}),this.speedAxisY=[],this.currentSpeed=this.controllerCfg.speed,this.currentType="range",this.fontFamily=e.fontFamily||"Arial, sans-serif",this.init()}return r.prototype.init=function(){this.renderPlayButton()},r.prototype.getNextMarkerPath=function(e,t,n){return[["M",e,t-n],["L",e+n,t],["L",e,t+n],["Z",e,t-n],["M",e,t],["L",e-n,t-n],["L",e-n,t+n],["Z"]]},r.prototype.getPreMarkerPath=function(e,t,n){return[["M",e,t-n],["L",e-n,t],["L",e,t+n],["L",e,t-n],["M",e,t],["L",e+n,t-n],["L",e+n,t+n],["Z"]]},r.prototype.renderPlayButton=function(){var e=this.controllerCfg,t=e.width,n=e.height,i=e.x,a=e.y,o=e.hideTimeTypeController,s=e.fill,u=s===void 0?Hhe:s,l=e.stroke,c=l===void 0?qhe:l,f=Fn(Fn({},Khe),e.playBtnStyle||{}),d=Fn(Fn({},Zhe),e.preBtnStyle||{}),h=Fn(Fn({},Qhe),e.nextBtnStyle||{}),v=n/2-5,p=a+10,g=this.controllerGroup.addShape("rect",{attrs:{x:i,y:p,width:t,height:n,stroke:c,fill:u},name:"container-rect"});this.playButton?this.playButton.update({x:t/2,y:p,r:v}):this.playButton=new Yhe({group:this.controllerGroup,x:t/2,y:p+v+5,r:v,isPlay:this.isPlay,style:f});var y=d.offsetX||0,m=d.offsetY||0,b=(d.scale||1)*v;this.controllerGroup.addShape("path",{attrs:Fn({path:this.getPreMarkerPath(t/2-5*v+y,p+v+5+m,b*.5)},d),name:gd});var w=h.offsetX||0,x=h.offsetY||0,_=(h.scale||1)*v;this.controllerGroup.addShape("path",{attrs:Fn({path:this.getNextMarkerPath(t/2+5*v+w,p+v+5+x,_*.5)},h),name:pd}),g.toBack(),this.renderSpeedBtn(),o||this.renderToggleTime(),this.bindEvent();var A=this.controllerCfg.scale,I=A===void 0?1:A,M=this.controllerGroup.getCanvasBBox(),S=(M.maxX+M.minX)/2,C=(M.maxY+M.minY)/2,T=yd([1,0,0,0,1,0,0,0,1],[["t",-S,-C],["s",I,I],["t",S,C]]);this.controllerGroup.setMatrix(T)},r.prototype.renderSpeedBtn=function(){var e=this.controllerCfg,t=e.y,n=e.width,i=e.hideTimeTypeController,a=Fn(Fn({},oF),this.controllerCfg.speedControllerStyle||{}),o=a.scroller,s=o===void 0?{}:o,u=a.text,l=u===void 0?{}:u,c=a.pointer,f=c===void 0?{}:c,d=a.scale,h=d===void 0?1:d,v=a.offsetX,p=v===void 0?0:v,g=a.offsetY,y=g===void 0?0:g,m=this.controllerGroup.addGroup({name:"speed-group"});this.speedGroup=m;var b=5;this.speedAxisY=[19,22,26,32,39];for(var w=0;w<5;w++){var x=t+this.speedAxisY[w],_=n-(i?ru:Ix);m.addShape("line",{attrs:Fn({x1:_,x2:_+15,y1:x,y2:x},s),speed:b,name:"speed-rect"}),this.speedAxisY[w]=x,b=b-1}this.speedText=m.addShape("text",{attrs:Fn({x:n-(i?ru:Ix)+20,y:this.speedAxisY[0]+4,text:"1.0X",fontFamily:this.fontFamily||"Arial, sans-serif"},l)}),this.speedPoint=m.addShape("path",{attrs:Fn({path:this.getPointerPath(n-(i?ru:Ix),0),matrix:[1,0,0,0,1,0,0,this.speedAxisY[4],1]},f)});var A=this.speedGroup.getCanvasBBox(),I=(A.maxX+A.minX)/2,M=(A.maxY+A.minY)/2,S=this.speedGroup.getMatrix()||[1,0,0,0,1,0,0,0,1];S=yd(S,[["t",-I,-M],["s",h,h],["t",I+p*h,M+y*h]]),this.speedGroup.setMatrix(S)},r.prototype.getPointerPath=function(e,t){return[["M",e,t],["L",e-10,t-4],["L",e-10,t+4],["Z"]]},r.prototype.renderToggleTime=function(){var e,t=this.controllerCfg.width,n=Fn(Fn({},sF),this.controllerCfg.timeTypeControllerStyle||{}),i=n.scale,a=i===void 0?1:i,o=n.offsetX,s=o===void 0?0:o,u=n.offsetY,l=u===void 0?0:u,c=n.box,f=c===void 0?{}:c,d=n.check,h=d===void 0?{}:d,v=n.text,p=v===void 0?{}:v;this.toggleGroup=this.controllerGroup.addGroup({name:"toggle-group"}),this.toggleGroup.addShape("rect",{attrs:Fn({x:t-ru,y:this.speedAxisY[0]+3.5},f),isChecked:!1,name:"toggle-model"}),this.checkedIcon=this.toggleGroup.addShape("path",{attrs:Fn({path:[["M",t-ru+3,this.speedAxisY[1]+6],["L",t-ru+7,this.speedAxisY[1]+10],["L",t-ru+12,this.speedAxisY[1]+4]]},h),capture:!1}),this.checkedIcon.hide(),this.checkedText=this.toggleGroup.addShape("text",{attrs:Fn({text:((e=this.controllerCfg)===null||e===void 0?void 0:e.timePointControllerText)||"\u5355\u4E00\u65F6\u95F4",x:t-ru+15,y:this.speedAxisY[0]+4,fontFamily:typeof window!="undefined"&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif"},p)});var g=this.toggleGroup.getCanvasBBox(),y=(g.maxX+g.minX)/2,m=(g.maxY+g.minY)/2,b=this.toggleGroup.getMatrix()||[1,0,0,0,1,0,0,0,1];b=yd(b,[["t",-y,-m],["s",a,a],["t",y+s*a,m+l*a]]),this.toggleGroup.setMatrix(b)},r.prototype.bindEvent=function(){var e=this;this.speedGroup.on("speed-rect:click",function(t){var n=t.target.attr("y1"),i=e.speedPoint.attr("matrix"),a=e.speedAxisY.indexOf(i[7]||0),o=e.speedAxisY.indexOf(n),s=e.speedAxisY[o]-e.speedAxisY[a];i=yd(i,[["t",0,s]]),e.speedPoint.setMatrix(i),e.currentSpeed=e.speedAxisY.length-o,e.speedText.attr("text",e.currentSpeed+".0X"),e.group.emit(fl,{speed:e.currentSpeed,type:e.currentType})}),this.speedGroup.on("mousewheel",function(t){t.preventDefault();var n=e.speedPoint.attr("matrix")||[1,0,0,0,1,0,0,0,1],i=n[7],a=e.speedAxisY.indexOf(i);if(a===-1){var o=1/0;e.speedAxisY.forEach(function(u,l){var c=Math.abs(u-i);o>c&&(o=c,a=l)})}t.originalEvent.deltaY>0?a=Math.max(0,a-1):a=Math.min(e.speedAxisY.length-1,a+1);var s=e.speedAxisY[a]-i;n=yd(n,[["t",0,s]]),e.speedPoint.setMatrix(n),e.currentSpeed=e.speedAxisY.length-a,e.speedText.attr("text",e.currentSpeed+".0X"),e.group.emit(fl,{speed:e.currentSpeed,type:e.currentType})}),this.toggleGroup&&this.toggleGroup.on("toggle-model:click",function(t){var n,i,a=t.target.get("isChecked");a?(e.checkedIcon.hide(),e.checkedText.attr("text",((i=e.controllerCfg)===null||i===void 0?void 0:i.timePointControllerText)||"\u5355\u4E00\u65F6\u95F4"),e.currentType="range"):(e.checkedIcon.show(),e.checkedText.attr("text",((n=e.controllerCfg)===null||n===void 0?void 0:n.timeRangeControllerText)||"\u65F6\u95F4\u8303\u56F4"),e.currentType="single"),t.target.set("isChecked",!a),e.group.emit(fl,{type:e.currentType,speed:e.currentSpeed})})},r.prototype.destroy=function(){this.speedGroup.off("speed-rect:click"),this.toggleGroup&&(this.toggleGroup.off("toggle-model:click"),this.toggleGroup.destroy()),this.speedGroup.destroy()},r}(),uF=ede,rn=globalThis&&globalThis.__assign||function(){return rn=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},rn.apply(this,arguments)},tde={fill:"#416180",opacity:.05},rde={fill:"#416180",opacity:.15,radius:5},nde={fill:"#5B8FF9",opacity:.3,cursor:"grab"},Cx=2,ide={width:Cx,height:24},ade={textBaseline:"middle",fill:"#000",opacity:.45},ode={textAlign:"center",textBaseline:"top",fill:"#607889",opacity:.35},sde={lineWidth:1,stroke:"#ccc"},ude=function(){function r(e){var t=this;this.prevX=0,this.onMouseDown=function(J){return function(ne){t.currentHandler=J;var me=ne.originalEvent;me.stopPropagation(),me.preventDefault(),t.prevX=zo(me,"touches.0.pageX",me.pageX);var oe=t.canvas.get("container");oe.addEventListener("mousemove",t.onMouseMove),oe.addEventListener("mouseup",t.onMouseUp),oe.addEventListener("mouseleave",t.onMouseUp),oe.addEventListener("touchmove",t.onMouseMove),oe.addEventListener("touchend",t.onMouseUp),oe.addEventListener("touchcancel",t.onMouseUp)}},this.onMouseMove=function(J){J.stopPropagation(),J.preventDefault();var ne=zo(J,"touches.0.pageX",J.pageX),me=ne-t.prevX,oe=t.adjustOffsetRange(me/t.width);t.updateStartEnd(oe),t.updateUI(),t.prevX=ne},this.onMouseUp=function(){t.currentHandler&&(t.currentHandler=void 0);var J=t.canvas.get("container");J&&(J.removeEventListener("mousemove",t.onMouseMove),J.removeEventListener("mouseup",t.onMouseUp),J.removeEventListener("mouseleave",t.onMouseUp),J.removeEventListener("touchmove",t.onMouseMove),J.removeEventListener("touchend",t.onMouseUp),J.removeEventListener("touchcancel",t.onMouseUp))};var n=e.x,i=n===void 0?0:n,a=e.y,o=a===void 0?0:a,s=e.width,u=s===void 0?100:s,l=e.height,c=e.padding,f=c===void 0?10:c,d=e.trendCfg,h=e.controllerCfg,v=h===void 0?{speed:1}:h,p=e.backgroundStyle,g=p===void 0?{}:p,y=e.foregroundStyle,m=y===void 0?{}:y,b=e.handlerStyle,w=b===void 0?{}:b,x=e.textStyle,_=x===void 0?{}:x,A=e.start,I=A===void 0?0:A,M=e.end,S=M===void 0?1:M,C=e.minText,T=C===void 0?"":C,k=e.maxText,L=k===void 0?"":k,B=e.group,ee=e.graph,K=e.canvas,z=e.tick,X=z===void 0?{tickLabelStyle:{},tickLineStyle:{},tickLabelFormatter:function(ne){return ne},ticks:[]}:z,H=e.type;this.graph=ee,this.canvas=K,this.group=B,this.timeBarType=H,this.x=i,this.y=o,this.width=u,this.height=l,this.padding=f,this.ticks=X.ticks,this.trendCfg=d,this.controllerCfg=v,this.currentSpeed=v.speed||1,this.tickLabelFormatter=X.tickLabelFormatter,H==="trend"?this.backgroundStyle=rn(rn({},tde),g):H==="simple"&&(this.backgroundStyle=rn(rn({},rde),g)),this.foregroundStyle=rn(rn({},nde),m),this.handlerStyle=rn(rn({},ide),w),this.textStyle=rn(rn({},ade),_),this.tickLabelStyle=rn(rn({},ode),X.tickLabelStyle),this.tickLineStyle=rn(rn({},sde),X.tickLineStyle),this.currentMode="range",this.start=I,this.end=S,this.minText=T,this.maxText=L,this.fontFamily=typeof window!="undefined"&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif",this.renderSlider()}return r.prototype.update=function(e){var t=e.x,n=e.y,i=e.width,a=e.height,o=e.minText,s=e.maxText,u=e.start,l=e.end;this.start=Math.min(1,Math.max(u,0)),this.end=Math.min(1,Math.max(l,0)),It(this,{x:t,y:n,width:i,height:a,minText:o,maxText:s}),this.updateUI()},r.prototype.setText=function(e,t){this.minTextShape.attr("text",e),this.maxTextShape.attr("text",t)},r.prototype.renderSlider=function(){var e=this,t=this,n=t.width,i=t.height,a=t.timeBarType;if(a==="trend"&&op(zo(this.trendCfg,"data"))){var o=new $he(rn(rn({x:this.x,y:this.y,width:n,height:i},this.trendCfg),{group:this.group}));this.trendComponent=o}var s=this.group.addGroup({name:"slider-group"});s.addShape("rect",{attrs:rn({x:0,y:0,width:n,height:i},this.backgroundStyle)});var u=this.group.addGroup();a==="trend"?(this.minTextShape=u.addShape("text",{attrs:rn({x:0,y:i/2+this.y,textAlign:"right",text:this.minText,silent:!1,fontFamily:this.fontFamily||"Arial, sans-serif"},this.textStyle),capture:!1}),this.maxTextShape=u.addShape("text",{attrs:rn({y:i/2+this.y,textAlign:"left",text:this.maxText,silent:!1,fontFamily:this.fontFamily||"Arial, sans-serif"},this.textStyle),capture:!1})):(this.minTextShape=u.addShape("text",{attrs:rn({x:0,y:this.y-10,textAlign:"center",text:this.minText,silent:!1,fontFamily:this.fontFamily||"Arial, sans-serif"},this.textStyle),capture:!1}),this.maxTextShape=u.addShape("text",{attrs:rn({y:this.y-10,textAlign:"center",text:this.maxText,silent:!1,fontFamily:this.fontFamily||"Arial, sans-serif"},this.textStyle),capture:!1})),this.foregroundShape=this.group.addGroup().addShape("rect",{attrs:rn({x:0,y:this.y,height:i},this.foregroundStyle)}),this.foregroundShape.on("mousedown",function(g){g.target.attr("cursor","grabbing")}),this.foregroundShape.on("mouseup",function(g){g.target.attr("cursor",e.foregroundStyle.cursor||"grab")});var l=zo(this.handlerStyle,"width",2),c=zo(this.handlerStyle,"height",24),f=this.group.addGroup({name:"minHandlerShape"});this.minHandlerShape=new nF({name:"minHandlerShape",group:f,type:a,x:this.x,y:this.y,width:l,height:c,style:this.handlerStyle});var d=this.group.addGroup({name:"maxHandlerShape"});this.maxHandlerShape=new nF({name:"maxHandlerShape",group:d,type:a,x:this.x,y:this.y,width:l,height:c,style:this.handlerStyle});var h=this.ticks,v=n/(h.length-1);this.tickPosList=[],this.textList&&this.textList.length&&this.textList.forEach(function(g){g.destroy()});var p=-1/0;this.textList=h.map(function(g,y){e.tickPosList.push(e.x+y*v);var m;e.tickLabelFormatter?(m=e.tickLabelFormatter(g),!We(m)&&m&&(m=g.date)):m=g.date;var b=e.group.addShape("text",{attrs:rn({x:e.x+y*v,y:e.y+i+5,text:m,fontFamily:e.fontFamily||"Arial, sans-serif"},e.tickLabelStyle)}),w=e.group.addShape("line",{attrs:rn({x1:e.x+y*v,y1:e.y+i+2,x2:e.x+y*v,y2:e.y+i+6},e.tickLineStyle)});w.toBack();var x=b.getBBox();return x.minX>p?(b.show(),w.show(),p=x.minX+x.width+10):(b.hide(),w.hide()),b}),this.controllerBtnGroup=new uF(rn({group:this.group,x:this.x,y:this.y+i+25,width:n,height:35},this.controllerCfg)),this.updateStartEnd(0),this.updateUI(),s.move(this.x,this.y),this.bindEvents()},r.prototype.bindEvents=function(){var e=this,t=this.group.find(function(i){return i.get("name")==="minHandlerShape"});t&&(t.on("minHandlerShape-handler:mousedown",this.onMouseDown(this.minHandlerShape)),t.on("minHandlerShape-handler:touchstart",this.onMouseDown(this.minHandlerShape)));var n=this.group.find(function(i){return i.get("name")==="maxHandlerShape"});n&&(n.on("maxHandlerShape-handler:mousedown",this.onMouseDown(this.maxHandlerShape)),n.on("maxHandlerShape-handler:touchstart",this.onMouseDown(this.maxHandlerShape))),this.foregroundShape.on("mousedown",this.onMouseDown(this.foregroundShape)),this.foregroundShape.on("touchstart",this.onMouseDown(this.foregroundShape)),this.group.on(tu+":click",function(){e.isPlay=!e.isPlay,e.currentHandler=e.maxHandlerShape,e.changePlayStatus()}),this.group.on(pd+":click",function(){e.currentHandler=e.maxHandlerShape,e.updateStartEnd(.01),e.updateUI()}),this.group.on(gd+":click",function(){e.currentHandler=e.maxHandlerShape,e.updateStartEnd(-.01),e.updateUI()}),this.group.on(fl,function(i){var a=i.type,o=i.speed;e.currentSpeed=o,e.currentMode=a,a==="single"?(e.minHandlerShape.hide(),e.foregroundShape.hide(),e.minTextShape.hide()):a==="range"&&(e.minHandlerShape.show(),e.foregroundShape.show(),e.minTextShape.show())})},r.prototype.adjustTickIndex=function(e){for(var t=0;t<this.tickPosList.length-1;t++)if(this.tickPosList[t]<=e&&e<=this.tickPosList[t+1])return Math.abs(this.tickPosList[t]-e)<Math.abs(e-this.tickPosList[t+1])?t:t+1;return 0},r.prototype.adjustOffsetRange=function(e){switch(this.currentHandler){case this.minHandlerShape:{var t=0-this.start,n=1-this.start;return Math.min(n,Math.max(t,e))}case this.maxHandlerShape:{var t=0-this.end,n=1-this.end;return Math.min(n,Math.max(t,e))}case this.foregroundShape:{var t=0-this.start,n=1-this.end;return Math.min(n,Math.max(t,e))}default:return 0}},r.prototype.updateStartEnd=function(e){var t=this.ticks[this.adjustTickIndex(this.start*this.width)],n=this.ticks[this.adjustTickIndex(this.end*this.width)];if(!this.currentHandler){this.minText=this.tickLabelFormatter?this.tickLabelFormatter(t):t.date,this.maxText=this.tickLabelFormatter?this.tickLabelFormatter(n):n.date;return}switch(this.currentHandler){case this.minHandlerShape:this.maxText=this.maxTextShape.attr("text"),this.start+=e,this.minText=this.tickLabelFormatter?this.tickLabelFormatter(t):t.date;break;case this.maxHandlerShape:this.minText=this.minTextShape.attr("text"),this.end+=e,this.maxText=this.tickLabelFormatter?this.tickLabelFormatter(n):n.date;break;case this.foregroundShape:this.start+=e,this.end+=e,this.minText=this.tickLabelFormatter?this.tickLabelFormatter(t):t.date,this.maxText=this.tickLabelFormatter?this.tickLabelFormatter(n):n.date;break}},r.prototype.updateUI=function(){var e=this;this.start<0&&(this.start=0),this.end>1&&(this.end=1);var t=this.x+this.start*this.width,n=this.x+this.end*this.width;this.foregroundShape.attr("x",t),this.foregroundShape.attr("width",n-t);var i=zo(this.handlerStyle,"width",Cx);this.setText(this.minText,this.maxText);var a=this.dodgeText([t,n]),o=a[0],s=a[1];this.minHandlerShape.setX(t-i/2),xe(o,function(u,l){return e.minTextShape.attr(l,u)}),this.maxHandlerShape.setX(n-i/2),xe(s,function(u,l){return e.maxTextShape.attr(l,u)}),this.currentMode==="range"?this.graph.emit(To,{value:[this.start,this.end].sort()}):this.currentMode==="single"&&this.graph.emit(To,{value:[this.end,this.end]})},r.prototype.dodgeText=function(e){var t,n,i=2,a=zo(this.handlerStyle,"width",Cx),o=this.minTextShape,s=this.maxTextShape,u=e[0],l=e[1],c=!1;u>l&&(t=[l,u],u=t[0],l=t[1],n=[s,o],o=n[0],s=n[1],c=!0);var f=o.getBBox(),d=s.getBBox(),h=null,v=null;return this.timeBarType==="trend"?(h=u-f.width<this.x+i?{x:u+a/2+i,textAlign:"left"}:{x:u-a/2-i,textAlign:"right"},v=l+d.width>this.x+this.width?{x:l-a/2-i,textAlign:"right"}:{x:l+a/2+i,textAlign:"left"}):this.timeBarType==="simple"&&(h=f.width>u-i?{x:u+a/2+i,textAlign:"center"}:{x:u-a/2-i,textAlign:"center"},v=d.width>this.width-l-i?{x:l-a/2-i,textAlign:"center"}:{x:l+a/2+i,textAlign:"center"}),c?[v,h]:[h,v]},r.prototype.startPlay=function(){var e=this;return typeof window!="undefined"?window.requestAnimationFrame(function(){var t=e,n=t.ticks,i=t.width,a=e.currentSpeed,o=i/n.length,s=o/((10-a)*1e3/60),u=e.adjustOffsetRange(s/e.width);e.updateStartEnd(u),e.updateUI(),e.isPlay&&(e.playHandler=e.startPlay())}):void 0},r.prototype.changePlayStatus=function(e){e===void 0&&(e=!0),this.controllerBtnGroup.playButton.update({isPlay:this.isPlay}),this.isPlay?(this.playHandler=this.startPlay(),this.graph.emit(iF,null)):this.playHandler&&(typeof window!="undefined"&&window.cancelAnimationFrame(this.playHandler),e&&this.graph.emit(aF,null))},r.prototype.destory=function(){this.graph.off(To);var e=this.group,t=e.find(function(i){return i.get("name")==="minHandlerShape"});t&&(t.off("minHandlerShape-handler:mousedown"),t.off("minHandlerShape-handler:touchstart"),t.destroy());var n=e.find(function(i){return i.get("name")==="maxHandlerShape"});n&&(n.off("maxHandlerShape-handler:mousedown"),n.off("maxHandlerShape-handler:touchstart"),n.destroy()),this.foregroundShape.off("mousedown"),this.foregroundShape.off("touchstart"),this.foregroundShape.destroy(),e.off(tu+":click"),e.off(pd+":click"),e.off(gd+":click"),e.off(fl),e.destroy(),this.trendComponent&&this.trendComponent.destory()},r}(),lde=ude,cde=function(){function r(e){var t=e.x,n=t===void 0?0:t,i=e.y,a=i===void 0?0:i,o=e.container,s=e.text,u=e.padding,l=u===void 0?[4,4,4,4]:u,c=e.className,f=c===void 0?"g6-component-timebar-tooltip":c,d=e.backgroundColor,h=d===void 0?"#000":d,v=e.textColor,p=v===void 0?"#fff":v,g=e.opacity,y=g===void 0?.8:g,m=e.fontSize,b=m===void 0?12:m;this.container=o,this.className=f,this.backgroundColor=h,this.textColor=p,this.x=n,this.y=a,this.text=s,this.padding=l,this.opacity=y,this.fontSize=b,this.render()}return r.prototype.render=function(){var e=this,t=e.className;e.x,e.y;var n=e.backgroundColor,i=e.textColor,a=e.text,o=e.padding,s=e.opacity,u=e.fontSize,l=e.container,c=An("<div class='"+t+`' style="position: absolute; width: fit-content; height: fit-content; opacity: `+s+'"></div>');We(l)&&(l=document.getElementById(l)),l.appendChild(c),e.parentHeight=l.offsetHeight,e.parentWidth=l.offsetWidth,jr(c,{visibility:"hidden",top:0,left:0});var f=An(`
      <div style='position: absolute; white-space:nowrap; background-color: `+n+"; font-size: "+u+"px; border-radius: 4px; width: fit-content; height: fit-content; color: "+i+"; padding: "+o[0]+"px "+o[1]+"px "+o[2]+"px "+o[3]+"px'></div>");f.innerHTML=a,c.appendChild(f),e.backgroundDOM=f;var d=An("<div style='position: absolute; width: 0px; height: 0px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 10px solid "+n+"'></div>");c.appendChild(d),e.arrowDOM=d,e.container=c},r.prototype.show=function(e){var t=this,n=e.text,i=e.x;e.y,e.clientX,e.clientY,t.backgroundDOM.innerHTML=n;var a=t.backgroundDOM.offsetWidth,o=t.backgroundDOM.offsetHeight,s=t.arrowDOM.offsetWidth,u=t.arrowDOM.offsetHeight;jr(t.container,{top:-o-u+"px",left:i+"px",visibility:"visible"}),jr(t.backgroundDOM,{marginLeft:-a/2+"px"}),jr(t.arrowDOM,{marginLeft:-s/2+"px",top:o+"px"});var l=i-a/2,c=i+a/2;l<0?jr(t.backgroundDOM,{marginLeft:-a/2-l+"px"}):c>t.parentWidth&&jr(t.backgroundDOM,{marginLeft:-a/2-c+t.parentWidth+12+"px"})},r.prototype.hide=function(){jr(this.container,{top:0,left:0,visibility:"hidden"})},r}(),fde=cde,Mx=globalThis&&globalThis.__assign||function(){return Mx=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},Mx.apply(this,arguments)},hde={fill:"#5B8FF9"},dde={fill:"#e6e8e9"},vde=function(){function r(e){this.frameCount=0,this.fontFamily="Arial, sans-serif";var t=e.graph,n=e.canvas,i=e.group,a=e.width,o=e.height,s=e.padding,u=e.data,l=e.start,c=e.end,f=e.x,d=f===void 0?0:f,h=e.y,v=h===void 0?0:h,p=e.tickLabelFormatter,g=e.selectedTickStyle,y=g===void 0?hde:g,m=e.unselectedTickStyle,b=m===void 0?dde:m,w=e.tooltipBackgroundColor,x=e.tooltipFomatter;this.graph=t,this.group=i,this.sliceGroup=i.addGroup({name:"slice-group"}),this.canvas=n,this.width=a,this.height=o,this.padding=s,this.data=u,this.start=l,this.end=c,this.tickLabelFormatter=p,this.selectedTickStyle=y,this.unselectedTickStyle=b,this.x=d,this.y=v,this.tooltipBackgroundColor=w,this.tooltipFomatter=x,this.fontFamily=typeof window!="undefined"&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif",this.renderSlices(),this.initEvent()}return r.prototype.renderSlices=function(){var e=this,t=this,n=t.width,i=t.height,a=t.padding,o=t.data,s=t.start,u=t.end,l=t.tickLabelFormatter,c=t.selectedTickStyle,f=t.unselectedTickStyle,d=n-2*a,h=10,v=4,p=3*a+v+h,g=i-p-2*a,y=2,m=o.length,b=(d-y*(m-1))/m;this.tickWidth=b;var w=this.sliceGroup,x=[],_=Math.round(m*s),A=Math.round(m*u);this.startTickRectId=_,this.endTickRectId=A,o.forEach(function(M,S){var C=S>=_&&S<=A,T=C?c:f,k=w.addShape("rect",{attrs:Mx({x:a+S*(b+y),y:a,width:b,height:g},T),draggable:!0,name:"tick-rect-"+S}),L=w.addShape("rect",{attrs:{x:a+S*b+y*(2*S-1)/2,y:a,width:S===0||S===m-1?b+y/2:b+y,height:g,fill:"#fff",opacity:0},draggable:!0,name:"pick-rect-"+S});L.toFront();var B=k.getBBox(),ee=(B.minX+B.maxX)/2;x.push({rect:k,pickRect:L,value:M.date,x:ee,y:B.minY});var K;if(l?(K=l(M),!We(K)&&K&&(K=M.date)):S%Math.round(m/10)==0&&(K=M.date),K){var z=B.maxY+a*2;w.addShape("line",{attrs:{stroke:"#BFBFBF",x1:ee,y1:z,x2:ee,y2:z+v}});var X=z+v+a,H=w.addShape("text",{attrs:{fill:"#8c8c8c",stroke:"#fff",lineWidth:1,x:ee,y:X,textAlign:"center",text:K,textBaseline:"top",fontSize:10,fontFamily:e.fontFamily||"Arial, sans-serif"},capture:!1}),J=H.getBBox();J.maxX>n?H.attr("textAlign","right"):J.minX<0&&H.attr("textAlign","left")}}),this.tickRects=x;var I=this.group;this.currentSpeed=1,this.controllerBtnGroup=new uF({group:I,x:this.x,y:this.y+i+5,width:n,height:40,hideTimeTypeController:!0,speed:this.currentSpeed,fontFamily:this.fontFamily||"Arial, sans-serif"})},r.prototype.initEvent=function(){var e=this,t=this.sliceGroup;t.on("click",function(c){var f=c.target;if(!(f.get("type")!=="rect"||!f.get("name"))){var d=parseInt(f.get("name").split("-")[2],10);if(!isNaN(d)){var h=e.tickRects,v=e.unselectedTickStyle;h.forEach(function(m){m.rect.attr(v)});var p=e.selectedTickStyle;h[d].rect.attr(p),e.startTickRectId=d,e.endTickRectId=d;var g=h.length,y=d/g;e.graph.emit(To,{value:[y,y]})}}}),t.on("dragstart",function(c){var f=e.tickRects,d=e.unselectedTickStyle;f.forEach(function(m){m.rect.attr(d)});var h=c.target,v=parseInt(h.get("name").split("-")[2],10),p=e.selectedTickStyle;f[v].rect.attr(p),e.startTickRectId=v;var g=f.length,y=v/g;e.graph.emit(To,{value:[y,y]}),e.dragging=!0}),t.on("dragover",function(c){if(!!e.dragging&&c.target.get("type")==="rect"){for(var f=parseInt(c.target.get("name").split("-")[2],10),d=e.startTickRectId,h=e.tickRects,v=e.selectedTickStyle,p=e.unselectedTickStyle,g=0;g<h.length;g++){var y=g>=d&&g<=f?v:p;h[g].rect.attr(y)}var m=h.length;e.endTickRectId=f;var b=d/m,w=f/m;e.graph.emit(To,{value:[b,w]})}}),t.on("drop",function(c){if(!!e.dragging&&(e.dragging=!1,c.target.get("type")==="rect")){var f=e.startTickRectId,d=parseInt(c.target.get("name").split("-")[2],10);if(!(d<f)){var h=e.selectedTickStyle,v=e.tickRects;v[d].rect.attr(h),e.endTickRectId=d;var p=v.length,g=f/p,y=d/p;e.graph.emit(To,{value:[g,y]})}}});var n=this,i=n.tooltipBackgroundColor,a=n.tooltipFomatter,o=n.canvas,s=new fde({container:o.get("container"),backgroundColor:i}),u=this.tickRects;u.forEach(function(c){var f=c.pickRect;f.on("mouseenter",function(d){var h=d.target;if(h.get("type")==="rect"){var v=parseInt(h.get("name").split("-")[2],10),p=o.getClientByPoint(u[v].x,u[v].y);s.show({x:u[v].x,y:u[v].y,clientX:p.x,clientY:p.y,text:a?a(u[v].value):u[v].value})}}),f.on("mouseleave",function(d){s.hide()})});var l=this.group;l.on(tu+":click",function(){e.isPlay=!e.isPlay,e.changePlayStatus()}),l.on(pd+":click",function(){e.updateStartEnd(1)}),l.on(gd+":click",function(){e.updateStartEnd(-1)}),l.on(fl,function(c){c.type;var f=c.speed;e.currentSpeed=f})},r.prototype.changePlayStatus=function(e){e===void 0&&(e=!0),this.controllerBtnGroup.playButton.update({isPlay:this.isPlay}),this.isPlay?(this.playHandler=this.startPlay(),this.graph.emit(iF,null)):this.playHandler&&(typeof window!="undefined"&&window.cancelAnimationFrame(this.playHandler),e&&this.graph.emit(aF,null))},r.prototype.startPlay=function(){var e=this;return typeof window!="undefined"?window.requestAnimationFrame(function(){var t=e.currentSpeed;e.frameCount%(60/t)==0&&(e.frameCount=0,e.updateStartEnd(1)),e.frameCount++,e.isPlay&&(e.playHandler=e.startPlay())}):void 0},r.prototype.updateStartEnd=function(e){var t=this,n=this.tickRects,i=n.length,a=this.unselectedTickStyle,o=this.selectedTickStyle,s=t.endTickRectId;if(e>0?t.endTickRectId++:(n[t.endTickRectId].rect.attr(a),t.endTickRectId--),s!==t.startTickRectId)t.endTickRectId<t.startTickRectId&&(t.startTickRectId=t.endTickRectId);else{for(var u=t.startTickRectId;u<=t.endTickRectId-1;u++)n[u].rect.attr(a);t.startTickRectId=t.endTickRectId}if(n[t.endTickRectId]){n[t.endTickRectId].rect.attr(o);var l=t.startTickRectId/i,c=t.endTickRectId/i;this.graph.emit(To,{value:[l,c]})}},r.prototype.destory=function(){this.graph.off(To);var e=this.sliceGroup;e.off("click"),e.off("dragstart"),e.off("dragover"),e.off("drop"),this.tickRects.forEach(function(t){var n=t.pickRect;n.off("mouseenter"),n.off("mouseleave")}),this.tickRects.length=0,e.off(tu+":click"),e.off(pd+":click"),e.off(gd+":click"),e.off(fl),this.sliceGroup.destroy()},r}(),pde=vde,gde=globalThis&&globalThis.__extends||function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),ss=globalThis&&globalThis.__assign||function(){return ss=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},ss.apply(this,arguments)},yde=globalThis&&globalThis.__rest||function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t},mde=4,bde=26,wde=function(r){gde(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{container:null,className:"g6-component-timebar",padding:10,type:"trend",trend:{data:[],isArea:!1,smooth:!0},controllerCfg:{speed:1,loop:!1},slider:{start:.1,end:.9,minText:"min",maxText:"max"},tick:{start:.1,end:.9,data:[]},textStyle:{},filterEdge:!1}},e.prototype.initContainer=function(){var t=this.get("graph"),n=this._cfgs,i=n.width,a=n.height,o=this.get("className")||"g6-component-timebar",s=this.get("container"),u=this.get("graph").get("container"),l;s?(We(s)&&(s=document.getElementById(s)),l=s):(l=An("<div class='"+o+"'></div>"),jr(l,{position:"relative"})),u.appendChild(l),this.set("timeBarContainer",l);var c,f=t.get("renderer");f==="SVG"?c=new Ih({container:l,width:i,height:a}):c=new Os({container:l,width:i,height:a}),this.set("canvas",c)},e.prototype.init=function(){this.initContainer();var t=this.get("canvas"),n=t.addGroup({name:"timebar-group"});this.set("timeBarGroup",n),this.renderTrend(),this.initEvent();var i=typeof window!="undefined"&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif";this.set("fontFamily",i)},e.prototype.renderTrend=function(){var t=this._cfgs,n=t.width,i=t.x,a=t.y,o=t.padding,s=t.type,u=t.trend,l=t.slider,c=t.controllerCfg,f=t.textStyle,d=t.tick,h=t.backgroundStyle,v=t.foregroundStyle,p=u.data,g=yde(u,["data"]),y=n-2*o,m=s==="trend"?bde:mde,b=this.get("graph"),w=this.get("timeBarGroup"),x=this.get("canvas"),_=null;s==="trend"||s==="simple"?_=new lde(ss(ss({graph:b,canvas:x,group:w,type:s,x:i+o,y:s==="trend"?a+o:a+o+15,width:y,height:m,padding:o,backgroundStyle:h,foregroundStyle:v,trendCfg:ss(ss({},g),{data:p.map(function(A){return A.value})})},l),{tick:{ticks:p,tickLabelFormatter:d.tickLabelFormatter,tickLabelStyle:d.tickLabelStyle,tickLineStyle:d.tickLineStyle},handlerStyle:ss(ss({},l.handlerStyle),{height:l.height||m}),controllerCfg:c,textStyle:f})):s==="tick"&&(_=new pde(ss({graph:b,canvas:x,group:w,x:i+o,y:a+o},d))),this.set("timebar",_)},e.prototype.filterData=function(t){var n,i=t.value,a=null,o=this._cfgs.type;if(o==="trend"||o==="simple"?a=this._cfgs.trend.data:o==="tick"&&(a=this._cfgs.tick.data),!a||a.length===0){console.warn("\u8BF7\u914D\u7F6E TimeBar \u7EC4\u4EF6\u7684\u6570\u636E");return}var s=this.get("rangeChange"),u=this.get("graph"),l=Math.round(a.length*i[0]),c=Math.round(a.length*i[1]);c=c>=a.length?a.length-1:c,l=l>=a.length?a.length-1:l;var f=(n=this._cfgs.tick)===null||n===void 0?void 0:n.tickLabelFormatter,d=f?f(a[l]):a[l].date,h=f?f(a[c]):a[c].date;if(o!=="tick"){var v=this.get("timebar");v.setText(d,h)}if(s)s(u,d,h);else{(!this.cacheGraphData||this.cacheGraphData.nodes&&this.cacheGraphData.nodes.length===0)&&(this.cacheGraphData=u.get("data"));var p=this.cacheGraphData.nodes.filter(function(m){return m.date>=a[l].date&&m.date<=a[c].date}),g=p.map(function(m){return m.id}),y=[];this.cacheGraphData.edges&&(y=this.cacheGraphData.edges.filter(function(m){return g.includes(m.source)&&g.includes(m.target)}),this.get("filterEdge")&&(y=y.filter(function(m){return m.date>=a[l].date&&m.date<=a[c].date}))),u.changeData({nodes:p,edges:y})}},e.prototype.initEvent=function(){var t=this,n=0,i=0,a=this._cfgs.type;!a||a==="trend"||a==="simple"?(n=this._cfgs.slider.start,i=this._cfgs.slider.end):a==="tick"&&(n=this._cfgs.tick.start,i=this._cfgs.tick.end);var o=this.get("graph");o.on("afterrender",function(s){t.filterData({value:[n,i]})}),o.on(To,mb(function(s){t.filterData(s)},200,{trailing:!0,leading:!0}))},e.prototype.destroy=function(){var t=this.get("timebar");t&&t.destory&&t.destory(),r.prototype.destroy.call(this);var n=this.get("timeBarContainer");if(n){var i=this.get("container");i||(i=this.get("graph").get("container")),We(i)&&(i=document.getElementById(i)),i.removeChild(n)}},e}(aa),xde=wde,_de=globalThis&&globalThis.__extends||function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Sde=Ua.applyMatrix;function Ede(r,e){var t,n;if(r.naturalWidth)t=r.naturalWidth,n=r.naturalHeight;else{var i=new Image;i.src=r.src,i.onload=function(){e&&e(i.width,i.height)}}return[t,n]}var Ade=function(r){_de(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{container:null,className:"g6-minimap",viewportClassName:"g6-minimap-viewport",width:200,delegateStyle:{fill:"#40a9ff",stroke:"#096dd9"},refresh:!0}},e.prototype.getEvents=function(){return{beforepaint:"updateViewport",beforeanimate:"disableRefresh",afteranimate:"enableRefresh",viewportchange:"disableOneRefresh"}},e.prototype.disableRefresh=function(){this.set("refresh",!1)},e.prototype.enableRefresh=function(){this.set("refresh",!0),this.updateCanvas()},e.prototype.disableOneRefresh=function(){this.set("viewportChange",!0)},e.prototype.initViewport=function(){var t=this,n=this._cfgs,i=n.graph;if(!this.destroyed){var a=this.get("container");We(a)&&(a=document.getElementById(a));var o=An("<div class="+n.viewportClassName+`
      style='position:absolute;
        left:0;
        top:0;
        box-sizing:border-box;
        border: 2px solid #1980ff'>
      </div>`),s=0,u=0,l=!1,c=0,f=0,d=0,h=0,v=0,p=0;a.addEventListener("mousedown",function(g){if(n.refresh=!1,g.target===o){var y=o.style;d=parseInt(y.width,10),h=parseInt(y.height,10);var m=t.get("width"),b=t.get("height");d>m||h>b||(p=i.getZoom(),v=t.get("ratio"),l=!0,s=g.clientX,u=g.clientY)}},!1),a.addEventListener("mousemove",function(g){if(!(!l||xt(g.clientX)||xt(g.clientY))){var y=t.get("width"),m=t.get("height"),b=o.style;c=parseInt(b.left,10),f=parseInt(b.top,10),d=parseInt(b.width,10),h=parseInt(b.height,10);var w=s-g.clientX,x=u-g.clientY;c-w<0?w=c:c-w+d>=y&&(w=0),f-x<0?x=f:f-x+h>=m&&(x=0),c-=w,f-=x,jr(o,{left:c+"px",top:f+"px"}),i.translate(w*p/v,x*p/v),s=g.clientX,u=g.clientY}},!1),a.addEventListener("mouseleave",function(){l=!1,n.refresh=!0},!1),a.addEventListener("mouseup",function(){l=!1,n.refresh=!0},!1),this.set("viewport",o),a.appendChild(o)}},e.prototype.updateViewport=function(){if(!this.destroyed){var t=this.get("ratio"),n=this.get("width"),i=this.get("height"),a=this.get("graph"),o=a.get("width"),s=a.get("height"),u=o/s,l=a.getGroup(),c=l.getCanvasBBox(),f=[(c.minX+c.maxX)/2,(c.minY+c.maxY)/2],d=[c.maxX-c.minX,c.maxY-c.minY],h={centerX:f[0],centerY:f[1],width:0,height:0,minX:0,minY:0};c[0]/c[1]>u?(h.width=d[0],h.height=h.width/u):(h.height=d[1],h.width=h.height*u),h.minX=f[0]-h.width/2,h.minY=f[1]-h.height/2;var v=l.getMatrix();v||(v=[1,0,0,0,1,0,0,0,1]);var p=bb([1,0,0,0,1,0,0,0,1],v),g=Sde({x:h.minX,y:h.minY},p),y=a.getCanvasByPoint(g.x,g.y),m=this.get("viewport");m||this.initViewport();var b=o/h.width,w=b*n,x=b*i,_=n*-y.x/h.width,A=i*-y.y/h.height,I=_+w,M=A+x;_<0&&(w+=_,_=0),I>n&&(w=w-(I-n)),A<0&&(x+=A,A=0),M>i&&(x=x-(M-i)),this.set("ratio",t);var S=_+"px",C=A+"px";jr(m,{left:S,top:C,width:w+"px",height:x+"px"})}},e.prototype.init=function(){this.initContainer()},e.prototype.initContainer=function(){var t=this,n=t.get("graph"),i=n.get("width"),a=n.get("height"),o=a/i,s=t.get("className"),u=t.get("container"),l=t.get("width"),c=t.get("height");!l&&!c&&(l=200),l?(c=o*l,t.set("height",c)):(l=1/o*c,t.set("width",l));var f=An("<div class='"+s+"' style='width: "+l+"px; height: "+c+"px; overflow: hidden; position: relative;'></div>");We(u)&&(u=document.getElementById(u)),u?u.appendChild(f):n.get("container").appendChild(f),t.set("container",f);var d=An('<div class="g6-minimap-container" style="position: relative; width: 100%; height: 100%; text-align: center; display: table;"></div>');f.appendChild(d);var h=An('<span style="display: table-cell; vertical-align: middle; "></span>');d.appendChild(h),t.set("containerDOM",d),t.set("containerSpan",h);var v=An('<img alt="" src="'+this.get("graphImg")+'" style="display: inline-block; user-select: none;" draggable="false" />');t.set("imgDOM",v),t.updateImgSize(),h.appendChild(v),t.updateCanvas()},e.prototype.updateImgSize=function(){var t=this,n=t.get("imgDOM"),i=t.get("width"),a=t.get("height");n.onload=function(){var o=Ede(n);o[0]>o[1]?n.width=i:n.height=a}},e.prototype.updateCanvas=function(){var t=this.get("refresh");if(!!t){var n=this.get("graph");if(!n.get("destroyed")){this.get("viewportChange")&&(this.set("viewportChange",!1),this.updateViewport());var i=this.get("width"),a=n.get("canvas").getCanvasBBox(),o=a.width,s=i/o;this.set("ratio",s),this.updateViewport()}}},e.prototype.getViewport=function(){return this.get("viewport")},e.prototype.getContainer=function(){return this.get("container")},e.prototype.updateGraphImg=function(t){var n=this,i=n.get("imgDOM");i.remove(),n.set("graphImg",t);var a=An('<img alt="" src="'+t+'" style="display: inline-block;" ondragstart="return false;" onselectstart="return false;"/>');n.set("imgDOM",a),a.src=t,n.updateImgSize();var o=n.get("containerSpan");o.appendChild(a),n.updateCanvas()},e.prototype.destroy=function(){var t=this.get("container");t.parentNode.removeChild(t)},e}(aa),Tde=Ade,Ide=globalThis&&globalThis.__extends||function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),kx=globalThis&&globalThis.__assign||function(){return kx=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},kx.apply(this,arguments)},Cde=Ua.distance,lF=.05,cF={stroke:"#000",strokeOpacity:.8,lineWidth:2,fillOpacity:1,fill:"#fff"},Mde=function(r){Ide(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{type:"both",trigger:"mousemove",r:60,delegateStyle:Ur(cF),showLabel:"edge",scaleRBy:"wheel"}},e.prototype.getEvents=function(){var t;switch(this.get("trigger")){case"click":t={click:"filter"};break;case"drag":t={click:"createDelegate"};break;default:t={mousemove:"filter"};break}return t},e.prototype.init=function(){var t=this,n=t.get("showLabel"),i=n==="node"||n==="both",a=n==="edge"||n==="both";t.set("showNodeLabel",i),t.set("showEdgeLabel",a);var o=t.get("shouldShow");o||t.set("shouldShow",function(){return!0})},e.prototype.createDelegate=function(t){var n=this,i=n.get("delegate");(!i||i.destroyed)&&(n.filter(t),i=n.get("delegate"),i.on("dragstart",function(a){}),i.on("drag",function(a){n.filter(a)}),this.get("scaleRBy")==="wheel"&&i.on("mousewheel",function(a){n.scaleRByWheel(a)}))},e.prototype.scaleRByWheel=function(t){var n=this;if(!(!t||!t.originalEvent)){t.preventDefault&&t.preventDefault();var i=n.get("graph"),a,o=n.get("delegate"),s=o?{x:o.attr("x"),y:o.attr("y")}:void 0;s||i.getPointByClient(t.clientX,t.clientY),t.originalEvent.wheelDelta<0?a=1-lF:a=1/(1-lF);var u=n.get("maxR"),l=n.get("minR"),c=n.get("r");(c>(u||i.get("height"))&&a>1||c<(l||i.get("height")*.05)&&a<1)&&(a=1),c*=a,n.set("r",c),n.filter(t)}},e.prototype.filter=function(t){var n=this,i=n.get("graph"),a=i.getNodes(),o={},s=n.get("r"),u=n.get("type"),l={x:t.x,y:t.y};n.updateDelegate(l,s);var c=n.get("shouldShow"),f=n.get("vShapes");f&&f.forEach(function(y){y.remove(),y.destroy()}),f=[],a.forEach(function(y){var m=y.getModel(),b=m.x,w=m.y;Cde({x:b,y:w},l)<s&&(o[m.id]=y)});var d=i.getEdges(),h=[];d.forEach(function(y){var m=y.getModel(),b=m.source,w=m.target;c(m)&&(u==="only-source"||u==="one"?o[b]&&!o[w]&&h.push(y):u==="only-target"||u==="one"?o[w]&&!o[b]&&h.push(y):u==="both"&&o[b]&&o[w]&&h.push(y))});var v=n.get("showNodeLabel"),p=n.get("showEdgelabel"),g=i.get("group");h.forEach(function(y){var m=y.get("group").get("children");m.forEach(function(b){var w=b.get("type"),x=g.addShape(w,{attrs:b.attr()});f.push(x),v&&w==="text"&&x.set("visible",!0)})}),Object.keys(o).forEach(function(y){var m=o[y],b=m.get("group").clone();if(g.add(b),f.push(b),p)for(var w=b.get("children"),x=0;x<w.length;x++){var _=w[x];_.get("type")==="text"&&_.set("visible",!0)}}),n.set("vShapes",f)},e.prototype.updateParams=function(t){var n=this,i=t.r,a=t.trigger,o=t.minR,s=t.maxR,u=t.scaleRBy,l=t.showLabel,c=t.shouldShow;if(isNaN(t.r)||n.set("r",i),isNaN(s)||n.set("maxR",s),isNaN(o)||n.set("minR",o),(a==="mousemove"||a==="click")&&n.set("trigger",a),u==="wheel"||u==="unset"){n.set("scaleRBy",u),n.get("delegate").remove(),n.get("delegate").destroy();var f=n.get("dPercentText");f&&(f.remove(),f.destroy())}(l==="node"||l==="both")&&n.set("showNodeLabel",!0),(l==="edge"||l==="both")&&n.set("showEdgeLabel",!0),c&&n.set("shouldShow",c)},e.prototype.updateDelegate=function(t,n){var i=this,a=i.get("graph"),o=i.get("delegate");if(!o||o.destroyed){var s=a.get("group"),u=i.get("delegateStyle")||cF;o=s.addShape("circle",{attrs:kx({r:n,x:t.x,y:t.y},u),name:"lens-shape",draggable:!0}),this.get("trigger")!=="drag"&&this.get("scaleRBy")==="wheel"&&o.on("mousewheel",function(l){i.scaleRByWheel(l)})}else o.attr({x:t.x,y:t.y,r:n});i.set("delegate",o)},e.prototype.clear=function(){var t=this,n=t.get("vShapes");n&&n.forEach(function(a){a.remove(),a.destroy()}),n=[],t.set("vShapes",n);var i=t.get("delegate");i&&!i.destroyed&&(i.remove(),i.destroy())},e.prototype.destroy=function(){this.clear()},e}(aa),kde=Mde,Dde=globalThis&&globalThis.__extends||function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Lde=Ua.pointLineDistance,Nde={stroke:"#FA8C16",lineWidth:1},Ode=function(r){Dde(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{line:Nde,itemAlignType:"center",tolerance:5,horizontalLines:{},verticalLines:{},alignLines:[]}},e.prototype.init=function(){},e.prototype.getEvents=function(){return{"node:dragstart":"onDragStart","node:drag":"onDrag","node:dragend":"onDragEnd"}},e.prototype.onDragStart=function(){this.initBoxLine()},e.prototype.onDrag=function(t){var n=t.item,i=n.get("delegateShape")||n,a=i.getBBox(),o=n.getModel(),s=o.x-a.x,u=o.y-a.y;this.show({x:a.minX+s,y:a.minY+u},{width:a.width,height:a.height})},e.prototype.onDragEnd=function(){this.destory()},e.prototype.initBoxLine=function(){var t=this._cfgs,n=t.horizontalLines,i=t.verticalLines,a=t.itemAlignType,o=this.get("graph"),s=o.getNodes();s.forEach(function(u){var l=u.getBBox(),c=u.get("id");a===!0||a==="horizontal"?(n[c+"tltr"]=[l.minX,l.minY,l.maxX,l.minY,u],n[c+"lcrc"]=[l.minX,l.centerY,l.maxX,l.centerY,u],n[c+"blbr"]=[l.minX,l.maxY,l.maxX,l.maxY,u]):a==="center"&&(n[c+"lcrc"]=[l.minX,l.centerY,l.maxX,l.centerY,u]),a===!0||a==="vertical"?(i[c+"tlbl"]=[l.minX,l.minY,l.minX,l.maxY,u],i[c+"tcbc"]=[l.centerX,l.minY,l.centerX,l.maxY,u],i[c+"trbr"]=[l.maxX,l.minY,l.maxX,l.maxY,u]):a==="center"&&(i[c+"tcbc"]=[l.centerX,l.minY,l.centerX,l.maxY,u])})},e.prototype.show=function(t,n){var i=It({},t);return this.itemAlign(t,n,i),t},e.prototype.itemAlign=function(t,n,i){var a=this,o=this._cfgs,s=o.horizontalLines,u=o.verticalLines,l=o.tolerance,c={x:i.x+n.width/2,y:i.y},f={x:i.x+n.width/2,y:i.y+n.height/2},d={x:i.x+n.width/2,y:i.y+n.height},h={x:i.x,y:i.y+n.height/2},v={x:i.x+n.width,y:i.y+n.height/2},p=[],g=[],y=null;if(this.clearAlignLine(),xe(s,function(b){b[4].isVisible&&(p.push(a.getLineDisObject(b,c)),p.push(a.getLineDisObject(b,f)),p.push(a.getLineDisObject(b,d)))}),xe(u,function(b){b[4].isVisible&&(g.push(a.getLineDisObject(b,h)),g.push(a.getLineDisObject(b,f)),g.push(a.getLineDisObject(b,v)))}),p.sort(function(b,w){return b.dis-w.dis}),g.sort(function(b,w){return b.dis-w.dis}),p.length!==0&&p[0].dis<l){t.y=p[0].line[1]-p[0].point.y+i.y,y={type:"item",horizontals:[p[0]]};for(var m=1;m<3;m++)p[0].dis===p[m].dis&&y.horizontals.push(p[m])}if(g.length!==0&&g[0].dis<l){t.x=g[0].line[0]-g[0].point.x+i.x,y?y.verticals=[g[0]]:y={type:"item",verticals:[g[0]]};for(var m=1;m<3;m++)g[0].dis===g[m].dis&&y.verticals.push(g[m])}y&&(y.bbox=n,this.addAlignLine(y))},e.prototype.addAlignLine=function(t){var n=t.bbox,i=t.type,a=t.horizontals,o=t.verticals,s=this._cfgs,u=s.line,l=s.alignLines,c=this.get("graph"),f=c.get("group");i==="item"&&(a&&xe(a,function(d){var h=d.line,v=d.point,p=(h[0]+h[2])/2,g,y;v.x<p?(g=v.x-n.width/2,y=Math.max(h[0],h[2])):(g=v.x+n.width/2,y=Math.min(h[0],h[2]));var m=It({x1:g,y1:h[1],x2:y,y2:h[1]},u),b=f.addShape("line",{attrs:m,capture:!1});l.push(b)}),o&&xe(o,function(d){var h=d.line,v=d.point,p=(h[1]+h[3])/2,g,y;v.y<p?(g=v.y-n.height/2,y=Math.max(h[1],h[3])):(g=v.y+n.height/2,y=Math.min(h[1],h[3]));var m=It({x1:h[0],y1:g,x2:h[0],y2:y},u),b=f.addShape("line",{attrs:m,capture:!1});l.push(b)}))},e.prototype.getLineDisObject=function(t,n){return{line:t,point:n,dis:Lde(t,n)}},e.prototype.getContainer=function(){return this.get("container")},e.prototype.clearAlignLine=function(){var t=this._cfgs.alignLines;xe(t,function(n){n.remove()}),t.length=0},e.prototype.destory=function(){var t=this._cfgs,n=t.horizontalLines,i=t.verticalLines,a=this.get("graph"),o=a.getNodes();o.forEach(function(s){var u=s.get("id");delete n[u+"tltr"],delete n[u+"lcrc"],delete n[u+"blbr"],delete i[u+"tlbl"],delete i[u+"tcbc"],delete i[u+"trbr"]}),this.clearAlignLine()},e}(aa),Pde=Ode,Rde=globalThis&&globalThis.__extends||function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),vn=globalThis&&globalThis.__assign||function(){return vn=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},vn.apply(this,arguments)},Bde=["click","mouseenter"],Fde=function(r){Rde(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{data:{},position:"top",padding:8,margin:8,offsetX:0,offsetY:0,layout:"horizontal",flipPage:!1,containerStyle:{},align:void 0,horiSep:8,vertiSep:8,filter:{enable:!1,trigger:"click"}}},e.prototype.init=function(){this.formatArray("padding"),this.formatArray("margin");var t=this.get("filter")||{},n=t.multiple;n&&t.trigger==="mouseenter"&&this.set("multiple",!1);var i=this.get("align");if(!i){var a=this.get("position").split("-");a.includes("left")&&(i="left"),a.includes("right")?i="right":i="center",this.set("align",i)}var o=this.get("graph"),s=o.get("container"),u=An(`<div class='g6-legend-container' style="position: absolute;"></div>`);s.appendChild(u),this.set("container",u);var l=this.render();jr(u,this.getContainerPos(l)),this.bindEvents()},e.prototype.getContainerPos=function(t){t===void 0&&(t=[0,0]);var n=this,i=n.get("graph"),a=this.get("offsetX"),o=this.get("offsetY"),s=this.get("margin"),u=this.get("position").split("-"),l={top:0,right:1,bottom:2,left:3},c=0,f=0,d={left:(i.getWidth()-t[0])/2+c,top:(i.getHeight()-t[1])/2+f};return u.forEach(function(h){var v=s[l[h]],p=h;switch(h){case"top":v+=f;break;case"left":v+=c;break;case"bottom":v=i.getHeight()-t[1]-v+f,p="top";break;default:v=i.getWidth()-t[0]-v+c,p="left";break}d[p]=v}),d.top+=o+i.getContainer().offsetTop,d.left+=a+i.getContainer().offsetLeft,Object.keys(d).forEach(function(h){d[h]=d[h]+"px"}),d},e.prototype.bindEvents=function(){var t=this,n=t.get("filter");if(!(!n||!n.enable)){var i=n.trigger||"click";Bde.includes(i)||(console.warn("Trigger for legend filterling must be 'click' or 'mouseenter', 'click' will take effect by default."),i="click");var a=t.get("legendCanvas");i==="mouseenter"?(a.on("node-container:mouseenter",function(o){return t.filterData(o)}),a.on("node-container:mouseleave",function(o){t.clearFilter(),t.clearActiveLegend()})):(a.on("node-container:click",function(o){return t.filterData(o)}),a.on("click",function(o){o.target&&o.target.isCanvas&&o.target.isCanvas()&&(t.clearFilter(),t.clearActiveLegend())}))}},e.prototype.changeData=function(t){this.set("data",t);var n=this.render();jr(this.get("container"),this.getContainerPos(n))},e.prototype.activateLegend=function(t){var n=this.get("filter"),i=n==null?void 0:n.multiple;i||this.clearActiveLegend();var a=t.get("parent");a.get("active")?(a.set("active",!1),this.findLegendItemsByState("active").length&&a.set("inactive",!0)):(a.set("inactive",!1),a.set("active",!0)),this.findLegendItemsByState("active").length?this.findLegendItemsByState("active","all",!1).forEach(function(f){f.set("inactive",!0)}):this.clearActiveLegend();var o=(n==null?void 0:n.lengedStateStyles)||{},s=(o==null?void 0:o.inactive)||{opacity:.5,"text-shape":{opacity:.5}},u=s["text-shape"]||{};this.findLegendItemsByState("inactive").forEach(function(f){var d=f.get("children"),h=d[0],v=d[1];h.attr(vn(vn({},h.get("oriAttrs")),s)),v.attr(vn(vn({},v.get("oriAttrs")),u))});var l=(o==null?void 0:o.active)||{stroke:"#000",lineWidth:2,"text-shape":{fontWeight:"bold"}},c=l["text-shape"]||{};this.findLegendItemsByState("active").forEach(function(f){var d=f.get("children"),h=d[0],v=d[1];h.attr(vn(vn({},h.get("oriAttrs")),l)),v.attr(vn(vn({},v.get("oriAttrs")),c))})},e.prototype.findLegendItemsByState=function(t,n,i){n===void 0&&(n="all"),i===void 0&&(i=!0);var a=this.get("legendCanvas").find(function(u){return u.get("name")==="root"}),o=a.find(function(u){return u.get("name")==="node-group"}),s=a.find(function(u){return u.get("name")==="edge-group"});return n==="node"?o.get("children").filter(function(u){return!!u.get(t)===i}):n==="edge"?s.get("children").filter(function(u){return!!u.get(t)===i}):o.get("children").filter(function(u){return!!u.get(t)===i}).concat(s.get("children").filter(function(u){return!!u.get(t)===i}))},e.prototype.clearActiveLegend=function(){var t=this.get("legendCanvas"),n=t.find(function(a){return a.get("name")==="root"}),i=[n.find(function(a){return a.get("name")==="node-group"}),n.find(function(a){return a.get("name")==="edge-group"})];i.forEach(function(a){a.get("children").forEach(function(o){o.set("active",!1),o.set("inactive",!1);var s=o.get("children"),u=s[0],l=s[1];u.attr(u.get("oriAttrs")),l.attr(l.get("oriAttrs"))})})},e.prototype.filterData=function(t){var n=this.get("filter"),i=n==null?void 0:n.filterFunctions;if(!(!n||!i)){var a=this.get("legendCanvas"),o=this.get("graph"),s=n.graphActiveState||"active",u=n.graphInactiveState||"inactive",l=n.multiple;this.clearFilter(),l||this.clearActiveLegend(),this.activateLegend(t.target);var c=a.find(function(y){return y.get("name")==="root"}),f=c.find(function(y){return y.get("name")==="node-group"}),d=c.find(function(y){return y.get("name")==="edge-group"}),h=f.get("children").filter(function(y){return y.get("active")}),v=d.get("children").filter(function(y){return y.get("active")}),p=0,g=["getNodes","getEdges"];g.forEach(function(y){o[y]().forEach(function(m){var b=!1,w=y==="getNodes"?h:v;w.forEach(function(x){var _=i[x.get("id")];b=b||_(m.getModel())}),b?(o.setItemState(m,u,!1),o.setItemState(m,s,!0),p++):(o.setItemState(m,s,!1),o.setItemState(m,u,!0))})}),p||g.forEach(function(y){o[y]().forEach(function(m){o.clearItemStates(m,[u])})})}},e.prototype.clearFilter=function(){var t=this.get("graph"),n=this.get("filter");if(!!n){var i=n.graphActiveState||"active",a=n.graphInactiveState||"inactive";t.getNodes().forEach(function(o){t.clearItemStates(o,[i,a])}),t.getEdges().forEach(function(o){t.clearItemStates(o,[i,a])})}},e.prototype.render=function(){var t=this;this.processData();var n=this.get("legendCanvas");if(!n){n=new Os({container:this.get("container"),width:200,height:200});var i=n.addGroup({name:"root"});i.addGroup({name:"node-group"}),i.addGroup({name:"edge-group"}),this.set("legendCanvas",n)}var a=n.find(function(K){return K.get("name")==="root"}),o=a.find(function(K){return K.get("name")==="node-group"}),s=a.find(function(K){return K.get("name")==="edge-group"}),u=this.get("itemsData"),l=["nodes","edges"],c=[o,s];l.forEach(function(K,z){u[K].forEach(function(X){var H,J=c[z].addGroup({id:X.id,name:"node-container"}),ne,me=X.type,oe=t.getShapeSize(X),Ae=oe.width,ze=oe.height,qe=oe.r,ft=t.getStyle(K.substr(0,4),X);switch(X.type){case"circle":ne={r:qe,x:0,y:0};break;case"rect":ne={width:Ae,height:ze,x:-Ae/2,y:-ze/2};break;case"ellipse":ne={r1:Ae,r2:ze,x:0,y:0};break;case"line":ne={x1:-Ae/2,y1:0,x2:Ae/2,y2:0},me="line";break;case"quadratic":ne={path:[["M",-Ae/2,0],["Q",0,Ae/2,Ae/2,0]]},me="path";break;case"cubic":ne={path:[["M",-Ae/2,0],["C",-Ae/6,Ae/2,Ae/6,-Ae/2,Ae/2,0]]},me="path";break;default:ne={r:qe,x:0,y:0};break}var ct=J.addShape(me,{attrs:vn(vn({},ne),ft),name:X.type+"-node-keyShape",oriAttrs:vn({opacity:1},ft)});if(X.label){var st=ct.getBBox(),gr=((H=X.labelCfg)===null||H===void 0?void 0:H.style)||{},tr=vn({textAlign:"begin",fontSize:12,textBaseline:"middle",fill:"#000",opacity:1,fontWeight:"normal"},gr);J.addShape("text",{attrs:vn({x:st.maxX+4,y:0,text:X.label},tr),className:"legend-label",name:X.type+"-node-text",oriAttrs:tr})}})});var f=this.get("padding"),d,h=a.find(function(K){return K.get("name")==="title-container"}),v={height:0,maxY:0,width:0};if(this.get("title")){h||(h=a.addGroup({name:"title-container"}));var p={fontSize:20,fontFamily:"Arial",fontWeight:300,textBaseline:"top",textAlign:"center",fill:"#000",x:0,y:f[0]},g=this.get("titleConfig")||{},y=Object.assign(p,g.style||{});d=h.addShape("text",{attrs:vn({text:this.get("title")},y)}),v=h.getCanvasBBox(),h.setMatrix([1,0,0,0,1,0,g.offsetX,g.offsetY,1])}this.layoutItems();var m=a.getCanvasBBox(),b=o.getCanvasBBox(),w=b.minX<0?Math.abs(b.minX)+f[3]:f[3],x=v.maxY<b.minY?Math.abs(v.maxY-b.minY)+f[0]:v.maxY+f[0],_=[1,0,0,0,1,0,w,x,1];o.setMatrix(_),m=a.getCanvasBBox();var A=[m.minX+m.width+f[1],m.minY+m.height+f[2]];if(d){var g=vn({position:"center",offsetX:0,offsetY:0},this.get("titleConfig"));v=h.getCanvasBBox();var I=h.getMatrix()||[1,0,0,0,1,0,0,0,1];g.position==="center"?I[6]=A[0]/2+g.offsetX:g.position==="right"?(I[6]=A[0]-f[3]+g.offsetX,d.attr({textAlign:"right"})):(I[6]=f[3]+g.offsetX,d.attr({textAlign:"left"})),h.setMatrix(I),v=h.getCanvasBBox(),w=b.minX<0?Math.abs(b.minX)+f[3]:f[3],x=b.minY<v.maxY?Math.abs(v.maxY-b.minY)+f[0]:v.maxY+f[0],_=[1,0,0,0,1,0,w,x,1],o.setMatrix(_);var M=[1,0,0,0,1,0,w,x,1];this.get("layout")==="vertical"?M[6]+=b.maxX+this.get("horiSep"):M[7]+=b.maxY+this.get("vertiSep"),s.setMatrix(M)}else{b=o.getCanvasBBox();var S=[1,0,0,0,1,0,0,0,1];this.get("layout")==="vertical"?S[6]+=_[6]+b.maxX+this.get("horiSep"):S[7]+=_[7]+b.maxY+this.get("vertiSep"),s.setMatrix(S)}m=a.getCanvasBBox(),b=o.getCanvasBBox(),_=o.getMatrix()||[1,0,0,0,1,0,0,0,1];var C=s.getMatrix()||[1,0,0,0,1,0,0,0,1],T=s.getCanvasBBox();A=[Math.max(b.width+_[6],T.width+C[6])+f[1],Math.max(b.height+_[7],T.height+C[7])+f[2]],n.changeSize(A[0],A[1]);var k=this.get("containerStyle"),L=a.getMatrix()||[1,0,0,0,1,0,0,0,1],B=Ua.invertMatrix({x:0,y:0},L),ee=a.addShape("rect",{attrs:vn({x:B.x+(k.lineWidth||1),y:B.y+(k.lineWidth||1),width:A[0]-2*(k.lineWidth||1),height:A[1]-2*(k.lineWidth||1),fill:"#f00",stroke:"#000",lineWidth:1,opacity:.5},k),name:"legend-back-rect",capture:!1});return ee.toBack(),A},e.prototype.layoutItems=function(){var t=this.get("legendCanvas"),n=this.get("horiSep"),i=this.get("vertiSep"),a=this.get("layout"),o=this.get("align"),s=[0,0],u=t.find(function(b){return b.get("name")==="root"}),l=u.find(function(b){return b.get("name")==="node-group"}),c=u.find(function(b){return b.get("name")==="edge-group"}),f={min:0,max:-1/0};l.get("children").forEach(function(b,w){w===0&&(f.min=s[0]);var x=b.get("children")[0],_=b.getCanvasBBox(),A=x.getBBox(),I=A.width,M=A.height,S=0,C=0;a==="vertical"?(S=s[1],C=s[0]+I/2,s[0]=C+_.height+i,_.maxX+S+I/2):(S=s[0]+I/2,C=s[1],s[0]=S+_.width+n,_.maxY+C+M/2),s[0]>f.max&&(f.max=s[0]),b.setMatrix([1,0,0,0,1,0,S,C,1])});var d=f.max-f.min,h={min:0,max:-1/0},v=l.getCanvasBBox();s[0]=0,s[1]=a==="vertical"?v.maxX+n:v.maxY+i,c.get("children").forEach(function(b,w){w===0&&(h.min=s[0]);var x=b.get("children")[0],_=b.getCanvasBBox(),A=x.getBBox(),I=A.width,M=A.height,S=0,C=0;a==="vertical"?(S=s[1],C=s[0],s[0]=C+_.height+i,b.setMatrix([1,0,0,0,1,0,0,C+M/2,1])):(S=s[0],C=s[1],s[0]=S+_.width+n,b.setMatrix([1,0,0,0,1,0,S+I/2,0,1])),s[0]>h.max&&(h.max=s[0])});var p=h.max-h.min;if(o&&o!==""&&o!=="left"){var g=d-p,y=o==="center"?Math.abs(g)/2:Math.abs(g),m=g<0?l:c;m.get("children").forEach(function(b){var w=b.getMatrix()||[1,0,0,0,1,0,0,0,1];a==="vertical"?w[7]+=y:w[6]+=y,b.setMatrix(w)})}},e.prototype.processData=function(){var t=this.get("data"),n={nodes:[],edges:[]};t.nodes&&(t.nodes.sort(function(i,a){return i.order-a.order}),t.nodes.forEach(function(i){var a,o,s,u,l,c=i.size||[((a=i.style)===null||a===void 0?void 0:a.width)||((o=i.style)===null||o===void 0?void 0:o.r)||8,((s=i.style)===null||s===void 0?void 0:s.height)||((u=i.style)===null||u===void 0?void 0:u.r)||8],f=((l=i.labelCfg)===null||l===void 0?void 0:l.style)||{};n.nodes.push({id:i.id||ao(),type:i.type||"circle",style:vn({},i.style),order:i.order,label:i.label,itemType:"node",size:c,labelCfg:{position:"right",style:vn({fontFamily:"Arial"},f)}})})),t.edges&&(t.edges.sort(function(i,a){return i.order-a.order}),t.edges.forEach(function(i){var a,o,s=i.type||"line";i.type==="cubic-horizontal"&&(s="cubic");var u=((a=i.labelCfg)===null||a===void 0?void 0:a.style)||{},l=i.size||[((o=i.style)===null||o===void 0?void 0:o.width)||8,1];n.edges.push({id:i.id||ao(),type:s,size:l,style:vn({lineWidth:Mt(l)?l[1]:1},i.style),order:i.order,label:i.label,itemType:"edge",labelCfg:{position:"right",style:vn({fontFamily:"Arial"},u)}})})),this.set("itemsData",n)},e.prototype.getContainer=function(){return this.get("container")},e.prototype.formatArray=function(t){var n=this.get(t);if(Ft(n))this.set(t,[n,n,n,n]);else if(Mt(n))switch(n.length){case 0:this.set(t,[0,0,0,0]);break;case 1:this.set(t,[n[0],n[0],n[0],n[0]]);break;case 2:this.set(t,[n[0],n[1],n[0],n[1]]);break;case 3:this.set(t,[n[0],n[1],n[2],n[1]]);break}return this.get(t)},e.prototype.getShapeSize=function(t){var n,i,a;return t.size&&(Mt(t.size)?(n=t.size[0],i=t.size[1]||t.size[0],a=t.size[0]/2):Ft(t.size)&&(n=t.size,i=t.size,a=t.size/2)),t.style&&(t.style.width&&(n=t.style.width),t.style.height&&(i=t.style.height),t.style.r&&(a=t.style.r)),a||(a=5),n||(n=a),i||(i=a),{width:n,height:i,r:a}},e.prototype.getStyle=function(t,n){var i=t==="node"?{fill:"#ccc",lineWidth:0}:{stroke:"#000",lineWidth:1};return vn(vn({},i),n.style||{})},e.prototype.destroy=function(){var t=this.get("graph"),n=t.get("container"),i=this.get("container");n.removeChild(i)},e}(aa),Ude=Fde,Gde={PluginBase:aa,Menu:pfe,Grid:cfe,Minimap:_fe,Bundling:Tfe,ToolBar:Nfe,Tooltip:Rfe,Fisheye:Mfe,TimeBar:xde,ImageMinimap:Tde,EdgeFilterLens:kde,SnapLine:Pde,Legend:Ude},Hn=Gde;Wo("circle",{options:{size:vt.defaultNode.size,style:{x:0,y:0,stroke:vt.defaultNode.style.stroke,fill:vt.defaultNode.style.fill,lineWidth:vt.defaultNode.style.lineWidth},labelCfg:{style:{fill:vt.nodeLabel.style.fill,fontSize:vt.nodeLabel.style.fontSize}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:vt.defaultNode.linkPoints.size,lineWidth:vt.defaultNode.linkPoints.lineWidth,fill:vt.defaultNode.linkPoints.fill,stroke:vt.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({},vt.nodeStateStyles)},shapeType:"circle",labelPosition:"center",drawShape:function(e,t){var n=this.getOptions(e).icon,i=n===void 0?{}:n,a=this.getShapeStyle(e),o=tn({},i,e.icon),s=t.addShape("circle",{attrs:a,className:this.type+"-keyShape",draggable:!0}),u=o.width,l=o.height,c=o.show,f=o.text;return c&&(f?t.addShape("text",{attrs:P({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},o),className:this.type+"-icon",name:this.type+"-icon",draggable:!0}):t.addShape("image",{attrs:P({x:-u/2,y:-l/2},o),className:this.type+"-icon",name:this.type+"-icon",draggable:!0})),this.drawLinkPoints(e,t),s},drawLinkPoints:function(e,t){var n=this.getOptions(e).linkPoints,i=n===void 0?{}:n,a=i.top,o=i.left,s=i.right,u=i.bottom,l=i.size,c=i.r,f=Ti(i,["top","left","right","bottom","size","r"]),d=this.getSize(e),h=d[0]/2;o&&t.addShape("circle",{attrs:P(P({},f),{x:-h,y:0,r:l/2||c||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0}),s&&t.addShape("circle",{attrs:P(P({},f),{x:h,y:0,r:l/2||c||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0}),a&&t.addShape("circle",{attrs:P(P({},f),{x:0,y:-h,r:l/2||c||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0}),u&&t.addShape("circle",{attrs:P(P({},f),{x:0,y:h,r:l/2||c||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0})},getShapeStyle:function(e){var t=this.getOptions(e).style,n={stroke:e.color},i=tn({},t,n),a=this.getSize(e),o=a[0]/2,s=P({x:0,y:0,r:o},i);return s},update:function(e,t){var n=t.getContainer(),i=this.getSize(e),a={stroke:e.color,r:i[0]/2},o=t.get("keyShape"),s=tn({},o.attr(),a,e.style);this.updateShape(e,t,s,!0),this.updateLinkPoints(e,n)}},"single-node");Wo("rect",{options:{size:[100,30],style:{radius:0,stroke:vt.defaultNode.style.stroke,fill:vt.defaultNode.style.fill,lineWidth:vt.defaultNode.style.lineWidth},labelCfg:{style:{fill:vt.nodeLabel.style.fill,fontSize:vt.nodeLabel.style.fontSize}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:vt.defaultNode.linkPoints.size,lineWidth:vt.defaultNode.linkPoints.lineWidth,fill:vt.defaultNode.linkPoints.fill,stroke:vt.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({},vt.nodeStateStyles)},shapeType:"rect",labelPosition:"center",drawShape:function(e,t){var n=this.getShapeStyle(e),i=t.addShape("rect",{attrs:n,className:this.type+"-keyShape",name:this.type+"-keyShape",draggable:!0});return this.drawLinkPoints(e,t),i},drawLinkPoints:function(e,t){var n=this.getOptions(e).linkPoints,i=n===void 0?{}:n,a=i.top,o=i.left,s=i.right,u=i.bottom,l=i.size,c=i.r,f=Ti(i,["top","left","right","bottom","size","r"]),d=this.getSize(e),h=d[0],v=d[1];o&&t.addShape("circle",{attrs:P(P({},f),{x:-h/2,y:0,r:l/2||c||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0}),s&&t.addShape("circle",{attrs:P(P({},f),{x:h/2,y:0,r:l/2||c||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0}),a&&t.addShape("circle",{attrs:P(P({},f),{x:0,y:-v/2,r:l/2||c||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0}),u&&t.addShape("circle",{attrs:P(P({},f),{x:0,y:v/2,r:l/2||c||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0})},getShapeStyle:function(e){var t=this.getOptions(e).style,n={stroke:e.color},i=It({},t,n),a=this.getSize(e),o=i.width||a[0],s=i.height||a[1],u=P({x:-o/2,y:-s/2,width:o,height:s},i);return u},update:function(e,t){var n=t.getContainer(),i=this.getOptions({}).style,a=this.getSize(e),o=t.get("keyShape");e.size||(a[0]=o.attr("width")||i.width,a[1]=o.attr("height")||i.height);var s={stroke:e.color,x:-a[0]/2,y:-a[1]/2,width:a[0],height:a[1]},u=It({},i,o.attr(),s);u=It(u,e.style),this.updateShape(e,t,u,!1),this.updateLinkPoints(e,n)}},"single-node");Wo("ellipse",{options:{size:[80,40],style:{x:0,y:0,stroke:vt.defaultNode.style.stroke,fill:vt.defaultNode.style.fill,lineWidth:vt.defaultNode.style.lineWidth},labelCfg:{style:{fill:vt.nodeLabel.style.fill,fontSize:vt.nodeLabel.style.fontSize}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:vt.defaultNode.linkPoints.size,lineWidth:vt.defaultNode.linkPoints.lineWidth,fill:vt.defaultNode.linkPoints.fill,stroke:vt.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({},vt.nodeStateStyles)},shapeType:"ellipse",labelPosition:"center",drawShape:function(e,t){var n=this.getOptions(e).icon,i=n===void 0?{}:n,a=this.getShapeStyle(e),o=t.addShape("ellipse",{attrs:a,className:"ellipse-keyShape",name:"ellipse-keyShape",draggable:!0}),s=i.width,u=i.height,l=i.show,c=i.text;return l&&(c?t.addShape("text",{attrs:P({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},i),className:this.type+"-icon",name:this.type+"-icon",draggable:!0}):t.addShape("image",{attrs:P({x:-s/2,y:-u/2},i),className:this.type+"-icon",name:this.type+"-icon",draggable:!0})),this.drawLinkPoints(e,t),o},drawLinkPoints:function(e,t){var n=this.getOptions(e).linkPoints,i=n===void 0?{}:n,a=i.top,o=i.left,s=i.right,u=i.bottom,l=i.size,c=i.r,f=Ti(i,["top","left","right","bottom","size","r"]),d=this.getSize(e),h=d[0]/2,v=d[1]/2;o&&t.addShape("circle",{attrs:P(P({},f),{x:-h,y:0,r:l/2||c||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0}),s&&t.addShape("circle",{attrs:P(P({},f),{x:h,y:0,r:l/2||c||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0}),a&&t.addShape("circle",{attrs:P(P({},f),{x:0,y:-v,r:l/2||c||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0}),u&&t.addShape("circle",{attrs:P(P({},f),{x:0,y:v,r:l/2||c||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0})},getShapeStyle:function(e){var t=this.getOptions(e).style,n={stroke:e.color},i=It({},t,n),a=this.getSize(e),o=a[0]/2,s=a[1]/2,u=P({x:0,y:0,rx:o,ry:s},i);return u},update:function(e,t){var n=t.getContainer(),i=this.getOptions({}).style,a=this.getSize(e),o={stroke:e.color,rx:a[0]/2,ry:a[1]/2},s=t.get("keyShape"),u=It({},i,s.attr(),o);u=It(u,e.style),this.updateShape(e,t,u,!0),this.updateLinkPoints(e,n)}},"single-node");Wo("diamond",{options:{size:[80,80],style:{stroke:vt.defaultNode.style.stroke,fill:vt.defaultNode.style.fill,lineWidth:vt.defaultNode.style.lineWidth},labelCfg:{style:{fill:vt.nodeLabel.style.fill,fontSize:vt.nodeLabel.style.fontSize}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:vt.defaultNode.linkPoints.size,lineWidth:vt.defaultNode.linkPoints.lineWidth,fill:vt.defaultNode.linkPoints.fill,stroke:vt.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({},vt.nodeStateStyles)},shapeType:"diamond",labelPosition:"center",drawShape:function(e,t){var n=this.getOptions(e).icon,i=n===void 0?{}:n,a=this.getShapeStyle(e),o=t.addShape("path",{attrs:a,className:this.type+"-keyShape",name:this.type+"-keyShape",draggable:!0}),s=i.width,u=i.height,l=i.show,c=i.text;return l&&(c?t.addShape("text",{attrs:P({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},i),className:this.type+"-icon",name:this.type+"-icon",draggable:!0}):t.addShape("image",{attrs:P({x:-s/2,y:-u/2},i),className:this.type+"-icon",name:this.type+"-icon",draggable:!0})),this.drawLinkPoints(e,t),o},drawLinkPoints:function(e,t){var n=this.getOptions(e).linkPoints,i=n===void 0?{}:n,a=i.top,o=i.left,s=i.right,u=i.bottom,l=i.size,c=i.r,f=Ti(i,["top","left","right","bottom","size","r"]),d=this.getSize(e),h=d[0],v=d[1];o&&t.addShape("circle",{attrs:P(P({},f),{x:-h/2,y:0,r:l/2||c||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0}),s&&t.addShape("circle",{attrs:P(P({},f),{x:h/2,y:0,r:l/2||c||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0}),a&&t.addShape("circle",{attrs:P(P({},f),{x:0,y:-v/2,r:l/2||c||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0}),u&&t.addShape("circle",{attrs:P(P({},f),{x:0,y:v/2,r:l/2||c||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0})},getPath:function(e){var t=this.getSize(e),n=t[0],i=t[1],a=[["M",0,-i/2],["L",n/2,0],["L",0,i/2],["L",-n/2,0],["Z"]];return a},getShapeStyle:function(e){var t=this.getOptions(e).style,n={stroke:e.color},i=It({},t,n),a=this.getPath(e),o=P({path:a},i);return o},update:function(e,t){var n=t.getContainer(),i=this.getOptions({}).style,a=this.getPath(e),o={stroke:e.color,path:a},s=t.get("keyShape"),u=It({},i,s.attr(),o);u=It(u,e.style),this.updateShape(e,t,u,!0),this.updateLinkPoints(e,n)}},"single-node");Wo("triangle",{options:{size:40,direction:"up",style:{stroke:vt.defaultNode.style.stroke,fill:vt.defaultNode.style.fill,lineWidth:vt.defaultNode.style.lineWidth},labelCfg:{style:{fill:vt.nodeLabel.style.fill,fontSize:vt.nodeLabel.style.fontSize},offset:15},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:vt.defaultNode.linkPoints.size,lineWidth:vt.defaultNode.linkPoints.lineWidth,fill:vt.defaultNode.linkPoints.fill,stroke:vt.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({},vt.nodeStateStyles)},shapeType:"triangle",labelPosition:"bottom",drawShape:function(e,t){var n=this.getOptions(e),i=n.icon,a=i===void 0?{}:i,o=n.direction,s=this.getShapeStyle(e),u=e.direction||o,l=t.addShape("path",{attrs:s,className:this.type+"-keyShape",name:this.type+"-keyShape",draggable:!0}),c=a.width,f=a.height,d=a.show,h=a.offset,v=a.text;if(d)if(v)t.addShape("text",{attrs:P({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},a),className:this.type+"-icon",name:this.type+"-icon",draggable:!0});else{var p=-c/2,g=-f/2;(u==="up"||u==="down")&&(g+=h),(u==="left"||u==="right")&&(p+=h),t.addShape("image",{attrs:P({x:p,y:g},a),className:this.type+"-icon",name:this.type+"-icon",draggable:!0})}return this.drawLinkPoints(e,t),l},drawLinkPoints:function(e,t){var n=this.getOptions(e),i=n.linkPoints,a=i===void 0?{}:i,o=n.direction,s=e.direction||o,u=a.top,l=a.left,c=a.right,f=a.bottom,d=a.size,h=a.r,v=Ti(a,["top","left","right","bottom","size","r"]),p=this.getSize(e),g=p[0];if(l){var y=null,m=g*Math.sin(1/3*Math.PI),b=g*Math.sin(1/3*Math.PI);s==="up"?y=[-b,m]:s==="down"?y=[-b,-m]:s==="left"&&(y=[-b,b-m]),y&&t.addShape("circle",{attrs:P(P({},v),{x:y[0],y:y[1],r:d/2||h||5}),className:"link-point-left",name:"link-point-left"})}if(c){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&&t.addShape("circle",{attrs:P(P({},v),{x:w[0],y:w[1],r:d/2||h||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&&t.addShape("circle",{attrs:P(P({},v),{x:x[0],y:x[1],r:d/2||h||5}),className:"link-point-top",name:"link-point-top"})}if(f){var _=null,m=g*Math.sin(1/3*Math.PI),b=g*Math.sin(1/3*Math.PI);s==="down"?_=[-b+m,m]:s==="left"?_=[b,m]:s==="right"&&(_=[-b,m]),_&&t.addShape("circle",{attrs:P(P({},v),{x:_[0],y:_[1],r:d/2||h||5}),className:"link-point-bottom",name:"link-point-bottom"})}},getPath:function(e){var t=this.getOptions(e).direction,n=e.direction||t,i=this.getSize(e),a=i[0],o=a*Math.sin(1/3*Math.PI),s=a*Math.sin(1/3*Math.PI),u=[["M",-s,o],["L",0,-o],["L",s,o],["Z"]];return n==="down"?u=[["M",-s,-o],["L",s,-o],["L",0,o],["Z"]]:n==="left"?u=[["M",-s,s-o],["L",s,-s],["L",s,s],["Z"]]:n==="right"&&(u=[["M",s,s-o],["L",-s,s],["L",-s,-s],["Z"]]),u},getShapeStyle:function(e){var t=this.getOptions(e).style,n={stroke:e.color},i=It({},t,n),a=this.getPath(e),o=P({path:a},i);return o},update:function(e,t){var n=t.getContainer(),i=this.getOptions({}).style,a=this.getPath(e),o={stroke:e.color,path:a},s=t.get("keyShape"),u=It({},i,s.attr(),o);u=It(u,e.style),this.updateShape(e,t,u,!0),this.updateLinkPoints(e,n)},updateLinkPoints:function(e,t){var n=this.getOptions({}),i=n.linkPoints,a=n.direction,o=e.direction||a,s=t.find(function(ee){return ee.get("className")==="link-point-left"}),u=t.find(function(ee){return ee.get("className")==="link-point-right"}),l=t.find(function(ee){return ee.get("className")==="link-point-top"}),c=t.find(function(ee){return ee.get("className")==="link-point-bottom"}),f=i,d=s||u||l||c;d&&(f=d.attr());var h=It({},f,e.linkPoints),v=h.fill,p=h.stroke,g=h.lineWidth,y=h.size/2;y||(y=h.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,_=m.bottom,A=this.getSize(e),I=A[0],M={r:y,fill:v,stroke:p,lineWidth:g},S=null,C=I*Math.sin(1/3*Math.PI),T=I*Math.sin(1/3*Math.PI);o==="up"?S=[-T,C]:o==="down"?S=[-T,-C]:o==="left"&&(S=[-T,T-C]),S&&(s?!b&&b!==void 0?s.remove():s.attr(P(P({},M),{x:S[0],y:S[1]})):b&&t.addShape("circle",{attrs:P(P({},M),{x:S[0],y:S[1]}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0}));var k=null;o==="up"?k=[T,C]:o==="down"?k=[T,-C]:o==="right"&&(k=[T,T-C]),k&&(u?!w&&w!==void 0?u.remove():u.attr(P(P({},M),{x:k[0],y:k[1]})):w&&t.addShape("circle",{attrs:P(P({},M),{x:k[0],y:k[1]}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0}));var L=null;o==="up"?L=[T-C,-C]:o==="left"?L=[T,-C]:o==="right"&&(L=[-T,-C]),L&&(l?!x&&x!==void 0?l.remove():l.attr(P(P({},M),{x:L[0],y:L[1]})):x&&t.addShape("circle",{attrs:P(P({},M),{x:L[0],y:L[1]}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0}));var B=null;o==="down"?B=[-T+C,C]:o==="left"?B=[T,C]:o==="right"&&(B=[-T,C]),B&&(c?!_&&_!==void 0?c.remove():c.attr(P(P({},M),{x:B[0],y:B[1]})):_&&t.addShape("circle",{attrs:P(P({},M),{x:B[0],y:B[1]}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))}},"single-node");Wo("modelRect",{options:{size:[185,70],style:{radius:5,stroke:"#69c0ff",fill:"#ffffff",lineWidth:vt.defaultNode.style.lineWidth,fillOpacity:1},labelCfg:{style:{fill:"#595959",fontSize:14},offset:30},descriptionCfg:{style:{fontSize:12,fill:"#bfbfbf"},paddingTop:0},preRect:{show:!0,width:4,fill:"#40a9ff",radius:2},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:10,lineWidth:1,fill:"#72CC4A",stroke:"#72CC4A"},logoIcon:{show:!0,x:0,y:0,img:"https://gw.alipayobjects.com/zos/basement_prod/4f81893c-1806-4de4-aff3-9a6b266bc8a2.svg",width:16,height:16,offset:0},stateIcon:{show:!0,x:0,y:0,img:"https://gw.alipayobjects.com/zos/basement_prod/300a2523-67e0-4cbf-9d4a-67c077b40395.svg",width:16,height:16,offset:-5},anchorPoints:[[0,.5],[1,.5]]},shapeType:"modelRect",drawShape:function(e,t){var n=this.getOptions(e).preRect,i=n===void 0?{}:n,a=this.getShapeStyle(e),o=this.getSize(e),s=o[0],u=o[1],l=t.addShape("rect",{attrs:a,className:this.type+"-keyShape",name:this.type+"-keyShape",draggable:!0}),c=i.show,f=Ti(i,["show"]);return c&&t.addShape("rect",{attrs:P({x:-s/2,y:-u/2,height:u},f),className:"pre-rect",name:"pre-rect",draggable:!0}),this.drawLogoIcon(e,t),this.drawStateIcon(e,t),this.drawLinkPoints(e,t),l},drawLogoIcon:function(e,t){var n=this.getOptions(e).logoIcon,i=n===void 0?{}:n,a=this.getSize(e),o=a[0];if(i.show){var s=i.width,u=i.height,l=i.x,c=i.y,f=i.offset,d=i.text,h=Ti(i,["width","height","x","y","offset","text"]);d?t.addShape("text",{attrs:P({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},h),className:"rect-logo-icon",name:"rect-logo-icon",draggable:!0}):t.addShape("image",{attrs:P(P({},h),{x:l||-o/2+s+f,y:c||-u/2,width:s,height:u}),className:"rect-logo-icon",name:"rect-logo-icon",draggable:!0})}},drawStateIcon:function(e,t){var n=this.getOptions(e).stateIcon,i=n===void 0?{}:n,a=this.getSize(e),o=a[0];if(i.show){var s=i.width,u=i.height,l=i.x,c=i.y,f=i.offset,d=i.text,h=Ti(i,["width","height","x","y","offset","text"]);d?t.addShape("text",{attrs:P({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},h),className:"rect-state-icon",name:"rect-state-icon",draggable:!0}):t.addShape("image",{attrs:P(P({},h),{x:l||o/2-s+f,y:c||-u/2,width:s,height:u}),className:"rect-state-icon",name:"rect-state-icon",draggable:!0})}},drawLinkPoints:function(e,t){var n=this.getOptions(e).linkPoints,i=n===void 0?{}:n,a=i.top,o=i.left,s=i.right,u=i.bottom,l=i.size,c=i.r,f=Ti(i,["top","left","right","bottom","size","r"]),d=this.getSize(e),h=d[0],v=d[1];o&&t.addShape("circle",{attrs:P(P({},f),{x:-h/2,y:0,r:l/2||c||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0}),s&&t.addShape("circle",{attrs:P(P({},f),{x:h/2,y:0,r:l/2||c||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0}),a&&t.addShape("circle",{attrs:P(P({},f),{x:0,y:-v/2,r:l/2||c||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0}),u&&t.addShape("circle",{attrs:P(P({},f),{x:0,y:v/2,r:l/2||c||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0})},drawLabel:function(e,t){var n=this.getOptions(e),i=n.labelCfg,a=i===void 0?{}:i,o=n.logoIcon,s=o===void 0?{}:o,u=n.descriptionCfg,l=u===void 0?{}:u,c=this.getSize(e),f=c[0],d=null,h=s.show,v=s.width,p=-f/2+a.offset;h&&(p=-f/2+v+a.offset);var g=a.style,y=l.style,m=l.paddingTop;return We(e.description)?(d=t.addShape("text",{attrs:P(P({},g),{x:p,y:-5,text:e.label}),className:"text-shape",name:"text-shape",draggable:!0}),t.addShape("text",{attrs:P(P({},y),{x:p,y:17+(m||0),text:e.description}),className:"rect-description",name:"rect-description",draggable:!0})):d=t.addShape("text",{attrs:P(P({},g),{x:p,y:7,text:e.label}),className:"text-shape",name:"text-shape",draggable:!0}),d},getShapeStyle:function(e){var t=this.getOptions(e).style,n={stroke:e.color},i=It({},t,n),a=this.getSize(e),o=i.width||a[0],s=i.height||a[1],u=P({x:-o/2,y:-s/2,width:o,height:s},i);return u},update:function(e,t){var n=this.getOptions(e),i=n.style,a=i===void 0?{}:i,o=n.labelCfg,s=o===void 0?{}:o,u=n.descriptionCfg,l=u===void 0?{}:u,c=this.getSize(e),f=c[0],d=c[1],h=t.get("keyShape");h.attr(P(P({},a),{x:-f/2,y:-d/2,width:f,height:d}));var v=t.getContainer(),p=v.find(function(ze){return ze.get("className")==="rect-logo-icon"}),g=p?p.attr():{},y=It({},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=-f/2+m+w;!b&&b!==void 0&&(x=-f/2+w);var _=v.find(function(ze){return ze.get("className")==="node-label"}),A=v.find(function(ze){return ze.get("className")==="rect-description"});if(e.label)if(!_)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});else{var I=e.labelCfg?e.labelCfg.style:{},M=It({},_.attr(),I);e.label&&(M.text=e.label),M.x=x,We(e.description)&&(M.y=-5),A&&(A.resetMatrix(),A.attr({x})),_.resetMatrix(),_.attr(M)}if(We(e.description)){var S=l.paddingTop;if(!A)v.addShape("text",{attrs:P(P({},l.style),{x,y:17+(S||0),text:e.description}),className:"rect-description",name:"rect-description",draggable:!0});else{var I=e.descriptionCfg?e.descriptionCfg.style:{},C=It({},A.attr(),I);We(e.description)&&(C.text=e.description),C.x=x,A.resetMatrix(),A.attr(P(P({},C),{y:17+(S||0)}))}}var T=v.find(function(ze){return ze.get("className")==="pre-rect"});if(T){var k=It({},T.attr(),e.preRect);T.attr(P(P({},k),{x:-f/2,y:-d/2,height:d}))}if(p)if(!b&&b!==void 0)p.remove();else{var L=y.width,B=y.height,ee=y.x,K=y.y,z=y.offset,X=Ti(y,["width","height","x","y","offset"]);p.attr(P(P({},X),{x:ee||-f/2+L+z,y:K||-B/2,width:L,height:B}))}else b&&this.drawLogoIcon(e,v);var H=v.find(function(ze){return ze.get("className")==="rect-state-icon"}),J=H?H.attr():{},ne=It({},J,e.stateIcon);if(H){!ne.show&&ne.show!==void 0&&H.remove();var me=ne.width,B=ne.height,ee=ne.x,K=ne.y,oe=ne.offset,Ae=Ti(ne,["width","height","x","y","offset"]);H.attr(P(P({},Ae),{x:ee||f/2-me+oe,y:K||-B/2,width:me,height:B}))}else ne.show&&this.drawStateIcon(e,v);this.updateLinkPoints(e,v)}},"single-node");Wo("star",{options:{size:60,style:{stroke:vt.defaultNode.style.stroke,fill:vt.defaultNode.style.fill,lineWidth:vt.defaultNode.style.lineWidth},labelCfg:{style:{fill:vt.nodeLabel.style.fill,fontSize:vt.nodeLabel.style.fontSize}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:vt.defaultNode.linkPoints.size,lineWidth:vt.defaultNode.linkPoints.lineWidth,fill:vt.defaultNode.linkPoints.fill,stroke:vt.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({},vt.nodeStateStyles)},shapeType:"star",labelPosition:"center",drawShape:function(e,t){var n=this.getOptions(e).icon,i=n===void 0?{}:n,a=this.getShapeStyle(e),o=t.addShape("path",{attrs:a,className:this.type+"-keyShape",name:this.type+"-keyShape",draggable:!0}),s=i.width,u=i.height,l=i.show,c=i.text;return l&&(c?t.addShape("text",{attrs:P({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},i),className:this.type+"-icon",name:this.type+"-icon",draggable:!0}):t.addShape("image",{attrs:P({x:-s/2,y:-u/2},i),className:this.type+"-icon",name:this.type+"-icon",draggable:!0})),this.drawLinkPoints(e,t),o},drawLinkPoints:function(e,t){var n=this.getOptions(e).linkPoints,i=n===void 0?{}:n,a=i.top,o=i.left,s=i.right,u=i.leftBottom,l=i.rightBottom,c=i.size,f=i.r,d=Ti(i,["top","left","right","leftBottom","rightBottom","size","r"]),h=this.getSize(e),v=h[0];if(s){var p=Math.cos((18+72*0)/180*Math.PI)*v,g=Math.sin((18+72*0)/180*Math.PI)*v;t.addShape("circle",{attrs:P(P({},d),{x:p,y:-g,r:c/2||f||5}),className:"link-point-right",name:"link-point-right"})}if(a){var p=Math.cos((18+72*1)/180*Math.PI)*v,g=Math.sin((18+72*1)/180*Math.PI)*v;t.addShape("circle",{attrs:P(P({},d),{x:p,y:-g,r:c/2||f||5}),className:"link-point-top",name:"link-point-top"})}if(o){var p=Math.cos((18+72*2)/180*Math.PI)*v,g=Math.sin((18+72*2)/180*Math.PI)*v;t.addShape("circle",{attrs:P(P({},d),{x:p,y:-g,r:c/2||f||5}),className:"link-point-left",name:"link-point-left"})}if(u){var p=Math.cos((18+72*3)/180*Math.PI)*v,g=Math.sin((18+72*3)/180*Math.PI)*v;t.addShape("circle",{attrs:P(P({},d),{x:p,y:-g,r:c/2||f||5}),className:"link-point-left-bottom",name:"link-point-left-bottom"})}if(l){var p=Math.cos((18+72*4)/180*Math.PI)*v,g=Math.sin((18+72*4)/180*Math.PI)*v;t.addShape("circle",{attrs:P(P({},d),{x:p,y:-g,r:c/2||f||5}),className:"link-point-right-bottom",name:"link-point-right-bottom"})}},getPath:function(e){for(var t=this.getSize(e),n=t[0],i=n*3/8,a=e.innerR||i,o=[],s=0;s<5;s++){var u=Math.cos((18+72*s)/180*Math.PI)*n,l=Math.sin((18+72*s)/180*Math.PI)*n,c=Math.cos((54+72*s)/180*Math.PI)*a,f=Math.sin((54+72*s)/180*Math.PI)*a;s===0?o.push(["M",u,-l]):o.push(["L",u,-l]),o.push(["L",c,-f])}return o.push(["Z"]),o},getShapeStyle:function(e){var t=this.getOptions(e).style,n={stroke:e.color},i=It({},t,n),a=this.getPath(e),o=P({path:a},i);return o},update:function(e,t){var n=t.getContainer(),i=this.getOptions({}).style,a=this.getPath(e),o={stroke:e.color,path:a},s=t.get("keyShape"),u=It({},i,s.attr(),o);u=It(u,e.style),this.updateShape(e,t,u,!0),this.updateLinkPoints(e,n)},updateLinkPoints:function(e,t){var n=this.getOptions({}).linkPoints,i=t.find(function(C){return C.get("className")==="link-point-left"}),a=t.find(function(C){return C.get("className")==="link-point-right"}),o=t.find(function(C){return C.get("className")==="link-point-top"}),s=t.find(function(C){return C.get("className")==="link-point-left-bottom"}),u=t.find(function(C){return C.get("className")==="link-point-right-bottom"}),l=n,c=i||a||o||s||u;c&&(l=c.attr());var f=It({},l,e.linkPoints),d=f.fill,h=f.stroke,v=f.lineWidth,p=f.size/2;p||(p=f.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,_=this.getSize(e),A=_[0],I={r:p,fill:d,stroke:h,lineWidth:v},M=Math.cos((18+72*0)/180*Math.PI)*A,S=Math.sin((18+72*0)/180*Math.PI)*A;a?!m&&m!==void 0?a.remove():a.attr(P(P({},I),{x:M,y:-S})):m&&t.addShape("circle",{attrs:P(P({},I),{x:M,y:-S}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0}),M=Math.cos((18+72*1)/180*Math.PI)*A,S=Math.sin((18+72*1)/180*Math.PI)*A,o?!b&&b!==void 0?o.remove():o.attr(P(P({},I),{x:M,y:-S})):b&&t.addShape("circle",{attrs:P(P({},I),{x:M,y:-S}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0}),M=Math.cos((18+72*2)/180*Math.PI)*A,S=Math.sin((18+72*2)/180*Math.PI)*A,i?!y&&y!==void 0?i.remove():i.attr(P(P({},I),{x:M,y:-S})):y&&t.addShape("circle",{attrs:P(P({},I),{x:M,y:-S}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0}),M=Math.cos((18+72*3)/180*Math.PI)*A,S=Math.sin((18+72*3)/180*Math.PI)*A,s?!w&&w!==void 0?s.remove():s.attr(P(P({},I),{x:M,y:-S})):w&&t.addShape("circle",{attrs:P(P({},I),{x:M,y:-S}),className:"link-point-left-bottom",name:"link-point-left-bottom",isAnchorPoint:!0}),M=Math.cos((18+72*4)/180*Math.PI)*A,S=Math.sin((18+72*4)/180*Math.PI)*A,u?!x&&x!==void 0?s.remove():u.attr(P(P({},I),{x:M,y:-S})):x&&t.addShape("circle",{attrs:P(P({},I),{x:M,y:-S}),className:"link-point-right-bottom",name:"link-point-right-bottom",isAnchorPoint:!0})}},"single-node");var md=Ua.defaultSubjectColors;Wo("donut",{options:{size:vt.defaultNode.size,style:{x:0,y:0,stroke:vt.defaultNode.style.stroke,fill:vt.defaultNode.style.fill,lineWidth:vt.defaultNode.style.lineWidth},labelCfg:{style:{fill:vt.nodeLabel.style.fill,fontSize:vt.nodeLabel.style.fontSize}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:vt.defaultNode.linkPoints.size,lineWidth:vt.defaultNode.linkPoints.lineWidth,fill:vt.defaultNode.linkPoints.fill,stroke:vt.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({},vt.nodeStateStyles)},shapeType:"circle",labelPosition:"center",drawShape:function(e,t){var n=this.getOptions(e).icon,i=n===void 0?{}:n,a=this.getShapeStyle(e),o=tn({},i,e.icon),s=t.addShape("circle",{attrs:a,className:this.type+"-keyShape",draggable:!0,name:this.type+"-keyShape"}),u=o.width,l=o.height,c=o.show,f=o.text;c&&(f?t.addShape("text",{attrs:P({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},o),className:this.type+"-icon",name:this.type+"-icon",draggable:!0}):t.addShape("image",{attrs:P({x:-u/2,y:-l/2},o),className:this.type+"-icon",name:this.type+"-icon",draggable:!0}));var d=s.attr("r"),h=.6*d,v=(d+h)/2,p=e,g=p.donutAttrs,y=g===void 0?{}:g,m=p.donutColorMap,b=m===void 0?{}:m,w=Object.keys(y).length;if(y&&w>1){var x=[],_=0;if(Object.keys(y).forEach(function(S){var C=y[S]||0;!Ft(C)||(x.push({key:S,value:C,color:b[S]}),_+=C)}),_){var A=d-h;if(w===1){t.addShape("circle",{attrs:{r:v,x:0,y:0,stroke:x[0].color||md[0],lineWidth:A},name:"fan-shape-0"});return}var I=[v,0],M=0;x.forEach(function(S,C){var T=S.value/_;if(!(T<.001)){if(T>.999&&(T=1),T===1){t.addShape("circle",{attrs:{r:v,x:0,y:0,stroke:S.color||md[C%md.length],lineWidth:A},name:"fan-shape-"+C});return}S.percent=T,S.angle=T*Math.PI*2,S.beginAgnle=M,M+=S.angle,S.endAngle=M,S.arcBegin=I,S.arcEnd=[v*Math.cos(S.endAngle),-v*Math.sin(S.endAngle)];var k=S.angle>Math.PI?1:0,L=[["M",S.arcBegin[0],S.arcBegin[1]],["A",v,v,0,k,0,S.arcEnd[0],S.arcEnd[1]],["L",S.arcEnd[0],S.arcEnd[1]]];t.addShape("path",{attrs:{path:L,lineWidth:A,stroke:S.color||md[C%md.length]},name:"fan-shape-"+C}),I=S.arcEnd}})}}return this.drawLinkPoints(e,t),s},update:void 0},"circle");var Ly=function(e){var t=e.x,n=e.y;return{x:t,y:n,centerX:t,centerY:n,minX:t,minY:n,maxX:t,maxY:n,height:0,width:0}},zde=function(e){e===void 0&&(e=[]);var t=[],n=[];e.forEach(function(u){t.push(u.x),n.push(u.y)});var i=Math.min.apply(Math,t),a=Math.max.apply(Math,t),o=Math.min.apply(Math,n),s=Math.max.apply(Math,n);return{centerX:(i+a)/2,centerY:(o+s)/2,maxX:a,maxY:s,minX:i,minY:o,height:s-o,width:a-i}},Dx=function(e){for(var t=[],n={},i=e.length,a=i-1;a>=0;a--){var o=e[a];o.id=o.x+"|||"+o.y,n[o.id]=o,t.push(o)}return t},fF=function(e){return Dx(e)},Ny=function(e,t){return e.width||e.height?{centerX:e.centerX,centerY:e.centerY,minX:e.minX-t,minY:e.minY-t,maxX:e.maxX+t,maxY:e.maxY+t,height:e.height+2*t,width:e.width+2*t}:e},$de=function(e,t){var n=Math.abs(e.x-t.centerX),i=Math.abs(e.y-t.centerY);return n===0&&i===0?0:n/t.width>i/t.height},Lx=function(e,t,n){var i=$de(t,e);if(i===0){var a=e.centerX,o=e.centerY;return n.y<t.y?o=e.minY:n.x>t.x?a=e.maxX:n.x<t.x?a=e.minX:n.x===t.x&&(o=e.maxY),{x:a,y:o}}return i?{x:t.x>e.centerX?e.maxX:e.minX,y:t.y}:{x:t.x,y:t.y>e.centerY?e.maxY:e.minY}},hF=function(e,t){var n=Math.min(e.minX,t.minX),i=Math.min(e.minY,t.minY),a=Math.max(e.maxX,t.maxX),o=Math.max(e.maxY,t.maxY);return{centerX:(n+a)/2,centerY:(i+o)/2,minX:n,minY:i,maxX:a,maxY:o,height:o-i,width:a-n}},Nx=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}]},Oy=function(e,t){var n=e.x,i=e.y;return n<t.minX||n>t.maxX||i<t.minY||i>t.maxY},Vde=function(e,t){return t<e.minX||t>e.maxX?[]:[{x:t,y:e.minY},{x:t,y:e.maxY}]},jde=function(e,t){return t<e.minY||t>e.maxY?[]:[{x:e.minX,y:t},{x:e.maxX,y:t}]},Wde=function(e,t){return Vde(e,t.x).concat(jde(e,t.y))},bd=function(e,t){return Math.abs(e.x-t.x)+Math.abs(e.y-t.y)},Xde=function(e,t){var n=-2,i=0;return t.forEach(function(a){a&&(e.x===a.x&&(i+=n),e.y===a.y&&(i+=n))}),i},dF=function(e,t,n,i,a){return bd(e,t)+bd(e,n)+Xde(e,[t,n,i,a])},Yde=function r(e,t,n,i,a){a===void 0&&(a=0),e.unshift(t[i]),n[i]&&n[i]!==i&&a<=100&&r(e,t,n,n[i],a+1)},Hde=function(e,t){var n=e.indexOf(t);n>-1&&e.splice(n,1)},Py=function(e,t,n,i){var a=n.x-e.x,o=n.y-e.y,s=i.x-e.x,u=i.y-e.y,l=n.x-t.x,c=n.y-t.y,f=i.x-t.x,d=i.y-t.y,h=a*u-o*s,v=l*d-c*f,p=a*c-o*l,g=s*d-u*f;return h*v<=0&&p*g<=0},Ox=function(e,t,n){if(n.width||n.height){var i=Nx(n),a=i[0],o=i[1],s=i[2],u=i[3];return Py(e,t,a,o)||Py(e,t,a,u)||Py(e,t,o,s)||Py(e,t,s,u)}return!1},qde=function(e,t,n,i){var a=[];return e.forEach(function(o){if(o!==t&&(o.x===t.x||o.y===t.y)){if(Ox(o,t,n)||Ox(o,t,i))return;a.push(o)}}),Dx(a)},Kde=function(e,t,n,i,a,o,s){var u=[],l=[t],c={},f={},d={};f[t.id]=0,d[t.id]=dF(t,n,t);var h={};e.forEach(function(y){h[y.id]=y});for(var v,p;l.length;){if(v=void 0,p=1/0,l.forEach(function(y){d[y.id]<=p&&(p=d[y.id],v=y)}),v===n){var g=[];return Yde(g,h,c,n.id),g}Hde(l,v),u.push(v),qde(e,v,i,a).forEach(function(y){if(u.indexOf(y)===-1){l.indexOf(y)===-1&&l.push(y);var m=d[v.id]+bd(v,y);f[y.id]&&m>=f[y.id]||(c[y.id]=v.id,f[y.id]=m,d[y.id]=f[y.id]+dF(y,n,t,o,s))}})}return[t,n]},Zde=function(e,t,n){return!(e.x===t.x&&t.x===n.x||e.y===t.y&&t.y===n.y)},Qde=function(e,t,n,i){var a=bd(e,t),o=bd(n,t);a<i&&(i=a),o<i&&(i=o);var s={x:t.x-i/a*(t.x-e.x),y:t.y-i/a*(t.y-e.y)},u={x:t.x-i/o*(t.x-n.x),y:t.y-i/o*(t.y-n.y)};return[s,u]},vF=function(e,t){var n=[],i=e[0];return n.push("M"+i.x+" "+i.y),e.forEach(function(a,o){var s=e[o+1],u=e[o+2];if(s&&u)if(Zde(a,s,u)){var l=Qde(a,s,u,t),c=l[0],f=l[1];n.push("L"+c.x+" "+c.y),n.push("Q"+s.x+" "+s.y+" "+f.x+" "+f.y),n.push("L"+f.x+" "+f.y)}else n.push("L"+s.x+" "+s.y);else s&&n.push("L"+s.x+" "+s.y)}),n.join("")},pF=function(e,t,n,i,a){var o,s;if(!n||!n.getType())o=Ly(e);else if(n.getType()==="combo"){var u=n.getKeyShape();o=u.getCanvasBBox()||Ly(e),o.centerX=(o.minX+o.maxX)/2,o.centerY=(o.minY+o.maxY)/2}else o=n.getBBox();if(!i||!i.getType())s=Ly(t);else if(i.getType()==="combo"){var l=i.getKeyShape().getBBox();if(l){var c=i.getModel(),f=c.x,d=c.y;s={x:f,y:d,width:l.width,height:l.height,minX:l.minX+f,maxX:l.maxX+f,minY:l.minY+d,maxY:l.maxY+d},s.centerX=(s.minX+s.maxX)/2,s.centerY=(s.minY+s.maxY)/2}else s=Ly(t)}else s=i&&i.getBBox();var h=Ny(o,a),v=Ny(s,a),p=Lx(h,e,t),g=Lx(v,t,e),y=zde([p,g]),m=hF(h,y),b=hF(v,y),w=[];w=w.concat(Nx(m)).concat(Nx(b));var x={x:(e.x+t.x)/2,y:(e.y+t.y)/2};[y,m,b].forEach(function(A){w=w.concat(Wde(A,x).filter(function(I){return Oy(I,h)&&Oy(I,v)}))}),[{x:p.x,y:g.y},{x:g.x,y:p.y}].forEach(function(A){Oy(A,h)&&Oy(A,v)&&w.push(A)}),w.unshift(p),w.push(g),w=Dx(w);var _=Kde(w,p,g,o,s,e,t);return _.unshift(e),_.push(t),fF(_)},Jde=function(e,t){return Math.abs(e.x-t.x)+Math.abs(e.y-t.y)},eve=function(e,t,n,i,a){return fF(pF(e,t,n,i,a.offset))},tve={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:Jde,fallbackRoute:eve},us=function(e,t){var n=Math.round(Math.abs(e/t)),i=e<0?-1:1;return n<0?0:i*n},rve=function(e,t,n){var i={};return e.forEach(function(a){if(!!a)for(var o=Ny(a.getBBox(),n),s=us(o.minX,t);s<=us(o.maxX,t);s+=1)for(var u=us(o.minY,t);u<=us(o.maxY,t);u+=1)i[s+"|||"+u]=!0}),i},Px=function(e,t){var n=t.x-e.x,i=t.y-e.y;return n||i?Math.atan2(i,n):0},gF=function(e,t){var n=Math.abs(e-t);return n>Math.PI?2*Math.PI-n:n},yF=function(e,t,n){for(var i=1/0,a=0,o=t.length;a<o;a++){var s=n(e,t[a]);s<i&&(i=s)}return i},mF=function(e,t,n,i,a){var o=[];if(!n)return[e];var s=a.directions,u=a.offset,l=n.getBBox(),c=t.x>l.minX&&t.x<l.maxX&&t.y>l.minY&&t.y<l.maxY,f=Ny(l,u);for(var d in f)f[d]=us(f[d],a.gridSize);if(c){for(var h=0,v=s;h<v.length;h++)for(var p=v[h],g=[[{x:f.minX,y:f.minY},{x:f.maxX,y:f.minY}],[{x:f.minX,y:f.minY},{x:f.minX,y:f.maxY}],[{x:f.maxX,y:f.minY},{x:f.maxX,y:f.maxY}],[{x:f.minX,y:f.maxY},{x:f.maxX,y:f.maxY}]],d=0;d<4;d++){var y=g[d],m=Ua.getLineIntersect(e,{x:e.x+p.stepX*f.width,y:e.y+p.stepY*f.height},y[0],y[1]);m&&!Ox(e,m,l)&&(m.id=m.x+"|||"+m.y,o.push(m))}return o}var b=Lx(f,e,i);return b.id=b.x+"|||"+b.y,[b]},Rx=function(e,t,n,i){var a=Px(e,t);if(!n[e.id]){var o=Px(i,e);return gF(o,a)}var s=Px({x:n[e.id].x,y:n[e.id].y},e);return gF(s,a)},nve=function(e,t,n,i,a,o,s){var u=[i],l=e.id,c=e.x,f=e.y,d={x:c,y:f,id:l};for(Rx(d,o,t,n)&&u.unshift({x:o.x===i.x?i.x:d.x*s,y:o.y===i.y?i.y:d.y*s});t[l]&&t[l].id!==l;){var h={x:c,y:f,id:l},v=t[l].id,p=t[l].x,g=t[l].y,y={x:p,y:g,id:v},m=Rx(y,h,t,n);m&&u.unshift({x:y.x===h.x?u[0].x:y.x*s,y:y.y===h.y?u[0].y:y.y*s}),l=v,c=p,f=g}var b={x:c,y:f,id:l};return u[0].x=b.x===n.x?a.x:u[0].x,u[0].y=b.y===n.y?a.y:u[0].y,u.unshift(a),u},ive=function(e,t,n,i,a){if(isNaN(e.x)||isNaN(t.x))return[];var o=tn(tve,a);o.obstacles=o.obstacles||[];var s=o.gridSize,u=rve(o.obstacles.concat([n,i]),s,o.offset),l={x:us(e.x,s),y:us(e.y,s)},c={x:us(t.x,s),y:us(t.y,s)};e.id=l.x+"|||"+l.y,t.id=c.x+"|||"+c.y;var f=mF(l,e,n,c,o),d=mF(c,t,i,l,o);f.forEach(function(k){delete u[k.id]}),d.forEach(function(k){delete u[k.id]});for(var h={},v={},p={},g={},y={},m=0;m<f.length;m++){var b=f[m];h[b.id]=b,g[b.id]=0,y[b.id]=yF(b,d,o.distFunc)}for(var w=o.maximumLoops,x=o.penalties,_,A,I,M,S,C,T;Object.keys(h).length>0&&w>0&&(_=void 0,A=1/0,Object.keys(h).forEach(function(k){var L=h[k].id;y[L]<=A&&(A=y[L],_=h[L])}),!!_);){if(d.findIndex(function(k){return k.x===_.x&&k.y===_.y})>-1)return nve(_,p,l,t,e,c,s);delete h[_.id],v[_.id]=!0;for(var m=0;m<o.directions.length;m++)I=o.directions[m],M={x:_.x+I.stepX,y:_.y+I.stepY,id:Math.round(_.x)+I.stepX+"|||"+(Math.round(_.y)+I.stepY)},!v[M.id]&&(T=Rx(_,M,p,l),!(T>o.maxAllowedDirectionChange)&&(u[M.id]||(h[M.id]||(h[M.id]=M),S=o.distFunc(_,M)+(isNaN(x[T])?s:x[T]),C=g[_.id]+S,!(g[M.id]&&C>=g[M.id])&&(p[M.id]=_,g[M.id]=C,y[M.id]=C+yF(M,d,o.distFunc)))));w-=1}return o.fallbackRoute(e,t,n,i,o)};gM("polyline",{options:{color:vt.defaultEdge.color,size:vt.defaultEdge.size,style:{radius:0,offset:15,x:0,y:0,stroke:vt.defaultEdge.style.stroke,lineAppendWidth:vt.defaultEdge.style.lineAppendWidth},labelCfg:{style:{fill:vt.edgeLabel.style.fill,fontSize:vt.edgeLabel.style.fontSize}},routeCfg:{obstacles:[],maxAllowedDirectionChange:Math.PI,maximumLoops:500,gridSize:10},stateStyles:P({},vt.edgeStateStyles)},shapeType:"polyline",labelPosition:"center",drawShape:function(e,t){var n=this.getShapeStyle(e);n.radius===0&&delete n.radius;var i=t.addShape("path",{className:"edge-shape",name:"edge-shape",attrs:n});return i},getShapeStyle:function(e){var t=this.options.style,n={stroke:e.color},i=It({},t,n,e.style);e=this.getPathPoints(e),this.radius=i.radius,this.offset=i.offset;var a=e.startPoint,o=e.endPoint,s=this.getControlPoints(e),u=[a];s&&(u=u.concat(s)),u.push(o);var l=e.sourceNode,c=e.targetNode,f=i.radius,d=this.options.routeCfg,h=It({},d,e.routeCfg);h.offset=i.offset;var v=this.getPath(u,l,c,f,h);(Mt(v)&&v.length<=1||We(v)&&v.indexOf("L")===-1)&&(v="M0 0, L0 0"),(isNaN(a.x)||isNaN(a.y)||isNaN(o.x)||isNaN(o.y))&&(v="M0 0, L0 0");var p=It({},vt.defaultEdge.style,i,{lineWidth:e.size,path:v});return p},updateShapeStyle:function(e,t){var n=t.getContainer();if(!!t.isVisible()){var i={stroke:e.color},a=n.find(function(w){return w.get("className")==="edge-shape"})||t.getKeyShape(),o=e.size;e=this.getPathPoints(e);var s=e.startPoint,u=e.endPoint,l=this.getControlPoints(e),c=[s];l&&(c=c.concat(l)),c.push(u);var f=a.attr(),d=It({},i,f,e.style),h=e.sourceNode,v=e.targetNode,p=d.radius,g=this.options.routeCfg,y=It({},g,e.routeCfg);y.offset=d.offset;var m=this.getPath(c,h,v,p,y);(Mt(m)&&m.length<=1||We(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"),f.endArrow&&d.endArrow===!1&&(e.style.endArrow={path:""}),f.startArrow&&d.startArrow===!1&&(e.style.startArrow={path:""});var b=It(i,a.attr(),{lineWidth:o,path:m},e.style);a&&a.attr(b)}},getPath:function(e,t,n,i,a){var o=a.offset,s=a.simple;if(!o||e.length>2){if(i)return vF(e,i);var u=[];return xe(e,function(d,h){h===0?u.push(["M",d.x,d.y]):u.push(["L",d.x,d.y])}),u}var l=s?pF(e[e.length-1],e[0],n,t,o):ive(e[0],e[e.length-1],t,n,a);if(!l||!l.length)return"M0 0, L0 0";if(i){var c=vF(l,i);return c}var f=Ua.pointsToPolygon(l);return f}},"single-edge");var bF=as.cloneEvent,wF=as.isNaN,xF=Math.abs,ave=10,ove=["shift","ctrl","alt","control"],sve={getDefaultCfg:function(){return{direction:"both",enableOptimize:!1,scalableRange:0,allowDragOnItem:!1}},getEvents:function(){return{dragstart:"onMouseDown",drag:"onMouseMove",dragend:"onMouseUp","canvas:click":"onMouseUp",keyup:"onKeyUp",focus:"onKeyUp",keydown:"onKeyDown",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onMouseUp"}},updateViewport:function(e){var t=this.origin,n=+e.clientX,i=+e.clientY;if(!(wF(n)||wF(i))){var a=n-t.x,o=i-t.y;this.get("direction")==="x"?o=0:this.get("direction")==="y"&&(a=0),this.origin={x:n,y:i};var s=this.graph.get("width"),u=this.graph.get("height"),l=this.graph.get("canvas").getCanvasBBox(),c=this.scalableRange,f=this.scalableRange;c<1&&c>-1&&(c=s*c,f=u*f),(l.minX<=s+c&&l.minX+a>s+c||l.maxX+c>=0&&l.maxX+c+a<0)&&(a=0),(l.minY<=u+f&&l.minY+o>u+f||l.maxY+f>=0&&l.maxY+f+o<0)&&(o=0),this.graph.translate(a,o)}},onTouchStart:function(e){var t=this,n=e.originalEvent.touches,i=n[0],a=n[1];i&&a||(e.preventDefault(),t.onMouseDown(e))},onMouseDown:function(e){var t=this,n=e.originalEvent;if(!(n&&e.name!==Zp.TOUCHSTART&&n.button!==0)&&!(e.name!==Zp.TOUCHSTART&&typeof window!="undefined"&&window.event&&!window.event.buttons&&!window.event.button)&&!!this.shouldBegin.call(this,e)&&!t.keydown){var i=e.target,a=i&&i.isCanvas&&i.isCanvas();if(!(!this.allowDragOnItem&&!a)&&(t.origin={x:e.clientX,y:e.clientY},t.dragging=!1,this.enableOptimize)){for(var o=this.graph,s=o.getEdges(),u=0,l=s.length;u<l;u++){var c=s[u].get("group").get("children");!c||c.forEach(function(w){w.set("ori-visibility",w.get("ori-visibility")||w.get("visible")),w.hide()})}for(var f=o.getNodes(),d=0,h=f.length;d<h;d++)for(var v=f[d].getContainer(),p=v.get("children"),g=0,y=p;g<y.length;g++){var m=y[g],b=m.get("isKeyShape");b||(m.set("ori-visibility",m.get("ori-visibility")||m.get("visible")),m.hide())}}}},onTouchMove:function(e){var t=this,n=e.originalEvent.touches,i=n[0],a=n[1];if(i&&a){this.onMouseUp(e);return}e.preventDefault(),t.onMouseMove(e)},onMouseMove:function(e){var t=this.graph;if(!this.keydown){var n=e.target,i=n&&n.isCanvas&&n.isCanvas();if(!(!this.allowDragOnItem&&!i)&&(e=bF(e),!!this.origin)){if(this.dragging)e.type="drag",t.emit("canvas:drag",e);else{if(xF(this.origin.x-e.clientX)+xF(this.origin.y-e.clientY)<ave)return;this.shouldBegin.call(this,e)&&(e.type="dragstart",t.emit("canvas:dragstart",e),this.dragging=!0)}this.shouldUpdate.call(this,e)&&this.updateViewport(e)}}},onMouseUp:function(e){var t,n,i=this.graph;if(!this.keydown){var a=i.getZoom(),o=i.get("modeController"),s=(n=(t=o==null?void 0:o.modes[o.mode])===null||t===void 0?void 0:t.filter(function(A){return A.type==="zoom-canvas"}))===null||n===void 0?void 0:n[0],u=s?s.optimizeZoom||.1:0;if(this.enableOptimize){for(var l=i.getEdges(),c=0,f=l.length;c<f;c++){var d=l[c].get("group").get("children");!d||d.forEach(function(A){var I=A.get("ori-visibility");I&&A.show()})}if(a>u)for(var h=i.getNodes(),v=0,p=h.length;v<p;v++)for(var g=h[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 _=w.get("ori-visibility");_&&w.show()}}}if(!this.dragging){this.origin=null;return}e=bF(e),this.shouldEnd.call(this,e)&&this.updateViewport(e),e.type="dragend",i.emit("canvas:dragend",e),this.endDrag()}},endDrag:function(){this.origin=null,this.dragging=!1,this.dragbegin=!1},onKeyDown:function(e){var t=this,n=e.key;!n||(ove.indexOf(n.toLowerCase())>-1?t.keydown=!0:t.keydown=!1)},onKeyUp:function(){this.keydown=!1,this.origin=null,this.dragging=!1,this.dragbegin=!1}},uve={getDefaultCfg:function(){return{updateEdge:!0,delegateStyle:{},enableDelegate:!1,onlyChangeComboSize:!1,comboActiveState:"",selectedState:"selected",enableOptimize:!1,enableDebounce:!1,enableStack:!0}},getEvents:function(){return{"node:dragstart":"onDragStart","node:drag":"onDrag","node:dragend":"onDragEnd","combo:dragenter":"onDragEnter","combo:dragleave":"onDragLeave","combo:drop":"onDropCombo","node:drop":"onDropNode","canvas:drop":"onDropCanvas",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onDragEnd"}},validationCombo:function(e){if(!this.origin||!e||e.destroyed)return!1;var t=e.getType();return t==="combo"},onTouchStart:function(e){if(!!e.item){var t=this;try{var n=e.originalEvent.touches,i=n[0],a=n[1];if(i&&a)return;e.preventDefault()}catch{console.warn("Touch original event not exist!")}t.onDragStart(e)}},onTouchMove:function(e){var t=this;try{var n=e.originalEvent.touches,i=n[0],a=n[1];if(i&&a){t.onDragEnd(e);return}e.preventDefault()}catch{console.warn("Touch original event not exist!")}t.onDrag(e)},onDragStart:function(e){var t=this;if(this.currentShouldEnd=!0,!!this.shouldBegin.call(this,e)){var n=e.item;if(!(!n||n.destroyed||n.hasLocked())){var i=n.getContainer();i.set("capture",!1),this.cachedCaptureItems||(this.cachedCaptureItems=[]),this.cachedCaptureItems.push(n);var a=e.target;if(a){var o=a.get("isAnchorPoint");if(o)return}var s=this.graph;this.targets=[],this.targetCombo=null;var u=s.findAllByState("node",this.selectedState),l=n.get("id"),c=u.filter(function(d){var h=d.get("id");return l===h});c.length===0?this.targets.push(n):u.length>1?u.forEach(function(d){var h=d.hasLocked();h||t.targets.push(d)}):this.targets.push(n);var f=[];this.targets.forEach(function(d){f.push(Ur(d.getModel()))}),this.set("beforeDragNodes",f),this.hidenEdge={},this.get("updateEdge")&&this.enableOptimize&&!this.enableDelegate&&this.targets.forEach(function(d){var h=d.getEdges();h.forEach(function(v){!v.isVisible()||(t.hidenEdge[v.getID()]=!0,v.hide())})}),this.origin={x:e.x,y:e.y},this.point={},this.originPoint={}}}},onDrag:function(e){var t=this;!this.origin||!this.shouldUpdate(this,e)||(this.get("enableDelegate")?this.updateDelegate(e):this.enableDebounce?this.debounceUpdate({targets:this.targets,graph:this.graph,point:this.point,origin:this.origin,evt:e,updateEdge:this.get("updateEdge")}):this.targets.map(function(n){t.update(n,e)}))},onDragEnd:function(e){var t=this,n;if(!!this.origin){(n=this.cachedCaptureItems)===null||n===void 0||n.forEach(function(o){var s=o.getContainer();s.set("capture",!0)}),this.cachedCaptureItems=[],this.delegateRect&&(this.delegateRect.remove(),this.delegateRect=null),this.get("updateEdge")&&this.enableOptimize&&!this.enableDelegate&&this.targets.forEach(function(o){var s=o.getEdges();s.forEach(function(u){t.hidenEdge[u.getID()]&&u.show(),u.refresh()})}),this.hidenEdge={};var i=this.graph;if(i.get("enabledStack")&&this.enableStack){var a={before:{nodes:[],edges:[],combos:[]},after:{nodes:[],edges:[],combos:[]}};this.get("beforeDragNodes").forEach(function(o){a.before.nodes.push({id:o.id,x:o.x,y:o.y})}),this.targets.forEach(function(o){var s=o.getModel();a.after.nodes.push({id:s.id,x:s.x,y:s.y})}),i.pushStack("update",Ur(a))}i.emit("dragnodeend",{items:this.targets,targetItem:null}),this.point={},this.origin=null,this.originPoint={},this.targets.length=0,this.targetCombo=null}},onDropCombo:function(e){var t=e.item;if(this.currentShouldEnd=this.shouldEnd.call(this,e,t),this.updatePositions(e,!this.currentShouldEnd),!(!this.currentShouldEnd||!this.validationCombo(t))){var n=this.graph;if(this.comboActiveState&&n.setItemState(t,this.comboActiveState,!1),this.targetCombo=t,this.onlyChangeComboSize)n.updateCombos();else{var i=t.getModel();this.targets.map(function(a){var o=a.getModel();o.comboId!==i.id&&n.updateComboTree(a,i.id)}),n.updateCombo(t)}n.emit("dragnodeend",{items:this.targets,targetItem:this.targetCombo})}},onDropCanvas:function(e){var t=this.graph;this.currentShouldEnd=this.shouldEnd.call(this,e,void 0),this.updatePositions(e,!this.currentShouldEnd),!(!this.targets||this.targets.length===0||!this.currentShouldEnd)&&(this.onlyChangeComboSize?t.updateCombos():this.targets.map(function(n){var i=n.getModel();i.comboId&&t.updateComboTree(n)}))},onDropNode:function(e){if(!(!this.targets||this.targets.length===0)){var t=this,n=e.item,i=t.graph,a=n.getModel().comboId,o=a?i.findById(a):void 0;if(this.currentShouldEnd=this.shouldEnd.call(this,e,o),this.updatePositions(e,!this.currentShouldEnd),!!this.currentShouldEnd){if(this.onlyChangeComboSize)i.updateCombos();else if(a){var s=i.findById(a);t.comboActiveState&&i.setItemState(s,t.comboActiveState,!1),this.targets.map(function(u){var l=u.getModel();a!==l.comboId&&i.updateComboTree(u,a)}),i.updateCombo(s)}else this.targets.map(function(u){var l=u.getModel();l.comboId&&i.updateComboTree(u)});i.emit("dragnodeend",{items:this.targets,targetItem:n})}}},onDragEnter:function(e){var t=e.item;if(!!this.validationCombo(t)){var n=this.graph;this.comboActiveState&&n.setItemState(t,this.comboActiveState,!0)}},onDragLeave:function(e){var t=e.item;if(!!this.validationCombo(t)){var n=this.graph;this.comboActiveState&&n.setItemState(t,this.comboActiveState,!1)}},updatePositions:function(e,t){var n=this;!this.targets||this.targets.length===0||(this.get("enableDelegate")?this.enableDebounce?this.debounceUpdate({targets:this.targets,graph:this.graph,point:this.point,origin:this.origin,evt:e,updateEdge:this.get("updateEdge"),updateFunc:this.update}):t||this.targets.map(function(i){return n.update(i,e)}):this.targets.map(function(i){return n.update(i,e,t)}))},update:function(e,t,n){var i=this.origin,a=e.get("model"),o=e.get("id");this.point[o]||(this.point[o]={x:a.x||0,y:a.y||0});var s=t.x-i.x+this.point[o].x,u=t.y-i.y+this.point[o].y;n&&(s+=i.x-t.x,u+=i.y-t.y);var l={x:s,y:u};this.get("updateEdge")?this.graph.updateItem(e,l,!1):e.updatePosition(l)},debounceUpdate:gb(function(r){var e=r.targets,t=r.graph,n=r.point,i=r.origin,a=r.evt,o=r.updateEdge;r.updateFunc,e.map(function(s){var u=s.get("model"),l=s.get("id");n[l]||(n[l]={x:u.x||0,y:u.y||0});var c=a.x-i.x+n[l].x,f=a.y-i.y+n[l].y,d={x:c,y:f};o?t.updateItem(s,d,!1):s.updatePosition(d)})},50,!0),updateDelegate:function(e){var t=this.graph;if(this.delegateRect){var d=e.x-this.origin.x+this.originPoint.minX,h=e.y-this.origin.y+this.originPoint.minY;this.delegateRect.attr({x:d,y:h})}else{var n=t.get("group"),i=tn({},Zu.delegateStyle,this.delegateStyle),a=this.calculationGroupPosition(e),o=a.x,s=a.y,u=a.width,l=a.height,c=a.minX,f=a.minY;this.originPoint={x:o,y:s,width:u,height:l,minX:c,minY:f},this.delegateRect=n.addShape("rect",{attrs:P({width:u,height:l,x:o,y:s},i),name:"rect-delegate-shape"}),this.delegate=this.delegateRect,this.delegateRect.set("capture",!1)}},calculationGroupPosition:function(e){var t=this.targets;t.length===0&&t.push(e.item);for(var n=1/0,i=-1/0,a=1/0,o=-1/0,s=0;s<t.length;s++){var u=t[s],l=u.getBBox(),c=l.minX,f=l.minY,d=l.maxX,h=l.maxY;c<n&&(n=c),f<a&&(a=f),d>i&&(i=d),h>o&&(o=h)}var v=Math.floor(n),p=Math.floor(a),g=Math.ceil(i)-Math.floor(n),y=Math.ceil(o)-Math.floor(a);return{x:v,y:p,width:g,height:y,minX:n,minY:a}}},lve={getDefaultCfg:function(){return{trigger:"mouseenter",activeState:"active",inactiveState:"inactive",resetSelected:!1,shouldUpdate:function(){return!0}}},getEvents:function(){return this.get("trigger")==="mouseenter"?{"node:mouseenter":"setAllItemStates","combo:mouseenter":"setAllItemStates","node:mouseleave":"clearActiveState","combo:mouseleave":"clearActiveState"}:{"node:click":"setAllItemStates","combo:click":"setAllItemStates","canvas:click":"clearActiveState","node:touchstart":"setOnTouchStart","combo:touchstart":"setOnTouchStart","canvas:touchstart":"clearOnTouchStart"}},setOnTouchStart:function(e){var t=this;try{var n=e.originalEvent.touches,i=n[0],a=n[1];if(i&&a)return;e.preventDefault()}catch{console.warn("Touch original event not exist!")}t.setAllItemStates(e)},clearOnTouchStart:function(e){var t=this;try{var n=e.originalEvent.touches,i=n[0],a=n[1];if(i&&a)return;e.preventDefault()}catch{console.warn("Touch original event not exist!")}t.clearActiveState(e)},setAllItemStates:function(e){var t=e.item,n=this.graph;if(this.item=t,!!this.shouldUpdate(e.item,{event:e,action:"activate"})){for(var i=this,a=this.activeState,o=this.inactiveState,s=n.getNodes(),u=n.getCombos(),l=n.getEdges(),c=n.get("vedges"),f=s.length,d=u.length,h=l.length,v=c.length,p=0;p<f;p++){var g=s[p],y=g.hasState("selected");i.resetSelected&&y&&n.setItemState(g,"selected",!1),n.setItemState(g,a,!1),o&&n.setItemState(g,o,!0)}for(var p=0;p<d;p++){var m=u[p],y=m.hasState("selected");i.resetSelected&&y&&n.setItemState(m,"selected",!1),n.setItemState(m,a,!1),o&&n.setItemState(m,o,!0)}for(var p=0;p<h;p++){var b=l[p];n.setItemState(b,a,!1),o&&n.setItemState(b,o,!0)}for(var p=0;p<v;p++){var w=c[p];n.setItemState(w,a,!1),o&&n.setItemState(w,o,!0)}o&&n.setItemState(t,o,!1),n.setItemState(t,a,!0);for(var x=t.getEdges(),_=x.length,p=0;p<_;p++){var b=x[p],A=void 0;b.getSource()===t?A=b.getTarget():A=b.getSource(),o&&n.setItemState(A,o,!1),n.setItemState(A,a,!0),n.setItemState(b,o,!1),n.setItemState(b,a,!0),b.toFront()}n.emit("afteractivaterelations",{item:e.item,action:"activate"})}},clearActiveState:function(e){var t=this,n=t.get("graph");if(!!t.shouldUpdate(e.item,{event:e,action:"deactivate"})){var i=this.activeState,a=this.inactiveState,o=n.get("autoPaint");n.setAutoPaint(!1);for(var s=n.getNodes()||[],u=n.getCombos()||[],l=n.getEdges()||[],c=n.get("vedges")||[],f=s.length,d=u.length,h=l.length,v=c.length,p=0;p<f;p++){var g=s[p];n.clearItemStates(g,[i,a])}for(var p=0;p<d;p++){var y=u[p];n.clearItemStates(y,[i,a])}for(var p=0;p<h;p++){var m=l[p];n.clearItemStates(m,[i,a,"deactivate"])}for(var p=0;p<v;p++){var b=c[p];n.clearItemStates(b,[i,a,"deactivate"])}n.paint(),n.setAutoPaint(o),n.emit("afteractivaterelations",{item:e.item||t.get("item"),action:"deactivate"})}}},Ry=Math.min,_F=Math.max,SF=Math.abs,EF="shift",cve=["drag","shift","ctrl","alt","control"],fve={getDefaultCfg:function(){return{brushStyle:{fill:"#EEF6FF",fillOpacity:.4,stroke:"#DDEEFE",lineWidth:1},onSelect:function(){},onDeselect:function(){},selectedState:"selected",trigger:EF,includeEdges:!0,selectedEdges:[],selectedNodes:[]}},getEvents:function(){return cve.indexOf(this.trigger.toLowerCase())>-1||(this.trigger=EF,console.warn("Behavior brush-select \u7684 trigger \u53C2\u6570\u4E0D\u5408\u6CD5\uFF0C\u8BF7\u8F93\u5165 'drag'\u3001'shift'\u3001'ctrl' \u6216 'alt'")),this.trigger==="drag"?{dragstart:"onMouseDown",drag:"onMouseMove",dragend:"onMouseUp","canvas:click":"clearStates"}:{dragstart:"onMouseDown",drag:"onMouseMove",dragend:"onMouseUp","canvas:click":"clearStates",keyup:"onKeyUp",keydown:"onKeyDown"}},onMouseDown:function(e){var t=e.item,n=this.brush;t||this.trigger!=="drag"&&!this.keydown||(this.selectedNodes&&this.selectedNodes.length!==0&&this.clearStates(),n||(n=this.createBrush()),this.originPoint={x:e.canvasX,y:e.canvasY},n.attr({width:0,height:0}),n.show(),this.dragging=!0)},onMouseMove:function(e){!this.dragging||this.trigger!=="drag"&&!this.keydown||this.updateBrush(e)},onMouseUp:function(e){this.graph,!(!this.brush&&!this.dragging)&&(this.trigger!=="drag"&&!this.keydown||(this.brush.remove(!0),this.brush=null,this.getSelectedNodes(e),this.dragging=!1))},clearStates:function(){var e=this,t=e.graph,n=e.selectedState,i=t.findAllByState("node",n),a=t.findAllByState("edge",n);i.forEach(function(o){return t.setItemState(o,n,!1)}),a.forEach(function(o){return t.setItemState(o,n,!1)}),this.selectedNodes=[],this.selectedEdges=[],this.onDeselect&&this.onDeselect(this.selectedNodes,this.selectedEdges),t.emit("nodeselectchange",{selectedItems:{nodes:[],edges:[]},select:!1})},getSelectedNodes:function(e){var t=this,n=this,i=n.graph,a=n.originPoint,o=n.shouldUpdate,s=this.selectedState,u={x:e.x,y:e.y},l=i.getPointByCanvas(a.x,a.y),c=Ry(u.x,l.x),f=_F(u.x,l.x),d=Ry(u.y,l.y),h=_F(u.y,l.y),v=[],p=[];i.getNodes().forEach(function(y){if(!!y.isVisible()){var m=y.getBBox();if(m.centerX>=c&&m.centerX<=f&&m.centerY>=d&&m.centerY<=h&&o(y,"select")){v.push(y);var b=y.getModel();p.push(b.id),i.setItemState(y,s,!0)}}});var g=[];this.includeEdges&&v.forEach(function(y){var m=y.getOutEdges();m.forEach(function(b){if(!!b.isVisible()){var w=b.getModel(),x=w.source,_=w.target;p.includes(x)&&p.includes(_)&&o(b,"select")&&(g.push(b),i.setItemState(b,t.selectedState,!0))}})}),this.selectedEdges=g,this.selectedNodes=v,this.onSelect&&this.onSelect(v,g),i.emit("nodeselectchange",{selectedItems:{nodes:v,edges:g},select:!0})},createBrush:function(){var e=this,t=e.graph.get("canvas").addShape("rect",{attrs:e.brushStyle,capture:!1,name:"brush-shape"});return this.brush=t,this.delegate=t,t},updateBrush:function(e){var t=this.originPoint;this.brush.attr({width:SF(e.canvasX-t.x),height:SF(e.canvasY-t.y),x:Ry(e.canvasX,t.x),y:Ry(e.canvasY,t.y)})},onKeyDown:function(e){var t=e.key;if(!!t){var n=this.trigger.toLowerCase(),i=t.toLowerCase();i===n||i==="control"&&n==="ctrl"||i==="ctrl"&&n==="control"?this.keydown=!0:this.keydown=!1}},onKeyUp:function(){this.brush&&(this.brush.remove(!0),this.brush=null,this.dragging=!1),this.keydown=!1}},AF="shift",hve=["shift","ctrl","alt","control"],dve={getDefaultCfg:function(){return{multiple:!0,trigger:AF,selectedState:"selected"}},getEvents:function(){var e=this;return hve.indexOf(e.trigger.toLowerCase())>-1||(e.trigger=AF,console.warn("Behavior brush-select \u7684 trigger \u53C2\u6570\u4E0D\u5408\u6CD5\uFF0C\u8BF7\u8F93\u5165 'drag'\u3001'shift'\u3001'ctrl' \u6216 'alt'")),e.multiple?{"node:click":"onClick","combo:click":"onClick","canvas:click":"onCanvasClick",keyup:"onKeyUp",keydown:"onKeyDown"}:{"node:click":"onClick","combo:click":"onClick","canvas:click":"onCanvasClick"}},onClick:function(e){var t=this,n=e.item;if(!(!n||n.destroyed)){n.getType();var i=t.graph,a=t.keydown,o=t.multiple,s=t.shouldUpdate,u=t.shouldBegin;if(!!u.call(t,e)){if(!a||!o){var l=i.findAllByState("node",t.selectedState).concat(i.findAllByState("combo",t.selectedState));xe(l,function(d){d!==n&&i.setItemState(d,t.selectedState,!1)})}if(n.hasState(t.selectedState)){s.call(t,e)&&i.setItemState(n,t.selectedState,!1);var c=i.findAllByState("node",t.selectedState),f=i.findAllByState("combo",t.selectedState);i.emit("nodeselectchange",{target:n,selectedItems:{nodes:c,combos:f},select:!1})}else{s.call(t,e)&&i.setItemState(n,t.selectedState,!0);var c=i.findAllByState("node",t.selectedState),f=i.findAllByState("combo",t.selectedState);i.emit("nodeselectchange",{target:n,selectedItems:{nodes:c,combos:f},select:!0})}}}},onCanvasClick:function(){var e=this,t=this.graph,n=t.findAllByState("node",this.selectedState);xe(n,function(a){t.setItemState(a,e.selectedState,!1)});var i=t.findAllByState("combo",this.selectedState);xe(i,function(a){t.setItemState(a,e.selectedState,!1)}),t.emit("nodeselectchange",{selectedItems:{nodes:[],edges:[],combos:[]},select:!1})},onKeyDown:function(e){var t=this,n=e.key;!n||(n.toLowerCase()===this.trigger.toLowerCase()||n.toLowerCase()==="control"?t.keydown=!0:t.keydown=!1)},onKeyUp:function(){var e=this;e.keydown=!1}},vve=Up,TF=.05,pve={getDefaultCfg:function(){return{sensitivity:2,minZoom:void 0,maxZoom:void 0,enableOptimize:!1,optimizeZoom:.1,fixSelectedItems:{fixAll:!1,fixLineWidth:!1,fixLabel:!1,fixState:"selected"}}},getEvents:function(){var e=this.fixSelectedItems;return e.fixState||(e.fixState="selected"),e.fixAll&&(e.fixLineWidth=!0,e.fixLabel=!0),{wheel:"onWheel",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd"}},onTouchStart:function(e){var t=e.originalEvent.touches,n=t[0],i=t[1];e.preventDefault(),!!i&&(this.shouldBegin&&!this.shouldBegin.call(this,e)||(this.startPoint={pageX:n.pageX,pageY:n.pageY},this.moveable=!0,i&&(this.endPoint={pageX:i.pageX,pageY:i.pageY}),this.originScale=this.graph.getZoom()||this.currentScale||1))},onTouchMove:function(e){if(!!this.moveable){e.preventDefault();var t=e.originalEvent.touches,n=t[0],i=t[1];if(!!i){this.endPoint||(this.endPoint={pageX:i.pageX,pageY:i.pageY});var a=function(h,v){return Math.hypot(v.x-h.x,v.y-h.y)},o=a({x:n.pageX,y:n.pageY},{x:i.pageX,y:i.pageY})/a({x:this.startPoint.pageX,y:this.startPoint.pageY},{x:this.endPoint.pageX,y:this.endPoint.pageY}),s=this.originScale*o;this.currentScale=s;var u=this.get("minZoom")||this.graph.get("minZoom"),l=this.get("maxZoom")||this.graph.get("maxZoom");if(!(s>l||s<u)){var c=this.graph.get("canvas"),f=c.getPointByClient(e.clientX,e.clientY);this.graph.zoomTo(s,{x:f.x,y:f.y}),this.graph.emit("wheelzoom",e)}}}},onTouchEnd:function(){this.moveable=!1,this.endPoint=null},onWheel:function(e){var t=this,n=this,i=n.graph,a=n.fixSelectedItems;if(!(this.shouldBegin&&!this.shouldBegin.call(this,e))&&!!this.shouldUpdate.call(this,e)){e.preventDefault();var o=i.get("canvas"),s=o.getPointByClient(e.clientX,e.clientY),u=this.get("sensitivity"),l=i.getZoom(),c=l,f=l;e.wheelDelta<0?c=1-TF*u:c=1/(1-TF*u),f=l*c;var d=this.get("minZoom")||i.get("minZoom"),h=this.get("maxZoom")||i.get("maxZoom");if(!(f>h||f<d)){var v=this.get("enableOptimize");if(v){var p=this.get("optimizeZoom"),g=this.get("optimized"),y=i.getNodes(),m=i.getEdges(),b=y.length,w=m.length;if(!g){for(var x=0;x<b;x++){var _=y[x];if(!_.destroyed)for(var A=_.get("group").get("children"),I=A.length,M=0;M<I;M++){var S=A[M];!S.destoryed&&!S.get("isKeyShape")&&(S.set("ori-visibility",S.get("ori-visibility")||S.get("visible")),S.hide())}}for(var C=0;C<w;C++)for(var T=m[C],A=T.get("group").get("children"),I=A.length,M=0;M<I;M++){var S=A[M];S.set("ori-visibility",S.get("ori-visibility")||S.get("visible")),S.hide()}this.set("optimized",!0)}clearTimeout(this.get("timeout"));var k=setTimeout(function(){var Ye=i.getZoom(),pt=t.get("optimized");if(pt){t.set("optimized",!1);for(var ht=0;ht<b;ht++){var dt=y[ht],D=dt.get("group").get("children"),V=D.length;if(Ye<p){var he=dt.getKeyShape(),ye=he.get("ori-visibility");ye&&he.show()}else for(var Se=0;Se<V;Se++){var De=D[Se],ye=De.get("ori-visibility");!De.get("visible")&&ye&&ye&&De.show()}}for(var At=0;At<w;At++){var ut=m[At],D=ut.get("group").get("children"),V=D.length;if(Ye<p){var he=ut.getKeyShape(),ye=he.get("ori-visibility");ye&&he.show()}else for(var Se=0;Se<V;Se++){var De=D[Se];if(!De.get("visible")){var ye=De.get("ori-visibility");ye&&De.show()}}}}},100);this.set("timeout",k)}if(l<=1){var L=void 0,B=void 0;if(a.fixAll||a.fixLineWidth||a.fixLabel){L=i.findAllByState("node",a.fixState),B=i.findAllByState("edge",a.fixState);for(var ee=l/f,K=L.length,z=0;z<K;z++){var _=L[z],X=_.getContainer(),H=_.getModel(),J=_.getOriginStyle(),ne=_.getStateStyle(a.fixState),me=_.get("shapeFactory").getShape(H.type).getStateStyle(a.fixState,_)[a.fixState];if(a.fixAll){if(f<=1){var oe=Ur(X.getMatrix());oe||(oe=[1,0,0,0,1,0,0,0,1]);var Ae=_.getModel(),ze=Ae.x,qe=Ae.y;oe=vve(oe,[["t",-ze,-qe],["s",ee,ee],["t",ze,qe]]),X.setMatrix(oe)}}else for(var A=X.get("children"),I=A.length,M=0;M<I;M++){var S=A[M],ft=void 0,ct=void 0;if(a.fixLabel){var st=S.get("type");if(st==="text"){ft=S.attr("fontSize")||12;var gr=ne[S.get("name")],tr=me[S.get("name")],$=gr?gr.fontSize:12,se=tr?tr.fontSize:12,W=$||se||12;if(f<=1&&S.attr("fontSize",W/f),ct)break}}if(a.fixLineWidth&&S.get("isKeyShape")){ct=S.attr("lineWidth")||0;var Ze=ne.lineWidth||me.lineWidth||J.lineWidth||0;if(f<=1&&S.attr("lineWidth",Ze/f),ft)break}}}for(var yt=B.length,at=0;at<yt;at++)for(var T=B[at],X=T.getContainer(),A=X.get("children"),H=T.getModel(),ne=T.getStateStyle(a.fixState),me=T.get("shapeFactory").getShape(H.type).getStateStyle(a.fixState,T)[a.fixState],I=A.length,M=0;M<I;M++){var S=A[M],ft=void 0,ct=void 0;if(a.fixLabel||a.fixAll){var st=S.get("type");if(st==="text"){ft=S.attr("fontSize")||12;var gr=ne[S.get("name")],tr=me[S.get("name")],$=gr?gr.fontSize:12,se=tr?tr.fontSize:12,W=$||se||12;if(f<=1&&S.attr("fontSize",W/f),ct)break}}if((a.fixLineWidth||a.fixAll)&&S.get("isKeyShape")){ct=S.attr("lineWidth")||0;var Ze=ne.lineWidth||me.lineWidth||1;if(f<=1&&S.attr("lineWidth",Ze/f),ft)break}}}}i.zoomTo(f,{x:s.x,y:s.y}),i.emit("wheelzoom",e)}}}},IF={onMouseEnter:function(e){var t=e.item;this.currentTarget=t,this.showTooltip(e),this.graph.emit("tooltipchange",{item:e.item,action:"show"})},onMouseMove:function(e){if(!this.shouldUpdate(e)){this.hideTooltip();return}!this.currentTarget||e.item!==this.currentTarget||this.updatePosition(e)},onMouseLeave:function(e){!this.shouldEnd(e)||(this.hideTooltip(),this.graph.emit("tooltipchange",{item:this.currentTarget,action:"hide"}),this.currentTarget=null)},showTooltip:function(e){var t=this.container;if(!(!e.item||e.item.destroyed)){t||(t=this.createTooltip(this.graph.get("canvas")),this.container=t);var n=this.formatText(e.item.get("model"),e);t.innerHTML=n,jr(this.container,{visibility:"visible"}),this.updatePosition(e)}},hideTooltip:function(){jr(this.container,{visibility:"hidden"})},updatePosition:function(e){var t=this.get("shouldBegin"),n=this,i=n.width,a=n.height,o=n.container,s=n.graph;if(!t(e)){jr(o,{visibility:"hidden"});return}var u=s.getPointByClient(e.clientX,e.clientY),l=s.getCanvasByPoint(u.x,u.y),c=l.x,f=l.y,d=o.getBoundingClientRect();c>i/2?c-=d.width:c+=this.offset,f>a/2?f-=d.height:f+=this.offset;var h=c+"px",v=f+"px";jr(this.container,{left:h,top:v,visibility:"visible"})},createTooltip:function(e){var t=e.get("el");t.style.position="relative";var n=An('<div class="g6-tooltip g6-'+this.item+'-tooltip"></div>');return t.parentNode.appendChild(n),jr(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}},gve=P({getDefaultCfg:function(){return{item:"node",offset:12,formatText:function(t){return t.label}}},getEvents:function(){return{"node:mouseenter":"onMouseEnter","node:mouseleave":"onMouseLeave","node:mousemove":"onMouseMove",afterremoveitem:"onMouseLeave"}}},IF),yve=P({getDefaultCfg:function(){return{item:"edge",offset:12,formatText:function(t){return"source: "+t.source+" target: "+t.target}}},getEvents:function(){return{"edge:mouseenter":"onMouseEnter","edge:mouseleave":"onMouseLeave","edge:mousemove":"onMouseMove",afterremoveitem:"onMouseLeave"}}},IF),CF="click",mve=["click","dblclick"],bve={getDefaultCfg:function(){return{trigger:CF,onChange:function(){}}},getEvents:function(){var e,t;return mve.includes(this.trigger)?t=this.trigger:(t=CF,console.warn("Behavior collapse-expand \u7684 trigger \u53C2\u6570\u4E0D\u5408\u6CD5\uFF0C\u8BF7\u8F93\u5165 'click' \u6216 'dblclick'")),e={},e["node:"+t]="onNodeClick",e.touchstart="onNodeClick",e},onNodeClick:function(e){var t=e.item;if(!!t){var n=this.graph.findDataById(t.get("id"));if(!!n){var i=n.children;if(!(!i||i.length===0)){var a=!n.collapsed;!this.shouldBegin(e,a)||(n.collapsed=a,t.getModel().collapsed=a,this.graph.emit("itemcollapsed",{item:e.item,collapsed:a}),!!this.shouldUpdate(e,a)&&(this.onChange(t,a),this.graph.layout()))}}}}},wve=as.calculationItemsBBox,xve=function r(e,t){if(t(e)!==!1&&e){var n=e.get("combos");if(n.length===0)return!1;xe(n,function(i){r(i,t)})}},_ve={getDefaultCfg:function(){return{enableDelegate:!1,delegateStyle:{},onlyChangeComboSize:!1,activeState:"",selectedState:"selected"}},getEvents:function(){return{"combo:dragstart":"onDragStart","combo:drag":"onDrag","combo:dragend":"onDragEnd","combo:drop":"onDrop","node:drop":"onNodeDrop","combo:dragenter":"onDragEnter","combo:dragleave":"onDragLeave"}},validationCombo:function(e){var t=e.item;if(!t||t.destroyed||!this.shouldUpdate(this,e))return!1;var n=t.getType();return n==="combo"},onDragStart:function(e){var t=this,n=this.graph,i=e.item;if(this.currentShouldEnd=!0,!!this.validationCombo(e)){this.targets=[];var a=n.findAllByState("combo",this.selectedState),o=i.get("id"),s=a.filter(function(u){var l=u.get("id");return o===l});s.length===0?this.targets.push(i):this.targets=a,this.activeState&&this.targets.map(function(u){var l=u.getModel();if(l.parentId){var c=n.findById(l.parentId);c&&n.setItemState(c,t.activeState,!0)}}),this.point={},this.originPoint={},this.origin={x:e.x,y:e.y},this.currentItemChildCombos=[],xve(i,function(u){if(u.destroyed)return!1;var l=u.getModel();return t.currentItemChildCombos.push(l.id),!0})}},onDrag:function(e){var t=this;if(!!this.origin&&!!this.validationCombo(e))if(this.enableDelegate)this.updateDelegate(e);else{if(this.activeState){var n=this.graph,i=e.item,a=i.getModel(),o=n.getCombos(),s=i.getBBox(),u=s.centerX,l=s.centerY,c=s.width,f=o.filter(function(d){var h=d.getModel();return a.parentId,h.id!==a.id&&!t.currentItemChildCombos.includes(h.id)});f.map(function(d){var h=d.getBBox(),v=h.centerX,p=h.centerY,g=h.width,y=u-v,m=l-p,b=2*Math.sqrt(y*y+m*m);c+g-b>.8*c?n.setItemState(d,t.activeState,!0):n.setItemState(d,t.activeState,!1)})}xe(this.targets,function(d){t.updateCombo(d,e)})}},updatePositions:function(e,t){var n=this;(this.enableDelegate||t)&&xe(this.targets,function(i){n.updateCombo(i,e,t)})},onDrop:function(e){var t=this,n=e.item;if(this.currentShouldEnd=this.shouldEnd.call(this,e,n),this.updatePositions(e,!this.currentShouldEnd),!(!this.currentShouldEnd||!n||!this.targets||n.destroyed)){var i=this.graph,a=n.getModel();this.targets.map(function(o){var s=o.getModel();s.parentId!==a.id?(t.activeState&&i.setItemState(n,t.activeState,!1),t.onlyChangeComboSize?i.updateCombo(o):i.updateComboTree(o,a.id)):i.updateCombo(n)}),this.end(n,e),this.endComparison=!0}},onNodeDrop:function(e){var t=this;if(!(!this.targets||this.targets.length===0)){var n=this.graph,i=e.item,a=i.getModel().comboId,o=a?n.findById(a):void 0;if(this.currentShouldEnd=this.shouldEnd.call(this,e,o),this.updatePositions(e,!this.currentShouldEnd),!!this.currentShouldEnd){var s;if(a){if(this.activeState){var u=n.findById(a);n.setItemState(u,this.activeState,!1)}this.targets.map(function(l){t.onlyChangeComboSize?n.updateCombo(l):a!==l.getID()&&(s=n.findById(a),a!==l.getModel().parentId&&n.updateComboTree(l,a))})}else this.targets.map(function(l){if(t.onlyChangeComboSize)n.updateCombo(l);else{var c=l.getModel();c.comboId&&n.updateComboTree(l)}});this.endComparison=!0,this.end(s,e)}}},onDragEnter:function(e){if(!!this.origin&&!!this.validationCombo(e)){var t=e.item,n=this.graph;this.activeState&&n.setItemState(t,this.activeState,!0)}},onDragLeave:function(e){if(!!this.origin&&!!this.validationCombo(e)){var t=e.item,n=this.graph;this.activeState&&n.setItemState(t,this.activeState,!1)}},onDragEnd:function(e){if(!(!this.targets||this.targets.length===0)){var t=e.item;this.currentShouldEnd&&this.updatePositions(e);var n=this.getParentCombo(t.getModel().parentId),i=this.graph;n&&this.activeState&&i.setItemState(n,this.activeState,!1),this.end(void 0,e)}},end:function(e,t){var n=this;if(!!this.origin){var i=this.graph;if(this.delegateShape){var a=i.get("delegateGroup");a.clear(),this.delegateShape=null}e&&this.activeState&&i.setItemState(e,this.activeState,!1),e||this.targets.map(function(o){n.onlyChangeComboSize?i.updateCombo(o):i.updateComboTree(o)}),this.point=[],this.origin=null,this.originPoint=null,this.targets.length=0}},traverse:function(e,t){var n=this;if(t(e)!==!1&&e){var i=e.get("combos");xe(i,function(o){n.traverse(o,t)});var a=e.get("nodes");xe(a,function(o){n.traverse(o,t)})}},updateCombo:function(e,t,n){var i=this;this.traverse(e,function(a){return a.destroyed?!1:(i.updateSignleItem(a,t,n),!0)})},updateSignleItem:function(e,t,n){var i=this.origin,a=this.graph,o=e.getModel(),s=e.get("id");this.point[s]||(this.point[s]={x:o.x,y:o.y});var u=t.x-i.x+this.point[s].x,l=t.y-i.y+this.point[s].y;n&&(u+=i.x-t.x,l+=i.y-t.y),a.updateItem(e,{x:u,y:l})},getParentCombo:function(e){var t=this.graph;if(!!e){var n=t.findById(e);if(!!n)return n}},updateDelegate:function(e){var t=this.graph;if(this.delegateShape){var d=e.x-this.origin.x+this.originPoint.minX,h=e.y-this.origin.y+this.originPoint.minY;this.delegateShape.attr({x:d,y:h})}else{var n=t.get("delegateGroup"),i=null;this.targets.length>1?i=wve(this.targets):i=this.targets[0].getBBox();var a=i.x,o=i.y,s=i.width,u=i.height,l=i.minX,c=i.minY;this.originPoint={x:a,y:o,width:s,height:u,minX:l,minY:c};var f=P(P({},Zu.delegateStyle),this.delegateStyle);this.delegateShape=n.addShape("rect",{attrs:P({width:i.width,height:i.height,x:i.x,y:i.y},f),name:"combo-delegate-shape"}),this.delegateShape.set("capture",!1),this.delegate=this.delegateShape}}},MF="dblclick",Sve=["click","dblclick"],Eve={getDefaultCfg:function(){return{trigger:MF,relayout:!0}},getEvents:function(){var e,t;return Sve.includes(this.trigger)?t=this.trigger:(t=MF,console.warn("Behavior collapse-expand-group \u7684 trigger \u53C2\u6570\u4E0D\u5408\u6CD5\uFF0C\u8BF7\u8F93\u5165 'click' \u6216 'dblclick'")),e={},e["combo:"+t]="onComboClick",e},onComboClick:function(e){var t=e.item,n=this,i=n.graph,a=n.relayout;if(!(!t||t.destroyed||t.getType()!=="combo")){var o=t.getModel(),s=o.id;!s||(i.collapseExpandCombo(s),a&&i.get("layout")?i.layout():i.refreshPositions())}}},Ave=as.isPolygonsIntersect,Tve=as.pathToPoints,kF="shift",Ive=["drag","shift","ctrl","alt","control"],Cve=function(e,t){var n,i=e.getKeyShape();if(e.get("type")==="path")n=Tve(i.attr("path"));else{var a=i.getCanvasBBox();n=[[a.minX,a.minY],[a.maxX,a.minY],[a.maxX,a.maxY],[a.minX,a.maxY]]}return Ave(t,n)},Mve={getDefaultCfg:function(){return{delegateStyle:{fill:"#EEF6FF",fillOpacity:.4,stroke:"#DDEEFE",lineWidth:1},onSelect:function(){},onDeselect:function(){},selectedState:"selected",trigger:kF,includeEdges:!0,selectedEdges:[],selectedNodes:[]}},getEvents:function(){return Ive.indexOf(this.trigger.toLowerCase())>-1||(this.trigger=kF,console.warn("Behavior lasso-select \u7684 trigger \u53C2\u6570\u4E0D\u5408\u6CD5\uFF0C\u8BF7\u8F93\u5165 'drag'\u3001'shift'\u3001'ctrl' \u6216 'alt'")),this.trigger==="drag"?{dragstart:"onDragStart",drag:"onDragMove",dragend:"onDragEnd","canvas:click":"clearStates"}:{dragstart:"onDragStart",drag:"onDragMove",dragend:"onDragEnd",keyup:"onKeyUp",keydown:"onKeyDown","canvas:click":"clearStates"}},onDragStart:function(e){var t=this.lasso,n=e.item;n||this.trigger!=="drag"&&!this.keydown||(this.selectedNodes&&this.selectedNodes.length!==0&&this.clearStates(),t||(t=this.createLasso()),this.dragging=!0,this.originPoint={x:e.x,y:e.y},this.points.push(this.originPoint),t.show())},onDragMove:function(e){!this.dragging||this.trigger!=="drag"&&!this.keydown||(this.points.push({x:e.x,y:e.y}),this.updateLasso(e))},onDragEnd:function(e){!this.lasso&&!this.dragging||this.trigger!=="drag"&&!this.keydown||(this.points.push(this.originPoint),this.getSelectedItems(),this.lasso.remove(!0),this.lasso=null,this.points=[],this.dragging=!1)},getLassoPath:function(){var e=this.points,t=[];return e.length&&(e.forEach(function(n,i){i===0?t.push(["M",n.x,n.y]):t.push(["L",n.x,n.y])}),t.push(["L",e[0].x,e[0].y])),t},clearStates:function(){var e=this,t=e.graph,n=e.selectedState,i=t.findAllByState("node",n),a=t.findAllByState("edge",n);i.forEach(function(o){return t.setItemState(o,n,!1)}),a.forEach(function(o){return t.setItemState(o,n,!1)}),this.onDeselect&&this.onDeselect(this.selectedNodes,this.selectedEdges),this.selectedNodes=[],this.selectedEdges=[],t.emit("nodeselectchange",{selectedItems:{nodes:[],edges:[]},select:!1})},getSelectedItems:function(){var e=this,t=this,n=t.graph,i=t.shouldUpdate,a=this.points.map(function(c){return[n.getCanvasByPoint(c.x,c.y).x,n.getCanvasByPoint(c.x,c.y).y]}),o=this.selectedState,s=[],u=[];n.getNodes().forEach(function(c){if(!!c.isVisible()&&Cve(c,a)&&i(c,"select")){s.push(c);var f=c.getModel();u.push(f.id),n.setItemState(c,o,!0)}});var l=[];this.includeEdges&&s.forEach(function(c){var f=c.getOutEdges();f.forEach(function(d){if(!!d.isVisible()){var h=d.getModel(),v=h.source,p=h.target;u.includes(v)&&u.includes(p)&&i(d,"select")&&(l.push(d),n.setItemState(d,e.selectedState,!0))}})}),this.selectedEdges=l,this.selectedNodes=s,this.onSelect&&this.onSelect(s,l),n.emit("nodeselectchange",{selectedItems:{nodes:s,edges:l},select:!0})},createLasso:function(){var e=this,t=e.graph.get("delegateGroup").addShape("path",{attrs:P({path:[]},e.delegateStyle),capture:!1,name:"lasso-shape"});return this.lasso=t,this.delegate=t,this.points=[],t},updateLasso:function(e){var t=this;this.lasso.attr({path:t.getLassoPath()})},onKeyDown:function(e){var t=e.key;!t||(t.toLowerCase()===this.trigger.toLowerCase()?this.keydown=!0:this.keydown=!1)},onKeyUp:function(){this.lasso&&(this.lasso.remove(!0),this.lasso=null,this.points=[],this.dragging=!1),this.keydown=!1}},DF="click",kve=["click","drag"],LF=void 0,Dve=["shift","ctrl","control","alt","meta",void 0],Lve={getDefaultCfg:function(){return{trigger:DF,key:LF,edgeConfig:{},getEdgeConfig:void 0}},getEvents:function(){var e=this;kve.indexOf(e.trigger.toLowerCase())>-1||(e.trigger=DF,console.warn("Behavior create-edge \u7684 trigger \u53C2\u6570\u4E0D\u5408\u6CD5\uFF0C\u8BF7\u8F93\u5165 'click'\uFF0C'drag'")),e.key&&Dve.indexOf(e.key.toLowerCase())===-1&&(e.trigger=LF,console.warn("Behavior create-edge \u7684 key \u53C2\u6570\u4E0D\u5408\u6CD5\uFF0C\u8BF7\u8F93\u5165 'shift'\uFF0C'ctrl'\uFF0C'alt'\uFF0C'control'\uFF0C\u6216 undefined"));var t;return e.trigger==="drag"?t={"node:dragstart":"onClick","combo:dragstart":"onClick",drag:"updateEndPoint","node:drop":"onClick","combo:drop":"onClick",dragend:"onDragEnd"}:e.trigger==="click"&&(t={"node:click":"onClick",mousemove:"updateEndPoint","edge:click":"cancelCreating","canvas:click":"cancelCreating","combo:click":"onClick"}),e.key&&(t.keydown="onKeyDown",t.keyup="onKeyUp"),t},onDragEnd:function(e){var t=this;if(!(t.key&&!t.keydown)){var n=e.item;(!n||n.getID()===t.source||n.getType()!=="node")&&t.cancelCreating({item:t.edge,x:e.x,y:e.y})}},onClick:function(e){var t=this;if(!(t.key&&!t.keydown)){var n=e.item,i=t.graph,a=n.getModel(),o=t.getEdgeConfig;if(t.addingEdge&&t.edge){if(!t.shouldEnd.call(t,e))return;var s=void 0;o&&on(o)?s=o({source:t.source,target:a.id}):s=t.edgeConfig;var u=P({target:a.id},s);if(t.source===a.id&&(u.type="loop"),i.emit("beforecreateedge",{}),i.updateItem(t.edge,u,!1),i.get("enabledStack")){var l=P(P({},t.edge.getModel()),{itemType:"edge"}),c={};c.edges=[l],i.pushStack("add",{before:{},after:c})}i.emit("aftercreateedge",{edge:t.edge}),t.edge.getKeyShape().set("capture",!0),t.edge=null,t.addingEdge=!1}else{if(!t.shouldBegin.call(t,e))return;var s=void 0;o&&on(o)?s=o({source:a.id,target:a.id}):s=t.edgeConfig,t.edge=i.addItem("edge",P({source:a.id,target:a.id},s),!1),t.source=a.id,t.addingEdge=!0,t.edge.getKeyShape().set("capture",!1)}}},updateEndPoint:function(e){var t=this;if(!(t.key&&!t.keydown)){var n={x:e.x,y:e.y};if(!t.graph.findById(t.source)){t.addingEdge=!1;return}t.addingEdge&&t.edge&&t.graph.updateItem(t.edge,{target:n},!1)}},cancelCreating:function(e){var t=this;if(!(t.key&&!t.keydown)){var n=t.graph,i=e.item;if(t.addingEdge&&e.target&&e.target.isCanvas&&e.target.isCanvas()){n.removeItem(t.edge,!1),t.edge=null,t.addingEdge=!1;return}t.addingEdge&&t.edge===i&&(n.removeItem(t.edge,!1),t.edge=null,t.addingEdge=!1)}},onKeyDown:function(e){var t=this,n=e.key;!n||(n.toLowerCase()===t.key.toLowerCase()?t.keydown=!0:t.keydown=!1)},onKeyUp:function(){var e=this;e.addingEdge&&e.edge&&(e.graph.removeItem(e.edge,!1),e.addingEdge=!1,e.edge=null),this.keydown=!1}},NF="ctrl",Nve=["shift","ctrl","alt","control"],Ove="1",Pve={getDefaultCfg:function(){return{trigger:NF,combinedKey:Ove,functionName:"fitView",functionParams:[]}},getEvents:function(){return Nve.indexOf(this.trigger.toLowerCase())>-1||(this.trigger=NF,console.warn("Behavior shortcuts-fit-view \u7684 trigger \u53C2\u6570 '"+this.trigger+"' \u4E0D\u5408\u6CD5\uFF0C\u8BF7\u8F93\u5165 'drag'\u3001'shift'\u3001'ctrl' \u6216 'alt'")),this.combinedKey===this.trigger&&(this.combinedKey=void 0),{keyup:"onKeyUp",keydown:"onKeyDown"}},onKeyDown:function(e){var t=e.key;if(!!t){var n=this.trigger.toLowerCase(),i=t.toLowerCase();this.triggerKeydown||(i===n||i==="control"&&n==="ctrl"||i==="ctrl"&&n==="control"?this.triggerKeydown=!0:this.triggerKeydown=!1);var a=this.graph;if(!a[this.functionName])return console.warn("Behavior shortcuts-fit-view \u7684 functionName \u53C2\u6570 '"+this.functionName+"' \u4E0D\u5408\u6CD5\uFF0C\u5B83\u4E0D\u662F Graph \u7684\u4E00\u4E2A\u51FD\u6570\u540D"),{};if(this.triggerKeydown&&!this.combinedKey){this.functionParams&&this.functionParams.length?a[this.functionName].apply(a,this.functionParams):a[this.functionName]();return}var o=this.combinedKey.toLowerCase();this.triggerKeydown&&(i===o||i==="control"&&o==="ctrl"||i==="ctrl"&&o==="control")&&(this.functionParams&&this.functionParams.length?a[this.functionName].apply(a,this.functionParams):a[this.functionName]())}},onKeyUp:function(){this.brush&&(this.brush.remove(!0),this.brush=null,this.dragging=!1),this.triggerKeydown=!1}},Rve=["shift","ctrl","alt","control"],Bve={getDefaultCfg:function(){return{direction:"both",enableOptimize:!1,zoomKey:"ctrl",scalableRange:0}},getEvents:function(){return(!this.zoomKey||Rve.indexOf(this.zoomKey)===-1)&&(this.zoomKey="ctrl"),{wheel:"onWheel"}},onWheel:function(e){var t=this,n=this.graph,i=e[this.zoomKey+"Key"];if(this.zoomKey==="control"&&(i=e.ctrlKey),i){var a=n.get("canvas"),o=a.getPointByClient(e.clientX,e.clientY),s=n.getZoom();e.wheelDelta>0?s=s+s*.05:s=s-s*.05,n.zoomTo(s,{x:o.x,y:o.y})}else{var u=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"),f=this.graph.get("height"),d=this.graph.get("canvas").getCanvasBBox(),h=this.scalableRange,v=this.scalableRange;h<1&&h>-1&&(h=c*h,v=f*v);var p=d.minX,g=d.maxX,y=d.minY,m=d.maxY;u>0?g<-h?u=0:g-u<-h&&(u=g+h):u<0&&(p>c+h?u=0:p-u>c+h&&(u=p-(c+h))),l>0?m<-v?l=0:m-l<-v&&(l=m+v):l<0&&(y>f+v?l=0:y-l>f+v&&(l=y-(f+v))),this.get("direction")==="x"?l=0:this.get("direction")==="y"&&(u=0),n.translate(-u,-l)}e.preventDefault();var b=this.get("enableOptimize");if(b){var w=this.get("optimizeZoom"),x=this.get("optimized"),_=n.getNodes(),A=n.getEdges(),I=_.length,M=A.length;if(!x){for(var S=0;S<I;S++){var C=_[S];if(!C.destroyed)for(var T=C.get("group").get("children"),k=T.length,L=0;L<k;L++){var B=T[L];!B.destoryed&&!B.get("isKeyShape")&&(B.set("ori-visibility",B.get("ori-visibility")||B.get("visible")),B.hide())}}for(var ee=0;ee<M;ee++)for(var K=A[ee],T=K.get("group").get("children"),k=T.length,L=0;L<k;L++){var B=T[L];B.set("ori-visibility",B.get("ori-visibility")||B.get("visible")),B.hide()}this.set("optimized",!0)}clearTimeout(this.get("timeout"));var z=setTimeout(function(){var X=n.getZoom(),H=t.get("optimized");if(H){t.set("optimized",!1);for(var J=0;J<I;J++){var ne=_[J],me=ne.get("group").get("children"),oe=me.length;if(X<w){var Ae=ne.getKeyShape(),ze=Ae.get("ori-visibility");ze&&Ae.show()}else for(var qe=0;qe<oe;qe++){var ft=me[qe],ze=ft.get("ori-visibility");!ft.get("visible")&&ze&&ze&&ft.show()}}for(var ct=0;ct<M;ct++){var st=A[ct],me=st.get("group").get("children"),oe=me.length;if(X<w){var Ae=st.getKeyShape(),ze=Ae.get("ori-visibility");ze&&Ae.show()}else for(var qe=0;qe<oe;qe++){var ft=me[qe];if(!ft.get("visible")){var ze=ft.get("ori-visibility");ze&&ft.show()}}}}},100);this.set("timeout",z)}}},Fve={"drag-canvas":sve,"zoom-canvas":pve,"drag-node":uve,"activate-relations":lve,"brush-select":fve,"click-select":dve,"lasso-select":Mve,tooltip:gve,"edge-tooltip":yve,"collapse-expand":bve,"drag-combo":_ve,"collapse-expand-combo":Eve,"create-edge":Lve,"shortcuts-call":Pve,"scroll-canvas":Bve};xe(Fve,function(r,e){yM(e,r)});var Uve=P(P({},FW),Uq);Hn.Grid;Hn.Minimap;Hn.Bundling;Hn.Menu;var Gve=Hn.Fisheye;Hn.ToolBar;Hn.Tooltip;var zve=Hn.TimeBar,$ve=Hn.ImageMinimap,Vve=Hn.EdgeFilterLens,jve=Hn.SnapLine;Hn.Legend;var Wve={version:Zu.version,Graph:p3,TreeGraph:ofe,Util:as,Layout:hx,TreeLayout:Yce,registerLayout:Hce,Global:Zu,registerBehavior:yM,registerCombo:DH,registerEdge:gM,registerNode:Wo,Minimap:Hn.Minimap,Grid:Hn.Grid,Bundling:Hn.Bundling,Menu:Hn.Menu,ToolBar:Hn.ToolBar,Tooltip:Hn.Tooltip,Legend:Hn.Legend,TimeBar:zve,SnapLine:jve,Fisheye:Gve,ImageMinimap:$ve,EdgeFilterLens:Vve,Algorithm:Uve,Arrow:EH,Marker:AH,Shape:hn};Wve.version="4.3.11";export{Wve as G,SA as S,EA as t};
