@typicalday/firegraph 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/editor/client/assets/index-B1nKCPMa.js +411 -0
- package/dist/editor/client/assets/index-CJJR5qe5.css +1 -0
- package/dist/editor/client/index.html +2 -2
- package/dist/editor/server/index.mjs +642 -304
- package/package.json +1 -1
- package/dist/editor/client/assets/index-DJJ_b0jI.js +0 -411
- package/dist/editor/client/assets/index-Q0QBYrMV.css +0 -1
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
var q5=Object.defineProperty;var F1=t=>{throw TypeError(t)};var I5=(t,e,a)=>e in t?q5(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a;var jp=(t,e,a)=>I5(t,typeof e!="symbol"?e+"":e,a),Ap=(t,e,a)=>e.has(t)||F1("Cannot "+a);var Z=(t,e,a)=>(Ap(t,e,"read from private field"),a?a.call(t):e.get(t)),_e=(t,e,a)=>e.has(t)?F1("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,a),Me=(t,e,a,r)=>(Ap(t,e,"write to private field"),r?r.call(t,a):e.set(t,a),a),rt=(t,e,a)=>(Ap(t,e,"access private method"),a);var Qd=(t,e,a,r)=>({set _(i){Me(t,e,i,a)},get _(){return Z(t,e,r)}});function V5(t,e){for(var a=0;a<e.length;a++){const r=e[a];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in t)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function a(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=a(i);fetch(i.href,s)}})();function AE(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Mp={exports:{}},Au={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var H1;function F5(){if(H1)return Au;H1=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function a(r,i,s){var o=null;if(s!==void 0&&(o=""+s),i.key!==void 0&&(o=""+i.key),"key"in i){s={};for(var u in i)u!=="key"&&(s[u]=i[u])}else s=i;return i=s.ref,{$$typeof:t,type:r,key:o,ref:i!==void 0?i:null,props:s}}return Au.Fragment=e,Au.jsx=a,Au.jsxs=a,Au}var G1;function H5(){return G1||(G1=1,Mp.exports=F5()),Mp.exports}var g=H5(),Dp={exports:{}},lt={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react.production.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var Q1;function G5(){if(Q1)return lt;Q1=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),o=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),m=Symbol.iterator;function y(k){return k===null||typeof k!="object"?null:(k=m&&k[m]||k["@@iterator"],typeof k=="function"?k:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,S={};function T(k,G,X){this.props=k,this.context=G,this.refs=S,this.updater=X||x}T.prototype.isReactComponent={},T.prototype.setState=function(k,G){if(typeof k!="object"&&typeof k!="function"&&k!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,k,G,"setState")},T.prototype.forceUpdate=function(k){this.updater.enqueueForceUpdate(this,k,"forceUpdate")};function C(){}C.prototype=T.prototype;function N(k,G,X){this.props=k,this.context=G,this.refs=S,this.updater=X||x}var A=N.prototype=new C;A.constructor=N,E(A,T.prototype),A.isPureReactComponent=!0;var M=Array.isArray;function D(){}var j={H:null,A:null,T:null,S:null},R=Object.prototype.hasOwnProperty;function L(k,G,X){var W=X.ref;return{$$typeof:t,type:k,key:G,ref:W!==void 0?W:null,props:X}}function z(k,G){return L(k.type,G,k.props)}function _(k){return typeof k=="object"&&k!==null&&k.$$typeof===t}function B(k){var G={"=":"=0",":":"=2"};return"$"+k.replace(/[=:]/g,function(X){return G[X]})}var q=/\/+/g;function V(k,G){return typeof k=="object"&&k!==null&&k.key!=null?B(""+k.key):G.toString(36)}function Q(k){switch(k.status){case"fulfilled":return k.value;case"rejected":throw k.reason;default:switch(typeof k.status=="string"?k.then(D,D):(k.status="pending",k.then(function(G){k.status==="pending"&&(k.status="fulfilled",k.value=G)},function(G){k.status==="pending"&&(k.status="rejected",k.reason=G)})),k.status){case"fulfilled":return k.value;case"rejected":throw k.reason}}throw k}function P(k,G,X,W,$){var ee=typeof k;(ee==="undefined"||ee==="boolean")&&(k=null);var ie=!1;if(k===null)ie=!0;else switch(ee){case"bigint":case"string":case"number":ie=!0;break;case"object":switch(k.$$typeof){case t:case e:ie=!0;break;case h:return ie=k._init,P(ie(k._payload),G,X,W,$)}}if(ie)return $=$(k),ie=W===""?"."+V(k,0):W,M($)?(X="",ie!=null&&(X=ie.replace(q,"$&/")+"/"),P($,G,X,"",function(ae){return ae})):$!=null&&(_($)&&($=z($,X+($.key==null||k&&k.key===$.key?"":(""+$.key).replace(q,"$&/")+"/")+ie)),G.push($)),1;ie=0;var he=W===""?".":W+":";if(M(k))for(var oe=0;oe<k.length;oe++)W=k[oe],ee=he+V(W,oe),ie+=P(W,G,X,ee,$);else if(oe=y(k),typeof oe=="function")for(k=oe.call(k),oe=0;!(W=k.next()).done;)W=W.value,ee=he+V(W,oe++),ie+=P(W,G,X,ee,$);else if(ee==="object"){if(typeof k.then=="function")return P(Q(k),G,X,W,$);throw G=String(k),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(k).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.")}return ie}function U(k,G,X){if(k==null)return k;var W=[],$=0;return P(k,W,"","",function(ee){return G.call(X,ee,$++)}),W}function F(k){if(k._status===-1){var G=k._result;G=G(),G.then(function(X){(k._status===0||k._status===-1)&&(k._status=1,k._result=X)},function(X){(k._status===0||k._status===-1)&&(k._status=2,k._result=X)}),k._status===-1&&(k._status=0,k._result=G)}if(k._status===1)return k._result.default;throw k._result}var K=typeof reportError=="function"?reportError:function(k){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var G=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof k=="object"&&k!==null&&typeof k.message=="string"?String(k.message):String(k),error:k});if(!window.dispatchEvent(G))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",k);return}console.error(k)},J={map:U,forEach:function(k,G,X){U(k,function(){G.apply(this,arguments)},X)},count:function(k){var G=0;return U(k,function(){G++}),G},toArray:function(k){return U(k,function(G){return G})||[]},only:function(k){if(!_(k))throw Error("React.Children.only expected to receive a single React element child.");return k}};return lt.Activity=p,lt.Children=J,lt.Component=T,lt.Fragment=a,lt.Profiler=i,lt.PureComponent=N,lt.StrictMode=r,lt.Suspense=d,lt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=j,lt.__COMPILER_RUNTIME={__proto__:null,c:function(k){return j.H.useMemoCache(k)}},lt.cache=function(k){return function(){return k.apply(null,arguments)}},lt.cacheSignal=function(){return null},lt.cloneElement=function(k,G,X){if(k==null)throw Error("The argument must be a React element, but you passed "+k+".");var W=E({},k.props),$=k.key;if(G!=null)for(ee in G.key!==void 0&&($=""+G.key),G)!R.call(G,ee)||ee==="key"||ee==="__self"||ee==="__source"||ee==="ref"&&G.ref===void 0||(W[ee]=G[ee]);var ee=arguments.length-2;if(ee===1)W.children=X;else if(1<ee){for(var ie=Array(ee),he=0;he<ee;he++)ie[he]=arguments[he+2];W.children=ie}return L(k.type,$,W)},lt.createContext=function(k){return k={$$typeof:o,_currentValue:k,_currentValue2:k,_threadCount:0,Provider:null,Consumer:null},k.Provider=k,k.Consumer={$$typeof:s,_context:k},k},lt.createElement=function(k,G,X){var W,$={},ee=null;if(G!=null)for(W in G.key!==void 0&&(ee=""+G.key),G)R.call(G,W)&&W!=="key"&&W!=="__self"&&W!=="__source"&&($[W]=G[W]);var ie=arguments.length-2;if(ie===1)$.children=X;else if(1<ie){for(var he=Array(ie),oe=0;oe<ie;oe++)he[oe]=arguments[oe+2];$.children=he}if(k&&k.defaultProps)for(W in ie=k.defaultProps,ie)$[W]===void 0&&($[W]=ie[W]);return L(k,ee,$)},lt.createRef=function(){return{current:null}},lt.forwardRef=function(k){return{$$typeof:u,render:k}},lt.isValidElement=_,lt.lazy=function(k){return{$$typeof:h,_payload:{_status:-1,_result:k},_init:F}},lt.memo=function(k,G){return{$$typeof:f,type:k,compare:G===void 0?null:G}},lt.startTransition=function(k){var G=j.T,X={};j.T=X;try{var W=k(),$=j.S;$!==null&&$(X,W),typeof W=="object"&&W!==null&&typeof W.then=="function"&&W.then(D,K)}catch(ee){K(ee)}finally{G!==null&&X.types!==null&&(G.types=X.types),j.T=G}},lt.unstable_useCacheRefresh=function(){return j.H.useCacheRefresh()},lt.use=function(k){return j.H.use(k)},lt.useActionState=function(k,G,X){return j.H.useActionState(k,G,X)},lt.useCallback=function(k,G){return j.H.useCallback(k,G)},lt.useContext=function(k){return j.H.useContext(k)},lt.useDebugValue=function(){},lt.useDeferredValue=function(k,G){return j.H.useDeferredValue(k,G)},lt.useEffect=function(k,G){return j.H.useEffect(k,G)},lt.useEffectEvent=function(k){return j.H.useEffectEvent(k)},lt.useId=function(){return j.H.useId()},lt.useImperativeHandle=function(k,G,X){return j.H.useImperativeHandle(k,G,X)},lt.useInsertionEffect=function(k,G){return j.H.useInsertionEffect(k,G)},lt.useLayoutEffect=function(k,G){return j.H.useLayoutEffect(k,G)},lt.useMemo=function(k,G){return j.H.useMemo(k,G)},lt.useOptimistic=function(k,G){return j.H.useOptimistic(k,G)},lt.useReducer=function(k,G,X){return j.H.useReducer(k,G,X)},lt.useRef=function(k){return j.H.useRef(k)},lt.useState=function(k){return j.H.useState(k)},lt.useSyncExternalStore=function(k,G,X){return j.H.useSyncExternalStore(k,G,X)},lt.useTransition=function(){return j.H.useTransition()},lt.version="19.2.4",lt}var Y1;function v0(){return Y1||(Y1=1,Dp.exports=G5()),Dp.exports}var I=v0();const ME=AE(I),DE=V5({__proto__:null,default:ME},[I]);var Op={exports:{}},Mu={},Rp={exports:{}},kp={};/**
|
|
18
|
+
* @license React
|
|
19
|
+
* scheduler.production.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/var K1;function Q5(){return K1||(K1=1,(function(t){function e(P,U){var F=P.length;P.push(U);e:for(;0<F;){var K=F-1>>>1,J=P[K];if(0<i(J,U))P[K]=U,P[F]=J,F=K;else break e}}function a(P){return P.length===0?null:P[0]}function r(P){if(P.length===0)return null;var U=P[0],F=P.pop();if(F!==U){P[0]=F;e:for(var K=0,J=P.length,k=J>>>1;K<k;){var G=2*(K+1)-1,X=P[G],W=G+1,$=P[W];if(0>i(X,F))W<J&&0>i($,X)?(P[K]=$,P[W]=F,K=W):(P[K]=X,P[G]=F,K=G);else if(W<J&&0>i($,F))P[K]=$,P[W]=F,K=W;else break e}}return U}function i(P,U){var F=P.sortIndex-U.sortIndex;return F!==0?F:P.id-U.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,u=o.now();t.unstable_now=function(){return o.now()-u}}var d=[],f=[],h=1,p=null,m=3,y=!1,x=!1,E=!1,S=!1,T=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function A(P){for(var U=a(f);U!==null;){if(U.callback===null)r(f);else if(U.startTime<=P)r(f),U.sortIndex=U.expirationTime,e(d,U);else break;U=a(f)}}function M(P){if(E=!1,A(P),!x)if(a(d)!==null)x=!0,D||(D=!0,B());else{var U=a(f);U!==null&&Q(M,U.startTime-P)}}var D=!1,j=-1,R=5,L=-1;function z(){return S?!0:!(t.unstable_now()-L<R)}function _(){if(S=!1,D){var P=t.unstable_now();L=P;var U=!0;try{e:{x=!1,E&&(E=!1,C(j),j=-1),y=!0;var F=m;try{t:{for(A(P),p=a(d);p!==null&&!(p.expirationTime>P&&z());){var K=p.callback;if(typeof K=="function"){p.callback=null,m=p.priorityLevel;var J=K(p.expirationTime<=P);if(P=t.unstable_now(),typeof J=="function"){p.callback=J,A(P),U=!0;break t}p===a(d)&&r(d),A(P)}else r(d);p=a(d)}if(p!==null)U=!0;else{var k=a(f);k!==null&&Q(M,k.startTime-P),U=!1}}break e}finally{p=null,m=F,y=!1}U=void 0}}finally{U?B():D=!1}}}var B;if(typeof N=="function")B=function(){N(_)};else if(typeof MessageChannel<"u"){var q=new MessageChannel,V=q.port2;q.port1.onmessage=_,B=function(){V.postMessage(null)}}else B=function(){T(_,0)};function Q(P,U){j=T(function(){P(t.unstable_now())},U)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(P){P.callback=null},t.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<P?Math.floor(1e3/P):5},t.unstable_getCurrentPriorityLevel=function(){return m},t.unstable_next=function(P){switch(m){case 1:case 2:case 3:var U=3;break;default:U=m}var F=m;m=U;try{return P()}finally{m=F}},t.unstable_requestPaint=function(){S=!0},t.unstable_runWithPriority=function(P,U){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var F=m;m=P;try{return U()}finally{m=F}},t.unstable_scheduleCallback=function(P,U,F){var K=t.unstable_now();switch(typeof F=="object"&&F!==null?(F=F.delay,F=typeof F=="number"&&0<F?K+F:K):F=K,P){case 1:var J=-1;break;case 2:J=250;break;case 5:J=1073741823;break;case 4:J=1e4;break;default:J=5e3}return J=F+J,P={id:h++,callback:U,priorityLevel:P,startTime:F,expirationTime:J,sortIndex:-1},F>K?(P.sortIndex=F,e(f,P),a(d)===null&&P===a(f)&&(E?(C(j),j=-1):E=!0,Q(M,F-K))):(P.sortIndex=J,e(d,P),x||y||(x=!0,D||(D=!0,B()))),P},t.unstable_shouldYield=z,t.unstable_wrapCallback=function(P){var U=m;return function(){var F=m;m=U;try{return P.apply(this,arguments)}finally{m=F}}}})(kp)),kp}var $1;function Y5(){return $1||($1=1,Rp.exports=Q5()),Rp.exports}var Bp={exports:{}},Ya={};/**
|
|
26
|
+
* @license React
|
|
27
|
+
* react-dom.production.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/var X1;function K5(){if(X1)return Ya;X1=1;var t=v0();function e(d){var f="https://react.dev/errors/"+d;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)f+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+d+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(){}var r={d:{f:a,r:function(){throw Error(e(522))},D:a,C:a,L:a,m:a,X:a,S:a,M:a},p:0,findDOMNode:null},i=Symbol.for("react.portal");function s(d,f,h){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:p==null?null:""+p,children:d,containerInfo:f,implementation:h}}var o=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(d,f){if(d==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return Ya.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Ya.createPortal=function(d,f){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(e(299));return s(d,f,null,h)},Ya.flushSync=function(d){var f=o.T,h=r.p;try{if(o.T=null,r.p=2,d)return d()}finally{o.T=f,r.p=h,r.d.f()}},Ya.preconnect=function(d,f){typeof d=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,r.d.C(d,f))},Ya.prefetchDNS=function(d){typeof d=="string"&&r.d.D(d)},Ya.preinit=function(d,f){if(typeof d=="string"&&f&&typeof f.as=="string"){var h=f.as,p=u(h,f.crossOrigin),m=typeof f.integrity=="string"?f.integrity:void 0,y=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;h==="style"?r.d.S(d,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:p,integrity:m,fetchPriority:y}):h==="script"&&r.d.X(d,{crossOrigin:p,integrity:m,fetchPriority:y,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},Ya.preinitModule=function(d,f){if(typeof d=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var h=u(f.as,f.crossOrigin);r.d.M(d,{crossOrigin:h,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&r.d.M(d)},Ya.preload=function(d,f){if(typeof d=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var h=f.as,p=u(h,f.crossOrigin);r.d.L(d,h,{crossOrigin:p,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},Ya.preloadModule=function(d,f){if(typeof d=="string")if(f){var h=u(f.as,f.crossOrigin);r.d.m(d,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:h,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else r.d.m(d)},Ya.requestFormReset=function(d){r.d.r(d)},Ya.unstable_batchedUpdates=function(d,f){return d(f)},Ya.useFormState=function(d,f,h){return o.H.useFormState(d,f,h)},Ya.useFormStatus=function(){return o.H.useHostTransitionStatus()},Ya.version="19.2.4",Ya}var Z1;function OE(){if(Z1)return Bp.exports;Z1=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Bp.exports=K5(),Bp.exports}/**
|
|
34
|
+
* @license React
|
|
35
|
+
* react-dom-client.production.js
|
|
36
|
+
*
|
|
37
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the MIT license found in the
|
|
40
|
+
* LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/var W1;function $5(){if(W1)return Mu;W1=1;var t=Y5(),e=v0(),a=OE();function r(n){var l="https://react.dev/errors/"+n;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)l+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+n+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function s(n){var l=n,c=n;if(n.alternate)for(;l.return;)l=l.return;else{n=l;do l=n,(l.flags&4098)!==0&&(c=l.return),n=l.return;while(n)}return l.tag===3?c:null}function o(n){if(n.tag===13){var l=n.memoizedState;if(l===null&&(n=n.alternate,n!==null&&(l=n.memoizedState)),l!==null)return l.dehydrated}return null}function u(n){if(n.tag===31){var l=n.memoizedState;if(l===null&&(n=n.alternate,n!==null&&(l=n.memoizedState)),l!==null)return l.dehydrated}return null}function d(n){if(s(n)!==n)throw Error(r(188))}function f(n){var l=n.alternate;if(!l){if(l=s(n),l===null)throw Error(r(188));return l!==n?null:n}for(var c=n,v=l;;){var b=c.return;if(b===null)break;var w=b.alternate;if(w===null){if(v=b.return,v!==null){c=v;continue}break}if(b.child===w.child){for(w=b.child;w;){if(w===c)return d(b),n;if(w===v)return d(b),l;w=w.sibling}throw Error(r(188))}if(c.return!==v.return)c=b,v=w;else{for(var O=!1,H=b.child;H;){if(H===c){O=!0,c=b,v=w;break}if(H===v){O=!0,v=b,c=w;break}H=H.sibling}if(!O){for(H=w.child;H;){if(H===c){O=!0,c=w,v=b;break}if(H===v){O=!0,v=w,c=b;break}H=H.sibling}if(!O)throw Error(r(189))}}if(c.alternate!==v)throw Error(r(190))}if(c.tag!==3)throw Error(r(188));return c.stateNode.current===c?n:l}function h(n){var l=n.tag;if(l===5||l===26||l===27||l===6)return n;for(n=n.child;n!==null;){if(l=h(n),l!==null)return l;n=n.sibling}return null}var p=Object.assign,m=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),N=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),L=Symbol.for("react.activity"),z=Symbol.for("react.memo_cache_sentinel"),_=Symbol.iterator;function B(n){return n===null||typeof n!="object"?null:(n=_&&n[_]||n["@@iterator"],typeof n=="function"?n:null)}var q=Symbol.for("react.client.reference");function V(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===q?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case E:return"Fragment";case T:return"Profiler";case S:return"StrictMode";case M:return"Suspense";case D:return"SuspenseList";case L:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case x:return"Portal";case N:return n.displayName||"Context";case C:return(n._context.displayName||"Context")+".Consumer";case A:var l=n.render;return n=n.displayName,n||(n=l.displayName||l.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case j:return l=n.displayName||null,l!==null?l:V(n.type)||"Memo";case R:l=n._payload,n=n._init;try{return V(n(l))}catch{}}return null}var Q=Array.isArray,P=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F={pending:!1,data:null,method:null,action:null},K=[],J=-1;function k(n){return{current:n}}function G(n){0>J||(n.current=K[J],K[J]=null,J--)}function X(n,l){J++,K[J]=n.current,n.current=l}var W=k(null),$=k(null),ee=k(null),ie=k(null);function he(n,l){switch(X(ee,l),X($,n),X(W,null),l.nodeType){case 9:case 11:n=(n=l.documentElement)&&(n=n.namespaceURI)?f1(n):0;break;default:if(n=l.tagName,l=l.namespaceURI)l=f1(l),n=h1(l,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}G(W),X(W,n)}function oe(){G(W),G($),G(ee)}function ae(n){n.memoizedState!==null&&X(ie,n);var l=W.current,c=h1(l,n.type);l!==c&&(X($,n),X(W,c))}function re(n){$.current===n&&(G(W),G($)),ie.current===n&&(G(ie),Tu._currentValue=F)}var le,se;function Ne(n){if(le===void 0)try{throw Error()}catch(c){var l=c.stack.trim().match(/\n( *(at )?)/);le=l&&l[1]||"",se=-1<c.stack.indexOf(`
|
|
42
|
+
at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
+
`+le+n+se}var Ae=!1;function We(n,l){if(!n||Ae)return"";Ae=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var v={DetermineComponentFrameRoot:function(){try{if(l){var Ce=function(){throw Error()};if(Object.defineProperty(Ce.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ce,[])}catch(ye){var ve=ye}Reflect.construct(n,[],Ce)}else{try{Ce.call()}catch(ye){ve=ye}n.call(Ce.prototype)}}else{try{throw Error()}catch(ye){ve=ye}(Ce=n())&&typeof Ce.catch=="function"&&Ce.catch(function(){})}}catch(ye){if(ye&&ve&&typeof ye.stack=="string")return[ye.stack,ve.stack]}return[null,null]}};v.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var b=Object.getOwnPropertyDescriptor(v.DetermineComponentFrameRoot,"name");b&&b.configurable&&Object.defineProperty(v.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var w=v.DetermineComponentFrameRoot(),O=w[0],H=w[1];if(O&&H){var te=O.split(`
|
|
44
|
+
`),fe=H.split(`
|
|
45
|
+
`);for(b=v=0;v<te.length&&!te[v].includes("DetermineComponentFrameRoot");)v++;for(;b<fe.length&&!fe[b].includes("DetermineComponentFrameRoot");)b++;if(v===te.length||b===fe.length)for(v=te.length-1,b=fe.length-1;1<=v&&0<=b&&te[v]!==fe[b];)b--;for(;1<=v&&0<=b;v--,b--)if(te[v]!==fe[b]){if(v!==1||b!==1)do if(v--,b--,0>b||te[v]!==fe[b]){var be=`
|
|
46
|
+
`+te[v].replace(" at new "," at ");return n.displayName&&be.includes("<anonymous>")&&(be=be.replace("<anonymous>",n.displayName)),be}while(1<=v&&0<=b);break}}}finally{Ae=!1,Error.prepareStackTrace=c}return(c=n?n.displayName||n.name:"")?Ne(c):""}function He(n,l){switch(n.tag){case 26:case 27:case 5:return Ne(n.type);case 16:return Ne("Lazy");case 13:return n.child!==l&&l!==null?Ne("Suspense Fallback"):Ne("Suspense");case 19:return Ne("SuspenseList");case 0:case 15:return We(n.type,!1);case 11:return We(n.type.render,!1);case 1:return We(n.type,!0);case 31:return Ne("Activity");default:return""}}function Se(n){try{var l="",c=null;do l+=He(n,c),c=n,n=n.return;while(n);return l}catch(v){return`
|
|
47
|
+
Error generating stack: `+v.message+`
|
|
48
|
+
`+v.stack}}var ke=Object.prototype.hasOwnProperty,De=t.unstable_scheduleCallback,Be=t.unstable_cancelCallback,Ge=t.unstable_shouldYield,Je=t.unstable_requestPaint,Re=t.unstable_now,nt=t.unstable_getCurrentPriorityLevel,xe=t.unstable_ImmediatePriority,pe=t.unstable_UserBlockingPriority,Ye=t.unstable_NormalPriority,tt=t.unstable_LowPriority,Ke=t.unstable_IdlePriority,Ue=t.log,we=t.unstable_setDisableYieldValue,Y=null,ce=null;function me(n){if(typeof Ue=="function"&&we(n),ce&&typeof ce.setStrictMode=="function")try{ce.setStrictMode(Y,n)}catch{}}var ge=Math.clz32?Math.clz32:je,Ee=Math.log,Pe=Math.LN2;function je(n){return n>>>=0,n===0?32:31-(Ee(n)/Pe|0)|0}var Fe=256,ze=262144,$e=4194304;function it(n){var l=n&42;if(l!==0)return l;switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function st(n,l,c){var v=n.pendingLanes;if(v===0)return 0;var b=0,w=n.suspendedLanes,O=n.pingedLanes;n=n.warmLanes;var H=v&134217727;return H!==0?(v=H&~w,v!==0?b=it(v):(O&=H,O!==0?b=it(O):c||(c=H&~n,c!==0&&(b=it(c))))):(H=v&~w,H!==0?b=it(H):O!==0?b=it(O):c||(c=v&~n,c!==0&&(b=it(c)))),b===0?0:l!==0&&l!==b&&(l&w)===0&&(w=b&-b,c=l&-l,w>=c||w===32&&(c&4194048)!==0)?l:b}function Ie(n,l){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&l)===0}function dt(n,l){switch(n){case 1:case 2:case 4:case 8:case 64:return l+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ut(){var n=$e;return $e<<=1,($e&62914560)===0&&($e=4194304),n}function Yt(n){for(var l=[],c=0;31>c;c++)l.push(n);return l}function Rt(n,l){n.pendingLanes|=l,l!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function Ba(n,l,c,v,b,w){var O=n.pendingLanes;n.pendingLanes=c,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=c,n.entangledLanes&=c,n.errorRecoveryDisabledLanes&=c,n.shellSuspendCounter=0;var H=n.entanglements,te=n.expirationTimes,fe=n.hiddenUpdates;for(c=O&~c;0<c;){var be=31-ge(c),Ce=1<<be;H[be]=0,te[be]=-1;var ve=fe[be];if(ve!==null)for(fe[be]=null,be=0;be<ve.length;be++){var ye=ve[be];ye!==null&&(ye.lane&=-536870913)}c&=~Ce}v!==0&&Kt(n,v,0),w!==0&&b===0&&n.tag!==0&&(n.suspendedLanes|=w&~(O&~l))}function Kt(n,l,c){n.pendingLanes|=l,n.suspendedLanes&=~l;var v=31-ge(l);n.entangledLanes|=l,n.entanglements[v]=n.entanglements[v]|1073741824|c&261930}function ia(n,l){var c=n.entangledLanes|=l;for(n=n.entanglements;c;){var v=31-ge(c),b=1<<v;b&l|n[v]&l&&(n[v]|=l),c&=~b}}function Wt(n,l){var c=l&-l;return c=(c&42)!==0?1:sa(c),(c&(n.suspendedLanes|l))!==0?0:c}function sa(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function Or(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function $t(){var n=U.p;return n!==0?n:(n=window.event,n===void 0?32:z1(n.type))}function Rr(n,l){var c=U.p;try{return U.p=n,l()}finally{U.p=c}}var Ta=Math.random().toString(36).slice(2),Ht="__reactFiber$"+Ta,ya="__reactProps$"+Ta,sr="__reactContainer$"+Ta,Ca="__reactEvents$"+Ta,Na="__reactListeners$"+Ta,Ga="__reactHandles$"+Ta,ai="__reactResources$"+Ta,ja="__reactMarker$"+Ta;function ul(n){delete n[Ht],delete n[ya],delete n[Ca],delete n[Na],delete n[Ga]}function ri(n){var l=n[Ht];if(l)return l;for(var c=n.parentNode;c;){if(l=c[sr]||c[Ht]){if(c=l.alternate,l.child!==null||c!==null&&c.child!==null)for(n=b1(n);n!==null;){if(c=n[Ht])return c;n=b1(n)}return l}n=c,c=n.parentNode}return null}function ni(n){if(n=n[Ht]||n[sr]){var l=n.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return n}return null}function vs(n){var l=n.tag;if(l===5||l===26||l===27||l===6)return n.stateNode;throw Error(r(33))}function ii(n){var l=n[ai];return l||(l=n[ai]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function da(n){n[ja]=!0}var Rc=new Set,kc={};function xr(n,l){ln(n,l),ln(n+"Capture",l)}function ln(n,l){for(kc[n]=l,n=0;n<l.length;n++)Rc.add(l[n])}var cl=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Uo={},qo={};function xh(n){return ke.call(qo,n)?!0:ke.call(Uo,n)?!1:cl.test(n)?qo[n]=!0:(Uo[n]=!0,!1)}function Qa(n,l,c){if(xh(l))if(c===null)n.removeAttribute(l);else{switch(typeof c){case"undefined":case"function":case"symbol":n.removeAttribute(l);return;case"boolean":var v=l.toLowerCase().slice(0,5);if(v!=="data-"&&v!=="aria-"){n.removeAttribute(l);return}}n.setAttribute(l,""+c)}}function si(n,l,c){if(c===null)n.removeAttribute(l);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(l);return}n.setAttribute(l,""+c)}}function kr(n,l,c,v){if(v===null)n.removeAttribute(c);else{switch(typeof v){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(c);return}n.setAttributeNS(l,c,""+v)}}function Aa(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function lr(n){var l=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function bh(n,l,c){var v=Object.getOwnPropertyDescriptor(n.constructor.prototype,l);if(!n.hasOwnProperty(l)&&typeof v<"u"&&typeof v.get=="function"&&typeof v.set=="function"){var b=v.get,w=v.set;return Object.defineProperty(n,l,{configurable:!0,get:function(){return b.call(this)},set:function(O){c=""+O,w.call(this,O)}}),Object.defineProperty(n,l,{enumerable:v.enumerable}),{getValue:function(){return c},setValue:function(O){c=""+O},stopTracking:function(){n._valueTracker=null,delete n[l]}}}}function Bc(n){if(!n._valueTracker){var l=lr(n)?"checked":"value";n._valueTracker=bh(n,l,""+n[l])}}function Lc(n){if(!n)return!1;var l=n._valueTracker;if(!l)return!0;var c=l.getValue(),v="";return n&&(v=lr(n)?n.checked?"true":"false":n.value),n=v,n!==c?(l.setValue(n),!0):!1}function zc(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var BN=/[\n"\\]/g;function Br(n){return n.replace(BN,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function wh(n,l,c,v,b,w,O,H){n.name="",O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?n.type=O:n.removeAttribute("type"),l!=null?O==="number"?(l===0&&n.value===""||n.value!=l)&&(n.value=""+Aa(l)):n.value!==""+Aa(l)&&(n.value=""+Aa(l)):O!=="submit"&&O!=="reset"||n.removeAttribute("value"),l!=null?Sh(n,O,Aa(l)):c!=null?Sh(n,O,Aa(c)):v!=null&&n.removeAttribute("value"),b==null&&w!=null&&(n.defaultChecked=!!w),b!=null&&(n.checked=b&&typeof b!="function"&&typeof b!="symbol"),H!=null&&typeof H!="function"&&typeof H!="symbol"&&typeof H!="boolean"?n.name=""+Aa(H):n.removeAttribute("name")}function sy(n,l,c,v,b,w,O,H){if(w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(n.type=w),l!=null||c!=null){if(!(w!=="submit"&&w!=="reset"||l!=null)){Bc(n);return}c=c!=null?""+Aa(c):"",l=l!=null?""+Aa(l):c,H||l===n.value||(n.value=l),n.defaultValue=l}v=v??b,v=typeof v!="function"&&typeof v!="symbol"&&!!v,n.checked=H?n.checked:!!v,n.defaultChecked=!!v,O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"&&(n.name=O),Bc(n)}function Sh(n,l,c){l==="number"&&zc(n.ownerDocument)===n||n.defaultValue===""+c||(n.defaultValue=""+c)}function dl(n,l,c,v){if(n=n.options,l){l={};for(var b=0;b<c.length;b++)l["$"+c[b]]=!0;for(c=0;c<n.length;c++)b=l.hasOwnProperty("$"+n[c].value),n[c].selected!==b&&(n[c].selected=b),b&&v&&(n[c].defaultSelected=!0)}else{for(c=""+Aa(c),l=null,b=0;b<n.length;b++){if(n[b].value===c){n[b].selected=!0,v&&(n[b].defaultSelected=!0);return}l!==null||n[b].disabled||(l=n[b])}l!==null&&(l.selected=!0)}}function ly(n,l,c){if(l!=null&&(l=""+Aa(l),l!==n.value&&(n.value=l),c==null)){n.defaultValue!==l&&(n.defaultValue=l);return}n.defaultValue=c!=null?""+Aa(c):""}function oy(n,l,c,v){if(l==null){if(v!=null){if(c!=null)throw Error(r(92));if(Q(v)){if(1<v.length)throw Error(r(93));v=v[0]}c=v}c==null&&(c=""),l=c}c=Aa(l),n.defaultValue=c,v=n.textContent,v===c&&v!==""&&v!==null&&(n.value=v),Bc(n)}function fl(n,l){if(l){var c=n.firstChild;if(c&&c===n.lastChild&&c.nodeType===3){c.nodeValue=l;return}}n.textContent=l}var LN=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function uy(n,l,c){var v=l.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?v?n.setProperty(l,""):l==="float"?n.cssFloat="":n[l]="":v?n.setProperty(l,c):typeof c!="number"||c===0||LN.has(l)?l==="float"?n.cssFloat=c:n[l]=(""+c).trim():n[l]=c+"px"}function cy(n,l,c){if(l!=null&&typeof l!="object")throw Error(r(62));if(n=n.style,c!=null){for(var v in c)!c.hasOwnProperty(v)||l!=null&&l.hasOwnProperty(v)||(v.indexOf("--")===0?n.setProperty(v,""):v==="float"?n.cssFloat="":n[v]="");for(var b in l)v=l[b],l.hasOwnProperty(b)&&c[b]!==v&&uy(n,b,v)}else for(var w in l)l.hasOwnProperty(w)&&uy(n,w,l[w])}function Eh(n){if(n.indexOf("-")===-1)return!1;switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var zN=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),PN=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Pc(n){return PN.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function Tn(){}var Th=null;function Ch(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var hl=null,vl=null;function dy(n){var l=ni(n);if(l&&(n=l.stateNode)){var c=n[ya]||null;e:switch(n=l.stateNode,l.type){case"input":if(wh(n,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),l=c.name,c.type==="radio"&&l!=null){for(c=n;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+Br(""+l)+'"][type="radio"]'),l=0;l<c.length;l++){var v=c[l];if(v!==n&&v.form===n.form){var b=v[ya]||null;if(!b)throw Error(r(90));wh(v,b.value,b.defaultValue,b.defaultValue,b.checked,b.defaultChecked,b.type,b.name)}}for(l=0;l<c.length;l++)v=c[l],v.form===n.form&&Lc(v)}break e;case"textarea":ly(n,c.value,c.defaultValue);break e;case"select":l=c.value,l!=null&&dl(n,!!c.multiple,l,!1)}}}var Nh=!1;function fy(n,l,c){if(Nh)return n(l,c);Nh=!0;try{var v=n(l);return v}finally{if(Nh=!1,(hl!==null||vl!==null)&&(Td(),hl&&(l=hl,n=vl,vl=hl=null,dy(l),n)))for(l=0;l<n.length;l++)dy(n[l])}}function Io(n,l){var c=n.stateNode;if(c===null)return null;var v=c[ya]||null;if(v===null)return null;c=v[l];e:switch(l){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(v=!v.disabled)||(n=n.type,v=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!v;break e;default:n=!1}if(n)return null;if(c&&typeof c!="function")throw Error(r(231,l,typeof c));return c}var Cn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),jh=!1;if(Cn)try{var Vo={};Object.defineProperty(Vo,"passive",{get:function(){jh=!0}}),window.addEventListener("test",Vo,Vo),window.removeEventListener("test",Vo,Vo)}catch{jh=!1}var li=null,Ah=null,_c=null;function hy(){if(_c)return _c;var n,l=Ah,c=l.length,v,b="value"in li?li.value:li.textContent,w=b.length;for(n=0;n<c&&l[n]===b[n];n++);var O=c-n;for(v=1;v<=O&&l[c-v]===b[w-v];v++);return _c=b.slice(n,1<v?1-v:void 0)}function Uc(n){var l=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&l===13&&(n=13)):n=l,n===10&&(n=13),32<=n||n===13?n:0}function qc(){return!0}function vy(){return!1}function or(n){function l(c,v,b,w,O){this._reactName=c,this._targetInst=b,this.type=v,this.nativeEvent=w,this.target=O,this.currentTarget=null;for(var H in n)n.hasOwnProperty(H)&&(c=n[H],this[H]=c?c(w):w[H]);return this.isDefaultPrevented=(w.defaultPrevented!=null?w.defaultPrevented:w.returnValue===!1)?qc:vy,this.isPropagationStopped=vy,this}return p(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=qc)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=qc)},persist:function(){},isPersistent:qc}),l}var ps={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ic=or(ps),Fo=p({},ps,{view:0,detail:0}),_N=or(Fo),Mh,Dh,Ho,Vc=p({},Fo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Rh,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==Ho&&(Ho&&n.type==="mousemove"?(Mh=n.screenX-Ho.screenX,Dh=n.screenY-Ho.screenY):Dh=Mh=0,Ho=n),Mh)},movementY:function(n){return"movementY"in n?n.movementY:Dh}}),py=or(Vc),UN=p({},Vc,{dataTransfer:0}),qN=or(UN),IN=p({},Fo,{relatedTarget:0}),Oh=or(IN),VN=p({},ps,{animationName:0,elapsedTime:0,pseudoElement:0}),FN=or(VN),HN=p({},ps,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),GN=or(HN),QN=p({},ps,{data:0}),gy=or(QN),YN={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},KN={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},$N={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function XN(n){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(n):(n=$N[n])?!!l[n]:!1}function Rh(){return XN}var ZN=p({},Fo,{key:function(n){if(n.key){var l=YN[n.key]||n.key;if(l!=="Unidentified")return l}return n.type==="keypress"?(n=Uc(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?KN[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Rh,charCode:function(n){return n.type==="keypress"?Uc(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?Uc(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),WN=or(ZN),JN=p({},Vc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),my=or(JN),ej=p({},Fo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Rh}),tj=or(ej),aj=p({},ps,{propertyName:0,elapsedTime:0,pseudoElement:0}),rj=or(aj),nj=p({},Vc,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),ij=or(nj),sj=p({},ps,{newState:0,oldState:0}),lj=or(sj),oj=[9,13,27,32],kh=Cn&&"CompositionEvent"in window,Go=null;Cn&&"documentMode"in document&&(Go=document.documentMode);var uj=Cn&&"TextEvent"in window&&!Go,yy=Cn&&(!kh||Go&&8<Go&&11>=Go),xy=" ",by=!1;function wy(n,l){switch(n){case"keyup":return oj.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Sy(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var pl=!1;function cj(n,l){switch(n){case"compositionend":return Sy(l);case"keypress":return l.which!==32?null:(by=!0,xy);case"textInput":return n=l.data,n===xy&&by?null:n;default:return null}}function dj(n,l){if(pl)return n==="compositionend"||!kh&&wy(n,l)?(n=hy(),_c=Ah=li=null,pl=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return yy&&l.locale!=="ko"?null:l.data;default:return null}}var fj={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Ey(n){var l=n&&n.nodeName&&n.nodeName.toLowerCase();return l==="input"?!!fj[n.type]:l==="textarea"}function Ty(n,l,c,v){hl?vl?vl.push(v):vl=[v]:hl=v,l=Od(l,"onChange"),0<l.length&&(c=new Ic("onChange","change",null,c,v),n.push({event:c,listeners:l}))}var Qo=null,Yo=null;function hj(n){s1(n,0)}function Fc(n){var l=vs(n);if(Lc(l))return n}function Cy(n,l){if(n==="change")return l}var Ny=!1;if(Cn){var Bh;if(Cn){var Lh="oninput"in document;if(!Lh){var jy=document.createElement("div");jy.setAttribute("oninput","return;"),Lh=typeof jy.oninput=="function"}Bh=Lh}else Bh=!1;Ny=Bh&&(!document.documentMode||9<document.documentMode)}function Ay(){Qo&&(Qo.detachEvent("onpropertychange",My),Yo=Qo=null)}function My(n){if(n.propertyName==="value"&&Fc(Yo)){var l=[];Ty(l,Yo,n,Ch(n)),fy(hj,l)}}function vj(n,l,c){n==="focusin"?(Ay(),Qo=l,Yo=c,Qo.attachEvent("onpropertychange",My)):n==="focusout"&&Ay()}function pj(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return Fc(Yo)}function gj(n,l){if(n==="click")return Fc(l)}function mj(n,l){if(n==="input"||n==="change")return Fc(l)}function yj(n,l){return n===l&&(n!==0||1/n===1/l)||n!==n&&l!==l}var br=typeof Object.is=="function"?Object.is:yj;function Ko(n,l){if(br(n,l))return!0;if(typeof n!="object"||n===null||typeof l!="object"||l===null)return!1;var c=Object.keys(n),v=Object.keys(l);if(c.length!==v.length)return!1;for(v=0;v<c.length;v++){var b=c[v];if(!ke.call(l,b)||!br(n[b],l[b]))return!1}return!0}function Dy(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Oy(n,l){var c=Dy(n);n=0;for(var v;c;){if(c.nodeType===3){if(v=n+c.textContent.length,n<=l&&v>=l)return{node:c,offset:l-n};n=v}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=Dy(c)}}function Ry(n,l){return n&&l?n===l?!0:n&&n.nodeType===3?!1:l&&l.nodeType===3?Ry(n,l.parentNode):"contains"in n?n.contains(l):n.compareDocumentPosition?!!(n.compareDocumentPosition(l)&16):!1:!1}function ky(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var l=zc(n.document);l instanceof n.HTMLIFrameElement;){try{var c=typeof l.contentWindow.location.href=="string"}catch{c=!1}if(c)n=l.contentWindow;else break;l=zc(n.document)}return l}function zh(n){var l=n&&n.nodeName&&n.nodeName.toLowerCase();return l&&(l==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||l==="textarea"||n.contentEditable==="true")}var xj=Cn&&"documentMode"in document&&11>=document.documentMode,gl=null,Ph=null,$o=null,_h=!1;function By(n,l,c){var v=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;_h||gl==null||gl!==zc(v)||(v=gl,"selectionStart"in v&&zh(v)?v={start:v.selectionStart,end:v.selectionEnd}:(v=(v.ownerDocument&&v.ownerDocument.defaultView||window).getSelection(),v={anchorNode:v.anchorNode,anchorOffset:v.anchorOffset,focusNode:v.focusNode,focusOffset:v.focusOffset}),$o&&Ko($o,v)||($o=v,v=Od(Ph,"onSelect"),0<v.length&&(l=new Ic("onSelect","select",null,l,c),n.push({event:l,listeners:v}),l.target=gl)))}function gs(n,l){var c={};return c[n.toLowerCase()]=l.toLowerCase(),c["Webkit"+n]="webkit"+l,c["Moz"+n]="moz"+l,c}var ml={animationend:gs("Animation","AnimationEnd"),animationiteration:gs("Animation","AnimationIteration"),animationstart:gs("Animation","AnimationStart"),transitionrun:gs("Transition","TransitionRun"),transitionstart:gs("Transition","TransitionStart"),transitioncancel:gs("Transition","TransitionCancel"),transitionend:gs("Transition","TransitionEnd")},Uh={},Ly={};Cn&&(Ly=document.createElement("div").style,"AnimationEvent"in window||(delete ml.animationend.animation,delete ml.animationiteration.animation,delete ml.animationstart.animation),"TransitionEvent"in window||delete ml.transitionend.transition);function ms(n){if(Uh[n])return Uh[n];if(!ml[n])return n;var l=ml[n],c;for(c in l)if(l.hasOwnProperty(c)&&c in Ly)return Uh[n]=l[c];return n}var zy=ms("animationend"),Py=ms("animationiteration"),_y=ms("animationstart"),bj=ms("transitionrun"),wj=ms("transitionstart"),Sj=ms("transitioncancel"),Uy=ms("transitionend"),qy=new Map,qh="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");qh.push("scrollEnd");function Xr(n,l){qy.set(n,l),xr(l,[n])}var Hc=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},Lr=[],yl=0,Ih=0;function Gc(){for(var n=yl,l=Ih=yl=0;l<n;){var c=Lr[l];Lr[l++]=null;var v=Lr[l];Lr[l++]=null;var b=Lr[l];Lr[l++]=null;var w=Lr[l];if(Lr[l++]=null,v!==null&&b!==null){var O=v.pending;O===null?b.next=b:(b.next=O.next,O.next=b),v.pending=b}w!==0&&Iy(c,b,w)}}function Qc(n,l,c,v){Lr[yl++]=n,Lr[yl++]=l,Lr[yl++]=c,Lr[yl++]=v,Ih|=v,n.lanes|=v,n=n.alternate,n!==null&&(n.lanes|=v)}function Vh(n,l,c,v){return Qc(n,l,c,v),Yc(n)}function ys(n,l){return Qc(n,null,null,l),Yc(n)}function Iy(n,l,c){n.lanes|=c;var v=n.alternate;v!==null&&(v.lanes|=c);for(var b=!1,w=n.return;w!==null;)w.childLanes|=c,v=w.alternate,v!==null&&(v.childLanes|=c),w.tag===22&&(n=w.stateNode,n===null||n._visibility&1||(b=!0)),n=w,w=w.return;return n.tag===3?(w=n.stateNode,b&&l!==null&&(b=31-ge(c),n=w.hiddenUpdates,v=n[b],v===null?n[b]=[l]:v.push(l),l.lane=c|536870912),w):null}function Yc(n){if(50<mu)throw mu=0,Zv=null,Error(r(185));for(var l=n.return;l!==null;)n=l,l=n.return;return n.tag===3?n.stateNode:null}var xl={};function Ej(n,l,c,v){this.tag=n,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=v,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function wr(n,l,c,v){return new Ej(n,l,c,v)}function Fh(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Nn(n,l){var c=n.alternate;return c===null?(c=wr(n.tag,l,n.key,n.mode),c.elementType=n.elementType,c.type=n.type,c.stateNode=n.stateNode,c.alternate=n,n.alternate=c):(c.pendingProps=l,c.type=n.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=n.flags&65011712,c.childLanes=n.childLanes,c.lanes=n.lanes,c.child=n.child,c.memoizedProps=n.memoizedProps,c.memoizedState=n.memoizedState,c.updateQueue=n.updateQueue,l=n.dependencies,c.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},c.sibling=n.sibling,c.index=n.index,c.ref=n.ref,c.refCleanup=n.refCleanup,c}function Vy(n,l){n.flags&=65011714;var c=n.alternate;return c===null?(n.childLanes=0,n.lanes=l,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=c.childLanes,n.lanes=c.lanes,n.child=c.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=c.memoizedProps,n.memoizedState=c.memoizedState,n.updateQueue=c.updateQueue,n.type=c.type,l=c.dependencies,n.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),n}function Kc(n,l,c,v,b,w){var O=0;if(v=n,typeof n=="function")Fh(n)&&(O=1);else if(typeof n=="string")O=A5(n,c,W.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case L:return n=wr(31,c,l,b),n.elementType=L,n.lanes=w,n;case E:return xs(c.children,b,w,l);case S:O=8,b|=24;break;case T:return n=wr(12,c,l,b|2),n.elementType=T,n.lanes=w,n;case M:return n=wr(13,c,l,b),n.elementType=M,n.lanes=w,n;case D:return n=wr(19,c,l,b),n.elementType=D,n.lanes=w,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case N:O=10;break e;case C:O=9;break e;case A:O=11;break e;case j:O=14;break e;case R:O=16,v=null;break e}O=29,c=Error(r(130,n===null?"null":typeof n,"")),v=null}return l=wr(O,c,l,b),l.elementType=n,l.type=v,l.lanes=w,l}function xs(n,l,c,v){return n=wr(7,n,v,l),n.lanes=c,n}function Hh(n,l,c){return n=wr(6,n,null,l),n.lanes=c,n}function Fy(n){var l=wr(18,null,null,0);return l.stateNode=n,l}function Gh(n,l,c){return l=wr(4,n.children!==null?n.children:[],n.key,l),l.lanes=c,l.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},l}var Hy=new WeakMap;function zr(n,l){if(typeof n=="object"&&n!==null){var c=Hy.get(n);return c!==void 0?c:(l={value:n,source:l,stack:Se(l)},Hy.set(n,l),l)}return{value:n,source:l,stack:Se(l)}}var bl=[],wl=0,$c=null,Xo=0,Pr=[],_r=0,oi=null,on=1,un="";function jn(n,l){bl[wl++]=Xo,bl[wl++]=$c,$c=n,Xo=l}function Gy(n,l,c){Pr[_r++]=on,Pr[_r++]=un,Pr[_r++]=oi,oi=n;var v=on;n=un;var b=32-ge(v)-1;v&=~(1<<b),c+=1;var w=32-ge(l)+b;if(30<w){var O=b-b%5;w=(v&(1<<O)-1).toString(32),v>>=O,b-=O,on=1<<32-ge(l)+b|c<<b|v,un=w+n}else on=1<<w|c<<b|v,un=n}function Qh(n){n.return!==null&&(jn(n,1),Gy(n,1,0))}function Yh(n){for(;n===$c;)$c=bl[--wl],bl[wl]=null,Xo=bl[--wl],bl[wl]=null;for(;n===oi;)oi=Pr[--_r],Pr[_r]=null,un=Pr[--_r],Pr[_r]=null,on=Pr[--_r],Pr[_r]=null}function Qy(n,l){Pr[_r++]=on,Pr[_r++]=un,Pr[_r++]=oi,on=l.id,un=l.overflow,oi=n}var La=null,It=null,mt=!1,ui=null,Ur=!1,Kh=Error(r(519));function ci(n){var l=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Zo(zr(l,n)),Kh}function Yy(n){var l=n.stateNode,c=n.type,v=n.memoizedProps;switch(l[Ht]=n,l[ya]=v,c){case"dialog":vt("cancel",l),vt("close",l);break;case"iframe":case"object":case"embed":vt("load",l);break;case"video":case"audio":for(c=0;c<xu.length;c++)vt(xu[c],l);break;case"source":vt("error",l);break;case"img":case"image":case"link":vt("error",l),vt("load",l);break;case"details":vt("toggle",l);break;case"input":vt("invalid",l),sy(l,v.value,v.defaultValue,v.checked,v.defaultChecked,v.type,v.name,!0);break;case"select":vt("invalid",l);break;case"textarea":vt("invalid",l),oy(l,v.value,v.defaultValue,v.children)}c=v.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||l.textContent===""+c||v.suppressHydrationWarning===!0||c1(l.textContent,c)?(v.popover!=null&&(vt("beforetoggle",l),vt("toggle",l)),v.onScroll!=null&&vt("scroll",l),v.onScrollEnd!=null&&vt("scrollend",l),v.onClick!=null&&(l.onclick=Tn),l=!0):l=!1,l||ci(n,!0)}function Ky(n){for(La=n.return;La;)switch(La.tag){case 5:case 31:case 13:Ur=!1;return;case 27:case 3:Ur=!0;return;default:La=La.return}}function Sl(n){if(n!==La)return!1;if(!mt)return Ky(n),mt=!0,!1;var l=n.tag,c;if((c=l!==3&&l!==27)&&((c=l===5)&&(c=n.type,c=!(c!=="form"&&c!=="button")||fp(n.type,n.memoizedProps)),c=!c),c&&It&&ci(n),Ky(n),l===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(317));It=x1(n)}else if(l===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(317));It=x1(n)}else l===27?(l=It,Ti(n.type)?(n=mp,mp=null,It=n):It=l):It=La?Ir(n.stateNode.nextSibling):null;return!0}function bs(){It=La=null,mt=!1}function $h(){var n=ui;return n!==null&&(fr===null?fr=n:fr.push.apply(fr,n),ui=null),n}function Zo(n){ui===null?ui=[n]:ui.push(n)}var Xh=k(null),ws=null,An=null;function di(n,l,c){X(Xh,l._currentValue),l._currentValue=c}function Mn(n){n._currentValue=Xh.current,G(Xh)}function Zh(n,l,c){for(;n!==null;){var v=n.alternate;if((n.childLanes&l)!==l?(n.childLanes|=l,v!==null&&(v.childLanes|=l)):v!==null&&(v.childLanes&l)!==l&&(v.childLanes|=l),n===c)break;n=n.return}}function Wh(n,l,c,v){var b=n.child;for(b!==null&&(b.return=n);b!==null;){var w=b.dependencies;if(w!==null){var O=b.child;w=w.firstContext;e:for(;w!==null;){var H=w;w=b;for(var te=0;te<l.length;te++)if(H.context===l[te]){w.lanes|=c,H=w.alternate,H!==null&&(H.lanes|=c),Zh(w.return,c,n),v||(O=null);break e}w=H.next}}else if(b.tag===18){if(O=b.return,O===null)throw Error(r(341));O.lanes|=c,w=O.alternate,w!==null&&(w.lanes|=c),Zh(O,c,n),O=null}else O=b.child;if(O!==null)O.return=b;else for(O=b;O!==null;){if(O===n){O=null;break}if(b=O.sibling,b!==null){b.return=O.return,O=b;break}O=O.return}b=O}}function El(n,l,c,v){n=null;for(var b=l,w=!1;b!==null;){if(!w){if((b.flags&524288)!==0)w=!0;else if((b.flags&262144)!==0)break}if(b.tag===10){var O=b.alternate;if(O===null)throw Error(r(387));if(O=O.memoizedProps,O!==null){var H=b.type;br(b.pendingProps.value,O.value)||(n!==null?n.push(H):n=[H])}}else if(b===ie.current){if(O=b.alternate,O===null)throw Error(r(387));O.memoizedState.memoizedState!==b.memoizedState.memoizedState&&(n!==null?n.push(Tu):n=[Tu])}b=b.return}n!==null&&Wh(l,n,c,v),l.flags|=262144}function Xc(n){for(n=n.firstContext;n!==null;){if(!br(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function Ss(n){ws=n,An=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function za(n){return $y(ws,n)}function Zc(n,l){return ws===null&&Ss(n),$y(n,l)}function $y(n,l){var c=l._currentValue;if(l={context:l,memoizedValue:c,next:null},An===null){if(n===null)throw Error(r(308));An=l,n.dependencies={lanes:0,firstContext:l},n.flags|=524288}else An=An.next=l;return c}var Tj=typeof AbortController<"u"?AbortController:function(){var n=[],l=this.signal={aborted:!1,addEventListener:function(c,v){n.push(v)}};this.abort=function(){l.aborted=!0,n.forEach(function(c){return c()})}},Cj=t.unstable_scheduleCallback,Nj=t.unstable_NormalPriority,fa={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Jh(){return{controller:new Tj,data:new Map,refCount:0}}function Wo(n){n.refCount--,n.refCount===0&&Cj(Nj,function(){n.controller.abort()})}var Jo=null,ev=0,Tl=0,Cl=null;function jj(n,l){if(Jo===null){var c=Jo=[];ev=0,Tl=rp(),Cl={status:"pending",value:void 0,then:function(v){c.push(v)}}}return ev++,l.then(Xy,Xy),l}function Xy(){if(--ev===0&&Jo!==null){Cl!==null&&(Cl.status="fulfilled");var n=Jo;Jo=null,Tl=0,Cl=null;for(var l=0;l<n.length;l++)(0,n[l])()}}function Aj(n,l){var c=[],v={status:"pending",value:null,reason:null,then:function(b){c.push(b)}};return n.then(function(){v.status="fulfilled",v.value=l;for(var b=0;b<c.length;b++)(0,c[b])(l)},function(b){for(v.status="rejected",v.reason=b,b=0;b<c.length;b++)(0,c[b])(void 0)}),v}var Zy=P.S;P.S=function(n,l){Bb=Re(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&jj(n,l),Zy!==null&&Zy(n,l)};var Es=k(null);function tv(){var n=Es.current;return n!==null?n:Pt.pooledCache}function Wc(n,l){l===null?X(Es,Es.current):X(Es,l.pool)}function Wy(){var n=tv();return n===null?null:{parent:fa._currentValue,pool:n}}var Nl=Error(r(460)),av=Error(r(474)),Jc=Error(r(542)),ed={then:function(){}};function Jy(n){return n=n.status,n==="fulfilled"||n==="rejected"}function ex(n,l,c){switch(c=n[c],c===void 0?n.push(l):c!==l&&(l.then(Tn,Tn),l=c),l.status){case"fulfilled":return l.value;case"rejected":throw n=l.reason,ax(n),n;default:if(typeof l.status=="string")l.then(Tn,Tn);else{if(n=Pt,n!==null&&100<n.shellSuspendCounter)throw Error(r(482));n=l,n.status="pending",n.then(function(v){if(l.status==="pending"){var b=l;b.status="fulfilled",b.value=v}},function(v){if(l.status==="pending"){var b=l;b.status="rejected",b.reason=v}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw n=l.reason,ax(n),n}throw Cs=l,Nl}}function Ts(n){try{var l=n._init;return l(n._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(Cs=c,Nl):c}}var Cs=null;function tx(){if(Cs===null)throw Error(r(459));var n=Cs;return Cs=null,n}function ax(n){if(n===Nl||n===Jc)throw Error(r(483))}var jl=null,eu=0;function td(n){var l=eu;return eu+=1,jl===null&&(jl=[]),ex(jl,n,l)}function tu(n,l){l=l.props.ref,n.ref=l!==void 0?l:null}function ad(n,l){throw l.$$typeof===m?Error(r(525)):(n=Object.prototype.toString.call(l),Error(r(31,n==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":n)))}function rx(n){function l(ue,ne){if(n){var de=ue.deletions;de===null?(ue.deletions=[ne],ue.flags|=16):de.push(ne)}}function c(ue,ne){if(!n)return null;for(;ne!==null;)l(ue,ne),ne=ne.sibling;return null}function v(ue){for(var ne=new Map;ue!==null;)ue.key!==null?ne.set(ue.key,ue):ne.set(ue.index,ue),ue=ue.sibling;return ne}function b(ue,ne){return ue=Nn(ue,ne),ue.index=0,ue.sibling=null,ue}function w(ue,ne,de){return ue.index=de,n?(de=ue.alternate,de!==null?(de=de.index,de<ne?(ue.flags|=67108866,ne):de):(ue.flags|=67108866,ne)):(ue.flags|=1048576,ne)}function O(ue){return n&&ue.alternate===null&&(ue.flags|=67108866),ue}function H(ue,ne,de,Te){return ne===null||ne.tag!==6?(ne=Hh(de,ue.mode,Te),ne.return=ue,ne):(ne=b(ne,de),ne.return=ue,ne)}function te(ue,ne,de,Te){var Ze=de.type;return Ze===E?be(ue,ne,de.props.children,Te,de.key):ne!==null&&(ne.elementType===Ze||typeof Ze=="object"&&Ze!==null&&Ze.$$typeof===R&&Ts(Ze)===ne.type)?(ne=b(ne,de.props),tu(ne,de),ne.return=ue,ne):(ne=Kc(de.type,de.key,de.props,null,ue.mode,Te),tu(ne,de),ne.return=ue,ne)}function fe(ue,ne,de,Te){return ne===null||ne.tag!==4||ne.stateNode.containerInfo!==de.containerInfo||ne.stateNode.implementation!==de.implementation?(ne=Gh(de,ue.mode,Te),ne.return=ue,ne):(ne=b(ne,de.children||[]),ne.return=ue,ne)}function be(ue,ne,de,Te,Ze){return ne===null||ne.tag!==7?(ne=xs(de,ue.mode,Te,Ze),ne.return=ue,ne):(ne=b(ne,de),ne.return=ue,ne)}function Ce(ue,ne,de){if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return ne=Hh(""+ne,ue.mode,de),ne.return=ue,ne;if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case y:return de=Kc(ne.type,ne.key,ne.props,null,ue.mode,de),tu(de,ne),de.return=ue,de;case x:return ne=Gh(ne,ue.mode,de),ne.return=ue,ne;case R:return ne=Ts(ne),Ce(ue,ne,de)}if(Q(ne)||B(ne))return ne=xs(ne,ue.mode,de,null),ne.return=ue,ne;if(typeof ne.then=="function")return Ce(ue,td(ne),de);if(ne.$$typeof===N)return Ce(ue,Zc(ue,ne),de);ad(ue,ne)}return null}function ve(ue,ne,de,Te){var Ze=ne!==null?ne.key:null;if(typeof de=="string"&&de!==""||typeof de=="number"||typeof de=="bigint")return Ze!==null?null:H(ue,ne,""+de,Te);if(typeof de=="object"&&de!==null){switch(de.$$typeof){case y:return de.key===Ze?te(ue,ne,de,Te):null;case x:return de.key===Ze?fe(ue,ne,de,Te):null;case R:return de=Ts(de),ve(ue,ne,de,Te)}if(Q(de)||B(de))return Ze!==null?null:be(ue,ne,de,Te,null);if(typeof de.then=="function")return ve(ue,ne,td(de),Te);if(de.$$typeof===N)return ve(ue,ne,Zc(ue,de),Te);ad(ue,de)}return null}function ye(ue,ne,de,Te,Ze){if(typeof Te=="string"&&Te!==""||typeof Te=="number"||typeof Te=="bigint")return ue=ue.get(de)||null,H(ne,ue,""+Te,Ze);if(typeof Te=="object"&&Te!==null){switch(Te.$$typeof){case y:return ue=ue.get(Te.key===null?de:Te.key)||null,te(ne,ue,Te,Ze);case x:return ue=ue.get(Te.key===null?de:Te.key)||null,fe(ne,ue,Te,Ze);case R:return Te=Ts(Te),ye(ue,ne,de,Te,Ze)}if(Q(Te)||B(Te))return ue=ue.get(de)||null,be(ne,ue,Te,Ze,null);if(typeof Te.then=="function")return ye(ue,ne,de,td(Te),Ze);if(Te.$$typeof===N)return ye(ue,ne,de,Zc(ne,Te),Ze);ad(ne,Te)}return null}function Ve(ue,ne,de,Te){for(var Ze=null,St=null,Qe=ne,ct=ne=0,gt=null;Qe!==null&&ct<de.length;ct++){Qe.index>ct?(gt=Qe,Qe=null):gt=Qe.sibling;var Et=ve(ue,Qe,de[ct],Te);if(Et===null){Qe===null&&(Qe=gt);break}n&&Qe&&Et.alternate===null&&l(ue,Qe),ne=w(Et,ne,ct),St===null?Ze=Et:St.sibling=Et,St=Et,Qe=gt}if(ct===de.length)return c(ue,Qe),mt&&jn(ue,ct),Ze;if(Qe===null){for(;ct<de.length;ct++)Qe=Ce(ue,de[ct],Te),Qe!==null&&(ne=w(Qe,ne,ct),St===null?Ze=Qe:St.sibling=Qe,St=Qe);return mt&&jn(ue,ct),Ze}for(Qe=v(Qe);ct<de.length;ct++)gt=ye(Qe,ue,ct,de[ct],Te),gt!==null&&(n&>.alternate!==null&&Qe.delete(gt.key===null?ct:gt.key),ne=w(gt,ne,ct),St===null?Ze=gt:St.sibling=gt,St=gt);return n&&Qe.forEach(function(Mi){return l(ue,Mi)}),mt&&jn(ue,ct),Ze}function at(ue,ne,de,Te){if(de==null)throw Error(r(151));for(var Ze=null,St=null,Qe=ne,ct=ne=0,gt=null,Et=de.next();Qe!==null&&!Et.done;ct++,Et=de.next()){Qe.index>ct?(gt=Qe,Qe=null):gt=Qe.sibling;var Mi=ve(ue,Qe,Et.value,Te);if(Mi===null){Qe===null&&(Qe=gt);break}n&&Qe&&Mi.alternate===null&&l(ue,Qe),ne=w(Mi,ne,ct),St===null?Ze=Mi:St.sibling=Mi,St=Mi,Qe=gt}if(Et.done)return c(ue,Qe),mt&&jn(ue,ct),Ze;if(Qe===null){for(;!Et.done;ct++,Et=de.next())Et=Ce(ue,Et.value,Te),Et!==null&&(ne=w(Et,ne,ct),St===null?Ze=Et:St.sibling=Et,St=Et);return mt&&jn(ue,ct),Ze}for(Qe=v(Qe);!Et.done;ct++,Et=de.next())Et=ye(Qe,ue,ct,Et.value,Te),Et!==null&&(n&&Et.alternate!==null&&Qe.delete(Et.key===null?ct:Et.key),ne=w(Et,ne,ct),St===null?Ze=Et:St.sibling=Et,St=Et);return n&&Qe.forEach(function(U5){return l(ue,U5)}),mt&&jn(ue,ct),Ze}function Lt(ue,ne,de,Te){if(typeof de=="object"&&de!==null&&de.type===E&&de.key===null&&(de=de.props.children),typeof de=="object"&&de!==null){switch(de.$$typeof){case y:e:{for(var Ze=de.key;ne!==null;){if(ne.key===Ze){if(Ze=de.type,Ze===E){if(ne.tag===7){c(ue,ne.sibling),Te=b(ne,de.props.children),Te.return=ue,ue=Te;break e}}else if(ne.elementType===Ze||typeof Ze=="object"&&Ze!==null&&Ze.$$typeof===R&&Ts(Ze)===ne.type){c(ue,ne.sibling),Te=b(ne,de.props),tu(Te,de),Te.return=ue,ue=Te;break e}c(ue,ne);break}else l(ue,ne);ne=ne.sibling}de.type===E?(Te=xs(de.props.children,ue.mode,Te,de.key),Te.return=ue,ue=Te):(Te=Kc(de.type,de.key,de.props,null,ue.mode,Te),tu(Te,de),Te.return=ue,ue=Te)}return O(ue);case x:e:{for(Ze=de.key;ne!==null;){if(ne.key===Ze)if(ne.tag===4&&ne.stateNode.containerInfo===de.containerInfo&&ne.stateNode.implementation===de.implementation){c(ue,ne.sibling),Te=b(ne,de.children||[]),Te.return=ue,ue=Te;break e}else{c(ue,ne);break}else l(ue,ne);ne=ne.sibling}Te=Gh(de,ue.mode,Te),Te.return=ue,ue=Te}return O(ue);case R:return de=Ts(de),Lt(ue,ne,de,Te)}if(Q(de))return Ve(ue,ne,de,Te);if(B(de)){if(Ze=B(de),typeof Ze!="function")throw Error(r(150));return de=Ze.call(de),at(ue,ne,de,Te)}if(typeof de.then=="function")return Lt(ue,ne,td(de),Te);if(de.$$typeof===N)return Lt(ue,ne,Zc(ue,de),Te);ad(ue,de)}return typeof de=="string"&&de!==""||typeof de=="number"||typeof de=="bigint"?(de=""+de,ne!==null&&ne.tag===6?(c(ue,ne.sibling),Te=b(ne,de),Te.return=ue,ue=Te):(c(ue,ne),Te=Hh(de,ue.mode,Te),Te.return=ue,ue=Te),O(ue)):c(ue,ne)}return function(ue,ne,de,Te){try{eu=0;var Ze=Lt(ue,ne,de,Te);return jl=null,Ze}catch(Qe){if(Qe===Nl||Qe===Jc)throw Qe;var St=wr(29,Qe,null,ue.mode);return St.lanes=Te,St.return=ue,St}finally{}}}var Ns=rx(!0),nx=rx(!1),fi=!1;function rv(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function nv(n,l){n=n.updateQueue,l.updateQueue===n&&(l.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function hi(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function vi(n,l,c){var v=n.updateQueue;if(v===null)return null;if(v=v.shared,(Nt&2)!==0){var b=v.pending;return b===null?l.next=l:(l.next=b.next,b.next=l),v.pending=l,l=Yc(n),Iy(n,null,c),l}return Qc(n,v,l,c),Yc(n)}function au(n,l,c){if(l=l.updateQueue,l!==null&&(l=l.shared,(c&4194048)!==0)){var v=l.lanes;v&=n.pendingLanes,c|=v,l.lanes=c,ia(n,c)}}function iv(n,l){var c=n.updateQueue,v=n.alternate;if(v!==null&&(v=v.updateQueue,c===v)){var b=null,w=null;if(c=c.firstBaseUpdate,c!==null){do{var O={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};w===null?b=w=O:w=w.next=O,c=c.next}while(c!==null);w===null?b=w=l:w=w.next=l}else b=w=l;c={baseState:v.baseState,firstBaseUpdate:b,lastBaseUpdate:w,shared:v.shared,callbacks:v.callbacks},n.updateQueue=c;return}n=c.lastBaseUpdate,n===null?c.firstBaseUpdate=l:n.next=l,c.lastBaseUpdate=l}var sv=!1;function ru(){if(sv){var n=Cl;if(n!==null)throw n}}function nu(n,l,c,v){sv=!1;var b=n.updateQueue;fi=!1;var w=b.firstBaseUpdate,O=b.lastBaseUpdate,H=b.shared.pending;if(H!==null){b.shared.pending=null;var te=H,fe=te.next;te.next=null,O===null?w=fe:O.next=fe,O=te;var be=n.alternate;be!==null&&(be=be.updateQueue,H=be.lastBaseUpdate,H!==O&&(H===null?be.firstBaseUpdate=fe:H.next=fe,be.lastBaseUpdate=te))}if(w!==null){var Ce=b.baseState;O=0,be=fe=te=null,H=w;do{var ve=H.lane&-536870913,ye=ve!==H.lane;if(ye?(pt&ve)===ve:(v&ve)===ve){ve!==0&&ve===Tl&&(sv=!0),be!==null&&(be=be.next={lane:0,tag:H.tag,payload:H.payload,callback:null,next:null});e:{var Ve=n,at=H;ve=l;var Lt=c;switch(at.tag){case 1:if(Ve=at.payload,typeof Ve=="function"){Ce=Ve.call(Lt,Ce,ve);break e}Ce=Ve;break e;case 3:Ve.flags=Ve.flags&-65537|128;case 0:if(Ve=at.payload,ve=typeof Ve=="function"?Ve.call(Lt,Ce,ve):Ve,ve==null)break e;Ce=p({},Ce,ve);break e;case 2:fi=!0}}ve=H.callback,ve!==null&&(n.flags|=64,ye&&(n.flags|=8192),ye=b.callbacks,ye===null?b.callbacks=[ve]:ye.push(ve))}else ye={lane:ve,tag:H.tag,payload:H.payload,callback:H.callback,next:null},be===null?(fe=be=ye,te=Ce):be=be.next=ye,O|=ve;if(H=H.next,H===null){if(H=b.shared.pending,H===null)break;ye=H,H=ye.next,ye.next=null,b.lastBaseUpdate=ye,b.shared.pending=null}}while(!0);be===null&&(te=Ce),b.baseState=te,b.firstBaseUpdate=fe,b.lastBaseUpdate=be,w===null&&(b.shared.lanes=0),xi|=O,n.lanes=O,n.memoizedState=Ce}}function ix(n,l){if(typeof n!="function")throw Error(r(191,n));n.call(l)}function sx(n,l){var c=n.callbacks;if(c!==null)for(n.callbacks=null,n=0;n<c.length;n++)ix(c[n],l)}var Al=k(null),rd=k(0);function lx(n,l){n=_n,X(rd,n),X(Al,l),_n=n|l.baseLanes}function lv(){X(rd,_n),X(Al,Al.current)}function ov(){_n=rd.current,G(Al),G(rd)}var Sr=k(null),qr=null;function pi(n){var l=n.alternate;X(la,la.current&1),X(Sr,n),qr===null&&(l===null||Al.current!==null||l.memoizedState!==null)&&(qr=n)}function uv(n){X(la,la.current),X(Sr,n),qr===null&&(qr=n)}function ox(n){n.tag===22?(X(la,la.current),X(Sr,n),qr===null&&(qr=n)):gi()}function gi(){X(la,la.current),X(Sr,Sr.current)}function Er(n){G(Sr),qr===n&&(qr=null),G(la)}var la=k(0);function nd(n){for(var l=n;l!==null;){if(l.tag===13){var c=l.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||pp(c)||gp(c)))return l}else if(l.tag===19&&(l.memoizedProps.revealOrder==="forwards"||l.memoizedProps.revealOrder==="backwards"||l.memoizedProps.revealOrder==="unstable_legacy-backwards"||l.memoizedProps.revealOrder==="together")){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===n)break;for(;l.sibling===null;){if(l.return===null||l.return===n)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var Dn=0,ot=null,kt=null,ha=null,id=!1,Ml=!1,js=!1,sd=0,iu=0,Dl=null,Mj=0;function Jt(){throw Error(r(321))}function cv(n,l){if(l===null)return!1;for(var c=0;c<l.length&&c<n.length;c++)if(!br(n[c],l[c]))return!1;return!0}function dv(n,l,c,v,b,w){return Dn=w,ot=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,P.H=n===null||n.memoizedState===null?Gx:Nv,js=!1,w=c(v,b),js=!1,Ml&&(w=cx(l,c,v,b)),ux(n),w}function ux(n){P.H=ou;var l=kt!==null&&kt.next!==null;if(Dn=0,ha=kt=ot=null,id=!1,iu=0,Dl=null,l)throw Error(r(300));n===null||va||(n=n.dependencies,n!==null&&Xc(n)&&(va=!0))}function cx(n,l,c,v){ot=n;var b=0;do{if(Ml&&(Dl=null),iu=0,Ml=!1,25<=b)throw Error(r(301));if(b+=1,ha=kt=null,n.updateQueue!=null){var w=n.updateQueue;w.lastEffect=null,w.events=null,w.stores=null,w.memoCache!=null&&(w.memoCache.index=0)}P.H=Qx,w=l(c,v)}while(Ml);return w}function Dj(){var n=P.H,l=n.useState()[0];return l=typeof l.then=="function"?su(l):l,n=n.useState()[0],(kt!==null?kt.memoizedState:null)!==n&&(ot.flags|=1024),l}function fv(){var n=sd!==0;return sd=0,n}function hv(n,l,c){l.updateQueue=n.updateQueue,l.flags&=-2053,n.lanes&=~c}function vv(n){if(id){for(n=n.memoizedState;n!==null;){var l=n.queue;l!==null&&(l.pending=null),n=n.next}id=!1}Dn=0,ha=kt=ot=null,Ml=!1,iu=sd=0,Dl=null}function er(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ha===null?ot.memoizedState=ha=n:ha=ha.next=n,ha}function oa(){if(kt===null){var n=ot.alternate;n=n!==null?n.memoizedState:null}else n=kt.next;var l=ha===null?ot.memoizedState:ha.next;if(l!==null)ha=l,kt=n;else{if(n===null)throw ot.alternate===null?Error(r(467)):Error(r(310));kt=n,n={memoizedState:kt.memoizedState,baseState:kt.baseState,baseQueue:kt.baseQueue,queue:kt.queue,next:null},ha===null?ot.memoizedState=ha=n:ha=ha.next=n}return ha}function ld(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function su(n){var l=iu;return iu+=1,Dl===null&&(Dl=[]),n=ex(Dl,n,l),l=ot,(ha===null?l.memoizedState:ha.next)===null&&(l=l.alternate,P.H=l===null||l.memoizedState===null?Gx:Nv),n}function od(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return su(n);if(n.$$typeof===N)return za(n)}throw Error(r(438,String(n)))}function pv(n){var l=null,c=ot.updateQueue;if(c!==null&&(l=c.memoCache),l==null){var v=ot.alternate;v!==null&&(v=v.updateQueue,v!==null&&(v=v.memoCache,v!=null&&(l={data:v.data.map(function(b){return b.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),c===null&&(c=ld(),ot.updateQueue=c),c.memoCache=l,c=l.data[l.index],c===void 0)for(c=l.data[l.index]=Array(n),v=0;v<n;v++)c[v]=z;return l.index++,c}function On(n,l){return typeof l=="function"?l(n):l}function ud(n){var l=oa();return gv(l,kt,n)}function gv(n,l,c){var v=n.queue;if(v===null)throw Error(r(311));v.lastRenderedReducer=c;var b=n.baseQueue,w=v.pending;if(w!==null){if(b!==null){var O=b.next;b.next=w.next,w.next=O}l.baseQueue=b=w,v.pending=null}if(w=n.baseState,b===null)n.memoizedState=w;else{l=b.next;var H=O=null,te=null,fe=l,be=!1;do{var Ce=fe.lane&-536870913;if(Ce!==fe.lane?(pt&Ce)===Ce:(Dn&Ce)===Ce){var ve=fe.revertLane;if(ve===0)te!==null&&(te=te.next={lane:0,revertLane:0,gesture:null,action:fe.action,hasEagerState:fe.hasEagerState,eagerState:fe.eagerState,next:null}),Ce===Tl&&(be=!0);else if((Dn&ve)===ve){fe=fe.next,ve===Tl&&(be=!0);continue}else Ce={lane:0,revertLane:fe.revertLane,gesture:null,action:fe.action,hasEagerState:fe.hasEagerState,eagerState:fe.eagerState,next:null},te===null?(H=te=Ce,O=w):te=te.next=Ce,ot.lanes|=ve,xi|=ve;Ce=fe.action,js&&c(w,Ce),w=fe.hasEagerState?fe.eagerState:c(w,Ce)}else ve={lane:Ce,revertLane:fe.revertLane,gesture:fe.gesture,action:fe.action,hasEagerState:fe.hasEagerState,eagerState:fe.eagerState,next:null},te===null?(H=te=ve,O=w):te=te.next=ve,ot.lanes|=Ce,xi|=Ce;fe=fe.next}while(fe!==null&&fe!==l);if(te===null?O=w:te.next=H,!br(w,n.memoizedState)&&(va=!0,be&&(c=Cl,c!==null)))throw c;n.memoizedState=w,n.baseState=O,n.baseQueue=te,v.lastRenderedState=w}return b===null&&(v.lanes=0),[n.memoizedState,v.dispatch]}function mv(n){var l=oa(),c=l.queue;if(c===null)throw Error(r(311));c.lastRenderedReducer=n;var v=c.dispatch,b=c.pending,w=l.memoizedState;if(b!==null){c.pending=null;var O=b=b.next;do w=n(w,O.action),O=O.next;while(O!==b);br(w,l.memoizedState)||(va=!0),l.memoizedState=w,l.baseQueue===null&&(l.baseState=w),c.lastRenderedState=w}return[w,v]}function dx(n,l,c){var v=ot,b=oa(),w=mt;if(w){if(c===void 0)throw Error(r(407));c=c()}else c=l();var O=!br((kt||b).memoizedState,c);if(O&&(b.memoizedState=c,va=!0),b=b.queue,bv(vx.bind(null,v,b,n),[n]),b.getSnapshot!==l||O||ha!==null&&ha.memoizedState.tag&1){if(v.flags|=2048,Ol(9,{destroy:void 0},hx.bind(null,v,b,c,l),null),Pt===null)throw Error(r(349));w||(Dn&127)!==0||fx(v,l,c)}return c}function fx(n,l,c){n.flags|=16384,n={getSnapshot:l,value:c},l=ot.updateQueue,l===null?(l=ld(),ot.updateQueue=l,l.stores=[n]):(c=l.stores,c===null?l.stores=[n]:c.push(n))}function hx(n,l,c,v){l.value=c,l.getSnapshot=v,px(l)&&gx(n)}function vx(n,l,c){return c(function(){px(l)&&gx(n)})}function px(n){var l=n.getSnapshot;n=n.value;try{var c=l();return!br(n,c)}catch{return!0}}function gx(n){var l=ys(n,2);l!==null&&hr(l,n,2)}function yv(n){var l=er();if(typeof n=="function"){var c=n;if(n=c(),js){me(!0);try{c()}finally{me(!1)}}}return l.memoizedState=l.baseState=n,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:On,lastRenderedState:n},l}function mx(n,l,c,v){return n.baseState=c,gv(n,kt,typeof v=="function"?v:On)}function Oj(n,l,c,v,b){if(fd(n))throw Error(r(485));if(n=l.action,n!==null){var w={payload:b,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(O){w.listeners.push(O)}};P.T!==null?c(!0):w.isTransition=!1,v(w),c=l.pending,c===null?(w.next=l.pending=w,yx(l,w)):(w.next=c.next,l.pending=c.next=w)}}function yx(n,l){var c=l.action,v=l.payload,b=n.state;if(l.isTransition){var w=P.T,O={};P.T=O;try{var H=c(b,v),te=P.S;te!==null&&te(O,H),xx(n,l,H)}catch(fe){xv(n,l,fe)}finally{w!==null&&O.types!==null&&(w.types=O.types),P.T=w}}else try{w=c(b,v),xx(n,l,w)}catch(fe){xv(n,l,fe)}}function xx(n,l,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(v){bx(n,l,v)},function(v){return xv(n,l,v)}):bx(n,l,c)}function bx(n,l,c){l.status="fulfilled",l.value=c,wx(l),n.state=c,l=n.pending,l!==null&&(c=l.next,c===l?n.pending=null:(c=c.next,l.next=c,yx(n,c)))}function xv(n,l,c){var v=n.pending;if(n.pending=null,v!==null){v=v.next;do l.status="rejected",l.reason=c,wx(l),l=l.next;while(l!==v)}n.action=null}function wx(n){n=n.listeners;for(var l=0;l<n.length;l++)(0,n[l])()}function Sx(n,l){return l}function Ex(n,l){if(mt){var c=Pt.formState;if(c!==null){e:{var v=ot;if(mt){if(It){t:{for(var b=It,w=Ur;b.nodeType!==8;){if(!w){b=null;break t}if(b=Ir(b.nextSibling),b===null){b=null;break t}}w=b.data,b=w==="F!"||w==="F"?b:null}if(b){It=Ir(b.nextSibling),v=b.data==="F!";break e}}ci(v)}v=!1}v&&(l=c[0])}}return c=er(),c.memoizedState=c.baseState=l,v={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sx,lastRenderedState:l},c.queue=v,c=Vx.bind(null,ot,v),v.dispatch=c,v=yv(!1),w=Cv.bind(null,ot,!1,v.queue),v=er(),b={state:l,dispatch:null,action:n,pending:null},v.queue=b,c=Oj.bind(null,ot,b,w,c),b.dispatch=c,v.memoizedState=n,[l,c,!1]}function Tx(n){var l=oa();return Cx(l,kt,n)}function Cx(n,l,c){if(l=gv(n,l,Sx)[0],n=ud(On)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var v=su(l)}catch(O){throw O===Nl?Jc:O}else v=l;l=oa();var b=l.queue,w=b.dispatch;return c!==l.memoizedState&&(ot.flags|=2048,Ol(9,{destroy:void 0},Rj.bind(null,b,c),null)),[v,w,n]}function Rj(n,l){n.action=l}function Nx(n){var l=oa(),c=kt;if(c!==null)return Cx(l,c,n);oa(),l=l.memoizedState,c=oa();var v=c.queue.dispatch;return c.memoizedState=n,[l,v,!1]}function Ol(n,l,c,v){return n={tag:n,create:c,deps:v,inst:l,next:null},l=ot.updateQueue,l===null&&(l=ld(),ot.updateQueue=l),c=l.lastEffect,c===null?l.lastEffect=n.next=n:(v=c.next,c.next=n,n.next=v,l.lastEffect=n),n}function jx(){return oa().memoizedState}function cd(n,l,c,v){var b=er();ot.flags|=n,b.memoizedState=Ol(1|l,{destroy:void 0},c,v===void 0?null:v)}function dd(n,l,c,v){var b=oa();v=v===void 0?null:v;var w=b.memoizedState.inst;kt!==null&&v!==null&&cv(v,kt.memoizedState.deps)?b.memoizedState=Ol(l,w,c,v):(ot.flags|=n,b.memoizedState=Ol(1|l,w,c,v))}function Ax(n,l){cd(8390656,8,n,l)}function bv(n,l){dd(2048,8,n,l)}function kj(n){ot.flags|=4;var l=ot.updateQueue;if(l===null)l=ld(),ot.updateQueue=l,l.events=[n];else{var c=l.events;c===null?l.events=[n]:c.push(n)}}function Mx(n){var l=oa().memoizedState;return kj({ref:l,nextImpl:n}),function(){if((Nt&2)!==0)throw Error(r(440));return l.impl.apply(void 0,arguments)}}function Dx(n,l){return dd(4,2,n,l)}function Ox(n,l){return dd(4,4,n,l)}function Rx(n,l){if(typeof l=="function"){n=n();var c=l(n);return function(){typeof c=="function"?c():l(null)}}if(l!=null)return n=n(),l.current=n,function(){l.current=null}}function kx(n,l,c){c=c!=null?c.concat([n]):null,dd(4,4,Rx.bind(null,l,n),c)}function wv(){}function Bx(n,l){var c=oa();l=l===void 0?null:l;var v=c.memoizedState;return l!==null&&cv(l,v[1])?v[0]:(c.memoizedState=[n,l],n)}function Lx(n,l){var c=oa();l=l===void 0?null:l;var v=c.memoizedState;if(l!==null&&cv(l,v[1]))return v[0];if(v=n(),js){me(!0);try{n()}finally{me(!1)}}return c.memoizedState=[v,l],v}function Sv(n,l,c){return c===void 0||(Dn&1073741824)!==0&&(pt&261930)===0?n.memoizedState=l:(n.memoizedState=c,n=zb(),ot.lanes|=n,xi|=n,c)}function zx(n,l,c,v){return br(c,l)?c:Al.current!==null?(n=Sv(n,c,v),br(n,l)||(va=!0),n):(Dn&42)===0||(Dn&1073741824)!==0&&(pt&261930)===0?(va=!0,n.memoizedState=c):(n=zb(),ot.lanes|=n,xi|=n,l)}function Px(n,l,c,v,b){var w=U.p;U.p=w!==0&&8>w?w:8;var O=P.T,H={};P.T=H,Cv(n,!1,l,c);try{var te=b(),fe=P.S;if(fe!==null&&fe(H,te),te!==null&&typeof te=="object"&&typeof te.then=="function"){var be=Aj(te,v);lu(n,l,be,Nr(n))}else lu(n,l,v,Nr(n))}catch(Ce){lu(n,l,{then:function(){},status:"rejected",reason:Ce},Nr())}finally{U.p=w,O!==null&&H.types!==null&&(O.types=H.types),P.T=O}}function Bj(){}function Ev(n,l,c,v){if(n.tag!==5)throw Error(r(476));var b=_x(n).queue;Px(n,b,l,F,c===null?Bj:function(){return Ux(n),c(v)})}function _x(n){var l=n.memoizedState;if(l!==null)return l;l={memoizedState:F,baseState:F,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:On,lastRenderedState:F},next:null};var c={};return l.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:On,lastRenderedState:c},next:null},n.memoizedState=l,n=n.alternate,n!==null&&(n.memoizedState=l),l}function Ux(n){var l=_x(n);l.next===null&&(l=n.alternate.memoizedState),lu(n,l.next.queue,{},Nr())}function Tv(){return za(Tu)}function qx(){return oa().memoizedState}function Ix(){return oa().memoizedState}function Lj(n){for(var l=n.return;l!==null;){switch(l.tag){case 24:case 3:var c=Nr();n=hi(c);var v=vi(l,n,c);v!==null&&(hr(v,l,c),au(v,l,c)),l={cache:Jh()},n.payload=l;return}l=l.return}}function zj(n,l,c){var v=Nr();c={lane:v,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},fd(n)?Fx(l,c):(c=Vh(n,l,c,v),c!==null&&(hr(c,n,v),Hx(c,l,v)))}function Vx(n,l,c){var v=Nr();lu(n,l,c,v)}function lu(n,l,c,v){var b={lane:v,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(fd(n))Fx(l,b);else{var w=n.alternate;if(n.lanes===0&&(w===null||w.lanes===0)&&(w=l.lastRenderedReducer,w!==null))try{var O=l.lastRenderedState,H=w(O,c);if(b.hasEagerState=!0,b.eagerState=H,br(H,O))return Qc(n,l,b,0),Pt===null&&Gc(),!1}catch{}finally{}if(c=Vh(n,l,b,v),c!==null)return hr(c,n,v),Hx(c,l,v),!0}return!1}function Cv(n,l,c,v){if(v={lane:2,revertLane:rp(),gesture:null,action:v,hasEagerState:!1,eagerState:null,next:null},fd(n)){if(l)throw Error(r(479))}else l=Vh(n,c,v,2),l!==null&&hr(l,n,2)}function fd(n){var l=n.alternate;return n===ot||l!==null&&l===ot}function Fx(n,l){Ml=id=!0;var c=n.pending;c===null?l.next=l:(l.next=c.next,c.next=l),n.pending=l}function Hx(n,l,c){if((c&4194048)!==0){var v=l.lanes;v&=n.pendingLanes,c|=v,l.lanes=c,ia(n,c)}}var ou={readContext:za,use:od,useCallback:Jt,useContext:Jt,useEffect:Jt,useImperativeHandle:Jt,useLayoutEffect:Jt,useInsertionEffect:Jt,useMemo:Jt,useReducer:Jt,useRef:Jt,useState:Jt,useDebugValue:Jt,useDeferredValue:Jt,useTransition:Jt,useSyncExternalStore:Jt,useId:Jt,useHostTransitionStatus:Jt,useFormState:Jt,useActionState:Jt,useOptimistic:Jt,useMemoCache:Jt,useCacheRefresh:Jt};ou.useEffectEvent=Jt;var Gx={readContext:za,use:od,useCallback:function(n,l){return er().memoizedState=[n,l===void 0?null:l],n},useContext:za,useEffect:Ax,useImperativeHandle:function(n,l,c){c=c!=null?c.concat([n]):null,cd(4194308,4,Rx.bind(null,l,n),c)},useLayoutEffect:function(n,l){return cd(4194308,4,n,l)},useInsertionEffect:function(n,l){cd(4,2,n,l)},useMemo:function(n,l){var c=er();l=l===void 0?null:l;var v=n();if(js){me(!0);try{n()}finally{me(!1)}}return c.memoizedState=[v,l],v},useReducer:function(n,l,c){var v=er();if(c!==void 0){var b=c(l);if(js){me(!0);try{c(l)}finally{me(!1)}}}else b=l;return v.memoizedState=v.baseState=b,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:b},v.queue=n,n=n.dispatch=zj.bind(null,ot,n),[v.memoizedState,n]},useRef:function(n){var l=er();return n={current:n},l.memoizedState=n},useState:function(n){n=yv(n);var l=n.queue,c=Vx.bind(null,ot,l);return l.dispatch=c,[n.memoizedState,c]},useDebugValue:wv,useDeferredValue:function(n,l){var c=er();return Sv(c,n,l)},useTransition:function(){var n=yv(!1);return n=Px.bind(null,ot,n.queue,!0,!1),er().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,l,c){var v=ot,b=er();if(mt){if(c===void 0)throw Error(r(407));c=c()}else{if(c=l(),Pt===null)throw Error(r(349));(pt&127)!==0||fx(v,l,c)}b.memoizedState=c;var w={value:c,getSnapshot:l};return b.queue=w,Ax(vx.bind(null,v,w,n),[n]),v.flags|=2048,Ol(9,{destroy:void 0},hx.bind(null,v,w,c,l),null),c},useId:function(){var n=er(),l=Pt.identifierPrefix;if(mt){var c=un,v=on;c=(v&~(1<<32-ge(v)-1)).toString(32)+c,l="_"+l+"R_"+c,c=sd++,0<c&&(l+="H"+c.toString(32)),l+="_"}else c=Mj++,l="_"+l+"r_"+c.toString(32)+"_";return n.memoizedState=l},useHostTransitionStatus:Tv,useFormState:Ex,useActionState:Ex,useOptimistic:function(n){var l=er();l.memoizedState=l.baseState=n;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=c,l=Cv.bind(null,ot,!0,c),c.dispatch=l,[n,l]},useMemoCache:pv,useCacheRefresh:function(){return er().memoizedState=Lj.bind(null,ot)},useEffectEvent:function(n){var l=er(),c={impl:n};return l.memoizedState=c,function(){if((Nt&2)!==0)throw Error(r(440));return c.impl.apply(void 0,arguments)}}},Nv={readContext:za,use:od,useCallback:Bx,useContext:za,useEffect:bv,useImperativeHandle:kx,useInsertionEffect:Dx,useLayoutEffect:Ox,useMemo:Lx,useReducer:ud,useRef:jx,useState:function(){return ud(On)},useDebugValue:wv,useDeferredValue:function(n,l){var c=oa();return zx(c,kt.memoizedState,n,l)},useTransition:function(){var n=ud(On)[0],l=oa().memoizedState;return[typeof n=="boolean"?n:su(n),l]},useSyncExternalStore:dx,useId:qx,useHostTransitionStatus:Tv,useFormState:Tx,useActionState:Tx,useOptimistic:function(n,l){var c=oa();return mx(c,kt,n,l)},useMemoCache:pv,useCacheRefresh:Ix};Nv.useEffectEvent=Mx;var Qx={readContext:za,use:od,useCallback:Bx,useContext:za,useEffect:bv,useImperativeHandle:kx,useInsertionEffect:Dx,useLayoutEffect:Ox,useMemo:Lx,useReducer:mv,useRef:jx,useState:function(){return mv(On)},useDebugValue:wv,useDeferredValue:function(n,l){var c=oa();return kt===null?Sv(c,n,l):zx(c,kt.memoizedState,n,l)},useTransition:function(){var n=mv(On)[0],l=oa().memoizedState;return[typeof n=="boolean"?n:su(n),l]},useSyncExternalStore:dx,useId:qx,useHostTransitionStatus:Tv,useFormState:Nx,useActionState:Nx,useOptimistic:function(n,l){var c=oa();return kt!==null?mx(c,kt,n,l):(c.baseState=n,[n,c.queue.dispatch])},useMemoCache:pv,useCacheRefresh:Ix};Qx.useEffectEvent=Mx;function jv(n,l,c,v){l=n.memoizedState,c=c(v,l),c=c==null?l:p({},l,c),n.memoizedState=c,n.lanes===0&&(n.updateQueue.baseState=c)}var Av={enqueueSetState:function(n,l,c){n=n._reactInternals;var v=Nr(),b=hi(v);b.payload=l,c!=null&&(b.callback=c),l=vi(n,b,v),l!==null&&(hr(l,n,v),au(l,n,v))},enqueueReplaceState:function(n,l,c){n=n._reactInternals;var v=Nr(),b=hi(v);b.tag=1,b.payload=l,c!=null&&(b.callback=c),l=vi(n,b,v),l!==null&&(hr(l,n,v),au(l,n,v))},enqueueForceUpdate:function(n,l){n=n._reactInternals;var c=Nr(),v=hi(c);v.tag=2,l!=null&&(v.callback=l),l=vi(n,v,c),l!==null&&(hr(l,n,c),au(l,n,c))}};function Yx(n,l,c,v,b,w,O){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(v,w,O):l.prototype&&l.prototype.isPureReactComponent?!Ko(c,v)||!Ko(b,w):!0}function Kx(n,l,c,v){n=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(c,v),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(c,v),l.state!==n&&Av.enqueueReplaceState(l,l.state,null)}function As(n,l){var c=l;if("ref"in l){c={};for(var v in l)v!=="ref"&&(c[v]=l[v])}if(n=n.defaultProps){c===l&&(c=p({},c));for(var b in n)c[b]===void 0&&(c[b]=n[b])}return c}function $x(n){Hc(n)}function Xx(n){console.error(n)}function Zx(n){Hc(n)}function hd(n,l){try{var c=n.onUncaughtError;c(l.value,{componentStack:l.stack})}catch(v){setTimeout(function(){throw v})}}function Wx(n,l,c){try{var v=n.onCaughtError;v(c.value,{componentStack:c.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(b){setTimeout(function(){throw b})}}function Mv(n,l,c){return c=hi(c),c.tag=3,c.payload={element:null},c.callback=function(){hd(n,l)},c}function Jx(n){return n=hi(n),n.tag=3,n}function eb(n,l,c,v){var b=c.type.getDerivedStateFromError;if(typeof b=="function"){var w=v.value;n.payload=function(){return b(w)},n.callback=function(){Wx(l,c,v)}}var O=c.stateNode;O!==null&&typeof O.componentDidCatch=="function"&&(n.callback=function(){Wx(l,c,v),typeof b!="function"&&(bi===null?bi=new Set([this]):bi.add(this));var H=v.stack;this.componentDidCatch(v.value,{componentStack:H!==null?H:""})})}function Pj(n,l,c,v,b){if(c.flags|=32768,v!==null&&typeof v=="object"&&typeof v.then=="function"){if(l=c.alternate,l!==null&&El(l,c,b,!0),c=Sr.current,c!==null){switch(c.tag){case 31:case 13:return qr===null?Cd():c.alternate===null&&ea===0&&(ea=3),c.flags&=-257,c.flags|=65536,c.lanes=b,v===ed?c.flags|=16384:(l=c.updateQueue,l===null?c.updateQueue=new Set([v]):l.add(v),ep(n,v,b)),!1;case 22:return c.flags|=65536,v===ed?c.flags|=16384:(l=c.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([v])},c.updateQueue=l):(c=l.retryQueue,c===null?l.retryQueue=new Set([v]):c.add(v)),ep(n,v,b)),!1}throw Error(r(435,c.tag))}return ep(n,v,b),Cd(),!1}if(mt)return l=Sr.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=b,v!==Kh&&(n=Error(r(422),{cause:v}),Zo(zr(n,c)))):(v!==Kh&&(l=Error(r(423),{cause:v}),Zo(zr(l,c))),n=n.current.alternate,n.flags|=65536,b&=-b,n.lanes|=b,v=zr(v,c),b=Mv(n.stateNode,v,b),iv(n,b),ea!==4&&(ea=2)),!1;var w=Error(r(520),{cause:v});if(w=zr(w,c),gu===null?gu=[w]:gu.push(w),ea!==4&&(ea=2),l===null)return!0;v=zr(v,c),c=l;do{switch(c.tag){case 3:return c.flags|=65536,n=b&-b,c.lanes|=n,n=Mv(c.stateNode,v,n),iv(c,n),!1;case 1:if(l=c.type,w=c.stateNode,(c.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(bi===null||!bi.has(w))))return c.flags|=65536,b&=-b,c.lanes|=b,b=Jx(b),eb(b,n,c,v),iv(c,b),!1}c=c.return}while(c!==null);return!1}var Dv=Error(r(461)),va=!1;function Pa(n,l,c,v){l.child=n===null?nx(l,null,c,v):Ns(l,n.child,c,v)}function tb(n,l,c,v,b){c=c.render;var w=l.ref;if("ref"in v){var O={};for(var H in v)H!=="ref"&&(O[H]=v[H])}else O=v;return Ss(l),v=dv(n,l,c,O,w,b),H=fv(),n!==null&&!va?(hv(n,l,b),Rn(n,l,b)):(mt&&H&&Qh(l),l.flags|=1,Pa(n,l,v,b),l.child)}function ab(n,l,c,v,b){if(n===null){var w=c.type;return typeof w=="function"&&!Fh(w)&&w.defaultProps===void 0&&c.compare===null?(l.tag=15,l.type=w,rb(n,l,w,v,b)):(n=Kc(c.type,null,v,l,l.mode,b),n.ref=l.ref,n.return=l,l.child=n)}if(w=n.child,!_v(n,b)){var O=w.memoizedProps;if(c=c.compare,c=c!==null?c:Ko,c(O,v)&&n.ref===l.ref)return Rn(n,l,b)}return l.flags|=1,n=Nn(w,v),n.ref=l.ref,n.return=l,l.child=n}function rb(n,l,c,v,b){if(n!==null){var w=n.memoizedProps;if(Ko(w,v)&&n.ref===l.ref)if(va=!1,l.pendingProps=v=w,_v(n,b))(n.flags&131072)!==0&&(va=!0);else return l.lanes=n.lanes,Rn(n,l,b)}return Ov(n,l,c,v,b)}function nb(n,l,c,v){var b=v.children,w=n!==null?n.memoizedState:null;if(n===null&&l.stateNode===null&&(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),v.mode==="hidden"){if((l.flags&128)!==0){if(w=w!==null?w.baseLanes|c:c,n!==null){for(v=l.child=n.child,b=0;v!==null;)b=b|v.lanes|v.childLanes,v=v.sibling;v=b&~w}else v=0,l.child=null;return ib(n,l,w,c,v)}if((c&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},n!==null&&Wc(l,w!==null?w.cachePool:null),w!==null?lx(l,w):lv(),ox(l);else return v=l.lanes=536870912,ib(n,l,w!==null?w.baseLanes|c:c,c,v)}else w!==null?(Wc(l,w.cachePool),lx(l,w),gi(),l.memoizedState=null):(n!==null&&Wc(l,null),lv(),gi());return Pa(n,l,b,c),l.child}function uu(n,l){return n!==null&&n.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function ib(n,l,c,v,b){var w=tv();return w=w===null?null:{parent:fa._currentValue,pool:w},l.memoizedState={baseLanes:c,cachePool:w},n!==null&&Wc(l,null),lv(),ox(l),n!==null&&El(n,l,v,!0),l.childLanes=b,null}function vd(n,l){return l=gd({mode:l.mode,children:l.children},n.mode),l.ref=n.ref,n.child=l,l.return=n,l}function sb(n,l,c){return Ns(l,n.child,null,c),n=vd(l,l.pendingProps),n.flags|=2,Er(l),l.memoizedState=null,n}function _j(n,l,c){var v=l.pendingProps,b=(l.flags&128)!==0;if(l.flags&=-129,n===null){if(mt){if(v.mode==="hidden")return n=vd(l,v),l.lanes=536870912,uu(null,n);if(uv(l),(n=It)?(n=y1(n,Ur),n=n!==null&&n.data==="&"?n:null,n!==null&&(l.memoizedState={dehydrated:n,treeContext:oi!==null?{id:on,overflow:un}:null,retryLane:536870912,hydrationErrors:null},c=Fy(n),c.return=l,l.child=c,La=l,It=null)):n=null,n===null)throw ci(l);return l.lanes=536870912,null}return vd(l,v)}var w=n.memoizedState;if(w!==null){var O=w.dehydrated;if(uv(l),b)if(l.flags&256)l.flags&=-257,l=sb(n,l,c);else if(l.memoizedState!==null)l.child=n.child,l.flags|=128,l=null;else throw Error(r(558));else if(va||El(n,l,c,!1),b=(c&n.childLanes)!==0,va||b){if(v=Pt,v!==null&&(O=Wt(v,c),O!==0&&O!==w.retryLane))throw w.retryLane=O,ys(n,O),hr(v,n,O),Dv;Cd(),l=sb(n,l,c)}else n=w.treeContext,It=Ir(O.nextSibling),La=l,mt=!0,ui=null,Ur=!1,n!==null&&Qy(l,n),l=vd(l,v),l.flags|=4096;return l}return n=Nn(n.child,{mode:v.mode,children:v.children}),n.ref=l.ref,l.child=n,n.return=l,n}function pd(n,l){var c=l.ref;if(c===null)n!==null&&n.ref!==null&&(l.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(r(284));(n===null||n.ref!==c)&&(l.flags|=4194816)}}function Ov(n,l,c,v,b){return Ss(l),c=dv(n,l,c,v,void 0,b),v=fv(),n!==null&&!va?(hv(n,l,b),Rn(n,l,b)):(mt&&v&&Qh(l),l.flags|=1,Pa(n,l,c,b),l.child)}function lb(n,l,c,v,b,w){return Ss(l),l.updateQueue=null,c=cx(l,v,c,b),ux(n),v=fv(),n!==null&&!va?(hv(n,l,w),Rn(n,l,w)):(mt&&v&&Qh(l),l.flags|=1,Pa(n,l,c,w),l.child)}function ob(n,l,c,v,b){if(Ss(l),l.stateNode===null){var w=xl,O=c.contextType;typeof O=="object"&&O!==null&&(w=za(O)),w=new c(v,w),l.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,w.updater=Av,l.stateNode=w,w._reactInternals=l,w=l.stateNode,w.props=v,w.state=l.memoizedState,w.refs={},rv(l),O=c.contextType,w.context=typeof O=="object"&&O!==null?za(O):xl,w.state=l.memoizedState,O=c.getDerivedStateFromProps,typeof O=="function"&&(jv(l,c,O,v),w.state=l.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof w.getSnapshotBeforeUpdate=="function"||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(O=w.state,typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount(),O!==w.state&&Av.enqueueReplaceState(w,w.state,null),nu(l,v,w,b),ru(),w.state=l.memoizedState),typeof w.componentDidMount=="function"&&(l.flags|=4194308),v=!0}else if(n===null){w=l.stateNode;var H=l.memoizedProps,te=As(c,H);w.props=te;var fe=w.context,be=c.contextType;O=xl,typeof be=="object"&&be!==null&&(O=za(be));var Ce=c.getDerivedStateFromProps;be=typeof Ce=="function"||typeof w.getSnapshotBeforeUpdate=="function",H=l.pendingProps!==H,be||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(H||fe!==O)&&Kx(l,w,v,O),fi=!1;var ve=l.memoizedState;w.state=ve,nu(l,v,w,b),ru(),fe=l.memoizedState,H||ve!==fe||fi?(typeof Ce=="function"&&(jv(l,c,Ce,v),fe=l.memoizedState),(te=fi||Yx(l,c,te,v,ve,fe,O))?(be||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount()),typeof w.componentDidMount=="function"&&(l.flags|=4194308)):(typeof w.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=v,l.memoizedState=fe),w.props=v,w.state=fe,w.context=O,v=te):(typeof w.componentDidMount=="function"&&(l.flags|=4194308),v=!1)}else{w=l.stateNode,nv(n,l),O=l.memoizedProps,be=As(c,O),w.props=be,Ce=l.pendingProps,ve=w.context,fe=c.contextType,te=xl,typeof fe=="object"&&fe!==null&&(te=za(fe)),H=c.getDerivedStateFromProps,(fe=typeof H=="function"||typeof w.getSnapshotBeforeUpdate=="function")||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(O!==Ce||ve!==te)&&Kx(l,w,v,te),fi=!1,ve=l.memoizedState,w.state=ve,nu(l,v,w,b),ru();var ye=l.memoizedState;O!==Ce||ve!==ye||fi||n!==null&&n.dependencies!==null&&Xc(n.dependencies)?(typeof H=="function"&&(jv(l,c,H,v),ye=l.memoizedState),(be=fi||Yx(l,c,be,v,ve,ye,te)||n!==null&&n.dependencies!==null&&Xc(n.dependencies))?(fe||typeof w.UNSAFE_componentWillUpdate!="function"&&typeof w.componentWillUpdate!="function"||(typeof w.componentWillUpdate=="function"&&w.componentWillUpdate(v,ye,te),typeof w.UNSAFE_componentWillUpdate=="function"&&w.UNSAFE_componentWillUpdate(v,ye,te)),typeof w.componentDidUpdate=="function"&&(l.flags|=4),typeof w.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof w.componentDidUpdate!="function"||O===n.memoizedProps&&ve===n.memoizedState||(l.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||O===n.memoizedProps&&ve===n.memoizedState||(l.flags|=1024),l.memoizedProps=v,l.memoizedState=ye),w.props=v,w.state=ye,w.context=te,v=be):(typeof w.componentDidUpdate!="function"||O===n.memoizedProps&&ve===n.memoizedState||(l.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||O===n.memoizedProps&&ve===n.memoizedState||(l.flags|=1024),v=!1)}return w=v,pd(n,l),v=(l.flags&128)!==0,w||v?(w=l.stateNode,c=v&&typeof c.getDerivedStateFromError!="function"?null:w.render(),l.flags|=1,n!==null&&v?(l.child=Ns(l,n.child,null,b),l.child=Ns(l,null,c,b)):Pa(n,l,c,b),l.memoizedState=w.state,n=l.child):n=Rn(n,l,b),n}function ub(n,l,c,v){return bs(),l.flags|=256,Pa(n,l,c,v),l.child}var Rv={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function kv(n){return{baseLanes:n,cachePool:Wy()}}function Bv(n,l,c){return n=n!==null?n.childLanes&~c:0,l&&(n|=Cr),n}function cb(n,l,c){var v=l.pendingProps,b=!1,w=(l.flags&128)!==0,O;if((O=w)||(O=n!==null&&n.memoizedState===null?!1:(la.current&2)!==0),O&&(b=!0,l.flags&=-129),O=(l.flags&32)!==0,l.flags&=-33,n===null){if(mt){if(b?pi(l):gi(),(n=It)?(n=y1(n,Ur),n=n!==null&&n.data!=="&"?n:null,n!==null&&(l.memoizedState={dehydrated:n,treeContext:oi!==null?{id:on,overflow:un}:null,retryLane:536870912,hydrationErrors:null},c=Fy(n),c.return=l,l.child=c,La=l,It=null)):n=null,n===null)throw ci(l);return gp(n)?l.lanes=32:l.lanes=536870912,null}var H=v.children;return v=v.fallback,b?(gi(),b=l.mode,H=gd({mode:"hidden",children:H},b),v=xs(v,b,c,null),H.return=l,v.return=l,H.sibling=v,l.child=H,v=l.child,v.memoizedState=kv(c),v.childLanes=Bv(n,O,c),l.memoizedState=Rv,uu(null,v)):(pi(l),Lv(l,H))}var te=n.memoizedState;if(te!==null&&(H=te.dehydrated,H!==null)){if(w)l.flags&256?(pi(l),l.flags&=-257,l=zv(n,l,c)):l.memoizedState!==null?(gi(),l.child=n.child,l.flags|=128,l=null):(gi(),H=v.fallback,b=l.mode,v=gd({mode:"visible",children:v.children},b),H=xs(H,b,c,null),H.flags|=2,v.return=l,H.return=l,v.sibling=H,l.child=v,Ns(l,n.child,null,c),v=l.child,v.memoizedState=kv(c),v.childLanes=Bv(n,O,c),l.memoizedState=Rv,l=uu(null,v));else if(pi(l),gp(H)){if(O=H.nextSibling&&H.nextSibling.dataset,O)var fe=O.dgst;O=fe,v=Error(r(419)),v.stack="",v.digest=O,Zo({value:v,source:null,stack:null}),l=zv(n,l,c)}else if(va||El(n,l,c,!1),O=(c&n.childLanes)!==0,va||O){if(O=Pt,O!==null&&(v=Wt(O,c),v!==0&&v!==te.retryLane))throw te.retryLane=v,ys(n,v),hr(O,n,v),Dv;pp(H)||Cd(),l=zv(n,l,c)}else pp(H)?(l.flags|=192,l.child=n.child,l=null):(n=te.treeContext,It=Ir(H.nextSibling),La=l,mt=!0,ui=null,Ur=!1,n!==null&&Qy(l,n),l=Lv(l,v.children),l.flags|=4096);return l}return b?(gi(),H=v.fallback,b=l.mode,te=n.child,fe=te.sibling,v=Nn(te,{mode:"hidden",children:v.children}),v.subtreeFlags=te.subtreeFlags&65011712,fe!==null?H=Nn(fe,H):(H=xs(H,b,c,null),H.flags|=2),H.return=l,v.return=l,v.sibling=H,l.child=v,uu(null,v),v=l.child,H=n.child.memoizedState,H===null?H=kv(c):(b=H.cachePool,b!==null?(te=fa._currentValue,b=b.parent!==te?{parent:te,pool:te}:b):b=Wy(),H={baseLanes:H.baseLanes|c,cachePool:b}),v.memoizedState=H,v.childLanes=Bv(n,O,c),l.memoizedState=Rv,uu(n.child,v)):(pi(l),c=n.child,n=c.sibling,c=Nn(c,{mode:"visible",children:v.children}),c.return=l,c.sibling=null,n!==null&&(O=l.deletions,O===null?(l.deletions=[n],l.flags|=16):O.push(n)),l.child=c,l.memoizedState=null,c)}function Lv(n,l){return l=gd({mode:"visible",children:l},n.mode),l.return=n,n.child=l}function gd(n,l){return n=wr(22,n,null,l),n.lanes=0,n}function zv(n,l,c){return Ns(l,n.child,null,c),n=Lv(l,l.pendingProps.children),n.flags|=2,l.memoizedState=null,n}function db(n,l,c){n.lanes|=l;var v=n.alternate;v!==null&&(v.lanes|=l),Zh(n.return,l,c)}function Pv(n,l,c,v,b,w){var O=n.memoizedState;O===null?n.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:v,tail:c,tailMode:b,treeForkCount:w}:(O.isBackwards=l,O.rendering=null,O.renderingStartTime=0,O.last=v,O.tail=c,O.tailMode=b,O.treeForkCount=w)}function fb(n,l,c){var v=l.pendingProps,b=v.revealOrder,w=v.tail;v=v.children;var O=la.current,H=(O&2)!==0;if(H?(O=O&1|2,l.flags|=128):O&=1,X(la,O),Pa(n,l,v,c),v=mt?Xo:0,!H&&n!==null&&(n.flags&128)!==0)e:for(n=l.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&db(n,c,l);else if(n.tag===19)db(n,c,l);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===l)break e;for(;n.sibling===null;){if(n.return===null||n.return===l)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(b){case"forwards":for(c=l.child,b=null;c!==null;)n=c.alternate,n!==null&&nd(n)===null&&(b=c),c=c.sibling;c=b,c===null?(b=l.child,l.child=null):(b=c.sibling,c.sibling=null),Pv(l,!1,b,c,w,v);break;case"backwards":case"unstable_legacy-backwards":for(c=null,b=l.child,l.child=null;b!==null;){if(n=b.alternate,n!==null&&nd(n)===null){l.child=b;break}n=b.sibling,b.sibling=c,c=b,b=n}Pv(l,!0,c,null,w,v);break;case"together":Pv(l,!1,null,null,void 0,v);break;default:l.memoizedState=null}return l.child}function Rn(n,l,c){if(n!==null&&(l.dependencies=n.dependencies),xi|=l.lanes,(c&l.childLanes)===0)if(n!==null){if(El(n,l,c,!1),(c&l.childLanes)===0)return null}else return null;if(n!==null&&l.child!==n.child)throw Error(r(153));if(l.child!==null){for(n=l.child,c=Nn(n,n.pendingProps),l.child=c,c.return=l;n.sibling!==null;)n=n.sibling,c=c.sibling=Nn(n,n.pendingProps),c.return=l;c.sibling=null}return l.child}function _v(n,l){return(n.lanes&l)!==0?!0:(n=n.dependencies,!!(n!==null&&Xc(n)))}function Uj(n,l,c){switch(l.tag){case 3:he(l,l.stateNode.containerInfo),di(l,fa,n.memoizedState.cache),bs();break;case 27:case 5:ae(l);break;case 4:he(l,l.stateNode.containerInfo);break;case 10:di(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,uv(l),null;break;case 13:var v=l.memoizedState;if(v!==null)return v.dehydrated!==null?(pi(l),l.flags|=128,null):(c&l.child.childLanes)!==0?cb(n,l,c):(pi(l),n=Rn(n,l,c),n!==null?n.sibling:null);pi(l);break;case 19:var b=(n.flags&128)!==0;if(v=(c&l.childLanes)!==0,v||(El(n,l,c,!1),v=(c&l.childLanes)!==0),b){if(v)return fb(n,l,c);l.flags|=128}if(b=l.memoizedState,b!==null&&(b.rendering=null,b.tail=null,b.lastEffect=null),X(la,la.current),v)break;return null;case 22:return l.lanes=0,nb(n,l,c,l.pendingProps);case 24:di(l,fa,n.memoizedState.cache)}return Rn(n,l,c)}function hb(n,l,c){if(n!==null)if(n.memoizedProps!==l.pendingProps)va=!0;else{if(!_v(n,c)&&(l.flags&128)===0)return va=!1,Uj(n,l,c);va=(n.flags&131072)!==0}else va=!1,mt&&(l.flags&1048576)!==0&&Gy(l,Xo,l.index);switch(l.lanes=0,l.tag){case 16:e:{var v=l.pendingProps;if(n=Ts(l.elementType),l.type=n,typeof n=="function")Fh(n)?(v=As(n,v),l.tag=1,l=ob(null,l,n,v,c)):(l.tag=0,l=Ov(null,l,n,v,c));else{if(n!=null){var b=n.$$typeof;if(b===A){l.tag=11,l=tb(null,l,n,v,c);break e}else if(b===j){l.tag=14,l=ab(null,l,n,v,c);break e}}throw l=V(n)||n,Error(r(306,l,""))}}return l;case 0:return Ov(n,l,l.type,l.pendingProps,c);case 1:return v=l.type,b=As(v,l.pendingProps),ob(n,l,v,b,c);case 3:e:{if(he(l,l.stateNode.containerInfo),n===null)throw Error(r(387));v=l.pendingProps;var w=l.memoizedState;b=w.element,nv(n,l),nu(l,v,null,c);var O=l.memoizedState;if(v=O.cache,di(l,fa,v),v!==w.cache&&Wh(l,[fa],c,!0),ru(),v=O.element,w.isDehydrated)if(w={element:v,isDehydrated:!1,cache:O.cache},l.updateQueue.baseState=w,l.memoizedState=w,l.flags&256){l=ub(n,l,v,c);break e}else if(v!==b){b=zr(Error(r(424)),l),Zo(b),l=ub(n,l,v,c);break e}else{switch(n=l.stateNode.containerInfo,n.nodeType){case 9:n=n.body;break;default:n=n.nodeName==="HTML"?n.ownerDocument.body:n}for(It=Ir(n.firstChild),La=l,mt=!0,ui=null,Ur=!0,c=nx(l,null,v,c),l.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(bs(),v===b){l=Rn(n,l,c);break e}Pa(n,l,v,c)}l=l.child}return l;case 26:return pd(n,l),n===null?(c=T1(l.type,null,l.pendingProps,null))?l.memoizedState=c:mt||(c=l.type,n=l.pendingProps,v=Rd(ee.current).createElement(c),v[Ht]=l,v[ya]=n,_a(v,c,n),da(v),l.stateNode=v):l.memoizedState=T1(l.type,n.memoizedProps,l.pendingProps,n.memoizedState),null;case 27:return ae(l),n===null&&mt&&(v=l.stateNode=w1(l.type,l.pendingProps,ee.current),La=l,Ur=!0,b=It,Ti(l.type)?(mp=b,It=Ir(v.firstChild)):It=b),Pa(n,l,l.pendingProps.children,c),pd(n,l),n===null&&(l.flags|=4194304),l.child;case 5:return n===null&&mt&&((b=v=It)&&(v=p5(v,l.type,l.pendingProps,Ur),v!==null?(l.stateNode=v,La=l,It=Ir(v.firstChild),Ur=!1,b=!0):b=!1),b||ci(l)),ae(l),b=l.type,w=l.pendingProps,O=n!==null?n.memoizedProps:null,v=w.children,fp(b,w)?v=null:O!==null&&fp(b,O)&&(l.flags|=32),l.memoizedState!==null&&(b=dv(n,l,Dj,null,null,c),Tu._currentValue=b),pd(n,l),Pa(n,l,v,c),l.child;case 6:return n===null&&mt&&((n=c=It)&&(c=g5(c,l.pendingProps,Ur),c!==null?(l.stateNode=c,La=l,It=null,n=!0):n=!1),n||ci(l)),null;case 13:return cb(n,l,c);case 4:return he(l,l.stateNode.containerInfo),v=l.pendingProps,n===null?l.child=Ns(l,null,v,c):Pa(n,l,v,c),l.child;case 11:return tb(n,l,l.type,l.pendingProps,c);case 7:return Pa(n,l,l.pendingProps,c),l.child;case 8:return Pa(n,l,l.pendingProps.children,c),l.child;case 12:return Pa(n,l,l.pendingProps.children,c),l.child;case 10:return v=l.pendingProps,di(l,l.type,v.value),Pa(n,l,v.children,c),l.child;case 9:return b=l.type._context,v=l.pendingProps.children,Ss(l),b=za(b),v=v(b),l.flags|=1,Pa(n,l,v,c),l.child;case 14:return ab(n,l,l.type,l.pendingProps,c);case 15:return rb(n,l,l.type,l.pendingProps,c);case 19:return fb(n,l,c);case 31:return _j(n,l,c);case 22:return nb(n,l,c,l.pendingProps);case 24:return Ss(l),v=za(fa),n===null?(b=tv(),b===null&&(b=Pt,w=Jh(),b.pooledCache=w,w.refCount++,w!==null&&(b.pooledCacheLanes|=c),b=w),l.memoizedState={parent:v,cache:b},rv(l),di(l,fa,b)):((n.lanes&c)!==0&&(nv(n,l),nu(l,null,null,c),ru()),b=n.memoizedState,w=l.memoizedState,b.parent!==v?(b={parent:v,cache:v},l.memoizedState=b,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=b),di(l,fa,v)):(v=w.cache,di(l,fa,v),v!==b.cache&&Wh(l,[fa],c,!0))),Pa(n,l,l.pendingProps.children,c),l.child;case 29:throw l.pendingProps}throw Error(r(156,l.tag))}function kn(n){n.flags|=4}function Uv(n,l,c,v,b){if((l=(n.mode&32)!==0)&&(l=!1),l){if(n.flags|=16777216,(b&335544128)===b)if(n.stateNode.complete)n.flags|=8192;else if(qb())n.flags|=8192;else throw Cs=ed,av}else n.flags&=-16777217}function vb(n,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!M1(l))if(qb())n.flags|=8192;else throw Cs=ed,av}function md(n,l){l!==null&&(n.flags|=4),n.flags&16384&&(l=n.tag!==22?ut():536870912,n.lanes|=l,Ll|=l)}function cu(n,l){if(!mt)switch(n.tailMode){case"hidden":l=n.tail;for(var c=null;l!==null;)l.alternate!==null&&(c=l),l=l.sibling;c===null?n.tail=null:c.sibling=null;break;case"collapsed":c=n.tail;for(var v=null;c!==null;)c.alternate!==null&&(v=c),c=c.sibling;v===null?l||n.tail===null?n.tail=null:n.tail.sibling=null:v.sibling=null}}function Vt(n){var l=n.alternate!==null&&n.alternate.child===n.child,c=0,v=0;if(l)for(var b=n.child;b!==null;)c|=b.lanes|b.childLanes,v|=b.subtreeFlags&65011712,v|=b.flags&65011712,b.return=n,b=b.sibling;else for(b=n.child;b!==null;)c|=b.lanes|b.childLanes,v|=b.subtreeFlags,v|=b.flags,b.return=n,b=b.sibling;return n.subtreeFlags|=v,n.childLanes=c,l}function qj(n,l,c){var v=l.pendingProps;switch(Yh(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Vt(l),null;case 1:return Vt(l),null;case 3:return c=l.stateNode,v=null,n!==null&&(v=n.memoizedState.cache),l.memoizedState.cache!==v&&(l.flags|=2048),Mn(fa),oe(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(n===null||n.child===null)&&(Sl(l)?kn(l):n===null||n.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,$h())),Vt(l),null;case 26:var b=l.type,w=l.memoizedState;return n===null?(kn(l),w!==null?(Vt(l),vb(l,w)):(Vt(l),Uv(l,b,null,v,c))):w?w!==n.memoizedState?(kn(l),Vt(l),vb(l,w)):(Vt(l),l.flags&=-16777217):(n=n.memoizedProps,n!==v&&kn(l),Vt(l),Uv(l,b,n,v,c)),null;case 27:if(re(l),c=ee.current,b=l.type,n!==null&&l.stateNode!=null)n.memoizedProps!==v&&kn(l);else{if(!v){if(l.stateNode===null)throw Error(r(166));return Vt(l),null}n=W.current,Sl(l)?Yy(l):(n=w1(b,v,c),l.stateNode=n,kn(l))}return Vt(l),null;case 5:if(re(l),b=l.type,n!==null&&l.stateNode!=null)n.memoizedProps!==v&&kn(l);else{if(!v){if(l.stateNode===null)throw Error(r(166));return Vt(l),null}if(w=W.current,Sl(l))Yy(l);else{var O=Rd(ee.current);switch(w){case 1:w=O.createElementNS("http://www.w3.org/2000/svg",b);break;case 2:w=O.createElementNS("http://www.w3.org/1998/Math/MathML",b);break;default:switch(b){case"svg":w=O.createElementNS("http://www.w3.org/2000/svg",b);break;case"math":w=O.createElementNS("http://www.w3.org/1998/Math/MathML",b);break;case"script":w=O.createElement("div"),w.innerHTML="<script><\/script>",w=w.removeChild(w.firstChild);break;case"select":w=typeof v.is=="string"?O.createElement("select",{is:v.is}):O.createElement("select"),v.multiple?w.multiple=!0:v.size&&(w.size=v.size);break;default:w=typeof v.is=="string"?O.createElement(b,{is:v.is}):O.createElement(b)}}w[Ht]=l,w[ya]=v;e:for(O=l.child;O!==null;){if(O.tag===5||O.tag===6)w.appendChild(O.stateNode);else if(O.tag!==4&&O.tag!==27&&O.child!==null){O.child.return=O,O=O.child;continue}if(O===l)break e;for(;O.sibling===null;){if(O.return===null||O.return===l)break e;O=O.return}O.sibling.return=O.return,O=O.sibling}l.stateNode=w;e:switch(_a(w,b,v),b){case"button":case"input":case"select":case"textarea":v=!!v.autoFocus;break e;case"img":v=!0;break e;default:v=!1}v&&kn(l)}}return Vt(l),Uv(l,l.type,n===null?null:n.memoizedProps,l.pendingProps,c),null;case 6:if(n&&l.stateNode!=null)n.memoizedProps!==v&&kn(l);else{if(typeof v!="string"&&l.stateNode===null)throw Error(r(166));if(n=ee.current,Sl(l)){if(n=l.stateNode,c=l.memoizedProps,v=null,b=La,b!==null)switch(b.tag){case 27:case 5:v=b.memoizedProps}n[Ht]=l,n=!!(n.nodeValue===c||v!==null&&v.suppressHydrationWarning===!0||c1(n.nodeValue,c)),n||ci(l,!0)}else n=Rd(n).createTextNode(v),n[Ht]=l,l.stateNode=n}return Vt(l),null;case 31:if(c=l.memoizedState,n===null||n.memoizedState!==null){if(v=Sl(l),c!==null){if(n===null){if(!v)throw Error(r(318));if(n=l.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(557));n[Ht]=l}else bs(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Vt(l),n=!1}else c=$h(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=c),n=!0;if(!n)return l.flags&256?(Er(l),l):(Er(l),null);if((l.flags&128)!==0)throw Error(r(558))}return Vt(l),null;case 13:if(v=l.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(b=Sl(l),v!==null&&v.dehydrated!==null){if(n===null){if(!b)throw Error(r(318));if(b=l.memoizedState,b=b!==null?b.dehydrated:null,!b)throw Error(r(317));b[Ht]=l}else bs(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Vt(l),b=!1}else b=$h(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=b),b=!0;if(!b)return l.flags&256?(Er(l),l):(Er(l),null)}return Er(l),(l.flags&128)!==0?(l.lanes=c,l):(c=v!==null,n=n!==null&&n.memoizedState!==null,c&&(v=l.child,b=null,v.alternate!==null&&v.alternate.memoizedState!==null&&v.alternate.memoizedState.cachePool!==null&&(b=v.alternate.memoizedState.cachePool.pool),w=null,v.memoizedState!==null&&v.memoizedState.cachePool!==null&&(w=v.memoizedState.cachePool.pool),w!==b&&(v.flags|=2048)),c!==n&&c&&(l.child.flags|=8192),md(l,l.updateQueue),Vt(l),null);case 4:return oe(),n===null&&lp(l.stateNode.containerInfo),Vt(l),null;case 10:return Mn(l.type),Vt(l),null;case 19:if(G(la),v=l.memoizedState,v===null)return Vt(l),null;if(b=(l.flags&128)!==0,w=v.rendering,w===null)if(b)cu(v,!1);else{if(ea!==0||n!==null&&(n.flags&128)!==0)for(n=l.child;n!==null;){if(w=nd(n),w!==null){for(l.flags|=128,cu(v,!1),n=w.updateQueue,l.updateQueue=n,md(l,n),l.subtreeFlags=0,n=c,c=l.child;c!==null;)Vy(c,n),c=c.sibling;return X(la,la.current&1|2),mt&&jn(l,v.treeForkCount),l.child}n=n.sibling}v.tail!==null&&Re()>Sd&&(l.flags|=128,b=!0,cu(v,!1),l.lanes=4194304)}else{if(!b)if(n=nd(w),n!==null){if(l.flags|=128,b=!0,n=n.updateQueue,l.updateQueue=n,md(l,n),cu(v,!0),v.tail===null&&v.tailMode==="hidden"&&!w.alternate&&!mt)return Vt(l),null}else 2*Re()-v.renderingStartTime>Sd&&c!==536870912&&(l.flags|=128,b=!0,cu(v,!1),l.lanes=4194304);v.isBackwards?(w.sibling=l.child,l.child=w):(n=v.last,n!==null?n.sibling=w:l.child=w,v.last=w)}return v.tail!==null?(n=v.tail,v.rendering=n,v.tail=n.sibling,v.renderingStartTime=Re(),n.sibling=null,c=la.current,X(la,b?c&1|2:c&1),mt&&jn(l,v.treeForkCount),n):(Vt(l),null);case 22:case 23:return Er(l),ov(),v=l.memoizedState!==null,n!==null?n.memoizedState!==null!==v&&(l.flags|=8192):v&&(l.flags|=8192),v?(c&536870912)!==0&&(l.flags&128)===0&&(Vt(l),l.subtreeFlags&6&&(l.flags|=8192)):Vt(l),c=l.updateQueue,c!==null&&md(l,c.retryQueue),c=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(c=n.memoizedState.cachePool.pool),v=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(v=l.memoizedState.cachePool.pool),v!==c&&(l.flags|=2048),n!==null&&G(Es),null;case 24:return c=null,n!==null&&(c=n.memoizedState.cache),l.memoizedState.cache!==c&&(l.flags|=2048),Mn(fa),Vt(l),null;case 25:return null;case 30:return null}throw Error(r(156,l.tag))}function Ij(n,l){switch(Yh(l),l.tag){case 1:return n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 3:return Mn(fa),oe(),n=l.flags,(n&65536)!==0&&(n&128)===0?(l.flags=n&-65537|128,l):null;case 26:case 27:case 5:return re(l),null;case 31:if(l.memoizedState!==null){if(Er(l),l.alternate===null)throw Error(r(340));bs()}return n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 13:if(Er(l),n=l.memoizedState,n!==null&&n.dehydrated!==null){if(l.alternate===null)throw Error(r(340));bs()}return n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 19:return G(la),null;case 4:return oe(),null;case 10:return Mn(l.type),null;case 22:case 23:return Er(l),ov(),n!==null&&G(Es),n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 24:return Mn(fa),null;case 25:return null;default:return null}}function pb(n,l){switch(Yh(l),l.tag){case 3:Mn(fa),oe();break;case 26:case 27:case 5:re(l);break;case 4:oe();break;case 31:l.memoizedState!==null&&Er(l);break;case 13:Er(l);break;case 19:G(la);break;case 10:Mn(l.type);break;case 22:case 23:Er(l),ov(),n!==null&&G(Es);break;case 24:Mn(fa)}}function du(n,l){try{var c=l.updateQueue,v=c!==null?c.lastEffect:null;if(v!==null){var b=v.next;c=b;do{if((c.tag&n)===n){v=void 0;var w=c.create,O=c.inst;v=w(),O.destroy=v}c=c.next}while(c!==b)}}catch(H){Ot(l,l.return,H)}}function mi(n,l,c){try{var v=l.updateQueue,b=v!==null?v.lastEffect:null;if(b!==null){var w=b.next;v=w;do{if((v.tag&n)===n){var O=v.inst,H=O.destroy;if(H!==void 0){O.destroy=void 0,b=l;var te=c,fe=H;try{fe()}catch(be){Ot(b,te,be)}}}v=v.next}while(v!==w)}}catch(be){Ot(l,l.return,be)}}function gb(n){var l=n.updateQueue;if(l!==null){var c=n.stateNode;try{sx(l,c)}catch(v){Ot(n,n.return,v)}}}function mb(n,l,c){c.props=As(n.type,n.memoizedProps),c.state=n.memoizedState;try{c.componentWillUnmount()}catch(v){Ot(n,l,v)}}function fu(n,l){try{var c=n.ref;if(c!==null){switch(n.tag){case 26:case 27:case 5:var v=n.stateNode;break;case 30:v=n.stateNode;break;default:v=n.stateNode}typeof c=="function"?n.refCleanup=c(v):c.current=v}}catch(b){Ot(n,l,b)}}function cn(n,l){var c=n.ref,v=n.refCleanup;if(c!==null)if(typeof v=="function")try{v()}catch(b){Ot(n,l,b)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(b){Ot(n,l,b)}else c.current=null}function yb(n){var l=n.type,c=n.memoizedProps,v=n.stateNode;try{e:switch(l){case"button":case"input":case"select":case"textarea":c.autoFocus&&v.focus();break e;case"img":c.src?v.src=c.src:c.srcSet&&(v.srcset=c.srcSet)}}catch(b){Ot(n,n.return,b)}}function qv(n,l,c){try{var v=n.stateNode;u5(v,n.type,c,l),v[ya]=l}catch(b){Ot(n,n.return,b)}}function xb(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Ti(n.type)||n.tag===4}function Iv(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||xb(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&Ti(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Vv(n,l,c){var v=n.tag;if(v===5||v===6)n=n.stateNode,l?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(n,l):(l=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,l.appendChild(n),c=c._reactRootContainer,c!=null||l.onclick!==null||(l.onclick=Tn));else if(v!==4&&(v===27&&Ti(n.type)&&(c=n.stateNode,l=null),n=n.child,n!==null))for(Vv(n,l,c),n=n.sibling;n!==null;)Vv(n,l,c),n=n.sibling}function yd(n,l,c){var v=n.tag;if(v===5||v===6)n=n.stateNode,l?c.insertBefore(n,l):c.appendChild(n);else if(v!==4&&(v===27&&Ti(n.type)&&(c=n.stateNode),n=n.child,n!==null))for(yd(n,l,c),n=n.sibling;n!==null;)yd(n,l,c),n=n.sibling}function bb(n){var l=n.stateNode,c=n.memoizedProps;try{for(var v=n.type,b=l.attributes;b.length;)l.removeAttributeNode(b[0]);_a(l,v,c),l[Ht]=n,l[ya]=c}catch(w){Ot(n,n.return,w)}}var Bn=!1,pa=!1,Fv=!1,wb=typeof WeakSet=="function"?WeakSet:Set,Ma=null;function Vj(n,l){if(n=n.containerInfo,cp=Ud,n=ky(n),zh(n)){if("selectionStart"in n)var c={start:n.selectionStart,end:n.selectionEnd};else e:{c=(c=n.ownerDocument)&&c.defaultView||window;var v=c.getSelection&&c.getSelection();if(v&&v.rangeCount!==0){c=v.anchorNode;var b=v.anchorOffset,w=v.focusNode;v=v.focusOffset;try{c.nodeType,w.nodeType}catch{c=null;break e}var O=0,H=-1,te=-1,fe=0,be=0,Ce=n,ve=null;t:for(;;){for(var ye;Ce!==c||b!==0&&Ce.nodeType!==3||(H=O+b),Ce!==w||v!==0&&Ce.nodeType!==3||(te=O+v),Ce.nodeType===3&&(O+=Ce.nodeValue.length),(ye=Ce.firstChild)!==null;)ve=Ce,Ce=ye;for(;;){if(Ce===n)break t;if(ve===c&&++fe===b&&(H=O),ve===w&&++be===v&&(te=O),(ye=Ce.nextSibling)!==null)break;Ce=ve,ve=Ce.parentNode}Ce=ye}c=H===-1||te===-1?null:{start:H,end:te}}else c=null}c=c||{start:0,end:0}}else c=null;for(dp={focusedElem:n,selectionRange:c},Ud=!1,Ma=l;Ma!==null;)if(l=Ma,n=l.child,(l.subtreeFlags&1028)!==0&&n!==null)n.return=l,Ma=n;else for(;Ma!==null;){switch(l=Ma,w=l.alternate,n=l.flags,l.tag){case 0:if((n&4)!==0&&(n=l.updateQueue,n=n!==null?n.events:null,n!==null))for(c=0;c<n.length;c++)b=n[c],b.ref.impl=b.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&w!==null){n=void 0,c=l,b=w.memoizedProps,w=w.memoizedState,v=c.stateNode;try{var Ve=As(c.type,b);n=v.getSnapshotBeforeUpdate(Ve,w),v.__reactInternalSnapshotBeforeUpdate=n}catch(at){Ot(c,c.return,at)}}break;case 3:if((n&1024)!==0){if(n=l.stateNode.containerInfo,c=n.nodeType,c===9)vp(n);else if(c===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":vp(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((n&1024)!==0)throw Error(r(163))}if(n=l.sibling,n!==null){n.return=l.return,Ma=n;break}Ma=l.return}}function Sb(n,l,c){var v=c.flags;switch(c.tag){case 0:case 11:case 15:zn(n,c),v&4&&du(5,c);break;case 1:if(zn(n,c),v&4)if(n=c.stateNode,l===null)try{n.componentDidMount()}catch(O){Ot(c,c.return,O)}else{var b=As(c.type,l.memoizedProps);l=l.memoizedState;try{n.componentDidUpdate(b,l,n.__reactInternalSnapshotBeforeUpdate)}catch(O){Ot(c,c.return,O)}}v&64&&gb(c),v&512&&fu(c,c.return);break;case 3:if(zn(n,c),v&64&&(n=c.updateQueue,n!==null)){if(l=null,c.child!==null)switch(c.child.tag){case 27:case 5:l=c.child.stateNode;break;case 1:l=c.child.stateNode}try{sx(n,l)}catch(O){Ot(c,c.return,O)}}break;case 27:l===null&&v&4&&bb(c);case 26:case 5:zn(n,c),l===null&&v&4&&yb(c),v&512&&fu(c,c.return);break;case 12:zn(n,c);break;case 31:zn(n,c),v&4&&Cb(n,c);break;case 13:zn(n,c),v&4&&Nb(n,c),v&64&&(n=c.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(c=Zj.bind(null,c),m5(n,c))));break;case 22:if(v=c.memoizedState!==null||Bn,!v){l=l!==null&&l.memoizedState!==null||pa,b=Bn;var w=pa;Bn=v,(pa=l)&&!w?Pn(n,c,(c.subtreeFlags&8772)!==0):zn(n,c),Bn=b,pa=w}break;case 30:break;default:zn(n,c)}}function Eb(n){var l=n.alternate;l!==null&&(n.alternate=null,Eb(l)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(l=n.stateNode,l!==null&&ul(l)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var Gt=null,ur=!1;function Ln(n,l,c){for(c=c.child;c!==null;)Tb(n,l,c),c=c.sibling}function Tb(n,l,c){if(ce&&typeof ce.onCommitFiberUnmount=="function")try{ce.onCommitFiberUnmount(Y,c)}catch{}switch(c.tag){case 26:pa||cn(c,l),Ln(n,l,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:pa||cn(c,l);var v=Gt,b=ur;Ti(c.type)&&(Gt=c.stateNode,ur=!1),Ln(n,l,c),wu(c.stateNode),Gt=v,ur=b;break;case 5:pa||cn(c,l);case 6:if(v=Gt,b=ur,Gt=null,Ln(n,l,c),Gt=v,ur=b,Gt!==null)if(ur)try{(Gt.nodeType===9?Gt.body:Gt.nodeName==="HTML"?Gt.ownerDocument.body:Gt).removeChild(c.stateNode)}catch(w){Ot(c,l,w)}else try{Gt.removeChild(c.stateNode)}catch(w){Ot(c,l,w)}break;case 18:Gt!==null&&(ur?(n=Gt,g1(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,c.stateNode),Fl(n)):g1(Gt,c.stateNode));break;case 4:v=Gt,b=ur,Gt=c.stateNode.containerInfo,ur=!0,Ln(n,l,c),Gt=v,ur=b;break;case 0:case 11:case 14:case 15:mi(2,c,l),pa||mi(4,c,l),Ln(n,l,c);break;case 1:pa||(cn(c,l),v=c.stateNode,typeof v.componentWillUnmount=="function"&&mb(c,l,v)),Ln(n,l,c);break;case 21:Ln(n,l,c);break;case 22:pa=(v=pa)||c.memoizedState!==null,Ln(n,l,c),pa=v;break;default:Ln(n,l,c)}}function Cb(n,l){if(l.memoizedState===null&&(n=l.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{Fl(n)}catch(c){Ot(l,l.return,c)}}}function Nb(n,l){if(l.memoizedState===null&&(n=l.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{Fl(n)}catch(c){Ot(l,l.return,c)}}function Fj(n){switch(n.tag){case 31:case 13:case 19:var l=n.stateNode;return l===null&&(l=n.stateNode=new wb),l;case 22:return n=n.stateNode,l=n._retryCache,l===null&&(l=n._retryCache=new wb),l;default:throw Error(r(435,n.tag))}}function xd(n,l){var c=Fj(n);l.forEach(function(v){if(!c.has(v)){c.add(v);var b=Wj.bind(null,n,v);v.then(b,b)}})}function cr(n,l){var c=l.deletions;if(c!==null)for(var v=0;v<c.length;v++){var b=c[v],w=n,O=l,H=O;e:for(;H!==null;){switch(H.tag){case 27:if(Ti(H.type)){Gt=H.stateNode,ur=!1;break e}break;case 5:Gt=H.stateNode,ur=!1;break e;case 3:case 4:Gt=H.stateNode.containerInfo,ur=!0;break e}H=H.return}if(Gt===null)throw Error(r(160));Tb(w,O,b),Gt=null,ur=!1,w=b.alternate,w!==null&&(w.return=null),b.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)jb(l,n),l=l.sibling}var Zr=null;function jb(n,l){var c=n.alternate,v=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:cr(l,n),dr(n),v&4&&(mi(3,n,n.return),du(3,n),mi(5,n,n.return));break;case 1:cr(l,n),dr(n),v&512&&(pa||c===null||cn(c,c.return)),v&64&&Bn&&(n=n.updateQueue,n!==null&&(v=n.callbacks,v!==null&&(c=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=c===null?v:c.concat(v))));break;case 26:var b=Zr;if(cr(l,n),dr(n),v&512&&(pa||c===null||cn(c,c.return)),v&4){var w=c!==null?c.memoizedState:null;if(v=n.memoizedState,c===null)if(v===null)if(n.stateNode===null){e:{v=n.type,c=n.memoizedProps,b=b.ownerDocument||b;t:switch(v){case"title":w=b.getElementsByTagName("title")[0],(!w||w[ja]||w[Ht]||w.namespaceURI==="http://www.w3.org/2000/svg"||w.hasAttribute("itemprop"))&&(w=b.createElement(v),b.head.insertBefore(w,b.querySelector("head > title"))),_a(w,v,c),w[Ht]=n,da(w),v=w;break e;case"link":var O=j1("link","href",b).get(v+(c.href||""));if(O){for(var H=0;H<O.length;H++)if(w=O[H],w.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&w.getAttribute("rel")===(c.rel==null?null:c.rel)&&w.getAttribute("title")===(c.title==null?null:c.title)&&w.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){O.splice(H,1);break t}}w=b.createElement(v),_a(w,v,c),b.head.appendChild(w);break;case"meta":if(O=j1("meta","content",b).get(v+(c.content||""))){for(H=0;H<O.length;H++)if(w=O[H],w.getAttribute("content")===(c.content==null?null:""+c.content)&&w.getAttribute("name")===(c.name==null?null:c.name)&&w.getAttribute("property")===(c.property==null?null:c.property)&&w.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&w.getAttribute("charset")===(c.charSet==null?null:c.charSet)){O.splice(H,1);break t}}w=b.createElement(v),_a(w,v,c),b.head.appendChild(w);break;default:throw Error(r(468,v))}w[Ht]=n,da(w),v=w}n.stateNode=v}else A1(b,n.type,n.stateNode);else n.stateNode=N1(b,v,n.memoizedProps);else w!==v?(w===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):w.count--,v===null?A1(b,n.type,n.stateNode):N1(b,v,n.memoizedProps)):v===null&&n.stateNode!==null&&qv(n,n.memoizedProps,c.memoizedProps)}break;case 27:cr(l,n),dr(n),v&512&&(pa||c===null||cn(c,c.return)),c!==null&&v&4&&qv(n,n.memoizedProps,c.memoizedProps);break;case 5:if(cr(l,n),dr(n),v&512&&(pa||c===null||cn(c,c.return)),n.flags&32){b=n.stateNode;try{fl(b,"")}catch(Ve){Ot(n,n.return,Ve)}}v&4&&n.stateNode!=null&&(b=n.memoizedProps,qv(n,b,c!==null?c.memoizedProps:b)),v&1024&&(Fv=!0);break;case 6:if(cr(l,n),dr(n),v&4){if(n.stateNode===null)throw Error(r(162));v=n.memoizedProps,c=n.stateNode;try{c.nodeValue=v}catch(Ve){Ot(n,n.return,Ve)}}break;case 3:if(Ld=null,b=Zr,Zr=kd(l.containerInfo),cr(l,n),Zr=b,dr(n),v&4&&c!==null&&c.memoizedState.isDehydrated)try{Fl(l.containerInfo)}catch(Ve){Ot(n,n.return,Ve)}Fv&&(Fv=!1,Ab(n));break;case 4:v=Zr,Zr=kd(n.stateNode.containerInfo),cr(l,n),dr(n),Zr=v;break;case 12:cr(l,n),dr(n);break;case 31:cr(l,n),dr(n),v&4&&(v=n.updateQueue,v!==null&&(n.updateQueue=null,xd(n,v)));break;case 13:cr(l,n),dr(n),n.child.flags&8192&&n.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(wd=Re()),v&4&&(v=n.updateQueue,v!==null&&(n.updateQueue=null,xd(n,v)));break;case 22:b=n.memoizedState!==null;var te=c!==null&&c.memoizedState!==null,fe=Bn,be=pa;if(Bn=fe||b,pa=be||te,cr(l,n),pa=be,Bn=fe,dr(n),v&8192)e:for(l=n.stateNode,l._visibility=b?l._visibility&-2:l._visibility|1,b&&(c===null||te||Bn||pa||Ms(n)),c=null,l=n;;){if(l.tag===5||l.tag===26){if(c===null){te=c=l;try{if(w=te.stateNode,b)O=w.style,typeof O.setProperty=="function"?O.setProperty("display","none","important"):O.display="none";else{H=te.stateNode;var Ce=te.memoizedProps.style,ve=Ce!=null&&Ce.hasOwnProperty("display")?Ce.display:null;H.style.display=ve==null||typeof ve=="boolean"?"":(""+ve).trim()}}catch(Ve){Ot(te,te.return,Ve)}}}else if(l.tag===6){if(c===null){te=l;try{te.stateNode.nodeValue=b?"":te.memoizedProps}catch(Ve){Ot(te,te.return,Ve)}}}else if(l.tag===18){if(c===null){te=l;try{var ye=te.stateNode;b?m1(ye,!0):m1(te.stateNode,!1)}catch(Ve){Ot(te,te.return,Ve)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===n)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===n)break e;for(;l.sibling===null;){if(l.return===null||l.return===n)break e;c===l&&(c=null),l=l.return}c===l&&(c=null),l.sibling.return=l.return,l=l.sibling}v&4&&(v=n.updateQueue,v!==null&&(c=v.retryQueue,c!==null&&(v.retryQueue=null,xd(n,c))));break;case 19:cr(l,n),dr(n),v&4&&(v=n.updateQueue,v!==null&&(n.updateQueue=null,xd(n,v)));break;case 30:break;case 21:break;default:cr(l,n),dr(n)}}function dr(n){var l=n.flags;if(l&2){try{for(var c,v=n.return;v!==null;){if(xb(v)){c=v;break}v=v.return}if(c==null)throw Error(r(160));switch(c.tag){case 27:var b=c.stateNode,w=Iv(n);yd(n,w,b);break;case 5:var O=c.stateNode;c.flags&32&&(fl(O,""),c.flags&=-33);var H=Iv(n);yd(n,H,O);break;case 3:case 4:var te=c.stateNode.containerInfo,fe=Iv(n);Vv(n,fe,te);break;default:throw Error(r(161))}}catch(be){Ot(n,n.return,be)}n.flags&=-3}l&4096&&(n.flags&=-4097)}function Ab(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var l=n;Ab(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),n=n.sibling}}function zn(n,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)Sb(n,l.alternate,l),l=l.sibling}function Ms(n){for(n=n.child;n!==null;){var l=n;switch(l.tag){case 0:case 11:case 14:case 15:mi(4,l,l.return),Ms(l);break;case 1:cn(l,l.return);var c=l.stateNode;typeof c.componentWillUnmount=="function"&&mb(l,l.return,c),Ms(l);break;case 27:wu(l.stateNode);case 26:case 5:cn(l,l.return),Ms(l);break;case 22:l.memoizedState===null&&Ms(l);break;case 30:Ms(l);break;default:Ms(l)}n=n.sibling}}function Pn(n,l,c){for(c=c&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var v=l.alternate,b=n,w=l,O=w.flags;switch(w.tag){case 0:case 11:case 15:Pn(b,w,c),du(4,w);break;case 1:if(Pn(b,w,c),v=w,b=v.stateNode,typeof b.componentDidMount=="function")try{b.componentDidMount()}catch(fe){Ot(v,v.return,fe)}if(v=w,b=v.updateQueue,b!==null){var H=v.stateNode;try{var te=b.shared.hiddenCallbacks;if(te!==null)for(b.shared.hiddenCallbacks=null,b=0;b<te.length;b++)ix(te[b],H)}catch(fe){Ot(v,v.return,fe)}}c&&O&64&&gb(w),fu(w,w.return);break;case 27:bb(w);case 26:case 5:Pn(b,w,c),c&&v===null&&O&4&&yb(w),fu(w,w.return);break;case 12:Pn(b,w,c);break;case 31:Pn(b,w,c),c&&O&4&&Cb(b,w);break;case 13:Pn(b,w,c),c&&O&4&&Nb(b,w);break;case 22:w.memoizedState===null&&Pn(b,w,c),fu(w,w.return);break;case 30:break;default:Pn(b,w,c)}l=l.sibling}}function Hv(n,l){var c=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(c=n.memoizedState.cachePool.pool),n=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(n=l.memoizedState.cachePool.pool),n!==c&&(n!=null&&n.refCount++,c!=null&&Wo(c))}function Gv(n,l){n=null,l.alternate!==null&&(n=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==n&&(l.refCount++,n!=null&&Wo(n))}function Wr(n,l,c,v){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)Mb(n,l,c,v),l=l.sibling}function Mb(n,l,c,v){var b=l.flags;switch(l.tag){case 0:case 11:case 15:Wr(n,l,c,v),b&2048&&du(9,l);break;case 1:Wr(n,l,c,v);break;case 3:Wr(n,l,c,v),b&2048&&(n=null,l.alternate!==null&&(n=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==n&&(l.refCount++,n!=null&&Wo(n)));break;case 12:if(b&2048){Wr(n,l,c,v),n=l.stateNode;try{var w=l.memoizedProps,O=w.id,H=w.onPostCommit;typeof H=="function"&&H(O,l.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(te){Ot(l,l.return,te)}}else Wr(n,l,c,v);break;case 31:Wr(n,l,c,v);break;case 13:Wr(n,l,c,v);break;case 23:break;case 22:w=l.stateNode,O=l.alternate,l.memoizedState!==null?w._visibility&2?Wr(n,l,c,v):hu(n,l):w._visibility&2?Wr(n,l,c,v):(w._visibility|=2,Rl(n,l,c,v,(l.subtreeFlags&10256)!==0||!1)),b&2048&&Hv(O,l);break;case 24:Wr(n,l,c,v),b&2048&&Gv(l.alternate,l);break;default:Wr(n,l,c,v)}}function Rl(n,l,c,v,b){for(b=b&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var w=n,O=l,H=c,te=v,fe=O.flags;switch(O.tag){case 0:case 11:case 15:Rl(w,O,H,te,b),du(8,O);break;case 23:break;case 22:var be=O.stateNode;O.memoizedState!==null?be._visibility&2?Rl(w,O,H,te,b):hu(w,O):(be._visibility|=2,Rl(w,O,H,te,b)),b&&fe&2048&&Hv(O.alternate,O);break;case 24:Rl(w,O,H,te,b),b&&fe&2048&&Gv(O.alternate,O);break;default:Rl(w,O,H,te,b)}l=l.sibling}}function hu(n,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var c=n,v=l,b=v.flags;switch(v.tag){case 22:hu(c,v),b&2048&&Hv(v.alternate,v);break;case 24:hu(c,v),b&2048&&Gv(v.alternate,v);break;default:hu(c,v)}l=l.sibling}}var vu=8192;function kl(n,l,c){if(n.subtreeFlags&vu)for(n=n.child;n!==null;)Db(n,l,c),n=n.sibling}function Db(n,l,c){switch(n.tag){case 26:kl(n,l,c),n.flags&vu&&n.memoizedState!==null&&M5(c,Zr,n.memoizedState,n.memoizedProps);break;case 5:kl(n,l,c);break;case 3:case 4:var v=Zr;Zr=kd(n.stateNode.containerInfo),kl(n,l,c),Zr=v;break;case 22:n.memoizedState===null&&(v=n.alternate,v!==null&&v.memoizedState!==null?(v=vu,vu=16777216,kl(n,l,c),vu=v):kl(n,l,c));break;default:kl(n,l,c)}}function Ob(n){var l=n.alternate;if(l!==null&&(n=l.child,n!==null)){l.child=null;do l=n.sibling,n.sibling=null,n=l;while(n!==null)}}function pu(n){var l=n.deletions;if((n.flags&16)!==0){if(l!==null)for(var c=0;c<l.length;c++){var v=l[c];Ma=v,kb(v,n)}Ob(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Rb(n),n=n.sibling}function Rb(n){switch(n.tag){case 0:case 11:case 15:pu(n),n.flags&2048&&mi(9,n,n.return);break;case 3:pu(n);break;case 12:pu(n);break;case 22:var l=n.stateNode;n.memoizedState!==null&&l._visibility&2&&(n.return===null||n.return.tag!==13)?(l._visibility&=-3,bd(n)):pu(n);break;default:pu(n)}}function bd(n){var l=n.deletions;if((n.flags&16)!==0){if(l!==null)for(var c=0;c<l.length;c++){var v=l[c];Ma=v,kb(v,n)}Ob(n)}for(n=n.child;n!==null;){switch(l=n,l.tag){case 0:case 11:case 15:mi(8,l,l.return),bd(l);break;case 22:c=l.stateNode,c._visibility&2&&(c._visibility&=-3,bd(l));break;default:bd(l)}n=n.sibling}}function kb(n,l){for(;Ma!==null;){var c=Ma;switch(c.tag){case 0:case 11:case 15:mi(8,c,l);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var v=c.memoizedState.cachePool.pool;v!=null&&v.refCount++}break;case 24:Wo(c.memoizedState.cache)}if(v=c.child,v!==null)v.return=c,Ma=v;else e:for(c=n;Ma!==null;){v=Ma;var b=v.sibling,w=v.return;if(Eb(v),v===c){Ma=null;break e}if(b!==null){b.return=w,Ma=b;break e}Ma=w}}}var Hj={getCacheForType:function(n){var l=za(fa),c=l.data.get(n);return c===void 0&&(c=n(),l.data.set(n,c)),c},cacheSignal:function(){return za(fa).controller.signal}},Gj=typeof WeakMap=="function"?WeakMap:Map,Nt=0,Pt=null,ht=null,pt=0,Dt=0,Tr=null,yi=!1,Bl=!1,Qv=!1,_n=0,ea=0,xi=0,Ds=0,Yv=0,Cr=0,Ll=0,gu=null,fr=null,Kv=!1,wd=0,Bb=0,Sd=1/0,Ed=null,bi=null,xa=0,wi=null,zl=null,Un=0,$v=0,Xv=null,Lb=null,mu=0,Zv=null;function Nr(){return(Nt&2)!==0&&pt!==0?pt&-pt:P.T!==null?rp():$t()}function zb(){if(Cr===0)if((pt&536870912)===0||mt){var n=ze;ze<<=1,(ze&3932160)===0&&(ze=262144),Cr=n}else Cr=536870912;return n=Sr.current,n!==null&&(n.flags|=32),Cr}function hr(n,l,c){(n===Pt&&(Dt===2||Dt===9)||n.cancelPendingCommit!==null)&&(Pl(n,0),Si(n,pt,Cr,!1)),Rt(n,c),((Nt&2)===0||n!==Pt)&&(n===Pt&&((Nt&2)===0&&(Ds|=c),ea===4&&Si(n,pt,Cr,!1)),dn(n))}function Pb(n,l,c){if((Nt&6)!==0)throw Error(r(327));var v=!c&&(l&127)===0&&(l&n.expiredLanes)===0||Ie(n,l),b=v?Kj(n,l):Jv(n,l,!0),w=v;do{if(b===0){Bl&&!v&&Si(n,l,0,!1);break}else{if(c=n.current.alternate,w&&!Qj(c)){b=Jv(n,l,!1),w=!1;continue}if(b===2){if(w=l,n.errorRecoveryDisabledLanes&w)var O=0;else O=n.pendingLanes&-536870913,O=O!==0?O:O&536870912?536870912:0;if(O!==0){l=O;e:{var H=n;b=gu;var te=H.current.memoizedState.isDehydrated;if(te&&(Pl(H,O).flags|=256),O=Jv(H,O,!1),O!==2){if(Qv&&!te){H.errorRecoveryDisabledLanes|=w,Ds|=w,b=4;break e}w=fr,fr=b,w!==null&&(fr===null?fr=w:fr.push.apply(fr,w))}b=O}if(w=!1,b!==2)continue}}if(b===1){Pl(n,0),Si(n,l,0,!0);break}e:{switch(v=n,w=b,w){case 0:case 1:throw Error(r(345));case 4:if((l&4194048)!==l)break;case 6:Si(v,l,Cr,!yi);break e;case 2:fr=null;break;case 3:case 5:break;default:throw Error(r(329))}if((l&62914560)===l&&(b=wd+300-Re(),10<b)){if(Si(v,l,Cr,!yi),st(v,0,!0)!==0)break e;Un=l,v.timeoutHandle=v1(_b.bind(null,v,c,fr,Ed,Kv,l,Cr,Ds,Ll,yi,w,"Throttled",-0,0),b);break e}_b(v,c,fr,Ed,Kv,l,Cr,Ds,Ll,yi,w,null,-0,0)}}break}while(!0);dn(n)}function _b(n,l,c,v,b,w,O,H,te,fe,be,Ce,ve,ye){if(n.timeoutHandle=-1,Ce=l.subtreeFlags,Ce&8192||(Ce&16785408)===16785408){Ce={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Tn},Db(l,w,Ce);var Ve=(w&62914560)===w?wd-Re():(w&4194048)===w?Bb-Re():0;if(Ve=D5(Ce,Ve),Ve!==null){Un=w,n.cancelPendingCommit=Ve(Qb.bind(null,n,l,w,c,v,b,O,H,te,be,Ce,null,ve,ye)),Si(n,w,O,!fe);return}}Qb(n,l,w,c,v,b,O,H,te)}function Qj(n){for(var l=n;;){var c=l.tag;if((c===0||c===11||c===15)&&l.flags&16384&&(c=l.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var v=0;v<c.length;v++){var b=c[v],w=b.getSnapshot;b=b.value;try{if(!br(w(),b))return!1}catch{return!1}}if(c=l.child,l.subtreeFlags&16384&&c!==null)c.return=l,l=c;else{if(l===n)break;for(;l.sibling===null;){if(l.return===null||l.return===n)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function Si(n,l,c,v){l&=~Yv,l&=~Ds,n.suspendedLanes|=l,n.pingedLanes&=~l,v&&(n.warmLanes|=l),v=n.expirationTimes;for(var b=l;0<b;){var w=31-ge(b),O=1<<w;v[w]=-1,b&=~O}c!==0&&Kt(n,c,l)}function Td(){return(Nt&6)===0?(yu(0),!1):!0}function Wv(){if(ht!==null){if(Dt===0)var n=ht.return;else n=ht,An=ws=null,vv(n),jl=null,eu=0,n=ht;for(;n!==null;)pb(n.alternate,n),n=n.return;ht=null}}function Pl(n,l){var c=n.timeoutHandle;c!==-1&&(n.timeoutHandle=-1,f5(c)),c=n.cancelPendingCommit,c!==null&&(n.cancelPendingCommit=null,c()),Un=0,Wv(),Pt=n,ht=c=Nn(n.current,null),pt=l,Dt=0,Tr=null,yi=!1,Bl=Ie(n,l),Qv=!1,Ll=Cr=Yv=Ds=xi=ea=0,fr=gu=null,Kv=!1,(l&8)!==0&&(l|=l&32);var v=n.entangledLanes;if(v!==0)for(n=n.entanglements,v&=l;0<v;){var b=31-ge(v),w=1<<b;l|=n[b],v&=~w}return _n=l,Gc(),c}function Ub(n,l){ot=null,P.H=ou,l===Nl||l===Jc?(l=tx(),Dt=3):l===av?(l=tx(),Dt=4):Dt=l===Dv?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,Tr=l,ht===null&&(ea=1,hd(n,zr(l,n.current)))}function qb(){var n=Sr.current;return n===null?!0:(pt&4194048)===pt?qr===null:(pt&62914560)===pt||(pt&536870912)!==0?n===qr:!1}function Ib(){var n=P.H;return P.H=ou,n===null?ou:n}function Vb(){var n=P.A;return P.A=Hj,n}function Cd(){ea=4,yi||(pt&4194048)!==pt&&Sr.current!==null||(Bl=!0),(xi&134217727)===0&&(Ds&134217727)===0||Pt===null||Si(Pt,pt,Cr,!1)}function Jv(n,l,c){var v=Nt;Nt|=2;var b=Ib(),w=Vb();(Pt!==n||pt!==l)&&(Ed=null,Pl(n,l)),l=!1;var O=ea;e:do try{if(Dt!==0&&ht!==null){var H=ht,te=Tr;switch(Dt){case 8:Wv(),O=6;break e;case 3:case 2:case 9:case 6:Sr.current===null&&(l=!0);var fe=Dt;if(Dt=0,Tr=null,_l(n,H,te,fe),c&&Bl){O=0;break e}break;default:fe=Dt,Dt=0,Tr=null,_l(n,H,te,fe)}}Yj(),O=ea;break}catch(be){Ub(n,be)}while(!0);return l&&n.shellSuspendCounter++,An=ws=null,Nt=v,P.H=b,P.A=w,ht===null&&(Pt=null,pt=0,Gc()),O}function Yj(){for(;ht!==null;)Fb(ht)}function Kj(n,l){var c=Nt;Nt|=2;var v=Ib(),b=Vb();Pt!==n||pt!==l?(Ed=null,Sd=Re()+500,Pl(n,l)):Bl=Ie(n,l);e:do try{if(Dt!==0&&ht!==null){l=ht;var w=Tr;t:switch(Dt){case 1:Dt=0,Tr=null,_l(n,l,w,1);break;case 2:case 9:if(Jy(w)){Dt=0,Tr=null,Hb(l);break}l=function(){Dt!==2&&Dt!==9||Pt!==n||(Dt=7),dn(n)},w.then(l,l);break e;case 3:Dt=7;break e;case 4:Dt=5;break e;case 7:Jy(w)?(Dt=0,Tr=null,Hb(l)):(Dt=0,Tr=null,_l(n,l,w,7));break;case 5:var O=null;switch(ht.tag){case 26:O=ht.memoizedState;case 5:case 27:var H=ht;if(O?M1(O):H.stateNode.complete){Dt=0,Tr=null;var te=H.sibling;if(te!==null)ht=te;else{var fe=H.return;fe!==null?(ht=fe,Nd(fe)):ht=null}break t}}Dt=0,Tr=null,_l(n,l,w,5);break;case 6:Dt=0,Tr=null,_l(n,l,w,6);break;case 8:Wv(),ea=6;break e;default:throw Error(r(462))}}$j();break}catch(be){Ub(n,be)}while(!0);return An=ws=null,P.H=v,P.A=b,Nt=c,ht!==null?0:(Pt=null,pt=0,Gc(),ea)}function $j(){for(;ht!==null&&!Ge();)Fb(ht)}function Fb(n){var l=hb(n.alternate,n,_n);n.memoizedProps=n.pendingProps,l===null?Nd(n):ht=l}function Hb(n){var l=n,c=l.alternate;switch(l.tag){case 15:case 0:l=lb(c,l,l.pendingProps,l.type,void 0,pt);break;case 11:l=lb(c,l,l.pendingProps,l.type.render,l.ref,pt);break;case 5:vv(l);default:pb(c,l),l=ht=Vy(l,_n),l=hb(c,l,_n)}n.memoizedProps=n.pendingProps,l===null?Nd(n):ht=l}function _l(n,l,c,v){An=ws=null,vv(l),jl=null,eu=0;var b=l.return;try{if(Pj(n,b,l,c,pt)){ea=1,hd(n,zr(c,n.current)),ht=null;return}}catch(w){if(b!==null)throw ht=b,w;ea=1,hd(n,zr(c,n.current)),ht=null;return}l.flags&32768?(mt||v===1?n=!0:Bl||(pt&536870912)!==0?n=!1:(yi=n=!0,(v===2||v===9||v===3||v===6)&&(v=Sr.current,v!==null&&v.tag===13&&(v.flags|=16384))),Gb(l,n)):Nd(l)}function Nd(n){var l=n;do{if((l.flags&32768)!==0){Gb(l,yi);return}n=l.return;var c=qj(l.alternate,l,_n);if(c!==null){ht=c;return}if(l=l.sibling,l!==null){ht=l;return}ht=l=n}while(l!==null);ea===0&&(ea=5)}function Gb(n,l){do{var c=Ij(n.alternate,n);if(c!==null){c.flags&=32767,ht=c;return}if(c=n.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!l&&(n=n.sibling,n!==null)){ht=n;return}ht=n=c}while(n!==null);ea=6,ht=null}function Qb(n,l,c,v,b,w,O,H,te){n.cancelPendingCommit=null;do jd();while(xa!==0);if((Nt&6)!==0)throw Error(r(327));if(l!==null){if(l===n.current)throw Error(r(177));if(w=l.lanes|l.childLanes,w|=Ih,Ba(n,c,w,O,H,te),n===Pt&&(ht=Pt=null,pt=0),zl=l,wi=n,Un=c,$v=w,Xv=b,Lb=v,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,Jj(Ye,function(){return Zb(),null})):(n.callbackNode=null,n.callbackPriority=0),v=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||v){v=P.T,P.T=null,b=U.p,U.p=2,O=Nt,Nt|=4;try{Vj(n,l,c)}finally{Nt=O,U.p=b,P.T=v}}xa=1,Yb(),Kb(),$b()}}function Yb(){if(xa===1){xa=0;var n=wi,l=zl,c=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||c){c=P.T,P.T=null;var v=U.p;U.p=2;var b=Nt;Nt|=4;try{jb(l,n);var w=dp,O=ky(n.containerInfo),H=w.focusedElem,te=w.selectionRange;if(O!==H&&H&&H.ownerDocument&&Ry(H.ownerDocument.documentElement,H)){if(te!==null&&zh(H)){var fe=te.start,be=te.end;if(be===void 0&&(be=fe),"selectionStart"in H)H.selectionStart=fe,H.selectionEnd=Math.min(be,H.value.length);else{var Ce=H.ownerDocument||document,ve=Ce&&Ce.defaultView||window;if(ve.getSelection){var ye=ve.getSelection(),Ve=H.textContent.length,at=Math.min(te.start,Ve),Lt=te.end===void 0?at:Math.min(te.end,Ve);!ye.extend&&at>Lt&&(O=Lt,Lt=at,at=O);var ue=Oy(H,at),ne=Oy(H,Lt);if(ue&&ne&&(ye.rangeCount!==1||ye.anchorNode!==ue.node||ye.anchorOffset!==ue.offset||ye.focusNode!==ne.node||ye.focusOffset!==ne.offset)){var de=Ce.createRange();de.setStart(ue.node,ue.offset),ye.removeAllRanges(),at>Lt?(ye.addRange(de),ye.extend(ne.node,ne.offset)):(de.setEnd(ne.node,ne.offset),ye.addRange(de))}}}}for(Ce=[],ye=H;ye=ye.parentNode;)ye.nodeType===1&&Ce.push({element:ye,left:ye.scrollLeft,top:ye.scrollTop});for(typeof H.focus=="function"&&H.focus(),H=0;H<Ce.length;H++){var Te=Ce[H];Te.element.scrollLeft=Te.left,Te.element.scrollTop=Te.top}}Ud=!!cp,dp=cp=null}finally{Nt=b,U.p=v,P.T=c}}n.current=l,xa=2}}function Kb(){if(xa===2){xa=0;var n=wi,l=zl,c=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||c){c=P.T,P.T=null;var v=U.p;U.p=2;var b=Nt;Nt|=4;try{Sb(n,l.alternate,l)}finally{Nt=b,U.p=v,P.T=c}}xa=3}}function $b(){if(xa===4||xa===3){xa=0,Je();var n=wi,l=zl,c=Un,v=Lb;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?xa=5:(xa=0,zl=wi=null,Xb(n,n.pendingLanes));var b=n.pendingLanes;if(b===0&&(bi=null),Or(c),l=l.stateNode,ce&&typeof ce.onCommitFiberRoot=="function")try{ce.onCommitFiberRoot(Y,l,void 0,(l.current.flags&128)===128)}catch{}if(v!==null){l=P.T,b=U.p,U.p=2,P.T=null;try{for(var w=n.onRecoverableError,O=0;O<v.length;O++){var H=v[O];w(H.value,{componentStack:H.stack})}}finally{P.T=l,U.p=b}}(Un&3)!==0&&jd(),dn(n),b=n.pendingLanes,(c&261930)!==0&&(b&42)!==0?n===Zv?mu++:(mu=0,Zv=n):mu=0,yu(0)}}function Xb(n,l){(n.pooledCacheLanes&=l)===0&&(l=n.pooledCache,l!=null&&(n.pooledCache=null,Wo(l)))}function jd(){return Yb(),Kb(),$b(),Zb()}function Zb(){if(xa!==5)return!1;var n=wi,l=$v;$v=0;var c=Or(Un),v=P.T,b=U.p;try{U.p=32>c?32:c,P.T=null,c=Xv,Xv=null;var w=wi,O=Un;if(xa=0,zl=wi=null,Un=0,(Nt&6)!==0)throw Error(r(331));var H=Nt;if(Nt|=4,Rb(w.current),Mb(w,w.current,O,c),Nt=H,yu(0,!1),ce&&typeof ce.onPostCommitFiberRoot=="function")try{ce.onPostCommitFiberRoot(Y,w)}catch{}return!0}finally{U.p=b,P.T=v,Xb(n,l)}}function Wb(n,l,c){l=zr(c,l),l=Mv(n.stateNode,l,2),n=vi(n,l,2),n!==null&&(Rt(n,2),dn(n))}function Ot(n,l,c){if(n.tag===3)Wb(n,n,c);else for(;l!==null;){if(l.tag===3){Wb(l,n,c);break}else if(l.tag===1){var v=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof v.componentDidCatch=="function"&&(bi===null||!bi.has(v))){n=zr(c,n),c=Jx(2),v=vi(l,c,2),v!==null&&(eb(c,v,l,n),Rt(v,2),dn(v));break}}l=l.return}}function ep(n,l,c){var v=n.pingCache;if(v===null){v=n.pingCache=new Gj;var b=new Set;v.set(l,b)}else b=v.get(l),b===void 0&&(b=new Set,v.set(l,b));b.has(c)||(Qv=!0,b.add(c),n=Xj.bind(null,n,l,c),l.then(n,n))}function Xj(n,l,c){var v=n.pingCache;v!==null&&v.delete(l),n.pingedLanes|=n.suspendedLanes&c,n.warmLanes&=~c,Pt===n&&(pt&c)===c&&(ea===4||ea===3&&(pt&62914560)===pt&&300>Re()-wd?(Nt&2)===0&&Pl(n,0):Yv|=c,Ll===pt&&(Ll=0)),dn(n)}function Jb(n,l){l===0&&(l=ut()),n=ys(n,l),n!==null&&(Rt(n,l),dn(n))}function Zj(n){var l=n.memoizedState,c=0;l!==null&&(c=l.retryLane),Jb(n,c)}function Wj(n,l){var c=0;switch(n.tag){case 31:case 13:var v=n.stateNode,b=n.memoizedState;b!==null&&(c=b.retryLane);break;case 19:v=n.stateNode;break;case 22:v=n.stateNode._retryCache;break;default:throw Error(r(314))}v!==null&&v.delete(l),Jb(n,c)}function Jj(n,l){return De(n,l)}var Ad=null,Ul=null,tp=!1,Md=!1,ap=!1,Ei=0;function dn(n){n!==Ul&&n.next===null&&(Ul===null?Ad=Ul=n:Ul=Ul.next=n),Md=!0,tp||(tp=!0,t5())}function yu(n,l){if(!ap&&Md){ap=!0;do for(var c=!1,v=Ad;v!==null;){if(n!==0){var b=v.pendingLanes;if(b===0)var w=0;else{var O=v.suspendedLanes,H=v.pingedLanes;w=(1<<31-ge(42|n)+1)-1,w&=b&~(O&~H),w=w&201326741?w&201326741|1:w?w|2:0}w!==0&&(c=!0,r1(v,w))}else w=pt,w=st(v,v===Pt?w:0,v.cancelPendingCommit!==null||v.timeoutHandle!==-1),(w&3)===0||Ie(v,w)||(c=!0,r1(v,w));v=v.next}while(c);ap=!1}}function e5(){e1()}function e1(){Md=tp=!1;var n=0;Ei!==0&&d5()&&(n=Ei);for(var l=Re(),c=null,v=Ad;v!==null;){var b=v.next,w=t1(v,l);w===0?(v.next=null,c===null?Ad=b:c.next=b,b===null&&(Ul=c)):(c=v,(n!==0||(w&3)!==0)&&(Md=!0)),v=b}xa!==0&&xa!==5||yu(n),Ei!==0&&(Ei=0)}function t1(n,l){for(var c=n.suspendedLanes,v=n.pingedLanes,b=n.expirationTimes,w=n.pendingLanes&-62914561;0<w;){var O=31-ge(w),H=1<<O,te=b[O];te===-1?((H&c)===0||(H&v)!==0)&&(b[O]=dt(H,l)):te<=l&&(n.expiredLanes|=H),w&=~H}if(l=Pt,c=pt,c=st(n,n===l?c:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),v=n.callbackNode,c===0||n===l&&(Dt===2||Dt===9)||n.cancelPendingCommit!==null)return v!==null&&v!==null&&Be(v),n.callbackNode=null,n.callbackPriority=0;if((c&3)===0||Ie(n,c)){if(l=c&-c,l===n.callbackPriority)return l;switch(v!==null&&Be(v),Or(c)){case 2:case 8:c=pe;break;case 32:c=Ye;break;case 268435456:c=Ke;break;default:c=Ye}return v=a1.bind(null,n),c=De(c,v),n.callbackPriority=l,n.callbackNode=c,l}return v!==null&&v!==null&&Be(v),n.callbackPriority=2,n.callbackNode=null,2}function a1(n,l){if(xa!==0&&xa!==5)return n.callbackNode=null,n.callbackPriority=0,null;var c=n.callbackNode;if(jd()&&n.callbackNode!==c)return null;var v=pt;return v=st(n,n===Pt?v:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),v===0?null:(Pb(n,v,l),t1(n,Re()),n.callbackNode!=null&&n.callbackNode===c?a1.bind(null,n):null)}function r1(n,l){if(jd())return null;Pb(n,l,!0)}function t5(){h5(function(){(Nt&6)!==0?De(xe,e5):e1()})}function rp(){if(Ei===0){var n=Tl;n===0&&(n=Fe,Fe<<=1,(Fe&261888)===0&&(Fe=256)),Ei=n}return Ei}function n1(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:Pc(""+n)}function i1(n,l){var c=l.ownerDocument.createElement("input");return c.name=l.name,c.value=l.value,n.id&&c.setAttribute("form",n.id),l.parentNode.insertBefore(c,l),n=new FormData(n),c.parentNode.removeChild(c),n}function a5(n,l,c,v,b){if(l==="submit"&&c&&c.stateNode===b){var w=n1((b[ya]||null).action),O=v.submitter;O&&(l=(l=O[ya]||null)?n1(l.formAction):O.getAttribute("formAction"),l!==null&&(w=l,O=null));var H=new Ic("action","action",null,v,b);n.push({event:H,listeners:[{instance:null,listener:function(){if(v.defaultPrevented){if(Ei!==0){var te=O?i1(b,O):new FormData(b);Ev(c,{pending:!0,data:te,method:b.method,action:w},null,te)}}else typeof w=="function"&&(H.preventDefault(),te=O?i1(b,O):new FormData(b),Ev(c,{pending:!0,data:te,method:b.method,action:w},w,te))},currentTarget:b}]})}}for(var np=0;np<qh.length;np++){var ip=qh[np],r5=ip.toLowerCase(),n5=ip[0].toUpperCase()+ip.slice(1);Xr(r5,"on"+n5)}Xr(zy,"onAnimationEnd"),Xr(Py,"onAnimationIteration"),Xr(_y,"onAnimationStart"),Xr("dblclick","onDoubleClick"),Xr("focusin","onFocus"),Xr("focusout","onBlur"),Xr(bj,"onTransitionRun"),Xr(wj,"onTransitionStart"),Xr(Sj,"onTransitionCancel"),Xr(Uy,"onTransitionEnd"),ln("onMouseEnter",["mouseout","mouseover"]),ln("onMouseLeave",["mouseout","mouseover"]),ln("onPointerEnter",["pointerout","pointerover"]),ln("onPointerLeave",["pointerout","pointerover"]),xr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),xr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),xr("onBeforeInput",["compositionend","keypress","textInput","paste"]),xr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),xr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),xr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var xu="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),i5=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(xu));function s1(n,l){l=(l&4)!==0;for(var c=0;c<n.length;c++){var v=n[c],b=v.event;v=v.listeners;e:{var w=void 0;if(l)for(var O=v.length-1;0<=O;O--){var H=v[O],te=H.instance,fe=H.currentTarget;if(H=H.listener,te!==w&&b.isPropagationStopped())break e;w=H,b.currentTarget=fe;try{w(b)}catch(be){Hc(be)}b.currentTarget=null,w=te}else for(O=0;O<v.length;O++){if(H=v[O],te=H.instance,fe=H.currentTarget,H=H.listener,te!==w&&b.isPropagationStopped())break e;w=H,b.currentTarget=fe;try{w(b)}catch(be){Hc(be)}b.currentTarget=null,w=te}}}}function vt(n,l){var c=l[Ca];c===void 0&&(c=l[Ca]=new Set);var v=n+"__bubble";c.has(v)||(l1(l,n,2,!1),c.add(v))}function sp(n,l,c){var v=0;l&&(v|=4),l1(c,n,v,l)}var Dd="_reactListening"+Math.random().toString(36).slice(2);function lp(n){if(!n[Dd]){n[Dd]=!0,Rc.forEach(function(c){c!=="selectionchange"&&(i5.has(c)||sp(c,!1,n),sp(c,!0,n))});var l=n.nodeType===9?n:n.ownerDocument;l===null||l[Dd]||(l[Dd]=!0,sp("selectionchange",!1,l))}}function l1(n,l,c,v){switch(z1(l)){case 2:var b=k5;break;case 8:b=B5;break;default:b=Sp}c=b.bind(null,l,c,n),b=void 0,!jh||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(b=!0),v?b!==void 0?n.addEventListener(l,c,{capture:!0,passive:b}):n.addEventListener(l,c,!0):b!==void 0?n.addEventListener(l,c,{passive:b}):n.addEventListener(l,c,!1)}function op(n,l,c,v,b){var w=v;if((l&1)===0&&(l&2)===0&&v!==null)e:for(;;){if(v===null)return;var O=v.tag;if(O===3||O===4){var H=v.stateNode.containerInfo;if(H===b)break;if(O===4)for(O=v.return;O!==null;){var te=O.tag;if((te===3||te===4)&&O.stateNode.containerInfo===b)return;O=O.return}for(;H!==null;){if(O=ri(H),O===null)return;if(te=O.tag,te===5||te===6||te===26||te===27){v=w=O;continue e}H=H.parentNode}}v=v.return}fy(function(){var fe=w,be=Ch(c),Ce=[];e:{var ve=qy.get(n);if(ve!==void 0){var ye=Ic,Ve=n;switch(n){case"keypress":if(Uc(c)===0)break e;case"keydown":case"keyup":ye=WN;break;case"focusin":Ve="focus",ye=Oh;break;case"focusout":Ve="blur",ye=Oh;break;case"beforeblur":case"afterblur":ye=Oh;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ye=py;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ye=qN;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ye=tj;break;case zy:case Py:case _y:ye=FN;break;case Uy:ye=rj;break;case"scroll":case"scrollend":ye=_N;break;case"wheel":ye=ij;break;case"copy":case"cut":case"paste":ye=GN;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ye=my;break;case"toggle":case"beforetoggle":ye=lj}var at=(l&4)!==0,Lt=!at&&(n==="scroll"||n==="scrollend"),ue=at?ve!==null?ve+"Capture":null:ve;at=[];for(var ne=fe,de;ne!==null;){var Te=ne;if(de=Te.stateNode,Te=Te.tag,Te!==5&&Te!==26&&Te!==27||de===null||ue===null||(Te=Io(ne,ue),Te!=null&&at.push(bu(ne,Te,de))),Lt)break;ne=ne.return}0<at.length&&(ve=new ye(ve,Ve,null,c,be),Ce.push({event:ve,listeners:at}))}}if((l&7)===0){e:{if(ve=n==="mouseover"||n==="pointerover",ye=n==="mouseout"||n==="pointerout",ve&&c!==Th&&(Ve=c.relatedTarget||c.fromElement)&&(ri(Ve)||Ve[sr]))break e;if((ye||ve)&&(ve=be.window===be?be:(ve=be.ownerDocument)?ve.defaultView||ve.parentWindow:window,ye?(Ve=c.relatedTarget||c.toElement,ye=fe,Ve=Ve?ri(Ve):null,Ve!==null&&(Lt=s(Ve),at=Ve.tag,Ve!==Lt||at!==5&&at!==27&&at!==6)&&(Ve=null)):(ye=null,Ve=fe),ye!==Ve)){if(at=py,Te="onMouseLeave",ue="onMouseEnter",ne="mouse",(n==="pointerout"||n==="pointerover")&&(at=my,Te="onPointerLeave",ue="onPointerEnter",ne="pointer"),Lt=ye==null?ve:vs(ye),de=Ve==null?ve:vs(Ve),ve=new at(Te,ne+"leave",ye,c,be),ve.target=Lt,ve.relatedTarget=de,Te=null,ri(be)===fe&&(at=new at(ue,ne+"enter",Ve,c,be),at.target=de,at.relatedTarget=Lt,Te=at),Lt=Te,ye&&Ve)t:{for(at=s5,ue=ye,ne=Ve,de=0,Te=ue;Te;Te=at(Te))de++;Te=0;for(var Ze=ne;Ze;Ze=at(Ze))Te++;for(;0<de-Te;)ue=at(ue),de--;for(;0<Te-de;)ne=at(ne),Te--;for(;de--;){if(ue===ne||ne!==null&&ue===ne.alternate){at=ue;break t}ue=at(ue),ne=at(ne)}at=null}else at=null;ye!==null&&o1(Ce,ve,ye,at,!1),Ve!==null&&Lt!==null&&o1(Ce,Lt,Ve,at,!0)}}e:{if(ve=fe?vs(fe):window,ye=ve.nodeName&&ve.nodeName.toLowerCase(),ye==="select"||ye==="input"&&ve.type==="file")var St=Cy;else if(Ey(ve))if(Ny)St=mj;else{St=pj;var Qe=vj}else ye=ve.nodeName,!ye||ye.toLowerCase()!=="input"||ve.type!=="checkbox"&&ve.type!=="radio"?fe&&Eh(fe.elementType)&&(St=Cy):St=gj;if(St&&(St=St(n,fe))){Ty(Ce,St,c,be);break e}Qe&&Qe(n,ve,fe),n==="focusout"&&fe&&ve.type==="number"&&fe.memoizedProps.value!=null&&Sh(ve,"number",ve.value)}switch(Qe=fe?vs(fe):window,n){case"focusin":(Ey(Qe)||Qe.contentEditable==="true")&&(gl=Qe,Ph=fe,$o=null);break;case"focusout":$o=Ph=gl=null;break;case"mousedown":_h=!0;break;case"contextmenu":case"mouseup":case"dragend":_h=!1,By(Ce,c,be);break;case"selectionchange":if(xj)break;case"keydown":case"keyup":By(Ce,c,be)}var ct;if(kh)e:{switch(n){case"compositionstart":var gt="onCompositionStart";break e;case"compositionend":gt="onCompositionEnd";break e;case"compositionupdate":gt="onCompositionUpdate";break e}gt=void 0}else pl?wy(n,c)&&(gt="onCompositionEnd"):n==="keydown"&&c.keyCode===229&&(gt="onCompositionStart");gt&&(yy&&c.locale!=="ko"&&(pl||gt!=="onCompositionStart"?gt==="onCompositionEnd"&&pl&&(ct=hy()):(li=be,Ah="value"in li?li.value:li.textContent,pl=!0)),Qe=Od(fe,gt),0<Qe.length&&(gt=new gy(gt,n,null,c,be),Ce.push({event:gt,listeners:Qe}),ct?gt.data=ct:(ct=Sy(c),ct!==null&&(gt.data=ct)))),(ct=uj?cj(n,c):dj(n,c))&&(gt=Od(fe,"onBeforeInput"),0<gt.length&&(Qe=new gy("onBeforeInput","beforeinput",null,c,be),Ce.push({event:Qe,listeners:gt}),Qe.data=ct)),a5(Ce,n,fe,c,be)}s1(Ce,l)})}function bu(n,l,c){return{instance:n,listener:l,currentTarget:c}}function Od(n,l){for(var c=l+"Capture",v=[];n!==null;){var b=n,w=b.stateNode;if(b=b.tag,b!==5&&b!==26&&b!==27||w===null||(b=Io(n,c),b!=null&&v.unshift(bu(n,b,w)),b=Io(n,l),b!=null&&v.push(bu(n,b,w))),n.tag===3)return v;n=n.return}return[]}function s5(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function o1(n,l,c,v,b){for(var w=l._reactName,O=[];c!==null&&c!==v;){var H=c,te=H.alternate,fe=H.stateNode;if(H=H.tag,te!==null&&te===v)break;H!==5&&H!==26&&H!==27||fe===null||(te=fe,b?(fe=Io(c,w),fe!=null&&O.unshift(bu(c,fe,te))):b||(fe=Io(c,w),fe!=null&&O.push(bu(c,fe,te)))),c=c.return}O.length!==0&&n.push({event:l,listeners:O})}var l5=/\r\n?/g,o5=/\u0000|\uFFFD/g;function u1(n){return(typeof n=="string"?n:""+n).replace(l5,`
|
|
49
|
+
`).replace(o5,"")}function c1(n,l){return l=u1(l),u1(n)===l}function Bt(n,l,c,v,b,w){switch(c){case"children":typeof v=="string"?l==="body"||l==="textarea"&&v===""||fl(n,v):(typeof v=="number"||typeof v=="bigint")&&l!=="body"&&fl(n,""+v);break;case"className":si(n,"class",v);break;case"tabIndex":si(n,"tabindex",v);break;case"dir":case"role":case"viewBox":case"width":case"height":si(n,c,v);break;case"style":cy(n,v,w);break;case"data":if(l!=="object"){si(n,"data",v);break}case"src":case"href":if(v===""&&(l!=="a"||c!=="href")){n.removeAttribute(c);break}if(v==null||typeof v=="function"||typeof v=="symbol"||typeof v=="boolean"){n.removeAttribute(c);break}v=Pc(""+v),n.setAttribute(c,v);break;case"action":case"formAction":if(typeof v=="function"){n.setAttribute(c,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof w=="function"&&(c==="formAction"?(l!=="input"&&Bt(n,l,"name",b.name,b,null),Bt(n,l,"formEncType",b.formEncType,b,null),Bt(n,l,"formMethod",b.formMethod,b,null),Bt(n,l,"formTarget",b.formTarget,b,null)):(Bt(n,l,"encType",b.encType,b,null),Bt(n,l,"method",b.method,b,null),Bt(n,l,"target",b.target,b,null)));if(v==null||typeof v=="symbol"||typeof v=="boolean"){n.removeAttribute(c);break}v=Pc(""+v),n.setAttribute(c,v);break;case"onClick":v!=null&&(n.onclick=Tn);break;case"onScroll":v!=null&&vt("scroll",n);break;case"onScrollEnd":v!=null&&vt("scrollend",n);break;case"dangerouslySetInnerHTML":if(v!=null){if(typeof v!="object"||!("__html"in v))throw Error(r(61));if(c=v.__html,c!=null){if(b.children!=null)throw Error(r(60));n.innerHTML=c}}break;case"multiple":n.multiple=v&&typeof v!="function"&&typeof v!="symbol";break;case"muted":n.muted=v&&typeof v!="function"&&typeof v!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(v==null||typeof v=="function"||typeof v=="boolean"||typeof v=="symbol"){n.removeAttribute("xlink:href");break}c=Pc(""+v),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":v!=null&&typeof v!="function"&&typeof v!="symbol"?n.setAttribute(c,""+v):n.removeAttribute(c);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":v&&typeof v!="function"&&typeof v!="symbol"?n.setAttribute(c,""):n.removeAttribute(c);break;case"capture":case"download":v===!0?n.setAttribute(c,""):v!==!1&&v!=null&&typeof v!="function"&&typeof v!="symbol"?n.setAttribute(c,v):n.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":v!=null&&typeof v!="function"&&typeof v!="symbol"&&!isNaN(v)&&1<=v?n.setAttribute(c,v):n.removeAttribute(c);break;case"rowSpan":case"start":v==null||typeof v=="function"||typeof v=="symbol"||isNaN(v)?n.removeAttribute(c):n.setAttribute(c,v);break;case"popover":vt("beforetoggle",n),vt("toggle",n),Qa(n,"popover",v);break;case"xlinkActuate":kr(n,"http://www.w3.org/1999/xlink","xlink:actuate",v);break;case"xlinkArcrole":kr(n,"http://www.w3.org/1999/xlink","xlink:arcrole",v);break;case"xlinkRole":kr(n,"http://www.w3.org/1999/xlink","xlink:role",v);break;case"xlinkShow":kr(n,"http://www.w3.org/1999/xlink","xlink:show",v);break;case"xlinkTitle":kr(n,"http://www.w3.org/1999/xlink","xlink:title",v);break;case"xlinkType":kr(n,"http://www.w3.org/1999/xlink","xlink:type",v);break;case"xmlBase":kr(n,"http://www.w3.org/XML/1998/namespace","xml:base",v);break;case"xmlLang":kr(n,"http://www.w3.org/XML/1998/namespace","xml:lang",v);break;case"xmlSpace":kr(n,"http://www.w3.org/XML/1998/namespace","xml:space",v);break;case"is":Qa(n,"is",v);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=zN.get(c)||c,Qa(n,c,v))}}function up(n,l,c,v,b,w){switch(c){case"style":cy(n,v,w);break;case"dangerouslySetInnerHTML":if(v!=null){if(typeof v!="object"||!("__html"in v))throw Error(r(61));if(c=v.__html,c!=null){if(b.children!=null)throw Error(r(60));n.innerHTML=c}}break;case"children":typeof v=="string"?fl(n,v):(typeof v=="number"||typeof v=="bigint")&&fl(n,""+v);break;case"onScroll":v!=null&&vt("scroll",n);break;case"onScrollEnd":v!=null&&vt("scrollend",n);break;case"onClick":v!=null&&(n.onclick=Tn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!kc.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(b=c.endsWith("Capture"),l=c.slice(2,b?c.length-7:void 0),w=n[ya]||null,w=w!=null?w[c]:null,typeof w=="function"&&n.removeEventListener(l,w,b),typeof v=="function")){typeof w!="function"&&w!==null&&(c in n?n[c]=null:n.hasAttribute(c)&&n.removeAttribute(c)),n.addEventListener(l,v,b);break e}c in n?n[c]=v:v===!0?n.setAttribute(c,""):Qa(n,c,v)}}}function _a(n,l,c){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":vt("error",n),vt("load",n);var v=!1,b=!1,w;for(w in c)if(c.hasOwnProperty(w)){var O=c[w];if(O!=null)switch(w){case"src":v=!0;break;case"srcSet":b=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,l));default:Bt(n,l,w,O,c,null)}}b&&Bt(n,l,"srcSet",c.srcSet,c,null),v&&Bt(n,l,"src",c.src,c,null);return;case"input":vt("invalid",n);var H=w=O=b=null,te=null,fe=null;for(v in c)if(c.hasOwnProperty(v)){var be=c[v];if(be!=null)switch(v){case"name":b=be;break;case"type":O=be;break;case"checked":te=be;break;case"defaultChecked":fe=be;break;case"value":w=be;break;case"defaultValue":H=be;break;case"children":case"dangerouslySetInnerHTML":if(be!=null)throw Error(r(137,l));break;default:Bt(n,l,v,be,c,null)}}sy(n,w,H,te,fe,O,b,!1);return;case"select":vt("invalid",n),v=O=w=null;for(b in c)if(c.hasOwnProperty(b)&&(H=c[b],H!=null))switch(b){case"value":w=H;break;case"defaultValue":O=H;break;case"multiple":v=H;default:Bt(n,l,b,H,c,null)}l=w,c=O,n.multiple=!!v,l!=null?dl(n,!!v,l,!1):c!=null&&dl(n,!!v,c,!0);return;case"textarea":vt("invalid",n),w=b=v=null;for(O in c)if(c.hasOwnProperty(O)&&(H=c[O],H!=null))switch(O){case"value":v=H;break;case"defaultValue":b=H;break;case"children":w=H;break;case"dangerouslySetInnerHTML":if(H!=null)throw Error(r(91));break;default:Bt(n,l,O,H,c,null)}oy(n,v,b,w);return;case"option":for(te in c)if(c.hasOwnProperty(te)&&(v=c[te],v!=null))switch(te){case"selected":n.selected=v&&typeof v!="function"&&typeof v!="symbol";break;default:Bt(n,l,te,v,c,null)}return;case"dialog":vt("beforetoggle",n),vt("toggle",n),vt("cancel",n),vt("close",n);break;case"iframe":case"object":vt("load",n);break;case"video":case"audio":for(v=0;v<xu.length;v++)vt(xu[v],n);break;case"image":vt("error",n),vt("load",n);break;case"details":vt("toggle",n);break;case"embed":case"source":case"link":vt("error",n),vt("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(fe in c)if(c.hasOwnProperty(fe)&&(v=c[fe],v!=null))switch(fe){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,l));default:Bt(n,l,fe,v,c,null)}return;default:if(Eh(l)){for(be in c)c.hasOwnProperty(be)&&(v=c[be],v!==void 0&&up(n,l,be,v,c,void 0));return}}for(H in c)c.hasOwnProperty(H)&&(v=c[H],v!=null&&Bt(n,l,H,v,c,null))}function u5(n,l,c,v){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var b=null,w=null,O=null,H=null,te=null,fe=null,be=null;for(ye in c){var Ce=c[ye];if(c.hasOwnProperty(ye)&&Ce!=null)switch(ye){case"checked":break;case"value":break;case"defaultValue":te=Ce;default:v.hasOwnProperty(ye)||Bt(n,l,ye,null,v,Ce)}}for(var ve in v){var ye=v[ve];if(Ce=c[ve],v.hasOwnProperty(ve)&&(ye!=null||Ce!=null))switch(ve){case"type":w=ye;break;case"name":b=ye;break;case"checked":fe=ye;break;case"defaultChecked":be=ye;break;case"value":O=ye;break;case"defaultValue":H=ye;break;case"children":case"dangerouslySetInnerHTML":if(ye!=null)throw Error(r(137,l));break;default:ye!==Ce&&Bt(n,l,ve,ye,v,Ce)}}wh(n,O,H,te,fe,be,w,b);return;case"select":ye=O=H=ve=null;for(w in c)if(te=c[w],c.hasOwnProperty(w)&&te!=null)switch(w){case"value":break;case"multiple":ye=te;default:v.hasOwnProperty(w)||Bt(n,l,w,null,v,te)}for(b in v)if(w=v[b],te=c[b],v.hasOwnProperty(b)&&(w!=null||te!=null))switch(b){case"value":ve=w;break;case"defaultValue":H=w;break;case"multiple":O=w;default:w!==te&&Bt(n,l,b,w,v,te)}l=H,c=O,v=ye,ve!=null?dl(n,!!c,ve,!1):!!v!=!!c&&(l!=null?dl(n,!!c,l,!0):dl(n,!!c,c?[]:"",!1));return;case"textarea":ye=ve=null;for(H in c)if(b=c[H],c.hasOwnProperty(H)&&b!=null&&!v.hasOwnProperty(H))switch(H){case"value":break;case"children":break;default:Bt(n,l,H,null,v,b)}for(O in v)if(b=v[O],w=c[O],v.hasOwnProperty(O)&&(b!=null||w!=null))switch(O){case"value":ve=b;break;case"defaultValue":ye=b;break;case"children":break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(r(91));break;default:b!==w&&Bt(n,l,O,b,v,w)}ly(n,ve,ye);return;case"option":for(var Ve in c)if(ve=c[Ve],c.hasOwnProperty(Ve)&&ve!=null&&!v.hasOwnProperty(Ve))switch(Ve){case"selected":n.selected=!1;break;default:Bt(n,l,Ve,null,v,ve)}for(te in v)if(ve=v[te],ye=c[te],v.hasOwnProperty(te)&&ve!==ye&&(ve!=null||ye!=null))switch(te){case"selected":n.selected=ve&&typeof ve!="function"&&typeof ve!="symbol";break;default:Bt(n,l,te,ve,v,ye)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var at in c)ve=c[at],c.hasOwnProperty(at)&&ve!=null&&!v.hasOwnProperty(at)&&Bt(n,l,at,null,v,ve);for(fe in v)if(ve=v[fe],ye=c[fe],v.hasOwnProperty(fe)&&ve!==ye&&(ve!=null||ye!=null))switch(fe){case"children":case"dangerouslySetInnerHTML":if(ve!=null)throw Error(r(137,l));break;default:Bt(n,l,fe,ve,v,ye)}return;default:if(Eh(l)){for(var Lt in c)ve=c[Lt],c.hasOwnProperty(Lt)&&ve!==void 0&&!v.hasOwnProperty(Lt)&&up(n,l,Lt,void 0,v,ve);for(be in v)ve=v[be],ye=c[be],!v.hasOwnProperty(be)||ve===ye||ve===void 0&&ye===void 0||up(n,l,be,ve,v,ye);return}}for(var ue in c)ve=c[ue],c.hasOwnProperty(ue)&&ve!=null&&!v.hasOwnProperty(ue)&&Bt(n,l,ue,null,v,ve);for(Ce in v)ve=v[Ce],ye=c[Ce],!v.hasOwnProperty(Ce)||ve===ye||ve==null&&ye==null||Bt(n,l,Ce,ve,v,ye)}function d1(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function c5(){if(typeof performance.getEntriesByType=="function"){for(var n=0,l=0,c=performance.getEntriesByType("resource"),v=0;v<c.length;v++){var b=c[v],w=b.transferSize,O=b.initiatorType,H=b.duration;if(w&&H&&d1(O)){for(O=0,H=b.responseEnd,v+=1;v<c.length;v++){var te=c[v],fe=te.startTime;if(fe>H)break;var be=te.transferSize,Ce=te.initiatorType;be&&d1(Ce)&&(te=te.responseEnd,O+=be*(te<H?1:(H-fe)/(te-fe)))}if(--v,l+=8*(w+O)/(b.duration/1e3),n++,10<n)break}}if(0<n)return l/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var cp=null,dp=null;function Rd(n){return n.nodeType===9?n:n.ownerDocument}function f1(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function h1(n,l){if(n===0)switch(l){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&l==="foreignObject"?0:n}function fp(n,l){return n==="textarea"||n==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.children=="bigint"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var hp=null;function d5(){var n=window.event;return n&&n.type==="popstate"?n===hp?!1:(hp=n,!0):(hp=null,!1)}var v1=typeof setTimeout=="function"?setTimeout:void 0,f5=typeof clearTimeout=="function"?clearTimeout:void 0,p1=typeof Promise=="function"?Promise:void 0,h5=typeof queueMicrotask=="function"?queueMicrotask:typeof p1<"u"?function(n){return p1.resolve(null).then(n).catch(v5)}:v1;function v5(n){setTimeout(function(){throw n})}function Ti(n){return n==="head"}function g1(n,l){var c=l,v=0;do{var b=c.nextSibling;if(n.removeChild(c),b&&b.nodeType===8)if(c=b.data,c==="/$"||c==="/&"){if(v===0){n.removeChild(b),Fl(l);return}v--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")v++;else if(c==="html")wu(n.ownerDocument.documentElement);else if(c==="head"){c=n.ownerDocument.head,wu(c);for(var w=c.firstChild;w;){var O=w.nextSibling,H=w.nodeName;w[ja]||H==="SCRIPT"||H==="STYLE"||H==="LINK"&&w.rel.toLowerCase()==="stylesheet"||c.removeChild(w),w=O}}else c==="body"&&wu(n.ownerDocument.body);c=b}while(c);Fl(l)}function m1(n,l){var c=n;n=0;do{var v=c.nextSibling;if(c.nodeType===1?l?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(l?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),v&&v.nodeType===8)if(c=v.data,c==="/$"){if(n===0)break;n--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||n++;c=v}while(c)}function vp(n){var l=n.firstChild;for(l&&l.nodeType===10&&(l=l.nextSibling);l;){var c=l;switch(l=l.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":vp(c),ul(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}n.removeChild(c)}}function p5(n,l,c,v){for(;n.nodeType===1;){var b=c;if(n.nodeName.toLowerCase()!==l.toLowerCase()){if(!v&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(v){if(!n[ja])switch(l){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(w=n.getAttribute("rel"),w==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(w!==b.rel||n.getAttribute("href")!==(b.href==null||b.href===""?null:b.href)||n.getAttribute("crossorigin")!==(b.crossOrigin==null?null:b.crossOrigin)||n.getAttribute("title")!==(b.title==null?null:b.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(w=n.getAttribute("src"),(w!==(b.src==null?null:b.src)||n.getAttribute("type")!==(b.type==null?null:b.type)||n.getAttribute("crossorigin")!==(b.crossOrigin==null?null:b.crossOrigin))&&w&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(l==="input"&&n.type==="hidden"){var w=b.name==null?null:""+b.name;if(b.type==="hidden"&&n.getAttribute("name")===w)return n}else return n;if(n=Ir(n.nextSibling),n===null)break}return null}function g5(n,l,c){if(l==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!c||(n=Ir(n.nextSibling),n===null))return null;return n}function y1(n,l){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!l||(n=Ir(n.nextSibling),n===null))return null;return n}function pp(n){return n.data==="$?"||n.data==="$~"}function gp(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function m5(n,l){var c=n.ownerDocument;if(n.data==="$~")n._reactRetry=l;else if(n.data!=="$?"||c.readyState!=="loading")l();else{var v=function(){l(),c.removeEventListener("DOMContentLoaded",v)};c.addEventListener("DOMContentLoaded",v),n._reactRetry=v}}function Ir(n){for(;n!=null;n=n.nextSibling){var l=n.nodeType;if(l===1||l===3)break;if(l===8){if(l=n.data,l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"||l==="F!"||l==="F")break;if(l==="/$"||l==="/&")return null}}return n}var mp=null;function x1(n){n=n.nextSibling;for(var l=0;n;){if(n.nodeType===8){var c=n.data;if(c==="/$"||c==="/&"){if(l===0)return Ir(n.nextSibling);l--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||l++}n=n.nextSibling}return null}function b1(n){n=n.previousSibling;for(var l=0;n;){if(n.nodeType===8){var c=n.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(l===0)return n;l--}else c!=="/$"&&c!=="/&"||l++}n=n.previousSibling}return null}function w1(n,l,c){switch(l=Rd(c),n){case"html":if(n=l.documentElement,!n)throw Error(r(452));return n;case"head":if(n=l.head,!n)throw Error(r(453));return n;case"body":if(n=l.body,!n)throw Error(r(454));return n;default:throw Error(r(451))}}function wu(n){for(var l=n.attributes;l.length;)n.removeAttributeNode(l[0]);ul(n)}var Vr=new Map,S1=new Set;function kd(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var qn=U.d;U.d={f:y5,r:x5,D:b5,C:w5,L:S5,m:E5,X:C5,S:T5,M:N5};function y5(){var n=qn.f(),l=Td();return n||l}function x5(n){var l=ni(n);l!==null&&l.tag===5&&l.type==="form"?Ux(l):qn.r(n)}var ql=typeof document>"u"?null:document;function E1(n,l,c){var v=ql;if(v&&typeof l=="string"&&l){var b=Br(l);b='link[rel="'+n+'"][href="'+b+'"]',typeof c=="string"&&(b+='[crossorigin="'+c+'"]'),S1.has(b)||(S1.add(b),n={rel:n,crossOrigin:c,href:l},v.querySelector(b)===null&&(l=v.createElement("link"),_a(l,"link",n),da(l),v.head.appendChild(l)))}}function b5(n){qn.D(n),E1("dns-prefetch",n,null)}function w5(n,l){qn.C(n,l),E1("preconnect",n,l)}function S5(n,l,c){qn.L(n,l,c);var v=ql;if(v&&n&&l){var b='link[rel="preload"][as="'+Br(l)+'"]';l==="image"&&c&&c.imageSrcSet?(b+='[imagesrcset="'+Br(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(b+='[imagesizes="'+Br(c.imageSizes)+'"]')):b+='[href="'+Br(n)+'"]';var w=b;switch(l){case"style":w=Il(n);break;case"script":w=Vl(n)}Vr.has(w)||(n=p({rel:"preload",href:l==="image"&&c&&c.imageSrcSet?void 0:n,as:l},c),Vr.set(w,n),v.querySelector(b)!==null||l==="style"&&v.querySelector(Su(w))||l==="script"&&v.querySelector(Eu(w))||(l=v.createElement("link"),_a(l,"link",n),da(l),v.head.appendChild(l)))}}function E5(n,l){qn.m(n,l);var c=ql;if(c&&n){var v=l&&typeof l.as=="string"?l.as:"script",b='link[rel="modulepreload"][as="'+Br(v)+'"][href="'+Br(n)+'"]',w=b;switch(v){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":w=Vl(n)}if(!Vr.has(w)&&(n=p({rel:"modulepreload",href:n},l),Vr.set(w,n),c.querySelector(b)===null)){switch(v){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Eu(w)))return}v=c.createElement("link"),_a(v,"link",n),da(v),c.head.appendChild(v)}}}function T5(n,l,c){qn.S(n,l,c);var v=ql;if(v&&n){var b=ii(v).hoistableStyles,w=Il(n);l=l||"default";var O=b.get(w);if(!O){var H={loading:0,preload:null};if(O=v.querySelector(Su(w)))H.loading=5;else{n=p({rel:"stylesheet",href:n,"data-precedence":l},c),(c=Vr.get(w))&&yp(n,c);var te=O=v.createElement("link");da(te),_a(te,"link",n),te._p=new Promise(function(fe,be){te.onload=fe,te.onerror=be}),te.addEventListener("load",function(){H.loading|=1}),te.addEventListener("error",function(){H.loading|=2}),H.loading|=4,Bd(O,l,v)}O={type:"stylesheet",instance:O,count:1,state:H},b.set(w,O)}}}function C5(n,l){qn.X(n,l);var c=ql;if(c&&n){var v=ii(c).hoistableScripts,b=Vl(n),w=v.get(b);w||(w=c.querySelector(Eu(b)),w||(n=p({src:n,async:!0},l),(l=Vr.get(b))&&xp(n,l),w=c.createElement("script"),da(w),_a(w,"link",n),c.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},v.set(b,w))}}function N5(n,l){qn.M(n,l);var c=ql;if(c&&n){var v=ii(c).hoistableScripts,b=Vl(n),w=v.get(b);w||(w=c.querySelector(Eu(b)),w||(n=p({src:n,async:!0,type:"module"},l),(l=Vr.get(b))&&xp(n,l),w=c.createElement("script"),da(w),_a(w,"link",n),c.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},v.set(b,w))}}function T1(n,l,c,v){var b=(b=ee.current)?kd(b):null;if(!b)throw Error(r(446));switch(n){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(l=Il(c.href),c=ii(b).hoistableStyles,v=c.get(l),v||(v={type:"style",instance:null,count:0,state:null},c.set(l,v)),v):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){n=Il(c.href);var w=ii(b).hoistableStyles,O=w.get(n);if(O||(b=b.ownerDocument||b,O={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},w.set(n,O),(w=b.querySelector(Su(n)))&&!w._p&&(O.instance=w,O.state.loading=5),Vr.has(n)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},Vr.set(n,c),w||j5(b,n,c,O.state))),l&&v===null)throw Error(r(528,""));return O}if(l&&v!==null)throw Error(r(529,""));return null;case"script":return l=c.async,c=c.src,typeof c=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=Vl(c),c=ii(b).hoistableScripts,v=c.get(l),v||(v={type:"script",instance:null,count:0,state:null},c.set(l,v)),v):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,n))}}function Il(n){return'href="'+Br(n)+'"'}function Su(n){return'link[rel="stylesheet"]['+n+"]"}function C1(n){return p({},n,{"data-precedence":n.precedence,precedence:null})}function j5(n,l,c,v){n.querySelector('link[rel="preload"][as="style"]['+l+"]")?v.loading=1:(l=n.createElement("link"),v.preload=l,l.addEventListener("load",function(){return v.loading|=1}),l.addEventListener("error",function(){return v.loading|=2}),_a(l,"link",c),da(l),n.head.appendChild(l))}function Vl(n){return'[src="'+Br(n)+'"]'}function Eu(n){return"script[async]"+n}function N1(n,l,c){if(l.count++,l.instance===null)switch(l.type){case"style":var v=n.querySelector('style[data-href~="'+Br(c.href)+'"]');if(v)return l.instance=v,da(v),v;var b=p({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return v=(n.ownerDocument||n).createElement("style"),da(v),_a(v,"style",b),Bd(v,c.precedence,n),l.instance=v;case"stylesheet":b=Il(c.href);var w=n.querySelector(Su(b));if(w)return l.state.loading|=4,l.instance=w,da(w),w;v=C1(c),(b=Vr.get(b))&&yp(v,b),w=(n.ownerDocument||n).createElement("link"),da(w);var O=w;return O._p=new Promise(function(H,te){O.onload=H,O.onerror=te}),_a(w,"link",v),l.state.loading|=4,Bd(w,c.precedence,n),l.instance=w;case"script":return w=Vl(c.src),(b=n.querySelector(Eu(w)))?(l.instance=b,da(b),b):(v=c,(b=Vr.get(w))&&(v=p({},c),xp(v,b)),n=n.ownerDocument||n,b=n.createElement("script"),da(b),_a(b,"link",v),n.head.appendChild(b),l.instance=b);case"void":return null;default:throw Error(r(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(v=l.instance,l.state.loading|=4,Bd(v,c.precedence,n));return l.instance}function Bd(n,l,c){for(var v=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),b=v.length?v[v.length-1]:null,w=b,O=0;O<v.length;O++){var H=v[O];if(H.dataset.precedence===l)w=H;else if(w!==b)break}w?w.parentNode.insertBefore(n,w.nextSibling):(l=c.nodeType===9?c.head:c,l.insertBefore(n,l.firstChild))}function yp(n,l){n.crossOrigin==null&&(n.crossOrigin=l.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=l.referrerPolicy),n.title==null&&(n.title=l.title)}function xp(n,l){n.crossOrigin==null&&(n.crossOrigin=l.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=l.referrerPolicy),n.integrity==null&&(n.integrity=l.integrity)}var Ld=null;function j1(n,l,c){if(Ld===null){var v=new Map,b=Ld=new Map;b.set(c,v)}else b=Ld,v=b.get(c),v||(v=new Map,b.set(c,v));if(v.has(n))return v;for(v.set(n,null),c=c.getElementsByTagName(n),b=0;b<c.length;b++){var w=c[b];if(!(w[ja]||w[Ht]||n==="link"&&w.getAttribute("rel")==="stylesheet")&&w.namespaceURI!=="http://www.w3.org/2000/svg"){var O=w.getAttribute(l)||"";O=n+O;var H=v.get(O);H?H.push(w):v.set(O,[w])}}return v}function A1(n,l,c){n=n.ownerDocument||n,n.head.insertBefore(c,l==="title"?n.querySelector("head > title"):null)}function A5(n,l,c){if(c===1||l.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;switch(l.rel){case"stylesheet":return n=l.disabled,typeof l.precedence=="string"&&n==null;default:return!0}case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function M1(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function M5(n,l,c,v){if(c.type==="stylesheet"&&(typeof v.media!="string"||matchMedia(v.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var b=Il(v.href),w=l.querySelector(Su(b));if(w){l=w._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(n.count++,n=zd.bind(n),l.then(n,n)),c.state.loading|=4,c.instance=w,da(w);return}w=l.ownerDocument||l,v=C1(v),(b=Vr.get(b))&&yp(v,b),w=w.createElement("link"),da(w);var O=w;O._p=new Promise(function(H,te){O.onload=H,O.onerror=te}),_a(w,"link",v),c.instance=w}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(c,l),(l=c.state.preload)&&(c.state.loading&3)===0&&(n.count++,c=zd.bind(n),l.addEventListener("load",c),l.addEventListener("error",c))}}var bp=0;function D5(n,l){return n.stylesheets&&n.count===0&&_d(n,n.stylesheets),0<n.count||0<n.imgCount?function(c){var v=setTimeout(function(){if(n.stylesheets&&_d(n,n.stylesheets),n.unsuspend){var w=n.unsuspend;n.unsuspend=null,w()}},6e4+l);0<n.imgBytes&&bp===0&&(bp=62500*c5());var b=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&_d(n,n.stylesheets),n.unsuspend)){var w=n.unsuspend;n.unsuspend=null,w()}},(n.imgBytes>bp?50:800)+l);return n.unsuspend=c,function(){n.unsuspend=null,clearTimeout(v),clearTimeout(b)}}:null}function zd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)_d(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var Pd=null;function _d(n,l){n.stylesheets=null,n.unsuspend!==null&&(n.count++,Pd=new Map,l.forEach(O5,n),Pd=null,zd.call(n))}function O5(n,l){if(!(l.state.loading&4)){var c=Pd.get(n);if(c)var v=c.get(null);else{c=new Map,Pd.set(n,c);for(var b=n.querySelectorAll("link[data-precedence],style[data-precedence]"),w=0;w<b.length;w++){var O=b[w];(O.nodeName==="LINK"||O.getAttribute("media")!=="not all")&&(c.set(O.dataset.precedence,O),v=O)}v&&c.set(null,v)}b=l.instance,O=b.getAttribute("data-precedence"),w=c.get(O)||v,w===v&&c.set(null,b),c.set(O,b),this.count++,v=zd.bind(this),b.addEventListener("load",v),b.addEventListener("error",v),w?w.parentNode.insertBefore(b,w.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(b,n.firstChild)),l.state.loading|=4}}var Tu={$$typeof:N,Provider:null,Consumer:null,_currentValue:F,_currentValue2:F,_threadCount:0};function R5(n,l,c,v,b,w,O,H,te){this.tag=1,this.containerInfo=n,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Yt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Yt(0),this.hiddenUpdates=Yt(null),this.identifierPrefix=v,this.onUncaughtError=b,this.onCaughtError=w,this.onRecoverableError=O,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=te,this.incompleteTransitions=new Map}function D1(n,l,c,v,b,w,O,H,te,fe,be,Ce){return n=new R5(n,l,c,O,te,fe,be,Ce,H),l=1,w===!0&&(l|=24),w=wr(3,null,null,l),n.current=w,w.stateNode=n,l=Jh(),l.refCount++,n.pooledCache=l,l.refCount++,w.memoizedState={element:v,isDehydrated:c,cache:l},rv(w),n}function O1(n){return n?(n=xl,n):xl}function R1(n,l,c,v,b,w){b=O1(b),v.context===null?v.context=b:v.pendingContext=b,v=hi(l),v.payload={element:c},w=w===void 0?null:w,w!==null&&(v.callback=w),c=vi(n,v,l),c!==null&&(hr(c,n,l),au(c,n,l))}function k1(n,l){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var c=n.retryLane;n.retryLane=c!==0&&c<l?c:l}}function wp(n,l){k1(n,l),(n=n.alternate)&&k1(n,l)}function B1(n){if(n.tag===13||n.tag===31){var l=ys(n,67108864);l!==null&&hr(l,n,67108864),wp(n,67108864)}}function L1(n){if(n.tag===13||n.tag===31){var l=Nr();l=sa(l);var c=ys(n,l);c!==null&&hr(c,n,l),wp(n,l)}}var Ud=!0;function k5(n,l,c,v){var b=P.T;P.T=null;var w=U.p;try{U.p=2,Sp(n,l,c,v)}finally{U.p=w,P.T=b}}function B5(n,l,c,v){var b=P.T;P.T=null;var w=U.p;try{U.p=8,Sp(n,l,c,v)}finally{U.p=w,P.T=b}}function Sp(n,l,c,v){if(Ud){var b=Ep(v);if(b===null)op(n,l,v,qd,c),P1(n,v);else if(z5(b,n,l,c,v))v.stopPropagation();else if(P1(n,v),l&4&&-1<L5.indexOf(n)){for(;b!==null;){var w=ni(b);if(w!==null)switch(w.tag){case 3:if(w=w.stateNode,w.current.memoizedState.isDehydrated){var O=it(w.pendingLanes);if(O!==0){var H=w;for(H.pendingLanes|=2,H.entangledLanes|=2;O;){var te=1<<31-ge(O);H.entanglements[1]|=te,O&=~te}dn(w),(Nt&6)===0&&(Sd=Re()+500,yu(0))}}break;case 31:case 13:H=ys(w,2),H!==null&&hr(H,w,2),Td(),wp(w,2)}if(w=Ep(v),w===null&&op(n,l,v,qd,c),w===b)break;b=w}b!==null&&v.stopPropagation()}else op(n,l,v,null,c)}}function Ep(n){return n=Ch(n),Tp(n)}var qd=null;function Tp(n){if(qd=null,n=ri(n),n!==null){var l=s(n);if(l===null)n=null;else{var c=l.tag;if(c===13){if(n=o(l),n!==null)return n;n=null}else if(c===31){if(n=u(l),n!==null)return n;n=null}else if(c===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;n=null}else l!==n&&(n=null)}}return qd=n,null}function z1(n){switch(n){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(nt()){case xe:return 2;case pe:return 8;case Ye:case tt:return 32;case Ke:return 268435456;default:return 32}default:return 32}}var Cp=!1,Ci=null,Ni=null,ji=null,Cu=new Map,Nu=new Map,Ai=[],L5="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function P1(n,l){switch(n){case"focusin":case"focusout":Ci=null;break;case"dragenter":case"dragleave":Ni=null;break;case"mouseover":case"mouseout":ji=null;break;case"pointerover":case"pointerout":Cu.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":Nu.delete(l.pointerId)}}function ju(n,l,c,v,b,w){return n===null||n.nativeEvent!==w?(n={blockedOn:l,domEventName:c,eventSystemFlags:v,nativeEvent:w,targetContainers:[b]},l!==null&&(l=ni(l),l!==null&&B1(l)),n):(n.eventSystemFlags|=v,l=n.targetContainers,b!==null&&l.indexOf(b)===-1&&l.push(b),n)}function z5(n,l,c,v,b){switch(l){case"focusin":return Ci=ju(Ci,n,l,c,v,b),!0;case"dragenter":return Ni=ju(Ni,n,l,c,v,b),!0;case"mouseover":return ji=ju(ji,n,l,c,v,b),!0;case"pointerover":var w=b.pointerId;return Cu.set(w,ju(Cu.get(w)||null,n,l,c,v,b)),!0;case"gotpointercapture":return w=b.pointerId,Nu.set(w,ju(Nu.get(w)||null,n,l,c,v,b)),!0}return!1}function _1(n){var l=ri(n.target);if(l!==null){var c=s(l);if(c!==null){if(l=c.tag,l===13){if(l=o(c),l!==null){n.blockedOn=l,Rr(n.priority,function(){L1(c)});return}}else if(l===31){if(l=u(c),l!==null){n.blockedOn=l,Rr(n.priority,function(){L1(c)});return}}else if(l===3&&c.stateNode.current.memoizedState.isDehydrated){n.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}n.blockedOn=null}function Id(n){if(n.blockedOn!==null)return!1;for(var l=n.targetContainers;0<l.length;){var c=Ep(n.nativeEvent);if(c===null){c=n.nativeEvent;var v=new c.constructor(c.type,c);Th=v,c.target.dispatchEvent(v),Th=null}else return l=ni(c),l!==null&&B1(l),n.blockedOn=c,!1;l.shift()}return!0}function U1(n,l,c){Id(n)&&c.delete(l)}function P5(){Cp=!1,Ci!==null&&Id(Ci)&&(Ci=null),Ni!==null&&Id(Ni)&&(Ni=null),ji!==null&&Id(ji)&&(ji=null),Cu.forEach(U1),Nu.forEach(U1)}function Vd(n,l){n.blockedOn===l&&(n.blockedOn=null,Cp||(Cp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,P5)))}var Fd=null;function q1(n){Fd!==n&&(Fd=n,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Fd===n&&(Fd=null);for(var l=0;l<n.length;l+=3){var c=n[l],v=n[l+1],b=n[l+2];if(typeof v!="function"){if(Tp(v||c)===null)continue;break}var w=ni(c);w!==null&&(n.splice(l,3),l-=3,Ev(w,{pending:!0,data:b,method:c.method,action:v},v,b))}}))}function Fl(n){function l(te){return Vd(te,n)}Ci!==null&&Vd(Ci,n),Ni!==null&&Vd(Ni,n),ji!==null&&Vd(ji,n),Cu.forEach(l),Nu.forEach(l);for(var c=0;c<Ai.length;c++){var v=Ai[c];v.blockedOn===n&&(v.blockedOn=null)}for(;0<Ai.length&&(c=Ai[0],c.blockedOn===null);)_1(c),c.blockedOn===null&&Ai.shift();if(c=(n.ownerDocument||n).$$reactFormReplay,c!=null)for(v=0;v<c.length;v+=3){var b=c[v],w=c[v+1],O=b[ya]||null;if(typeof w=="function")O||q1(c);else if(O){var H=null;if(w&&w.hasAttribute("formAction")){if(b=w,O=w[ya]||null)H=O.formAction;else if(Tp(b)!==null)continue}else H=O.action;typeof H=="function"?c[v+1]=H:(c.splice(v,3),v-=3),q1(c)}}}function I1(){function n(w){w.canIntercept&&w.info==="react-transition"&&w.intercept({handler:function(){return new Promise(function(O){return b=O})},focusReset:"manual",scroll:"manual"})}function l(){b!==null&&(b(),b=null),v||setTimeout(c,20)}function c(){if(!v&&!navigation.transition){var w=navigation.currentEntry;w&&w.url!=null&&navigation.navigate(w.url,{state:w.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var v=!1,b=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",l),navigation.addEventListener("navigateerror",l),setTimeout(c,100),function(){v=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",l),navigation.removeEventListener("navigateerror",l),b!==null&&(b(),b=null)}}}function Np(n){this._internalRoot=n}Hd.prototype.render=Np.prototype.render=function(n){var l=this._internalRoot;if(l===null)throw Error(r(409));var c=l.current,v=Nr();R1(c,v,n,l,null,null)},Hd.prototype.unmount=Np.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var l=n.containerInfo;R1(n.current,2,null,n,null,null),Td(),l[sr]=null}};function Hd(n){this._internalRoot=n}Hd.prototype.unstable_scheduleHydration=function(n){if(n){var l=$t();n={blockedOn:null,target:n,priority:l};for(var c=0;c<Ai.length&&l!==0&&l<Ai[c].priority;c++);Ai.splice(c,0,n),c===0&&_1(n)}};var V1=e.version;if(V1!=="19.2.4")throw Error(r(527,V1,"19.2.4"));U.findDOMNode=function(n){var l=n._reactInternals;if(l===void 0)throw typeof n.render=="function"?Error(r(188)):(n=Object.keys(n).join(","),Error(r(268,n)));return n=f(l),n=n!==null?h(n):null,n=n===null?null:n.stateNode,n};var _5={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:P,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Gd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Gd.isDisabled&&Gd.supportsFiber)try{Y=Gd.inject(_5),ce=Gd}catch{}}return Mu.createRoot=function(n,l){if(!i(n))throw Error(r(299));var c=!1,v="",b=$x,w=Xx,O=Zx;return l!=null&&(l.unstable_strictMode===!0&&(c=!0),l.identifierPrefix!==void 0&&(v=l.identifierPrefix),l.onUncaughtError!==void 0&&(b=l.onUncaughtError),l.onCaughtError!==void 0&&(w=l.onCaughtError),l.onRecoverableError!==void 0&&(O=l.onRecoverableError)),l=D1(n,1,!1,null,null,c,v,null,b,w,O,I1),n[sr]=l.current,lp(n),new Np(l)},Mu.hydrateRoot=function(n,l,c){if(!i(n))throw Error(r(299));var v=!1,b="",w=$x,O=Xx,H=Zx,te=null;return c!=null&&(c.unstable_strictMode===!0&&(v=!0),c.identifierPrefix!==void 0&&(b=c.identifierPrefix),c.onUncaughtError!==void 0&&(w=c.onUncaughtError),c.onCaughtError!==void 0&&(O=c.onCaughtError),c.onRecoverableError!==void 0&&(H=c.onRecoverableError),c.formState!==void 0&&(te=c.formState)),l=D1(n,1,!0,l,c??null,v,b,te,w,O,H,I1),l.context=O1(null),c=l.current,v=Nr(),v=sa(v),b=hi(v),b.callback=null,vi(c,b,v),c=v,l.current.lanes=c,Rt(l,c),dn(l),n[sr]=l.current,lp(n),new Hd(l)},Mu.version="19.2.4",Mu}var J1;function X5(){if(J1)return Op.exports;J1=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Op.exports=$5(),Op.exports}var Z5=X5();const W5=AE(Z5);var jf=OE();/**
|
|
50
|
+
* @remix-run/router v1.23.2
|
|
51
|
+
*
|
|
52
|
+
* Copyright (c) Remix Software Inc.
|
|
53
|
+
*
|
|
54
|
+
* This source code is licensed under the MIT license found in the
|
|
55
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
56
|
+
*
|
|
57
|
+
* @license MIT
|
|
58
|
+
*/function Qu(){return Qu=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var a=arguments[e];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(t[r]=a[r])}return t},Qu.apply(this,arguments)}var Gi;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(Gi||(Gi={}));const e2="popstate";function J5(t){t===void 0&&(t={});function e(r,i){let{pathname:s,search:o,hash:u}=r.location;return ym("",{pathname:s,search:o,hash:u},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function a(r,i){return typeof i=="string"?i:Af(i)}return tA(e,a,null,t)}function ua(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function p0(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function eA(){return Math.random().toString(36).substr(2,8)}function t2(t,e){return{usr:t.state,key:t.key,idx:e}}function ym(t,e,a,r){return a===void 0&&(a=null),Qu({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Do(e):e,{state:a,key:e&&e.key||r||eA()})}function Af(t){let{pathname:e="/",search:a="",hash:r=""}=t;return a&&a!=="?"&&(e+=a.charAt(0)==="?"?a:"?"+a),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Do(t){let e={};if(t){let a=t.indexOf("#");a>=0&&(e.hash=t.substr(a),t=t.substr(0,a));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function tA(t,e,a,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:s=!1}=r,o=i.history,u=Gi.Pop,d=null,f=h();f==null&&(f=0,o.replaceState(Qu({},o.state,{idx:f}),""));function h(){return(o.state||{idx:null}).idx}function p(){u=Gi.Pop;let S=h(),T=S==null?null:S-f;f=S,d&&d({action:u,location:E.location,delta:T})}function m(S,T){u=Gi.Push;let C=ym(E.location,S,T);f=h()+1;let N=t2(C,f),A=E.createHref(C);try{o.pushState(N,"",A)}catch(M){if(M instanceof DOMException&&M.name==="DataCloneError")throw M;i.location.assign(A)}s&&d&&d({action:u,location:E.location,delta:1})}function y(S,T){u=Gi.Replace;let C=ym(E.location,S,T);f=h();let N=t2(C,f),A=E.createHref(C);o.replaceState(N,"",A),s&&d&&d({action:u,location:E.location,delta:0})}function x(S){let T=i.location.origin!=="null"?i.location.origin:i.location.href,C=typeof S=="string"?S:Af(S);return C=C.replace(/ $/,"%20"),ua(T,"No window.location.(origin|href) available to create URL for href: "+C),new URL(C,T)}let E={get action(){return u},get location(){return t(i,o)},listen(S){if(d)throw new Error("A history only accepts one active listener");return i.addEventListener(e2,p),d=S,()=>{i.removeEventListener(e2,p),d=null}},createHref(S){return e(i,S)},createURL:x,encodeLocation(S){let T=x(S);return{pathname:T.pathname,search:T.search,hash:T.hash}},push:m,replace:y,go(S){return o.go(S)}};return E}var a2;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(a2||(a2={}));function aA(t,e,a){return a===void 0&&(a="/"),rA(t,e,a)}function rA(t,e,a,r){let i=typeof e=="string"?Do(e):e,s=g0(i.pathname||"/",a);if(s==null)return null;let o=RE(t);nA(o);let u=null;for(let d=0;u==null&&d<o.length;++d){let f=gA(s);u=hA(o[d],f)}return u}function RE(t,e,a,r){e===void 0&&(e=[]),a===void 0&&(a=[]),r===void 0&&(r="");let i=(s,o,u)=>{let d={relativePath:u===void 0?s.path||"":u,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};d.relativePath.startsWith("/")&&(ua(d.relativePath.startsWith(r),'Absolute route path "'+d.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),d.relativePath=d.relativePath.slice(r.length));let f=$i([r,d.relativePath]),h=a.concat(d);s.children&&s.children.length>0&&(ua(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+f+'".')),RE(s.children,e,h,f)),!(s.path==null&&!s.index)&&e.push({path:f,score:dA(f,s.index),routesMeta:h})};return t.forEach((s,o)=>{var u;if(s.path===""||!((u=s.path)!=null&&u.includes("?")))i(s,o);else for(let d of kE(s.path))i(s,o,d)}),e}function kE(t){let e=t.split("/");if(e.length===0)return[];let[a,...r]=e,i=a.endsWith("?"),s=a.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let o=kE(r.join("/")),u=[];return u.push(...o.map(d=>d===""?s:[s,d].join("/"))),i&&u.push(...o),u.map(d=>t.startsWith("/")&&d===""?"/":d)}function nA(t){t.sort((e,a)=>e.score!==a.score?a.score-e.score:fA(e.routesMeta.map(r=>r.childrenIndex),a.routesMeta.map(r=>r.childrenIndex)))}const iA=/^:[\w-]+$/,sA=3,lA=2,oA=1,uA=10,cA=-2,r2=t=>t==="*";function dA(t,e){let a=t.split("/"),r=a.length;return a.some(r2)&&(r+=cA),e&&(r+=lA),a.filter(i=>!r2(i)).reduce((i,s)=>i+(iA.test(s)?sA:s===""?oA:uA),r)}function fA(t,e){return t.length===e.length&&t.slice(0,-1).every((r,i)=>r===e[i])?t[t.length-1]-e[e.length-1]:0}function hA(t,e,a){let{routesMeta:r}=t,i={},s="/",o=[];for(let u=0;u<r.length;++u){let d=r[u],f=u===r.length-1,h=s==="/"?e:e.slice(s.length)||"/",p=vA({path:d.relativePath,caseSensitive:d.caseSensitive,end:f},h),m=d.route;if(!p)return null;Object.assign(i,p.params),o.push({params:i,pathname:$i([s,p.pathname]),pathnameBase:wA($i([s,p.pathnameBase])),route:m}),p.pathnameBase!=="/"&&(s=$i([s,p.pathnameBase]))}return o}function vA(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[a,r]=pA(t.path,t.caseSensitive,t.end),i=e.match(a);if(!i)return null;let s=i[0],o=s.replace(/(.)\/+$/,"$1"),u=i.slice(1);return{params:r.reduce((f,h,p)=>{let{paramName:m,isOptional:y}=h;if(m==="*"){let E=u[p]||"";o=s.slice(0,s.length-E.length).replace(/(.)\/+$/,"$1")}const x=u[p];return y&&!x?f[m]=void 0:f[m]=(x||"").replace(/%2F/g,"/"),f},{}),pathname:s,pathnameBase:o,pattern:t}}function pA(t,e,a){e===void 0&&(e=!1),a===void 0&&(a=!0),p0(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,u,d)=>(r.push({paramName:u,isOptional:d!=null}),d?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):a?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),r]}function gA(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return p0(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function g0(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let a=e.endsWith("/")?e.length-1:e.length,r=t.charAt(a);return r&&r!=="/"?null:t.slice(a)||"/"}const mA=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,yA=t=>mA.test(t);function xA(t,e){e===void 0&&(e="/");let{pathname:a,search:r="",hash:i=""}=typeof t=="string"?Do(t):t,s;if(a)if(yA(a))s=a;else{if(a.includes("//")){let o=a;a=a.replace(/\/\/+/g,"/"),p0(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+a))}a.startsWith("/")?s=n2(a.substring(1),"/"):s=n2(a,e)}else s=e;return{pathname:s,search:SA(r),hash:EA(i)}}function n2(t,e){let a=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?a.length>1&&a.pop():i!=="."&&a.push(i)}),a.length>1?a.join("/"):"/"}function Lp(t,e,a,r){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+a+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function bA(t){return t.filter((e,a)=>a===0||e.route.path&&e.route.path.length>0)}function m0(t,e){let a=bA(t);return e?a.map((r,i)=>i===a.length-1?r.pathname:r.pathnameBase):a.map(r=>r.pathnameBase)}function y0(t,e,a,r){r===void 0&&(r=!1);let i;typeof t=="string"?i=Do(t):(i=Qu({},t),ua(!i.pathname||!i.pathname.includes("?"),Lp("?","pathname","search",i)),ua(!i.pathname||!i.pathname.includes("#"),Lp("#","pathname","hash",i)),ua(!i.search||!i.search.includes("#"),Lp("#","search","hash",i)));let s=t===""||i.pathname==="",o=s?"/":i.pathname,u;if(o==null)u=a;else{let p=e.length-1;if(!r&&o.startsWith("..")){let m=o.split("/");for(;m[0]==="..";)m.shift(),p-=1;i.pathname=m.join("/")}u=p>=0?e[p]:"/"}let d=xA(i,u),f=o&&o!=="/"&&o.endsWith("/"),h=(s||o===".")&&a.endsWith("/");return!d.pathname.endsWith("/")&&(f||h)&&(d.pathname+="/"),d}const $i=t=>t.join("/").replace(/\/\/+/g,"/"),wA=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),SA=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,EA=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function TA(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const BE=["post","put","patch","delete"];new Set(BE);const CA=["get",...BE];new Set(CA);/**
|
|
59
|
+
* React Router v6.30.3
|
|
60
|
+
*
|
|
61
|
+
* Copyright (c) Remix Software Inc.
|
|
62
|
+
*
|
|
63
|
+
* This source code is licensed under the MIT license found in the
|
|
64
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
65
|
+
*
|
|
66
|
+
* @license MIT
|
|
67
|
+
*/function Yu(){return Yu=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var a=arguments[e];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(t[r]=a[r])}return t},Yu.apply(this,arguments)}const x0=I.createContext(null),NA=I.createContext(null),ss=I.createContext(null),Kf=I.createContext(null),Jn=I.createContext({outlet:null,matches:[],isDataRoute:!1}),LE=I.createContext(null);function jA(t,e){let{relative:a}=e===void 0?{}:e;Oo()||ua(!1);let{basename:r,navigator:i}=I.useContext(ss),{hash:s,pathname:o,search:u}=_E(t,{relative:a}),d=o;return r!=="/"&&(d=o==="/"?r:$i([r,o])),i.createHref({pathname:d,search:u,hash:s})}function Oo(){return I.useContext(Kf)!=null}function ls(){return Oo()||ua(!1),I.useContext(Kf).location}function zE(t){I.useContext(ss).static||I.useLayoutEffect(t)}function $r(){let{isDataRoute:t}=I.useContext(Jn);return t?qA():AA()}function AA(){Oo()||ua(!1);let t=I.useContext(x0),{basename:e,future:a,navigator:r}=I.useContext(ss),{matches:i}=I.useContext(Jn),{pathname:s}=ls(),o=JSON.stringify(m0(i,a.v7_relativeSplatPath)),u=I.useRef(!1);return zE(()=>{u.current=!0}),I.useCallback(function(f,h){if(h===void 0&&(h={}),!u.current)return;if(typeof f=="number"){r.go(f);return}let p=y0(f,JSON.parse(o),s,h.relative==="path");t==null&&e!=="/"&&(p.pathname=p.pathname==="/"?e:$i([e,p.pathname])),(h.replace?r.replace:r.push)(p,h.state,h)},[e,r,o,s,t])}function PE(){let{matches:t}=I.useContext(Jn),e=t[t.length-1];return e?e.params:{}}function _E(t,e){let{relative:a}=e===void 0?{}:e,{future:r}=I.useContext(ss),{matches:i}=I.useContext(Jn),{pathname:s}=ls(),o=JSON.stringify(m0(i,r.v7_relativeSplatPath));return I.useMemo(()=>y0(t,JSON.parse(o),s,a==="path"),[t,o,s,a])}function MA(t,e){return DA(t,e)}function DA(t,e,a,r){Oo()||ua(!1);let{navigator:i}=I.useContext(ss),{matches:s}=I.useContext(Jn),o=s[s.length-1],u=o?o.params:{};o&&o.pathname;let d=o?o.pathnameBase:"/";o&&o.route;let f=ls(),h;if(e){var p;let S=typeof e=="string"?Do(e):e;d==="/"||(p=S.pathname)!=null&&p.startsWith(d)||ua(!1),h=S}else h=f;let m=h.pathname||"/",y=m;if(d!=="/"){let S=d.replace(/^\//,"").split("/");y="/"+m.replace(/^\//,"").split("/").slice(S.length).join("/")}let x=aA(t,{pathname:y}),E=LA(x&&x.map(S=>Object.assign({},S,{params:Object.assign({},u,S.params),pathname:$i([d,i.encodeLocation?i.encodeLocation(S.pathname).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?d:$i([d,i.encodeLocation?i.encodeLocation(S.pathnameBase).pathname:S.pathnameBase])})),s,a,r);return e&&E?I.createElement(Kf.Provider,{value:{location:Yu({pathname:"/",search:"",hash:"",state:null,key:"default"},h),navigationType:Gi.Pop}},E):E}function OA(){let t=UA(),e=TA(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),a=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return I.createElement(I.Fragment,null,I.createElement("h2",null,"Unexpected Application Error!"),I.createElement("h3",{style:{fontStyle:"italic"}},e),a?I.createElement("pre",{style:i},a):null,null)}const RA=I.createElement(OA,null);class kA extends I.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,a){return a.location!==e.location||a.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:a.error,location:a.location,revalidation:e.revalidation||a.revalidation}}componentDidCatch(e,a){console.error("React Router caught the following error during render",e,a)}render(){return this.state.error!==void 0?I.createElement(Jn.Provider,{value:this.props.routeContext},I.createElement(LE.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function BA(t){let{routeContext:e,match:a,children:r}=t,i=I.useContext(x0);return i&&i.static&&i.staticContext&&(a.route.errorElement||a.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=a.route.id),I.createElement(Jn.Provider,{value:e},r)}function LA(t,e,a,r){var i;if(e===void 0&&(e=[]),a===void 0&&(a=null),r===void 0&&(r=null),t==null){var s;if(!a)return null;if(a.errors)t=a.matches;else if((s=r)!=null&&s.v7_partialHydration&&e.length===0&&!a.initialized&&a.matches.length>0)t=a.matches;else return null}let o=t,u=(i=a)==null?void 0:i.errors;if(u!=null){let h=o.findIndex(p=>p.route.id&&(u==null?void 0:u[p.route.id])!==void 0);h>=0||ua(!1),o=o.slice(0,Math.min(o.length,h+1))}let d=!1,f=-1;if(a&&r&&r.v7_partialHydration)for(let h=0;h<o.length;h++){let p=o[h];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(f=h),p.route.id){let{loaderData:m,errors:y}=a,x=p.route.loader&&m[p.route.id]===void 0&&(!y||y[p.route.id]===void 0);if(p.route.lazy||x){d=!0,f>=0?o=o.slice(0,f+1):o=[o[0]];break}}}return o.reduceRight((h,p,m)=>{let y,x=!1,E=null,S=null;a&&(y=u&&p.route.id?u[p.route.id]:void 0,E=p.route.errorElement||RA,d&&(f<0&&m===0?(IA("route-fallback"),x=!0,S=null):f===m&&(x=!0,S=p.route.hydrateFallbackElement||null)));let T=e.concat(o.slice(0,m+1)),C=()=>{let N;return y?N=E:x?N=S:p.route.Component?N=I.createElement(p.route.Component,null):p.route.element?N=p.route.element:N=h,I.createElement(BA,{match:p,routeContext:{outlet:h,matches:T,isDataRoute:a!=null},children:N})};return a&&(p.route.ErrorBoundary||p.route.errorElement||m===0)?I.createElement(kA,{location:a.location,revalidation:a.revalidation,component:E,error:y,children:C(),routeContext:{outlet:null,matches:T,isDataRoute:!0}}):C()},null)}var UE=(function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t})(UE||{}),qE=(function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t})(qE||{});function zA(t){let e=I.useContext(x0);return e||ua(!1),e}function PA(t){let e=I.useContext(NA);return e||ua(!1),e}function _A(t){let e=I.useContext(Jn);return e||ua(!1),e}function IE(t){let e=_A(),a=e.matches[e.matches.length-1];return a.route.id||ua(!1),a.route.id}function UA(){var t;let e=I.useContext(LE),a=PA(),r=IE();return e!==void 0?e:(t=a.errors)==null?void 0:t[r]}function qA(){let{router:t}=zA(UE.UseNavigateStable),e=IE(qE.UseNavigateStable),a=I.useRef(!1);return zE(()=>{a.current=!0}),I.useCallback(function(i,s){s===void 0&&(s={}),a.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,Yu({fromRouteId:e},s)))},[t,e])}const i2={};function IA(t,e,a){i2[t]||(i2[t]=!0)}function VA(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function FA(t){let{to:e,replace:a,state:r,relative:i}=t;Oo()||ua(!1);let{future:s,static:o}=I.useContext(ss),{matches:u}=I.useContext(Jn),{pathname:d}=ls(),f=$r(),h=y0(e,m0(u,s.v7_relativeSplatPath),d,i==="path"),p=JSON.stringify(h);return I.useEffect(()=>f(JSON.parse(p),{replace:a,state:r,relative:i}),[f,p,i,a,r]),null}function xm(t){ua(!1)}function HA(t){let{basename:e="/",children:a=null,location:r,navigationType:i=Gi.Pop,navigator:s,static:o=!1,future:u}=t;Oo()&&ua(!1);let d=e.replace(/^\/*/,"/"),f=I.useMemo(()=>({basename:d,navigator:s,static:o,future:Yu({v7_relativeSplatPath:!1},u)}),[d,u,s,o]);typeof r=="string"&&(r=Do(r));let{pathname:h="/",search:p="",hash:m="",state:y=null,key:x="default"}=r,E=I.useMemo(()=>{let S=g0(h,d);return S==null?null:{location:{pathname:S,search:p,hash:m,state:y,key:x},navigationType:i}},[d,h,p,m,y,x,i]);return E==null?null:I.createElement(ss.Provider,{value:f},I.createElement(Kf.Provider,{children:a,value:E}))}function GA(t){let{children:e,location:a}=t;return MA(bm(e),a)}new Promise(()=>{});function bm(t,e){e===void 0&&(e=[]);let a=[];return I.Children.forEach(t,(r,i)=>{if(!I.isValidElement(r))return;let s=[...e,i];if(r.type===I.Fragment){a.push.apply(a,bm(r.props.children,s));return}r.type!==xm&&ua(!1),!r.props.index||!r.props.children||ua(!1);let o={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=bm(r.props.children,s)),a.push(o)}),a}/**
|
|
68
|
+
* React Router DOM v6.30.3
|
|
69
|
+
*
|
|
70
|
+
* Copyright (c) Remix Software Inc.
|
|
71
|
+
*
|
|
72
|
+
* This source code is licensed under the MIT license found in the
|
|
73
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
74
|
+
*
|
|
75
|
+
* @license MIT
|
|
76
|
+
*/function wm(){return wm=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var a=arguments[e];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(t[r]=a[r])}return t},wm.apply(this,arguments)}function QA(t,e){if(t==null)return{};var a={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(a[i]=t[i]);return a}function YA(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function KA(t,e){return t.button===0&&(!e||e==="_self")&&!YA(t)}const $A=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],XA="6";try{window.__reactRouterVersion=XA}catch{}const ZA="startTransition",s2=DE[ZA];function WA(t){let{basename:e,children:a,future:r,window:i}=t,s=I.useRef();s.current==null&&(s.current=J5({window:i,v5Compat:!0}));let o=s.current,[u,d]=I.useState({action:o.action,location:o.location}),{v7_startTransition:f}=r||{},h=I.useCallback(p=>{f&&s2?s2(()=>d(p)):d(p)},[d,f]);return I.useLayoutEffect(()=>o.listen(h),[o,h]),I.useEffect(()=>VA(r),[r]),I.createElement(HA,{basename:e,children:a,location:u.location,navigationType:u.action,navigator:o,future:r})}const JA=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",eM=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ua=I.forwardRef(function(e,a){let{onClick:r,relative:i,reloadDocument:s,replace:o,state:u,target:d,to:f,preventScrollReset:h,viewTransition:p}=e,m=QA(e,$A),{basename:y}=I.useContext(ss),x,E=!1;if(typeof f=="string"&&eM.test(f)&&(x=f,JA))try{let N=new URL(window.location.href),A=f.startsWith("//")?new URL(N.protocol+f):new URL(f),M=g0(A.pathname,y);A.origin===N.origin&&M!=null?f=M+A.search+A.hash:E=!0}catch{}let S=jA(f,{relative:i}),T=tM(f,{replace:o,state:u,target:d,preventScrollReset:h,relative:i,viewTransition:p});function C(N){r&&r(N),N.defaultPrevented||T(N)}return I.createElement("a",wm({},m,{href:x||S,onClick:E||s?r:C,ref:a,target:d}))});var l2;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(l2||(l2={}));var o2;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(o2||(o2={}));function tM(t,e){let{target:a,replace:r,state:i,preventScrollReset:s,relative:o,viewTransition:u}=e===void 0?{}:e,d=$r(),f=ls(),h=_E(t,{relative:o});return I.useCallback(p=>{if(KA(p,a)){p.preventDefault();let m=r!==void 0?r:Af(f)===Af(h);d(t,{replace:m,state:i,preventScrollReset:s,relative:o,viewTransition:u})}},[f,d,h,r,i,a,t,s,o,u])}var nl=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},aM={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},Li,h0,gE,rM=(gE=class{constructor(){_e(this,Li,aM);_e(this,h0,!1)}setTimeoutProvider(t){Me(this,Li,t)}setTimeout(t,e){return Z(this,Li).setTimeout(t,e)}clearTimeout(t){Z(this,Li).clearTimeout(t)}setInterval(t,e){return Z(this,Li).setInterval(t,e)}clearInterval(t){Z(this,Li).clearInterval(t)}},Li=new WeakMap,h0=new WeakMap,gE),_s=new rM;function nM(t){setTimeout(t,0)}var $s=typeof window>"u"||"Deno"in globalThis;function $a(){}function iM(t,e){return typeof t=="function"?t(e):t}function Sm(t){return typeof t=="number"&&t>=0&&t!==1/0}function VE(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Xi(t,e){return typeof t=="function"?t(e):t}function Qr(t,e){return typeof t=="function"?t(e):t}function u2(t,e){const{type:a="all",exact:r,fetchStatus:i,predicate:s,queryKey:o,stale:u}=t;if(o){if(r){if(e.queryHash!==b0(o,e.options))return!1}else if(!Ku(e.queryKey,o))return!1}if(a!=="all"){const d=e.isActive();if(a==="active"&&!d||a==="inactive"&&d)return!1}return!(typeof u=="boolean"&&e.isStale()!==u||i&&i!==e.state.fetchStatus||s&&!s(e))}function c2(t,e){const{exact:a,status:r,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(a){if(Ji(e.options.mutationKey)!==Ji(s))return!1}else if(!Ku(e.options.mutationKey,s))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function b0(t,e){return((e==null?void 0:e.queryKeyHashFn)||Ji)(t)}function Ji(t){return JSON.stringify(t,(e,a)=>Em(a)?Object.keys(a).sort().reduce((r,i)=>(r[i]=a[i],r),{}):a)}function Ku(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(a=>Ku(t[a],e[a])):!1}var sM=Object.prototype.hasOwnProperty;function w0(t,e,a=0){if(t===e)return t;if(a>500)return e;const r=d2(t)&&d2(e);if(!r&&!(Em(t)&&Em(e)))return e;const s=(r?t:Object.keys(t)).length,o=r?e:Object.keys(e),u=o.length,d=r?new Array(u):{};let f=0;for(let h=0;h<u;h++){const p=r?h:o[h],m=t[p],y=e[p];if(m===y){d[p]=m,(r?h<s:sM.call(t,p))&&f++;continue}if(m===null||y===null||typeof m!="object"||typeof y!="object"){d[p]=y;continue}const x=w0(m,y,a+1);d[p]=x,x===m&&f++}return s===u&&f===s?t:d}function $u(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const a in t)if(t[a]!==e[a])return!1;return!0}function d2(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function Em(t){if(!f2(t))return!1;const e=t.constructor;if(e===void 0)return!0;const a=e.prototype;return!(!f2(a)||!a.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function f2(t){return Object.prototype.toString.call(t)==="[object Object]"}function lM(t){return new Promise(e=>{_s.setTimeout(e,t)})}function Tm(t,e,a){return typeof a.structuralSharing=="function"?a.structuralSharing(t,e):a.structuralSharing!==!1?w0(t,e):e}function oM(t,e,a=0){const r=[...t,e];return a&&r.length>a?r.slice(1):r}function uM(t,e,a=0){const r=[e,...t];return a&&r.length>a?r.slice(0,-1):r}var Ar=Symbol();function FE(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===Ar?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function S0(t,e){return typeof t=="function"?t(...e):!!t}function cM(t,e,a){let r=!1,i;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(i??(i=e()),r||(r=!0,i.aborted?a():i.addEventListener("abort",a,{once:!0})),i)}),t}var qs,zi,co,mE,dM=(mE=class extends nl{constructor(){super();_e(this,qs);_e(this,zi);_e(this,co);Me(this,co,e=>{if(!$s&&window.addEventListener){const a=()=>e();return window.addEventListener("visibilitychange",a,!1),()=>{window.removeEventListener("visibilitychange",a)}}})}onSubscribe(){Z(this,zi)||this.setEventListener(Z(this,co))}onUnsubscribe(){var e;this.hasListeners()||((e=Z(this,zi))==null||e.call(this),Me(this,zi,void 0))}setEventListener(e){var a;Me(this,co,e),(a=Z(this,zi))==null||a.call(this),Me(this,zi,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){Z(this,qs)!==e&&(Me(this,qs,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(a=>{a(e)})}isFocused(){var e;return typeof Z(this,qs)=="boolean"?Z(this,qs):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},qs=new WeakMap,zi=new WeakMap,co=new WeakMap,mE),E0=new dM;function Cm(){let t,e;const a=new Promise((i,s)=>{t=i,e=s});a.status="pending",a.catch(()=>{});function r(i){Object.assign(a,i),delete a.resolve,delete a.reject}return a.resolve=i=>{r({status:"fulfilled",value:i}),t(i)},a.reject=i=>{r({status:"rejected",reason:i}),e(i)},a}var fM=nM;function hM(){let t=[],e=0,a=u=>{u()},r=u=>{u()},i=fM;const s=u=>{e?t.push(u):i(()=>{a(u)})},o=()=>{const u=t;t=[],u.length&&i(()=>{r(()=>{u.forEach(d=>{a(d)})})})};return{batch:u=>{let d;e++;try{d=u()}finally{e--,e||o()}return d},batchCalls:u=>(...d)=>{s(()=>{u(...d)})},schedule:s,setNotifyFunction:u=>{a=u},setBatchNotifyFunction:u=>{r=u},setScheduler:u=>{i=u}}}var aa=hM(),fo,Pi,ho,yE,vM=(yE=class extends nl{constructor(){super();_e(this,fo,!0);_e(this,Pi);_e(this,ho);Me(this,ho,e=>{if(!$s&&window.addEventListener){const a=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",a,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",a),window.removeEventListener("offline",r)}}})}onSubscribe(){Z(this,Pi)||this.setEventListener(Z(this,ho))}onUnsubscribe(){var e;this.hasListeners()||((e=Z(this,Pi))==null||e.call(this),Me(this,Pi,void 0))}setEventListener(e){var a;Me(this,ho,e),(a=Z(this,Pi))==null||a.call(this),Me(this,Pi,e(this.setOnline.bind(this)))}setOnline(e){Z(this,fo)!==e&&(Me(this,fo,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return Z(this,fo)}},fo=new WeakMap,Pi=new WeakMap,ho=new WeakMap,yE),Mf=new vM;function pM(t){return Math.min(1e3*2**t,3e4)}function HE(t){return(t??"online")==="online"?Mf.isOnline():!0}var Nm=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function GE(t){let e=!1,a=0,r;const i=Cm(),s=()=>i.status!=="pending",o=E=>{var S;if(!s()){const T=new Nm(E);m(T),(S=t.onCancel)==null||S.call(t,T)}},u=()=>{e=!0},d=()=>{e=!1},f=()=>E0.isFocused()&&(t.networkMode==="always"||Mf.isOnline())&&t.canRun(),h=()=>HE(t.networkMode)&&t.canRun(),p=E=>{s()||(r==null||r(),i.resolve(E))},m=E=>{s()||(r==null||r(),i.reject(E))},y=()=>new Promise(E=>{var S;r=T=>{(s()||f())&&E(T)},(S=t.onPause)==null||S.call(t)}).then(()=>{var E;r=void 0,s()||(E=t.onContinue)==null||E.call(t)}),x=()=>{if(s())return;let E;const S=a===0?t.initialPromise:void 0;try{E=S??t.fn()}catch(T){E=Promise.reject(T)}Promise.resolve(E).then(p).catch(T=>{var D;if(s())return;const C=t.retry??($s?0:3),N=t.retryDelay??pM,A=typeof N=="function"?N(a,T):N,M=C===!0||typeof C=="number"&&a<C||typeof C=="function"&&C(a,T);if(e||!M){m(T);return}a++,(D=t.onFail)==null||D.call(t,a,T),lM(A).then(()=>f()?void 0:y()).then(()=>{e?m(T):x()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r==null||r(),i),cancelRetry:u,continueRetry:d,canStart:h,start:()=>(h()?x():y().then(x),i)}}var Is,xE,QE=(xE=class{constructor(){_e(this,Is)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Sm(this.gcTime)&&Me(this,Is,_s.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??($s?1/0:300*1e3))}clearGcTimeout(){Z(this,Is)&&(_s.clearTimeout(Z(this,Is)),Me(this,Is,void 0))}},Is=new WeakMap,xE),Vs,vo,Hr,Fs,Da,lc,Hs,Jr,Vn,bE,gM=(bE=class extends QE{constructor(e){super();_e(this,Jr);_e(this,Vs);_e(this,vo);_e(this,Hr);_e(this,Fs);_e(this,Da);_e(this,lc);_e(this,Hs);Me(this,Hs,!1),Me(this,lc,e.defaultOptions),this.setOptions(e.options),this.observers=[],Me(this,Fs,e.client),Me(this,Hr,Z(this,Fs).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,Me(this,Vs,v2(this.options)),this.state=e.state??Z(this,Vs),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=Z(this,Da))==null?void 0:e.promise}setOptions(e){if(this.options={...Z(this,lc),...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const a=v2(this.options);a.data!==void 0&&(this.setState(h2(a.data,a.dataUpdatedAt)),Me(this,Vs,a))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&Z(this,Hr).remove(this)}setData(e,a){const r=Tm(this.state.data,e,this.options);return rt(this,Jr,Vn).call(this,{data:r,type:"success",dataUpdatedAt:a==null?void 0:a.updatedAt,manual:a==null?void 0:a.manual}),r}setState(e,a){rt(this,Jr,Vn).call(this,{type:"setState",state:e,setStateOptions:a})}cancel(e){var r,i;const a=(r=Z(this,Da))==null?void 0:r.promise;return(i=Z(this,Da))==null||i.cancel(e),a?a.then($a).catch($a):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(Z(this,Vs))}isActive(){return this.observers.some(e=>Qr(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ar||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Xi(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!VE(this.state.dataUpdatedAt,e)}onFocus(){var a;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(a=Z(this,Da))==null||a.continue()}onOnline(){var a;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(a=Z(this,Da))==null||a.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),Z(this,Hr).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(a=>a!==e),this.observers.length||(Z(this,Da)&&(Z(this,Hs)?Z(this,Da).cancel({revert:!0}):Z(this,Da).cancelRetry()),this.scheduleGc()),Z(this,Hr).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||rt(this,Jr,Vn).call(this,{type:"invalidate"})}async fetch(e,a){var d,f,h,p,m,y,x,E,S,T,C,N;if(this.state.fetchStatus!=="idle"&&((d=Z(this,Da))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(a!=null&&a.cancelRefetch))this.cancel({silent:!0});else if(Z(this,Da))return Z(this,Da).continueRetry(),Z(this,Da).promise}if(e&&this.setOptions(e),!this.options.queryFn){const A=this.observers.find(M=>M.options.queryFn);A&&this.setOptions(A.options)}const r=new AbortController,i=A=>{Object.defineProperty(A,"signal",{enumerable:!0,get:()=>(Me(this,Hs,!0),r.signal)})},s=()=>{const A=FE(this.options,a),D=(()=>{const j={client:Z(this,Fs),queryKey:this.queryKey,meta:this.meta};return i(j),j})();return Me(this,Hs,!1),this.options.persister?this.options.persister(A,D,this):A(D)},u=(()=>{const A={fetchOptions:a,options:this.options,queryKey:this.queryKey,client:Z(this,Fs),state:this.state,fetchFn:s};return i(A),A})();(f=this.options.behavior)==null||f.onFetch(u,this),Me(this,vo,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((h=u.fetchOptions)==null?void 0:h.meta))&&rt(this,Jr,Vn).call(this,{type:"fetch",meta:(p=u.fetchOptions)==null?void 0:p.meta}),Me(this,Da,GE({initialPromise:a==null?void 0:a.initialPromise,fn:u.fetchFn,onCancel:A=>{A instanceof Nm&&A.revert&&this.setState({...Z(this,vo),fetchStatus:"idle"}),r.abort()},onFail:(A,M)=>{rt(this,Jr,Vn).call(this,{type:"failed",failureCount:A,error:M})},onPause:()=>{rt(this,Jr,Vn).call(this,{type:"pause"})},onContinue:()=>{rt(this,Jr,Vn).call(this,{type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0}));try{const A=await Z(this,Da).start();if(A===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(A),(y=(m=Z(this,Hr).config).onSuccess)==null||y.call(m,A,this),(E=(x=Z(this,Hr).config).onSettled)==null||E.call(x,A,this.state.error,this),A}catch(A){if(A instanceof Nm){if(A.silent)return Z(this,Da).promise;if(A.revert){if(this.state.data===void 0)throw A;return this.state.data}}throw rt(this,Jr,Vn).call(this,{type:"error",error:A}),(T=(S=Z(this,Hr).config).onError)==null||T.call(S,A,this),(N=(C=Z(this,Hr).config).onSettled)==null||N.call(C,this.state.data,A,this),A}finally{this.scheduleGc()}}},Vs=new WeakMap,vo=new WeakMap,Hr=new WeakMap,Fs=new WeakMap,Da=new WeakMap,lc=new WeakMap,Hs=new WeakMap,Jr=new WeakSet,Vn=function(e){const a=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...YE(r.data,this.options),fetchMeta:e.meta??null};case"success":const i={...r,...h2(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Me(this,vo,e.manual?i:void 0),i;case"error":const s=e.error;return{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=a(this.state),aa.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),Z(this,Hr).notify({query:this,type:"updated",action:e})})},bE);function YE(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:HE(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function h2(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function v2(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,a=e!==void 0,r=a?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:a?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:a?"success":"pending",fetchStatus:"idle"}}var vr,yt,oc,tr,Gs,po,Hn,_i,uc,go,mo,Qs,Ys,Ui,yo,Mt,_u,jm,Am,Mm,Dm,Om,Rm,km,KE,wE,gc=(wE=class extends nl{constructor(e,a){super();_e(this,Mt);_e(this,vr);_e(this,yt);_e(this,oc);_e(this,tr);_e(this,Gs);_e(this,po);_e(this,Hn);_e(this,_i);_e(this,uc);_e(this,go);_e(this,mo);_e(this,Qs);_e(this,Ys);_e(this,Ui);_e(this,yo,new Set);this.options=a,Me(this,vr,e),Me(this,_i,null),Me(this,Hn,Cm()),this.bindMethods(),this.setOptions(a)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(Z(this,yt).addObserver(this),p2(Z(this,yt),this.options)?rt(this,Mt,_u).call(this):this.updateResult(),rt(this,Mt,Dm).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Bm(Z(this,yt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Bm(Z(this,yt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,rt(this,Mt,Om).call(this),rt(this,Mt,Rm).call(this),Z(this,yt).removeObserver(this)}setOptions(e){const a=this.options,r=Z(this,yt);if(this.options=Z(this,vr).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Qr(this.options.enabled,Z(this,yt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");rt(this,Mt,km).call(this),Z(this,yt).setOptions(this.options),a._defaulted&&!$u(this.options,a)&&Z(this,vr).getQueryCache().notify({type:"observerOptionsUpdated",query:Z(this,yt),observer:this});const i=this.hasListeners();i&&g2(Z(this,yt),r,this.options,a)&&rt(this,Mt,_u).call(this),this.updateResult(),i&&(Z(this,yt)!==r||Qr(this.options.enabled,Z(this,yt))!==Qr(a.enabled,Z(this,yt))||Xi(this.options.staleTime,Z(this,yt))!==Xi(a.staleTime,Z(this,yt)))&&rt(this,Mt,jm).call(this);const s=rt(this,Mt,Am).call(this);i&&(Z(this,yt)!==r||Qr(this.options.enabled,Z(this,yt))!==Qr(a.enabled,Z(this,yt))||s!==Z(this,Ui))&&rt(this,Mt,Mm).call(this,s)}getOptimisticResult(e){const a=Z(this,vr).getQueryCache().build(Z(this,vr),e),r=this.createResult(a,e);return yM(this,r)&&(Me(this,tr,r),Me(this,po,this.options),Me(this,Gs,Z(this,yt).state)),r}getCurrentResult(){return Z(this,tr)}trackResult(e,a){return new Proxy(e,{get:(r,i)=>(this.trackProp(i),a==null||a(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&Z(this,Hn).status==="pending"&&Z(this,Hn).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(e){Z(this,yo).add(e)}getCurrentQuery(){return Z(this,yt)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const a=Z(this,vr).defaultQueryOptions(e),r=Z(this,vr).getQueryCache().build(Z(this,vr),a);return r.fetch().then(()=>this.createResult(r,a))}fetch(e){return rt(this,Mt,_u).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),Z(this,tr)))}createResult(e,a){var L;const r=Z(this,yt),i=this.options,s=Z(this,tr),o=Z(this,Gs),u=Z(this,po),f=e!==r?e.state:Z(this,oc),{state:h}=e;let p={...h},m=!1,y;if(a._optimisticResults){const z=this.hasListeners(),_=!z&&p2(e,a),B=z&&g2(e,r,a,i);(_||B)&&(p={...p,...YE(h.data,e.options)}),a._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:x,errorUpdatedAt:E,status:S}=p;y=p.data;let T=!1;if(a.placeholderData!==void 0&&y===void 0&&S==="pending"){let z;s!=null&&s.isPlaceholderData&&a.placeholderData===(u==null?void 0:u.placeholderData)?(z=s.data,T=!0):z=typeof a.placeholderData=="function"?a.placeholderData((L=Z(this,mo))==null?void 0:L.state.data,Z(this,mo)):a.placeholderData,z!==void 0&&(S="success",y=Tm(s==null?void 0:s.data,z,a),m=!0)}if(a.select&&y!==void 0&&!T)if(s&&y===(o==null?void 0:o.data)&&a.select===Z(this,uc))y=Z(this,go);else try{Me(this,uc,a.select),y=a.select(y),y=Tm(s==null?void 0:s.data,y,a),Me(this,go,y),Me(this,_i,null)}catch(z){Me(this,_i,z)}Z(this,_i)&&(x=Z(this,_i),y=Z(this,go),E=Date.now(),S="error");const C=p.fetchStatus==="fetching",N=S==="pending",A=S==="error",M=N&&C,D=y!==void 0,R={status:S,fetchStatus:p.fetchStatus,isPending:N,isSuccess:S==="success",isError:A,isInitialLoading:M,isLoading:M,data:y,dataUpdatedAt:p.dataUpdatedAt,error:x,errorUpdatedAt:E,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:p.dataUpdateCount>0||p.errorUpdateCount>0,isFetchedAfterMount:p.dataUpdateCount>f.dataUpdateCount||p.errorUpdateCount>f.errorUpdateCount,isFetching:C,isRefetching:C&&!N,isLoadingError:A&&!D,isPaused:p.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:A&&D,isStale:T0(e,a),refetch:this.refetch,promise:Z(this,Hn),isEnabled:Qr(a.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const z=R.data!==void 0,_=R.status==="error"&&!z,B=Q=>{_?Q.reject(R.error):z&&Q.resolve(R.data)},q=()=>{const Q=Me(this,Hn,R.promise=Cm());B(Q)},V=Z(this,Hn);switch(V.status){case"pending":e.queryHash===r.queryHash&&B(V);break;case"fulfilled":(_||R.data!==V.value)&&q();break;case"rejected":(!_||R.error!==V.reason)&&q();break}}return R}updateResult(){const e=Z(this,tr),a=this.createResult(Z(this,yt),this.options);if(Me(this,Gs,Z(this,yt).state),Me(this,po,this.options),Z(this,Gs).data!==void 0&&Me(this,mo,Z(this,yt)),$u(a,e))return;Me(this,tr,a);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,s=typeof i=="function"?i():i;if(s==="all"||!s&&!Z(this,yo).size)return!0;const o=new Set(s??Z(this,yo));return this.options.throwOnError&&o.add("error"),Object.keys(Z(this,tr)).some(u=>{const d=u;return Z(this,tr)[d]!==e[d]&&o.has(d)})};rt(this,Mt,KE).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&rt(this,Mt,Dm).call(this)}},vr=new WeakMap,yt=new WeakMap,oc=new WeakMap,tr=new WeakMap,Gs=new WeakMap,po=new WeakMap,Hn=new WeakMap,_i=new WeakMap,uc=new WeakMap,go=new WeakMap,mo=new WeakMap,Qs=new WeakMap,Ys=new WeakMap,Ui=new WeakMap,yo=new WeakMap,Mt=new WeakSet,_u=function(e){rt(this,Mt,km).call(this);let a=Z(this,yt).fetch(this.options,e);return e!=null&&e.throwOnError||(a=a.catch($a)),a},jm=function(){rt(this,Mt,Om).call(this);const e=Xi(this.options.staleTime,Z(this,yt));if($s||Z(this,tr).isStale||!Sm(e))return;const r=VE(Z(this,tr).dataUpdatedAt,e)+1;Me(this,Qs,_s.setTimeout(()=>{Z(this,tr).isStale||this.updateResult()},r))},Am=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(Z(this,yt)):this.options.refetchInterval)??!1},Mm=function(e){rt(this,Mt,Rm).call(this),Me(this,Ui,e),!($s||Qr(this.options.enabled,Z(this,yt))===!1||!Sm(Z(this,Ui))||Z(this,Ui)===0)&&Me(this,Ys,_s.setInterval(()=>{(this.options.refetchIntervalInBackground||E0.isFocused())&&rt(this,Mt,_u).call(this)},Z(this,Ui)))},Dm=function(){rt(this,Mt,jm).call(this),rt(this,Mt,Mm).call(this,rt(this,Mt,Am).call(this))},Om=function(){Z(this,Qs)&&(_s.clearTimeout(Z(this,Qs)),Me(this,Qs,void 0))},Rm=function(){Z(this,Ys)&&(_s.clearInterval(Z(this,Ys)),Me(this,Ys,void 0))},km=function(){const e=Z(this,vr).getQueryCache().build(Z(this,vr),this.options);if(e===Z(this,yt))return;const a=Z(this,yt);Me(this,yt,e),Me(this,oc,e.state),this.hasListeners()&&(a==null||a.removeObserver(this),e.addObserver(this))},KE=function(e){aa.batch(()=>{e.listeners&&this.listeners.forEach(a=>{a(Z(this,tr))}),Z(this,vr).getQueryCache().notify({query:Z(this,yt),type:"observerResultsUpdated"})})},wE);function mM(t,e){return Qr(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function p2(t,e){return mM(t,e)||t.state.data!==void 0&&Bm(t,e,e.refetchOnMount)}function Bm(t,e,a){if(Qr(e.enabled,t)!==!1&&Xi(e.staleTime,t)!=="static"){const r=typeof a=="function"?a(t):a;return r==="always"||r!==!1&&T0(t,e)}return!1}function g2(t,e,a,r){return(t!==e||Qr(r.enabled,t)===!1)&&(!a.suspense||t.state.status!=="error")&&T0(t,a)}function T0(t,e){return Qr(e.enabled,t)!==!1&&t.isStaleByTime(Xi(e.staleTime,t))}function yM(t,e){return!$u(t.getCurrentResult(),e)}function Df(t){return{onFetch:(e,a)=>{var h,p,m,y,x;const r=e.options,i=(m=(p=(h=e.fetchOptions)==null?void 0:h.meta)==null?void 0:p.fetchMore)==null?void 0:m.direction,s=((y=e.state.data)==null?void 0:y.pages)||[],o=((x=e.state.data)==null?void 0:x.pageParams)||[];let u={pages:[],pageParams:[]},d=0;const f=async()=>{let E=!1;const S=N=>{cM(N,()=>e.signal,()=>E=!0)},T=FE(e.options,e.fetchOptions),C=async(N,A,M)=>{if(E)return Promise.reject();if(A==null&&N.pages.length)return Promise.resolve(N);const j=(()=>{const _={client:e.client,queryKey:e.queryKey,pageParam:A,direction:M?"backward":"forward",meta:e.options.meta};return S(_),_})(),R=await T(j),{maxPages:L}=e.options,z=M?uM:oM;return{pages:z(N.pages,R,L),pageParams:z(N.pageParams,A,L)}};if(i&&s.length){const N=i==="backward",A=N?$E:Lm,M={pages:s,pageParams:o},D=A(r,M);u=await C(M,D,N)}else{const N=t??s.length;do{const A=d===0?o[0]??r.initialPageParam:Lm(r,u);if(d>0&&A==null)break;u=await C(u,A),d++}while(d<N)}return u};e.options.persister?e.fetchFn=()=>{var E,S;return(S=(E=e.options).persister)==null?void 0:S.call(E,f,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},a)}:e.fetchFn=f}}}function Lm(t,{pages:e,pageParams:a}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,a[r],a):void 0}function $E(t,{pages:e,pageParams:a}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,a[0],a):void 0}function xM(t,e){return e?Lm(t,e)!=null:!1}function bM(t,e){return!e||!t.getPreviousPageParam?!1:$E(t,e)!=null}var XE=class extends gc{constructor(t,e){super(t,e)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(t){super.setOptions({...t,behavior:Df()})}getOptimisticResult(t){return t.behavior=Df(),super.getOptimisticResult(t)}fetchNextPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"backward"}}})}createResult(t,e){var x,E;const{state:a}=t,r=super.createResult(t,e),{isFetching:i,isRefetching:s,isError:o,isRefetchError:u}=r,d=(E=(x=a.fetchMeta)==null?void 0:x.fetchMore)==null?void 0:E.direction,f=o&&d==="forward",h=i&&d==="forward",p=o&&d==="backward",m=i&&d==="backward";return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:xM(e,a.data),hasPreviousPage:bM(e,a.data),isFetchNextPageError:f,isFetchingNextPage:h,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:u&&!f&&!p,isRefetching:s&&!h&&!m}}},cc,gn,Ka,Ks,mn,Ri,SE,wM=(SE=class extends QE{constructor(e){super();_e(this,mn);_e(this,cc);_e(this,gn);_e(this,Ka);_e(this,Ks);Me(this,cc,e.client),this.mutationId=e.mutationId,Me(this,Ka,e.mutationCache),Me(this,gn,[]),this.state=e.state||ZE(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){Z(this,gn).includes(e)||(Z(this,gn).push(e),this.clearGcTimeout(),Z(this,Ka).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){Me(this,gn,Z(this,gn).filter(a=>a!==e)),this.scheduleGc(),Z(this,Ka).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){Z(this,gn).length||(this.state.status==="pending"?this.scheduleGc():Z(this,Ka).remove(this))}continue(){var e;return((e=Z(this,Ks))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var o,u,d,f,h,p,m,y,x,E,S,T,C,N,A,M,D,j;const a=()=>{rt(this,mn,Ri).call(this,{type:"continue"})},r={client:Z(this,cc),meta:this.options.meta,mutationKey:this.options.mutationKey};Me(this,Ks,GE({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(R,L)=>{rt(this,mn,Ri).call(this,{type:"failed",failureCount:R,error:L})},onPause:()=>{rt(this,mn,Ri).call(this,{type:"pause"})},onContinue:a,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>Z(this,Ka).canRun(this)}));const i=this.state.status==="pending",s=!Z(this,Ks).canStart();try{if(i)a();else{rt(this,mn,Ri).call(this,{type:"pending",variables:e,isPaused:s}),Z(this,Ka).config.onMutate&&await Z(this,Ka).config.onMutate(e,this,r);const L=await((u=(o=this.options).onMutate)==null?void 0:u.call(o,e,r));L!==this.state.context&&rt(this,mn,Ri).call(this,{type:"pending",context:L,variables:e,isPaused:s})}const R=await Z(this,Ks).start();return await((f=(d=Z(this,Ka).config).onSuccess)==null?void 0:f.call(d,R,e,this.state.context,this,r)),await((p=(h=this.options).onSuccess)==null?void 0:p.call(h,R,e,this.state.context,r)),await((y=(m=Z(this,Ka).config).onSettled)==null?void 0:y.call(m,R,null,this.state.variables,this.state.context,this,r)),await((E=(x=this.options).onSettled)==null?void 0:E.call(x,R,null,e,this.state.context,r)),rt(this,mn,Ri).call(this,{type:"success",data:R}),R}catch(R){try{await((T=(S=Z(this,Ka).config).onError)==null?void 0:T.call(S,R,e,this.state.context,this,r))}catch(L){Promise.reject(L)}try{await((N=(C=this.options).onError)==null?void 0:N.call(C,R,e,this.state.context,r))}catch(L){Promise.reject(L)}try{await((M=(A=Z(this,Ka).config).onSettled)==null?void 0:M.call(A,void 0,R,this.state.variables,this.state.context,this,r))}catch(L){Promise.reject(L)}try{await((j=(D=this.options).onSettled)==null?void 0:j.call(D,void 0,R,e,this.state.context,r))}catch(L){Promise.reject(L)}throw rt(this,mn,Ri).call(this,{type:"error",error:R}),R}finally{Z(this,Ka).runNext(this)}}},cc=new WeakMap,gn=new WeakMap,Ka=new WeakMap,Ks=new WeakMap,mn=new WeakSet,Ri=function(e){const a=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=a(this.state),aa.batch(()=>{Z(this,gn).forEach(r=>{r.onMutationUpdate(e)}),Z(this,Ka).notify({mutation:this,type:"updated",action:e})})},SE);function ZE(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Gn,en,dc,EE,SM=(EE=class extends nl{constructor(e={}){super();_e(this,Gn);_e(this,en);_e(this,dc);this.config=e,Me(this,Gn,new Set),Me(this,en,new Map),Me(this,dc,0)}build(e,a,r){const i=new wM({client:e,mutationCache:this,mutationId:++Qd(this,dc)._,options:e.defaultMutationOptions(a),state:r});return this.add(i),i}add(e){Z(this,Gn).add(e);const a=Yd(e);if(typeof a=="string"){const r=Z(this,en).get(a);r?r.push(e):Z(this,en).set(a,[e])}this.notify({type:"added",mutation:e})}remove(e){if(Z(this,Gn).delete(e)){const a=Yd(e);if(typeof a=="string"){const r=Z(this,en).get(a);if(r)if(r.length>1){const i=r.indexOf(e);i!==-1&&r.splice(i,1)}else r[0]===e&&Z(this,en).delete(a)}}this.notify({type:"removed",mutation:e})}canRun(e){const a=Yd(e);if(typeof a=="string"){const r=Z(this,en).get(a),i=r==null?void 0:r.find(s=>s.state.status==="pending");return!i||i===e}else return!0}runNext(e){var r;const a=Yd(e);if(typeof a=="string"){const i=(r=Z(this,en).get(a))==null?void 0:r.find(s=>s!==e&&s.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){aa.batch(()=>{Z(this,Gn).forEach(e=>{this.notify({type:"removed",mutation:e})}),Z(this,Gn).clear(),Z(this,en).clear()})}getAll(){return Array.from(Z(this,Gn))}find(e){const a={exact:!0,...e};return this.getAll().find(r=>c2(a,r))}findAll(e={}){return this.getAll().filter(a=>c2(e,a))}notify(e){aa.batch(()=>{this.listeners.forEach(a=>{a(e)})})}resumePausedMutations(){const e=this.getAll().filter(a=>a.state.isPaused);return aa.batch(()=>Promise.all(e.map(a=>a.continue().catch($a))))}},Gn=new WeakMap,en=new WeakMap,dc=new WeakMap,EE);function Yd(t){var e;return(e=t.options.scope)==null?void 0:e.id}var Qn,qi,pr,Yn,$n,hf,zm,TE,EM=(TE=class extends nl{constructor(a,r){super();_e(this,$n);_e(this,Qn);_e(this,qi);_e(this,pr);_e(this,Yn);Me(this,Qn,a),this.setOptions(r),this.bindMethods(),rt(this,$n,hf).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(a){var i;const r=this.options;this.options=Z(this,Qn).defaultMutationOptions(a),$u(this.options,r)||Z(this,Qn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:Z(this,pr),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Ji(r.mutationKey)!==Ji(this.options.mutationKey)?this.reset():((i=Z(this,pr))==null?void 0:i.state.status)==="pending"&&Z(this,pr).setOptions(this.options)}onUnsubscribe(){var a;this.hasListeners()||(a=Z(this,pr))==null||a.removeObserver(this)}onMutationUpdate(a){rt(this,$n,hf).call(this),rt(this,$n,zm).call(this,a)}getCurrentResult(){return Z(this,qi)}reset(){var a;(a=Z(this,pr))==null||a.removeObserver(this),Me(this,pr,void 0),rt(this,$n,hf).call(this),rt(this,$n,zm).call(this)}mutate(a,r){var i;return Me(this,Yn,r),(i=Z(this,pr))==null||i.removeObserver(this),Me(this,pr,Z(this,Qn).getMutationCache().build(Z(this,Qn),this.options)),Z(this,pr).addObserver(this),Z(this,pr).execute(a)}},Qn=new WeakMap,qi=new WeakMap,pr=new WeakMap,Yn=new WeakMap,$n=new WeakSet,hf=function(){var r;const a=((r=Z(this,pr))==null?void 0:r.state)??ZE();Me(this,qi,{...a,isPending:a.status==="pending",isSuccess:a.status==="success",isError:a.status==="error",isIdle:a.status==="idle",mutate:this.mutate,reset:this.reset})},zm=function(a){aa.batch(()=>{var r,i,s,o,u,d,f,h;if(Z(this,Yn)&&this.hasListeners()){const p=Z(this,qi).variables,m=Z(this,qi).context,y={client:Z(this,Qn),meta:this.options.meta,mutationKey:this.options.mutationKey};if((a==null?void 0:a.type)==="success"){try{(i=(r=Z(this,Yn)).onSuccess)==null||i.call(r,a.data,p,m,y)}catch(x){Promise.reject(x)}try{(o=(s=Z(this,Yn)).onSettled)==null||o.call(s,a.data,null,p,m,y)}catch(x){Promise.reject(x)}}else if((a==null?void 0:a.type)==="error"){try{(d=(u=Z(this,Yn)).onError)==null||d.call(u,a.error,p,m,y)}catch(x){Promise.reject(x)}try{(h=(f=Z(this,Yn)).onSettled)==null||h.call(f,void 0,a.error,p,m,y)}catch(x){Promise.reject(x)}}}this.listeners.forEach(p=>{p(Z(this,qi))})})},TE);function m2(t,e){const a=new Set(e);return t.filter(r=>!a.has(r))}function TM(t,e,a){const r=t.slice(0);return r[e]=a,r}var xo,jr,bo,wo,Gr,Ii,fc,hc,vc,pc,Va,Pm,_m,Um,qm,Im,CE,CM=(CE=class extends nl{constructor(e,a,r){super();_e(this,Va);_e(this,xo);_e(this,jr);_e(this,bo);_e(this,wo);_e(this,Gr);_e(this,Ii);_e(this,fc);_e(this,hc);_e(this,vc);_e(this,pc,[]);Me(this,xo,e),Me(this,wo,r),Me(this,bo,[]),Me(this,Gr,[]),Me(this,jr,[]),this.setQueries(a)}onSubscribe(){this.listeners.size===1&&Z(this,Gr).forEach(e=>{e.subscribe(a=>{rt(this,Va,qm).call(this,e,a)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,Z(this,Gr).forEach(e=>{e.destroy()})}setQueries(e,a){Me(this,bo,e),Me(this,wo,a),aa.batch(()=>{const r=Z(this,Gr),i=rt(this,Va,Um).call(this,Z(this,bo));i.forEach(p=>p.observer.setOptions(p.defaultedQueryOptions));const s=i.map(p=>p.observer),o=s.map(p=>p.getCurrentResult()),u=r.length!==s.length,d=s.some((p,m)=>p!==r[m]),f=u||d,h=f?!0:o.some((p,m)=>{const y=Z(this,jr)[m];return!y||!$u(p,y)});!f&&!h||(f&&(Me(this,pc,i),Me(this,Gr,s)),Me(this,jr,o),this.hasListeners()&&(f&&(m2(r,s).forEach(p=>{p.destroy()}),m2(s,r).forEach(p=>{p.subscribe(m=>{rt(this,Va,qm).call(this,p,m)})})),rt(this,Va,Im).call(this)))})}getCurrentResult(){return Z(this,jr)}getQueries(){return Z(this,Gr).map(e=>e.getCurrentQuery())}getObservers(){return Z(this,Gr)}getOptimisticResult(e,a){const r=rt(this,Va,Um).call(this,e),i=r.map(o=>o.observer.getOptimisticResult(o.defaultedQueryOptions)),s=r.map(o=>o.defaultedQueryOptions.queryHash);return[i,o=>rt(this,Va,_m).call(this,o??i,a,s),()=>rt(this,Va,Pm).call(this,i,r)]}},xo=new WeakMap,jr=new WeakMap,bo=new WeakMap,wo=new WeakMap,Gr=new WeakMap,Ii=new WeakMap,fc=new WeakMap,hc=new WeakMap,vc=new WeakMap,pc=new WeakMap,Va=new WeakSet,Pm=function(e,a){return a.map((r,i)=>{const s=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?s:r.observer.trackResult(s,o=>{a.forEach(u=>{u.observer.trackProp(o)})})})},_m=function(e,a,r){if(a){const i=Z(this,vc),s=r!==void 0&&i!==void 0&&(i.length!==r.length||r.some((o,u)=>o!==i[u]));return(!Z(this,Ii)||Z(this,jr)!==Z(this,hc)||s||a!==Z(this,fc))&&(Me(this,fc,a),Me(this,hc,Z(this,jr)),r!==void 0&&Me(this,vc,r),Me(this,Ii,w0(Z(this,Ii),a(e)))),Z(this,Ii)}return e},Um=function(e){const a=new Map;Z(this,Gr).forEach(i=>{const s=i.options.queryHash;if(!s)return;const o=a.get(s);o?o.push(i):a.set(s,[i])});const r=[];return e.forEach(i=>{var d;const s=Z(this,xo).defaultQueryOptions(i),u=((d=a.get(s.queryHash))==null?void 0:d.shift())??new gc(Z(this,xo),s);r.push({defaultedQueryOptions:s,observer:u})}),r},qm=function(e,a){const r=Z(this,Gr).indexOf(e);r!==-1&&(Me(this,jr,TM(Z(this,jr),r,a)),rt(this,Va,Im).call(this))},Im=function(){var e;if(this.hasListeners()){const a=Z(this,Ii),r=rt(this,Va,Pm).call(this,Z(this,jr),Z(this,pc)),i=rt(this,Va,_m).call(this,r,(e=Z(this,wo))==null?void 0:e.combine);a!==i&&aa.batch(()=>{this.listeners.forEach(s=>{s(Z(this,jr))})})}},CE),yn,NE,NM=(NE=class extends nl{constructor(e={}){super();_e(this,yn);this.config=e,Me(this,yn,new Map)}build(e,a,r){const i=a.queryKey,s=a.queryHash??b0(i,a);let o=this.get(s);return o||(o=new gM({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(a),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){Z(this,yn).has(e.queryHash)||(Z(this,yn).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const a=Z(this,yn).get(e.queryHash);a&&(e.destroy(),a===e&&Z(this,yn).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){aa.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return Z(this,yn).get(e)}getAll(){return[...Z(this,yn).values()]}find(e){const a={exact:!0,...e};return this.getAll().find(r=>u2(a,r))}findAll(e={}){const a=this.getAll();return Object.keys(e).length>0?a.filter(r=>u2(e,r)):a}notify(e){aa.batch(()=>{this.listeners.forEach(a=>{a(e)})})}onFocus(){aa.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){aa.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},yn=new WeakMap,NE),ta,Vi,Fi,So,Eo,Hi,To,Co,jE,jM=(jE=class{constructor(t={}){_e(this,ta);_e(this,Vi);_e(this,Fi);_e(this,So);_e(this,Eo);_e(this,Hi);_e(this,To);_e(this,Co);Me(this,ta,t.queryCache||new NM),Me(this,Vi,t.mutationCache||new SM),Me(this,Fi,t.defaultOptions||{}),Me(this,So,new Map),Me(this,Eo,new Map),Me(this,Hi,0)}mount(){Qd(this,Hi)._++,Z(this,Hi)===1&&(Me(this,To,E0.subscribe(async t=>{t&&(await this.resumePausedMutations(),Z(this,ta).onFocus())})),Me(this,Co,Mf.subscribe(async t=>{t&&(await this.resumePausedMutations(),Z(this,ta).onOnline())})))}unmount(){var t,e;Qd(this,Hi)._--,Z(this,Hi)===0&&((t=Z(this,To))==null||t.call(this),Me(this,To,void 0),(e=Z(this,Co))==null||e.call(this),Me(this,Co,void 0))}isFetching(t){return Z(this,ta).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return Z(this,Vi).findAll({...t,status:"pending"}).length}getQueryData(t){var a;const e=this.defaultQueryOptions({queryKey:t});return(a=Z(this,ta).get(e.queryHash))==null?void 0:a.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),a=Z(this,ta).build(this,e),r=a.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&a.isStaleByTime(Xi(e.staleTime,a))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return Z(this,ta).findAll(t).map(({queryKey:e,state:a})=>{const r=a.data;return[e,r]})}setQueryData(t,e,a){const r=this.defaultQueryOptions({queryKey:t}),i=Z(this,ta).get(r.queryHash),s=i==null?void 0:i.state.data,o=iM(e,s);if(o!==void 0)return Z(this,ta).build(this,r).setData(o,{...a,manual:!0})}setQueriesData(t,e,a){return aa.batch(()=>Z(this,ta).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,a)]))}getQueryState(t){var a;const e=this.defaultQueryOptions({queryKey:t});return(a=Z(this,ta).get(e.queryHash))==null?void 0:a.state}removeQueries(t){const e=Z(this,ta);aa.batch(()=>{e.findAll(t).forEach(a=>{e.remove(a)})})}resetQueries(t,e){const a=Z(this,ta);return aa.batch(()=>(a.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const a={revert:!0,...e},r=aa.batch(()=>Z(this,ta).findAll(t).map(i=>i.cancel(a)));return Promise.all(r).then($a).catch($a)}invalidateQueries(t,e={}){return aa.batch(()=>(Z(this,ta).findAll(t).forEach(a=>{a.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const a={...e,cancelRefetch:e.cancelRefetch??!0},r=aa.batch(()=>Z(this,ta).findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,a);return a.throwOnError||(s=s.catch($a)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then($a)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const a=Z(this,ta).build(this,e);return a.isStaleByTime(Xi(e.staleTime,a))?a.fetch(e):Promise.resolve(a.state.data)}prefetchQuery(t){return this.fetchQuery(t).then($a).catch($a)}fetchInfiniteQuery(t){return t.behavior=Df(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then($a).catch($a)}ensureInfiniteQueryData(t){return t.behavior=Df(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Mf.isOnline()?Z(this,Vi).resumePausedMutations():Promise.resolve()}getQueryCache(){return Z(this,ta)}getMutationCache(){return Z(this,Vi)}getDefaultOptions(){return Z(this,Fi)}setDefaultOptions(t){Me(this,Fi,t)}setQueryDefaults(t,e){Z(this,So).set(Ji(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...Z(this,So).values()],a={};return e.forEach(r=>{Ku(t,r.queryKey)&&Object.assign(a,r.defaultOptions)}),a}setMutationDefaults(t,e){Z(this,Eo).set(Ji(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...Z(this,Eo).values()],a={};return e.forEach(r=>{Ku(t,r.mutationKey)&&Object.assign(a,r.defaultOptions)}),a}defaultQueryOptions(t){if(t._defaulted)return t;const e={...Z(this,Fi).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=b0(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===Ar&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...Z(this,Fi).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){Z(this,ta).clear(),Z(this,Vi).clear()}},ta=new WeakMap,Vi=new WeakMap,Fi=new WeakMap,So=new WeakMap,Eo=new WeakMap,Hi=new WeakMap,To=new WeakMap,Co=new WeakMap,jE),WE=I.createContext(void 0),mc=t=>{const e=I.useContext(WE);if(t)return t;if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},AM=({client:t,children:e})=>(I.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),g.jsx(WE.Provider,{value:t,children:e})),JE=I.createContext(!1),eT=()=>I.useContext(JE);JE.Provider;function MM(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var DM=I.createContext(MM()),tT=()=>I.useContext(DM),aT=(t,e,a)=>{const r=a!=null&&a.state.error&&typeof t.throwOnError=="function"?S0(t.throwOnError,[a.state.error,a]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},rT=t=>{I.useEffect(()=>{t.clearReset()},[t])},nT=({result:t,errorResetBoundary:e,throwOnError:a,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||S0(a,[t.error,r])),C0=(t,e)=>e.state.data===void 0,iT=t=>{if(t.suspense){const a=i=>i==="static"?i:Math.max(i??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...i)=>a(r(...i)):a(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},OM=(t,e)=>t.isLoading&&t.isFetching&&!e,Vm=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,Fm=(t,e,a)=>e.fetchOptimistic(t).catch(()=>{a.clearReset()});function sT({queries:t,...e},a){const r=mc(a),i=eT(),s=tT(),o=I.useMemo(()=>t.map(E=>{const S=r.defaultQueryOptions(E);return S._optimisticResults=i?"isRestoring":"optimistic",S}),[t,r,i]);o.forEach(E=>{iT(E);const S=r.getQueryCache().get(E.queryHash);aT(E,s,S)}),rT(s);const[u]=I.useState(()=>new CM(r,o,e)),[d,f,h]=u.getOptimisticResult(o,e.combine),p=!i&&e.subscribed!==!1;I.useSyncExternalStore(I.useCallback(E=>p?u.subscribe(aa.batchCalls(E)):$a,[u,p]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),I.useEffect(()=>{u.setQueries(o,e)},[o,e,u]);const y=d.some((E,S)=>Vm(o[S],E))?d.flatMap((E,S)=>{const T=o[S];if(T&&Vm(T,E)){const C=new gc(r,T);return Fm(T,C,s)}return[]}):[];if(y.length>0)throw Promise.all(y);const x=d.find((E,S)=>{const T=o[S];return T&&nT({result:E,errorResetBoundary:s,throwOnError:T.throwOnError,query:r.getQueryCache().get(T.queryHash),suspense:T.suspense})});if(x!=null&&x.error)throw x.error;return f(h())}function $f(t,e,a){var m,y,x,E;const r=eT(),i=tT(),s=mc(a),o=s.defaultQueryOptions(t);(y=(m=s.getDefaultOptions().queries)==null?void 0:m._experimental_beforeQuery)==null||y.call(m,o);const u=s.getQueryCache().get(o.queryHash);o._optimisticResults=r?"isRestoring":"optimistic",iT(o),aT(o,i,u),rT(i);const d=!s.getQueryCache().get(o.queryHash),[f]=I.useState(()=>new e(s,o)),h=f.getOptimisticResult(o),p=!r&&t.subscribed!==!1;if(I.useSyncExternalStore(I.useCallback(S=>{const T=p?f.subscribe(aa.batchCalls(S)):$a;return f.updateResult(),T},[f,p]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),I.useEffect(()=>{f.setOptions(o)},[o,f]),Vm(o,h))throw Fm(o,f,i);if(nT({result:h,errorResetBoundary:i,throwOnError:o.throwOnError,query:u,suspense:o.suspense}))throw h.error;if((E=(x=s.getDefaultOptions().queries)==null?void 0:x._experimental_afterQuery)==null||E.call(x,o,h),o.experimental_prefetchInRender&&!$s&&OM(h,r)){const S=d?Fm(o,f,i):u==null?void 0:u.promise;S==null||S.catch($a).finally(()=>{f.updateResult()})}return o.notifyOnChangeProps?h:f.trackResult(h)}function RM(t,e){return $f(t,gc,e)}function kM(t,e){return $f({...t,enabled:!0,suspense:!0,throwOnError:C0,placeholderData:void 0},gc,e)}function BM(t,e){return $f({...t,enabled:!0,suspense:!0,throwOnError:C0},XE,e)}function LM(t,e){return sT({...t,queries:t.queries.map(a=>({...a,suspense:!0,throwOnError:C0,enabled:!0,placeholderData:void 0}))},e)}function zM(t,e){const a=mc(e);a.getQueryState(t.queryKey)||a.prefetchQuery(t)}function PM(t,e){const a=mc(e);a.getQueryState(t.queryKey)||a.prefetchInfiniteQuery(t)}function _M(t,e){const a=mc(e),[r]=I.useState(()=>new EM(a,t));I.useEffect(()=>{r.setOptions(t)},[r,t]);const i=I.useSyncExternalStore(I.useCallback(o=>r.subscribe(aa.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),s=I.useCallback((o,u)=>{r.mutate(o,u).catch($a)},[r]);if(i.error&&S0(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:s,mutateAsync:i.mutate}}function UM(t,e){return $f(t,XE,e)}var qM=Object.create,lT=Object.defineProperty,IM=Object.getOwnPropertyDescriptor,oT=Object.getOwnPropertyNames,VM=Object.getPrototypeOf,FM=Object.prototype.hasOwnProperty,wn=(t,e)=>function(){return e||(0,t[oT(t)[0]])((e={exports:{}}).exports,e),e.exports},HM=(t,e,a,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(var i=oT(e),s=0,o=i.length,u;s<o;s++)u=i[s],!FM.call(t,u)&&u!==a&&lT(t,u,{get:(d=>e[d]).bind(null,u),enumerable:!(r=IM(e,u))||r.enumerable});return t},ca=(t,e,a)=>(a=t!=null?qM(VM(t)):{},HM(e||!t||!t.__esModule?lT(a,"default",{value:t,enumerable:!0}):a,t)),uT=wn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(t,e){function a(r){"@babel/helpers - typeof";return e.exports=a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(i){return typeof i}:function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},e.exports.__esModule=!0,e.exports.default=e.exports,a(r)}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}}),GM=wn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(t,e){var a=uT().default;function r(i,s){if(a(i)!="object"||!i)return i;var o=i[Symbol.toPrimitive];if(o!==void 0){var u=o.call(i,s||"default");if(a(u)!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(i)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),QM=wn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(t,e){var a=uT().default,r=GM();function i(s){var o=r(s,"string");return a(o)=="symbol"?o:o+""}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports}}),il=wn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,e){var a=QM();function r(i,s,o){return(s=a(s))in i?Object.defineProperty(i,s,{value:o,enumerable:!0,configurable:!0,writable:!0}):i[s]=o,i}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),sn=wn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,e){var a=il();function r(s,o){var u=Object.keys(s);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(s);o&&(d=d.filter(function(f){return Object.getOwnPropertyDescriptor(s,f).enumerable})),u.push.apply(u,d)}return u}function i(s){for(var o=1;o<arguments.length;o++){var u=arguments[o]!=null?arguments[o]:{};o%2?r(Object(u),!0).forEach(function(d){a(s,d,u[d])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(u)):r(Object(u)).forEach(function(d){Object.defineProperty(s,d,Object.getOwnPropertyDescriptor(u,d))})}return s}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports}});function Xf(t){const e={subscribe(a){let r=null,i=!1,s=!1,o=!1;function u(){if(r===null){o=!0;return}s||(s=!0,typeof r=="function"?r():r&&r.unsubscribe())}return r=t({next(d){var f;i||(f=a.next)===null||f===void 0||f.call(a,d)},error(d){var f;i||(i=!0,(f=a.error)===null||f===void 0||f.call(a,d),u())},complete(){var d;i||(i=!0,(d=a.complete)===null||d===void 0||d.call(a),u())}}),o&&u(),{unsubscribe:u}},pipe(...a){return a.reduce(YM,e)}};return e}function YM(t,e){return e(t)}function KM(t){const e=new AbortController;return new Promise((r,i)=>{let s=!1;function o(){s||(s=!0,u.unsubscribe())}e.signal.addEventListener("abort",()=>{i(e.signal.reason)});const u=t.subscribe({next(d){s=!0,r(d),o()},error(d){i(d)},complete(){e.abort(),o()}})})}function $M(t){return e=>{let a=0,r=null;const i=[];function s(){r||(r=e.subscribe({next(u){for(const f of i){var d;(d=f.next)===null||d===void 0||d.call(f,u)}},error(u){for(const f of i){var d;(d=f.error)===null||d===void 0||d.call(f,u)}},complete(){for(const d of i){var u;(u=d.complete)===null||u===void 0||u.call(d)}}}))}function o(){if(a===0&&r){const u=r;r=null,u.unsubscribe()}}return Xf(u=>(a++,i.push(u),s(),{unsubscribe(){a--,o();const d=i.findIndex(f=>f===u);d>-1&&i.splice(d,1)}}))}}function XM(t){let e=t;const a=[],r=o=>{e!==void 0&&o.next(e),a.push(o)},i=o=>{a.splice(a.indexOf(o),1)},s=Xf(o=>(r(o),()=>{i(o)}));return s.next=o=>{if(e!==o){e=o;for(const u of a)u.next(o)}},s.get=()=>e,s}function ZM(t){return Xf(e=>{function a(i=0,s=t.op){const o=t.links[i];if(!o)throw new Error("No more links to execute - did you forget to add an ending link?");return o({op:s,next(d){return a(i+1,d)}})}return a().subscribe(e)})}function Xs(t){return!!t&&!Array.isArray(t)&&typeof t=="object"}function WM(){return Object.create(null)}const JM=typeof Symbol=="function"&&!!Symbol.asyncIterator;function cT(t){return JM&&Xs(t)&&Symbol.asyncIterator in t}var eD=Object.create,dT=Object.defineProperty,tD=Object.getOwnPropertyDescriptor,fT=Object.getOwnPropertyNames,aD=Object.getPrototypeOf,rD=Object.prototype.hasOwnProperty,yc=(t,e)=>function(){return e||(0,t[fT(t)[0]])((e={exports:{}}).exports,e),e.exports},nD=(t,e,a,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(var i=fT(e),s=0,o=i.length,u;s<o;s++)u=i[s],!rD.call(t,u)&&u!==a&&dT(t,u,{get:(d=>e[d]).bind(null,u),enumerable:!(r=tD(e,u))||r.enumerable});return t},Zf=(t,e,a)=>(a=t!=null?eD(aD(t)):{},nD(dT(a,"default",{value:t,enumerable:!0}),t));const hT=()=>{},y2=t=>{Object.freeze&&Object.freeze(t)};function vT(t,e,a){var r;const i=e.join(".");return(r=a[i])!==null&&r!==void 0||(a[i]=new Proxy(hT,{get(s,o){if(!(typeof o!="string"||o==="then"))return vT(t,[...e,o],a)},apply(s,o,u){const d=e[e.length-1];let f={args:u,path:e};return d==="call"?f={args:u.length>=2?[u[1]]:[],path:e.slice(0,-1)}:d==="apply"&&(f={args:u.length>=2?u[1]:[],path:e.slice(0,-1)}),y2(f.args),y2(f.path),t(f)}})),a[i]}const Wf=t=>vT(t,[],WM()),N0=t=>new Proxy(hT,{get(e,a){if(a!=="then")return t(a)}});var pT=yc({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(t,e){function a(r){"@babel/helpers - typeof";return e.exports=a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(i){return typeof i}:function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},e.exports.__esModule=!0,e.exports.default=e.exports,a(r)}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}}),iD=yc({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(t,e){var a=pT().default;function r(i,s){if(a(i)!="object"||!i)return i;var o=i[Symbol.toPrimitive];if(o!==void 0){var u=o.call(i,s||"default");if(a(u)!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(i)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),sD=yc({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(t,e){var a=pT().default,r=iD();function i(s){var o=r(s,"string");return a(o)=="symbol"?o:o+""}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports}}),gT=yc({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,e){var a=sD();function r(i,s,o){return(s=a(s))in i?Object.defineProperty(i,s,{value:o,enumerable:!0,configurable:!0,writable:!0}):i[s]=o,i}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),j0=yc({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,e){var a=gT();function r(s,o){var u=Object.keys(s);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(s);o&&(d=d.filter(function(f){return Object.getOwnPropertyDescriptor(s,f).enumerable})),u.push.apply(u,d)}return u}function i(s){for(var o=1;o<arguments.length;o++){var u=arguments[o]!=null?arguments[o]:{};o%2?r(Object(u),!0).forEach(function(d){a(s,d,u[d])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(u)):r(Object(u)).forEach(function(d){Object.defineProperty(s,d,Object.getOwnPropertyDescriptor(u,d))})}return s}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports}});Zf(j0());Zf(gT());var Kd=Zf(j0());function lD(t,e){if("error"in t){const r=e.deserialize(t.error);return{ok:!1,error:(0,Kd.default)((0,Kd.default)({},t),{},{error:r})}}return{ok:!0,result:(0,Kd.default)((0,Kd.default)({},t.result),(!t.result.type||t.result.type==="data")&&{type:"data",data:e.deserialize(t.result.data)})}}var zp=class extends Error{constructor(){super("Unable to transform response from server")}};function oD(t,e){let a;try{a=lD(t,e)}catch{throw new zp}if(!a.ok&&(!Xs(a.error.error)||typeof a.error.error.code!="number"))throw new zp;if(a.ok&&!Xs(a.result))throw new zp;return a}Zf(j0());var $d=ca(il(),1),Hl=ca(sn(),1);function uD(t){return t instanceof Of}function cD(t){return Xs(t)&&Xs(t.error)&&typeof t.error.code=="number"&&typeof t.error.message=="string"}function dD(t,e){return typeof t=="string"?t:Xs(t)&&typeof t.message=="string"?t.message:e}var Of=class vf extends Error{constructor(e,a){var r,i;const s=a==null?void 0:a.cause;super(e,{cause:s}),(0,$d.default)(this,"cause",void 0),(0,$d.default)(this,"shape",void 0),(0,$d.default)(this,"data",void 0),(0,$d.default)(this,"meta",void 0),this.meta=a==null?void 0:a.meta,this.cause=s,this.shape=a==null||(r=a.result)===null||r===void 0?void 0:r.error,this.data=a==null||(i=a.result)===null||i===void 0?void 0:i.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,vf.prototype)}static from(e,a={}){const r=e;return uD(r)?(a.meta&&(r.meta=(0,Hl.default)((0,Hl.default)({},r.meta),a.meta)),r):cD(r)?new vf(r.error.message,(0,Hl.default)((0,Hl.default)({},a),{},{result:r,cause:a.cause})):new vf(dD(r,"Unknown error"),(0,Hl.default)((0,Hl.default)({},a),{},{cause:r}))}};function fD(t){const e=t;return e?"input"in e?e:{input:e,output:e}:{input:{serialize:a=>a,deserialize:a=>a},output:{serialize:a=>a,deserialize:a=>a}}}const x2=t=>typeof t=="function";function hD(t){if(t)return t;if(typeof window<"u"&&x2(window.fetch))return window.fetch;if(typeof globalThis<"u"&&x2(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}var Vu=ca(sn());function vD(t){return{url:t.url.toString(),fetch:t.fetch,transformer:fD(t.transformer),methodOverride:t.methodOverride}}function pD(t){const e={};for(let a=0;a<t.length;a++){const r=t[a];e[a]=r}return e}const gD={query:"GET",mutation:"POST",subscription:"PATCH"};function mT(t){return"input"in t?t.transformer.input.serialize(t.input):pD(t.inputs.map(e=>t.transformer.input.serialize(e)))}const yT=t=>{const e=t.url.split("?");let r=e[0].replace(/\/$/,"")+"/"+t.path;const i=[];if(e[1]&&i.push(e[1]),"inputs"in t&&i.push("batch=1"),t.type==="query"||t.type==="subscription"){const s=mT(t);s!==void 0&&t.methodOverride!=="POST"&&i.push(`input=${encodeURIComponent(JSON.stringify(s))}`)}return i.length&&(r+="?"+i.join("&")),r},mD=t=>{if(t.type==="query"&&t.methodOverride!=="POST")return;const e=mT(t);return e!==void 0?JSON.stringify(e):void 0},yD=t=>SD((0,Vu.default)((0,Vu.default)({},t),{},{contentTypeHeader:"application/json",getUrl:yT,getBody:mD}));var xD=class extends Error{constructor(){const t="AbortError";super(t),this.name=t,this.message=t}};const bD=t=>{var e;if(t!=null&&t.aborted)throw(e=t.throwIfAborted)===null||e===void 0||e.call(t),typeof DOMException<"u"?new DOMException("AbortError","AbortError"):new xD};async function wD(t){var e;bD(t.signal);const a=t.getUrl(t),r=t.getBody(t),i=(e=t.methodOverride)!==null&&e!==void 0?e:gD[t.type],s=await(async()=>{const u=await t.headers();return Symbol.iterator in u?Object.fromEntries(u):u})(),o=(0,Vu.default)((0,Vu.default)((0,Vu.default)({},t.contentTypeHeader&&i!=="GET"?{"content-type":t.contentTypeHeader}:{}),t.trpcAcceptHeader?{"trpc-accept":t.trpcAcceptHeader}:void 0),s);return hD(t.fetch)(a,{method:i,signal:t.signal,body:r,headers:o})}async function SD(t){const e={},a=await wD(t);e.response=a;const r=await a.json();return e.responseJSON=r,{json:r,meta:e}}ca(sn(),1);const b2=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function w2(t){let e=null,a=null;const r=()=>{clearTimeout(a),a=null,e=null};function i(u){const d=[[]];let f=0;for(;;){const m=u[f];if(!m)break;const y=d[d.length-1];if(m.aborted){var h;(h=m.reject)===null||h===void 0||h.call(m,new Error("Aborted")),f++;continue}if(t.validate(y.concat(m).map(E=>E.key))){y.push(m),f++;continue}if(y.length===0){var p;(p=m.reject)===null||p===void 0||p.call(m,new Error("Input is too big for a single dispatch")),f++;continue}d.push([])}return d}function s(){const u=i(e);r();for(const d of u){if(!d.length)continue;const f={items:d};for(const p of d)p.batch=f;t.fetch(f.items.map(p=>p.key)).then(async p=>{await Promise.all(p.map(async(y,x)=>{const E=f.items[x];try{var S;const C=await Promise.resolve(y);(S=E.resolve)===null||S===void 0||S.call(E,C)}catch(C){var T;(T=E.reject)===null||T===void 0||T.call(E,C)}E.batch=null,E.reject=null,E.resolve=null}));for(const y of f.items){var m;(m=y.reject)===null||m===void 0||m.call(y,new Error("Missing result")),y.batch=null}}).catch(p=>{for(const y of f.items){var m;(m=y.reject)===null||m===void 0||m.call(y,p),y.batch=null}})}}function o(u){var d;const f={aborted:!1,key:u,batch:null,resolve:b2,reject:b2},h=new Promise((p,m)=>{var y;f.reject=m,f.resolve=p,(y=e)!==null&&y!==void 0||(e=[]),e.push(f)});return(d=a)!==null&&d!==void 0||(a=setTimeout(s)),h}return{load:o}}function ED(...t){const e=new AbortController,a=t.length;let r=0;const i=()=>{++r===a&&e.abort()};for(const s of t)s!=null&&s.aborted?i():s==null||s.addEventListener("abort",i,{once:!0});return e.signal}var Xd=ca(sn(),1);function TD(t){var e,a;const r=vD(t),i=(e=t.maxURLLength)!==null&&e!==void 0?e:1/0,s=(a=t.maxItems)!==null&&a!==void 0?a:1/0;return()=>{const o=h=>({validate(p){if(i===1/0&&s===1/0)return!0;if(p.length>s)return!1;const m=p.map(E=>E.path).join(","),y=p.map(E=>E.input);return yT((0,Xd.default)((0,Xd.default)({},r),{},{type:h,path:m,inputs:y,signal:null})).length<=i},async fetch(p){const m=p.map(C=>C.path).join(","),y=p.map(C=>C.input),x=ED(...p.map(C=>C.signal)),E=await yD((0,Xd.default)((0,Xd.default)({},r),{},{path:m,inputs:y,type:h,headers(){return t.headers?typeof t.headers=="function"?t.headers({opList:p}):t.headers:{}},signal:x}));return(Array.isArray(E.json)?E.json:p.map(()=>E.json)).map(C=>({meta:E.meta,json:C}))}}),u=w2(o("query")),d=w2(o("mutation")),f={query:u,mutation:d};return({op:h})=>Xf(p=>{/* istanbul ignore if -- @preserve */if(h.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const y=f[h.type].load(h);let x;return y.then(E=>{x=E;const S=oD(E.json,r.transformer.output);if(!S.ok){p.error(Of.from(S.error,{meta:E.meta}));return}p.next({context:E.meta,result:S.result}),p.complete()}).catch(E=>{p.error(Of.from(E,{meta:x==null?void 0:x.meta}))}),()=>{}})}}ca(sn(),1);const xT=(t,...e)=>typeof t=="function"?t(...e):t;ca(il(),1);function CD(){let t,e;return{promise:new Promise((r,i)=>{t=r,e=i}),resolve:t,reject:e}}async function ND(t){const e=await xT(t.url);if(!t.connectionParams)return e;const r=`${e.includes("?")?"&":"?"}connectionParams=1`;return e+r}async function jD(t,e){const a={method:"connectionParams",data:await xT(t)};return e.encode(a)}ca(il(),1);var ki=ca(il(),1);function AD(t){const{promise:e,resolve:a,reject:r}=CD();return t.addEventListener("open",()=>{t.removeEventListener("error",r),a()}),t.addEventListener("error",r),e}function MD(t,{intervalMs:e,pongTimeoutMs:a}){let r,i;function s(){r=setTimeout(()=>{t.send("PING"),i=setTimeout(()=>{t.close()},a)},e)}function o(){clearTimeout(r),s()}function u(){clearTimeout(i),o()}t.addEventListener("open",s),t.addEventListener("message",({data:d})=>{clearTimeout(r),s(),d==="PONG"&&u()}),t.addEventListener("close",()=>{clearTimeout(r),clearTimeout(i)})}var DD=class Hm{constructor(e){var a;if((0,ki.default)(this,"id",++Hm.connectCount),(0,ki.default)(this,"WebSocketPonyfill",void 0),(0,ki.default)(this,"urlOptions",void 0),(0,ki.default)(this,"keepAliveOpts",void 0),(0,ki.default)(this,"encoder",void 0),(0,ki.default)(this,"wsObservable",XM(null)),(0,ki.default)(this,"openPromise",null),this.WebSocketPonyfill=(a=e.WebSocketPonyfill)!==null&&a!==void 0?a:WebSocket,!this.WebSocketPonyfill)throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");this.urlOptions=e.urlOptions,this.keepAliveOpts=e.keepAlive,this.encoder=e.encoder}get ws(){return this.wsObservable.get()}set ws(e){this.wsObservable.next(e)}isOpen(){return!!this.ws&&this.ws.readyState===this.WebSocketPonyfill.OPEN&&!this.openPromise}isClosed(){return!!this.ws&&(this.ws.readyState===this.WebSocketPonyfill.CLOSING||this.ws.readyState===this.WebSocketPonyfill.CLOSED)}async open(){var e=this;if(e.openPromise)return e.openPromise;e.id=++Hm.connectCount;const a=ND(e.urlOptions).then(r=>new e.WebSocketPonyfill(r));e.openPromise=a.then(async r=>{e.ws=r,r.binaryType="arraybuffer",r.addEventListener("message",function({data:i}){i==="PING"&&this.send("PONG")}),e.keepAliveOpts.enabled&&MD(r,e.keepAliveOpts),r.addEventListener("close",()=>{e.ws===r&&(e.ws=null)}),await AD(r),e.urlOptions.connectionParams&&r.send(await jD(e.urlOptions.connectionParams,e.encoder))});try{await e.openPromise}finally{e.openPromise=null}}async close(){var e=this;try{await e.openPromise}finally{var a;(a=e.ws)===null||a===void 0||a.close()}}};(0,ki.default)(DD,"connectCount",0);ca(il(),1);ca(sn(),1);var Pp=ca(il(),1),S2=ca(sn(),1),Jf=class{constructor(t){(0,Pp.default)(this,"links",void 0),(0,Pp.default)(this,"runtime",void 0),(0,Pp.default)(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=t.links.map(e=>e(this.runtime))}$request(t){var e;return ZM({links:this.links,op:(0,S2.default)((0,S2.default)({},t),{},{context:(e=t.context)!==null&&e!==void 0?e:{},id:++this.requestId})}).pipe($M())}async requestAsPromise(t){var e=this;try{const a=e.$request(t);return(await KM(a)).result.data}catch(a){throw Of.from(a)}}query(t,e,a){return this.requestAsPromise({type:"query",path:t,input:e,context:a==null?void 0:a.context,signal:a==null?void 0:a.signal})}mutation(t,e,a){return this.requestAsPromise({type:"mutation",path:t,input:e,context:a==null?void 0:a.context,signal:a==null?void 0:a.signal})}subscription(t,e,a){return this.$request({type:"subscription",path:t,input:e,context:a.context,signal:a.signal}).subscribe({next(i){switch(i.result.type){case"state":{var s;(s=a.onConnectionStateChange)===null||s===void 0||s.call(a,i.result);break}case"started":{var o;(o=a.onStarted)===null||o===void 0||o.call(a,{context:i.context});break}case"stopped":{var u;(u=a.onStopped)===null||u===void 0||u.call(a);break}case"data":case void 0:{var d;(d=a.onData)===null||d===void 0||d.call(a,i.result.data);break}}},error(i){var s;(s=a.onError)===null||s===void 0||s.call(a,i)},complete(){var i;(i=a.onComplete)===null||i===void 0||i.call(a)}})}};const bT=Symbol.for("trpc_untypedClient"),OD={query:"query",mutate:"mutation",subscribe:"subscription"},RD=t=>OD[t];function wT(t){const e=Wf(({path:a,args:r})=>{const i=[...a],s=RD(i.pop()),o=i.join(".");return t[s](o,...r)});return N0(a=>a===bT?t:e[a])}function kD(t){const e=new Jf(t);return wT(e)}function A0(t){return t[bT]}ca(sn(),1);ca(sn(),1);var BD=wn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(t,e){function a(i){var s,o,u,d=2;for(typeof Symbol<"u"&&(o=Symbol.asyncIterator,u=Symbol.iterator);d--;){if(o&&(s=i[o])!=null)return s.call(i);if(u&&(s=i[u])!=null)return new r(s.call(i));o="@@asyncIterator",u="@@iterator"}throw new TypeError("Object is not async iterable")}function r(i){function s(o){if(Object(o)!==o)return Promise.reject(new TypeError(o+" is not an object."));var u=o.done;return Promise.resolve(o.value).then(function(d){return{value:d,done:u}})}return r=function(u){this.s=u,this.n=u.next},r.prototype={s:null,n:null,next:function(){return s(this.n.apply(this.s,arguments))},return:function(u){var d=this.s.return;return d===void 0?Promise.resolve({value:u,done:!0}):s(d.apply(this.s,arguments))},throw:function(u){var d=this.s.return;return d===void 0?Promise.reject(u):s(d.apply(this.s,arguments))}},new r(i)}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}});ca(BD(),1);ca(sn(),1);var LD=wn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(t,e){function a(){var r=typeof SuppressedError=="function"?SuppressedError:function(u,d){var f=Error();return f.name="SuppressedError",f.error=u,f.suppressed=d,f},i={},s=[];function o(u,d){if(d!=null){if(Object(d)!==d)throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(u)var f=d[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(f===void 0&&(f=d[Symbol.dispose||Symbol.for("Symbol.dispose")],u))var h=f;if(typeof f!="function")throw new TypeError("Object is not disposable.");h&&(f=function(){try{h.call(d)}catch(m){return Promise.reject(m)}}),s.push({v:d,d:f,a:u})}else u&&s.push({d,a:u});return d}return{e:i,u:o.bind(null,!1),a:o.bind(null,!0),d:function(){var d,f=this.e,h=0;function p(){for(;d=s.pop();)try{if(!d.a&&h===1)return h=0,s.push(d),Promise.resolve().then(p);if(d.d){var y=d.d.call(d.v);if(d.a)return h|=2,Promise.resolve(y).then(p,m)}else h|=1}catch(x){return m(x)}if(h===1)return f!==i?Promise.reject(f):Promise.resolve();if(f!==i)throw f}function m(y){return f=f!==i?new r(y,f):y,p()}return p()}}}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}}),ST=wn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js"(t,e){function a(r,i){this.v=r,this.k=i}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}}),zD=wn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(t,e){var a=ST();function r(i){return new a(i,0)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),PD=wn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(t,e){var a=ST();function r(s){return function(){return new i(s.apply(this,arguments))}}function i(s){var o,u;function d(h,p){try{var m=s[h](p),y=m.value,x=y instanceof a;Promise.resolve(x?y.v:y).then(function(E){if(x){var S=h==="return"?"return":"next";if(!y.k||E.done)return d(S,E);E=s[S](E).value}f(m.done?"return":"normal",E)},function(E){d("throw",E)})}catch(E){f("throw",E)}}function f(h,p){switch(h){case"return":o.resolve({value:p,done:!0});break;case"throw":o.reject(p);break;default:o.resolve({value:p,done:!1})}(o=o.next)?d(o.key,o.arg):u=null}this._invoke=function(h,p){return new Promise(function(m,y){var x={key:h,arg:p,resolve:m,reject:y,next:null};u?u=u.next=x:(o=u=x,d(h,p))})},typeof s.return!="function"&&(this.return=void 0)}i.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},i.prototype.next=function(s){return this._invoke("next",s)},i.prototype.throw=function(s){return this._invoke("throw",s)},i.prototype.return=function(s){return this._invoke("return",s)},e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}});ca(LD(),1);ca(zD(),1);ca(PD(),1);ca(sn(),1);var _D=Object.create,ET=Object.defineProperty,UD=Object.getOwnPropertyDescriptor,TT=Object.getOwnPropertyNames,qD=Object.getPrototypeOf,ID=Object.prototype.hasOwnProperty,os=(t,e)=>function(){return e||(0,t[TT(t)[0]])((e={exports:{}}).exports,e),e.exports},VD=(t,e,a,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(var i=TT(e),s=0,o=i.length,u;s<o;s++)u=i[s],!ID.call(t,u)&&u!==a&&ET(t,u,{get:(d=>e[d]).bind(null,u),enumerable:!(r=UD(e,u))||r.enumerable});return t},sl=(t,e,a)=>(a=t!=null?_D(qD(t)):{},VD(e||!t||!t.__esModule?ET(a,"default",{value:t,enumerable:!0}):a,t)),FD=os({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutPropertiesLoose.js"(t,e){function a(r,i){if(r==null)return{};var s={};for(var o in r)if({}.hasOwnProperty.call(r,o)){if(i.includes(o))continue;s[o]=r[o]}return s}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}}),HD=os({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutProperties.js"(t,e){var a=FD();function r(i,s){if(i==null)return{};var o,u,d=a(i,s);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(i);for(u=0;u<f.length;u++)o=f[u],s.includes(o)||{}.propertyIsEnumerable.call(i,o)&&(d[o]=i[o])}return d}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),CT=os({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(t,e){function a(r){"@babel/helpers - typeof";return e.exports=a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(i){return typeof i}:function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},e.exports.__esModule=!0,e.exports.default=e.exports,a(r)}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}}),GD=os({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(t,e){var a=CT().default;function r(i,s){if(a(i)!="object"||!i)return i;var o=i[Symbol.toPrimitive];if(o!==void 0){var u=o.call(i,s||"default");if(a(u)!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(i)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),QD=os({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(t,e){var a=CT().default,r=GD();function i(s){var o=r(s,"string");return a(o)=="symbol"?o:o+""}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports}}),YD=os({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,e){var a=QD();function r(i,s,o){return(s=a(s))in i?Object.defineProperty(i,s,{value:o,enumerable:!0,configurable:!0,writable:!0}):i[s]=o,i}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),xc=os({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,e){var a=YD();function r(s,o){var u=Object.keys(s);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(s);o&&(d=d.filter(function(f){return Object.getOwnPropertyDescriptor(s,f).enumerable})),u.push.apply(u,d)}return u}function i(s){for(var o=1;o<arguments.length;o++){var u=arguments[o]!=null?arguments[o]:{};o%2?r(Object(u),!0).forEach(function(d){a(s,d,u[d])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(u)):r(Object(u)).forEach(function(d){Object.defineProperty(s,d,Object.getOwnPropertyDescriptor(u,d))})}return s}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports}}),KD=sl(HD(),1),E2=sl(xc(),1);const $D=["cursor","direction"];function pn(t,e,a){const r=t.flatMap(i=>i.split("."));if(!e&&(!a||a==="any"))return r.length?[r]:[];if(a==="infinite"&&Xs(e)&&("direction"in e||"cursor"in e)){const{cursor:i,direction:s}=e,o=(0,KD.default)(e,$D);return[r,{input:o,type:"infinite"}]}return[r,(0,E2.default)((0,E2.default)({},typeof e<"u"&&e!==Ar&&{input:e}),a&&a!=="any"&&{type:a})]}function pf(t){return pn(t,void 0,"any")}function XD(t){return Wf(({path:e,args:a})=>{var r;const i=[...e],s=i.pop();if(s==="useMutation")return t[s](i,...a);if(s==="_def")return{path:i};const[o,...u]=a,d=(r=u[0])!==null&&r!==void 0?r:{};return t[s](i,o,d)})}var _p;const ZD=["client","ssrContext","ssrState","abortOnUnmount"],WD=(_p=I.createContext)===null||_p===void 0?void 0:_p.call(DE,null),JD=t=>{switch(t){case"queryOptions":case"fetch":case"ensureData":case"prefetch":case"getData":case"setData":case"setQueriesData":return"query";case"infiniteQueryOptions":case"fetchInfinite":case"prefetchInfinite":case"getInfiniteData":case"setInfiniteData":return"infinite";case"setMutationDefaults":case"getMutationDefaults":case"isMutating":case"cancel":case"invalidate":case"refetch":case"reset":return"any"}};function eO(t){return Wf(e=>{const a=[...e.path],r=a.pop(),i=[...e.args],s=i.shift(),o=JD(r),u=pn(a,s,o);return{infiniteQueryOptions:()=>t.infiniteQueryOptions(a,u,i[0]),queryOptions:()=>t.queryOptions(a,u,...i),fetch:()=>t.fetchQuery(u,...i),fetchInfinite:()=>t.fetchInfiniteQuery(u,i[0]),prefetch:()=>t.prefetchQuery(u,...i),prefetchInfinite:()=>t.prefetchInfiniteQuery(u,i[0]),ensureData:()=>t.ensureQueryData(u,...i),invalidate:()=>t.invalidateQueries(u,...i),reset:()=>t.resetQueries(u,...i),refetch:()=>t.refetchQueries(u,...i),cancel:()=>t.cancelQuery(u,...i),setData:()=>{t.setQueryData(u,i[0],i[1])},setQueriesData:()=>t.setQueriesData(u,i[0],i[1],i[2]),setInfiniteData:()=>{t.setInfiniteQueryData(u,i[0],i[1])},getData:()=>t.getQueryData(u),getInfiniteData:()=>t.getInfiniteQueryData(u),setMutationDefaults:()=>t.setMutationDefaults(pf(a),s),getMutationDefaults:()=>t.getMutationDefaults(pf(a)),isMutating:()=>t.isMutating({mutationKey:pf(a)})}[r]()})}function tO(t){const e=wT(t.client),a=eO(t);return N0(r=>{const i=r;return i==="client"?e:ZD.includes(i)?t[i]:a[r]})}var aO=sl(xc(),1);function T2(t){const e=t instanceof Jf?t:A0(t);return Wf(a=>{const r=a.path,i=r.join("."),[s,o]=a.args;return(0,aO.default)({queryKey:pn(r,s,"query"),queryFn:()=>e.query(i,s,o==null?void 0:o.trpc)},o)})}var Up=sl(xc(),1);function rr(t,e,a){var r;const i=t[0];let s=(r=t[1])===null||r===void 0?void 0:r.input;if(a){var o;s=(0,Up.default)((0,Up.default)((0,Up.default)({},(o=s)!==null&&o!==void 0?o:{}),a.pageParam?{cursor:a.pageParam}:{}),{},{direction:a.direction})}return[i.join("."),s,e==null?void 0:e.trpc]}var rO=os({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(t,e){function a(i){var s,o,u,d=2;for(typeof Symbol<"u"&&(o=Symbol.asyncIterator,u=Symbol.iterator);d--;){if(o&&(s=i[o])!=null)return s.call(i);if(u&&(s=i[u])!=null)return new r(s.call(i));o="@@asyncIterator",u="@@iterator"}throw new TypeError("Object is not async iterable")}function r(i){function s(o){if(Object(o)!==o)return Promise.reject(new TypeError(o+" is not an object."));var u=o.done;return Promise.resolve(o.value).then(function(d){return{value:d,done:u}})}return r=function(u){this.s=u,this.n=u.next},r.prototype={s:null,n:null,next:function(){return s(this.n.apply(this.s,arguments))},return:function(u){var d=this.s.return;return d===void 0?Promise.resolve({value:u,done:!0}):s(d.apply(this.s,arguments))},throw:function(u){var d=this.s.return;return d===void 0?Promise.reject(u):s(d.apply(this.s,arguments))}},new r(i)}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}}),nO=sl(rO(),1);function Gm(t){return{path:t.path.join(".")}}function Du(t){const e=Gm(t);return I.useMemo(()=>e,[e])}async function NT(t,e,a){const i=e.getQueryCache().build(e,{queryKey:a});i.setState({data:[],status:"success"});const s=[];var o=!1,u=!1,d;try{for(var f=(0,nO.default)(t),h;o=!(h=await f.next()).done;o=!1){const p=h.value;s.push(p),i.setState({data:[...s]})}}catch(p){u=!0,d=p}finally{try{o&&f.return!=null&&await f.return()}finally{if(u)throw d}}return s}var Tt=sl(xc(),1);function iO(t){const{client:e,queryClient:a}=t,r=e instanceof Jf?e:A0(e);return{infiniteQueryOptions:(i,s,o)=>{var u,d;const f=((u=s[1])===null||u===void 0?void 0:u.input)===Ar,h=async p=>{var m;const y=(0,Tt.default)((0,Tt.default)({},o),{},{trpc:(0,Tt.default)((0,Tt.default)({},o==null?void 0:o.trpc),!(o==null||(m=o.trpc)===null||m===void 0)&&m.abortOnUnmount?{signal:p.signal}:{signal:null})});return await r.query(...rr(s,y,{direction:p.direction,pageParam:p.pageParam}))};return Object.assign((0,Tt.default)((0,Tt.default)({},o),{},{initialData:o==null?void 0:o.initialData,queryKey:s,queryFn:f?Ar:h,initialPageParam:(d=o==null?void 0:o.initialCursor)!==null&&d!==void 0?d:null}),{trpc:Gm({path:i})})},queryOptions:(i,s,o)=>{var u;const d=((u=s[1])===null||u===void 0?void 0:u.input)===Ar,f=async h=>{var p;const m=(0,Tt.default)((0,Tt.default)({},o),{},{trpc:(0,Tt.default)((0,Tt.default)({},o==null?void 0:o.trpc),!(o==null||(p=o.trpc)===null||p===void 0)&&p.abortOnUnmount?{signal:h.signal}:{signal:null})}),y=await r.query(...rr(s,m));return cT(y)?NT(y,a,s):y};return Object.assign((0,Tt.default)((0,Tt.default)({},o),{},{initialData:o==null?void 0:o.initialData,queryKey:s,queryFn:d?Ar:f}),{trpc:Gm({path:i})})},fetchQuery:(i,s)=>a.fetchQuery((0,Tt.default)((0,Tt.default)({},s),{},{queryKey:i,queryFn:()=>r.query(...rr(i,s))})),fetchInfiniteQuery:(i,s)=>{var o;return a.fetchInfiniteQuery((0,Tt.default)((0,Tt.default)({},s),{},{queryKey:i,queryFn:({pageParam:u,direction:d})=>r.query(...rr(i,s,{pageParam:u,direction:d})),initialPageParam:(o=s==null?void 0:s.initialCursor)!==null&&o!==void 0?o:null}))},prefetchQuery:(i,s)=>a.prefetchQuery((0,Tt.default)((0,Tt.default)({},s),{},{queryKey:i,queryFn:()=>r.query(...rr(i,s))})),prefetchInfiniteQuery:(i,s)=>{var o;return a.prefetchInfiniteQuery((0,Tt.default)((0,Tt.default)({},s),{},{queryKey:i,queryFn:({pageParam:u,direction:d})=>r.query(...rr(i,s,{pageParam:u,direction:d})),initialPageParam:(o=s==null?void 0:s.initialCursor)!==null&&o!==void 0?o:null}))},ensureQueryData:(i,s)=>a.ensureQueryData((0,Tt.default)((0,Tt.default)({},s),{},{queryKey:i,queryFn:()=>r.query(...rr(i,s))})),invalidateQueries:(i,s,o)=>a.invalidateQueries((0,Tt.default)((0,Tt.default)({},s),{},{queryKey:i}),o),resetQueries:(i,s,o)=>a.resetQueries((0,Tt.default)((0,Tt.default)({},s),{},{queryKey:i}),o),refetchQueries:(i,s,o)=>a.refetchQueries((0,Tt.default)((0,Tt.default)({},s),{},{queryKey:i}),o),cancelQuery:(i,s)=>a.cancelQueries({queryKey:i},s),setQueryData:(i,s,o)=>a.setQueryData(i,s,o),setQueriesData:(i,s,o,u)=>a.setQueriesData((0,Tt.default)((0,Tt.default)({},s),{},{queryKey:i}),o,u),getQueryData:i=>a.getQueryData(i),setInfiniteQueryData:(i,s,o)=>a.setQueryData(i,s,o),getInfiniteQueryData:i=>a.getQueryData(i),setMutationDefaults:(i,s)=>{const o=i[0],u=d=>r.mutation(...rr([o,{input:d}],t));return a.setMutationDefaults(i,typeof s=="function"?s({canonicalMutationFn:u}):s)},getMutationDefaults:i=>a.getMutationDefaults(i),isMutating:i=>a.isMutating((0,Tt.default)((0,Tt.default)({},i),{},{exact:!0}))}}var Le=sl(xc());const C2=(t,e)=>new Proxy(t,{get(r,i){return e(i),r[i]}});function sO(t){var e,a;const r=(e=void 0)!==null&&e!==void 0?e:M=>M.originalFn(),i=(a=void 0)!==null&&a!==void 0?a:WD,s=kD,o=M=>{var D;const{abortOnUnmount:j=!1,queryClient:R,ssrContext:L}=M,[z,_]=I.useState((D=M.ssrState)!==null&&D!==void 0?D:!1),B=M.client instanceof Jf?M.client:A0(M.client),q=I.useMemo(()=>iO({client:B,queryClient:R}),[B,R]),V=I.useMemo(()=>(0,Le.default)({abortOnUnmount:j,queryClient:R,client:B,ssrContext:L??null,ssrState:z},q),[j,B,q,R,L,z]);return I.useEffect(()=>{_(Q=>Q?"mounted":!1)},[]),g.jsx(i.Provider,{value:V,children:M.children})};function u(){const M=I.useContext(i);if(!M)throw new Error("Unable to find tRPC Context. Did you forget to wrap your App inside `withTRPC` HoC?");return M}function d(M,D){var j;const{queryClient:R,ssrState:L}=u();return L&&L!=="mounted"&&((j=R.getQueryCache().find({queryKey:M}))===null||j===void 0?void 0:j.state.status)==="error"?(0,Le.default)({retryOnMount:!1},D):D}function f(M,D,j){var R,L,z,_,B;const q=u(),{abortOnUnmount:V,client:Q,ssrState:P,queryClient:U,prefetchQuery:F}=q,K=pn(M,D,"query"),J=U.getQueryDefaults(K),k=D===Ar;typeof window>"u"&&P==="prepass"&&(j==null||(R=j.trpc)===null||R===void 0?void 0:R.ssr)!==!1&&((L=j==null?void 0:j.enabled)!==null&&L!==void 0?L:J==null?void 0:J.enabled)!==!1&&!k&&!U.getQueryCache().find({queryKey:K})&&F(K,j);const G=d(K,(0,Le.default)((0,Le.default)({},J),j)),X=(z=(_=j==null||(B=j.trpc)===null||B===void 0?void 0:B.abortOnUnmount)!==null&&_!==void 0?_:void 0)!==null&&z!==void 0?z:V,W=RM((0,Le.default)((0,Le.default)({},G),{},{queryKey:K,queryFn:k?D:async $=>{const ee=(0,Le.default)((0,Le.default)({},G),{},{trpc:(0,Le.default)((0,Le.default)({},G==null?void 0:G.trpc),X?{signal:$.signal}:{signal:null})}),ie=await Q.query(...rr(K,ee));return cT(ie)?NT(ie,U,K):ie}}),U);return W.trpc=Du({path:M}),W}function h(M,D,j){var R,L,z;const _=u(),B=pn(M,D,"query"),q=D===Ar,V=(R=(L=j==null||(z=j.trpc)===null||z===void 0?void 0:z.abortOnUnmount)!==null&&L!==void 0?L:void 0)!==null&&R!==void 0?R:_.abortOnUnmount;zM((0,Le.default)((0,Le.default)({},j),{},{queryKey:B,queryFn:q?D:Q=>{const P={trpc:(0,Le.default)((0,Le.default)({},j==null?void 0:j.trpc),V?{signal:Q.signal}:{})};return _.client.query(...rr(B,P))}}))}function p(M,D,j){var R,L,z;const _=u(),B=pn(M,D,"query"),q=(R=(L=j==null||(z=j.trpc)===null||z===void 0?void 0:z.abortOnUnmount)!==null&&L!==void 0?L:void 0)!==null&&R!==void 0?R:_.abortOnUnmount,V=kM((0,Le.default)((0,Le.default)({},j),{},{queryKey:B,queryFn:Q=>{const P=(0,Le.default)((0,Le.default)({},j),{},{trpc:(0,Le.default)((0,Le.default)({},j==null?void 0:j.trpc),q?{signal:Q.signal}:{signal:null})});return _.client.query(...rr(B,P))}}),_.queryClient);return V.trpc=Du({path:M}),[V.data,V]}function m(M,D){const{client:j,queryClient:R}=u(),L=pf(M),z=R.defaultMutationOptions(R.getMutationDefaults(L)),_=_M((0,Le.default)((0,Le.default)({},D),{},{mutationKey:L,mutationFn:B=>j.mutation(...rr([M,{input:B}],D)),onSuccess(...B){var q,V;return r({originalFn:()=>{var P,U,F;return(P=D==null||(U=D.onSuccess)===null||U===void 0?void 0:U.call(D,...B))!==null&&P!==void 0?P:z==null||(F=z.onSuccess)===null||F===void 0?void 0:F.call(z,...B)},queryClient:R,meta:(q=(V=D==null?void 0:D.meta)!==null&&V!==void 0?V:z==null?void 0:z.meta)!==null&&q!==void 0?q:{}})}}),R);return _.trpc=Du({path:M}),_}const y={data:void 0,error:null,status:"idle"},x={data:void 0,error:null,status:"connecting"};/* istanbul ignore next -- @preserve */function E(M,D,j){var R;const L=(R=j==null?void 0:j.enabled)!==null&&R!==void 0?R:D!==Ar,z=Ji(pn(M,D,"any")),{client:_}=u(),B=I.useRef(j);I.useEffect(()=>{B.current=j});const[q]=I.useState(new Set([])),V=I.useCallback(k=>{q.add(k)},[q]),Q=I.useRef(null),P=I.useCallback(k=>{const G=F.current,X=F.current=k(G);let W=!1;for(const $ of q)if(G[$]!==X[$]){W=!0;break}W&&J(C2(X,V))},[V,q]),U=I.useCallback(()=>{var k;if((k=Q.current)===null||k===void 0||k.unsubscribe(),!L){P(()=>(0,Le.default)((0,Le.default)({},y),{},{reset:U}));return}P(()=>(0,Le.default)((0,Le.default)({},x),{},{reset:U}));const G=_.subscription(M.join("."),D??void 0,{onStarted:()=>{var X,W;(X=(W=B.current).onStarted)===null||X===void 0||X.call(W),P($=>(0,Le.default)((0,Le.default)({},$),{},{status:"pending",error:null}))},onData:X=>{var W,$;(W=($=B.current).onData)===null||W===void 0||W.call($,X),P(ee=>(0,Le.default)((0,Le.default)({},ee),{},{status:"pending",data:X,error:null}))},onError:X=>{var W,$;(W=($=B.current).onError)===null||W===void 0||W.call($,X),P(ee=>(0,Le.default)((0,Le.default)({},ee),{},{status:"error",error:X}))},onConnectionStateChange:X=>{P(W=>{switch(X.state){case"idle":return(0,Le.default)((0,Le.default)({},W),{},{status:X.state,error:null,data:void 0});case"connecting":return(0,Le.default)((0,Le.default)({},W),{},{error:X.error,status:X.state});case"pending":return W}})},onComplete:()=>{var X,W;(X=(W=B.current).onComplete)===null||X===void 0||X.call(W),P($=>(0,Le.default)((0,Le.default)({},$),{},{status:"idle",error:null,data:void 0}))}});Q.current=G},[_,z,L,P]);I.useEffect(()=>(U(),()=>{var k;(k=Q.current)===null||k===void 0||k.unsubscribe()}),[U]);const F=I.useRef(L?(0,Le.default)((0,Le.default)({},x),{},{reset:U}):(0,Le.default)((0,Le.default)({},y),{},{reset:U})),[K,J]=I.useState(C2(F.current,V));return K}function S(M,D,j){var R,L,z,_,B;const{client:q,ssrState:V,prefetchInfiniteQuery:Q,queryClient:P,abortOnUnmount:U}=u(),F=pn(M,D,"infinite"),K=P.getQueryDefaults(F),J=D===Ar;typeof window>"u"&&V==="prepass"&&(j==null||(R=j.trpc)===null||R===void 0?void 0:R.ssr)!==!1&&((L=j==null?void 0:j.enabled)!==null&&L!==void 0?L:K==null?void 0:K.enabled)!==!1&&!J&&!P.getQueryCache().find({queryKey:F})&&Q(F,(0,Le.default)((0,Le.default)({},K),j));const k=d(F,(0,Le.default)((0,Le.default)({},K),j)),G=(z=j==null||(_=j.trpc)===null||_===void 0?void 0:_.abortOnUnmount)!==null&&z!==void 0?z:U,X=UM((0,Le.default)((0,Le.default)({},k),{},{initialPageParam:(B=j.initialCursor)!==null&&B!==void 0?B:null,persister:j.persister,queryKey:F,queryFn:J?D:W=>{var $;const ee=(0,Le.default)((0,Le.default)({},k),{},{trpc:(0,Le.default)((0,Le.default)({},k==null?void 0:k.trpc),G?{signal:W.signal}:{signal:null})});return q.query(...rr(F,ee,{pageParam:($=W.pageParam)!==null&&$!==void 0?$:j.initialCursor,direction:W.direction}))}}),P);return X.trpc=Du({path:M}),X}function T(M,D,j){var R,L,z;const _=u(),B=pn(M,D,"infinite"),q=_.queryClient.getQueryDefaults(B),V=D===Ar,Q=d(B,(0,Le.default)((0,Le.default)({},q),j)),P=(R=j==null||(L=j.trpc)===null||L===void 0?void 0:L.abortOnUnmount)!==null&&R!==void 0?R:_.abortOnUnmount;PM((0,Le.default)((0,Le.default)({},j),{},{initialPageParam:(z=j.initialCursor)!==null&&z!==void 0?z:null,queryKey:B,queryFn:V?D:U=>{var F;const K=(0,Le.default)((0,Le.default)({},Q),{},{trpc:(0,Le.default)((0,Le.default)({},Q==null?void 0:Q.trpc),P?{signal:U.signal}:{})});return _.client.query(...rr(B,K,{pageParam:(F=U.pageParam)!==null&&F!==void 0?F:j.initialCursor,direction:U.direction}))}}))}function C(M,D,j){var R,L,z;const _=u(),B=pn(M,D,"infinite"),q=_.queryClient.getQueryDefaults(B),V=d(B,(0,Le.default)((0,Le.default)({},q),j)),Q=(R=j==null||(L=j.trpc)===null||L===void 0?void 0:L.abortOnUnmount)!==null&&R!==void 0?R:_.abortOnUnmount,P=BM((0,Le.default)((0,Le.default)({},j),{},{initialPageParam:(z=j.initialCursor)!==null&&z!==void 0?z:null,queryKey:B,queryFn:U=>{var F;const K=(0,Le.default)((0,Le.default)({},V),{},{trpc:(0,Le.default)((0,Le.default)({},V==null?void 0:V.trpc),Q?{signal:U.signal}:{})});return _.client.query(...rr(B,K,{pageParam:(F=U.pageParam)!==null&&F!==void 0?F:j.initialCursor,direction:U.direction}))}}),_.queryClient);return P.trpc=Du({path:M}),[P.data,P]}return{Provider:o,createClient:s,useContext:u,useUtils:u,useQuery:f,usePrefetchQuery:h,useSuspenseQuery:p,useQueries:(M,D)=>{const{ssrState:j,queryClient:R,prefetchQuery:L,client:z}=u(),_=T2(z),B=M(_);if(typeof window>"u"&&j==="prepass")for(const V of B){var q;const Q=V;((q=Q.trpc)===null||q===void 0?void 0:q.ssr)!==!1&&!R.getQueryCache().find({queryKey:Q.queryKey})&&L(Q.queryKey,Q)}return sT({queries:B.map(V=>(0,Le.default)((0,Le.default)({},V),{},{queryKey:V.queryKey})),combine:D==null?void 0:D.combine},R)},useSuspenseQueries:M=>{const{queryClient:D,client:j}=u(),R=T2(j),L=M(R),z=LM({queries:L.map(_=>(0,Le.default)((0,Le.default)({},_),{},{queryFn:_.queryFn,queryKey:_.queryKey}))},D);return[z.map(_=>_.data),z]},useMutation:m,useSubscription:E,useInfiniteQuery:S,usePrefetchInfiniteQuery:T,useSuspenseInfiniteQuery:C}}function lO(t){const e=XD(t);return N0(a=>a==="useContext"||a==="useUtils"?()=>{const r=t.useUtils();return I.useMemo(()=>tO(r),[r])}:t.hasOwnProperty(a)?t[a]:e[a])}function oO(t){const e=sO();return lO(e)}const xt=oO(),N2=["bg-blue-500","bg-emerald-500","bg-amber-500","bg-rose-500","bg-violet-500","bg-cyan-500","bg-pink-500","bg-lime-500","bg-teal-500","bg-orange-500"],j2=["bg-blue-500/15 text-blue-400","bg-emerald-500/15 text-emerald-400","bg-amber-500/15 text-amber-400","bg-rose-500/15 text-rose-400","bg-violet-500/15 text-violet-400","bg-cyan-500/15 text-cyan-400","bg-pink-500/15 text-pink-400","bg-lime-500/15 text-lime-400","bg-teal-500/15 text-teal-400","bg-orange-500/15 text-orange-400"],A2=["#3b82f6","#10b981","#f59e0b","#f43f5e","#8b5cf6","#06b6d4","#ec4899","#84cc16","#14b8a6","#f97316"];function M0(t){let e=0;for(let a=0;a<t.length;a++)e=e*31+t.charCodeAt(a)|0;return Math.abs(e)}function uO(t){return N2[M0(t)%N2.length]}function ra(t){return j2[M0(t)%j2.length]}function M2(t){return A2[M0(t)%A2.length]}function no(t){if(!t)return"--";try{return new Date(t).toLocaleString()}catch{return String(t)}}function jT(t,e=80){const a=JSON.stringify(t);return a.length<=e?a:a.slice(0,e)+"..."}function Xt(t){return t?{scope:t}:{}}function Zs(t,e,a){const r=`/g/col/${encodeURIComponent(t)}`;if(!e||Object.keys(e).length===0)return r;const s=(a!=null&&a.length?a:Object.keys(e)).filter(o=>e[o]!==void 0).map(o=>encodeURIComponent(e[o])).join("/");return s?`${r}/${s}`:r}function D2(t,e,a,r){return`${Zs(t,a,r)}/doc/${encodeURIComponent(e)}`}function an(t,e,a){const r=new Set(e.map(i=>i.viewName));if(!t)return"json";if(a){const i=t[a];if(i&&r.has(i))return i}return t.default&&r.has(t.default)?t.default:"json"}const O2={edges:[],hasMore:!1,loading:!1},D0=I.createContext(null);function cO({children:t}){const[e,a]=I.useState(null),[r,i]=I.useState({out:O2,in:O2}),s=I.useRef(null),o=I.useCallback(p=>{s.current=p},[]),u=I.useCallback(p=>{var m;(m=s.current)==null||m.peek(p)},[]),d=I.useCallback(()=>{var p;(p=s.current)==null||p.clearPeek()},[]),f=I.useCallback((p,m)=>{i(y=>({...y,[p]:m}))},[]),h=I.useMemo(()=>({focused:e,setFocused:a,onPeekNearby:u,onClearPeek:d,registerCallbacks:o,edgeResults:r,setEdgeResults:f}),[e,a,u,d,o,r,f]);return g.jsx(D0.Provider,{value:h,children:t})}function dO(){const t=I.useContext(D0);if(!t)throw new Error("useFocus must be used within a FocusProvider");return t}function Ro(){return I.useContext(D0)}const AT=I.createContext(null),fO=/^[A-Za-z0-9_-]+:[A-Za-z0-9_-]+$/;function MT(t){const e=t.split("/").filter(Boolean).map(s=>{try{return decodeURIComponent(s)}catch{return s}}),a=[];let r=0;for(;r<e.length&&fO.test(e[r]);){const s=e[r].indexOf(":"),o=e[r].slice(0,s),u=e[r].slice(s+1);o&&u&&a.push({parentUid:o,subgraphName:u}),r++}const i=e.slice(r).length>0?"/"+e.slice(r).join("/"):"/";return{segments:a,pageRoute:i}}function Rf(t){return t.length===0?"/g":"/g/"+t.map(e=>`${e.parentUid}:${e.subgraphName}`).join("/")}function hO({children:t}){const e=ls(),a=$r(),r=I.useMemo(()=>{if(!e.pathname.startsWith("/g"))return[];const p=e.pathname.slice(2).replace(/^\//,"");return MT(p).segments},[e.pathname]),i=I.useMemo(()=>r.map(p=>`${p.parentUid}/${p.subgraphName}`).join("/"),[r]),s=I.useMemo(()=>Rf(r),[r]),o=I.useCallback(p=>s+p,[s]),u=I.useCallback((p,m)=>{a(`${s}/${p}:${m}`)},[a,s]),d=I.useCallback(p=>{a(Rf(r.slice(0,p)))},[a,r]),f=I.useCallback(()=>{a("/g")},[a]),h=I.useMemo(()=>({scopePath:i,segments:r,isScoped:r.length>0,scopeUrlPrefix:s,scopedPath:o,enterSubgraph:u,popToDepth:d,exitToRoot:f}),[i,r,s,o,u,d,f]);return g.jsx(AT.Provider,{value:h,children:t})}function Wa(){const t=I.useContext(AT);if(!t)throw new Error("useScope must be used within a ScopeProvider");return t}function vO({schema:t}){const{focused:e,onPeekNearby:a,onClearPeek:r,edgeResults:i}=dO(),s=$r(),o=I.useMemo(()=>e?{uid:e.uid,nodeType:e.nodeType,edgeType:"",direction:"out"}:{uid:"",nodeType:"",edgeType:"",direction:"out"},[e==null?void 0:e.uid,e==null?void 0:e.nodeType]);return e?g.jsxs("div",{className:"flex flex-col h-full overflow-auto",children:[g.jsx("div",{className:"px-3 py-2 border-b border-slate-800 shrink-0 cursor-pointer hover:bg-slate-800/50 transition-colors",onMouseEnter:()=>a(o),children:g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:`px-1.5 py-0.5 rounded text-[9px] font-mono ${ra(e.nodeType)}`,children:e.nodeType}),g.jsx("span",{className:"text-[11px] font-mono text-slate-300 truncate",children:e.uid})]})}),g.jsx(R2,{direction:"out",results:i.out,schema:t,onPeek:a,onClearPeek:r,navigate:s}),g.jsx(R2,{direction:"in",results:i.in,schema:t,onPeek:a,onClearPeek:r,navigate:s})]}):g.jsxs("div",{className:"px-3 py-6 text-center",children:[g.jsx("svg",{className:"w-6 h-6 mx-auto mb-2 text-slate-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),g.jsx("p",{className:"text-[11px] text-slate-500",children:"Navigate to a node to explore nearby relationships"})]})}function R2({direction:t,results:e,schema:a,onPeek:r,onClearPeek:i,navigate:s}){const{edges:o,hasMore:u,loading:d}=e,f=I.useMemo(()=>{const m={};for(const y of a.edgeTypes)y.inverseLabel&&(m[y.axbType]=y.inverseLabel);return m},[a.edgeTypes]),h=I.useMemo(()=>{const m={};for(const y of o)m[y.axbType]||(m[y.axbType]=[]),m[y.axbType].push(y);return m},[o]),p=Object.entries(h);return d?g.jsxs("div",{className:"px-3 py-2",children:[g.jsx("h3",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold mb-1",children:t==="out"?"Outgoing":"Incoming"}),g.jsxs("div",{className:"flex items-center gap-1.5 py-1",children:[g.jsx("span",{className:"w-2.5 h-2.5 border border-slate-600 border-t-transparent rounded-full animate-spin"}),g.jsx("span",{className:"text-[10px] text-slate-600",children:"Loading..."})]})]}):g.jsxs("div",{className:"px-2 py-2",children:[g.jsx("h3",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold mb-1 px-1",children:t==="out"?"Outgoing":"Incoming"}),p.length===0?g.jsx("p",{className:"text-[10px] text-slate-600 px-1",children:"None"}):p.map(([m,y])=>g.jsx(pO,{axbType:m,edges:y,direction:t,inverseLabel:t==="in"?f[m]:void 0,onPeek:r,onClearPeek:i,navigate:s},m)),u&&g.jsx("p",{className:"text-[10px] text-slate-600 px-1 mt-1",children:"and more..."})]})}function pO({axbType:t,edges:e,direction:a,inverseLabel:r,onPeek:i,onClearPeek:s,navigate:o}){const[u,d]=I.useState(!0);return g.jsxs("div",{className:"mb-1",children:[g.jsxs("button",{onClick:()=>d(!u),className:"w-full flex items-center gap-1 px-1 py-0.5 rounded text-left hover:bg-slate-800/50 transition-colors group",children:[g.jsx("svg",{className:`w-3 h-3 text-slate-600 transition-transform ${u?"rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),r?g.jsx("span",{className:"text-amber-400/80 text-[11px] font-mono cursor-help",title:`Inverse of: ${t}`,children:r}):g.jsx("span",{className:"text-indigo-400/80 text-[11px] font-mono",children:t}),g.jsxs("span",{className:"text-slate-600 text-[10px]",children:["(",e.length,")"]})]}),u&&g.jsx("div",{className:"ml-3 space-y-px",children:e.map(f=>{const h=a==="out"?f.bUid:f.aUid,p=a==="out"?f.bType:f.aType;return g.jsx(gO,{targetUid:h,targetType:p,edgeType:f.axbType,direction:a,onPeek:i,onClearPeek:s,navigate:o},`${f.aUid}:${f.axbType}:${f.bUid}`)})})]})}function gO({targetUid:t,targetType:e,edgeType:a,direction:r,onPeek:i,onClearPeek:s,navigate:o}){const{scopedPath:u}=Wa(),d=I.useRef(null),f=I.useMemo(()=>({uid:t,nodeType:e,edgeType:a,direction:r}),[t,e,a,r]),h=I.useCallback(()=>{d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{d.current=null,i(f)},150)},[f,i]),p=I.useCallback(()=>{d.current&&(clearTimeout(d.current),d.current=null)},[]),m=I.useCallback(()=>{d.current&&(clearTimeout(d.current),d.current=null),s(),o(u(`/node/${encodeURIComponent(t)}`))},[t,s,o]);return I.useEffect(()=>()=>{d.current&&clearTimeout(d.current)},[]),g.jsxs("button",{onClick:m,onMouseEnter:h,onMouseLeave:p,className:"w-full flex items-center gap-1.5 px-2 py-1 rounded text-left transition-colors text-slate-400 hover:bg-slate-800 hover:text-slate-200",children:[g.jsx("span",{className:`px-1 py-px rounded text-[9px] font-mono shrink-0 ${ra(e)}`,children:e}),g.jsx("span",{className:"text-[11px] font-mono truncate",children:t})]})}function mO({schema:t,config:e,viewRegistry:a}){var A;const r=ls(),i=$r(),[s,o]=I.useState(""),[u,d]=I.useState("navigate"),f=Ro(),{scopePath:h,scopedPath:p,scopeUrlPrefix:m,isScoped:y,exitToRoot:x}=Wa(),E=xt.useUtils(),S=xt.reloadSchema.useMutation({onSuccess:()=>{E.getSchema.invalidate(),E.getViews.invalidate(),E.getWarnings.invalidate()}}),[T,C]=I.useState(null);I.useEffect(()=>{f!=null&&f.focused&&d("nearby")},[(A=f==null?void 0:f.focused)==null?void 0:A.uid]);const N=M=>{M.preventDefault(),s.trim()&&(i(p(`/node/${encodeURIComponent(s.trim())}`)),o(""))};return g.jsxs("aside",{className:"w-64 bg-slate-900 border-r border-slate-800 flex flex-col h-full shrink-0",children:[g.jsxs("div",{className:"p-4 border-b border-slate-800",children:[g.jsxs(Ua,{to:"/",className:"flex items-center gap-2 group",children:[g.jsx("div",{className:"w-7 h-7 bg-indigo-600 rounded-lg flex items-center justify-center text-xs font-bold",children:"FG"}),g.jsx("span",{className:"font-semibold text-sm group-hover:text-indigo-400 transition-colors",children:"Firegraph Editor"})]}),g.jsx("div",{className:"mt-2 text-[10px] text-slate-500 font-mono truncate",title:e.projectId,children:e.projectId}),g.jsxs("div",{className:"text-[10px] text-slate-500 font-mono truncate",title:e.collection,children:["/",e.collection]}),y&&g.jsxs("div",{className:"mt-1 flex items-center gap-1.5",children:[g.jsx("svg",{className:"w-3 h-3 text-indigo-400 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4"})}),g.jsx("span",{className:"text-[10px] text-indigo-400 font-mono truncate",title:h,children:h}),g.jsx("button",{onClick:x,className:"text-[9px] text-slate-500 hover:text-slate-300 underline shrink-0 transition-colors",children:"exit"})]}),g.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5",children:[g.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-medium bg-emerald-500/15 text-emerald-400",children:"Registry"}),t.dynamicMode&&g.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-medium bg-violet-500/15 text-violet-400",children:"Dynamic"}),t.readonly&&g.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-medium bg-slate-500/15 text-slate-400",children:"Read-Only"})]}),t.dynamicMode&&g.jsxs("div",{className:"mt-2",children:[g.jsxs("button",{onClick:()=>{C(null),S.mutate(void 0,{onSuccess:M=>{C(`Loaded ${M.nodeTypeCount} node, ${M.edgeTypeCount} edge types`),setTimeout(()=>C(null),3e3)},onError:M=>{C(`Error: ${M.message}`),setTimeout(()=>C(null),5e3)}})},disabled:S.isPending,className:"w-full flex items-center justify-center gap-1.5 px-2 py-1 rounded-md text-[10px] font-medium bg-violet-600/20 text-violet-300 hover:bg-violet-600/30 transition-colors disabled:opacity-50",children:[g.jsx("svg",{className:`w-3 h-3 ${S.isPending?"animate-spin":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),S.isPending?"Refreshing...":"Refresh Schemas"]}),T&&g.jsx("p",{className:`mt-1 text-[9px] ${S.isError?"text-red-400":"text-emerald-400"}`,children:T})]})]}),g.jsxs("div",{className:"flex border-b border-slate-800 shrink-0",children:[g.jsx("button",{onClick:()=>d("navigate"),className:`flex-1 px-3 py-2 text-[11px] font-medium transition-colors ${u==="navigate"?"text-slate-200 border-b-2 border-indigo-500":"text-slate-500 hover:text-slate-300"}`,children:"Navigate"}),g.jsx("button",{onClick:()=>d("nearby"),className:`flex-1 px-3 py-2 text-[11px] font-medium transition-colors relative ${u==="nearby"?"text-slate-200 border-b-2 border-indigo-500":"text-slate-500 hover:text-slate-300"}`,children:"Nearby"})]}),u==="navigate"?g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"p-3 border-b border-slate-800",children:g.jsx("form",{onSubmit:N,children:g.jsx("input",{type:"text",value:s,onChange:M=>o(M.target.value),placeholder:"Go to node by UID...",className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-xs text-slate-200 placeholder:text-slate-500 focus:outline-none focus:border-indigo-500 transition-colors"})})}),g.jsxs("nav",{className:"flex-1 overflow-auto p-3",children:[g.jsxs("div",{className:"mb-4",children:[g.jsxs(Ua,{to:"/g",className:`flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors ${r.pathname===m?"bg-indigo-600/20 text-indigo-400":"text-slate-400 hover:text-slate-200 hover:bg-slate-800"}`,children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2V6zM14 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V6zM4 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2v-2zM14 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z"})}),"Graph"]}),g.jsxs(Ua,{to:p("/traverse"),className:`flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors ${r.pathname===p("/traverse")?"bg-indigo-600/20 text-indigo-400":"text-slate-400 hover:text-slate-200 hover:bg-slate-800"}`,children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"Traverse"]}),(a==null?void 0:a.hasViews)&&g.jsxs(Ua,{to:p("/views"),className:`flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors ${r.pathname===p("/views")?"bg-indigo-600/20 text-indigo-400":"text-slate-400 hover:text-slate-200 hover:bg-slate-800"}`,children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 5a1 1 0 011-1h14a1 1 0 011 1v2a1 1 0 01-1 1H5a1 1 0 01-1-1V5zM4 13a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H5a1 1 0 01-1-1v-6zM16 13a1 1 0 011-1h2a1 1 0 011 1v6a1 1 0 01-1 1h-2a1 1 0 01-1-1v-6z"})}),"Views"]})]}),g.jsxs("div",{className:"mb-4",children:[g.jsx("h3",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold mb-2 px-3",children:"Node Types"}),t.nodeTypes.length===0?g.jsx("p",{className:"text-xs text-slate-600 px-3",children:"No nodes registered"}):t.nodeTypes.map(M=>g.jsxs(Ua,{to:p(`/browse/${encodeURIComponent(M.type)}`),className:`flex items-center justify-between px-3 py-1.5 rounded-lg text-xs transition-colors ${r.pathname===p(`/browse/${encodeURIComponent(M.type)}`)?"bg-slate-800 text-slate-100":"text-slate-400 hover:text-slate-200 hover:bg-slate-800/50"}`,children:[g.jsxs("span",{className:"flex items-center gap-2",children:[g.jsx("span",{className:`w-2 h-2 rounded-full ${uO(M.type)}`}),M.type]}),M.isDynamic&&g.jsx("span",{className:"px-1 py-px rounded text-[8px] font-semibold bg-violet-500/20 text-violet-400",title:"Dynamic type (from Firestore)",children:"D"})]},M.type))]}),g.jsxs("div",{className:"mb-4",children:[g.jsx("h3",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold mb-2 px-3",children:"Edge Types"}),t.edgeTypes.length===0?g.jsx("p",{className:"text-xs text-slate-600 px-3",children:"No edges registered"}):t.edgeTypes.map(M=>g.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 text-[11px] text-slate-500",children:[g.jsxs("span",{children:[g.jsx("span",{className:"text-slate-400",children:M.aType}),g.jsx("span",{className:"text-indigo-400 mx-1",children:"→"}),g.jsx("span",{className:"text-indigo-400",children:M.axbType}),g.jsx("span",{className:"text-indigo-400 mx-1",children:"→"}),g.jsx("span",{className:"text-slate-400",children:M.bType})]}),M.isDynamic&&g.jsx("span",{className:"px-1 py-px rounded text-[8px] font-semibold bg-violet-500/20 text-violet-400 shrink-0 ml-1",title:"Dynamic type (from Firestore)",children:"D"})]},`${M.aType}:${M.axbType}:${M.bType}`))]}),(t.collections??[]).length>0&&g.jsxs("div",{children:[g.jsx("h3",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold mb-2 px-3",children:"Collections"}),(t.collections??[]).map(M=>g.jsxs(Ua,{to:Zs(M.name),className:`flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors ${r.pathname.startsWith(Zs(M.name))?"bg-slate-800 text-slate-100":"text-slate-400 hover:text-slate-200 hover:bg-slate-800/50"}`,children:[g.jsx("svg",{className:"w-3 h-3 shrink-0 text-amber-500/70",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),g.jsx("span",{className:"flex-1 truncate",children:M.name}),M.pathParams.length>0&&g.jsx("span",{className:"text-[9px] text-slate-600 shrink-0",children:M.pathParams.map(D=>`{${D}}`).join("/")})]},M.name))]})]})]}):g.jsx("div",{className:"flex-1 overflow-auto",children:g.jsx(vO,{schema:t})}),g.jsx("div",{className:"p-3 border-t border-slate-800"})]})}function yO(){const{segments:t,isScoped:e}=Wa();return e?g.jsxs("nav",{className:"flex items-center px-4 py-2 bg-indigo-950/40 border-b border-indigo-500/20 text-xs gap-1 flex-wrap",children:[g.jsx("svg",{className:"w-3.5 h-3.5 text-indigo-400 mr-1 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4"})}),g.jsx(Ua,{to:"/g",className:"text-indigo-400 hover:text-indigo-300 font-medium transition-colors",children:"graph"}),t.map((a,r)=>g.jsxs("span",{className:"flex items-center gap-1",children:[g.jsx("span",{className:"text-slate-600",children:"/"}),g.jsx(Ua,{to:`${Rf(t.slice(0,r))}/node/${encodeURIComponent(a.parentUid)}`,className:"text-slate-400 hover:text-slate-200 font-mono transition-colors",title:a.parentUid,children:a.parentUid.length>10?`${a.parentUid.slice(0,8)}…`:a.parentUid}),g.jsx("span",{className:"text-slate-600",children:"/"}),g.jsx(Ua,{to:Rf(t.slice(0,r+1)),className:"text-indigo-400 hover:text-indigo-300 font-medium transition-colors",children:a.subgraphName})]},r))]}):null}function xO({warnings:t}){const[e,a]=I.useState(!1),[r,i]=I.useState(!1);return t.length===0||r?null:g.jsx("div",{className:"mx-6 mt-4",children:g.jsxs("div",{className:"bg-amber-500/10 border border-amber-500/30 rounded-lg px-4 py-3",children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsxs("button",{onClick:()=>a(!e),className:"flex items-center gap-2 text-left",children:[g.jsx("svg",{className:"w-4 h-4 text-amber-400 shrink-0",fill:"none",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"})}),g.jsxs("span",{className:"text-amber-400 text-sm font-medium",children:[t.length," schema/views warning",t.length!==1?"s":""]}),g.jsx("svg",{className:`w-3.5 h-3.5 text-amber-400/60 transition-transform ${e?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})})]}),g.jsx("button",{onClick:()=>i(!0),className:"text-amber-400/40 hover:text-amber-400/70 transition-colors p-1",title:"Dismiss",children:g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18 18 6M6 6l12 12"})})})]}),e&&g.jsx("ul",{className:"mt-3 space-y-1.5",children:t.map((s,o)=>g.jsxs("li",{className:"text-xs text-amber-300/80 flex items-start gap-2",children:[g.jsx("span",{className:"shrink-0 mt-1 w-1.5 h-1.5 rounded-full bg-amber-400"}),g.jsxs("span",{children:[g.jsxs("span",{className:"text-amber-400/50 font-mono mr-1",children:["[",s.code,"]"]}),s.message]})]},o))})]})})}class bO{constructor(e){jp(this,"baseUrl");this.baseUrl=e??""}async request(e){const a=await fetch(`${this.baseUrl}/api/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!a.ok){const i=await a.json().catch(()=>({}));throw new Error(i.error??`HTTP ${a.status}`)}const{requestId:r}=await a.json();return new wO(this.baseUrl,r)}async status(){const e=await fetch(`${this.baseUrl}/api/chat/status`);if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}async health(){try{const e=await fetch(`${this.baseUrl}/api/chat/status`,{signal:AbortSignal.timeout(3e3)});return e.ok?(await e.json()).enabled:!1}catch{return!1}}}class wO{constructor(e,a){this.baseUrl=e,this.requestId=a}async*stream(){const e=`${this.baseUrl}/api/chat/stream?requestId=${this.requestId}`,a=await fetch(e,{headers:{Accept:"text/event-stream"}});if(!a.ok||!a.body)throw new Error("Failed to open SSE stream");const r=a.body.getReader(),i=new TextDecoder;let s="",o=null;try{for(;;){const{value:u,done:d}=await r.read();if(d)break;s+=i.decode(u,{stream:!0});const f=s.split(`
|
|
77
|
+
|
|
78
|
+
`);s=f.pop()??"";for(const h of f){const p=h.split(`
|
|
79
|
+
`);let m="",y="";for(const x of p)x.startsWith("event: ")?m=x.slice(7):x.startsWith("data: ")&&(y=x.slice(6));if(m==="chunk"&&y)yield{kind:"text",text:JSON.parse(y).text};else if(m==="artifact"&&y)yield{kind:"artifact",artifact:JSON.parse(y)};else if(m==="tool_start"&&y)yield{kind:"tool_start",command:JSON.parse(y).command};else if(m==="session"&&y)o=JSON.parse(y).sessionId;else{if(m==="done")return{sessionId:o};if(m==="error"&&y)throw new Error(JSON.parse(y).message)}}}}finally{r.cancel()}return{sessionId:o}}}const DT=I.createContext(null),O0="fg-chat-history",qp="fg-chat-session";function k2(){return Date.now().toString(36)+Math.random().toString(36).slice(2,8)}function SO(){try{const t=sessionStorage.getItem(O0);if(t)return JSON.parse(t).map(a=>({...a,streaming:!1,activeToolCall:null}))}catch{}return[]}function EO(t){try{sessionStorage.setItem(O0,JSON.stringify(t))}catch{}}function TO({chatEnabled:t,children:e}){const[a,r]=I.useState(SO),[i,s]=I.useState(t?"checking":"disconnected"),[o,u]=I.useState(!1),[d,f]=I.useState(()=>{try{return sessionStorage.getItem(qp)}catch{return null}}),h=I.useRef(null);I.useEffect(()=>{t?(h.current=new bO,s("checking")):(h.current=null,s("disconnected"))},[t]),I.useEffect(()=>{EO(a)},[a]),I.useEffect(()=>{try{d?sessionStorage.setItem(qp,d):sessionStorage.removeItem(qp)}catch{}},[d]),I.useEffect(()=>{if(!h.current)return;let y=!0;const x=h.current,E=async()=>{const T=await x.health();y&&s(T?"connected":"disconnected")};E();const S=setInterval(E,3e4);return()=>{y=!1,clearInterval(S)}},[t]);const p=I.useCallback(async(y,x)=>{var N;const E=h.current;if(!E||o)return;const S={id:k2(),role:"user",content:y,timestamp:new Date().toISOString()},T=k2(),C={id:T,role:"assistant",content:"",timestamp:new Date().toISOString(),streaming:!0};r(A=>[...A,S,C]),u(!0);try{const M=(await E.request({prompt:y,context:x,sessionId:d??void 0})).stream();let D=await M.next();for(;!D.done;){const j=D.value;j.kind==="text"?r(R=>R.map(L=>L.id===T?{...L,content:L.content+j.text}:L)):j.kind==="artifact"?r(R=>R.map(L=>L.id===T?{...L,artifacts:[...L.artifacts??[],j.artifact],activeToolCall:null}:L)):j.kind==="tool_start"&&r(R=>R.map(L=>L.id===T?{...L,activeToolCall:j.command}:L)),D=await M.next()}(N=D.value)!=null&&N.sessionId&&f(D.value.sessionId),r(j=>j.map(R=>R.id===T?{...R,streaming:!1,activeToolCall:null}:R))}catch(A){const M=A instanceof Error?A.message:"Unknown error";r(D=>D.map(j=>j.id===T?{...j,role:"error",content:M,streaming:!1}:j))}finally{u(!1)}},[o,d]),m=I.useCallback(()=>{r([]),sessionStorage.removeItem(O0),f(null)},[]);return g.jsx(DT.Provider,{value:{messages:a,status:i,isStreaming:o,sendMessage:p,clearHistory:m,chatEnabled:t},children:e})}function CO(){const t=I.useContext(DT);if(!t)throw new Error("useChat must be used within ChatProvider");return t}const OT=I.createContext(null);function NO({children:t}){const[e,a]=I.useState(null),r=I.useCallback(s=>{a(s)},[]),i=I.useCallback(()=>{a(null)},[]);return g.jsx(OT.Provider,{value:{activeArtifact:e,showArtifact:r,dismissArtifact:i},children:t})}function jO(){const t=I.useContext(OT);if(!t)throw new Error("useArtifact must be used within ArtifactProvider");return t}const RT=I.createContext(null);function AO({children:t}){const[e,a]=I.useState("collapsed"),r=I.useCallback(()=>a("expanded"),[]),i=I.useCallback(()=>a("collapsed"),[]);return g.jsx(RT.Provider,{value:{mode:e,expand:r,collapse:i},children:t})}function MO(){const t=I.useContext(RT);if(!t)throw new Error("useChatBar must be used within ChatBarProvider");return t}function DO(t,e){var r;const a={};if(t!=null&&t.focused){a.focusedNode={uid:t.focused.uid,nodeType:t.focused.nodeType};const i=(r=e.nodeSchemas)==null?void 0:r.find(s=>s.aType===t.focused.nodeType&&s.isNodeEntry);if(i&&(a.nodeSchema={type:i.aType,description:i.description,fields:i.fields.map(s=>({name:s.name,type:s.type,required:s.required,description:s.description,enumValues:s.enumValues}))}),t.edgeResults.out.edges.length>0){const s={};for(const o of t.edgeResults.out.edges){const u=o.axbType;s[u]||(s[u]={targetType:o.bType,count:0}),s[u].count++}a.outgoingEdges=Object.entries(s).map(([o,u])=>({axbType:o,targetType:u.targetType,count:u.count,hasMore:t.edgeResults.out.hasMore}))}if(t.edgeResults.in.edges.length>0){const s={};for(const o of t.edgeResults.in.edges){const u=o.axbType;s[u]||(s[u]={sourceType:o.aType,count:0}),s[u].count++}a.incomingEdges=Object.entries(s).map(([o,u])=>({axbType:o,sourceType:u.sourceType,count:u.count,hasMore:t.edgeResults.in.hasMore}))}}return a.graphTopology=e.edgeTypes.map(i=>({aType:i.aType,axbType:i.axbType,bType:i.bType,inverseLabel:i.inverseLabel})),a}function OO(t){const e=t.data;switch(t.kind){case"node-detail":{const a=e.node,r=Array.isArray(e.outEdges)?e.outEdges.length:0,i=Array.isArray(e.inEdges)?e.inEdges.length:0;return{icon:"●",label:a?`${a.type}:${a.uid}`:"Node not found",detail:`${r+i} edges`}}case"nodes-list":return{icon:"≡",label:`${(Array.isArray(e.nodes)?e.nodes:[]).length} nodes`,detail:e.hasMore?"has more":""};case"edges-list":return{icon:"→",label:`${(Array.isArray(e.edges)?e.edges:[]).length} edges`,detail:e.hasMore?"has more":""};case"traverse":return{icon:"⚡",label:`Traversal: ${(Array.isArray(e.hops)?e.hops:[]).length} hops`,detail:`${e.totalReads??0} reads`};case"search":return{icon:"⌕",label:`${(Array.isArray(e.results)?e.results:[]).length} results`,detail:"search"};case"schema":{const a=Array.isArray(e.nodeTypes)?e.nodeTypes:[],r=Array.isArray(e.edgeTypes)?e.edgeTypes:[];return{icon:"⊞",label:`${a.length} node types`,detail:`${r.length} edge types`}}default:return{icon:"?",label:"Query result",detail:""}}}function Dr({data:t,defaultExpanded:e=!0,depth:a=0}){const[r,i]=I.useState(e&&a<2);if(t===null)return g.jsx("span",{className:"text-slate-500",children:"null"});if(t===void 0)return g.jsx("span",{className:"text-slate-500",children:"undefined"});if(typeof t=="string")return g.jsxs("span",{className:"text-emerald-400",children:['"',t,'"']});if(typeof t=="number")return g.jsx("span",{className:"text-amber-400",children:t});if(typeof t=="boolean")return g.jsx("span",{className:"text-violet-400",children:String(t)});if(Array.isArray(t))return t.length===0?g.jsx("span",{className:"text-slate-500",children:"[]"}):g.jsxs("span",{children:[g.jsx("button",{onClick:()=>i(!r),className:"text-slate-500 hover:text-slate-300 transition-colors",children:r?"[▾":`[▸ ${t.length} items]`}),r&&g.jsx("div",{className:"ml-4 border-l border-slate-800 pl-3",children:t.map((s,o)=>g.jsxs("div",{className:"py-0.5",children:[g.jsx("span",{className:"text-slate-600 text-xs mr-2",children:o}),g.jsx(Dr,{data:s,depth:a+1}),o<t.length-1&&g.jsx("span",{className:"text-slate-600",children:","})]},o))}),r&&g.jsx("span",{className:"text-slate-500",children:"]"})]});if(typeof t=="object"){const s=Object.entries(t);return s.length===0?g.jsx("span",{className:"text-slate-500",children:"{}"}):g.jsxs("span",{children:[g.jsx("button",{onClick:()=>i(!r),className:"text-slate-500 hover:text-slate-300 transition-colors",children:r?"{▾":`{▸ ${s.length} keys}`}),r&&g.jsx("div",{className:"ml-4 border-l border-slate-800 pl-3",children:s.map(([o,u],d)=>g.jsxs("div",{className:"py-0.5",children:[g.jsx("span",{className:"text-cyan-400",children:o}),g.jsx("span",{className:"text-slate-600",children:": "}),g.jsx(Dr,{data:u,depth:a+1}),d<s.length-1&&g.jsx("span",{className:"text-slate-600",children:","})]},o))}),r&&g.jsx("span",{className:"text-slate-500",children:"}"})]})}return g.jsx("span",{className:"text-slate-400",children:String(t)})}function RO({tagName:t,data:e,className:a,onError:r}){const i=I.useRef(null),s=I.useRef(null),o=I.useRef(r);return o.current=r,I.useEffect(()=>{var d,f;const u=i.current;if(u)try{if(!customElements.get(t)){console.warn(`[CustomView] <${t}> is not registered, falling back to JSON.`),s.current=null,(d=o.current)==null||d.call(o);return}if(!s.current||s.current.tagName.toLowerCase()!==t){u.innerHTML="";const h=document.createElement(t);h.style.display="block",u.appendChild(h),s.current=h}s.current.data=e}catch(h){console.error(`[CustomView] Error rendering <${t}>:`,h),u.innerHTML="",s.current=null,(f=o.current)==null||f.call(o)}},[t,e]),I.useEffect(()=>()=>{i.current&&(i.current.innerHTML=""),s.current=null},[]),g.jsx("div",{ref:i,className:a})}class kO extends I.Component{constructor(){super(...arguments);jp(this,"state",{error:null})}static getDerivedStateFromError(a){return{error:a}}componentDidCatch(a){var r,i;console.error("[CustomView] Boundary caught error:",a),(i=(r=this.props).onError)==null||i.call(r)}render(){return this.state.error?null:this.props.children}}function Xn(t){return g.jsx(kO,{...t,children:g.jsx(RO,{...t})})}function No({views:t,activeView:e,onSwitch:a}){return t.length===0?null:g.jsxs("select",{value:e,onChange:r=>a(r.target.value),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-xs text-slate-200 focus:outline-none focus:border-indigo-500",children:[g.jsx("option",{value:"json",children:"JSON"}),t.map(r=>g.jsx("option",{value:r.tagName,children:r.viewName},r.tagName))]})}let R0=0;function Ls(){return`lane-${++R0}`}function kf(t){return{uid:t,nodeType:"",edgeType:"",direction:"out"}}function BO(t,e){switch(e.type){case"RESET":{R0=0;const a=Ls();return{lanes:[{id:a,frames:[kf(e.rootUid)]}],activeLaneId:a,previewLaneId:void 0}}case"EXTEND_LANE":return{lanes:t.lanes.map(a=>a.id===e.laneId?{...a,frames:[...a.frames,e.frame]}:a),activeLaneId:e.laneId};case"EXTEND_PATH":return{lanes:t.lanes.map(a=>a.id===e.laneId?{...a,frames:[...a.frames,...e.frames]}:a),activeLaneId:e.laneId};case"FORK_AND_DRILL":{const a=t.lanes.find(i=>i.id===e.fromLaneId);if(!a)return t;const r={id:e.newLaneId,frames:[...a.frames.slice(0,e.fromIndex+1),e.frame]};return{lanes:[...t.lanes,r],activeLaneId:e.newLaneId}}case"FORK_AND_DRILL_PATH":{const a=t.lanes.find(i=>i.id===e.fromLaneId);if(!a)return t;const r={id:e.newLaneId,frames:[...a.frames.slice(0,e.fromIndex+1),...e.frames]};return{lanes:[...t.lanes,r],activeLaneId:e.newLaneId}}case"CREATE_LANE":return{lanes:[...t.lanes,{id:e.newLaneId,frames:e.frames}],activeLaneId:e.newLaneId};case"POP_TO":return{lanes:t.lanes.map(a=>a.id===e.laneId?{...a,frames:a.frames.slice(0,e.index+1)}:a),activeLaneId:e.laneId};case"CLOSE_LANE":{const a=t.lanes.filter(r=>r.id!==e.laneId);if(a.length===0){const r=Ls();return{lanes:[{id:r,frames:[kf(e.rootUid)]}],activeLaneId:r}}return{lanes:a,activeLaneId:t.activeLaneId===e.laneId?a[0].id:t.activeLaneId}}case"SWITCH_LANE":return{...t,activeLaneId:e.laneId};case"SET_ROOT_TYPE":return{...t,lanes:t.lanes.map(a=>{var i;if(((i=a.frames[0])==null?void 0:i.nodeType)===e.nodeType)return a;const r=[...a.frames];return r[0]={...r[0],nodeType:e.nodeType},{...a,frames:r}})};case"PREVIEW_FRAME":{let a=t.lanes;t.previewLaneId&&(a=a.map(i=>i.id===t.previewLaneId?{...i,frames:i.frames.slice(0,-1)}:i));const r=a.find(i=>i.id===e.laneId);return r&&r.frames.some(i=>i.uid===e.frame.uid)?{...t,lanes:a,previewLaneId:void 0}:{...t,lanes:a.map(i=>i.id===e.laneId?{...i,frames:[...i.frames,e.frame]}:i),previewLaneId:e.laneId}}case"CLEAR_PREVIEW":return t.previewLaneId?{...t,lanes:t.lanes.map(a=>a.id===t.previewLaneId?{...a,frames:a.frames.slice(0,-1)}:a),previewLaneId:void 0}:t;case"COMMIT_PREVIEW":return{...t,previewLaneId:void 0};default:return t}}const k0=I.createContext(null),B0=I.createContext(null);function LO({rootUid:t,initialPaths:e,children:a}){const[r,i]=I.useReducer(BO,{rootUid:t,initialPaths:e},D=>{if(R0=0,D.initialPaths&&D.initialPaths.length>0){const R=D.initialPaths.map(L=>({id:Ls(),frames:[kf(D.rootUid),...L]}));return{lanes:R,activeLaneId:R[0].id}}const j=Ls();return{lanes:[{id:j,frames:[kf(D.rootUid)]}],activeLaneId:j}}),s=I.useRef(t);I.useEffect(()=>{s.current!==t&&(s.current=t,i({type:"RESET",rootUid:t}))},[t]);const o=I.useMemo(()=>r.lanes.find(D=>D.id===r.activeLaneId)??r.lanes[0],[r.lanes,r.activeLaneId]),u=I.useCallback(D=>{i({type:"EXTEND_LANE",laneId:r.activeLaneId,frame:D})},[r.activeLaneId]),d=I.useCallback(D=>{D.length!==0&&i({type:"EXTEND_PATH",laneId:r.activeLaneId,frames:D})},[r.activeLaneId]),f=I.useCallback((D,j)=>{i({type:"EXTEND_LANE",laneId:D,frame:j})},[]),h=I.useCallback((D,j)=>{j.length!==0&&i({type:"EXTEND_PATH",laneId:D,frames:j})},[]),p=I.useCallback((D,j,R)=>{const L=Ls();i({type:"FORK_AND_DRILL",fromLaneId:D,fromIndex:j,frame:R,newLaneId:L})},[]),m=I.useCallback((D,j,R)=>{if(R.length===0)return;const L=Ls();i({type:"FORK_AND_DRILL_PATH",fromLaneId:D,fromIndex:j,frames:R,newLaneId:L})},[]),y=I.useCallback(D=>{if(D.length===0)return;const j=Ls();i({type:"CREATE_LANE",newLaneId:j,frames:D})},[]),x=I.useCallback((D,j)=>{i({type:"POP_TO",laneId:D,index:j})},[]),E=I.useCallback(D=>{i({type:"CLOSE_LANE",laneId:D,rootUid:t})},[t]),S=I.useCallback(D=>{i({type:"SWITCH_LANE",laneId:D})},[]),T=I.useCallback(D=>{i({type:"SET_ROOT_TYPE",nodeType:D})},[]),C=I.useCallback(D=>{i({type:"PREVIEW_FRAME",laneId:r.activeLaneId,frame:D})},[r.activeLaneId]),N=I.useCallback(()=>{i({type:"CLEAR_PREVIEW"})},[]),A=I.useCallback(()=>{i({type:"COMMIT_PREVIEW"})},[]),M=I.useMemo(()=>({lanes:r.lanes,activeLaneId:r.activeLaneId,activeLane:o,activeIndex:o.frames.length-1,previewLaneId:r.previewLaneId,drillIn:u,drillPath:d,extendLane:f,extendPath:h,forkAndDrill:p,forkAndDrillPath:m,createLane:y,popTo:x,closeLane:E,switchLane:S,setRootType:T,previewFrame:C,clearPreview:N,commitPreview:A}),[r.lanes,r.activeLaneId,r.previewLaneId,o,u,d,f,h,p,m,y,x,E,S,T,C,N,A]);return g.jsx(k0.Provider,{value:M,children:a})}function eh(){const t=I.useContext(k0);if(!t)throw new Error("useDrill must be used within a DrillProvider");const e=I.useContext(B0);return e?{...t,...e}:t}function kT(){const t=I.useContext(k0),e=I.useContext(B0);return t?e?{...t,...e}:t:null}function Qm(t,e){(e==null||e>t.length)&&(e=t.length);for(var a=0,r=Array(e);a<e;a++)r[a]=t[a];return r}function zO(t){if(Array.isArray(t))return t}function PO(t){if(Array.isArray(t))return Qm(t)}function us(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _O(t,e){for(var a=0;a<e.length;a++){var r=e[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,LT(r.key),r)}}function cs(t,e,a){return e&&_O(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function yr(t,e){var a=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=L0(t))||e){a&&(t=a);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(d){throw d},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
80
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s,o=!0,u=!1;return{s:function(){a=a.call(t)},n:function(){var d=a.next();return o=d.done,d},e:function(d){u=!0,s=d},f:function(){try{o||a.return==null||a.return()}finally{if(u)throw s}}}}function BT(t,e,a){return(e=LT(e))in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function UO(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function qO(t,e){var a=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(a!=null){var r,i,s,o,u=[],d=!0,f=!1;try{if(s=(a=a.call(t)).next,e===0){if(Object(a)!==a)return;d=!1}else for(;!(d=(r=s.call(a)).done)&&(u.push(r.value),u.length!==e);d=!0);}catch(h){f=!0,i=h}finally{try{if(!d&&a.return!=null&&(o=a.return(),Object(o)!==o))return}finally{if(f)throw i}}return u}}function IO(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
81
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function VO(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
82
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ma(t,e){return zO(t)||qO(t,e)||L0(t,e)||IO()}function Bf(t){return PO(t)||UO(t)||L0(t)||VO()}function FO(t,e){if(typeof t!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var r=a.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function LT(t){var e=FO(t,"string");return typeof e=="symbol"?e:e+""}function Sa(t){"@babel/helpers - typeof";return Sa=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Sa(t)}function L0(t,e){if(t){if(typeof t=="string")return Qm(t,e);var a={}.toString.call(t).slice(8,-1);return a==="Object"&&t.constructor&&(a=t.constructor.name),a==="Map"||a==="Set"?Array.from(t):a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?Qm(t,e):void 0}}var ba=typeof window>"u"?null:window,B2=ba?ba.navigator:null;ba&&ba.document;var HO=Sa(""),zT=Sa({}),GO=Sa(function(){}),QO=typeof HTMLElement>"u"?"undefined":Sa(HTMLElement),bc=function(e){return e&&e.instanceString&&Zt(e.instanceString)?e.instanceString():null},Xe=function(e){return e!=null&&Sa(e)==HO},Zt=function(e){return e!=null&&Sa(e)===GO},_t=function(e){return!Mr(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},wt=function(e){return e!=null&&Sa(e)===zT&&!_t(e)&&e.constructor===Object},YO=function(e){return e!=null&&Sa(e)===zT},Oe=function(e){return e!=null&&Sa(e)===Sa(1)&&!isNaN(e)},KO=function(e){return Oe(e)&&Math.floor(e)===e},Lf=function(e){if(QO!=="undefined")return e!=null&&e instanceof HTMLElement},Mr=function(e){return wc(e)||PT(e)},wc=function(e){return bc(e)==="collection"&&e._private.single},PT=function(e){return bc(e)==="collection"&&!e._private.single},z0=function(e){return bc(e)==="core"},_T=function(e){return bc(e)==="stylesheet"},$O=function(e){return bc(e)==="event"},es=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},XO=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},ZO=function(e){return wt(e)&&Oe(e.x1)&&Oe(e.x2)&&Oe(e.y1)&&Oe(e.y2)},WO=function(e){return YO(e)&&Zt(e.then)},JO=function(){return B2&&B2.userAgent.match(/msie|trident|edge/i)},jo=function(e,a){a||(a=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var s=[],o=0;o<arguments.length;o++)s.push(arguments[o]);return s.join("$")});var r=function(){var s=this,o=arguments,u,d=a.apply(s,o),f=r.cache;return(u=f[d])||(u=f[d]=e.apply(s,o)),u};return r.cache={},r},P0=jo(function(t){return t.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),th=jo(function(t){return t.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),UT=jo(function(t,e){return t+e[0].toUpperCase()+e.substring(1)},function(t,e){return t+"$"+e}),L2=function(e){return es(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},Qi=function(e,a){return e.slice(-1*a.length)===a},wa="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",e4="rgb[a]?\\(("+wa+"[%]?)\\s*,\\s*("+wa+"[%]?)\\s*,\\s*("+wa+"[%]?)(?:\\s*,\\s*("+wa+"))?\\)",t4="rgb[a]?\\((?:"+wa+"[%]?)\\s*,\\s*(?:"+wa+"[%]?)\\s*,\\s*(?:"+wa+"[%]?)(?:\\s*,\\s*(?:"+wa+"))?\\)",a4="hsl[a]?\\(("+wa+")\\s*,\\s*("+wa+"[%])\\s*,\\s*("+wa+"[%])(?:\\s*,\\s*("+wa+"))?\\)",r4="hsl[a]?\\((?:"+wa+")\\s*,\\s*(?:"+wa+"[%])\\s*,\\s*(?:"+wa+"[%])(?:\\s*,\\s*(?:"+wa+"))?\\)",n4="\\#[0-9a-fA-F]{3}",i4="\\#[0-9a-fA-F]{6}",qT=function(e,a){return e<a?-1:e>a?1:0},s4=function(e,a){return-1*qT(e,a)},et=Object.assign!=null?Object.assign.bind(Object):function(t){for(var e=arguments,a=1;a<e.length;a++){var r=e[a];if(r!=null)for(var i=Object.keys(r),s=0;s<i.length;s++){var o=i[s];t[o]=r[o]}}return t},l4=function(e){if(!(!(e.length===4||e.length===7)||e[0]!=="#")){var a=e.length===4,r,i,s,o=16;return a?(r=parseInt(e[1]+e[1],o),i=parseInt(e[2]+e[2],o),s=parseInt(e[3]+e[3],o)):(r=parseInt(e[1]+e[2],o),i=parseInt(e[3]+e[4],o),s=parseInt(e[5]+e[6],o)),[r,i,s]}},o4=function(e){var a,r,i,s,o,u,d,f;function h(x,E,S){return S<0&&(S+=1),S>1&&(S-=1),S<1/6?x+(E-x)*6*S:S<1/2?E:S<2/3?x+(E-x)*(2/3-S)*6:x}var p=new RegExp("^"+a4+"$").exec(e);if(p){if(r=parseInt(p[1]),r<0?r=(360- -1*r%360)%360:r>360&&(r=r%360),r/=360,i=parseFloat(p[2]),i<0||i>100||(i=i/100,s=parseFloat(p[3]),s<0||s>100)||(s=s/100,o=p[4],o!==void 0&&(o=parseFloat(o),o<0||o>1)))return;if(i===0)u=d=f=Math.round(s*255);else{var m=s<.5?s*(1+i):s+i-s*i,y=2*s-m;u=Math.round(255*h(y,m,r+1/3)),d=Math.round(255*h(y,m,r)),f=Math.round(255*h(y,m,r-1/3))}a=[u,d,f,o]}return a},u4=function(e){var a,r=new RegExp("^"+e4+"$").exec(e);if(r){a=[];for(var i=[],s=1;s<=3;s++){var o=r[s];if(o[o.length-1]==="%"&&(i[s]=!0),o=parseFloat(o),i[s]&&(o=o/100*255),o<0||o>255)return;a.push(Math.floor(o))}var u=i[1]||i[2]||i[3],d=i[1]&&i[2]&&i[3];if(u&&!d)return;var f=r[4];if(f!==void 0){if(f=parseFloat(f),f<0||f>1)return;a.push(f)}}return a},c4=function(e){return d4[e.toLowerCase()]},IT=function(e){return(_t(e)?e:null)||c4(e)||l4(e)||u4(e)||o4(e)},d4={transparent:[0,0,0,0],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],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],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],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]},VT=function(e){for(var a=e.map,r=e.keys,i=r.length,s=0;s<i;s++){var o=r[s];if(wt(o))throw Error("Tried to set map with object key");s<r.length-1?(a[o]==null&&(a[o]={}),a=a[o]):a[o]=e.value}},FT=function(e){for(var a=e.map,r=e.keys,i=r.length,s=0;s<i;s++){var o=r[s];if(wt(o))throw Error("Tried to get map with object key");if(a=a[o],a==null)return a}return a},Zd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Sc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ip,z2;function Ec(){if(z2)return Ip;z2=1;function t(e){var a=typeof e;return e!=null&&(a=="object"||a=="function")}return Ip=t,Ip}var Vp,P2;function f4(){if(P2)return Vp;P2=1;var t=typeof Zd=="object"&&Zd&&Zd.Object===Object&&Zd;return Vp=t,Vp}var Fp,_2;function ah(){if(_2)return Fp;_2=1;var t=f4(),e=typeof self=="object"&&self&&self.Object===Object&&self,a=t||e||Function("return this")();return Fp=a,Fp}var Hp,U2;function h4(){if(U2)return Hp;U2=1;var t=ah(),e=function(){return t.Date.now()};return Hp=e,Hp}var Gp,q2;function v4(){if(q2)return Gp;q2=1;var t=/\s/;function e(a){for(var r=a.length;r--&&t.test(a.charAt(r)););return r}return Gp=e,Gp}var Qp,I2;function p4(){if(I2)return Qp;I2=1;var t=v4(),e=/^\s+/;function a(r){return r&&r.slice(0,t(r)+1).replace(e,"")}return Qp=a,Qp}var Yp,V2;function _0(){if(V2)return Yp;V2=1;var t=ah(),e=t.Symbol;return Yp=e,Yp}var Kp,F2;function g4(){if(F2)return Kp;F2=1;var t=_0(),e=Object.prototype,a=e.hasOwnProperty,r=e.toString,i=t?t.toStringTag:void 0;function s(o){var u=a.call(o,i),d=o[i];try{o[i]=void 0;var f=!0}catch{}var h=r.call(o);return f&&(u?o[i]=d:delete o[i]),h}return Kp=s,Kp}var $p,H2;function m4(){if(H2)return $p;H2=1;var t=Object.prototype,e=t.toString;function a(r){return e.call(r)}return $p=a,$p}var Xp,G2;function HT(){if(G2)return Xp;G2=1;var t=_0(),e=g4(),a=m4(),r="[object Null]",i="[object Undefined]",s=t?t.toStringTag:void 0;function o(u){return u==null?u===void 0?i:r:s&&s in Object(u)?e(u):a(u)}return Xp=o,Xp}var Zp,Q2;function y4(){if(Q2)return Zp;Q2=1;function t(e){return e!=null&&typeof e=="object"}return Zp=t,Zp}var Wp,Y2;function Tc(){if(Y2)return Wp;Y2=1;var t=HT(),e=y4(),a="[object Symbol]";function r(i){return typeof i=="symbol"||e(i)&&t(i)==a}return Wp=r,Wp}var Jp,K2;function x4(){if(K2)return Jp;K2=1;var t=p4(),e=Ec(),a=Tc(),r=NaN,i=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,o=/^0o[0-7]+$/i,u=parseInt;function d(f){if(typeof f=="number")return f;if(a(f))return r;if(e(f)){var h=typeof f.valueOf=="function"?f.valueOf():f;f=e(h)?h+"":h}if(typeof f!="string")return f===0?f:+f;f=t(f);var p=s.test(f);return p||o.test(f)?u(f.slice(2),p?2:8):i.test(f)?r:+f}return Jp=d,Jp}var eg,$2;function b4(){if($2)return eg;$2=1;var t=Ec(),e=h4(),a=x4(),r="Expected a function",i=Math.max,s=Math.min;function o(u,d,f){var h,p,m,y,x,E,S=0,T=!1,C=!1,N=!0;if(typeof u!="function")throw new TypeError(r);d=a(d)||0,t(f)&&(T=!!f.leading,C="maxWait"in f,m=C?i(a(f.maxWait)||0,d):m,N="trailing"in f?!!f.trailing:N);function A(q){var V=h,Q=p;return h=p=void 0,S=q,y=u.apply(Q,V),y}function M(q){return S=q,x=setTimeout(R,d),T?A(q):y}function D(q){var V=q-E,Q=q-S,P=d-V;return C?s(P,m-Q):P}function j(q){var V=q-E,Q=q-S;return E===void 0||V>=d||V<0||C&&Q>=m}function R(){var q=e();if(j(q))return L(q);x=setTimeout(R,D(q))}function L(q){return x=void 0,N&&h?A(q):(h=p=void 0,y)}function z(){x!==void 0&&clearTimeout(x),S=0,h=E=p=x=void 0}function _(){return x===void 0?y:L(e())}function B(){var q=e(),V=j(q);if(h=arguments,p=this,E=q,V){if(x===void 0)return M(E);if(C)return clearTimeout(x),x=setTimeout(R,d),A(E)}return x===void 0&&(x=setTimeout(R,d)),y}return B.cancel=z,B.flush=_,B}return eg=o,eg}var w4=b4(),Cc=Sc(w4),tg=ba?ba.performance:null,GT=tg&&tg.now?function(){return tg.now()}:function(){return Date.now()},S4=(function(){if(ba){if(ba.requestAnimationFrame)return function(t){ba.requestAnimationFrame(t)};if(ba.mozRequestAnimationFrame)return function(t){ba.mozRequestAnimationFrame(t)};if(ba.webkitRequestAnimationFrame)return function(t){ba.webkitRequestAnimationFrame(t)};if(ba.msRequestAnimationFrame)return function(t){ba.msRequestAnimationFrame(t)}}return function(t){t&&setTimeout(function(){t(GT())},1e3/60)}})(),zf=function(e){return S4(e)},Zn=GT,zs=9261,QT=65599,Jl=5381,YT=function(e){for(var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:zs,r=a,i;i=e.next(),!i.done;)r=r*QT+i.value|0;return r},Xu=function(e){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:zs;return a*QT+e|0},Zu=function(e){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Jl;return(a<<5)+a+e|0},E4=function(e,a){return e*2097152+a},Di=function(e){return e[0]*2097152+e[1]},Wd=function(e,a){return[Xu(e[0],a[0]),Zu(e[1],a[1])]},X2=function(e,a){var r={value:0,done:!1},i=0,s=e.length,o={next:function(){return i<s?r.value=e[i++]:r.done=!0,r}};return YT(o,a)},Ws=function(e,a){var r={value:0,done:!1},i=0,s=e.length,o={next:function(){return i<s?r.value=e.charCodeAt(i++):r.done=!0,r}};return YT(o,a)},KT=function(){return T4(arguments)},T4=function(e){for(var a,r=0;r<e.length;r++){var i=e[r];r===0?a=Ws(i):a=Ws(i,a)}return a};function C4(t,e,a,r,i){var s=i*Math.PI/180,o=Math.cos(s)*(t-a)-Math.sin(s)*(e-r)+a,u=Math.sin(s)*(t-a)+Math.cos(s)*(e-r)+r;return{x:o,y:u}}var N4=function(e,a,r,i,s,o){return{x:(e-r)*s+r,y:(a-i)*o+i}};function j4(t,e,a){if(a===0)return t;var r=(e.x1+e.x2)/2,i=(e.y1+e.y2)/2,s=e.w/e.h,o=1/s,u=C4(t.x,t.y,r,i,a),d=N4(u.x,u.y,r,i,s,o);return{x:d.x,y:d.y}}var Z2=!0,A4=console.warn!=null,M4=console.trace!=null,U0=Number.MAX_SAFE_INTEGER||9007199254740991,$T=function(){return!0},Pf=function(){return!1},W2=function(){return 0},q0=function(){},Qt=function(e){throw new Error(e)},XT=function(e){if(e!==void 0)Z2=!!e;else return Z2},At=function(e){XT()&&(A4?console.warn(e):(console.log(e),M4&&console.trace()))},D4=function(e){return et({},e)},xn=function(e){return e==null?e:_t(e)?e.slice():wt(e)?D4(e):e},O4=function(e){return e.slice()},ZT=function(e,a){for(a=e="";e++<36;a+=e*51&52?(e^15?8^Math.random()*(e^20?16:4):4).toString(16):"-");return a},R4={},WT=function(){return R4},Fa=function(e){var a=Object.keys(e);return function(r){for(var i={},s=0;s<a.length;s++){var o=a[s],u=r==null?void 0:r[o];i[o]=u===void 0?e[o]:u}return i}},ts=function(e,a,r){for(var i=e.length-1;i>=0;i--)e[i]===a&&e.splice(i,1)},I0=function(e){e.splice(0,e.length)},k4=function(e,a){for(var r=0;r<a.length;r++){var i=a[r];e.push(i)}},gr=function(e,a,r){return r&&(a=UT(r,a)),e[a]},Fn=function(e,a,r,i){r&&(a=UT(r,a)),e[a]=i},B4=(function(){function t(){us(this,t),this._obj={}}return cs(t,[{key:"set",value:function(a,r){return this._obj[a]=r,this}},{key:"delete",value:function(a){return this._obj[a]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(a){return this._obj[a]!==void 0}},{key:"get",value:function(a){return this._obj[a]}}])})(),Kn=typeof Map<"u"?Map:B4,L4="undefined",z4=(function(){function t(e){if(us(this,t),this._obj=Object.create(null),this.size=0,e!=null){var a;e.instanceString!=null&&e.instanceString()===this.instanceString()?a=e.toArray():a=e;for(var r=0;r<a.length;r++)this.add(a[r])}}return cs(t,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(a){var r=this._obj;r[a]!==1&&(r[a]=1,this.size++)}},{key:"delete",value:function(a){var r=this._obj;r[a]===1&&(r[a]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(a){return this._obj[a]===1}},{key:"toArray",value:function(){var a=this;return Object.keys(this._obj).filter(function(r){return a.has(r)})}},{key:"forEach",value:function(a,r){return this.toArray().forEach(a,r)}}])})(),ko=(typeof Set>"u"?"undefined":Sa(Set))!==L4?Set:z4,rh=function(e,a){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||a===void 0||!z0(e)){Qt("An element must have a core reference and parameters set");return}var i=a.group;if(i==null&&(a.data&&a.data.source!=null&&a.data.target!=null?i="edges":i="nodes"),i!=="nodes"&&i!=="edges"){Qt("An element must be of type `nodes` or `edges`; you specified `"+i+"`");return}this.length=1,this[0]=this;var s=this._private={cy:e,single:!0,data:a.data||{},position:a.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:i,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!a.selected,selectable:a.selectable===void 0?!0:!!a.selectable,locked:!!a.locked,grabbed:!1,grabbable:a.grabbable===void 0?!0:!!a.grabbable,pannable:a.pannable===void 0?i==="edges":!!a.pannable,active:!1,classes:new ko,animation:{current:[],queue:[]},rscratch:{},scratch:a.scratch||{},edges:[],children:[],parent:a.parent&&a.parent.isNode()?a.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(s.position.x==null&&(s.position.x=0),s.position.y==null&&(s.position.y=0),a.renderedPosition){var o=a.renderedPosition,u=e.pan(),d=e.zoom();s.position={x:(o.x-u.x)/d,y:(o.y-u.y)/d}}var f=[];_t(a.classes)?f=a.classes:Xe(a.classes)&&(f=a.classes.split(/\s+/));for(var h=0,p=f.length;h<p;h++){var m=f[h];!m||m===""||s.classes.add(m)}this.createEmitter(),(r===void 0||r)&&this.restore();var y=a.style||a.css;y&&(At("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(y))},J2=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(r,i,s){var o;wt(r)&&!Mr(r)&&(o=r,r=o.roots||o.root,i=o.visit,s=o.directed),s=arguments.length===2&&!Zt(i)?i:s,i=Zt(i)?i:function(){};for(var u=this._private.cy,d=r=Xe(r)?this.filter(r):r,f=[],h=[],p={},m={},y={},x=0,E,S=this.byGroup(),T=S.nodes,C=S.edges,N=0;N<d.length;N++){var A=d[N],M=A.id();A.isNode()&&(f.unshift(A),e.bfs&&(y[M]=!0,h.push(A)),m[M]=0)}for(var D=function(){var q=e.bfs?f.shift():f.pop(),V=q.id();if(e.dfs){if(y[V])return 0;y[V]=!0,h.push(q)}var Q=m[V],P=p[V],U=P!=null?P.source():null,F=P!=null?P.target():null,K=P==null?void 0:q.same(U)?F[0]:U[0],J;if(J=i(q,P,K,x++,Q),J===!0)return E=q,1;if(J===!1)return 1;for(var k=q.connectedEdges().filter(function(ee){return(!s||ee.source().same(q))&&C.has(ee)}),G=0;G<k.length;G++){var X=k[G],W=X.connectedNodes().filter(function(ee){return!ee.same(q)&&T.has(ee)}),$=W.id();W.length!==0&&!y[$]&&(W=W[0],f.push(W),e.bfs&&(y[$]=!0,h.push(W)),p[$]=X,m[$]=m[V]+1)}},j;f.length!==0&&(j=D(),!(j!==0&&j===1)););for(var R=u.collection(),L=0;L<h.length;L++){var z=h[L],_=p[z.id()];_!=null&&R.push(_),R.push(z)}return{path:u.collection(R),found:u.collection(E)}}},Wu={breadthFirstSearch:J2({bfs:!0}),depthFirstSearch:J2({dfs:!0})};Wu.bfs=Wu.breadthFirstSearch;Wu.dfs=Wu.depthFirstSearch;var gf={exports:{}},P4=gf.exports,ew;function _4(){return ew||(ew=1,(function(t,e){(function(){var a,r,i,s,o,u,d,f,h,p,m,y,x,E,S;i=Math.floor,p=Math.min,r=function(T,C){return T<C?-1:T>C?1:0},h=function(T,C,N,A,M){var D;if(N==null&&(N=0),M==null&&(M=r),N<0)throw new Error("lo must be non-negative");for(A==null&&(A=T.length);N<A;)D=i((N+A)/2),M(C,T[D])<0?A=D:N=D+1;return[].splice.apply(T,[N,N-N].concat(C)),C},u=function(T,C,N){return N==null&&(N=r),T.push(C),E(T,0,T.length-1,N)},o=function(T,C){var N,A;return C==null&&(C=r),N=T.pop(),T.length?(A=T[0],T[0]=N,S(T,0,C)):A=N,A},f=function(T,C,N){var A;return N==null&&(N=r),A=T[0],T[0]=C,S(T,0,N),A},d=function(T,C,N){var A;return N==null&&(N=r),T.length&&N(T[0],C)<0&&(A=[T[0],C],C=A[0],T[0]=A[1],S(T,0,N)),C},s=function(T,C){var N,A,M,D,j,R;for(C==null&&(C=r),D=(function(){R=[];for(var L=0,z=i(T.length/2);0<=z?L<z:L>z;0<=z?L++:L--)R.push(L);return R}).apply(this).reverse(),j=[],A=0,M=D.length;A<M;A++)N=D[A],j.push(S(T,N,C));return j},x=function(T,C,N){var A;if(N==null&&(N=r),A=T.indexOf(C),A!==-1)return E(T,0,A,N),S(T,A,N)},m=function(T,C,N){var A,M,D,j,R;if(N==null&&(N=r),M=T.slice(0,C),!M.length)return M;for(s(M,N),R=T.slice(C),D=0,j=R.length;D<j;D++)A=R[D],d(M,A,N);return M.sort(N).reverse()},y=function(T,C,N){var A,M,D,j,R,L,z,_,B;if(N==null&&(N=r),C*10<=T.length){if(D=T.slice(0,C).sort(N),!D.length)return D;for(M=D[D.length-1],z=T.slice(C),j=0,L=z.length;j<L;j++)A=z[j],N(A,M)<0&&(h(D,A,0,null,N),D.pop(),M=D[D.length-1]);return D}for(s(T,N),B=[],R=0,_=p(C,T.length);0<=_?R<_:R>_;0<=_?++R:--R)B.push(o(T,N));return B},E=function(T,C,N,A){var M,D,j;for(A==null&&(A=r),M=T[N];N>C;){if(j=N-1>>1,D=T[j],A(M,D)<0){T[N]=D,N=j;continue}break}return T[N]=M},S=function(T,C,N){var A,M,D,j,R;for(N==null&&(N=r),M=T.length,R=C,D=T[C],A=2*C+1;A<M;)j=A+1,j<M&&!(N(T[A],T[j])<0)&&(A=j),T[C]=T[A],C=A,A=2*C+1;return T[C]=D,E(T,R,C,N)},a=(function(){T.push=u,T.pop=o,T.replace=f,T.pushpop=d,T.heapify=s,T.updateItem=x,T.nlargest=m,T.nsmallest=y;function T(C){this.cmp=C??r,this.nodes=[]}return T.prototype.push=function(C){return u(this.nodes,C,this.cmp)},T.prototype.pop=function(){return o(this.nodes,this.cmp)},T.prototype.peek=function(){return this.nodes[0]},T.prototype.contains=function(C){return this.nodes.indexOf(C)!==-1},T.prototype.replace=function(C){return f(this.nodes,C,this.cmp)},T.prototype.pushpop=function(C){return d(this.nodes,C,this.cmp)},T.prototype.heapify=function(){return s(this.nodes,this.cmp)},T.prototype.updateItem=function(C){return x(this.nodes,C,this.cmp)},T.prototype.clear=function(){return this.nodes=[]},T.prototype.empty=function(){return this.nodes.length===0},T.prototype.size=function(){return this.nodes.length},T.prototype.clone=function(){var C;return C=new T,C.nodes=this.nodes.slice(0),C},T.prototype.toArray=function(){return this.nodes.slice(0)},T.prototype.insert=T.prototype.push,T.prototype.top=T.prototype.peek,T.prototype.front=T.prototype.peek,T.prototype.has=T.prototype.contains,T.prototype.copy=T.prototype.clone,T})(),(function(T,C){return t.exports=C()})(this,function(){return a})}).call(P4)})(gf)),gf.exports}var ag,tw;function U4(){return tw||(tw=1,ag=_4()),ag}var q4=U4(),Nc=Sc(q4),I4=Fa({root:null,weight:function(e){return 1},directed:!1}),V4={dijkstra:function(e){if(!wt(e)){var a=arguments;e={root:a[0],weight:a[1],directed:a[2]}}var r=I4(e),i=r.root,s=r.weight,o=r.directed,u=this,d=s,f=Xe(i)?this.filter(i)[0]:i[0],h={},p={},m={},y=this.byGroup(),x=y.nodes,E=y.edges;E.unmergeBy(function(Q){return Q.isLoop()});for(var S=function(P){return h[P.id()]},T=function(P,U){h[P.id()]=U,C.updateItem(P)},C=new Nc(function(Q,P){return S(Q)-S(P)}),N=0;N<x.length;N++){var A=x[N];h[A.id()]=A.same(f)?0:1/0,C.push(A)}for(var M=function(P,U){for(var F=(o?P.edgesTo(U):P.edgesWith(U)).intersect(E),K=1/0,J,k=0;k<F.length;k++){var G=F[k],X=d(G);(X<K||!J)&&(K=X,J=G)}return{edge:J,dist:K}};C.size()>0;){var D=C.pop(),j=S(D),R=D.id();if(m[R]=j,j!==1/0)for(var L=D.neighborhood().intersect(x),z=0;z<L.length;z++){var _=L[z],B=_.id(),q=M(D,_),V=j+q.dist;V<S(_)&&(T(_,V),p[B]={node:D,edge:q.edge})}}return{distanceTo:function(P){var U=Xe(P)?x.filter(P)[0]:P[0];return m[U.id()]},pathTo:function(P){var U=Xe(P)?x.filter(P)[0]:P[0],F=[],K=U,J=K.id();if(U.length>0)for(F.unshift(U);p[J];){var k=p[J];F.unshift(k.edge),F.unshift(k.node),K=k.node,J=K.id()}return u.spawn(F)}}}},F4={kruskal:function(e){e=e||function(N){return 1};for(var a=this.byGroup(),r=a.nodes,i=a.edges,s=r.length,o=new Array(s),u=r,d=function(A){for(var M=0;M<o.length;M++){var D=o[M];if(D.has(A))return M}},f=0;f<s;f++)o[f]=this.spawn(r[f]);for(var h=i.sort(function(N,A){return e(N)-e(A)}),p=0;p<h.length;p++){var m=h[p],y=m.source()[0],x=m.target()[0],E=d(y),S=d(x),T=o[E],C=o[S];E!==S&&(u.merge(m),T.merge(C),o.splice(S,1))}return u}},H4=Fa({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),G4={aStar:function(e){var a=this.cy(),r=H4(e),i=r.root,s=r.goal,o=r.heuristic,u=r.directed,d=r.weight;i=a.collection(i)[0],s=a.collection(s)[0];var f=i.id(),h=s.id(),p={},m={},y={},x=new Nc(function(J,k){return m[J.id()]-m[k.id()]}),E=new ko,S={},T={},C=function(k,G){x.push(k),E.add(G)},N,A,M=function(){N=x.pop(),A=N.id(),E.delete(A)},D=function(k){return E.has(k)};C(i,f),p[f]=0,m[f]=o(i);for(var j=0;x.size()>0;){if(M(),j++,A===h){for(var R=[],L=s,z=h,_=T[z];R.unshift(L),_!=null&&R.unshift(_),L=S[z],L!=null;)z=L.id(),_=T[z];return{found:!0,distance:p[A],path:this.spawn(R),steps:j}}y[A]=!0;for(var B=N._private.edges,q=0;q<B.length;q++){var V=B[q];if(this.hasElementWithId(V.id())&&!(u&&V.data("source")!==A)){var Q=V.source(),P=V.target(),U=Q.id()!==A?Q:P,F=U.id();if(this.hasElementWithId(F)&&!y[F]){var K=p[A]+d(V);if(!D(F)){p[F]=K,m[F]=K+o(U),C(U,F),S[F]=N,T[F]=V;continue}K<p[F]&&(p[F]=K,m[F]=K+o(U),S[F]=N,T[F]=V)}}}}return{found:!1,distance:void 0,path:void 0,steps:j}}},Q4=Fa({weight:function(e){return 1},directed:!1}),Y4={floydWarshall:function(e){for(var a=this.cy(),r=Q4(e),i=r.weight,s=r.directed,o=i,u=this.byGroup(),d=u.nodes,f=u.edges,h=d.length,p=h*h,m=function(X){return d.indexOf(X)},y=function(X){return d[X]},x=new Array(p),E=0;E<p;E++){var S=E%h,T=(E-S)/h;T===S?x[E]=0:x[E]=1/0}for(var C=new Array(p),N=new Array(p),A=0;A<f.length;A++){var M=f[A],D=M.source()[0],j=M.target()[0];if(D!==j){var R=m(D),L=m(j),z=R*h+L,_=o(M);if(x[z]>_&&(x[z]=_,C[z]=L,N[z]=M),!s){var B=L*h+R;!s&&x[B]>_&&(x[B]=_,C[B]=R,N[B]=M)}}}for(var q=0;q<h;q++)for(var V=0;V<h;V++)for(var Q=V*h+q,P=0;P<h;P++){var U=V*h+P,F=q*h+P;x[Q]+x[F]<x[U]&&(x[U]=x[Q]+x[F],C[U]=C[Q])}var K=function(X){return(Xe(X)?a.filter(X):X)[0]},J=function(X){return m(K(X))},k={distance:function(X,W){var $=J(X),ee=J(W);return x[$*h+ee]},path:function(X,W){var $=J(X),ee=J(W),ie=y($);if($===ee)return ie.collection();if(C[$*h+ee]==null)return a.collection();var he=a.collection(),oe=$,ae;for(he.merge(ie);$!==ee;)oe=$,$=C[$*h+ee],ae=N[oe*h+$],he.merge(ae),he.merge(y($));return he}};return k}},K4=Fa({weight:function(e){return 1},directed:!1,root:null}),$4={bellmanFord:function(e){var a=this,r=K4(e),i=r.weight,s=r.directed,o=r.root,u=i,d=this,f=this.cy(),h=this.byGroup(),p=h.edges,m=h.nodes,y=m.length,x=new Kn,E=!1,S=[];o=f.collection(o)[0],p.unmergeBy(function(He){return He.isLoop()});for(var T=p.length,C=function(Se){var ke=x.get(Se.id());return ke||(ke={},x.set(Se.id(),ke)),ke},N=function(Se){return(Xe(Se)?f.$(Se):Se)[0]},A=function(Se){return C(N(Se)).dist},M=function(Se){for(var ke=arguments.length>1&&arguments[1]!==void 0?arguments[1]:o,De=N(Se),Be=[],Ge=De;;){if(Ge==null)return a.spawn();var Je=C(Ge),Re=Je.edge,nt=Je.pred;if(Be.unshift(Ge[0]),Ge.same(ke)&&Be.length>0)break;Re!=null&&Be.unshift(Re),Ge=nt}return d.spawn(Be)},D=0;D<y;D++){var j=m[D],R=C(j);j.same(o)?R.dist=0:R.dist=1/0,R.pred=null,R.edge=null}for(var L=!1,z=function(Se,ke,De,Be,Ge,Je){var Re=Be.dist+Je;Re<Ge.dist&&!De.same(Be.edge)&&(Ge.dist=Re,Ge.pred=Se,Ge.edge=De,L=!0)},_=1;_<y;_++){L=!1;for(var B=0;B<T;B++){var q=p[B],V=q.source(),Q=q.target(),P=u(q),U=C(V),F=C(Q);z(V,Q,q,U,F,P),s||z(Q,V,q,F,U,P)}if(!L)break}if(L)for(var K=[],J=0;J<T;J++){var k=p[J],G=k.source(),X=k.target(),W=u(k),$=C(G).dist,ee=C(X).dist;if($+W<ee||!s&&ee+W<$)if(E||(At("Graph contains a negative weight cycle for Bellman-Ford"),E=!0),e.findNegativeWeightCycles!==!1){var ie=[];$+W<ee&&ie.push(G),!s&&ee+W<$&&ie.push(X);for(var he=ie.length,oe=0;oe<he;oe++){var ae=ie[oe],re=[ae];re.push(C(ae).edge);for(var le=C(ae).pred;re.indexOf(le)===-1;)re.push(le),re.push(C(le).edge),le=C(le).pred;re=re.slice(re.indexOf(le));for(var se=re[0].id(),Ne=0,Ae=2;Ae<re.length;Ae+=2)re[Ae].id()<se&&(se=re[Ae].id(),Ne=Ae);re=re.slice(Ne).concat(re.slice(0,Ne)),re.push(re[0]);var We=re.map(function(He){return He.id()}).join(",");K.indexOf(We)===-1&&(S.push(d.spawn(re)),K.push(We))}}else break}return{distanceTo:A,pathTo:M,hasNegativeWeightCycle:E,negativeWeightCycles:S}}},X4=Math.sqrt(2),Z4=function(e,a,r){r.length===0&&Qt("Karger-Stein must be run on a connected (sub)graph");for(var i=r[e],s=i[1],o=i[2],u=a[s],d=a[o],f=r,h=f.length-1;h>=0;h--){var p=f[h],m=p[1],y=p[2];(a[m]===u&&a[y]===d||a[m]===d&&a[y]===u)&&f.splice(h,1)}for(var x=0;x<f.length;x++){var E=f[x];E[1]===d?(f[x]=E.slice(),f[x][1]=u):E[2]===d&&(f[x]=E.slice(),f[x][2]=u)}for(var S=0;S<a.length;S++)a[S]===d&&(a[S]=u);return f},rg=function(e,a,r,i){for(;r>i;){var s=Math.floor(Math.random()*a.length);a=Z4(s,e,a),r--}return a},W4={kargerStein:function(){var e=this,a=this.byGroup(),r=a.nodes,i=a.edges;i.unmergeBy(function(F){return F.isLoop()});var s=r.length,o=i.length,u=Math.ceil(Math.pow(Math.log(s)/Math.LN2,2)),d=Math.floor(s/X4);if(s<2){Qt("At least 2 nodes are required for Karger-Stein algorithm");return}for(var f=[],h=0;h<o;h++){var p=i[h];f.push([h,r.indexOf(p.source()),r.indexOf(p.target())])}for(var m=1/0,y=[],x=new Array(s),E=new Array(s),S=new Array(s),T=function(K,J){for(var k=0;k<s;k++)J[k]=K[k]},C=0;C<=u;C++){for(var N=0;N<s;N++)E[N]=N;var A=rg(E,f.slice(),s,d),M=A.slice();T(E,S);var D=rg(E,A,d,2),j=rg(S,M,d,2);D.length<=j.length&&D.length<m?(m=D.length,y=D,T(E,x)):j.length<=D.length&&j.length<m&&(m=j.length,y=j,T(S,x))}for(var R=this.spawn(y.map(function(F){return i[F[0]]})),L=this.spawn(),z=this.spawn(),_=x[0],B=0;B<x.length;B++){var q=x[B],V=r[B];q===_?L.merge(V):z.merge(V)}var Q=function(K){var J=e.spawn();return K.forEach(function(k){J.merge(k),k.connectedEdges().forEach(function(G){e.contains(G)&&!R.contains(G)&&J.merge(G)})}),J},P=[Q(L),Q(z)],U={cut:R,components:P,partition1:L,partition2:z};return U}},ng,J4=function(e){return{x:e.x,y:e.y}},nh=function(e,a,r){return{x:e.x*a+r.x,y:e.y*a+r.y}},JT=function(e,a,r){return{x:(e.x-r.x)/a,y:(e.y-r.y)/a}},eo=function(e){return{x:e[0],y:e[1]}},eR=function(e){for(var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,i=1/0,s=a;s<r;s++){var o=e[s];isFinite(o)&&(i=Math.min(o,i))}return i},tR=function(e){for(var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,i=-1/0,s=a;s<r;s++){var o=e[s];isFinite(o)&&(i=Math.max(o,i))}return i},aR=function(e){for(var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,i=0,s=0,o=a;o<r;o++){var u=e[o];isFinite(u)&&(i+=u,s++)}return i/s},rR=function(e){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;i?e=e.slice(a,r):(r<e.length&&e.splice(r,e.length-r),a>0&&e.splice(0,a));for(var u=0,d=e.length-1;d>=0;d--){var f=e[d];o?isFinite(f)||(e[d]=-1/0,u++):e.splice(d,1)}s&&e.sort(function(m,y){return m-y});var h=e.length,p=Math.floor(h/2);return h%2!==0?e[p+1+u]:(e[p-1+u]+e[p+u])/2},nR=function(e){return Math.PI*e/180},Jd=function(e,a){return Math.atan2(a,e)-Math.PI/2},V0=Math.log2||function(t){return Math.log(t)/Math.log(2)},F0=function(e){return e>0?1:e<0?-1:0},Js=function(e,a){return Math.sqrt(ks(e,a))},ks=function(e,a){var r=a.x-e.x,i=a.y-e.y;return r*r+i*i},iR=function(e){for(var a=e.length,r=0,i=0;i<a;i++)r+=e[i];for(var s=0;s<a;s++)e[s]=e[s]/r;return e},Oa=function(e,a,r,i){return(1-i)*(1-i)*e+2*(1-i)*i*a+i*i*r},io=function(e,a,r,i){return{x:Oa(e.x,a.x,r.x,i),y:Oa(e.y,a.y,r.y,i)}},sR=function(e,a,r,i){var s={x:a.x-e.x,y:a.y-e.y},o=Js(e,a),u={x:s.x/o,y:s.y/o};return r=r??0,i=i??r*o,{x:e.x+u.x*i,y:e.y+u.y*i}},Ju=function(e,a,r){return Math.max(e,Math.min(r,a))},nr=function(e){if(e==null)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(e.x1!=null&&e.y1!=null){if(e.x2!=null&&e.y2!=null&&e.x2>=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(e.w!=null&&e.h!=null&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},lR=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},oR=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},uR=function(e,a){e.x1=Math.min(e.x1,a.x1),e.x2=Math.max(e.x2,a.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,a.y1),e.y2=Math.max(e.y2,a.y2),e.h=e.y2-e.y1},eC=function(e,a,r){e.x1=Math.min(e.x1,a),e.x2=Math.max(e.x2,a),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,r),e.y2=Math.max(e.y2,r),e.h=e.y2-e.y1},mf=function(e){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.x1-=a,e.x2+=a,e.y1-=a,e.y2+=a,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},yf=function(e){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],r,i,s,o;if(a.length===1)r=i=s=o=a[0];else if(a.length===2)r=s=a[0],o=i=a[1];else if(a.length===4){var u=ma(a,4);r=u[0],i=u[1],s=u[2],o=u[3]}return e.x1-=o,e.x2+=i,e.y1-=r,e.y2+=s,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},aw=function(e,a){e.x1=a.x1,e.y1=a.y1,e.x2=a.x2,e.y2=a.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},H0=function(e,a){return!(e.x1>a.x2||a.x1>e.x2||e.x2<a.x1||a.x2<e.x1||e.y2<a.y1||a.y2<e.y1||e.y1>a.y2||a.y1>e.y2)},Yi=function(e,a,r){return e.x1<=a&&a<=e.x2&&e.y1<=r&&r<=e.y2},rw=function(e,a){return Yi(e,a.x,a.y)},tC=function(e,a){return Yi(e,a.x1,a.y1)&&Yi(e,a.x2,a.y2)},cR=(ng=Math.hypot)!==null&&ng!==void 0?ng:function(t,e){return Math.sqrt(t*t+e*e)};function dR(t,e){if(t.length<3)throw new Error("Need at least 3 vertices");var a=function(R,L){return{x:R.x+L.x,y:R.y+L.y}},r=function(R,L){return{x:R.x-L.x,y:R.y-L.y}},i=function(R,L){return{x:R.x*L,y:R.y*L}},s=function(R,L){return R.x*L.y-R.y*L.x},o=function(R){var L=cR(R.x,R.y);return L===0?{x:0,y:0}:{x:R.x/L,y:R.y/L}},u=function(R){for(var L=0,z=0;z<R.length;z++){var _=R[z],B=R[(z+1)%R.length];L+=_.x*B.y-B.x*_.y}return L/2},d=function(R,L,z,_){var B=r(L,R),q=r(_,z),V=s(B,q);if(Math.abs(V)<1e-9)return a(R,i(B,.5));var Q=s(r(z,R),q)/V;return a(R,i(B,Q))},f=t.map(function(j){return{x:j.x,y:j.y}});u(f)<0&&f.reverse();for(var h=f.length,p=[],m=0;m<h;m++){var y=f[m],x=f[(m+1)%h],E=r(x,y),S=o({x:E.y,y:-E.x});p.push(S)}for(var T=p.map(function(j,R){var L=a(f[R],i(j,e)),z=a(f[(R+1)%h],i(j,e));return{p1:L,p2:z}}),C=[],N=0;N<h;N++){var A=T[(N-1+h)%h],M=T[N],D=d(A.p1,A.p2,M.p1,M.p2);C.push(D)}return C}function fR(t,e,a,r,i,s){var o=wR(t,e,a,r,i),u=dR(o,s),d=nr();return u.forEach(function(f){return eC(d,f.x,f.y)}),d}var aC=function(e,a,r,i,s,o,u){var d=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",f=d==="auto"?as(s,o):d,h=s/2,p=o/2;f=Math.min(f,h,p);var m=f!==h,y=f!==p,x;if(m){var E=r-h+f-u,S=i-p-u,T=r+h-f+u,C=S;if(x=Ki(e,a,r,i,E,S,T,C,!1),x.length>0)return x}if(y){var N=r+h+u,A=i-p+f-u,M=N,D=i+p-f+u;if(x=Ki(e,a,r,i,N,A,M,D,!1),x.length>0)return x}if(m){var j=r-h+f-u,R=i+p+u,L=r+h-f+u,z=R;if(x=Ki(e,a,r,i,j,R,L,z,!1),x.length>0)return x}if(y){var _=r-h-u,B=i-p+f-u,q=_,V=i+p-f+u;if(x=Ki(e,a,r,i,_,B,q,V,!1),x.length>0)return x}var Q;{var P=r-h+f,U=i-p+f;if(Q=Uu(e,a,r,i,P,U,f+u),Q.length>0&&Q[0]<=P&&Q[1]<=U)return[Q[0],Q[1]]}{var F=r+h-f,K=i-p+f;if(Q=Uu(e,a,r,i,F,K,f+u),Q.length>0&&Q[0]>=F&&Q[1]<=K)return[Q[0],Q[1]]}{var J=r+h-f,k=i+p-f;if(Q=Uu(e,a,r,i,J,k,f+u),Q.length>0&&Q[0]>=J&&Q[1]>=k)return[Q[0],Q[1]]}{var G=r-h+f,X=i+p-f;if(Q=Uu(e,a,r,i,G,X,f+u),Q.length>0&&Q[0]<=G&&Q[1]>=X)return[Q[0],Q[1]]}return[]},hR=function(e,a,r,i,s,o,u){var d=u,f=Math.min(r,s),h=Math.max(r,s),p=Math.min(i,o),m=Math.max(i,o);return f-d<=e&&e<=h+d&&p-d<=a&&a<=m+d},vR=function(e,a,r,i,s,o,u,d,f){var h={x1:Math.min(r,u,s)-f,x2:Math.max(r,u,s)+f,y1:Math.min(i,d,o)-f,y2:Math.max(i,d,o)+f};return!(e<h.x1||e>h.x2||a<h.y1||a>h.y2)},pR=function(e,a,r,i){r-=i;var s=a*a-4*e*r;if(s<0)return[];var o=Math.sqrt(s),u=2*e,d=(-a+o)/u,f=(-a-o)/u;return[d,f]},gR=function(e,a,r,i,s){var o=1e-5;e===0&&(e=o),a/=e,r/=e,i/=e;var u,d,f,h,p,m,y,x;if(d=(3*r-a*a)/9,f=-(27*i)+a*(9*r-2*(a*a)),f/=54,u=d*d*d+f*f,s[1]=0,y=a/3,u>0){p=f+Math.sqrt(u),p=p<0?-Math.pow(-p,1/3):Math.pow(p,1/3),m=f-Math.sqrt(u),m=m<0?-Math.pow(-m,1/3):Math.pow(m,1/3),s[0]=-y+p+m,y+=(p+m)/2,s[4]=s[2]=-y,y=Math.sqrt(3)*(-m+p)/2,s[3]=y,s[5]=-y;return}if(s[5]=s[3]=0,u===0){x=f<0?-Math.pow(-f,1/3):Math.pow(f,1/3),s[0]=-y+2*x,s[4]=s[2]=-(x+y);return}d=-d,h=d*d*d,h=Math.acos(f/Math.sqrt(h)),x=2*Math.sqrt(d),s[0]=-y+x*Math.cos(h/3),s[2]=-y+x*Math.cos((h+2*Math.PI)/3),s[4]=-y+x*Math.cos((h+4*Math.PI)/3)},mR=function(e,a,r,i,s,o,u,d){var f=1*r*r-4*r*s+2*r*u+4*s*s-4*s*u+u*u+i*i-4*i*o+2*i*d+4*o*o-4*o*d+d*d,h=9*r*s-3*r*r-3*r*u-6*s*s+3*s*u+9*i*o-3*i*i-3*i*d-6*o*o+3*o*d,p=3*r*r-6*r*s+r*u-r*e+2*s*s+2*s*e-u*e+3*i*i-6*i*o+i*d-i*a+2*o*o+2*o*a-d*a,m=1*r*s-r*r+r*e-s*e+i*o-i*i+i*a-o*a,y=[];gR(f,h,p,m,y);for(var x=1e-7,E=[],S=0;S<6;S+=2)Math.abs(y[S+1])<x&&y[S]>=0&&y[S]<=1&&E.push(y[S]);E.push(1),E.push(0);for(var T=-1,C,N,A,M=0;M<E.length;M++)C=Math.pow(1-E[M],2)*r+2*(1-E[M])*E[M]*s+E[M]*E[M]*u,N=Math.pow(1-E[M],2)*i+2*(1-E[M])*E[M]*o+E[M]*E[M]*d,A=Math.pow(C-e,2)+Math.pow(N-a,2),T>=0?A<T&&(T=A):T=A;return T},yR=function(e,a,r,i,s,o){var u=[e-r,a-i],d=[s-r,o-i],f=d[0]*d[0]+d[1]*d[1],h=u[0]*u[0]+u[1]*u[1],p=u[0]*d[0]+u[1]*d[1],m=p*p/f;return p<0?h:m>f?(e-s)*(e-s)+(a-o)*(a-o):h-m},mr=function(e,a,r){for(var i,s,o,u,d,f=0,h=0;h<r.length/2;h++)if(i=r[h*2],s=r[h*2+1],h+1<r.length/2?(o=r[(h+1)*2],u=r[(h+1)*2+1]):(o=r[(h+1-r.length/2)*2],u=r[(h+1-r.length/2)*2+1]),!(i==e&&o==e))if(i>=e&&e>=o||i<=e&&e<=o)d=(e-i)/(o-i)*(u-s)+s,d>a&&f++;else continue;return f%2!==0},Wn=function(e,a,r,i,s,o,u,d,f){var h=new Array(r.length),p;d[0]!=null?(p=Math.atan(d[1]/d[0]),d[0]<0?p=p+Math.PI/2:p=-p-Math.PI/2):p=d;for(var m=Math.cos(-p),y=Math.sin(-p),x=0;x<h.length/2;x++)h[x*2]=o/2*(r[x*2]*m-r[x*2+1]*y),h[x*2+1]=u/2*(r[x*2+1]*m+r[x*2]*y),h[x*2]+=i,h[x*2+1]+=s;var E;if(f>0){var S=Uf(h,-f);E=_f(S)}else E=h;return mr(e,a,E)},xR=function(e,a,r,i,s,o,u,d){for(var f=new Array(r.length*2),h=0;h<d.length;h++){var p=d[h];f[h*4+0]=p.startX,f[h*4+1]=p.startY,f[h*4+2]=p.stopX,f[h*4+3]=p.stopY;var m=Math.pow(p.cx-e,2)+Math.pow(p.cy-a,2);if(m<=Math.pow(p.radius,2))return!0}return mr(e,a,f)},_f=function(e){for(var a=new Array(e.length/2),r,i,s,o,u,d,f,h,p=0;p<e.length/4;p++){r=e[p*4],i=e[p*4+1],s=e[p*4+2],o=e[p*4+3],p<e.length/4-1?(u=e[(p+1)*4],d=e[(p+1)*4+1],f=e[(p+1)*4+2],h=e[(p+1)*4+3]):(u=e[0],d=e[1],f=e[2],h=e[3]);var m=Ki(r,i,s,o,u,d,f,h,!0);a[p*2]=m[0],a[p*2+1]=m[1]}return a},Uf=function(e,a){for(var r=new Array(e.length*2),i,s,o,u,d=0;d<e.length/2;d++){i=e[d*2],s=e[d*2+1],d<e.length/2-1?(o=e[(d+1)*2],u=e[(d+1)*2+1]):(o=e[0],u=e[1]);var f=u-s,h=-(o-i),p=Math.sqrt(f*f+h*h),m=f/p,y=h/p;r[d*4]=i+m*a,r[d*4+1]=s+y*a,r[d*4+2]=o+m*a,r[d*4+3]=u+y*a}return r},bR=function(e,a,r,i,s,o){var u=r-e,d=i-a;u/=s,d/=o;var f=Math.sqrt(u*u+d*d),h=f-1;if(h<0)return[];var p=h/f;return[(r-e)*p+e,(i-a)*p+a]},Us=function(e,a,r,i,s,o,u){return e-=s,a-=o,e/=r/2+u,a/=i/2+u,e*e+a*a<=1},Uu=function(e,a,r,i,s,o,u){var d=[r-e,i-a],f=[e-s,a-o],h=d[0]*d[0]+d[1]*d[1],p=2*(f[0]*d[0]+f[1]*d[1]),m=f[0]*f[0]+f[1]*f[1]-u*u,y=p*p-4*h*m;if(y<0)return[];var x=(-p+Math.sqrt(y))/(2*h),E=(-p-Math.sqrt(y))/(2*h),S=Math.min(x,E),T=Math.max(x,E),C=[];if(S>=0&&S<=1&&C.push(S),T>=0&&T<=1&&C.push(T),C.length===0)return[];var N=C[0]*d[0]+e,A=C[0]*d[1]+a;if(C.length>1){if(C[0]==C[1])return[N,A];var M=C[1]*d[0]+e,D=C[1]*d[1]+a;return[N,A,M,D]}else return[N,A]},ig=function(e,a,r){return a<=e&&e<=r||r<=e&&e<=a?e:e<=a&&a<=r||r<=a&&a<=e?a:r},Ki=function(e,a,r,i,s,o,u,d,f){var h=e-s,p=r-e,m=u-s,y=a-o,x=i-a,E=d-o,S=m*y-E*h,T=p*y-x*h,C=E*p-m*x;if(C!==0){var N=S/C,A=T/C,M=.001,D=0-M,j=1+M;return D<=N&&N<=j&&D<=A&&A<=j?[e+N*p,a+N*x]:f?[e+N*p,a+N*x]:[]}else return S===0||T===0?ig(e,r,u)===u?[u,d]:ig(e,r,s)===s?[s,o]:ig(s,u,r)===r?[r,i]:[]:[]},wR=function(e,a,r,i,s){var o=[],u=i/2,d=s/2,f=a,h=r;o.push({x:f+u*e[0],y:h+d*e[1]});for(var p=1;p<e.length/2;p++)o.push({x:f+u*e[p*2],y:h+d*e[p*2+1]});return o},ec=function(e,a,r,i,s,o,u,d){var f=[],h,p=new Array(r.length),m=!0;o==null&&(m=!1);var y;if(m){for(var x=0;x<p.length/2;x++)p[x*2]=r[x*2]*o+i,p[x*2+1]=r[x*2+1]*u+s;if(d>0){var E=Uf(p,-d);y=_f(E)}else y=p}else y=r;for(var S,T,C,N,A=0;A<y.length/2;A++)S=y[A*2],T=y[A*2+1],A<y.length/2-1?(C=y[(A+1)*2],N=y[(A+1)*2+1]):(C=y[0],N=y[1]),h=Ki(e,a,i,s,S,T,C,N),h.length!==0&&f.push(h[0],h[1]);return f},SR=function(e,a,r,i,s,o,u,d,f){var h=[],p,m=new Array(r.length*2);f.forEach(function(C,N){N===0?(m[m.length-2]=C.startX,m[m.length-1]=C.startY):(m[N*4-2]=C.startX,m[N*4-1]=C.startY),m[N*4]=C.stopX,m[N*4+1]=C.stopY,p=Uu(e,a,i,s,C.cx,C.cy,C.radius),p.length!==0&&h.push(p[0],p[1])});for(var y=0;y<m.length/4;y++)p=Ki(e,a,i,s,m[y*4],m[y*4+1],m[y*4+2],m[y*4+3],!1),p.length!==0&&h.push(p[0],p[1]);if(h.length>2){for(var x=[h[0],h[1]],E=Math.pow(x[0]-e,2)+Math.pow(x[1]-a,2),S=1;S<h.length/2;S++){var T=Math.pow(h[S*2]-e,2)+Math.pow(h[S*2+1]-a,2);T<=E&&(x[0]=h[S*2],x[1]=h[S*2+1],E=T)}return x}return h},ef=function(e,a,r){var i=[e[0]-a[0],e[1]-a[1]],s=Math.sqrt(i[0]*i[0]+i[1]*i[1]),o=(s-r)/s;return o<0&&(o=1e-5),[a[0]+o*i[0],a[1]+o*i[1]]},ar=function(e,a){var r=Ym(e,a);return r=rC(r),r},rC=function(e){for(var a,r,i=e.length/2,s=1/0,o=1/0,u=-1/0,d=-1/0,f=0;f<i;f++)a=e[2*f],r=e[2*f+1],s=Math.min(s,a),u=Math.max(u,a),o=Math.min(o,r),d=Math.max(d,r);for(var h=2/(u-s),p=2/(d-o),m=0;m<i;m++)a=e[2*m]=e[2*m]*h,r=e[2*m+1]=e[2*m+1]*p,s=Math.min(s,a),u=Math.max(u,a),o=Math.min(o,r),d=Math.max(d,r);if(o<-1)for(var y=0;y<i;y++)r=e[2*y+1]=e[2*y+1]+(-1-o);return e},Ym=function(e,a){var r=1/e*2*Math.PI,i=e%2===0?Math.PI/2+r/2:Math.PI/2;i+=a;for(var s=new Array(e*2),o,u=0;u<e;u++)o=u*r+i,s[2*u]=Math.cos(o),s[2*u+1]=Math.sin(-o);return s},as=function(e,a){return Math.min(e/4,a/4,8)},nC=function(e,a){return Math.min(e/10,a/10,8)},G0=function(){return 8},ER=function(e,a,r){return[e-2*a+r,2*(a-e),e]},Km=function(e,a){return{heightOffset:Math.min(15,.05*a),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}};function sg(t,e){function a(p){for(var m=[],y=0;y<p.length;y++){var x=p[y],E=p[(y+1)%p.length],S={x:E.x-x.x,y:E.y-x.y},T={x:-S.y,y:S.x},C=Math.sqrt(T.x*T.x+T.y*T.y);m.push({x:T.x/C,y:T.y/C})}return m}function r(p,m){var y=1/0,x=-1/0,E=yr(p),S;try{for(E.s();!(S=E.n()).done;){var T=S.value,C=T.x*m.x+T.y*m.y;y=Math.min(y,C),x=Math.max(x,C)}}catch(N){E.e(N)}finally{E.f()}return{min:y,max:x}}function i(p,m){return!(p.max<m.min||m.max<p.min)}var s=[].concat(Bf(a(t)),Bf(a(e))),o=yr(s),u;try{for(o.s();!(u=o.n()).done;){var d=u.value,f=r(t,d),h=r(e,d);if(!i(f,h))return!1}}catch(p){o.e(p)}finally{o.f()}return!0}var TR=Fa({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),CR={pageRank:function(e){for(var a=TR(e),r=a.dampingFactor,i=a.precision,s=a.iterations,o=a.weight,u=this._private.cy,d=this.byGroup(),f=d.nodes,h=d.edges,p=f.length,m=p*p,y=h.length,x=new Array(m),E=new Array(p),S=(1-r)/p,T=0;T<p;T++){for(var C=0;C<p;C++){var N=T*p+C;x[N]=0}E[T]=0}for(var A=0;A<y;A++){var M=h[A],D=M.data("source"),j=M.data("target");if(D!==j){var R=f.indexOfId(D),L=f.indexOfId(j),z=o(M),_=L*p+R;x[_]+=z,E[R]+=z}}for(var B=1/p+S,q=0;q<p;q++)if(E[q]===0)for(var V=0;V<p;V++){var Q=V*p+q;x[Q]=B}else for(var P=0;P<p;P++){var U=P*p+q;x[U]=x[U]/E[q]+S}for(var F=new Array(p),K=new Array(p),J,k=0;k<p;k++)F[k]=1;for(var G=0;G<s;G++){for(var X=0;X<p;X++)K[X]=0;for(var W=0;W<p;W++)for(var $=0;$<p;$++){var ee=W*p+$;K[W]+=x[ee]*F[$]}iR(K),J=F,F=K,K=J;for(var ie=0,he=0;he<p;he++){var oe=J[he]-F[he];ie+=oe*oe}if(ie<i)break}var ae={rank:function(le){return le=u.collection(le)[0],F[f.indexOf(le)]}};return ae}},nw=Fa({root:null,weight:function(e){return 1},directed:!1,alpha:0}),so={degreeCentralityNormalized:function(e){e=nw(e);var a=this.cy(),r=this.nodes(),i=r.length;if(e.directed){for(var h={},p={},m=0,y=0,x=0;x<i;x++){var E=r[x],S=E.id();e.root=E;var T=this.degreeCentrality(e);m<T.indegree&&(m=T.indegree),y<T.outdegree&&(y=T.outdegree),h[S]=T.indegree,p[S]=T.outdegree}return{indegree:function(N){return m==0?0:(Xe(N)&&(N=a.filter(N)),h[N.id()]/m)},outdegree:function(N){return y===0?0:(Xe(N)&&(N=a.filter(N)),p[N.id()]/y)}}}else{for(var s={},o=0,u=0;u<i;u++){var d=r[u];e.root=d;var f=this.degreeCentrality(e);o<f.degree&&(o=f.degree),s[d.id()]=f.degree}return{degree:function(N){return o===0?0:(Xe(N)&&(N=a.filter(N)),s[N.id()]/o)}}}},degreeCentrality:function(e){e=nw(e);var a=this.cy(),r=this,i=e,s=i.root,o=i.weight,u=i.directed,d=i.alpha;if(s=a.collection(s)[0],u){for(var y=s.connectedEdges(),x=y.filter(function(D){return D.target().same(s)&&r.has(D)}),E=y.filter(function(D){return D.source().same(s)&&r.has(D)}),S=x.length,T=E.length,C=0,N=0,A=0;A<x.length;A++)C+=o(x[A]);for(var M=0;M<E.length;M++)N+=o(E[M]);return{indegree:Math.pow(S,1-d)*Math.pow(C,d),outdegree:Math.pow(T,1-d)*Math.pow(N,d)}}else{for(var f=s.connectedEdges().intersection(r),h=f.length,p=0,m=0;m<f.length;m++)p+=o(f[m]);return{degree:Math.pow(h,1-d)*Math.pow(p,d)}}}};so.dc=so.degreeCentrality;so.dcn=so.degreeCentralityNormalised=so.degreeCentralityNormalized;var iw=Fa({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),lo={closenessCentralityNormalized:function(e){for(var a=iw(e),r=a.harmonic,i=a.weight,s=a.directed,o=this.cy(),u={},d=0,f=this.nodes(),h=this.floydWarshall({weight:i,directed:s}),p=0;p<f.length;p++){for(var m=0,y=f[p],x=0;x<f.length;x++)if(p!==x){var E=h.distance(y,f[x]);r?m+=1/E:m+=E}r||(m=1/m),d<m&&(d=m),u[y.id()]=m}return{closeness:function(T){return d==0?0:(Xe(T)?T=o.filter(T)[0].id():T=T.id(),u[T]/d)}}},closenessCentrality:function(e){var a=iw(e),r=a.root,i=a.weight,s=a.directed,o=a.harmonic;r=this.filter(r)[0];for(var u=this.dijkstra({root:r,weight:i,directed:s}),d=0,f=this.nodes(),h=0;h<f.length;h++){var p=f[h];if(!p.same(r)){var m=u.distanceTo(p);o?d+=1/m:d+=m}}return o?d:1/d}};lo.cc=lo.closenessCentrality;lo.ccn=lo.closenessCentralityNormalised=lo.closenessCentralityNormalized;var NR=Fa({weight:null,directed:!1}),$m={betweennessCentrality:function(e){for(var a=NR(e),r=a.directed,i=a.weight,s=i!=null,o=this.cy(),u=this.nodes(),d={},f={},h=0,p={set:function(N,A){f[N]=A,A>h&&(h=A)},get:function(N){return f[N]}},m=0;m<u.length;m++){var y=u[m],x=y.id();r?d[x]=y.outgoers().nodes():d[x]=y.openNeighborhood().nodes(),p.set(x,0)}for(var E=function(){for(var N=u[S].id(),A=[],M={},D={},j={},R=new Nc(function(W,$){return j[W]-j[$]}),L=0;L<u.length;L++){var z=u[L].id();M[z]=[],D[z]=0,j[z]=1/0}for(D[N]=1,j[N]=0,R.push(N);!R.empty();){var _=R.pop();if(A.push(_),s)for(var B=0;B<d[_].length;B++){var q=d[_][B],V=o.getElementById(_),Q=void 0;V.edgesTo(q).length>0?Q=V.edgesTo(q)[0]:Q=q.edgesTo(V)[0];var P=i(Q);q=q.id(),j[q]>j[_]+P&&(j[q]=j[_]+P,R.nodes.indexOf(q)<0?R.push(q):R.updateItem(q),D[q]=0,M[q]=[]),j[q]==j[_]+P&&(D[q]=D[q]+D[_],M[q].push(_))}else for(var U=0;U<d[_].length;U++){var F=d[_][U].id();j[F]==1/0&&(R.push(F),j[F]=j[_]+1),j[F]==j[_]+1&&(D[F]=D[F]+D[_],M[F].push(_))}}for(var K={},J=0;J<u.length;J++)K[u[J].id()]=0;for(;A.length>0;){for(var k=A.pop(),G=0;G<M[k].length;G++){var X=M[k][G];K[X]=K[X]+D[X]/D[k]*(1+K[k])}k!=u[S].id()&&p.set(k,p.get(k)+K[k])}},S=0;S<u.length;S++)E();var T={betweenness:function(N){var A=o.collection(N).id();return p.get(A)},betweennessNormalized:function(N){if(h==0)return 0;var A=o.collection(N).id();return p.get(A)/h}};return T.betweennessNormalised=T.betweennessNormalized,T}};$m.bc=$m.betweennessCentrality;var jR=Fa({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(t){return 1}]}),AR=function(e){return jR(e)},MR=function(e,a){for(var r=0,i=0;i<a.length;i++)r+=a[i](e);return r},DR=function(e,a,r){for(var i=0;i<a;i++)e[i*a+i]=r},iC=function(e,a){for(var r,i=0;i<a;i++){r=0;for(var s=0;s<a;s++)r+=e[s*a+i];for(var o=0;o<a;o++)e[o*a+i]=e[o*a+i]/r}},OR=function(e,a,r){for(var i=new Array(r*r),s=0;s<r;s++){for(var o=0;o<r;o++)i[s*r+o]=0;for(var u=0;u<r;u++)for(var d=0;d<r;d++)i[s*r+d]+=e[s*r+u]*a[u*r+d]}return i},RR=function(e,a,r){for(var i=e.slice(0),s=1;s<r;s++)e=OR(e,i,a);return e},kR=function(e,a,r){for(var i=new Array(a*a),s=0;s<a*a;s++)i[s]=Math.pow(e[s],r);return iC(i,a),i},BR=function(e,a,r,i){for(var s=0;s<r;s++){var o=Math.round(e[s]*Math.pow(10,i))/Math.pow(10,i),u=Math.round(a[s]*Math.pow(10,i))/Math.pow(10,i);if(o!==u)return!1}return!0},LR=function(e,a,r,i){for(var s=[],o=0;o<a;o++){for(var u=[],d=0;d<a;d++)Math.round(e[o*a+d]*1e3)/1e3>0&&u.push(r[d]);u.length!==0&&s.push(i.collection(u))}return s},zR=function(e,a){for(var r=0;r<e.length;r++)if(!a[r]||e[r].id()!==a[r].id())return!1;return!0},PR=function(e){for(var a=0;a<e.length;a++)for(var r=0;r<e.length;r++)a!=r&&zR(e[a],e[r])&&e.splice(r,1);return e},sw=function(e){for(var a=this.nodes(),r=this.edges(),i=this.cy(),s=AR(e),o={},u=0;u<a.length;u++)o[a[u].id()]=u;for(var d=a.length,f=d*d,h=new Array(f),p,m=0;m<f;m++)h[m]=0;for(var y=0;y<r.length;y++){var x=r[y],E=o[x.source().id()],S=o[x.target().id()],T=MR(x,s.attributes);h[E*d+S]+=T,h[S*d+E]+=T}DR(h,d,s.multFactor),iC(h,d);for(var C=!0,N=0;C&&N<s.maxIterations;)C=!1,p=RR(h,d,s.expandFactor),h=kR(p,d,s.inflateFactor),BR(h,p,f,4)||(C=!0),N++;var A=LR(h,d,a,i);return A=PR(A),A},_R={markovClustering:sw,mcl:sw},UR=function(e){return e},sC=function(e,a){return Math.abs(a-e)},lw=function(e,a,r){return e+sC(a,r)},ow=function(e,a,r){return e+Math.pow(r-a,2)},qR=function(e){return Math.sqrt(e)},IR=function(e,a,r){return Math.max(e,sC(a,r))},Ou=function(e,a,r,i,s){for(var o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:UR,u=i,d,f,h=0;h<e;h++)d=a(h),f=r(h),u=s(u,d,f);return o(u)},Ao={euclidean:function(e,a,r){return e>=2?Ou(e,a,r,0,ow,qR):Ou(e,a,r,0,lw)},squaredEuclidean:function(e,a,r){return Ou(e,a,r,0,ow)},manhattan:function(e,a,r){return Ou(e,a,r,0,lw)},max:function(e,a,r){return Ou(e,a,r,-1/0,IR)}};Ao["squared-euclidean"]=Ao.squaredEuclidean;Ao.squaredeuclidean=Ao.squaredEuclidean;function ih(t,e,a,r,i,s){var o;return Zt(t)?o=t:o=Ao[t]||Ao.euclidean,e===0&&Zt(t)?o(i,s):o(e,a,r,i,s)}var VR=Fa({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),Q0=function(e){return VR(e)},qf=function(e,a,r,i,s){var o=s!=="kMedoids",u=o?function(p){return r[p]}:function(p){return i[p](r)},d=function(m){return i[m](a)},f=r,h=a;return ih(e,i.length,u,d,f,h)},lg=function(e,a,r){for(var i=r.length,s=new Array(i),o=new Array(i),u=new Array(a),d=null,f=0;f<i;f++)s[f]=e.min(r[f]).value,o[f]=e.max(r[f]).value;for(var h=0;h<a;h++){d=[];for(var p=0;p<i;p++)d[p]=Math.random()*(o[p]-s[p])+s[p];u[h]=d}return u},lC=function(e,a,r,i,s){for(var o=1/0,u=0,d=0;d<a.length;d++){var f=qf(r,e,a[d],i,s);f<o&&(o=f,u=d)}return u},oC=function(e,a,r){for(var i=[],s=null,o=0;o<a.length;o++)s=a[o],r[s.id()]===e&&i.push(s);return i},FR=function(e,a,r){return Math.abs(a-e)<=r},HR=function(e,a,r){for(var i=0;i<e.length;i++)for(var s=0;s<e[i].length;s++){var o=Math.abs(e[i][s]-a[i][s]);if(o>r)return!1}return!0},GR=function(e,a,r){for(var i=0;i<r;i++)if(e===a[i])return!0;return!1},uw=function(e,a){var r=new Array(a);if(e.length<50)for(var i=0;i<a;i++){for(var s=e[Math.floor(Math.random()*e.length)];GR(s,r,i);)s=e[Math.floor(Math.random()*e.length)];r[i]=s}else for(var o=0;o<a;o++)r[o]=e[Math.floor(Math.random()*e.length)];return r},cw=function(e,a,r){for(var i=0,s=0;s<a.length;s++)i+=qf("manhattan",a[s],e,r,"kMedoids");return i},QR=function(e){var a=this.cy(),r=this.nodes(),i=null,s=Q0(e),o=new Array(s.k),u={},d;s.testMode?typeof s.testCentroids=="number"?(s.testCentroids,d=lg(r,s.k,s.attributes)):Sa(s.testCentroids)==="object"?d=s.testCentroids:d=lg(r,s.k,s.attributes):d=lg(r,s.k,s.attributes);for(var f=!0,h=0;f&&h<s.maxIterations;){for(var p=0;p<r.length;p++)i=r[p],u[i.id()]=lC(i,d,s.distance,s.attributes,"kMeans");f=!1;for(var m=0;m<s.k;m++){var y=oC(m,r,u);if(y.length!==0){for(var x=s.attributes.length,E=d[m],S=new Array(x),T=new Array(x),C=0;C<x;C++){T[C]=0;for(var N=0;N<y.length;N++)i=y[N],T[C]+=s.attributes[C](i);S[C]=T[C]/y.length,FR(S[C],E[C],s.sensitivityThreshold)||(f=!0)}d[m]=S,o[m]=a.collection(y)}}h++}return o},YR=function(e){var a=this.cy(),r=this.nodes(),i=null,s=Q0(e),o=new Array(s.k),u,d={},f,h=new Array(s.k);s.testMode?typeof s.testCentroids=="number"||(Sa(s.testCentroids)==="object"?u=s.testCentroids:u=uw(r,s.k)):u=uw(r,s.k);for(var p=!0,m=0;p&&m<s.maxIterations;){for(var y=0;y<r.length;y++)i=r[y],d[i.id()]=lC(i,u,s.distance,s.attributes,"kMedoids");p=!1;for(var x=0;x<u.length;x++){var E=oC(x,r,d);if(E.length!==0){h[x]=cw(u[x],E,s.attributes);for(var S=0;S<E.length;S++)f=cw(E[S],E,s.attributes),f<h[x]&&(h[x]=f,u[x]=E[S],p=!0);o[x]=a.collection(E)}}m++}return o},KR=function(e,a,r,i,s){for(var o,u,d=0;d<a.length;d++)for(var f=0;f<e.length;f++)i[d][f]=Math.pow(r[d][f],s.m);for(var h=0;h<e.length;h++)for(var p=0;p<s.attributes.length;p++){o=0,u=0;for(var m=0;m<a.length;m++)o+=i[m][h]*s.attributes[p](a[m]),u+=i[m][h];e[h][p]=o/u}},$R=function(e,a,r,i,s){for(var o=0;o<e.length;o++)a[o]=e[o].slice();for(var u,d,f,h=2/(s.m-1),p=0;p<r.length;p++)for(var m=0;m<i.length;m++){u=0;for(var y=0;y<r.length;y++)d=qf(s.distance,i[m],r[p],s.attributes,"cmeans"),f=qf(s.distance,i[m],r[y],s.attributes,"cmeans"),u+=Math.pow(d/f,h);e[m][p]=1/u}},XR=function(e,a,r,i){for(var s=new Array(r.k),o=0;o<s.length;o++)s[o]=[];for(var u,d,f=0;f<a.length;f++){u=-1/0,d=-1;for(var h=0;h<a[0].length;h++)a[f][h]>u&&(u=a[f][h],d=h);s[d].push(e[f])}for(var p=0;p<s.length;p++)s[p]=i.collection(s[p]);return s},dw=function(e){var a=this.cy(),r=this.nodes(),i=Q0(e),s,o,u,d,f;d=new Array(r.length);for(var h=0;h<r.length;h++)d[h]=new Array(i.k);u=new Array(r.length);for(var p=0;p<r.length;p++)u[p]=new Array(i.k);for(var m=0;m<r.length;m++){for(var y=0,x=0;x<i.k;x++)u[m][x]=Math.random(),y+=u[m][x];for(var E=0;E<i.k;E++)u[m][E]=u[m][E]/y}o=new Array(i.k);for(var S=0;S<i.k;S++)o[S]=new Array(i.attributes.length);f=new Array(r.length);for(var T=0;T<r.length;T++)f[T]=new Array(i.k);for(var C=!0,N=0;C&&N<i.maxIterations;)C=!1,KR(o,r,u,f,i),$R(u,d,o,r,i),HR(u,d,i.sensitivityThreshold)||(C=!0),N++;return s=XR(r,u,i,a),{clusters:s,degreeOfMembership:u}},ZR={kMeans:QR,kMedoids:YR,fuzzyCMeans:dw,fcm:dw},WR=Fa({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),JR={single:"min",complete:"max"},ek=function(e){var a=WR(e),r=JR[a.linkage];return r!=null&&(a.linkage=r),a},fw=function(e,a,r,i,s){for(var o=0,u=1/0,d,f=s.attributes,h=function(L,z){return ih(s.distance,f.length,function(_){return f[_](L)},function(_){return f[_](z)},L,z)},p=0;p<e.length;p++){var m=e[p].key,y=r[m][i[m]];y<u&&(o=m,u=y)}if(s.mode==="threshold"&&u>=s.threshold||s.mode==="dendrogram"&&e.length===1)return!1;var x=a[o],E=a[i[o]],S;s.mode==="dendrogram"?S={left:x,right:E,key:x.key}:S={value:x.value.concat(E.value),key:x.key},e[x.index]=S,e.splice(E.index,1),a[x.key]=S;for(var T=0;T<e.length;T++){var C=e[T];x.key===C.key?d=1/0:s.linkage==="min"?(d=r[x.key][C.key],r[x.key][C.key]>r[E.key][C.key]&&(d=r[E.key][C.key])):s.linkage==="max"?(d=r[x.key][C.key],r[x.key][C.key]<r[E.key][C.key]&&(d=r[E.key][C.key])):s.linkage==="mean"?d=(r[x.key][C.key]*x.size+r[E.key][C.key]*E.size)/(x.size+E.size):s.mode==="dendrogram"?d=h(C.value,x.value):d=h(C.value[0],x.value[0]),r[x.key][C.key]=r[C.key][x.key]=d}for(var N=0;N<e.length;N++){var A=e[N].key;if(i[A]===x.key||i[A]===E.key){for(var M=A,D=0;D<e.length;D++){var j=e[D].key;r[A][j]<r[A][M]&&(M=j)}i[A]=M}e[N].index=N}return x.key=E.key=x.index=E.index=null,!0},to=function(e,a,r){e&&(e.value?a.push(e.value):(e.left&&to(e.left,a),e.right&&to(e.right,a)))},Xm=function(e,a){if(!e)return"";if(e.left&&e.right){var r=Xm(e.left,a),i=Xm(e.right,a),s=a.add({group:"nodes",data:{id:r+","+i}});return a.add({group:"edges",data:{source:r,target:s.id()}}),a.add({group:"edges",data:{source:i,target:s.id()}}),s.id()}else if(e.value)return e.value.id()},Zm=function(e,a,r){if(!e)return[];var i=[],s=[],o=[];return a===0?(e.left&&to(e.left,i),e.right&&to(e.right,s),o=i.concat(s),[r.collection(o)]):a===1?e.value?[r.collection(e.value)]:(e.left&&to(e.left,i),e.right&&to(e.right,s),[r.collection(i),r.collection(s)]):e.value?[r.collection(e.value)]:(e.left&&(i=Zm(e.left,a-1,r)),e.right&&(s=Zm(e.right,a-1,r)),i.concat(s))},hw=function(e){for(var a=this.cy(),r=this.nodes(),i=ek(e),s=i.attributes,o=function(N,A){return ih(i.distance,s.length,function(M){return s[M](N)},function(M){return s[M](A)},N,A)},u=[],d=[],f=[],h=[],p=0;p<r.length;p++){var m={value:i.mode==="dendrogram"?r[p]:[r[p]],key:p,index:p};u[p]=m,h[p]=m,d[p]=[],f[p]=0}for(var y=0;y<u.length;y++)for(var x=0;x<=y;x++){var E=void 0;i.mode==="dendrogram"?E=y===x?1/0:o(u[y].value,u[x].value):E=y===x?1/0:o(u[y].value[0],u[x].value[0]),d[y][x]=E,d[x][y]=E,E<d[y][f[y]]&&(f[y]=x)}for(var S=fw(u,h,d,f,i);S;)S=fw(u,h,d,f,i);var T;return i.mode==="dendrogram"?(T=Zm(u[0],i.dendrogramDepth,a),i.addDendrogram&&Xm(u[0],a)):(T=new Array(u.length),u.forEach(function(C,N){C.key=C.index=null,T[N]=a.collection(C.value)})),T},tk={hierarchicalClustering:hw,hca:hw},ak=Fa({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),rk=function(e){var a=e.damping,r=e.preference;.5<=a&&a<1||Qt("Damping must range on [0.5, 1). Got: ".concat(a));var i=["median","mean","min","max"];return i.some(function(s){return s===r})||Oe(r)||Qt("Preference must be one of [".concat(i.map(function(s){return"'".concat(s,"'")}).join(", "),"] or a number. Got: ").concat(r)),ak(e)},nk=function(e,a,r,i){var s=function(u,d){return i[d](u)};return-ih(e,i.length,function(o){return s(a,o)},function(o){return s(r,o)},a,r)},ik=function(e,a){var r=null;return a==="median"?r=rR(e):a==="mean"?r=aR(e):a==="min"?r=eR(e):a==="max"?r=tR(e):r=a,r},sk=function(e,a,r){for(var i=[],s=0;s<e;s++)a[s*e+s]+r[s*e+s]>0&&i.push(s);return i},vw=function(e,a,r){for(var i=[],s=0;s<e;s++){for(var o=-1,u=-1/0,d=0;d<r.length;d++){var f=r[d];a[s*e+f]>u&&(o=f,u=a[s*e+f])}o>0&&i.push(o)}for(var h=0;h<r.length;h++)i[r[h]]=r[h];return i},lk=function(e,a,r){for(var i=vw(e,a,r),s=0;s<r.length;s++){for(var o=[],u=0;u<i.length;u++)i[u]===r[s]&&o.push(u);for(var d=-1,f=-1/0,h=0;h<o.length;h++){for(var p=0,m=0;m<o.length;m++)p+=a[o[m]*e+o[h]];p>f&&(d=h,f=p)}r[s]=o[d]}return i=vw(e,a,r),i},pw=function(e){for(var a=this.cy(),r=this.nodes(),i=rk(e),s={},o=0;o<r.length;o++)s[r[o].id()]=o;var u,d,f,h,p,m;u=r.length,d=u*u,f=new Array(d);for(var y=0;y<d;y++)f[y]=-1/0;for(var x=0;x<u;x++)for(var E=0;E<u;E++)x!==E&&(f[x*u+E]=nk(i.distance,r[x],r[E],i.attributes));h=ik(f,i.preference);for(var S=0;S<u;S++)f[S*u+S]=h;p=new Array(d);for(var T=0;T<d;T++)p[T]=0;m=new Array(d);for(var C=0;C<d;C++)m[C]=0;for(var N=new Array(u),A=new Array(u),M=new Array(u),D=0;D<u;D++)N[D]=0,A[D]=0,M[D]=0;for(var j=new Array(u*i.minIterations),R=0;R<j.length;R++)j[R]=0;var L;for(L=0;L<i.maxIterations;L++){for(var z=0;z<u;z++){for(var _=-1/0,B=-1/0,q=-1,V=0,Q=0;Q<u;Q++)N[Q]=p[z*u+Q],V=m[z*u+Q]+f[z*u+Q],V>=_?(B=_,_=V,q=Q):V>B&&(B=V);for(var P=0;P<u;P++)p[z*u+P]=(1-i.damping)*(f[z*u+P]-_)+i.damping*N[P];p[z*u+q]=(1-i.damping)*(f[z*u+q]-B)+i.damping*N[q]}for(var U=0;U<u;U++){for(var F=0,K=0;K<u;K++)N[K]=m[K*u+U],A[K]=Math.max(0,p[K*u+U]),F+=A[K];F-=A[U],A[U]=p[U*u+U],F+=A[U];for(var J=0;J<u;J++)m[J*u+U]=(1-i.damping)*Math.min(0,F-A[J])+i.damping*N[J];m[U*u+U]=(1-i.damping)*(F-A[U])+i.damping*N[U]}for(var k=0,G=0;G<u;G++){var X=m[G*u+G]+p[G*u+G]>0?1:0;j[L%i.minIterations*u+G]=X,k+=X}if(k>0&&(L>=i.minIterations-1||L==i.maxIterations-1)){for(var W=0,$=0;$<u;$++){M[$]=0;for(var ee=0;ee<i.minIterations;ee++)M[$]+=j[ee*u+$];(M[$]===0||M[$]===i.minIterations)&&W++}if(W===u)break}}for(var ie=sk(u,p,m),he=lk(u,f,ie),oe={},ae=0;ae<ie.length;ae++)oe[ie[ae]]=[];for(var re=0;re<r.length;re++){var le=s[r[re].id()],se=he[le];se!=null&&oe[se].push(r[re])}for(var Ne=new Array(ie.length),Ae=0;Ae<ie.length;Ae++)Ne[Ae]=a.collection(oe[ie[Ae]]);return Ne},ok={affinityPropagation:pw,ap:pw},uk=Fa({root:void 0,directed:!1}),ck={hierholzer:function(e){if(!wt(e)){var a=arguments;e={root:a[0],directed:a[1]}}var r=uk(e),i=r.root,s=r.directed,o=this,u=!1,d,f,h;i&&(h=Xe(i)?this.filter(i)[0].id():i[0].id());var p={},m={};s?o.forEach(function(C){var N=C.id();if(C.isNode()){var A=C.indegree(!0),M=C.outdegree(!0),D=A-M,j=M-A;D==1?d?u=!0:d=N:j==1?f?u=!0:f=N:(j>1||D>1)&&(u=!0),p[N]=[],C.outgoers().forEach(function(R){R.isEdge()&&p[N].push(R.id())})}else m[N]=[void 0,C.target().id()]}):o.forEach(function(C){var N=C.id();if(C.isNode()){var A=C.degree(!0);A%2&&(d?f?u=!0:f=N:d=N),p[N]=[],C.connectedEdges().forEach(function(M){return p[N].push(M.id())})}else m[N]=[C.source().id(),C.target().id()]});var y={found:!1,trail:void 0};if(u)return y;if(f&&d)if(s){if(h&&f!=h)return y;h=f}else{if(h&&f!=h&&d!=h)return y;h||(h=f)}else h||(h=o[0].id());var x=function(N){for(var A=N,M=[N],D,j,R;p[A].length;)D=p[A].shift(),j=m[D][0],R=m[D][1],A!=R?(p[R]=p[R].filter(function(L){return L!=D}),A=R):!s&&A!=j&&(p[j]=p[j].filter(function(L){return L!=D}),A=j),M.unshift(D),M.unshift(A);return M},E=[],S=[];for(S=x(h);S.length!=1;)p[S[0]].length==0?(E.unshift(o.getElementById(S.shift())),E.unshift(o.getElementById(S.shift()))):S=x(S.shift()).concat(S);E.unshift(o.getElementById(S.shift()));for(var T in p)if(p[T].length)return y;return y.found=!0,y.trail=this.spawn(E,!0),y}},tf=function(){var e=this,a={},r=0,i=0,s=[],o=[],u={},d=function(m,y){for(var x=o.length-1,E=[],S=e.spawn();o[x].x!=m||o[x].y!=y;)E.push(o.pop().edge),x--;E.push(o.pop().edge),E.forEach(function(T){var C=T.connectedNodes().intersection(e);S.merge(T),C.forEach(function(N){var A=N.id(),M=N.connectedEdges().intersection(e);S.merge(N),a[A].cutVertex?S.merge(M.filter(function(D){return D.isLoop()})):S.merge(M)})}),s.push(S)},f=function(m,y,x){m===x&&(i+=1),a[y]={id:r,low:r++,cutVertex:!1};var E=e.getElementById(y).connectedEdges().intersection(e);if(E.size()===0)s.push(e.spawn(e.getElementById(y)));else{var S,T,C,N;E.forEach(function(A){S=A.source().id(),T=A.target().id(),C=S===y?T:S,C!==x&&(N=A.id(),u[N]||(u[N]=!0,o.push({x:y,y:C,edge:A})),C in a?a[y].low=Math.min(a[y].low,a[C].id):(f(m,C,y),a[y].low=Math.min(a[y].low,a[C].low),a[y].id<=a[C].low&&(a[y].cutVertex=!0,d(y,C))))})}};e.forEach(function(p){if(p.isNode()){var m=p.id();m in a||(i=0,f(m,m),a[m].cutVertex=i>1)}});var h=Object.keys(a).filter(function(p){return a[p].cutVertex}).map(function(p){return e.getElementById(p)});return{cut:e.spawn(h),components:s}},dk={hopcroftTarjanBiconnected:tf,htbc:tf,htb:tf,hopcroftTarjanBiconnectedComponents:tf},af=function(){var e=this,a={},r=0,i=[],s=[],o=e.spawn(e),u=function(f){s.push(f),a[f]={index:r,low:r++,explored:!1};var h=e.getElementById(f).connectedEdges().intersection(e);if(h.forEach(function(E){var S=E.target().id();S!==f&&(S in a||u(S),a[S].explored||(a[f].low=Math.min(a[f].low,a[S].low)))}),a[f].index===a[f].low){for(var p=e.spawn();;){var m=s.pop();if(p.merge(e.getElementById(m)),a[m].low=a[f].index,a[m].explored=!0,m===f)break}var y=p.edgesWith(p),x=p.merge(y);i.push(x),o=o.difference(x)}};return e.forEach(function(d){if(d.isNode()){var f=d.id();f in a||u(f)}}),{cut:o,components:i}},fk={tarjanStronglyConnected:af,tsc:af,tscc:af,tarjanStronglyConnectedComponents:af},uC={};[Wu,V4,F4,G4,Y4,$4,W4,CR,so,lo,$m,_R,ZR,tk,ok,ck,dk,fk].forEach(function(t){et(uC,t)});/*!
|
|
83
|
+
Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
|
|
84
|
+
Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
|
|
85
|
+
Licensed under The MIT License (http://opensource.org/licenses/MIT)
|
|
86
|
+
*/var cC=0,dC=1,fC=2,nn=function(e){if(!(this instanceof nn))return new nn(e);this.id="Thenable/1.0.7",this.state=cC,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof e=="function"&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};nn.prototype={fulfill:function(e){return gw(this,dC,"fulfillValue",e)},reject:function(e){return gw(this,fC,"rejectReason",e)},then:function(e,a){var r=this,i=new nn;return r.onFulfilled.push(yw(e,i,"fulfill")),r.onRejected.push(yw(a,i,"reject")),hC(r),i.proxy}};var gw=function(e,a,r,i){return e.state===cC&&(e.state=a,e[r]=i,hC(e)),e},hC=function(e){e.state===dC?mw(e,"onFulfilled",e.fulfillValue):e.state===fC&&mw(e,"onRejected",e.rejectReason)},mw=function(e,a,r){if(e[a].length!==0){var i=e[a];e[a]=[];var s=function(){for(var u=0;u<i.length;u++)i[u](r)};typeof setImmediate=="function"?setImmediate(s):setTimeout(s,0)}},yw=function(e,a,r){return function(i){if(typeof e!="function")a[r].call(a,i);else{var s;try{s=e(i)}catch(o){a.reject(o);return}vC(a,s)}}},vC=function(e,a){if(e===a||e.proxy===a){e.reject(new TypeError("cannot resolve promise with itself"));return}var r;if(Sa(a)==="object"&&a!==null||typeof a=="function")try{r=a.then}catch(s){e.reject(s);return}if(typeof r=="function"){var i=!1;try{r.call(a,function(s){i||(i=!0,s===a?e.reject(new TypeError("circular thenable chain")):vC(e,s))},function(s){i||(i=!0,e.reject(s))})}catch(s){i||e.reject(s)}return}e.fulfill(a)};nn.all=function(t){return new nn(function(e,a){for(var r=new Array(t.length),i=0,s=function(d,f){r[d]=f,i++,i===t.length&&e(r)},o=0;o<t.length;o++)(function(u){var d=t[u],f=d!=null&&d.then!=null;if(f)d.then(function(p){s(u,p)},function(p){a(p)});else{var h=d;s(u,h)}})(o)})};nn.resolve=function(t){return new nn(function(e,a){e(t)})};nn.reject=function(t){return new nn(function(e,a){a(t)})};var Bo=typeof Promise<"u"?Promise:nn,Wm=function(e,a,r){var i=z0(e),s=!i,o=this._private=et({duration:1e3},a,r);if(o.target=e,o.style=o.style||o.css,o.started=!1,o.playing=!1,o.hooked=!1,o.applying=!1,o.progress=0,o.completes=[],o.frames=[],o.complete&&Zt(o.complete)&&o.completes.push(o.complete),s){var u=e.position();o.startPosition=o.startPosition||{x:u.x,y:u.y},o.startStyle=o.startStyle||e.cy().style().getAnimationStartStyle(e,o.style)}if(i){var d=e.pan();o.startPan={x:d.x,y:d.y},o.startZoom=e.zoom()}this.length=1,this[0]=this},el=Wm.prototype;et(el,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var a,r=e.target._private.animation;e.queue?a=r.queue:a=r.current,a.push(this),Mr(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return e.progress===1&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var a=this._private;return e===void 0?a.progress*a.duration:this.progress(e/a.duration)},progress:function(e){var a=this._private,r=a.playing;return e===void 0?a.progress:(r&&this.pause(),a.progress=e,a.started=!1,r&&this.play(),this)},completed:function(){return this._private.progress===1},reverse:function(){var e=this._private,a=e.playing;a&&this.pause(),e.progress=1-e.progress,e.started=!1;var r=function(f,h){var p=e[f];p!=null&&(e[f]=e[h],e[h]=p)};if(r("zoom","startZoom"),r("pan","startPan"),r("position","startPosition"),e.style)for(var i=0;i<e.style.length;i++){var s=e.style[i],o=s.name,u=e.startStyle[o];e.startStyle[o]=s,e.style[i]=u}return a&&this.play(),this},promise:function(e){var a=this._private,r;switch(e){case"frame":r=a.frames;break;default:case"complete":case"completed":r=a.completes}return new Bo(function(i,s){r.push(function(){i()})})}});el.complete=el.completed;el.run=el.play;el.running=el.playing;var hk={animated:function(){return function(){var a=this,r=a.length!==void 0,i=r?a:[a],s=this._private.cy||this;if(!s.styleEnabled())return!1;var o=i[0];if(o)return o._private.animation.current.length>0}},clearQueue:function(){return function(){var a=this,r=a.length!==void 0,i=r?a:[a],s=this._private.cy||this;if(!s.styleEnabled())return this;for(var o=0;o<i.length;o++){var u=i[o];u._private.animation.queue=[]}return this}},delay:function(){return function(a,r){var i=this._private.cy||this;return i.styleEnabled()?this.animate({delay:a,duration:a,complete:r}):this}},delayAnimation:function(){return function(a,r){var i=this._private.cy||this;return i.styleEnabled()?this.animation({delay:a,duration:a,complete:r}):this}},animation:function(){return function(a,r){var i=this,s=i.length!==void 0,o=s?i:[i],u=this._private.cy||this,d=!s,f=!d;if(!u.styleEnabled())return this;var h=u.style();a=et({},a,r);var p=Object.keys(a).length===0;if(p)return new Wm(o[0],a);switch(a.duration===void 0&&(a.duration=400),a.duration){case"slow":a.duration=600;break;case"fast":a.duration=200;break}if(f&&(a.style=h.getPropsList(a.style||a.css),a.css=void 0),f&&a.renderedPosition!=null){var m=a.renderedPosition,y=u.pan(),x=u.zoom();a.position=JT(m,x,y)}if(d&&a.panBy!=null){var E=a.panBy,S=u.pan();a.pan={x:S.x+E.x,y:S.y+E.y}}var T=a.center||a.centre;if(d&&T!=null){var C=u.getCenterPan(T.eles,a.zoom);C!=null&&(a.pan=C)}if(d&&a.fit!=null){var N=a.fit,A=u.getFitViewport(N.eles||N.boundingBox,N.padding);A!=null&&(a.pan=A.pan,a.zoom=A.zoom)}if(d&&wt(a.zoom)){var M=u.getZoomedViewport(a.zoom);M!=null?(M.zoomed&&(a.zoom=M.zoom),M.panned&&(a.pan=M.pan)):a.zoom=null}return new Wm(o[0],a)}},animate:function(){return function(a,r){var i=this,s=i.length!==void 0,o=s?i:[i],u=this._private.cy||this;if(!u.styleEnabled())return this;r&&(a=et({},a,r));for(var d=0;d<o.length;d++){var f=o[d],h=f.animated()&&(a.queue===void 0||a.queue),p=f.animation(a,h?{queue:!0}:void 0);p.play()}return this}},stop:function(){return function(a,r){var i=this,s=i.length!==void 0,o=s?i:[i],u=this._private.cy||this;if(!u.styleEnabled())return this;for(var d=0;d<o.length;d++){for(var f=o[d],h=f._private,p=h.animation.current,m=0;m<p.length;m++){var y=p[m],x=y._private;r&&(x.duration=0)}a&&(h.animation.queue=[]),r||(h.animation.current=[])}return u.notify("draw"),this}}},og,xw;function sh(){if(xw)return og;xw=1;var t=Array.isArray;return og=t,og}var ug,bw;function vk(){if(bw)return ug;bw=1;var t=sh(),e=Tc(),a=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(s,o){if(t(s))return!1;var u=typeof s;return u=="number"||u=="symbol"||u=="boolean"||s==null||e(s)?!0:r.test(s)||!a.test(s)||o!=null&&s in Object(o)}return ug=i,ug}var cg,ww;function pk(){if(ww)return cg;ww=1;var t=HT(),e=Ec(),a="[object AsyncFunction]",r="[object Function]",i="[object GeneratorFunction]",s="[object Proxy]";function o(u){if(!e(u))return!1;var d=t(u);return d==r||d==i||d==a||d==s}return cg=o,cg}var dg,Sw;function gk(){if(Sw)return dg;Sw=1;var t=ah(),e=t["__core-js_shared__"];return dg=e,dg}var fg,Ew;function mk(){if(Ew)return fg;Ew=1;var t=gk(),e=(function(){var r=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""})();function a(r){return!!e&&e in r}return fg=a,fg}var hg,Tw;function yk(){if(Tw)return hg;Tw=1;var t=Function.prototype,e=t.toString;function a(r){if(r!=null){try{return e.call(r)}catch{}try{return r+""}catch{}}return""}return hg=a,hg}var vg,Cw;function xk(){if(Cw)return vg;Cw=1;var t=pk(),e=mk(),a=Ec(),r=yk(),i=/[\\^$.*+?()[\]{}|]/g,s=/^\[object .+?Constructor\]$/,o=Function.prototype,u=Object.prototype,d=o.toString,f=u.hasOwnProperty,h=RegExp("^"+d.call(f).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function p(m){if(!a(m)||e(m))return!1;var y=t(m)?h:s;return y.test(r(m))}return vg=p,vg}var pg,Nw;function bk(){if(Nw)return pg;Nw=1;function t(e,a){return e==null?void 0:e[a]}return pg=t,pg}var gg,jw;function Y0(){if(jw)return gg;jw=1;var t=xk(),e=bk();function a(r,i){var s=e(r,i);return t(s)?s:void 0}return gg=a,gg}var mg,Aw;function lh(){if(Aw)return mg;Aw=1;var t=Y0(),e=t(Object,"create");return mg=e,mg}var yg,Mw;function wk(){if(Mw)return yg;Mw=1;var t=lh();function e(){this.__data__=t?t(null):{},this.size=0}return yg=e,yg}var xg,Dw;function Sk(){if(Dw)return xg;Dw=1;function t(e){var a=this.has(e)&&delete this.__data__[e];return this.size-=a?1:0,a}return xg=t,xg}var bg,Ow;function Ek(){if(Ow)return bg;Ow=1;var t=lh(),e="__lodash_hash_undefined__",a=Object.prototype,r=a.hasOwnProperty;function i(s){var o=this.__data__;if(t){var u=o[s];return u===e?void 0:u}return r.call(o,s)?o[s]:void 0}return bg=i,bg}var wg,Rw;function Tk(){if(Rw)return wg;Rw=1;var t=lh(),e=Object.prototype,a=e.hasOwnProperty;function r(i){var s=this.__data__;return t?s[i]!==void 0:a.call(s,i)}return wg=r,wg}var Sg,kw;function Ck(){if(kw)return Sg;kw=1;var t=lh(),e="__lodash_hash_undefined__";function a(r,i){var s=this.__data__;return this.size+=this.has(r)?0:1,s[r]=t&&i===void 0?e:i,this}return Sg=a,Sg}var Eg,Bw;function Nk(){if(Bw)return Eg;Bw=1;var t=wk(),e=Sk(),a=Ek(),r=Tk(),i=Ck();function s(o){var u=-1,d=o==null?0:o.length;for(this.clear();++u<d;){var f=o[u];this.set(f[0],f[1])}}return s.prototype.clear=t,s.prototype.delete=e,s.prototype.get=a,s.prototype.has=r,s.prototype.set=i,Eg=s,Eg}var Tg,Lw;function jk(){if(Lw)return Tg;Lw=1;function t(){this.__data__=[],this.size=0}return Tg=t,Tg}var Cg,zw;function pC(){if(zw)return Cg;zw=1;function t(e,a){return e===a||e!==e&&a!==a}return Cg=t,Cg}var Ng,Pw;function oh(){if(Pw)return Ng;Pw=1;var t=pC();function e(a,r){for(var i=a.length;i--;)if(t(a[i][0],r))return i;return-1}return Ng=e,Ng}var jg,_w;function Ak(){if(_w)return jg;_w=1;var t=oh(),e=Array.prototype,a=e.splice;function r(i){var s=this.__data__,o=t(s,i);if(o<0)return!1;var u=s.length-1;return o==u?s.pop():a.call(s,o,1),--this.size,!0}return jg=r,jg}var Ag,Uw;function Mk(){if(Uw)return Ag;Uw=1;var t=oh();function e(a){var r=this.__data__,i=t(r,a);return i<0?void 0:r[i][1]}return Ag=e,Ag}var Mg,qw;function Dk(){if(qw)return Mg;qw=1;var t=oh();function e(a){return t(this.__data__,a)>-1}return Mg=e,Mg}var Dg,Iw;function Ok(){if(Iw)return Dg;Iw=1;var t=oh();function e(a,r){var i=this.__data__,s=t(i,a);return s<0?(++this.size,i.push([a,r])):i[s][1]=r,this}return Dg=e,Dg}var Og,Vw;function Rk(){if(Vw)return Og;Vw=1;var t=jk(),e=Ak(),a=Mk(),r=Dk(),i=Ok();function s(o){var u=-1,d=o==null?0:o.length;for(this.clear();++u<d;){var f=o[u];this.set(f[0],f[1])}}return s.prototype.clear=t,s.prototype.delete=e,s.prototype.get=a,s.prototype.has=r,s.prototype.set=i,Og=s,Og}var Rg,Fw;function kk(){if(Fw)return Rg;Fw=1;var t=Y0(),e=ah(),a=t(e,"Map");return Rg=a,Rg}var kg,Hw;function Bk(){if(Hw)return kg;Hw=1;var t=Nk(),e=Rk(),a=kk();function r(){this.size=0,this.__data__={hash:new t,map:new(a||e),string:new t}}return kg=r,kg}var Bg,Gw;function Lk(){if(Gw)return Bg;Gw=1;function t(e){var a=typeof e;return a=="string"||a=="number"||a=="symbol"||a=="boolean"?e!=="__proto__":e===null}return Bg=t,Bg}var Lg,Qw;function uh(){if(Qw)return Lg;Qw=1;var t=Lk();function e(a,r){var i=a.__data__;return t(r)?i[typeof r=="string"?"string":"hash"]:i.map}return Lg=e,Lg}var zg,Yw;function zk(){if(Yw)return zg;Yw=1;var t=uh();function e(a){var r=t(this,a).delete(a);return this.size-=r?1:0,r}return zg=e,zg}var Pg,Kw;function Pk(){if(Kw)return Pg;Kw=1;var t=uh();function e(a){return t(this,a).get(a)}return Pg=e,Pg}var _g,$w;function _k(){if($w)return _g;$w=1;var t=uh();function e(a){return t(this,a).has(a)}return _g=e,_g}var Ug,Xw;function Uk(){if(Xw)return Ug;Xw=1;var t=uh();function e(a,r){var i=t(this,a),s=i.size;return i.set(a,r),this.size+=i.size==s?0:1,this}return Ug=e,Ug}var qg,Zw;function qk(){if(Zw)return qg;Zw=1;var t=Bk(),e=zk(),a=Pk(),r=_k(),i=Uk();function s(o){var u=-1,d=o==null?0:o.length;for(this.clear();++u<d;){var f=o[u];this.set(f[0],f[1])}}return s.prototype.clear=t,s.prototype.delete=e,s.prototype.get=a,s.prototype.has=r,s.prototype.set=i,qg=s,qg}var Ig,Ww;function Ik(){if(Ww)return Ig;Ww=1;var t=qk(),e="Expected a function";function a(r,i){if(typeof r!="function"||i!=null&&typeof i!="function")throw new TypeError(e);var s=function(){var o=arguments,u=i?i.apply(this,o):o[0],d=s.cache;if(d.has(u))return d.get(u);var f=r.apply(this,o);return s.cache=d.set(u,f)||d,f};return s.cache=new(a.Cache||t),s}return a.Cache=t,Ig=a,Ig}var Vg,Jw;function Vk(){if(Jw)return Vg;Jw=1;var t=Ik(),e=500;function a(r){var i=t(r,function(o){return s.size===e&&s.clear(),o}),s=i.cache;return i}return Vg=a,Vg}var Fg,eS;function gC(){if(eS)return Fg;eS=1;var t=Vk(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,a=/\\(\\)?/g,r=t(function(i){var s=[];return i.charCodeAt(0)===46&&s.push(""),i.replace(e,function(o,u,d,f){s.push(d?f.replace(a,"$1"):u||o)}),s});return Fg=r,Fg}var Hg,tS;function mC(){if(tS)return Hg;tS=1;function t(e,a){for(var r=-1,i=e==null?0:e.length,s=Array(i);++r<i;)s[r]=a(e[r],r,e);return s}return Hg=t,Hg}var Gg,aS;function Fk(){if(aS)return Gg;aS=1;var t=_0(),e=mC(),a=sh(),r=Tc(),i=t?t.prototype:void 0,s=i?i.toString:void 0;function o(u){if(typeof u=="string")return u;if(a(u))return e(u,o)+"";if(r(u))return s?s.call(u):"";var d=u+"";return d=="0"&&1/u==-1/0?"-0":d}return Gg=o,Gg}var Qg,rS;function yC(){if(rS)return Qg;rS=1;var t=Fk();function e(a){return a==null?"":t(a)}return Qg=e,Qg}var Yg,nS;function xC(){if(nS)return Yg;nS=1;var t=sh(),e=vk(),a=gC(),r=yC();function i(s,o){return t(s)?s:e(s,o)?[s]:a(r(s))}return Yg=i,Yg}var Kg,iS;function K0(){if(iS)return Kg;iS=1;var t=Tc();function e(a){if(typeof a=="string"||t(a))return a;var r=a+"";return r=="0"&&1/a==-1/0?"-0":r}return Kg=e,Kg}var $g,sS;function Hk(){if(sS)return $g;sS=1;var t=xC(),e=K0();function a(r,i){i=t(i,r);for(var s=0,o=i.length;r!=null&&s<o;)r=r[e(i[s++])];return s&&s==o?r:void 0}return $g=a,$g}var Xg,lS;function Gk(){if(lS)return Xg;lS=1;var t=Hk();function e(a,r,i){var s=a==null?void 0:t(a,r);return s===void 0?i:s}return Xg=e,Xg}var Qk=Gk(),Yk=Sc(Qk),Zg,oS;function Kk(){if(oS)return Zg;oS=1;var t=Y0(),e=(function(){try{var a=t(Object,"defineProperty");return a({},"",{}),a}catch{}})();return Zg=e,Zg}var Wg,uS;function $k(){if(uS)return Wg;uS=1;var t=Kk();function e(a,r,i){r=="__proto__"&&t?t(a,r,{configurable:!0,enumerable:!0,value:i,writable:!0}):a[r]=i}return Wg=e,Wg}var Jg,cS;function Xk(){if(cS)return Jg;cS=1;var t=$k(),e=pC(),a=Object.prototype,r=a.hasOwnProperty;function i(s,o,u){var d=s[o];(!(r.call(s,o)&&e(d,u))||u===void 0&&!(o in s))&&t(s,o,u)}return Jg=i,Jg}var em,dS;function Zk(){if(dS)return em;dS=1;var t=9007199254740991,e=/^(?:0|[1-9]\d*)$/;function a(r,i){var s=typeof r;return i=i??t,!!i&&(s=="number"||s!="symbol"&&e.test(r))&&r>-1&&r%1==0&&r<i}return em=a,em}var tm,fS;function Wk(){if(fS)return tm;fS=1;var t=Xk(),e=xC(),a=Zk(),r=Ec(),i=K0();function s(o,u,d,f){if(!r(o))return o;u=e(u,o);for(var h=-1,p=u.length,m=p-1,y=o;y!=null&&++h<p;){var x=i(u[h]),E=d;if(x==="__proto__"||x==="constructor"||x==="prototype")return o;if(h!=m){var S=y[x];E=f?f(S,x,y):void 0,E===void 0&&(E=r(S)?S:a(u[h+1])?[]:{})}t(y,x,E),y=y[x]}return o}return tm=s,tm}var am,hS;function Jk(){if(hS)return am;hS=1;var t=Wk();function e(a,r,i){return a==null?a:t(a,r,i)}return am=e,am}var e3=Jk(),t3=Sc(e3),rm,vS;function a3(){if(vS)return rm;vS=1;function t(e,a){var r=-1,i=e.length;for(a||(a=Array(i));++r<i;)a[r]=e[r];return a}return rm=t,rm}var nm,pS;function r3(){if(pS)return nm;pS=1;var t=mC(),e=a3(),a=sh(),r=Tc(),i=gC(),s=K0(),o=yC();function u(d){return a(d)?t(d,s):r(d)?[d]:e(i(o(d)))}return nm=u,nm}var n3=r3(),i3=Sc(n3),s3={data:function(e){var a={field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(i){},beforeSet:function(i,s){},onSet:function(i){},canSet:function(i){return!0}};return e=et({},a,e),function(i,s){var o=e,u=this,d=u.length!==void 0,f=d?u:[u],h=d?u[0]:u;if(Xe(i)){var p=i.indexOf(".")!==-1,m=p&&i3(i);if(o.allowGetting&&s===void 0){var y;return h&&(o.beforeGet(h),m&&h._private[o.field][i]===void 0?y=Yk(h._private[o.field],m):y=h._private[o.field][i]),y}else if(o.allowSetting&&s!==void 0){var x=!o.immutableKeys[i];if(x){var E=BT({},i,s);o.beforeSet(u,E);for(var S=0,T=f.length;S<T;S++){var C=f[S];o.canSet(C)&&(m&&h._private[o.field][i]===void 0?t3(C._private[o.field],m,s):C._private[o.field][i]=s)}o.updateStyle&&u.updateStyle(),o.onSet(u),o.settingTriggersEvent&&u[o.triggerFnName](o.settingEvent)}}}else if(o.allowSetting&&wt(i)){var N=i,A,M,D=Object.keys(N);o.beforeSet(u,N);for(var j=0;j<D.length;j++){A=D[j],M=N[A];var R=!o.immutableKeys[A];if(R)for(var L=0;L<f.length;L++){var z=f[L];o.canSet(z)&&(z._private[o.field][A]=M)}}o.updateStyle&&u.updateStyle(),o.onSet(u),o.settingTriggersEvent&&u[o.triggerFnName](o.settingEvent)}else if(o.allowBinding&&Zt(i)){var _=i;u.on(o.bindingEvent,_)}else if(o.allowGetting&&i===void 0){var B;return h&&(o.beforeGet(h),B=h._private[o.field]),B}return u}},removeData:function(e){var a={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return e=et({},a,e),function(i){var s=e,o=this,u=o.length!==void 0,d=u?o:[o];if(Xe(i)){for(var f=i.split(/\s+/),h=f.length,p=0;p<h;p++){var m=f[p];if(!es(m)){var y=!s.immutableKeys[m];if(y)for(var x=0,E=d.length;x<E;x++)d[x]._private[s.field][m]=void 0}}s.triggerEvent&&o[s.triggerFnName](s.event)}else if(i===void 0){for(var S=0,T=d.length;S<T;S++)for(var C=d[S]._private[s.field],N=Object.keys(C),A=0;A<N.length;A++){var M=N[A],D=!s.immutableKeys[M];D&&(C[M]=void 0)}s.triggerEvent&&o[s.triggerFnName](s.event)}return o}}},l3={eventAliasesOn:function(e){var a=e;a.addListener=a.listen=a.bind=a.on,a.unlisten=a.unbind=a.off=a.removeListener,a.trigger=a.emit,a.pon=a.promiseOn=function(r,i){var s=this,o=Array.prototype.slice.call(arguments,0);return new Bo(function(u,d){var f=function(y){s.off.apply(s,p),u(y)},h=o.concat([f]),p=h.concat([]);s.on.apply(s,h)})}}},jt={};[hk,s3,l3].forEach(function(t){et(jt,t)});var o3={animate:jt.animate(),animation:jt.animation(),animated:jt.animated(),clearQueue:jt.clearQueue(),delay:jt.delay(),delayAnimation:jt.delayAnimation(),stop:jt.stop()},xf={classes:function(e){var a=this;if(e===void 0){var r=[];return a[0]._private.classes.forEach(function(x){return r.push(x)}),r}else _t(e)||(e=(e||"").match(/\S+/g)||[]);for(var i=[],s=new ko(e),o=0;o<a.length;o++){for(var u=a[o],d=u._private,f=d.classes,h=!1,p=0;p<e.length;p++){var m=e[p],y=f.has(m);if(!y){h=!0;break}}h||(h=f.size!==e.length),h&&(d.classes=s,i.push(u))}return i.length>0&&this.spawn(i).updateStyle().emit("class"),a},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var a=this[0];return a!=null&&a._private.classes.has(e)},toggleClass:function(e,a){_t(e)||(e=e.match(/\S+/g)||[]);for(var r=this,i=a===void 0,s=[],o=0,u=r.length;o<u;o++)for(var d=r[o],f=d._private.classes,h=!1,p=0;p<e.length;p++){var m=e[p],y=f.has(m),x=!1;a||i&&!y?(f.add(m),x=!0):(!a||i&&y)&&(f.delete(m),x=!0),!h&&x&&(s.push(d),h=!0)}return s.length>0&&this.spawn(s).updateStyle().emit("class"),r},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,a){var r=this;if(a==null)a=250;else if(a===0)return r;return r.addClass(e),setTimeout(function(){r.removeClass(e)},a),r}};xf.className=xf.classNames=xf.classes;var bt={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:wa,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};bt.variable="(?:[\\w-.]|(?:\\\\"+bt.metaChar+"))+";bt.className="(?:[\\w-]|(?:\\\\"+bt.metaChar+"))+";bt.value=bt.string+"|"+bt.number;bt.id=bt.variable;(function(){var t,e,a;for(t=bt.comparatorOp.split("|"),a=0;a<t.length;a++)e=t[a],bt.comparatorOp+="|@"+e;for(t=bt.comparatorOp.split("|"),a=0;a<t.length;a++)e=t[a],!(e.indexOf("!")>=0)&&e!=="="&&(bt.comparatorOp+="|\\!"+e)})();var zt=function(){return{checks:[]}},qe={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20},Jm=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(t,e){return s4(t.selector,e.selector)}),u3=(function(){for(var t={},e,a=0;a<Jm.length;a++)e=Jm[a],t[e.selector]=e.matches;return t})(),c3=function(e,a){return u3[e](a)},d3="("+Jm.map(function(t){return t.selector}).join("|")+")",Gl=function(e){return e.replace(new RegExp("\\\\("+bt.metaChar+")","g"),function(a,r){return r})},Oi=function(e,a,r){e[e.length-1]=r},e0=[{name:"group",query:!0,regex:"("+bt.group+")",populate:function(e,a,r){var i=ma(r,1),s=i[0];a.checks.push({type:qe.GROUP,value:s==="*"?s:s+"s"})}},{name:"state",query:!0,regex:d3,populate:function(e,a,r){var i=ma(r,1),s=i[0];a.checks.push({type:qe.STATE,value:s})}},{name:"id",query:!0,regex:"\\#("+bt.id+")",populate:function(e,a,r){var i=ma(r,1),s=i[0];a.checks.push({type:qe.ID,value:Gl(s)})}},{name:"className",query:!0,regex:"\\.("+bt.className+")",populate:function(e,a,r){var i=ma(r,1),s=i[0];a.checks.push({type:qe.CLASS,value:Gl(s)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+bt.variable+")\\s*\\]",populate:function(e,a,r){var i=ma(r,1),s=i[0];a.checks.push({type:qe.DATA_EXIST,field:Gl(s)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+bt.variable+")\\s*("+bt.comparatorOp+")\\s*("+bt.value+")\\s*\\]",populate:function(e,a,r){var i=ma(r,3),s=i[0],o=i[1],u=i[2],d=new RegExp("^"+bt.string+"$").exec(u)!=null;d?u=u.substring(1,u.length-1):u=parseFloat(u),a.checks.push({type:qe.DATA_COMPARE,field:Gl(s),operator:o,value:u})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+bt.boolOp+")\\s*("+bt.variable+")\\s*\\]",populate:function(e,a,r){var i=ma(r,2),s=i[0],o=i[1];a.checks.push({type:qe.DATA_BOOL,field:Gl(o),operator:s})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+bt.meta+")\\s*("+bt.comparatorOp+")\\s*("+bt.number+")\\s*\\]\\]",populate:function(e,a,r){var i=ma(r,3),s=i[0],o=i[1],u=i[2];a.checks.push({type:qe.META_COMPARE,field:Gl(s),operator:o,value:parseFloat(u)})}},{name:"nextQuery",separator:!0,regex:bt.separator,populate:function(e,a){var r=e.currentSubject,i=e.edgeCount,s=e.compoundCount,o=e[e.length-1];r!=null&&(o.subject=r,e.currentSubject=null),o.edgeCount=i,o.compoundCount=s,e.edgeCount=0,e.compoundCount=0;var u=e[e.length++]=zt();return u}},{name:"directedEdge",separator:!0,regex:bt.directedEdge,populate:function(e,a){if(e.currentSubject==null){var r=zt(),i=a,s=zt();return r.checks.push({type:qe.DIRECTED_EDGE,source:i,target:s}),Oi(e,a,r),e.edgeCount++,s}else{var o=zt(),u=a,d=zt();return o.checks.push({type:qe.NODE_SOURCE,source:u,target:d}),Oi(e,a,o),e.edgeCount++,d}}},{name:"undirectedEdge",separator:!0,regex:bt.undirectedEdge,populate:function(e,a){if(e.currentSubject==null){var r=zt(),i=a,s=zt();return r.checks.push({type:qe.UNDIRECTED_EDGE,nodes:[i,s]}),Oi(e,a,r),e.edgeCount++,s}else{var o=zt(),u=a,d=zt();return o.checks.push({type:qe.NODE_NEIGHBOR,node:u,neighbor:d}),Oi(e,a,o),d}}},{name:"child",separator:!0,regex:bt.child,populate:function(e,a){if(e.currentSubject==null){var r=zt(),i=zt(),s=e[e.length-1];return r.checks.push({type:qe.CHILD,parent:s,child:i}),Oi(e,a,r),e.compoundCount++,i}else if(e.currentSubject===a){var o=zt(),u=e[e.length-1],d=zt(),f=zt(),h=zt(),p=zt();return o.checks.push({type:qe.COMPOUND_SPLIT,left:u,right:d,subject:f}),f.checks=a.checks,a.checks=[{type:qe.TRUE}],p.checks.push({type:qe.TRUE}),d.checks.push({type:qe.PARENT,parent:p,child:h}),Oi(e,u,o),e.currentSubject=f,e.compoundCount++,h}else{var m=zt(),y=zt(),x=[{type:qe.PARENT,parent:m,child:y}];return m.checks=a.checks,a.checks=x,e.compoundCount++,y}}},{name:"descendant",separator:!0,regex:bt.descendant,populate:function(e,a){if(e.currentSubject==null){var r=zt(),i=zt(),s=e[e.length-1];return r.checks.push({type:qe.DESCENDANT,ancestor:s,descendant:i}),Oi(e,a,r),e.compoundCount++,i}else if(e.currentSubject===a){var o=zt(),u=e[e.length-1],d=zt(),f=zt(),h=zt(),p=zt();return o.checks.push({type:qe.COMPOUND_SPLIT,left:u,right:d,subject:f}),f.checks=a.checks,a.checks=[{type:qe.TRUE}],p.checks.push({type:qe.TRUE}),d.checks.push({type:qe.ANCESTOR,ancestor:p,descendant:h}),Oi(e,u,o),e.currentSubject=f,e.compoundCount++,h}else{var m=zt(),y=zt(),x=[{type:qe.ANCESTOR,ancestor:m,descendant:y}];return m.checks=a.checks,a.checks=x,e.compoundCount++,y}}},{name:"subject",modifier:!0,regex:bt.subject,populate:function(e,a){if(e.currentSubject!=null&&e.currentSubject!==a)return At("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=a;var r=e[e.length-1],i=r.checks[0],s=i==null?null:i.type;s===qe.DIRECTED_EDGE?i.type=qe.NODE_TARGET:s===qe.UNDIRECTED_EDGE&&(i.type=qe.NODE_NEIGHBOR,i.node=i.nodes[1],i.neighbor=i.nodes[0],i.nodes=null)}}];e0.forEach(function(t){return t.regexObj=new RegExp("^"+t.regex)});var f3=function(e){for(var a,r,i,s=0;s<e0.length;s++){var o=e0[s],u=o.name,d=e.match(o.regexObj);if(d!=null){r=d,a=o,i=u;var f=d[0];e=e.substring(f.length);break}}return{expr:a,match:r,name:i,remaining:e}},h3=function(e){var a=e.match(/^\s+/);if(a){var r=a[0];e=e.substring(r.length)}return e},v3=function(e){var a=this,r=a.inputText=e,i=a[0]=zt();for(a.length=1,r=h3(r);;){var s=f3(r);if(s.expr==null)return At("The selector `"+e+"`is invalid"),!1;var o=s.match.slice(1),u=s.expr.populate(a,i,o);if(u===!1)return!1;if(u!=null&&(i=u),r=s.remaining,r.match(/^\s*$/))break}var d=a[a.length-1];a.currentSubject!=null&&(d.subject=a.currentSubject),d.edgeCount=a.edgeCount,d.compoundCount=a.compoundCount;for(var f=0;f<a.length;f++){var h=a[f];if(h.compoundCount>0&&h.edgeCount>0)return At("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(h.edgeCount>1)return At("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;h.edgeCount===1&&At("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},p3=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(h){return h??""},a=function(h){return Xe(h)?'"'+h+'"':e(h)},r=function(h){return" "+h+" "},i=function(h,p){var m=h.type,y=h.value;switch(m){case qe.GROUP:{var x=e(y);return x.substring(0,x.length-1)}case qe.DATA_COMPARE:{var E=h.field,S=h.operator;return"["+E+r(e(S))+a(y)+"]"}case qe.DATA_BOOL:{var T=h.operator,C=h.field;return"["+e(T)+C+"]"}case qe.DATA_EXIST:{var N=h.field;return"["+N+"]"}case qe.META_COMPARE:{var A=h.operator,M=h.field;return"[["+M+r(e(A))+a(y)+"]]"}case qe.STATE:return y;case qe.ID:return"#"+y;case qe.CLASS:return"."+y;case qe.PARENT:case qe.CHILD:return s(h.parent,p)+r(">")+s(h.child,p);case qe.ANCESTOR:case qe.DESCENDANT:return s(h.ancestor,p)+" "+s(h.descendant,p);case qe.COMPOUND_SPLIT:{var D=s(h.left,p),j=s(h.subject,p),R=s(h.right,p);return D+(D.length>0?" ":"")+j+R}case qe.TRUE:return""}},s=function(h,p){return h.checks.reduce(function(m,y,x){return m+(p===h&&x===0?"$":"")+i(y,p)},"")},o="",u=0;u<this.length;u++){var d=this[u];o+=s(d,d.subject),this.length>1&&u<this.length-1&&(o+=", ")}return this.toStringCache=o,o},g3={parse:v3,toString:p3},bC=function(e,a,r){var i,s=Xe(e),o=Oe(e),u=Xe(r),d,f,h=!1,p=!1,m=!1;switch(a.indexOf("!")>=0&&(a=a.replace("!",""),p=!0),a.indexOf("@")>=0&&(a=a.replace("@",""),h=!0),(s||u||h)&&(d=!s&&!o?"":""+e,f=""+r),h&&(e=d=d.toLowerCase(),r=f=f.toLowerCase()),a){case"*=":i=d.indexOf(f)>=0;break;case"$=":i=d.indexOf(f,d.length-f.length)>=0;break;case"^=":i=d.indexOf(f)===0;break;case"=":i=e===r;break;case">":m=!0,i=e>r;break;case">=":m=!0,i=e>=r;break;case"<":m=!0,i=e<r;break;case"<=":m=!0,i=e<=r;break;default:i=!1;break}return p&&(e!=null||!m)&&(i=!i),i},m3=function(e,a){switch(a){case"?":return!!e;case"!":return!e;case"^":return e===void 0}},y3=function(e){return e!==void 0},$0=function(e,a){return e.data(a)},x3=function(e,a){return e[a]()},na=[],Ft=function(e,a){return e.checks.every(function(r){return na[r.type](r,a)})};na[qe.GROUP]=function(t,e){var a=t.value;return a==="*"||a===e.group()};na[qe.STATE]=function(t,e){var a=t.value;return c3(a,e)};na[qe.ID]=function(t,e){var a=t.value;return e.id()===a};na[qe.CLASS]=function(t,e){var a=t.value;return e.hasClass(a)};na[qe.META_COMPARE]=function(t,e){var a=t.field,r=t.operator,i=t.value;return bC(x3(e,a),r,i)};na[qe.DATA_COMPARE]=function(t,e){var a=t.field,r=t.operator,i=t.value;return bC($0(e,a),r,i)};na[qe.DATA_BOOL]=function(t,e){var a=t.field,r=t.operator;return m3($0(e,a),r)};na[qe.DATA_EXIST]=function(t,e){var a=t.field;return t.operator,y3($0(e,a))};na[qe.UNDIRECTED_EDGE]=function(t,e){var a=t.nodes[0],r=t.nodes[1],i=e.source(),s=e.target();return Ft(a,i)&&Ft(r,s)||Ft(r,i)&&Ft(a,s)};na[qe.NODE_NEIGHBOR]=function(t,e){return Ft(t.node,e)&&e.neighborhood().some(function(a){return a.isNode()&&Ft(t.neighbor,a)})};na[qe.DIRECTED_EDGE]=function(t,e){return Ft(t.source,e.source())&&Ft(t.target,e.target())};na[qe.NODE_SOURCE]=function(t,e){return Ft(t.source,e)&&e.outgoers().some(function(a){return a.isNode()&&Ft(t.target,a)})};na[qe.NODE_TARGET]=function(t,e){return Ft(t.target,e)&&e.incomers().some(function(a){return a.isNode()&&Ft(t.source,a)})};na[qe.CHILD]=function(t,e){return Ft(t.child,e)&&Ft(t.parent,e.parent())};na[qe.PARENT]=function(t,e){return Ft(t.parent,e)&&e.children().some(function(a){return Ft(t.child,a)})};na[qe.DESCENDANT]=function(t,e){return Ft(t.descendant,e)&&e.ancestors().some(function(a){return Ft(t.ancestor,a)})};na[qe.ANCESTOR]=function(t,e){return Ft(t.ancestor,e)&&e.descendants().some(function(a){return Ft(t.descendant,a)})};na[qe.COMPOUND_SPLIT]=function(t,e){return Ft(t.subject,e)&&Ft(t.left,e)&&Ft(t.right,e)};na[qe.TRUE]=function(){return!0};na[qe.COLLECTION]=function(t,e){var a=t.value;return a.has(e)};na[qe.FILTER]=function(t,e){var a=t.value;return a(e)};var b3=function(e){var a=this;if(a.length===1&&a[0].checks.length===1&&a[0].checks[0].type===qe.ID)return e.getElementById(a[0].checks[0].value).collection();var r=function(s){for(var o=0;o<a.length;o++){var u=a[o];if(Ft(u,s))return!0}return!1};return a.text()==null&&(r=function(){return!0}),e.filter(r)},w3=function(e){for(var a=this,r=0;r<a.length;r++){var i=a[r];if(Ft(i,e))return!0}return!1},S3={matches:w3,filter:b3},rs=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||Xe(e)&&e.match(/^\s*$/)||(Mr(e)?this.addQuery({checks:[{type:qe.COLLECTION,value:e.collection()}]}):Zt(e)?this.addQuery({checks:[{type:qe.FILTER,value:e}]}):Xe(e)?this.parse(e)||(this.invalid=!0):Qt("A selector must be created from a string; found "))},ns=rs.prototype;[g3,S3].forEach(function(t){return et(ns,t)});ns.text=function(){return this.inputText};ns.size=function(){return this.length};ns.eq=function(t){return this[t]};ns.sameText=function(t){return!this.invalid&&!t.invalid&&this.text()===t.text()};ns.addQuery=function(t){this[this.length++]=t};ns.selector=ns.toString;var Zi={allAre:function(e){var a=new rs(e);return this.every(function(r){return a.matches(r)})},is:function(e){var a=new rs(e);return this.some(function(r){return a.matches(r)})},some:function(e,a){for(var r=0;r<this.length;r++){var i=a?e.apply(a,[this[r],r,this]):e(this[r],r,this);if(i)return!0}return!1},every:function(e,a){for(var r=0;r<this.length;r++){var i=a?e.apply(a,[this[r],r,this]):e(this[r],r,this);if(!i)return!1}return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var a=this.length,r=e.length;return a!==r?!1:a===1?this[0]===e[0]:this.every(function(i){return e.hasElementWithId(i.id())})},anySame:function(e){return e=this.cy().collection(e),this.some(function(a){return e.hasElementWithId(a.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var a=this.neighborhood();return e.every(function(r){return a.hasElementWithId(r.id())})},contains:function(e){e=this.cy().collection(e);var a=this;return e.every(function(r){return a.hasElementWithId(r.id())})}};Zi.allAreNeighbours=Zi.allAreNeighbors;Zi.has=Zi.contains;Zi.equal=Zi.equals=Zi.same;var Kr=function(e,a){return function(i,s,o,u){var d=i,f=this,h;if(d==null?h="":Mr(d)&&d.length===1&&(h=d.id()),f.length===1&&h){var p=f[0]._private,m=p.traversalCache=p.traversalCache||{},y=m[a]=m[a]||[],x=Ws(h),E=y[x];return E||(y[x]=e.call(f,i,s,o,u))}else return e.call(f,i,s,o,u)}},Mo={parent:function(e){var a=[];if(this.length===1){var r=this[0]._private.parent;if(r)return r}for(var i=0;i<this.length;i++){var s=this[i],o=s._private.parent;o&&a.push(o)}return this.spawn(a,!0).filter(e)},parents:function(e){for(var a=[],r=this.parent();r.nonempty();){for(var i=0;i<r.length;i++){var s=r[i];a.push(s)}r=r.parent()}return this.spawn(a,!0).filter(e)},commonAncestors:function(e){for(var a,r=0;r<this.length;r++){var i=this[r],s=i.parents();a=a||s,a=a.intersect(s)}return a.filter(e)},orphans:function(e){return this.stdFilter(function(a){return a.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(a){return a.isChild()}).filter(e)},children:Kr(function(t){for(var e=[],a=0;a<this.length;a++)for(var r=this[a],i=r._private.children,s=0;s<i.length;s++)e.push(i[s]);return this.spawn(e,!0).filter(t)},"children"),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length!==0},isChildless:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length===0},isChild:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent!=null},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent==null},descendants:function(e){var a=[];function r(i){for(var s=0;s<i.length;s++){var o=i[s];a.push(o),o.children().nonempty()&&r(o.children())}}return r(this.children()),this.spawn(a,!0).filter(e)}};function X0(t,e,a,r){for(var i=[],s=new ko,o=t.cy(),u=o.hasCompoundNodes(),d=0;d<t.length;d++){var f=t[d];a?i.push(f):u&&r(i,s,f)}for(;i.length>0;){var h=i.shift();e(h),s.add(h.id()),u&&r(i,s,h)}return t}function wC(t,e,a){if(a.isParent())for(var r=a._private.children,i=0;i<r.length;i++){var s=r[i];e.has(s.id())||t.push(s)}}Mo.forEachDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return X0(this,t,e,wC)};function SC(t,e,a){if(a.isChild()){var r=a._private.parent;e.has(r.id())||t.push(r)}}Mo.forEachUp=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return X0(this,t,e,SC)};function E3(t,e,a){SC(t,e,a),wC(t,e,a)}Mo.forEachUpAndDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return X0(this,t,e,E3)};Mo.ancestors=Mo.parents;var tc,EC;tc=EC={data:jt.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:jt.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:jt.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:jt.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:jt.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:jt.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}};tc.attr=tc.data;tc.removeAttr=tc.removeData;var T3=EC,ch={};function im(t){return function(e){var a=this;if(e===void 0&&(e=!0),a.length!==0)if(a.isNode()&&!a.removed()){for(var r=0,i=a[0],s=i._private.edges,o=0;o<s.length;o++){var u=s[o];!e&&u.isLoop()||(r+=t(i,u))}return r}else return}}et(ch,{degree:im(function(t,e){return e.source().same(e.target())?2:1}),indegree:im(function(t,e){return e.target().same(t)?1:0}),outdegree:im(function(t,e){return e.source().same(t)?1:0})});function Ql(t,e){return function(a){for(var r,i=this.nodes(),s=0;s<i.length;s++){var o=i[s],u=o[t](a);u!==void 0&&(r===void 0||e(u,r))&&(r=u)}return r}}et(ch,{minDegree:Ql("degree",function(t,e){return t<e}),maxDegree:Ql("degree",function(t,e){return t>e}),minIndegree:Ql("indegree",function(t,e){return t<e}),maxIndegree:Ql("indegree",function(t,e){return t>e}),minOutdegree:Ql("outdegree",function(t,e){return t<e}),maxOutdegree:Ql("outdegree",function(t,e){return t>e})});et(ch,{totalDegree:function(e){for(var a=0,r=this.nodes(),i=0;i<r.length;i++)a+=r[i].degree(e);return a}});var rn,TC,CC=function(e,a,r){for(var i=0;i<e.length;i++){var s=e[i];if(!s.locked()){var o=s._private.position,u={x:a.x!=null?a.x-o.x:0,y:a.y!=null?a.y-o.y:0};s.isParent()&&!(u.x===0&&u.y===0)&&s.children().shift(u,r),s.dirtyBoundingBoxCache()}}},gS={field:"position",bindingEvent:"position",allowBinding:!0,allowSetting:!0,settingEvent:"position",settingTriggersEvent:!0,triggerFnName:"emitAndNotify",allowGetting:!0,validKeys:["x","y"],beforeGet:function(e){e.updateCompoundBounds()},beforeSet:function(e,a){CC(e,a,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};rn=TC={position:jt.data(gS),silentPosition:jt.data(et({},gS,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,a){CC(e,a,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,a){if(wt(e))a?this.silentPosition(e):this.position(e);else if(Zt(e)){var r=e,i=this.cy();i.startBatch();for(var s=0;s<this.length;s++){var o=this[s],u=void 0;(u=r(o,s))&&(a?o.silentPosition(u):o.position(u))}i.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,a,r){var i;if(wt(e)?(i={x:Oe(e.x)?e.x:0,y:Oe(e.y)?e.y:0},r=a):Xe(e)&&Oe(a)&&(i={x:0,y:0},i[e]=a),i!=null){var s=this.cy();s.startBatch();for(var o=0;o<this.length;o++){var u=this[o];if(!(s.hasCompoundNodes()&&u.isChild()&&u.ancestors().anySame(this))){var d=u.position(),f={x:d.x+i.x,y:d.y+i.y};r?u.silentPosition(f):u.position(f)}}s.endBatch()}return this},silentShift:function(e,a){return wt(e)?this.shift(e,!0):Xe(e)&&Oe(a)&&this.shift(e,a,!0),this},renderedPosition:function(e,a){var r=this[0],i=this.cy(),s=i.zoom(),o=i.pan(),u=wt(e)?e:void 0,d=u!==void 0||a!==void 0&&Xe(e);if(r&&r.isNode())if(d)for(var f=0;f<this.length;f++){var h=this[f];a!==void 0?h.position(e,(a-o[e])/s):u!==void 0&&h.position(JT(u,s,o))}else{var p=r.position();return u=nh(p,s,o),e===void 0?u:u[e]}else if(!d)return;return this},relativePosition:function(e,a){var r=this[0],i=this.cy(),s=wt(e)?e:void 0,o=s!==void 0||a!==void 0&&Xe(e),u=i.hasCompoundNodes();if(r&&r.isNode())if(o)for(var d=0;d<this.length;d++){var f=this[d],h=u?f.parent():null,p=h&&h.length>0,m=p;p&&(h=h[0]);var y=m?h.position():{x:0,y:0};a!==void 0?f.position(e,a+y[e]):s!==void 0&&f.position({x:s.x+y.x,y:s.y+y.y})}else{var x=r.position(),E=u?r.parent():null,S=E&&E.length>0,T=S;S&&(E=E[0]);var C=T?E.position():{x:0,y:0};return s={x:x.x-C.x,y:x.y-C.y},e===void 0?s:s[e]}else if(!o)return;return this}};rn.modelPosition=rn.point=rn.position;rn.modelPositions=rn.points=rn.positions;rn.renderedPoint=rn.renderedPosition;rn.relativePoint=rn.relativePosition;var C3=TC,oo,ds;oo=ds={};ds.renderedBoundingBox=function(t){var e=this.boundingBox(t),a=this.cy(),r=a.zoom(),i=a.pan(),s=e.x1*r+i.x,o=e.x2*r+i.x,u=e.y1*r+i.y,d=e.y2*r+i.y;return{x1:s,x2:o,y1:u,y2:d,w:o-s,h:d-u}};ds.dirtyCompoundBoundsCache=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();return!e.styleEnabled()||!e.hasCompoundNodes()?this:(this.forEachUp(function(a){if(a.isParent()){var r=a._private;r.compoundBoundsClean=!1,r.bbCache=null,t||a.emitAndNotify("bounds")}}),this)};ds.updateCompoundBounds=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();if(!e.styleEnabled()||!e.hasCompoundNodes())return this;if(!t&&e.batching())return this;function a(o){if(!o.isParent())return;var u=o._private,d=o.children(),f=o.pstyle("compound-sizing-wrt-labels").value==="include",h={width:{val:o.pstyle("min-width").pfValue,left:o.pstyle("min-width-bias-left"),right:o.pstyle("min-width-bias-right")},height:{val:o.pstyle("min-height").pfValue,top:o.pstyle("min-height-bias-top"),bottom:o.pstyle("min-height-bias-bottom")}},p=d.boundingBox({includeLabels:f,includeOverlays:!1,useCache:!1}),m=u.position;(p.w===0||p.h===0)&&(p={w:o.pstyle("width").pfValue,h:o.pstyle("height").pfValue},p.x1=m.x-p.w/2,p.x2=m.x+p.w/2,p.y1=m.y-p.h/2,p.y2=m.y+p.h/2);function y(L,z,_){var B=0,q=0,V=z+_;return L>0&&V>0&&(B=z/V*L,q=_/V*L),{biasDiff:B,biasComplementDiff:q}}function x(L,z,_,B){if(_.units==="%")switch(B){case"width":return L>0?_.pfValue*L:0;case"height":return z>0?_.pfValue*z:0;case"average":return L>0&&z>0?_.pfValue*(L+z)/2:0;case"min":return L>0&&z>0?L>z?_.pfValue*z:_.pfValue*L:0;case"max":return L>0&&z>0?L>z?_.pfValue*L:_.pfValue*z:0;default:return 0}else return _.units==="px"?_.pfValue:0}var E=h.width.left.value;h.width.left.units==="px"&&h.width.val>0&&(E=E*100/h.width.val);var S=h.width.right.value;h.width.right.units==="px"&&h.width.val>0&&(S=S*100/h.width.val);var T=h.height.top.value;h.height.top.units==="px"&&h.height.val>0&&(T=T*100/h.height.val);var C=h.height.bottom.value;h.height.bottom.units==="px"&&h.height.val>0&&(C=C*100/h.height.val);var N=y(h.width.val-p.w,E,S),A=N.biasDiff,M=N.biasComplementDiff,D=y(h.height.val-p.h,T,C),j=D.biasDiff,R=D.biasComplementDiff;u.autoPadding=x(p.w,p.h,o.pstyle("padding"),o.pstyle("padding-relative-to").value),u.autoWidth=Math.max(p.w,h.width.val),m.x=(-A+p.x1+p.x2+M)/2,u.autoHeight=Math.max(p.h,h.height.val),m.y=(-j+p.y1+p.y2+R)/2}for(var r=0;r<this.length;r++){var i=this[r],s=i._private;(!s.compoundBoundsClean||t)&&(a(i),e.batching()||(s.compoundBoundsClean=!0))}return this};var Yr=function(e){return e===1/0||e===-1/0?0:e},tn=function(e,a,r,i,s){i-a===0||s-r===0||a==null||r==null||i==null||s==null||(e.x1=a<e.x1?a:e.x1,e.x2=i>e.x2?i:e.x2,e.y1=r<e.y1?r:e.y1,e.y2=s>e.y2?s:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},Bi=function(e,a){return a==null?e:tn(e,a.x1,a.y1,a.x2,a.y2)},Ru=function(e,a,r){return gr(e,a,r)},rf=function(e,a,r){if(!a.cy().headless()){var i=a._private,s=i.rstyle,o=s.arrowWidth/2,u=a.pstyle(r+"-arrow-shape").value,d,f;if(u!=="none"){r==="source"?(d=s.srcX,f=s.srcY):r==="target"?(d=s.tgtX,f=s.tgtY):(d=s.midX,f=s.midY);var h=i.arrowBounds=i.arrowBounds||{},p=h[r]=h[r]||{};p.x1=d-o,p.y1=f-o,p.x2=d+o,p.y2=f+o,p.w=p.x2-p.x1,p.h=p.y2-p.y1,mf(p,1),tn(e,p.x1,p.y1,p.x2,p.y2)}}},sm=function(e,a,r){if(!a.cy().headless()){var i;r?i=r+"-":i="";var s=a._private,o=s.rstyle,u=a.pstyle(i+"label").strValue;if(u){var d=a.pstyle("text-halign"),f=a.pstyle("text-valign"),h=Ru(o,"labelWidth",r),p=Ru(o,"labelHeight",r),m=Ru(o,"labelX",r),y=Ru(o,"labelY",r),x=a.pstyle(i+"text-margin-x").pfValue,E=a.pstyle(i+"text-margin-y").pfValue,S=a.isEdge(),T=a.pstyle(i+"text-rotation"),C=a.pstyle("text-outline-width").pfValue,N=a.pstyle("text-border-width").pfValue,A=N/2,M=a.pstyle("text-background-padding").pfValue,D=2,j=p,R=h,L=R/2,z=j/2,_,B,q,V;if(S)_=m-L,B=m+L,q=y-z,V=y+z;else{switch(d.value){case"left":_=m-R,B=m;break;case"center":_=m-L,B=m+L;break;case"right":_=m,B=m+R;break}switch(f.value){case"top":q=y-j,V=y;break;case"center":q=y-z,V=y+z;break;case"bottom":q=y,V=y+j;break}}var Q=x-Math.max(C,A)-M-D,P=x+Math.max(C,A)+M+D,U=E-Math.max(C,A)-M-D,F=E+Math.max(C,A)+M+D;_+=Q,B+=P,q+=U,V+=F;var K=r||"main",J=s.labelBounds,k=J[K]=J[K]||{};k.x1=_,k.y1=q,k.x2=B,k.y2=V,k.w=B-_,k.h=V-q,k.leftPad=Q,k.rightPad=P,k.topPad=U,k.botPad=F;var G=S&&T.strValue==="autorotate",X=T.pfValue!=null&&T.pfValue!==0;if(G||X){var W=G?Ru(s.rstyle,"labelAngle",r):T.pfValue,$=Math.cos(W),ee=Math.sin(W),ie=(_+B)/2,he=(q+V)/2;if(!S){switch(d.value){case"left":ie=B;break;case"right":ie=_;break}switch(f.value){case"top":he=V;break;case"bottom":he=q;break}}var oe=function(He,Se){return He=He-ie,Se=Se-he,{x:He*$-Se*ee+ie,y:He*ee+Se*$+he}},ae=oe(_,q),re=oe(_,V),le=oe(B,q),se=oe(B,V);_=Math.min(ae.x,re.x,le.x,se.x),B=Math.max(ae.x,re.x,le.x,se.x),q=Math.min(ae.y,re.y,le.y,se.y),V=Math.max(ae.y,re.y,le.y,se.y)}var Ne=K+"Rot",Ae=J[Ne]=J[Ne]||{};Ae.x1=_,Ae.y1=q,Ae.x2=B,Ae.y2=V,Ae.w=B-_,Ae.h=V-q,tn(e,_,q,B,V),tn(s.labelBounds.all,_,q,B,V)}return e}},mS=function(e,a){if(!a.cy().headless()){var r=a.pstyle("outline-opacity").value,i=a.pstyle("outline-width").value,s=a.pstyle("outline-offset").value,o=i+s;NC(e,a,r,o,"outside",o/2)}},NC=function(e,a,r,i,s,o){if(!(r===0||i<=0||s==="inside")){var u=a.cy(),d=a.pstyle("shape").value,f=u.renderer().nodeShapes[d],h=a.position(),p=h.x,m=h.y,y=a.width(),x=a.height();if(f.hasMiterBounds){s==="center"&&(i/=2);var E=f.miterBounds(p,m,y,x,i);Bi(e,E)}else o!=null&&o>0&&yf(e,[o,o,o,o])}},N3=function(e,a){if(!a.cy().headless()){var r=a.pstyle("border-opacity").value,i=a.pstyle("border-width").pfValue,s=a.pstyle("border-position").value;NC(e,a,r,i,s)}},j3=function(e,a){var r=e._private.cy,i=r.styleEnabled(),s=r.headless(),o=nr(),u=e._private,d=e.isNode(),f=e.isEdge(),h,p,m,y,x,E,S=u.rstyle,T=d&&i?e.pstyle("bounds-expansion").pfValue:[0],C=function(We){return We.pstyle("display").value!=="none"},N=!i||C(e)&&(!f||C(e.source())&&C(e.target()));if(N){var A=0,M=0;i&&a.includeOverlays&&(A=e.pstyle("overlay-opacity").value,A!==0&&(M=e.pstyle("overlay-padding").value));var D=0,j=0;i&&a.includeUnderlays&&(D=e.pstyle("underlay-opacity").value,D!==0&&(j=e.pstyle("underlay-padding").value));var R=Math.max(M,j),L=0,z=0;if(i&&(L=e.pstyle("width").pfValue,z=L/2),d&&a.includeNodes){var _=e.position();x=_.x,E=_.y;var B=e.outerWidth(),q=B/2,V=e.outerHeight(),Q=V/2;h=x-q,p=x+q,m=E-Q,y=E+Q,tn(o,h,m,p,y),i&&mS(o,e),i&&a.includeOutlines&&!s&&mS(o,e),i&&N3(o,e)}else if(f&&a.includeEdges)if(i&&!s){var P=e.pstyle("curve-style").strValue;if(h=Math.min(S.srcX,S.midX,S.tgtX),p=Math.max(S.srcX,S.midX,S.tgtX),m=Math.min(S.srcY,S.midY,S.tgtY),y=Math.max(S.srcY,S.midY,S.tgtY),h-=z,p+=z,m-=z,y+=z,tn(o,h,m,p,y),P==="haystack"){var U=S.haystackPts;if(U&&U.length===2){if(h=U[0].x,m=U[0].y,p=U[1].x,y=U[1].y,h>p){var F=h;h=p,p=F}if(m>y){var K=m;m=y,y=K}tn(o,h-z,m-z,p+z,y+z)}}else if(P==="bezier"||P==="unbundled-bezier"||Qi(P,"segments")||Qi(P,"taxi")){var J;switch(P){case"bezier":case"unbundled-bezier":J=S.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":J=S.linePts;break}if(J!=null)for(var k=0;k<J.length;k++){var G=J[k];h=G.x-z,p=G.x+z,m=G.y-z,y=G.y+z,tn(o,h,m,p,y)}}}else{var X=e.source(),W=X.position(),$=e.target(),ee=$.position();if(h=W.x,p=ee.x,m=W.y,y=ee.y,h>p){var ie=h;h=p,p=ie}if(m>y){var he=m;m=y,y=he}h-=z,p+=z,m-=z,y+=z,tn(o,h,m,p,y)}if(i&&a.includeEdges&&f&&(rf(o,e,"mid-source"),rf(o,e,"mid-target"),rf(o,e,"source"),rf(o,e,"target")),i){var oe=e.pstyle("ghost").value==="yes";if(oe){var ae=e.pstyle("ghost-offset-x").pfValue,re=e.pstyle("ghost-offset-y").pfValue;tn(o,o.x1+ae,o.y1+re,o.x2+ae,o.y2+re)}}var le=u.bodyBounds=u.bodyBounds||{};aw(le,o),yf(le,T),mf(le,1),i&&(h=o.x1,p=o.x2,m=o.y1,y=o.y2,tn(o,h-R,m-R,p+R,y+R));var se=u.overlayBounds=u.overlayBounds||{};aw(se,o),yf(se,T),mf(se,1);var Ne=u.labelBounds=u.labelBounds||{};Ne.all!=null?oR(Ne.all):Ne.all=nr(),i&&a.includeLabels&&(a.includeMainLabels&&sm(o,e,null),f&&(a.includeSourceLabels&&sm(o,e,"source"),a.includeTargetLabels&&sm(o,e,"target")))}return o.x1=Yr(o.x1),o.y1=Yr(o.y1),o.x2=Yr(o.x2),o.y2=Yr(o.y2),o.w=Yr(o.x2-o.x1),o.h=Yr(o.y2-o.y1),o.w>0&&o.h>0&&N&&(yf(o,T),mf(o,1)),o},jC=function(e){var a=0,r=function(o){return(o?1:0)<<a++},i=0;return i+=r(e.incudeNodes),i+=r(e.includeEdges),i+=r(e.includeLabels),i+=r(e.includeMainLabels),i+=r(e.includeSourceLabels),i+=r(e.includeTargetLabels),i+=r(e.includeOverlays),i+=r(e.includeOutlines),i},AC=function(e){var a=function(u){return Math.round(u)};if(e.isEdge()){var r=e.source().position(),i=e.target().position();return X2([a(r.x),a(r.y),a(i.x),a(i.y)])}else{var s=e.position();return X2([a(s.x),a(s.y)])}},yS=function(e,a){var r=e._private,i,s=e.isEdge(),o=a==null?xS:jC(a),u=o===xS;if(r.bbCache==null?(i=j3(e,ac),r.bbCache=i,r.bbCachePosKey=AC(e)):i=r.bbCache,!u){var d=e.isNode();i=nr(),(a.includeNodes&&d||a.includeEdges&&!d)&&(a.includeOverlays?Bi(i,r.overlayBounds):Bi(i,r.bodyBounds)),a.includeLabels&&(a.includeMainLabels&&(!s||a.includeSourceLabels&&a.includeTargetLabels)?Bi(i,r.labelBounds.all):(a.includeMainLabels&&Bi(i,r.labelBounds.mainRot),a.includeSourceLabels&&Bi(i,r.labelBounds.sourceRot),a.includeTargetLabels&&Bi(i,r.labelBounds.targetRot))),i.w=i.x2-i.x1,i.h=i.y2-i.y1}return i},ac={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},xS=jC(ac),bS=Fa(ac);ds.boundingBox=function(t){var e,a=t===void 0||t.useCache===void 0||t.useCache===!0,r=jo(function(h){var p=h._private;return p.bbCache==null||p.styleDirty||p.bbCachePosKey!==AC(h)},function(h){return h.id()});if(a&&this.length===1&&!r(this[0]))t===void 0?t=ac:t=bS(t),e=yS(this[0],t);else{e=nr(),t=t||ac;var i=bS(t),s=this,o=s.cy(),u=o.styleEnabled();this.edges().forEach(r),this.nodes().forEach(r),u&&this.recalculateRenderedStyle(a),this.updateCompoundBounds(!a);for(var d=0;d<s.length;d++){var f=s[d];r(f)&&f.dirtyBoundingBoxCache(),Bi(e,yS(f,i))}}return e.x1=Yr(e.x1),e.y1=Yr(e.y1),e.x2=Yr(e.x2),e.y2=Yr(e.y2),e.w=Yr(e.x2-e.x1),e.h=Yr(e.y2-e.y1),e};ds.dirtyBoundingBoxCache=function(){for(var t=0;t<this.length;t++){var e=this[t]._private;e.bbCache=null,e.bbCachePosKey=null,e.bodyBounds=null,e.overlayBounds=null,e.labelBounds.all=null,e.labelBounds.source=null,e.labelBounds.target=null,e.labelBounds.main=null,e.labelBounds.sourceRot=null,e.labelBounds.targetRot=null,e.labelBounds.mainRot=null,e.arrowBounds.source=null,e.arrowBounds.target=null,e.arrowBounds["mid-source"]=null,e.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this};ds.boundingBoxAt=function(t){var e=this.nodes(),a=this.cy(),r=a.hasCompoundNodes(),i=a.collection();if(r&&(i=e.filter(function(f){return f.isParent()}),e=e.not(i)),wt(t)){var s=t;t=function(){return s}}var o=function(h,p){return h._private.bbAtOldPos=t(h,p)},u=function(h){return h._private.bbAtOldPos};a.startBatch(),e.forEach(o).silentPositions(t),r&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0));var d=lR(this.boundingBox({useCache:!1}));return e.silentPositions(u),r&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0)),a.endBatch(),d};oo.boundingbox=oo.bb=oo.boundingBox;oo.renderedBoundingbox=oo.renderedBoundingBox;var A3=ds,qu,jc;qu=jc={};var MC=function(e){e.uppercaseName=L2(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=L2(e.outerName),qu[e.name]=function(){var r=this[0],i=r._private,s=i.cy,o=s._private.styleEnabled;if(r)if(o){if(r.isParent())return r.updateCompoundBounds(),i[e.autoName]||0;var u=r.pstyle(e.name);switch(u.strValue){case"label":return r.recalculateRenderedStyle(),i.rstyle[e.labelName]||0;default:return u.pfValue}}else return 1},qu["outer"+e.uppercaseName]=function(){var r=this[0],i=r._private,s=i.cy,o=s._private.styleEnabled;if(r)if(o){var u=r[e.name](),d=r.pstyle("border-position").value,f;d==="center"?f=r.pstyle("border-width").pfValue:d==="outside"?f=2*r.pstyle("border-width").pfValue:f=0;var h=2*r.padding();return u+f+h}else return 1},qu["rendered"+e.uppercaseName]=function(){var r=this[0];if(r){var i=r[e.name]();return i*this.cy().zoom()}},qu["rendered"+e.uppercaseOuterName]=function(){var r=this[0];if(r){var i=r[e.outerName]();return i*this.cy().zoom()}}};MC({name:"width"});MC({name:"height"});jc.padding=function(){var t=this[0],e=t._private;return t.isParent()?(t.updateCompoundBounds(),e.autoPadding!==void 0?e.autoPadding:t.pstyle("padding").pfValue):t.pstyle("padding").pfValue};jc.paddedHeight=function(){var t=this[0];return t.height()+2*t.padding()};jc.paddedWidth=function(){var t=this[0];return t.width()+2*t.padding()};var M3=jc,D3=function(e,a){if(e.isEdge()&&e.takesUpSpace())return a(e)},O3=function(e,a){if(e.isEdge()&&e.takesUpSpace()){var r=e.cy();return nh(a(e),r.zoom(),r.pan())}},R3=function(e,a){if(e.isEdge()&&e.takesUpSpace()){var r=e.cy(),i=r.pan(),s=r.zoom();return a(e).map(function(o){return nh(o,s,i)})}},k3=function(e){return e.renderer().getControlPoints(e)},B3=function(e){return e.renderer().getSegmentPoints(e)},L3=function(e){return e.renderer().getSourceEndpoint(e)},z3=function(e){return e.renderer().getTargetEndpoint(e)},P3=function(e){return e.renderer().getEdgeMidpoint(e)},wS={controlPoints:{get:k3,mult:!0},segmentPoints:{get:B3,mult:!0},sourceEndpoint:{get:L3},targetEndpoint:{get:z3},midpoint:{get:P3}},_3=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)},U3=Object.keys(wS).reduce(function(t,e){var a=wS[e],r=_3(e);return t[e]=function(){return D3(this,a.get)},a.mult?t[r]=function(){return R3(this,a.get)}:t[r]=function(){return O3(this,a.get)},t},{}),q3=et({},C3,A3,M3,U3);/*!
|
|
87
|
+
Event object based on jQuery events, MIT license
|
|
88
|
+
|
|
89
|
+
https://jquery.org/license/
|
|
90
|
+
https://tldrlegal.com/license/mit-license
|
|
91
|
+
https://github.com/jquery/jquery/blob/master/src/event.js
|
|
92
|
+
*/var DC=function(e,a){this.recycle(e,a)};function ku(){return!1}function nf(){return!0}DC.prototype={instanceString:function(){return"event"},recycle:function(e,a){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=ku,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?nf:ku):e!=null&&e.type?a=e:this.type=e,a!=null&&(this.originalEvent=a.originalEvent,this.type=a.type!=null?a.type:this.type,this.cy=a.cy,this.target=a.target,this.position=a.position,this.renderedPosition=a.renderedPosition,this.namespace=a.namespace,this.layout=a.layout),this.cy!=null&&this.position!=null&&this.renderedPosition==null){var r=this.position,i=this.cy.zoom(),s=this.cy.pan();this.renderedPosition={x:r.x*i+s.x,y:r.y*i+s.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=nf;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=nf;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=nf,this.stopPropagation()},isDefaultPrevented:ku,isPropagationStopped:ku,isImmediatePropagationStopped:ku};var OC=/^([^.]+)(\.(?:[^.]+))?$/,I3=".*",RC={qualifierCompare:function(e,a){return e===a},eventMatches:function(){return!0},addEventFields:function(){},callbackContext:function(e){return e},beforeEmit:function(){},afterEmit:function(){},bubble:function(){return!1},parent:function(){return null},context:null},SS=Object.keys(RC),V3={};function dh(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:V3,e=arguments.length>1?arguments[1]:void 0,a=0;a<SS.length;a++){var r=SS[a];this[r]=t[r]||RC[r]}this.context=e||this.context,this.listeners=[],this.emitting=0}var is=dh.prototype,kC=function(e,a,r,i,s,o,u){Zt(i)&&(s=i,i=null),u&&(o==null?o=u:o=et({},o,u));for(var d=_t(r)?r:r.split(/\s+/),f=0;f<d.length;f++){var h=d[f];if(!es(h)){var p=h.match(OC);if(p){var m=p[1],y=p[2]?p[2]:null,x=a(e,h,m,y,i,s,o);if(x===!1)break}}}},ES=function(e,a){return e.addEventFields(e.context,a),new DC(a.type,a)},F3=function(e,a,r){if($O(r)){a(e,r);return}else if(wt(r)){a(e,ES(e,r));return}for(var i=_t(r)?r:r.split(/\s+/),s=0;s<i.length;s++){var o=i[s];if(!es(o)){var u=o.match(OC);if(u){var d=u[1],f=u[2]?u[2]:null,h=ES(e,{type:d,namespace:f,target:e.context});a(e,h)}}}};is.on=is.addListener=function(t,e,a,r,i){return kC(this,function(s,o,u,d,f,h,p){Zt(h)&&s.listeners.push({event:o,callback:h,type:u,namespace:d,qualifier:f,conf:p})},t,e,a,r,i),this};is.one=function(t,e,a,r){return this.on(t,e,a,r,{one:!0})};is.removeListener=is.off=function(t,e,a,r){var i=this;this.emitting!==0&&(this.listeners=O4(this.listeners));for(var s=this.listeners,o=function(f){var h=s[f];kC(i,function(p,m,y,x,E,S){if((h.type===y||t==="*")&&(!x&&h.namespace!==".*"||h.namespace===x)&&(!E||p.qualifierCompare(h.qualifier,E))&&(!S||h.callback===S))return s.splice(f,1),!1},t,e,a,r)},u=s.length-1;u>=0;u--)o(u);return this};is.removeAllListeners=function(){return this.removeListener("*")};is.emit=is.trigger=function(t,e,a){var r=this.listeners,i=r.length;return this.emitting++,_t(e)||(e=[e]),F3(this,function(s,o){a!=null&&(r=[{event:o.event,type:o.type,namespace:o.namespace,callback:a}],i=r.length);for(var u=function(){var h=r[d];if(h.type===o.type&&(!h.namespace||h.namespace===o.namespace||h.namespace===I3)&&s.eventMatches(s.context,h,o)){var p=[o];e!=null&&k4(p,e),s.beforeEmit(s.context,h,o),h.conf&&h.conf.one&&(s.listeners=s.listeners.filter(function(x){return x!==h}));var m=s.callbackContext(s.context,h,o),y=h.callback.apply(m,p);s.afterEmit(s.context,h,o),y===!1&&(o.stopPropagation(),o.preventDefault())}},d=0;d<i;d++)u();s.bubble(s.context)&&!o.isPropagationStopped()&&s.parent(s.context).emit(o,e)},t),this.emitting--,this};var H3={qualifierCompare:function(e,a){return e==null||a==null?e==null&&a==null:e.sameText(a)},eventMatches:function(e,a,r){var i=a.qualifier;return i!=null?e!==r.target&&wc(r.target)&&i.matches(r.target):!0},addEventFields:function(e,a){a.cy=e.cy(),a.target=e},callbackContext:function(e,a,r){return a.qualifier!=null?r.target:e},beforeEmit:function(e,a){a.conf&&a.conf.once&&a.conf.onceCollection.removeListener(a.event,a.qualifier,a.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},sf=function(e){return Xe(e)?new rs(e):e},BC={createEmitter:function(){for(var e=0;e<this.length;e++){var a=this[e],r=a._private;r.emitter||(r.emitter=new dh(H3,a))}return this},emitter:function(){return this._private.emitter},on:function(e,a,r){for(var i=sf(a),s=0;s<this.length;s++){var o=this[s];o.emitter().on(e,i,r)}return this},removeListener:function(e,a,r){for(var i=sf(a),s=0;s<this.length;s++){var o=this[s];o.emitter().removeListener(e,i,r)}return this},removeAllListeners:function(){for(var e=0;e<this.length;e++){var a=this[e];a.emitter().removeAllListeners()}return this},one:function(e,a,r){for(var i=sf(a),s=0;s<this.length;s++){var o=this[s];o.emitter().one(e,i,r)}return this},once:function(e,a,r){for(var i=sf(a),s=0;s<this.length;s++){var o=this[s];o.emitter().on(e,i,r,{once:!0,onceCollection:this})}},emit:function(e,a){for(var r=0;r<this.length;r++){var i=this[r];i.emitter().emit(e,a)}return this},emitAndNotify:function(e,a){if(this.length!==0)return this.cy().notify(e,this),this.emit(e,a),this}};jt.eventAliasesOn(BC);var LC={nodes:function(e){return this.filter(function(a){return a.isNode()}).filter(e)},edges:function(e){return this.filter(function(a){return a.isEdge()}).filter(e)},byGroup:function(){for(var e=this.spawn(),a=this.spawn(),r=0;r<this.length;r++){var i=this[r];i.isNode()?e.push(i):a.push(i)}return{nodes:e,edges:a}},filter:function(e,a){if(e===void 0)return this;if(Xe(e)||Mr(e))return new rs(e).filter(this);if(Zt(e)){for(var r=this.spawn(),i=this,s=0;s<i.length;s++){var o=i[s],u=a?e.apply(a,[o,s,i]):e(o,s,i);u&&r.push(o)}return r}return this.spawn()},not:function(e){if(e){Xe(e)&&(e=this.filter(e));for(var a=this.spawn(),r=0;r<this.length;r++){var i=this[r],s=e.has(i);s||a.push(i)}return a}else return this},absoluteComplement:function(){var e=this.cy();return e.mutableElements().not(this)},intersect:function(e){if(Xe(e)){var a=e;return this.filter(a)}for(var r=this.spawn(),i=this,s=e,o=this.length<e.length,u=o?i:s,d=o?s:i,f=0;f<u.length;f++){var h=u[f];d.has(h)&&r.push(h)}return r},xor:function(e){var a=this._private.cy;Xe(e)&&(e=a.$(e));var r=this.spawn(),i=this,s=e,o=function(d,f){for(var h=0;h<d.length;h++){var p=d[h],m=p._private.data.id,y=f.hasElementWithId(m);y||r.push(p)}};return o(i,s),o(s,i),r},diff:function(e){var a=this._private.cy;Xe(e)&&(e=a.$(e));var r=this.spawn(),i=this.spawn(),s=this.spawn(),o=this,u=e,d=function(h,p,m){for(var y=0;y<h.length;y++){var x=h[y],E=x._private.data.id,S=p.hasElementWithId(E);S?s.merge(x):m.push(x)}};return d(o,u,r),d(u,o,i),{left:r,right:i,both:s}},add:function(e){var a=this._private.cy;if(!e)return this;if(Xe(e)){var r=e;e=a.mutableElements().filter(r)}for(var i=this.spawnSelf(),s=0;s<e.length;s++){var o=e[s],u=!this.has(o);u&&i.push(o)}return i},merge:function(e){var a=this._private,r=a.cy;if(!e)return this;if(e&&Xe(e)){var i=e;e=r.mutableElements().filter(i)}for(var s=a.map,o=0;o<e.length;o++){var u=e[o],d=u._private.data.id,f=!s.has(d);if(f){var h=this.length++;this[h]=u,s.set(d,{ele:u,index:h})}}return this},unmergeAt:function(e){var a=this[e],r=a.id(),i=this._private,s=i.map;this[e]=void 0,s.delete(r);var o=e===this.length-1;if(this.length>1&&!o){var u=this.length-1,d=this[u],f=d._private.data.id;this[u]=void 0,this[e]=d,s.set(f,{ele:d,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var a=this._private,r=e._private.data.id,i=a.map,s=i.get(r);if(!s)return this;var o=s.index;return this.unmergeAt(o),this},unmerge:function(e){var a=this._private.cy;if(!e)return this;if(e&&Xe(e)){var r=e;e=a.mutableElements().filter(r)}for(var i=0;i<e.length;i++)this.unmergeOne(e[i]);return this},unmergeBy:function(e){for(var a=this.length-1;a>=0;a--){var r=this[a];e(r)&&this.unmergeAt(a)}return this},map:function(e,a){for(var r=[],i=this,s=0;s<i.length;s++){var o=i[s],u=a?e.apply(a,[o,s,i]):e(o,s,i);r.push(u)}return r},reduce:function(e,a){for(var r=a,i=this,s=0;s<i.length;s++)r=e(r,i[s],s,i);return r},max:function(e,a){for(var r=-1/0,i,s=this,o=0;o<s.length;o++){var u=s[o],d=a?e.apply(a,[u,o,s]):e(u,o,s);d>r&&(r=d,i=u)}return{value:r,ele:i}},min:function(e,a){for(var r=1/0,i,s=this,o=0;o<s.length;o++){var u=s[o],d=a?e.apply(a,[u,o,s]):e(u,o,s);d<r&&(r=d,i=u)}return{value:r,ele:i}}},Ct=LC;Ct.u=Ct["|"]=Ct["+"]=Ct.union=Ct.or=Ct.add;Ct["\\"]=Ct["!"]=Ct["-"]=Ct.difference=Ct.relativeComplement=Ct.subtract=Ct.not;Ct.n=Ct["&"]=Ct["."]=Ct.and=Ct.intersection=Ct.intersect;Ct["^"]=Ct["(+)"]=Ct["(-)"]=Ct.symmetricDifference=Ct.symdiff=Ct.xor;Ct.fnFilter=Ct.filterFn=Ct.stdFilter=Ct.filter;Ct.complement=Ct.abscomp=Ct.absoluteComplement;var G3={isNode:function(){return this.group()==="nodes"},isEdge:function(){return this.group()==="edges"},isLoop:function(){return this.isEdge()&&this.source()[0]===this.target()[0]},isSimple:function(){return this.isEdge()&&this.source()[0]!==this.target()[0]},group:function(){var e=this[0];if(e)return e._private.group}},zC=function(e,a){var r=e.cy(),i=r.hasCompoundNodes();function s(h){var p=h.pstyle("z-compound-depth");return p.value==="auto"?i?h.zDepth():0:p.value==="bottom"?-1:p.value==="top"?U0:0}var o=s(e)-s(a);if(o!==0)return o;function u(h){var p=h.pstyle("z-index-compare");return p.value==="auto"&&h.isNode()?1:0}var d=u(e)-u(a);if(d!==0)return d;var f=e.pstyle("z-index").value-a.pstyle("z-index").value;return f!==0?f:e.poolIndex()-a.poolIndex()},If={forEach:function(e,a){if(Zt(e))for(var r=this.length,i=0;i<r;i++){var s=this[i],o=a?e.apply(a,[s,i,this]):e(s,i,this);if(o===!1)break}return this},toArray:function(){for(var e=[],a=0;a<this.length;a++)e.push(this[a]);return e},slice:function(e,a){var r=[],i=this.length;a==null&&(a=i),e==null&&(e=0),e<0&&(e=i+e),a<0&&(a=i+a);for(var s=e;s>=0&&s<a&&s<i;s++)r.push(this[s]);return this.spawn(r)},size:function(){return this.length},eq:function(e){return this[e]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return this.length===0},nonempty:function(){return!this.empty()},sort:function(e){if(!Zt(e))return this;var a=this.toArray().sort(e);return this.spawn(a)},sortByZIndex:function(){return this.sort(zC)},zDepth:function(){var e=this[0];if(e){var a=e._private,r=a.group;if(r==="nodes"){var i=a.data.parent?e.parents().size():0;return e.isParent()?i:U0-1}else{var s=a.source,o=a.target,u=s.zDepth(),d=o.zDepth();return Math.max(u,d,0)}}}};If.each=If.forEach;var Q3=function(){var e="undefined",a=(typeof Symbol>"u"?"undefined":Sa(Symbol))!=e&&Sa(Symbol.iterator)!=e;a&&(If[Symbol.iterator]=function(){var r=this,i={value:void 0,done:!1},s=0,o=this.length;return BT({next:function(){return s<o?i.value=r[s++]:(i.value=void 0,i.done=!0),i}},Symbol.iterator,function(){return this})})};Q3();var Y3=Fa({nodeDimensionsIncludeLabels:!1}),bf={layoutDimensions:function(e){e=Y3(e);var a;if(!this.takesUpSpace())a={w:0,h:0};else if(e.nodeDimensionsIncludeLabels){var r=this.boundingBox();a={w:r.w,h:r.h}}else a={w:this.outerWidth(),h:this.outerHeight()};return(a.w===0||a.h===0)&&(a.w=a.h=1),a},layoutPositions:function(e,a,r){var i=this.nodes().filter(function(M){return!M.isParent()}),s=this.cy(),o=a.eles,u=function(D){return D.id()},d=jo(r,u);e.emit({type:"layoutstart",layout:e}),e.animations=[];var f=function(D,j,R){var L={x:j.x1+j.w/2,y:j.y1+j.h/2},z={x:(R.x-L.x)*D,y:(R.y-L.y)*D};return{x:L.x+z.x,y:L.y+z.y}},h=a.spacingFactor&&a.spacingFactor!==1,p=function(){if(!h)return null;for(var D=nr(),j=0;j<i.length;j++){var R=i[j],L=d(R,j);eC(D,L.x,L.y)}return D},m=p(),y=jo(function(M,D){var j=d(M,D);if(h){var R=Math.abs(a.spacingFactor);j=f(R,m,j)}return a.transform!=null&&(j=a.transform(M,j)),j},u);if(a.animate){for(var x=0;x<i.length;x++){var E=i[x],S=y(E,x),T=a.animateFilter==null||a.animateFilter(E,x);if(T){var C=E.animation({position:S,duration:a.animationDuration,easing:a.animationEasing});e.animations.push(C)}else E.position(S)}if(a.fit){var N=s.animation({fit:{boundingBox:o.boundingBoxAt(y),padding:a.padding},duration:a.animationDuration,easing:a.animationEasing});e.animations.push(N)}else if(a.zoom!==void 0&&a.pan!==void 0){var A=s.animation({zoom:a.zoom,pan:a.pan,duration:a.animationDuration,easing:a.animationEasing});e.animations.push(A)}e.animations.forEach(function(M){return M.play()}),e.one("layoutready",a.ready),e.emit({type:"layoutready",layout:e}),Bo.all(e.animations.map(function(M){return M.promise()})).then(function(){e.one("layoutstop",a.stop),e.emit({type:"layoutstop",layout:e})})}else i.positions(y),a.fit&&s.fit(a.eles,a.padding),a.zoom!=null&&s.zoom(a.zoom),a.pan&&s.pan(a.pan),e.one("layoutready",a.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",a.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){var a=this.cy();return a.makeLayout(et({},e,{eles:this}))}};bf.createLayout=bf.makeLayout=bf.layout;function PC(t,e,a){var r=a._private,i=r.styleCache=r.styleCache||[],s;return(s=i[t])!=null||(s=i[t]=e(a)),s}function fh(t,e){return t=Ws(t),function(r){return PC(t,e,r)}}function hh(t,e){t=Ws(t);var a=function(i){return e.call(i)};return function(){var i=this[0];if(i)return PC(t,a,i)}}var qa={recalculateRenderedStyle:function(e){var a=this.cy(),r=a.renderer(),i=a.styleEnabled();return r&&i&&r.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e=this.cy(),a=function(s){return s._private.styleCache=null};if(e.hasCompoundNodes()){var r;r=this.spawnSelf().merge(this.descendants()).merge(this.parents()),r.merge(r.connectedEdges()),r.forEach(a)}else this.forEach(function(i){a(i),i.connectedEdges().forEach(a)});return this},updateStyle:function(e){var a=this._private.cy;if(!a.styleEnabled())return this;if(a.batching()){var r=a._private.batchStyleEles;return r.merge(this),this}var i=a.hasCompoundNodes(),s=this;e=!!(e||e===void 0),i&&(s=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var o=s;return e?o.emitAndNotify("style"):o.emit("style"),s.forEach(function(u){return u._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var a=0;a<this.length;a++){var r=this[a];r._private.styleDirty&&(r._private.styleDirty=!1,e.style().apply(r))}},parsedStyle:function(e){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this[0],i=r.cy();if(i.styleEnabled()&&r){r._private.styleDirty&&(r._private.styleDirty=!1,i.style().apply(r));var s=r._private.style[e];return s??(a?i.style().getDefaultProperty(e):null)}},numericStyle:function(e){var a=this[0];if(a.cy().styleEnabled()&&a){var r=a.pstyle(e);return r.pfValue!==void 0?r.pfValue:r.value}},numericStyleUnits:function(e){var a=this[0];if(a.cy().styleEnabled()&&a)return a.pstyle(e).units},renderedStyle:function(e){var a=this.cy();if(!a.styleEnabled())return this;var r=this[0];if(r)return a.style().getRenderedStyle(r,e)},style:function(e,a){var r=this.cy();if(!r.styleEnabled())return this;var i=!1,s=r.style();if(wt(e)){var o=e;s.applyBypass(this,o,i),this.emitAndNotify("style")}else if(Xe(e))if(a===void 0){var u=this[0];return u?s.getStylePropertyValue(u,e):void 0}else s.applyBypass(this,e,a,i),this.emitAndNotify("style");else if(e===void 0){var d=this[0];return d?s.getRawStyle(d):void 0}return this},removeStyle:function(e){var a=this.cy();if(!a.styleEnabled())return this;var r=!1,i=a.style(),s=this;if(e===void 0)for(var o=0;o<s.length;o++){var u=s[o];i.removeAllBypasses(u,r)}else{e=e.split(/\s+/);for(var d=0;d<s.length;d++){var f=s[d];i.removeBypasses(f,e,r)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var a=e.hasCompoundNodes(),r=this[0];if(r){var i=r._private,s=r.pstyle("opacity").value;if(!a)return s;var o=i.data.parent?r.parents():null;if(o)for(var u=0;u<o.length;u++){var d=o[u],f=d.pstyle("opacity").value;s=f*s}return s}},transparent:function(){var e=this.cy();if(!e.styleEnabled())return!1;var a=this[0],r=a.cy().hasCompoundNodes();if(a)return r?a.effectiveOpacity()===0:a.pstyle("opacity").value===0},backgrounding:function(){var e=this.cy();if(!e.styleEnabled())return!1;var a=this[0];return!!a._private.backgrounding}};function lm(t,e){var a=t._private,r=a.data.parent?t.parents():null;if(r)for(var i=0;i<r.length;i++){var s=r[i];if(!e(s))return!1}return!0}function Z0(t){var e=t.ok,a=t.edgeOkViaNode||t.ok,r=t.parentOk||t.ok;return function(){var i=this.cy();if(!i.styleEnabled())return!0;var s=this[0],o=i.hasCompoundNodes();if(s){var u=s._private;if(!e(s))return!1;if(s.isNode())return!o||lm(s,r);var d=u.source,f=u.target;return a(d)&&(!o||lm(d,a))&&(d===f||a(f)&&(!o||lm(f,a)))}}}var Lo=fh("eleTakesUpSpace",function(t){return t.pstyle("display").value==="element"&&t.width()!==0&&(t.isNode()?t.height()!==0:!0)});qa.takesUpSpace=hh("takesUpSpace",Z0({ok:Lo}));var K3=fh("eleInteractive",function(t){return t.pstyle("events").value==="yes"&&t.pstyle("visibility").value==="visible"&&Lo(t)}),$3=fh("parentInteractive",function(t){return t.pstyle("visibility").value==="visible"&&Lo(t)});qa.interactive=hh("interactive",Z0({ok:K3,parentOk:$3,edgeOkViaNode:Lo}));qa.noninteractive=function(){var t=this[0];if(t)return!t.interactive()};var X3=fh("eleVisible",function(t){return t.pstyle("visibility").value==="visible"&&t.pstyle("opacity").pfValue!==0&&Lo(t)}),Z3=Lo;qa.visible=hh("visible",Z0({ok:X3,edgeOkViaNode:Z3}));qa.hidden=function(){var t=this[0];if(t)return!t.visible()};qa.isBundledBezier=hh("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1});qa.bypass=qa.css=qa.style;qa.renderedCss=qa.renderedStyle;qa.removeBypass=qa.removeCss=qa.removeStyle;qa.pstyle=qa.parsedStyle;var Wi={};function TS(t){return function(){var e=arguments,a=[];if(e.length===2){var r=e[0],i=e[1];this.on(t.event,r,i)}else if(e.length===1&&Zt(e[0])){var s=e[0];this.on(t.event,s)}else if(e.length===0||e.length===1&&_t(e[0])){for(var o=e.length===1?e[0]:null,u=0;u<this.length;u++){var d=this[u],f=!t.ableField||d._private[t.ableField],h=d._private[t.field]!=t.value;if(t.overrideAble){var p=t.overrideAble(d);if(p!==void 0&&(f=p,!p))return this}f&&(d._private[t.field]=t.value,h&&a.push(d))}var m=this.spawn(a);m.updateStyle(),m.emit(t.event),o&&m.emit(o)}return this}}function zo(t){Wi[t.field]=function(){var e=this[0];if(e){if(t.overrideField){var a=t.overrideField(e);if(a!==void 0)return a}return e._private[t.field]}},Wi[t.on]=TS({event:t.on,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!0}),Wi[t.off]=TS({event:t.off,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!1})}zo({field:"locked",overrideField:function(e){return e.cy().autolock()?!0:void 0},on:"lock",off:"unlock"});zo({field:"grabbable",overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:"grabify",off:"ungrabify"});zo({field:"selected",ableField:"selectable",overrideAble:function(e){return e.cy().autounselectify()?!1:void 0},on:"select",off:"unselect"});zo({field:"selectable",overrideField:function(e){return e.cy().autounselectify()?!1:void 0},on:"selectify",off:"unselectify"});Wi.deselect=Wi.unselect;Wi.grabbed=function(){var t=this[0];if(t)return t._private.grabbed};zo({field:"active",on:"activate",off:"unactivate"});zo({field:"pannable",on:"panify",off:"unpanify"});Wi.inactive=function(){var t=this[0];if(t)return!t._private.active};var Xa={},CS=function(e){return function(r){for(var i=this,s=[],o=0;o<i.length;o++){var u=i[o];if(u.isNode()){for(var d=!1,f=u.connectedEdges(),h=0;h<f.length;h++){var p=f[h],m=p.source(),y=p.target();if(e.noIncomingEdges&&y===u&&m!==u||e.noOutgoingEdges&&m===u&&y!==u){d=!0;break}}d||s.push(u)}}return this.spawn(s,!0).filter(r)}},NS=function(e){return function(a){for(var r=this,i=[],s=0;s<r.length;s++){var o=r[s];if(o.isNode())for(var u=o.connectedEdges(),d=0;d<u.length;d++){var f=u[d],h=f.source(),p=f.target();e.outgoing&&h===o?(i.push(f),i.push(p)):e.incoming&&p===o&&(i.push(f),i.push(h))}}return this.spawn(i,!0).filter(a)}},jS=function(e){return function(a){for(var r=this,i=[],s={};;){var o=e.outgoing?r.outgoers():r.incomers();if(o.length===0)break;for(var u=!1,d=0;d<o.length;d++){var f=o[d],h=f.id();s[h]||(s[h]=!0,i.push(f),u=!0)}if(!u)break;r=o}return this.spawn(i,!0).filter(a)}};Xa.clearTraversalCache=function(){for(var t=0;t<this.length;t++)this[t]._private.traversalCache=null};et(Xa,{roots:CS({noIncomingEdges:!0}),leaves:CS({noOutgoingEdges:!0}),outgoers:Kr(NS({outgoing:!0}),"outgoers"),successors:jS({outgoing:!0}),incomers:Kr(NS({incoming:!0}),"incomers"),predecessors:jS({})});et(Xa,{neighborhood:Kr(function(t){for(var e=[],a=this.nodes(),r=0;r<a.length;r++)for(var i=a[r],s=i.connectedEdges(),o=0;o<s.length;o++){var u=s[o],d=u.source(),f=u.target(),h=i===d?f:d;h.length>0&&e.push(h[0]),e.push(u[0])}return this.spawn(e,!0).filter(t)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}});Xa.neighbourhood=Xa.neighborhood;Xa.closedNeighbourhood=Xa.closedNeighborhood;Xa.openNeighbourhood=Xa.openNeighborhood;et(Xa,{source:Kr(function(e){var a=this[0],r;return a&&(r=a._private.source||a.cy().collection()),r&&e?r.filter(e):r},"source"),target:Kr(function(e){var a=this[0],r;return a&&(r=a._private.target||a.cy().collection()),r&&e?r.filter(e):r},"target"),sources:AS({attr:"source"}),targets:AS({attr:"target"})});function AS(t){return function(a){for(var r=[],i=0;i<this.length;i++){var s=this[i],o=s._private[t.attr];o&&r.push(o)}return this.spawn(r,!0).filter(a)}}et(Xa,{edgesWith:Kr(MS(),"edgesWith"),edgesTo:Kr(MS({thisIsSrc:!0}),"edgesTo")});function MS(t){return function(a){var r=[],i=this._private.cy,s=t||{};Xe(a)&&(a=i.$(a));for(var o=0;o<a.length;o++)for(var u=a[o]._private.edges,d=0;d<u.length;d++){var f=u[d],h=f._private.data,p=this.hasElementWithId(h.source)&&a.hasElementWithId(h.target),m=a.hasElementWithId(h.source)&&this.hasElementWithId(h.target),y=p||m;y&&((s.thisIsSrc||s.thisIsTgt)&&(s.thisIsSrc&&!p||s.thisIsTgt&&!m)||r.push(f))}return this.spawn(r,!0)}}et(Xa,{connectedEdges:Kr(function(t){for(var e=[],a=this,r=0;r<a.length;r++){var i=a[r];if(i.isNode())for(var s=i._private.edges,o=0;o<s.length;o++){var u=s[o];e.push(u)}}return this.spawn(e,!0).filter(t)},"connectedEdges"),connectedNodes:Kr(function(t){for(var e=[],a=this,r=0;r<a.length;r++){var i=a[r];i.isEdge()&&(e.push(i.source()[0]),e.push(i.target()[0]))}return this.spawn(e,!0).filter(t)},"connectedNodes"),parallelEdges:Kr(DS(),"parallelEdges"),codirectedEdges:Kr(DS({codirected:!0}),"codirectedEdges")});function DS(t){var e={codirected:!1};return t=et({},e,t),function(r){for(var i=[],s=this.edges(),o=t,u=0;u<s.length;u++)for(var d=s[u],f=d._private,h=f.source,p=h._private.data.id,m=f.data.target,y=h._private.edges,x=0;x<y.length;x++){var E=y[x],S=E._private.data,T=S.target,C=S.source,N=T===m&&C===p,A=p===T&&m===C;(o.codirected&&N||!o.codirected&&(N||A))&&i.push(E)}return this.spawn(i,!0).filter(r)}}et(Xa,{components:function(e){var a=this,r=a.cy(),i=r.collection(),s=e==null?a.nodes():e.nodes(),o=[];e!=null&&s.empty()&&(s=e.sources());var u=function(h,p){i.merge(h),s.unmerge(h),p.merge(h)};if(s.empty())return a.spawn();var d=function(){var h=r.collection();o.push(h);var p=s[0];u(p,h),a.bfs({directed:!1,roots:p,visit:function(y){return u(y,h)}}),h.forEach(function(m){m.connectedEdges().forEach(function(y){a.has(y)&&h.has(y.source())&&h.has(y.target())&&h.merge(y)})})};do d();while(s.length>0);return o},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}});Xa.componentsOf=Xa.components;var Ia=function(e,a){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e===void 0){Qt("A collection must have a reference to the core");return}var s=new Kn,o=!1;if(!a)a=[];else if(a.length>0&&wt(a[0])&&!wc(a[0])){o=!0;for(var u=[],d=new ko,f=0,h=a.length;f<h;f++){var p=a[f];p.data==null&&(p.data={});var m=p.data;if(m.id==null)m.id=ZT();else if(e.hasElementWithId(m.id)||d.has(m.id))continue;var y=new rh(e,p,!1);u.push(y),d.add(m.id)}a=u}this.length=0;for(var x=0,E=a.length;x<E;x++){var S=a[x][0];if(S!=null){var T=S._private.data.id;(!r||!s.has(T))&&(r&&s.set(T,{index:this.length,ele:S}),this[this.length]=S,this.length++)}}this._private={eles:this,cy:e,get map(){return this.lazyMap==null&&this.rebuildMap(),this.lazyMap},set map(C){this.lazyMap=C},rebuildMap:function(){for(var N=this.lazyMap=new Kn,A=this.eles,M=0;M<A.length;M++){var D=A[M];N.set(D.id(),{index:M,ele:D})}}},r&&(this._private.map=s),o&&!i&&this.restore()},qt=rh.prototype=Ia.prototype=Object.create(Array.prototype);qt.instanceString=function(){return"collection"};qt.spawn=function(t,e){return new Ia(this.cy(),t,e)};qt.spawnSelf=function(){return this.spawn(this)};qt.cy=function(){return this._private.cy};qt.renderer=function(){return this._private.cy.renderer()};qt.element=function(){return this[0]};qt.collection=function(){return PT(this)?this:new Ia(this._private.cy,[this])};qt.unique=function(){return new Ia(this._private.cy,this,!0)};qt.hasElementWithId=function(t){return t=""+t,this._private.map.has(t)};qt.getElementById=function(t){t=""+t;var e=this._private.cy,a=this._private.map.get(t);return a?a.ele:new Ia(e)};qt.$id=qt.getElementById;qt.poolIndex=function(){var t=this._private.cy,e=t._private.elements,a=this[0]._private.data.id;return e._private.map.get(a).index};qt.indexOf=function(t){var e=t[0]._private.data.id;return this._private.map.get(e).index};qt.indexOfId=function(t){return t=""+t,this._private.map.get(t).index};qt.json=function(t){var e=this.element(),a=this.cy();if(e==null&&t)return this;if(e!=null){var r=e._private;if(wt(t)){if(a.startBatch(),t.data){e.data(t.data);var i=r.data;if(e.isEdge()){var s=!1,o={},u=t.data.source,d=t.data.target;u!=null&&u!=i.source&&(o.source=""+u,s=!0),d!=null&&d!=i.target&&(o.target=""+d,s=!0),s&&(e=e.move(o))}else{var f="parent"in t.data,h=t.data.parent;f&&(h!=null||i.parent!=null)&&h!=i.parent&&(h===void 0&&(h=null),h!=null&&(h=""+h),e=e.move({parent:h}))}}t.position&&e.position(t.position);var p=function(E,S,T){var C=t[E];C!=null&&C!==r[E]&&(C?e[S]():e[T]())};return p("removed","remove","restore"),p("selected","select","unselect"),p("selectable","selectify","unselectify"),p("locked","lock","unlock"),p("grabbable","grabify","ungrabify"),p("pannable","panify","unpanify"),t.classes!=null&&e.classes(t.classes),a.endBatch(),this}else if(t===void 0){var m={data:xn(r.data),position:xn(r.position),group:r.group,removed:r.removed,selected:r.selected,selectable:r.selectable,locked:r.locked,grabbable:r.grabbable,pannable:r.pannable,classes:null};m.classes="";var y=0;return r.classes.forEach(function(x){return m.classes+=y++===0?x:" "+x}),m}}};qt.jsons=function(){for(var t=[],e=0;e<this.length;e++){var a=this[e],r=a.json();t.push(r)}return t};qt.clone=function(){for(var t=this.cy(),e=[],a=0;a<this.length;a++){var r=this[a],i=r.json(),s=new rh(t,i,!1);e.push(s)}return new Ia(t,e)};qt.copy=qt.clone;qt.restore=function(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,a=this,r=a.cy(),i=r._private,s=[],o=[],u,d=0,f=a.length;d<f;d++){var h=a[d];e&&!h.removed()||(h.isNode()?s.push(h):o.push(h))}u=s.concat(o);var p,m=function(){u.splice(p,1),p--};for(p=0;p<u.length;p++){var y=u[p],x=y._private,E=x.data;if(y.clearTraversalCache(),!(!e&&!x.removed)){if(E.id===void 0)E.id=ZT();else if(Oe(E.id))E.id=""+E.id;else if(es(E.id)||!Xe(E.id)){Qt("Can not create element with invalid string ID `"+E.id+"`"),m();continue}else if(r.hasElementWithId(E.id)){Qt("Can not create second element with ID `"+E.id+"`"),m();continue}}var S=E.id;if(y.isNode()){var T=x.position;T.x==null&&(T.x=0),T.y==null&&(T.y=0)}if(y.isEdge()){for(var C=y,N=["source","target"],A=N.length,M=!1,D=0;D<A;D++){var j=N[D],R=E[j];Oe(R)&&(R=E[j]=""+E[j]),R==null||R===""?(Qt("Can not create edge `"+S+"` with unspecified "+j),M=!0):r.hasElementWithId(R)||(Qt("Can not create edge `"+S+"` with nonexistant "+j+" `"+R+"`"),M=!0)}if(M){m();continue}var L=r.getElementById(E.source),z=r.getElementById(E.target);L.same(z)?L._private.edges.push(C):(L._private.edges.push(C),z._private.edges.push(C)),C._private.source=L,C._private.target=z}x.map=new Kn,x.map.set(S,{ele:y,index:0}),x.removed=!1,e&&r.addToPool(y)}for(var _=0;_<s.length;_++){var B=s[_],q=B._private.data;Oe(q.parent)&&(q.parent=""+q.parent);var V=q.parent,Q=V!=null;if(Q||B._private.parent){var P=B._private.parent?r.collection().merge(B._private.parent):r.getElementById(V);if(P.empty())q.parent=void 0;else if(P[0].removed())At("Node added with missing parent, reference to parent removed"),q.parent=void 0,B._private.parent=null;else{for(var U=!1,F=P;!F.empty();){if(B.same(F)){U=!0,q.parent=void 0;break}F=F.parent()}U||(P[0]._private.children.push(B),B._private.parent=P[0],i.hasCompoundNodes=!0)}}}if(u.length>0){for(var K=u.length===a.length?a:new Ia(r,u),J=0;J<K.length;J++){var k=K[J];k.isNode()||(k.parallelEdges().clearTraversalCache(),k.source().clearTraversalCache(),k.target().clearTraversalCache())}var G;i.hasCompoundNodes?G=r.collection().merge(K).merge(K.connectedNodes()).merge(K.parent()):G=K,G.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(t),t?K.emitAndNotify("add"):e&&K.emit("add")}return a};qt.removed=function(){var t=this[0];return t&&t._private.removed};qt.inside=function(){var t=this[0];return t&&!t._private.removed};qt.remove=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,a=this,r=[],i={},s=a._private.cy;function o(V){for(var Q=V._private.edges,P=0;P<Q.length;P++)d(Q[P])}function u(V){for(var Q=V._private.children,P=0;P<Q.length;P++)d(Q[P])}function d(V){var Q=i[V.id()];e&&V.removed()||Q||(i[V.id()]=!0,V.isNode()?(r.push(V),o(V),u(V)):r.unshift(V))}for(var f=0,h=a.length;f<h;f++){var p=a[f];d(p)}function m(V,Q){var P=V._private.edges;ts(P,Q),V.clearTraversalCache()}function y(V){V.clearTraversalCache()}var x=[];x.ids={};function E(V,Q){Q=Q[0],V=V[0];var P=V._private.children,U=V.id();ts(P,Q),Q._private.parent=null,x.ids[U]||(x.ids[U]=!0,x.push(V))}a.dirtyCompoundBoundsCache(),e&&s.removeFromPool(r);for(var S=0;S<r.length;S++){var T=r[S];if(T.isEdge()){var C=T.source()[0],N=T.target()[0];m(C,T),m(N,T);for(var A=T.parallelEdges(),M=0;M<A.length;M++){var D=A[M];y(D),D.isBundledBezier()&&D.dirtyBoundingBoxCache()}}else{var j=T.parent();j.length!==0&&E(j,T)}e&&(T._private.removed=!0)}var R=s._private.elements;s._private.hasCompoundNodes=!1;for(var L=0;L<R.length;L++){var z=R[L];if(z.isParent()){s._private.hasCompoundNodes=!0;break}}var _=new Ia(this.cy(),r);_.size()>0&&(t?_.emitAndNotify("remove"):e&&_.emit("remove"));for(var B=0;B<x.length;B++){var q=x[B];(!e||!q.removed())&&q.updateStyle()}return _};qt.move=function(t){var e=this._private.cy,a=this,r=!1,i=!1,s=function(x){return x==null?x:""+x};if(t.source!==void 0||t.target!==void 0){var o=s(t.source),u=s(t.target),d=o!=null&&e.hasElementWithId(o),f=u!=null&&e.hasElementWithId(u);(d||f)&&(e.batch(function(){a.remove(r,i),a.emitAndNotify("moveout");for(var y=0;y<a.length;y++){var x=a[y],E=x._private.data;x.isEdge()&&(d&&(E.source=o),f&&(E.target=u))}a.restore(r,i)}),a.emitAndNotify("move"))}else if(t.parent!==void 0){var h=s(t.parent),p=h===null||e.hasElementWithId(h);if(p){var m=h===null?void 0:h;e.batch(function(){var y=a.remove(r,i);y.emitAndNotify("moveout");for(var x=0;x<a.length;x++){var E=a[x],S=E._private.data;E.isNode()&&(S.parent=m)}y.restore(r,i)}),a.emitAndNotify("move")}}return this};[uC,o3,xf,Zi,Mo,T3,ch,q3,BC,LC,G3,If,bf,qa,Wi,Xa].forEach(function(t){et(qt,t)});var W3={add:function(e){var a,r=this;if(Mr(e)){var i=e;if(i._private.cy===r)a=i.restore();else{for(var s=[],o=0;o<i.length;o++){var u=i[o];s.push(u.json())}a=new Ia(r,s)}}else if(_t(e)){var d=e;a=new Ia(r,d)}else if(wt(e)&&(_t(e.nodes)||_t(e.edges))){for(var f=e,h=[],p=["nodes","edges"],m=0,y=p.length;m<y;m++){var x=p[m],E=f[x];if(_t(E))for(var S=0,T=E.length;S<T;S++){var C=et({group:x},E[S]);h.push(C)}}a=new Ia(r,h)}else{var N=e;a=new rh(r,N).collection()}return a},remove:function(e){if(!Mr(e)){if(Xe(e)){var a=e;e=this.$(a)}}return e.remove()}};/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */function J3(t,e,a,r){var i=4,s=.001,o=1e-7,u=10,d=11,f=1/(d-1),h=typeof Float32Array<"u";if(arguments.length!==4)return!1;for(var p=0;p<4;++p)if(typeof arguments[p]!="number"||isNaN(arguments[p])||!isFinite(arguments[p]))return!1;t=Math.min(t,1),a=Math.min(a,1),t=Math.max(t,0),a=Math.max(a,0);var m=h?new Float32Array(d):new Array(d);function y(z,_){return 1-3*_+3*z}function x(z,_){return 3*_-6*z}function E(z){return 3*z}function S(z,_,B){return((y(_,B)*z+x(_,B))*z+E(_))*z}function T(z,_,B){return 3*y(_,B)*z*z+2*x(_,B)*z+E(_)}function C(z,_){for(var B=0;B<i;++B){var q=T(_,t,a);if(q===0)return _;var V=S(_,t,a)-z;_-=V/q}return _}function N(){for(var z=0;z<d;++z)m[z]=S(z*f,t,a)}function A(z,_,B){var q,V,Q=0;do V=_+(B-_)/2,q=S(V,t,a)-z,q>0?B=V:_=V;while(Math.abs(q)>o&&++Q<u);return V}function M(z){for(var _=0,B=1,q=d-1;B!==q&&m[B]<=z;++B)_+=f;--B;var V=(z-m[B])/(m[B+1]-m[B]),Q=_+V*f,P=T(Q,t,a);return P>=s?C(z,Q):P===0?Q:A(z,_,_+f)}var D=!1;function j(){D=!0,(t!==e||a!==r)&&N()}var R=function(_){return D||j(),t===e&&a===r?_:_===0?0:_===1?1:S(M(_),e,r)};R.getControlPoints=function(){return[{x:t,y:e},{x:a,y:r}]};var L="generateBezier("+[t,e,a,r]+")";return R.toString=function(){return L},R}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var eB=(function(){function t(r){return-r.tension*r.x-r.friction*r.v}function e(r,i,s){var o={x:r.x+s.dx*i,v:r.v+s.dv*i,tension:r.tension,friction:r.friction};return{dx:o.v,dv:t(o)}}function a(r,i){var s={dx:r.v,dv:t(r)},o=e(r,i*.5,s),u=e(r,i*.5,o),d=e(r,i,u),f=1/6*(s.dx+2*(o.dx+u.dx)+d.dx),h=1/6*(s.dv+2*(o.dv+u.dv)+d.dv);return r.x=r.x+f*i,r.v=r.v+h*i,r}return function r(i,s,o){var u={x:-1,v:0,tension:null,friction:null},d=[0],f=0,h=1/1e4,p=16/1e3,m,y,x;for(i=parseFloat(i)||500,s=parseFloat(s)||20,o=o||null,u.tension=i,u.friction=s,m=o!==null,m?(f=r(i,s),y=f/o*p):y=p;x=a(x||u,y),d.push(1+x.x),f+=16,Math.abs(x.x)>h&&Math.abs(x.v)>h;);return m?function(E){return d[E*(d.length-1)|0]}:f}})(),Ut=function(e,a,r,i){var s=J3(e,a,r,i);return function(o,u,d){return o+(u-o)*s(d)}},wf={linear:function(e,a,r){return e+(a-e)*r},ease:Ut(.25,.1,.25,1),"ease-in":Ut(.42,0,1,1),"ease-out":Ut(0,0,.58,1),"ease-in-out":Ut(.42,0,.58,1),"ease-in-sine":Ut(.47,0,.745,.715),"ease-out-sine":Ut(.39,.575,.565,1),"ease-in-out-sine":Ut(.445,.05,.55,.95),"ease-in-quad":Ut(.55,.085,.68,.53),"ease-out-quad":Ut(.25,.46,.45,.94),"ease-in-out-quad":Ut(.455,.03,.515,.955),"ease-in-cubic":Ut(.55,.055,.675,.19),"ease-out-cubic":Ut(.215,.61,.355,1),"ease-in-out-cubic":Ut(.645,.045,.355,1),"ease-in-quart":Ut(.895,.03,.685,.22),"ease-out-quart":Ut(.165,.84,.44,1),"ease-in-out-quart":Ut(.77,0,.175,1),"ease-in-quint":Ut(.755,.05,.855,.06),"ease-out-quint":Ut(.23,1,.32,1),"ease-in-out-quint":Ut(.86,0,.07,1),"ease-in-expo":Ut(.95,.05,.795,.035),"ease-out-expo":Ut(.19,1,.22,1),"ease-in-out-expo":Ut(1,0,0,1),"ease-in-circ":Ut(.6,.04,.98,.335),"ease-out-circ":Ut(.075,.82,.165,1),"ease-in-out-circ":Ut(.785,.135,.15,.86),spring:function(e,a,r){if(r===0)return wf.linear;var i=eB(e,a,r);return function(s,o,u){return s+(o-s)*i(u)}},"cubic-bezier":Ut};function OS(t,e,a,r,i){if(r===1||e===a)return a;var s=i(e,a,r);return t==null||((t.roundValue||t.color)&&(s=Math.round(s)),t.min!==void 0&&(s=Math.max(s,t.min)),t.max!==void 0&&(s=Math.min(s,t.max))),s}function RS(t,e){return t.pfValue!=null||t.value!=null?t.pfValue!=null&&(e==null||e.type.units!=="%")?t.pfValue:t.value:t}function Yl(t,e,a,r,i){var s=i!=null?i.type:null;a<0?a=0:a>1&&(a=1);var o=RS(t,i),u=RS(e,i);if(Oe(o)&&Oe(u))return OS(s,o,u,a,r);if(_t(o)&&_t(u)){for(var d=[],f=0;f<u.length;f++){var h=o[f],p=u[f];if(h!=null&&p!=null){var m=OS(s,h,p,a,r);d.push(m)}else d.push(p)}return d}}function tB(t,e,a,r){var i=!r,s=t._private,o=e._private,u=o.easing,d=o.startTime,f=r?t:t.cy(),h=f.style();if(!o.easingImpl)if(u==null)o.easingImpl=wf.linear;else{var p;if(Xe(u)){var m=h.parse("transition-timing-function",u);p=m.value}else p=u;var y,x;Xe(p)?(y=p,x=[]):(y=p[1],x=p.slice(2).map(function(K){return+K})),x.length>0?(y==="spring"&&x.push(o.duration),o.easingImpl=wf[y].apply(null,x)):o.easingImpl=wf[y]}var E=o.easingImpl,S;if(o.duration===0?S=1:S=(a-d)/o.duration,o.applying&&(S=o.progress),S<0?S=0:S>1&&(S=1),o.delay==null){var T=o.startPosition,C=o.position;if(C&&i&&!t.locked()){var N={};Bu(T.x,C.x)&&(N.x=Yl(T.x,C.x,S,E)),Bu(T.y,C.y)&&(N.y=Yl(T.y,C.y,S,E)),t.position(N)}var A=o.startPan,M=o.pan,D=s.pan,j=M!=null&&r;j&&(Bu(A.x,M.x)&&(D.x=Yl(A.x,M.x,S,E)),Bu(A.y,M.y)&&(D.y=Yl(A.y,M.y,S,E)),t.emit("pan"));var R=o.startZoom,L=o.zoom,z=L!=null&&r;z&&(Bu(R,L)&&(s.zoom=Ju(s.minZoom,Yl(R,L,S,E),s.maxZoom)),t.emit("zoom")),(j||z)&&t.emit("viewport");var _=o.style;if(_&&_.length>0&&i){for(var B=0;B<_.length;B++){var q=_[B],V=q.name,Q=q,P=o.startStyle[V],U=h.properties[P.name],F=Yl(P,Q,S,E,U);h.overrideBypass(t,V,F)}t.emit("style")}}return o.progress=S,S}function Bu(t,e){return t==null||e==null?!1:Oe(t)&&Oe(e)?!0:!!(t&&e)}function aB(t,e,a,r){var i=e._private;i.started=!0,i.startTime=a-i.progress*i.duration}function kS(t,e){var a=e._private.aniEles,r=[];function i(h,p){var m=h._private,y=m.animation.current,x=m.animation.queue,E=!1;if(y.length===0){var S=x.shift();S&&y.push(S)}for(var T=function(D){for(var j=D.length-1;j>=0;j--){var R=D[j];R()}D.splice(0,D.length)},C=y.length-1;C>=0;C--){var N=y[C],A=N._private;if(A.stopped){y.splice(C,1),A.hooked=!1,A.playing=!1,A.started=!1,T(A.frames);continue}!A.playing&&!A.applying||(A.playing&&A.applying&&(A.applying=!1),A.started||aB(h,N,t),tB(h,N,t,p),A.applying&&(A.applying=!1),T(A.frames),A.step!=null&&A.step(t),N.completed()&&(y.splice(C,1),A.hooked=!1,A.playing=!1,A.started=!1,T(A.completes)),E=!0)}return!p&&y.length===0&&x.length===0&&r.push(h),E}for(var s=!1,o=0;o<a.length;o++){var u=a[o],d=i(u);s=s||d}var f=i(e,!0);(s||f)&&(a.length>0?e.notify("draw",a):e.notify("draw")),a.unmerge(r),e.emit("step")}var rB={animate:jt.animate(),animation:jt.animation(),animated:jt.animated(),clearQueue:jt.clearQueue(),delay:jt.delay(),delayAnimation:jt.delayAnimation(),stop:jt.stop(),addToAnimationPool:function(e){var a=this;a.styleEnabled()&&a._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function a(){e._private.animationsRunning&&zf(function(s){kS(s,e),a()})}var r=e.renderer();r&&r.beforeRender?r.beforeRender(function(s,o){kS(o,e)},r.beforeRenderPriorities.animations):a()}},nB={qualifierCompare:function(e,a){return e==null||a==null?e==null&&a==null:e.sameText(a)},eventMatches:function(e,a,r){var i=a.qualifier;return i!=null?e!==r.target&&wc(r.target)&&i.matches(r.target):!0},addEventFields:function(e,a){a.cy=e,a.target=e},callbackContext:function(e,a,r){return a.qualifier!=null?r.target:e}},lf=function(e){return Xe(e)?new rs(e):e},_C={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new dh(nB,this)),this},emitter:function(){return this._private.emitter},on:function(e,a,r){return this.emitter().on(e,lf(a),r),this},removeListener:function(e,a,r){return this.emitter().removeListener(e,lf(a),r),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,a,r){return this.emitter().one(e,lf(a),r),this},once:function(e,a,r){return this.emitter().one(e,lf(a),r),this},emit:function(e,a){return this.emitter().emit(e,a),this},emitAndNotify:function(e,a){return this.emit(e),this.notify(e,a),this}};jt.eventAliasesOn(_C);var t0={png:function(e){var a=this._private.renderer;return e=e||{},a.png(e)},jpg:function(e){var a=this._private.renderer;return e=e||{},e.bg=e.bg||"#fff",a.jpg(e)}};t0.jpeg=t0.jpg;var Sf={layout:function(e){var a=this;if(e==null){Qt("Layout options must be specified to make a layout");return}if(e.name==null){Qt("A `name` must be specified to make a layout");return}var r=e.name,i=a.extension("layout",r);if(i==null){Qt("No such layout `"+r+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var s;Xe(e.eles)?s=a.$(e.eles):s=e.eles!=null?e.eles:a.$();var o=new i(et({},e,{cy:a,eles:s}));return o}};Sf.createLayout=Sf.makeLayout=Sf.layout;var iB={notify:function(e,a){var r=this._private;if(this.batching()){r.batchNotifications=r.batchNotifications||{};var i=r.batchNotifications[e]=r.batchNotifications[e]||this.collection();a!=null&&i.merge(a);return}if(r.notificationsEnabled){var s=this.renderer();this.destroyed()||!s||s.notify(e,a)}},notifications:function(e){var a=this._private;return e===void 0?a.notificationsEnabled:(a.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return e.batchCount==null&&(e.batchCount=0),e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(e.batchCount===0)return this;if(e.batchCount--,e.batchCount===0){e.batchStyleEles.updateStyle();var a=this.renderer();Object.keys(e.batchNotifications).forEach(function(r){var i=e.batchNotifications[r];i.empty()?a.notify(r):a.notify(r,i)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var a=this;return this.batch(function(){for(var r=Object.keys(e),i=0;i<r.length;i++){var s=r[i],o=e[s],u=a.getElementById(s);u.data(o)}})}},sB=Fa({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1,webgl:!1,webglDebug:!1,webglDebugShowAtlases:!1,webglTexSize:2048,webglTexRows:36,webglTexRowsNodes:18,webglBatchSize:2048,webglTexPerBatch:14,webglBgColor:[255,255,255]}),a0={renderTo:function(e,a,r,i){var s=this._private.renderer;return s.renderTo(e,a,r,i),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify("draw"),this},resize:function(){return this.invalidateSize(),this.emitAndNotify("resize"),this},initRenderer:function(e){var a=this,r=a.extension("renderer",e.name);if(r==null){Qt("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"));return}e.wheelSensitivity!==void 0&&At("You have set a custom wheel sensitivity. This will make your app zoom unnaturally when using mainstream mice. You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.");var i=sB(e);i.cy=a,a._private.renderer=new r(i),this.notify("init")},destroyRenderer:function(){var e=this;e.notify("destroy");var a=e.container();if(a)for(a._cyreg=null;a.childNodes.length>0;)a.removeChild(a.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(r){var i=r._private;i.rscratch={},i.rstyle={},i.animation.current=[],i.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};a0.invalidateDimensions=a0.resize;var Ef={collection:function(e,a){return Xe(e)?this.$(e):Mr(e)?e.collection():_t(e)?(a||(a={}),new Ia(this,e,a.unique,a.removed)):new Ia(this)},nodes:function(e){var a=this.$(function(r){return r.isNode()});return e?a.filter(e):a},edges:function(e){var a=this.$(function(r){return r.isEdge()});return e?a.filter(e):a},$:function(e){var a=this._private.elements;return e?a.filter(e):a.spawnSelf()},mutableElements:function(){return this._private.elements}};Ef.elements=Ef.filter=Ef.$;var ka={},Fu="t",lB="f";ka.apply=function(t){for(var e=this,a=e._private,r=a.cy,i=r.collection(),s=0;s<t.length;s++){var o=t[s],u=e.getContextMeta(o);if(!u.empty){var d=e.getContextStyle(u),f=e.applyContextStyle(u,d,o);o._private.appliedInitStyle?e.updateTransitions(o,f.diffProps):o._private.appliedInitStyle=!0;var h=e.updateStyleHints(o);h&&i.push(o)}}return i};ka.getPropertiesDiff=function(t,e){var a=this,r=a._private.propDiffs=a._private.propDiffs||{},i=t+"-"+e,s=r[i];if(s)return s;for(var o=[],u={},d=0;d<a.length;d++){var f=a[d],h=t[d]===Fu,p=e[d]===Fu,m=h!==p,y=f.mappedProperties.length>0;if(m||p&&y){var x=void 0;m&&y||m?x=f.properties:y&&(x=f.mappedProperties);for(var E=0;E<x.length;E++){for(var S=x[E],T=S.name,C=!1,N=d+1;N<a.length;N++){var A=a[N],M=e[N]===Fu;if(M&&(C=A.properties[S.name]!=null,C))break}!u[T]&&!C&&(u[T]=!0,o.push(T))}}}return r[i]=o,o};ka.getContextMeta=function(t){for(var e=this,a="",r,i=t._private.styleCxtKey||"",s=0;s<e.length;s++){var o=e[s],u=o.selector&&o.selector.matches(t);u?a+=Fu:a+=lB}return r=e.getPropertiesDiff(i,a),t._private.styleCxtKey=a,{key:a,diffPropNames:r,empty:r.length===0}};ka.getContextStyle=function(t){var e=t.key,a=this,r=this._private.contextStyles=this._private.contextStyles||{};if(r[e])return r[e];for(var i={_private:{key:e}},s=0;s<a.length;s++){var o=a[s],u=e[s]===Fu;if(u)for(var d=0;d<o.properties.length;d++){var f=o.properties[d];i[f.name]=f}}return r[e]=i,i};ka.applyContextStyle=function(t,e,a){for(var r=this,i=t.diffPropNames,s={},o=r.types,u=0;u<i.length;u++){var d=i[u],f=e[d],h=a.pstyle(d);if(!f)if(h)h.bypass?f={name:d,deleteBypassed:!0}:f={name:d,delete:!0};else continue;if(h!==f){if(f.mapped===o.fn&&h!=null&&h.mapping!=null&&h.mapping.value===f.value){var p=h.mapping,m=p.fnValue=f.value(a);if(m===p.prevFnValue)continue}var y=s[d]={prev:h};r.applyParsedProperty(a,f),y.next=a.pstyle(d),y.next&&y.next.bypass&&(y.next=y.next.bypassed)}}return{diffProps:s}};ka.updateStyleHints=function(t){var e=t._private,a=this,r=a.propertyGroupNames,i=a.propertyGroupKeys,s=function(le,se,Ne){return a.getPropertiesHash(le,se,Ne)},o=e.styleKey;if(t.removed())return!1;var u=e.group==="nodes",d=t._private.style;r=Object.keys(d);for(var f=0;f<i.length;f++){var h=i[f];e.styleKeys[h]=[zs,Jl]}for(var p=function(le,se){return e.styleKeys[se][0]=Xu(le,e.styleKeys[se][0])},m=function(le,se){return e.styleKeys[se][1]=Zu(le,e.styleKeys[se][1])},y=function(le,se){p(le,se),m(le,se)},x=function(le,se){for(var Ne=0;Ne<le.length;Ne++){var Ae=le.charCodeAt(Ne);p(Ae,se),m(Ae,se)}},E=2e9,S=function(le){return-128<le&&le<128&&Math.floor(le)!==le?E-(le*1024|0):le},T=0;T<r.length;T++){var C=r[T],N=d[C];if(N!=null){var A=this.properties[C],M=A.type,D=A.groupKey,j=void 0;A.hashOverride!=null?j=A.hashOverride(t,N):N.pfValue!=null&&(j=N.pfValue);var R=A.enums==null?N.value:null,L=j!=null,z=R!=null,_=L||z,B=N.units;if(M.number&&_&&!M.multiple){var q=L?j:R;y(S(q),D),!L&&B!=null&&x(B,D)}else x(N.strValue,D)}}for(var V=[zs,Jl],Q=0;Q<i.length;Q++){var P=i[Q],U=e.styleKeys[P];V[0]=Xu(U[0],V[0]),V[1]=Zu(U[1],V[1])}e.styleKey=E4(V[0],V[1]);var F=e.styleKeys;e.labelDimsKey=Di(F.labelDimensions);var K=s(t,["label"],F.labelDimensions);if(e.labelKey=Di(K),e.labelStyleKey=Di(Wd(F.commonLabel,K)),!u){var J=s(t,["source-label"],F.labelDimensions);e.sourceLabelKey=Di(J),e.sourceLabelStyleKey=Di(Wd(F.commonLabel,J));var k=s(t,["target-label"],F.labelDimensions);e.targetLabelKey=Di(k),e.targetLabelStyleKey=Di(Wd(F.commonLabel,k))}if(u){var G=e.styleKeys,X=G.nodeBody,W=G.nodeBorder,$=G.nodeOutline,ee=G.backgroundImage,ie=G.compound,he=G.pie,oe=G.stripe,ae=[X,W,$,ee,ie,he,oe].filter(function(re){return re!=null}).reduce(Wd,[zs,Jl]);e.nodeKey=Di(ae),e.hasPie=he!=null&&he[0]!==zs&&he[1]!==Jl,e.hasStripe=oe!=null&&oe[0]!==zs&&oe[1]!==Jl}return o!==e.styleKey};ka.clearStyleHints=function(t){var e=t._private;e.styleCxtKey="",e.styleKeys={},e.styleKey=null,e.labelKey=null,e.labelStyleKey=null,e.sourceLabelKey=null,e.sourceLabelStyleKey=null,e.targetLabelKey=null,e.targetLabelStyleKey=null,e.nodeKey=null,e.hasPie=null,e.hasStripe=null};ka.applyParsedProperty=function(t,e){var a=this,r=e,i=t._private.style,s,o=a.types,u=a.properties[r.name].type,d=r.bypass,f=i[r.name],h=f&&f.bypass,p=t._private,m="mapping",y=function(X){return X==null?null:X.pfValue!=null?X.pfValue:X.value},x=function(){var X=y(f),W=y(r);a.checkTriggers(t,r.name,X,W)};if(e.name==="curve-style"&&t.isEdge()&&(e.value!=="bezier"&&t.isLoop()||e.value==="haystack"&&(t.source().isParent()||t.target().isParent()))&&(r=e=this.parse(e.name,"bezier",d)),r.delete)return i[r.name]=void 0,x(),!0;if(r.deleteBypassed)return f?f.bypass?(f.bypassed=void 0,x(),!0):!1:(x(),!0);if(r.deleteBypass)return f?f.bypass?(i[r.name]=f.bypassed,x(),!0):!1:(x(),!0);var E=function(){At("Do not assign mappings to elements without corresponding data (i.e. ele `"+t.id()+"` has no mapping for property `"+r.name+"` with data field `"+r.field+"`); try a `["+r.field+"]` selector to limit scope to elements with `"+r.field+"` defined")};switch(r.mapped){case o.mapData:{for(var S=r.field.split("."),T=p.data,C=0;C<S.length&&T;C++){var N=S[C];T=T[N]}if(T==null)return E(),!1;var A;if(Oe(T)){var M=r.fieldMax-r.fieldMin;M===0?A=0:A=(T-r.fieldMin)/M}else return At("Do not use continuous mappers without specifying numeric data (i.e. `"+r.field+": "+T+"` for `"+t.id()+"` is non-numeric)"),!1;if(A<0?A=0:A>1&&(A=1),u.color){var D=r.valueMin[0],j=r.valueMax[0],R=r.valueMin[1],L=r.valueMax[1],z=r.valueMin[2],_=r.valueMax[2],B=r.valueMin[3]==null?1:r.valueMin[3],q=r.valueMax[3]==null?1:r.valueMax[3],V=[Math.round(D+(j-D)*A),Math.round(R+(L-R)*A),Math.round(z+(_-z)*A),Math.round(B+(q-B)*A)];s={bypass:r.bypass,name:r.name,value:V,strValue:"rgb("+V[0]+", "+V[1]+", "+V[2]+")"}}else if(u.number){var Q=r.valueMin+(r.valueMax-r.valueMin)*A;s=this.parse(r.name,Q,r.bypass,m)}else return!1;if(!s)return E(),!1;s.mapping=r,r=s;break}case o.data:{for(var P=r.field.split("."),U=p.data,F=0;F<P.length&&U;F++){var K=P[F];U=U[K]}if(U!=null&&(s=this.parse(r.name,U,r.bypass,m)),!s)return E(),!1;s.mapping=r,r=s;break}case o.fn:{var J=r.value,k=r.fnValue!=null?r.fnValue:J(t);if(r.prevFnValue=k,k==null)return At("Custom function mappers may not return null (i.e. `"+r.name+"` for ele `"+t.id()+"` is null)"),!1;if(s=this.parse(r.name,k,r.bypass,m),!s)return At("Custom function mappers may not return invalid values for the property type (i.e. `"+r.name+"` for ele `"+t.id()+"` is invalid)"),!1;s.mapping=xn(r),r=s;break}case void 0:break;default:return!1}return d?(h?r.bypassed=f.bypassed:r.bypassed=f,i[r.name]=r):h?f.bypassed=r:i[r.name]=r,x(),!0};ka.cleanElements=function(t,e){for(var a=0;a<t.length;a++){var r=t[a];if(this.clearStyleHints(r),r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache(),!e)r._private.style={};else for(var i=r._private.style,s=Object.keys(i),o=0;o<s.length;o++){var u=s[o],d=i[u];d!=null&&(d.bypass?d.bypassed=null:i[u]=null)}}};ka.update=function(){var t=this._private.cy,e=t.mutableElements();e.updateStyle()};ka.updateTransitions=function(t,e){var a=this,r=t._private,i=t.pstyle("transition-property").value,s=t.pstyle("transition-duration").pfValue,o=t.pstyle("transition-delay").pfValue;if(i.length>0&&s>0){for(var u={},d=!1,f=0;f<i.length;f++){var h=i[f],p=t.pstyle(h),m=e[h];if(m){var y=m.prev,x=y,E=m.next!=null?m.next:p,S=!1,T=void 0,C=1e-6;x&&(Oe(x.pfValue)&&Oe(E.pfValue)?(S=E.pfValue-x.pfValue,T=x.pfValue+C*S):Oe(x.value)&&Oe(E.value)?(S=E.value-x.value,T=x.value+C*S):_t(x.value)&&_t(E.value)&&(S=x.value[0]!==E.value[0]||x.value[1]!==E.value[1]||x.value[2]!==E.value[2],T=x.strValue),S&&(u[h]=E.strValue,this.applyBypass(t,h,T),d=!0))}}if(!d)return;r.transitioning=!0,new Bo(function(N){o>0?t.delayAnimation(o).play().promise().then(N):N()}).then(function(){return t.animation({style:u,duration:s,easing:t.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){a.removeBypasses(t,i),t.emitAndNotify("style"),r.transitioning=!1})}else r.transitioning&&(this.removeBypasses(t,i),t.emitAndNotify("style"),r.transitioning=!1)};ka.checkTrigger=function(t,e,a,r,i,s){var o=this.properties[e],u=i(o);t.removed()||u!=null&&u(a,r,t)&&s(o)};ka.checkZOrderTrigger=function(t,e,a,r){var i=this;this.checkTrigger(t,e,a,r,function(s){return s.triggersZOrder},function(){i._private.cy.notify("zorder",t)})};ka.checkBoundsTrigger=function(t,e,a,r){this.checkTrigger(t,e,a,r,function(i){return i.triggersBounds},function(i){t.dirtyCompoundBoundsCache(),t.dirtyBoundingBoxCache()})};ka.checkConnectedEdgesBoundsTrigger=function(t,e,a,r){this.checkTrigger(t,e,a,r,function(i){return i.triggersBoundsOfConnectedEdges},function(i){t.connectedEdges().forEach(function(s){s.dirtyBoundingBoxCache()})})};ka.checkParallelEdgesBoundsTrigger=function(t,e,a,r){this.checkTrigger(t,e,a,r,function(i){return i.triggersBoundsOfParallelEdges},function(i){t.parallelEdges().forEach(function(s){s.dirtyBoundingBoxCache()})})};ka.checkTriggers=function(t,e,a,r){t.dirtyStyleCache(),this.checkZOrderTrigger(t,e,a,r),this.checkBoundsTrigger(t,e,a,r),this.checkConnectedEdgesBoundsTrigger(t,e,a,r),this.checkParallelEdgesBoundsTrigger(t,e,a,r)};var Ac={};Ac.applyBypass=function(t,e,a,r){var i=this,s=[],o=!0;if(e==="*"||e==="**"){if(a!==void 0)for(var u=0;u<i.properties.length;u++){var d=i.properties[u],f=d.name,h=this.parse(f,a,!0);h&&s.push(h)}}else if(Xe(e)){var p=this.parse(e,a,!0);p&&s.push(p)}else if(wt(e)){var m=e;r=a;for(var y=Object.keys(m),x=0;x<y.length;x++){var E=y[x],S=m[E];if(S===void 0&&(S=m[th(E)]),S!==void 0){var T=this.parse(E,S,!0);T&&s.push(T)}}}else return!1;if(s.length===0)return!1;for(var C=!1,N=0;N<t.length;N++){for(var A=t[N],M={},D=void 0,j=0;j<s.length;j++){var R=s[j];if(r){var L=A.pstyle(R.name);D=M[R.name]={prev:L}}C=this.applyParsedProperty(A,xn(R))||C,r&&(D.next=A.pstyle(R.name))}C&&this.updateStyleHints(A),r&&this.updateTransitions(A,M,o)}return C};Ac.overrideBypass=function(t,e,a){e=P0(e);for(var r=0;r<t.length;r++){var i=t[r],s=i._private.style[e],o=this.properties[e].type,u=o.color,d=o.mutiple,f=s?s.pfValue!=null?s.pfValue:s.value:null;!s||!s.bypass?this.applyBypass(i,e,a):(s.value=a,s.pfValue!=null&&(s.pfValue=a),u?s.strValue="rgb("+a.join(",")+")":d?s.strValue=a.join(" "):s.strValue=""+a,this.updateStyleHints(i)),this.checkTriggers(i,e,f,a)}};Ac.removeAllBypasses=function(t,e){return this.removeBypasses(t,this.propertyNames,e)};Ac.removeBypasses=function(t,e,a){for(var r=!0,i=0;i<t.length;i++){for(var s=t[i],o={},u=0;u<e.length;u++){var d=e[u],f=this.properties[d],h=s.pstyle(f.name);if(!(!h||!h.bypass)){var p="",m=this.parse(d,p,!0),y=o[f.name]={prev:h};this.applyParsedProperty(s,m),y.next=s.pstyle(f.name)}}this.updateStyleHints(s),a&&this.updateTransitions(s,o,r)}};var W0={};W0.getEmSizeInPixels=function(){var t=this.containerCss("font-size");return t!=null?parseFloat(t):1};W0.containerCss=function(t){var e=this._private.cy,a=e.container(),r=e.window();if(r&&a&&r.getComputedStyle)return r.getComputedStyle(a).getPropertyValue(t)};var bn={};bn.getRenderedStyle=function(t,e){return e?this.getStylePropertyValue(t,e,!0):this.getRawStyle(t,!0)};bn.getRawStyle=function(t,e){var a=this;if(t=t[0],t){for(var r={},i=0;i<a.properties.length;i++){var s=a.properties[i],o=a.getStylePropertyValue(t,s.name,e);o!=null&&(r[s.name]=o,r[th(s.name)]=o)}return r}};bn.getIndexedStyle=function(t,e,a,r){var i=t.pstyle(e)[a][r];return i??t.cy().style().getDefaultProperty(e)[a][0]};bn.getStylePropertyValue=function(t,e,a){var r=this;if(t=t[0],t){var i=r.properties[e];i.alias&&(i=i.pointsTo);var s=i.type,o=t.pstyle(i.name);if(o){var u=o.value,d=o.units,f=o.strValue;if(a&&s.number&&u!=null&&Oe(u)){var h=t.cy().zoom(),p=function(S){return S*h},m=function(S,T){return p(S)+T},y=_t(u),x=y?d.every(function(E){return E!=null}):d!=null;return x?y?u.map(function(E,S){return m(E,d[S])}).join(" "):m(u,d):y?u.map(function(E){return Xe(E)?E:""+p(E)}).join(" "):""+p(u)}else if(f!=null)return f}return null}};bn.getAnimationStartStyle=function(t,e){for(var a={},r=0;r<e.length;r++){var i=e[r],s=i.name,o=t.pstyle(s);o!==void 0&&(wt(o)?o=this.parse(s,o.strValue):o=this.parse(s,o)),o&&(a[s]=o)}return a};bn.getPropsList=function(t){var e=this,a=[],r=t,i=e.properties;if(r)for(var s=Object.keys(r),o=0;o<s.length;o++){var u=s[o],d=r[u],f=i[u]||i[P0(u)],h=this.parse(f.name,d);h&&a.push(h)}return a};bn.getNonDefaultPropertiesHash=function(t,e,a){var r=a.slice(),i,s,o,u,d,f;for(d=0;d<e.length;d++)if(i=e[d],s=t.pstyle(i,!1),s!=null)if(s.pfValue!=null)r[0]=Xu(u,r[0]),r[1]=Zu(u,r[1]);else for(o=s.strValue,f=0;f<o.length;f++)u=o.charCodeAt(f),r[0]=Xu(u,r[0]),r[1]=Zu(u,r[1]);return r};bn.getPropertiesHash=bn.getNonDefaultPropertiesHash;var vh={};vh.appendFromJson=function(t){for(var e=this,a=0;a<t.length;a++){var r=t[a],i=r.selector,s=r.style||r.css,o=Object.keys(s);e.selector(i);for(var u=0;u<o.length;u++){var d=o[u],f=s[d];e.css(d,f)}}return e};vh.fromJson=function(t){var e=this;return e.resetToDefault(),e.appendFromJson(t),e};vh.json=function(){for(var t=[],e=this.defaultLength;e<this.length;e++){for(var a=this[e],r=a.selector,i=a.properties,s={},o=0;o<i.length;o++){var u=i[o];s[u.name]=u.strValue}t.push({selector:r?r.toString():"core",style:s})}return t};var J0={};J0.appendFromString=function(t){var e=this,a=this,r=""+t,i,s,o;r=r.replace(/[/][*](\s|.)+?[*][/]/g,"");function u(){r.length>i.length?r=r.substr(i.length):r=""}function d(){s.length>o.length?s=s.substr(o.length):s=""}for(;;){var f=r.match(/^\s*$/);if(f)break;var h=r.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!h){At("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+r);break}i=h[0];var p=h[1];if(p!=="core"){var m=new rs(p);if(m.invalid){At("Skipping parsing of block: Invalid selector found in string stylesheet: "+p),u();continue}}var y=h[2],x=!1;s=y;for(var E=[];;){var S=s.match(/^\s*$/);if(S)break;var T=s.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!T){At("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+y),x=!0;break}o=T[0];var C=T[1],N=T[2],A=e.properties[C];if(!A){At("Skipping property: Invalid property name in: "+o),d();continue}var M=a.parse(C,N);if(!M){At("Skipping property: Invalid property definition in: "+o),d();continue}E.push({name:C,val:N}),d()}if(x){u();break}a.selector(p);for(var D=0;D<E.length;D++){var j=E[D];a.css(j.name,j.val)}u()}return a};J0.fromString=function(t){var e=this;return e.resetToDefault(),e.appendFromString(t),e};var ga={};(function(){var t=wa,e=t4,a=r4,r=n4,i=i4,s=function(re){return"^"+re+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},o=function(re){var le=t+"|\\w+|"+e+"|"+a+"|"+r+"|"+i;return"^"+re+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+t+")\\s*\\,\\s*("+t+")\\s*,\\s*("+le+")\\s*\\,\\s*("+le+")\\)$"},u=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];ga.types={time:{number:!0,min:0,units:"s|ms",implicitUnits:"ms"},percent:{number:!0,min:0,max:100,units:"%",implicitUnits:"%"},percentages:{number:!0,min:0,max:100,units:"%",implicitUnits:"%",multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},nonNegativeNumber:{number:!0,min:0,unitless:!0},position:{enums:["parent","origin"]},nodeSize:{number:!0,min:0,enums:["label"]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:["horizontal","leftward","rightward","vertical","upward","downward","auto"]},axisDirectionExplicit:{enums:["leftward","rightward","upward","downward"]},axisDirectionPrimary:{enums:["horizontal","vertical"]},paddingRelativeTo:{enums:["width","height","average","min","max"]},bgWH:{number:!0,min:0,allowPercent:!0,enums:["auto"],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:["inner","include-padding"],multiple:!0},bgRepeat:{enums:["repeat","repeat-x","repeat-y","no-repeat"],multiple:!0},bgFit:{enums:["none","contain","cover"],multiple:!0},bgCrossOrigin:{enums:["anonymous","use-credentials","null"],multiple:!0},bgClip:{enums:["none","node"],multiple:!0},bgContainment:{enums:["inside","over"],multiple:!0},boxSelection:{enums:["contain","overlap","none"]},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:["solid","linear-gradient","radial-gradient"]},bool:{enums:["yes","no"]},bools:{enums:["yes","no"],multiple:!0},lineStyle:{enums:["solid","dotted","dashed"]},lineCap:{enums:["butt","round","square"]},linePosition:{enums:["center","inside","outside"]},lineJoin:{enums:["round","bevel","miter"]},borderStyle:{enums:["solid","dotted","dashed","double"]},curveStyle:{enums:["bezier","unbundled-bezier","haystack","segments","straight","straight-triangle","taxi","round-segments","round-taxi"]},radiusType:{enums:["arc-radius","influence-radius"],multiple:!0},fontFamily:{regex:'^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'},fontStyle:{enums:["italic","normal","oblique"]},fontWeight:{enums:["normal","bold","bolder","lighter","100","200","300","400","500","600","800","900",100,200,300,400,500,600,700,800,900]},textDecoration:{enums:["none","underline","overline","line-through"]},textTransform:{enums:["none","uppercase","lowercase"]},textWrap:{enums:["none","wrap","ellipsis"]},textOverflowWrap:{enums:["whitespace","anywhere"]},textBackgroundShape:{enums:["rectangle","roundrectangle","round-rectangle","circle"]},nodeShape:{enums:["rectangle","roundrectangle","round-rectangle","cutrectangle","cut-rectangle","bottomroundrectangle","bottom-round-rectangle","barrel","ellipse","triangle","round-triangle","square","pentagon","round-pentagon","hexagon","round-hexagon","concavehexagon","concave-hexagon","heptagon","round-heptagon","octagon","round-octagon","tag","round-tag","star","diamond","round-diamond","vee","rhomboid","right-rhomboid","polygon"]},overlayShape:{enums:["roundrectangle","round-rectangle","ellipse"]},cornerRadius:{number:!0,min:0,units:"px|em",implicitUnits:"px",enums:["auto"]},compoundIncludeLabels:{enums:["include","exclude"]},arrowShape:{enums:["tee","triangle","triangle-tee","circle-triangle","triangle-cross","triangle-backcurve","vee","square","circle","diamond","chevron","none"]},arrowFill:{enums:["filled","hollow"]},arrowWidth:{number:!0,units:"%|px|em",implicitUnits:"px",enums:["match-line"]},display:{enums:["element","none"]},visibility:{enums:["hidden","visible"]},zCompoundDepth:{enums:["bottom","orphan","auto","top"]},zIndexCompare:{enums:["auto","manual"]},valign:{enums:["top","center","bottom"]},halign:{enums:["left","center","right"]},justification:{enums:["left","center","right","auto"]},text:{string:!0},data:{mapping:!0,regex:s("data")},layoutData:{mapping:!0,regex:s("layoutData")},scratch:{mapping:!0,regex:s("scratch")},mapData:{mapping:!0,regex:o("mapData")},mapLayoutData:{mapping:!0,regex:o("mapLayoutData")},mapScratch:{mapping:!0,regex:o("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:u,singleRegexMatchValue:!0},urls:{regexes:u,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:"deg|rad",implicitUnits:"rad"},textRotation:{number:!0,units:"deg|rad",implicitUnits:"rad",enums:["none","autorotate"]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:["intersection","node-position","endpoints"]},edgeEndpoint:{number:!0,multiple:!0,units:"%|px|em|deg|rad",implicitUnits:"px",enums:["inside-to-node","outside-to-node","outside-to-node-or-label","outside-to-line","outside-to-line-or-label"],singleEnum:!0,validate:function(re,le){switch(re.length){case 2:return le[0]!=="deg"&&le[0]!=="rad"&&le[1]!=="deg"&&le[1]!=="rad";case 1:return Xe(re[0])||le[0]==="deg"||le[0]==="rad";default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+t+")\\s*,\\s*("+t+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+t+")\\s*,\\s*("+t+")\\s*,\\s*("+t+")\\s*,\\s*("+t+")\\s*\\)$"],enums:["linear","ease","ease-in","ease-out","ease-in-out","ease-in-sine","ease-out-sine","ease-in-out-sine","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic","ease-in-quart","ease-out-quart","ease-in-out-quart","ease-in-quint","ease-out-quint","ease-in-out-quint","ease-in-expo","ease-out-expo","ease-in-out-expo","ease-in-circ","ease-out-circ","ease-in-out-circ"]},gradientDirection:{enums:["to-bottom","to-top","to-left","to-right","to-bottom-right","to-bottom-left","to-top-right","to-top-left","to-right-bottom","to-left-bottom","to-right-top","to-left-top"]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(re){var le=re.length;return le===1||le===2||le===4}}};var d={zeroNonZero:function(re,le){return(re==null||le==null)&&re!==le||re==0&&le!=0?!0:re!=0&&le==0},any:function(re,le){return re!=le},emptyNonEmpty:function(re,le){var se=es(re),Ne=es(le);return se&&!Ne||!se&&Ne}},f=ga.types,h=[{name:"label",type:f.text,triggersBounds:d.any,triggersZOrder:d.emptyNonEmpty},{name:"text-rotation",type:f.textRotation,triggersBounds:d.any},{name:"text-margin-x",type:f.bidirectionalSize,triggersBounds:d.any},{name:"text-margin-y",type:f.bidirectionalSize,triggersBounds:d.any}],p=[{name:"source-label",type:f.text,triggersBounds:d.any},{name:"source-text-rotation",type:f.textRotation,triggersBounds:d.any},{name:"source-text-margin-x",type:f.bidirectionalSize,triggersBounds:d.any},{name:"source-text-margin-y",type:f.bidirectionalSize,triggersBounds:d.any},{name:"source-text-offset",type:f.size,triggersBounds:d.any}],m=[{name:"target-label",type:f.text,triggersBounds:d.any},{name:"target-text-rotation",type:f.textRotation,triggersBounds:d.any},{name:"target-text-margin-x",type:f.bidirectionalSize,triggersBounds:d.any},{name:"target-text-margin-y",type:f.bidirectionalSize,triggersBounds:d.any},{name:"target-text-offset",type:f.size,triggersBounds:d.any}],y=[{name:"font-family",type:f.fontFamily,triggersBounds:d.any},{name:"font-style",type:f.fontStyle,triggersBounds:d.any},{name:"font-weight",type:f.fontWeight,triggersBounds:d.any},{name:"font-size",type:f.size,triggersBounds:d.any},{name:"text-transform",type:f.textTransform,triggersBounds:d.any},{name:"text-wrap",type:f.textWrap,triggersBounds:d.any},{name:"text-overflow-wrap",type:f.textOverflowWrap,triggersBounds:d.any},{name:"text-max-width",type:f.size,triggersBounds:d.any},{name:"text-outline-width",type:f.size,triggersBounds:d.any},{name:"line-height",type:f.positiveNumber,triggersBounds:d.any}],x=[{name:"text-valign",type:f.valign,triggersBounds:d.any},{name:"text-halign",type:f.halign,triggersBounds:d.any},{name:"color",type:f.color},{name:"text-outline-color",type:f.color},{name:"text-outline-opacity",type:f.zeroOneNumber},{name:"text-background-color",type:f.color},{name:"text-background-opacity",type:f.zeroOneNumber},{name:"text-background-padding",type:f.size,triggersBounds:d.any},{name:"text-border-opacity",type:f.zeroOneNumber},{name:"text-border-color",type:f.color},{name:"text-border-width",type:f.size,triggersBounds:d.any},{name:"text-border-style",type:f.borderStyle,triggersBounds:d.any},{name:"text-background-shape",type:f.textBackgroundShape,triggersBounds:d.any},{name:"text-justification",type:f.justification},{name:"box-select-labels",type:f.bool,triggersBounds:d.any}],E=[{name:"events",type:f.bool,triggersZOrder:d.any},{name:"text-events",type:f.bool,triggersZOrder:d.any},{name:"box-selection",type:f.boxSelection,triggersZOrder:d.any}],S=[{name:"display",type:f.display,triggersZOrder:d.any,triggersBounds:d.any,triggersBoundsOfConnectedEdges:d.any,triggersBoundsOfParallelEdges:function(re,le,se){return re===le?!1:se.pstyle("curve-style").value==="bezier"}},{name:"visibility",type:f.visibility,triggersZOrder:d.any},{name:"opacity",type:f.zeroOneNumber,triggersZOrder:d.zeroNonZero},{name:"text-opacity",type:f.zeroOneNumber},{name:"min-zoomed-font-size",type:f.size},{name:"z-compound-depth",type:f.zCompoundDepth,triggersZOrder:d.any},{name:"z-index-compare",type:f.zIndexCompare,triggersZOrder:d.any},{name:"z-index",type:f.number,triggersZOrder:d.any}],T=[{name:"overlay-padding",type:f.size,triggersBounds:d.any},{name:"overlay-color",type:f.color},{name:"overlay-opacity",type:f.zeroOneNumber,triggersBounds:d.zeroNonZero},{name:"overlay-shape",type:f.overlayShape,triggersBounds:d.any},{name:"overlay-corner-radius",type:f.cornerRadius}],C=[{name:"underlay-padding",type:f.size,triggersBounds:d.any},{name:"underlay-color",type:f.color},{name:"underlay-opacity",type:f.zeroOneNumber,triggersBounds:d.zeroNonZero},{name:"underlay-shape",type:f.overlayShape,triggersBounds:d.any},{name:"underlay-corner-radius",type:f.cornerRadius}],N=[{name:"transition-property",type:f.propList},{name:"transition-duration",type:f.time},{name:"transition-delay",type:f.time},{name:"transition-timing-function",type:f.easing}],A=function(re,le){return le.value==="label"?-re.poolIndex():le.pfValue},M=[{name:"height",type:f.nodeSize,triggersBounds:d.any,hashOverride:A},{name:"width",type:f.nodeSize,triggersBounds:d.any,hashOverride:A},{name:"shape",type:f.nodeShape,triggersBounds:d.any},{name:"shape-polygon-points",type:f.polygonPointList,triggersBounds:d.any},{name:"corner-radius",type:f.cornerRadius},{name:"background-color",type:f.color},{name:"background-fill",type:f.fill},{name:"background-opacity",type:f.zeroOneNumber},{name:"background-blacken",type:f.nOneOneNumber},{name:"background-gradient-stop-colors",type:f.colors},{name:"background-gradient-stop-positions",type:f.percentages},{name:"background-gradient-direction",type:f.gradientDirection},{name:"padding",type:f.sizeMaybePercent,triggersBounds:d.any},{name:"padding-relative-to",type:f.paddingRelativeTo,triggersBounds:d.any},{name:"bounds-expansion",type:f.boundsExpansion,triggersBounds:d.any}],D=[{name:"border-color",type:f.color},{name:"border-opacity",type:f.zeroOneNumber},{name:"border-width",type:f.size,triggersBounds:d.any},{name:"border-style",type:f.borderStyle},{name:"border-cap",type:f.lineCap},{name:"border-join",type:f.lineJoin},{name:"border-dash-pattern",type:f.numbers},{name:"border-dash-offset",type:f.number},{name:"border-position",type:f.linePosition}],j=[{name:"outline-color",type:f.color},{name:"outline-opacity",type:f.zeroOneNumber},{name:"outline-width",type:f.size,triggersBounds:d.any},{name:"outline-style",type:f.borderStyle},{name:"outline-offset",type:f.size,triggersBounds:d.any}],R=[{name:"background-image",type:f.urls},{name:"background-image-crossorigin",type:f.bgCrossOrigin},{name:"background-image-opacity",type:f.zeroOneNumbers},{name:"background-image-containment",type:f.bgContainment},{name:"background-image-smoothing",type:f.bools},{name:"background-position-x",type:f.bgPos},{name:"background-position-y",type:f.bgPos},{name:"background-width-relative-to",type:f.bgRelativeTo},{name:"background-height-relative-to",type:f.bgRelativeTo},{name:"background-repeat",type:f.bgRepeat},{name:"background-fit",type:f.bgFit},{name:"background-clip",type:f.bgClip},{name:"background-width",type:f.bgWH},{name:"background-height",type:f.bgWH},{name:"background-offset-x",type:f.bgPos},{name:"background-offset-y",type:f.bgPos}],L=[{name:"position",type:f.position,triggersBounds:d.any},{name:"compound-sizing-wrt-labels",type:f.compoundIncludeLabels,triggersBounds:d.any},{name:"min-width",type:f.size,triggersBounds:d.any},{name:"min-width-bias-left",type:f.sizeMaybePercent,triggersBounds:d.any},{name:"min-width-bias-right",type:f.sizeMaybePercent,triggersBounds:d.any},{name:"min-height",type:f.size,triggersBounds:d.any},{name:"min-height-bias-top",type:f.sizeMaybePercent,triggersBounds:d.any},{name:"min-height-bias-bottom",type:f.sizeMaybePercent,triggersBounds:d.any}],z=[{name:"line-style",type:f.lineStyle},{name:"line-color",type:f.color},{name:"line-fill",type:f.fill},{name:"line-cap",type:f.lineCap},{name:"line-opacity",type:f.zeroOneNumber},{name:"line-dash-pattern",type:f.numbers},{name:"line-dash-offset",type:f.number},{name:"line-outline-width",type:f.size},{name:"line-outline-color",type:f.color},{name:"line-gradient-stop-colors",type:f.colors},{name:"line-gradient-stop-positions",type:f.percentages},{name:"curve-style",type:f.curveStyle,triggersBounds:d.any,triggersBoundsOfParallelEdges:function(re,le){return re===le?!1:re==="bezier"||le==="bezier"}},{name:"haystack-radius",type:f.zeroOneNumber,triggersBounds:d.any},{name:"source-endpoint",type:f.edgeEndpoint,triggersBounds:d.any},{name:"target-endpoint",type:f.edgeEndpoint,triggersBounds:d.any},{name:"control-point-step-size",type:f.size,triggersBounds:d.any},{name:"control-point-distances",type:f.bidirectionalSizes,triggersBounds:d.any},{name:"control-point-weights",type:f.numbers,triggersBounds:d.any},{name:"segment-distances",type:f.bidirectionalSizes,triggersBounds:d.any},{name:"segment-weights",type:f.numbers,triggersBounds:d.any},{name:"segment-radii",type:f.numbers,triggersBounds:d.any},{name:"radius-type",type:f.radiusType,triggersBounds:d.any},{name:"taxi-turn",type:f.bidirectionalSizeMaybePercent,triggersBounds:d.any},{name:"taxi-turn-min-distance",type:f.size,triggersBounds:d.any},{name:"taxi-direction",type:f.axisDirection,triggersBounds:d.any},{name:"taxi-radius",type:f.number,triggersBounds:d.any},{name:"edge-distances",type:f.edgeDistances,triggersBounds:d.any},{name:"arrow-scale",type:f.positiveNumber,triggersBounds:d.any},{name:"loop-direction",type:f.angle,triggersBounds:d.any},{name:"loop-sweep",type:f.angle,triggersBounds:d.any},{name:"source-distance-from-node",type:f.size,triggersBounds:d.any},{name:"target-distance-from-node",type:f.size,triggersBounds:d.any}],_=[{name:"ghost",type:f.bool,triggersBounds:d.any},{name:"ghost-offset-x",type:f.bidirectionalSize,triggersBounds:d.any},{name:"ghost-offset-y",type:f.bidirectionalSize,triggersBounds:d.any},{name:"ghost-opacity",type:f.zeroOneNumber}],B=[{name:"selection-box-color",type:f.color},{name:"selection-box-opacity",type:f.zeroOneNumber},{name:"selection-box-border-color",type:f.color},{name:"selection-box-border-width",type:f.size},{name:"active-bg-color",type:f.color},{name:"active-bg-opacity",type:f.zeroOneNumber},{name:"active-bg-size",type:f.size},{name:"outside-texture-bg-color",type:f.color},{name:"outside-texture-bg-opacity",type:f.zeroOneNumber}],q=[];ga.pieBackgroundN=16,q.push({name:"pie-size",type:f.sizeMaybePercent}),q.push({name:"pie-hole",type:f.sizeMaybePercent}),q.push({name:"pie-start-angle",type:f.angle});for(var V=1;V<=ga.pieBackgroundN;V++)q.push({name:"pie-"+V+"-background-color",type:f.color}),q.push({name:"pie-"+V+"-background-size",type:f.percent}),q.push({name:"pie-"+V+"-background-opacity",type:f.zeroOneNumber});var Q=[];ga.stripeBackgroundN=16,Q.push({name:"stripe-size",type:f.sizeMaybePercent}),Q.push({name:"stripe-direction",type:f.axisDirectionPrimary});for(var P=1;P<=ga.stripeBackgroundN;P++)Q.push({name:"stripe-"+P+"-background-color",type:f.color}),Q.push({name:"stripe-"+P+"-background-size",type:f.percent}),Q.push({name:"stripe-"+P+"-background-opacity",type:f.zeroOneNumber});var U=[],F=ga.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:f.arrowShape,triggersBounds:d.any},{name:"arrow-color",type:f.color},{name:"arrow-fill",type:f.arrowFill},{name:"arrow-width",type:f.arrowWidth}].forEach(function(ae){F.forEach(function(re){var le=re+"-"+ae.name,se=ae.type,Ne=ae.triggersBounds;U.push({name:le,type:se,triggersBounds:Ne})})},{});var K=ga.properties=[].concat(E,N,S,T,C,_,x,y,h,p,m,M,D,j,R,q,Q,L,z,U,B),J=ga.propertyGroups={behavior:E,transition:N,visibility:S,overlay:T,underlay:C,ghost:_,commonLabel:x,labelDimensions:y,mainLabel:h,sourceLabel:p,targetLabel:m,nodeBody:M,nodeBorder:D,nodeOutline:j,backgroundImage:R,pie:q,stripe:Q,compound:L,edgeLine:z,edgeArrow:U,core:B},k=ga.propertyGroupNames={},G=ga.propertyGroupKeys=Object.keys(J);G.forEach(function(ae){k[ae]=J[ae].map(function(re){return re.name}),J[ae].forEach(function(re){return re.groupKey=ae})});var X=ga.aliases=[{name:"content",pointsTo:"label"},{name:"control-point-distance",pointsTo:"control-point-distances"},{name:"control-point-weight",pointsTo:"control-point-weights"},{name:"segment-distance",pointsTo:"segment-distances"},{name:"segment-weight",pointsTo:"segment-weights"},{name:"segment-radius",pointsTo:"segment-radii"},{name:"edge-text-rotation",pointsTo:"text-rotation"},{name:"padding-left",pointsTo:"padding"},{name:"padding-right",pointsTo:"padding"},{name:"padding-top",pointsTo:"padding"},{name:"padding-bottom",pointsTo:"padding"}];ga.propertyNames=K.map(function(ae){return ae.name});for(var W=0;W<K.length;W++){var $=K[W];K[$.name]=$}for(var ee=0;ee<X.length;ee++){var ie=X[ee],he=K[ie.pointsTo],oe={name:ie.name,alias:!0,pointsTo:he};K.push(oe),K[ie.name]=oe}})();ga.getDefaultProperty=function(t){return this.getDefaultProperties()[t]};ga.getDefaultProperties=function(){var t=this._private;if(t.defaultProperties!=null)return t.defaultProperties;for(var e=et({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125,events:"yes","text-events":"no","text-valign":"top","text-halign":"center","text-justification":"auto","line-height":1,color:"#000","box-selection":"contain","text-outline-color":"#000","text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":"none","text-transform":"none","text-wrap":"none","text-overflow-wrap":"whitespace","text-max-width":9999,"text-background-color":"#000","text-background-opacity":0,"text-background-shape":"rectangle","text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":"solid","text-border-color":"#000","font-family":"Helvetica Neue, Helvetica, sans-serif","font-style":"normal","font-weight":"normal","font-size":16,"min-zoomed-font-size":0,"text-rotation":"none","source-text-rotation":"none","target-text-rotation":"none",visibility:"visible",display:"element",opacity:1,"z-compound-depth":"auto","z-index-compare":"auto","z-index":0,label:"","text-margin-x":0,"text-margin-y":0,"source-label":"","source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":"","target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":"#000","overlay-padding":10,"overlay-shape":"round-rectangle","overlay-corner-radius":"auto","underlay-opacity":0,"underlay-color":"#000","underlay-padding":10,"underlay-shape":"round-rectangle","underlay-corner-radius":"auto","transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","box-select-labels":"no","background-blacken":0,"background-color":"#999","background-fill":"solid","background-opacity":1,"background-image":"none","background-image-crossorigin":"anonymous","background-image-opacity":1,"background-image-containment":"inside","background-image-smoothing":"yes","background-position-x":"50%","background-position-y":"50%","background-offset-x":0,"background-offset-y":0,"background-width-relative-to":"include-padding","background-height-relative-to":"include-padding","background-repeat":"no-repeat","background-fit":"none","background-clip":"node","background-width":"auto","background-height":"auto","border-color":"#000","border-opacity":1,"border-width":0,"border-style":"solid","border-dash-pattern":[4,2],"border-dash-offset":0,"border-cap":"butt","border-join":"miter","border-position":"center","outline-color":"#999","outline-opacity":1,"outline-width":0,"outline-offset":0,"outline-style":"solid",height:30,width:30,shape:"ellipse","shape-polygon-points":"-1, -1, 1, -1, 1, 1, -1, 1","corner-radius":"auto","bounds-expansion":0,"background-gradient-direction":"to-bottom","background-gradient-stop-colors":"#999","background-gradient-stop-positions":"0%",ghost:"no","ghost-offset-y":0,"ghost-offset-x":0,"ghost-opacity":0,padding:0,"padding-relative-to":"width",position:"origin","compound-sizing-wrt-labels":"include","min-width":0,"min-width-bias-left":0,"min-width-bias-right":0,"min-height":0,"min-height-bias-top":0,"min-height-bias-bottom":0},{"pie-size":"100%","pie-hole":0,"pie-start-angle":"0deg"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce(function(d,f){for(var h=1;h<=ga.pieBackgroundN;h++){var p=f.name.replace("{{i}}",h),m=f.value;d[p]=m}return d},{}),{"stripe-size":"100%","stripe-direction":"horizontal"},[{name:"stripe-{{i}}-background-color",value:"black"},{name:"stripe-{{i}}-background-size",value:"0%"},{name:"stripe-{{i}}-background-opacity",value:1}].reduce(function(d,f){for(var h=1;h<=ga.stripeBackgroundN;h++){var p=f.name.replace("{{i}}",h),m=f.value;d[p]=m}return d},{}),{"line-style":"solid","line-color":"#999","line-fill":"solid","line-cap":"butt","line-opacity":1,"line-outline-width":0,"line-outline-color":"#000","line-gradient-stop-colors":"#999","line-gradient-stop-positions":"0%","control-point-step-size":40,"control-point-weights":.5,"segment-weights":.5,"segment-distances":20,"segment-radii":15,"radius-type":"arc-radius","taxi-turn":"50%","taxi-radius":15,"taxi-turn-min-distance":10,"taxi-direction":"auto","edge-distances":"intersection","curve-style":"haystack","haystack-radius":0,"arrow-scale":1,"loop-direction":"-45deg","loop-sweep":"-90deg","source-distance-from-node":0,"target-distance-from-node":0,"source-endpoint":"outside-to-node","target-endpoint":"outside-to-node","line-dash-pattern":[6,3],"line-dash-offset":0},[{name:"arrow-shape",value:"none"},{name:"arrow-color",value:"#999"},{name:"arrow-fill",value:"filled"},{name:"arrow-width",value:1}].reduce(function(d,f){return ga.arrowPrefixes.forEach(function(h){var p=h+"-"+f.name,m=f.value;d[p]=m}),d},{})),a={},r=0;r<this.properties.length;r++){var i=this.properties[r];if(!i.pointsTo){var s=i.name,o=e[s],u=this.parse(s,o);a[s]=u}}return t.defaultProperties=a,t.defaultProperties};ga.addDefaultStylesheet=function(){this.selector(":parent").css({shape:"rectangle",padding:10,"background-color":"#eee","border-color":"#ccc","border-width":1}).selector("edge").css({width:3}).selector(":loop").css({"curve-style":"bezier"}).selector("edge:compound").css({"curve-style":"bezier","source-endpoint":"outside-to-line","target-endpoint":"outside-to-line"}).selector(":selected").css({"background-color":"#0169D9","line-color":"#0169D9","source-arrow-color":"#0169D9","target-arrow-color":"#0169D9","mid-source-arrow-color":"#0169D9","mid-target-arrow-color":"#0169D9"}).selector(":parent:selected").css({"background-color":"#CCE1F9","border-color":"#aec8e5"}).selector(":active").css({"overlay-color":"black","overlay-padding":10,"overlay-opacity":.25}),this.defaultLength=this.length};var ph={};ph.parse=function(t,e,a,r){var i=this;if(Zt(e))return i.parseImplWarn(t,e,a,r);var s=r==="mapping"||r===!0||r===!1||r==null?"dontcare":r,o=a?"t":"f",u=""+e,d=KT(t,u,o,s),f=i.propCache=i.propCache||[],h;return(h=f[d])||(h=f[d]=i.parseImplWarn(t,e,a,r)),(a||r==="mapping")&&(h=xn(h),h&&(h.value=xn(h.value))),h};ph.parseImplWarn=function(t,e,a,r){var i=this.parseImpl(t,e,a,r);return!i&&e!=null&&At("The style property `".concat(t,": ").concat(e,"` is invalid")),i&&(i.name==="width"||i.name==="height")&&e==="label"&&At("The style value of `label` is deprecated for `"+i.name+"`"),i};ph.parseImpl=function(t,e,a,r){var i=this;t=P0(t);var s=i.properties[t],o=e,u=i.types;if(!s||e===void 0)return null;s.alias&&(s=s.pointsTo,t=s.name);var d=Xe(e);d&&(e=e.trim());var f=s.type;if(!f)return null;if(a&&(e===""||e===null))return{name:t,value:e,bypass:!0,deleteBypass:!0};if(Zt(e))return{name:t,value:e,strValue:"fn",mapped:u.fn,bypass:a};var h,p;if(!(!d||r||e.length<7||e[1]!=="a")){if(e.length>=7&&e[0]==="d"&&(h=new RegExp(u.data.regex).exec(e))){if(a)return!1;var m=u.data;return{name:t,value:h,strValue:""+e,mapped:m,field:h[1],bypass:a}}else if(e.length>=10&&e[0]==="m"&&(p=new RegExp(u.mapData.regex).exec(e))){if(a||f.multiple)return!1;var y=u.mapData;if(!(f.color||f.number))return!1;var x=this.parse(t,p[4]);if(!x||x.mapped)return!1;var E=this.parse(t,p[5]);if(!E||E.mapped)return!1;if(x.pfValue===E.pfValue||x.strValue===E.strValue)return At("`"+t+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+t+": "+x.strValue+"`"),this.parse(t,x.strValue);if(f.color){var S=x.value,T=E.value,C=S[0]===T[0]&&S[1]===T[1]&&S[2]===T[2]&&(S[3]===T[3]||(S[3]==null||S[3]===1)&&(T[3]==null||T[3]===1));if(C)return!1}return{name:t,value:p,strValue:""+e,mapped:y,field:p[1],fieldMin:parseFloat(p[2]),fieldMax:parseFloat(p[3]),valueMin:x.value,valueMax:E.value,bypass:a}}}if(f.multiple&&r!=="multiple"){var N;if(d?N=e.split(/\s+/):_t(e)?N=e:N=[e],f.evenMultiple&&N.length%2!==0)return null;for(var A=[],M=[],D=[],j="",R=!1,L=0;L<N.length;L++){var z=i.parse(t,N[L],a,"multiple");R=R||Xe(z.value),A.push(z.value),D.push(z.pfValue!=null?z.pfValue:z.value),M.push(z.units),j+=(L>0?" ":"")+z.strValue}return f.validate&&!f.validate(A,M)?null:f.singleEnum&&R?A.length===1&&Xe(A[0])?{name:t,value:A[0],strValue:A[0],bypass:a}:null:{name:t,value:A,pfValue:D,strValue:j,bypass:a,units:M}}var _=function(){for(var oe=0;oe<f.enums.length;oe++){var ae=f.enums[oe];if(ae===e)return{name:t,value:e,strValue:""+e,bypass:a}}return null};if(f.number){var B,q="px";if(f.units&&(B=f.units),f.implicitUnits&&(q=f.implicitUnits),!f.unitless)if(d){var V="px|em"+(f.allowPercent?"|\\%":"");B&&(V=B);var Q=e.match("^("+wa+")("+V+")?$");Q&&(e=Q[1],B=Q[2]||q)}else(!B||f.implicitUnits)&&(B=q);if(e=parseFloat(e),isNaN(e)&&f.enums===void 0)return null;if(isNaN(e)&&f.enums!==void 0)return e=o,_();if(f.integer&&!KO(e)||f.min!==void 0&&(e<f.min||f.strictMin&&e===f.min)||f.max!==void 0&&(e>f.max||f.strictMax&&e===f.max))return null;var P={name:t,value:e,strValue:""+e+(B||""),units:B,bypass:a};return f.unitless||B!=="px"&&B!=="em"?P.pfValue=e:P.pfValue=B==="px"||!B?e:this.getEmSizeInPixels()*e,(B==="ms"||B==="s")&&(P.pfValue=B==="ms"?e:1e3*e),(B==="deg"||B==="rad")&&(P.pfValue=B==="rad"?e:nR(e)),B==="%"&&(P.pfValue=e/100),P}else if(f.propList){var U=[],F=""+e;if(F!=="none"){for(var K=F.split(/\s*,\s*|\s+/),J=0;J<K.length;J++){var k=K[J].trim();i.properties[k]?U.push(k):At("`"+k+"` is not a valid property name")}if(U.length===0)return null}return{name:t,value:U,strValue:U.length===0?"none":U.join(" "),bypass:a}}else if(f.color){var G=IT(e);return G?{name:t,value:G,pfValue:G,strValue:"rgb("+G[0]+","+G[1]+","+G[2]+")",bypass:a}:null}else if(f.regex||f.regexes){if(f.enums){var X=_();if(X)return X}for(var W=f.regexes?f.regexes:[f.regex],$=0;$<W.length;$++){var ee=new RegExp(W[$]),ie=ee.exec(e);if(ie)return{name:t,value:f.singleRegexMatchValue?ie[1]:ie,strValue:""+e,bypass:a}}return null}else return f.string?{name:t,value:""+e,strValue:""+e,bypass:a}:f.enums?_():null};var Ra=function(e){if(!(this instanceof Ra))return new Ra(e);if(!z0(e)){Qt("A style must have a core reference");return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},Za=Ra.prototype;Za.instanceString=function(){return"style"};Za.clear=function(){for(var t=this._private,e=t.cy,a=e.elements(),r=0;r<this.length;r++)this[r]=void 0;return this.length=0,t.contextStyles={},t.propDiffs={},this.cleanElements(a,!0),a.forEach(function(i){var s=i[0]._private;s.styleDirty=!0,s.appliedInitStyle=!1}),this};Za.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this};Za.core=function(t){return this._private.coreStyle[t]||this.getDefaultProperty(t)};Za.selector=function(t){var e=t==="core"?null:new rs(t),a=this.length++;return this[a]={selector:e,properties:[],mappedProperties:[],index:a},this};Za.css=function(){var t=this,e=arguments;if(e.length===1)for(var a=e[0],r=0;r<t.properties.length;r++){var i=t.properties[r],s=a[i.name];s===void 0&&(s=a[th(i.name)]),s!==void 0&&this.cssRule(i.name,s)}else e.length===2&&this.cssRule(e[0],e[1]);return this};Za.style=Za.css;Za.cssRule=function(t,e){var a=this.parse(t,e);if(a){var r=this.length-1;this[r].properties.push(a),this[r].properties[a.name]=a,a.name.match(/pie-(\d+)-background-size/)&&a.value&&(this._private.hasPie=!0),a.name.match(/stripe-(\d+)-background-size/)&&a.value&&(this._private.hasStripe=!0),a.mapped&&this[r].mappedProperties.push(a);var i=!this[r].selector;i&&(this._private.coreStyle[a.name]=a)}return this};Za.append=function(t){return _T(t)?t.appendToStyle(this):_t(t)?this.appendFromJson(t):Xe(t)&&this.appendFromString(t),this};Ra.fromJson=function(t,e){var a=new Ra(t);return a.fromJson(e),a};Ra.fromString=function(t,e){return new Ra(t).fromString(e)};[ka,Ac,W0,bn,vh,J0,ga,ph].forEach(function(t){et(Za,t)});Ra.types=Za.types;Ra.properties=Za.properties;Ra.propertyGroups=Za.propertyGroups;Ra.propertyGroupNames=Za.propertyGroupNames;Ra.propertyGroupKeys=Za.propertyGroupKeys;var oB={style:function(e){if(e){var a=this.setStyle(e);a.update()}return this._private.style},setStyle:function(e){var a=this._private;return _T(e)?a.style=e.generateStyle(this):_t(e)?a.style=Ra.fromJson(this,e):Xe(e)?a.style=Ra.fromString(this,e):a.style=Ra(this),a.style},updateStyle:function(){this.mutableElements().updateStyle()}},uB="single",tl={autolock:function(e){if(e!==void 0)this._private.autolock=!!e;else return this._private.autolock;return this},autoungrabify:function(e){if(e!==void 0)this._private.autoungrabify=!!e;else return this._private.autoungrabify;return this},autounselectify:function(e){if(e!==void 0)this._private.autounselectify=!!e;else return this._private.autounselectify;return this},selectionType:function(e){var a=this._private;if(a.selectionType==null&&(a.selectionType=uB),e!==void 0)(e==="additive"||e==="single")&&(a.selectionType=e);else return a.selectionType;return this},panningEnabled:function(e){if(e!==void 0)this._private.panningEnabled=!!e;else return this._private.panningEnabled;return this},userPanningEnabled:function(e){if(e!==void 0)this._private.userPanningEnabled=!!e;else return this._private.userPanningEnabled;return this},zoomingEnabled:function(e){if(e!==void 0)this._private.zoomingEnabled=!!e;else return this._private.zoomingEnabled;return this},userZoomingEnabled:function(e){if(e!==void 0)this._private.userZoomingEnabled=!!e;else return this._private.userZoomingEnabled;return this},boxSelectionEnabled:function(e){if(e!==void 0)this._private.boxSelectionEnabled=!!e;else return this._private.boxSelectionEnabled;return this},pan:function(){var e=arguments,a=this._private.pan,r,i,s,o,u;switch(e.length){case 0:return a;case 1:if(Xe(e[0]))return r=e[0],a[r];if(wt(e[0])){if(!this._private.panningEnabled)return this;s=e[0],o=s.x,u=s.y,Oe(o)&&(a.x=o),Oe(u)&&(a.y=u),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;r=e[0],i=e[1],(r==="x"||r==="y")&&Oe(i)&&(a[r]=i),this.emit("pan viewport");break}return this.notify("viewport"),this},panBy:function(e,a){var r=arguments,i=this._private.pan,s,o,u,d,f;if(!this._private.panningEnabled)return this;switch(r.length){case 1:wt(e)&&(u=r[0],d=u.x,f=u.y,Oe(d)&&(i.x+=d),Oe(f)&&(i.y+=f),this.emit("pan viewport"));break;case 2:s=e,o=a,(s==="x"||s==="y")&&Oe(o)&&(i[s]+=o),this.emit("pan viewport");break}return this.notify("viewport"),this},gc:function(){this.notify("gc")},fit:function(e,a){var r=this.getFitViewport(e,a);if(r){var i=this._private;i.zoom=r.zoom,i.pan=r.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,a){if(Oe(e)&&a===void 0&&(a=e,e=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var r;if(Xe(e)){var i=e;e=this.$(i)}else if(ZO(e)){var s=e;r={x1:s.x1,y1:s.y1,x2:s.x2,y2:s.y2},r.w=r.x2-r.x1,r.h=r.y2-r.y1}else Mr(e)||(e=this.mutableElements());if(!(Mr(e)&&e.empty())){r=r||e.boundingBox();var o=this.width(),u=this.height(),d;if(a=Oe(a)?a:0,!isNaN(o)&&!isNaN(u)&&o>0&&u>0&&!isNaN(r.w)&&!isNaN(r.h)&&r.w>0&&r.h>0){d=Math.min((o-2*a)/r.w,(u-2*a)/r.h),d=d>this._private.maxZoom?this._private.maxZoom:d,d=d<this._private.minZoom?this._private.minZoom:d;var f={x:(o-d*(r.x1+r.x2))/2,y:(u-d*(r.y1+r.y2))/2};return{zoom:d,pan:f}}}}},zoomRange:function(e,a){var r=this._private;if(a==null){var i=e;e=i.min,a=i.max}return Oe(e)&&Oe(a)&&e<=a?(r.minZoom=e,r.maxZoom=a):Oe(e)&&a===void 0&&e<=r.maxZoom?r.minZoom=e:Oe(a)&&e===void 0&&a>=r.minZoom&&(r.maxZoom=a),this},minZoom:function(e){return e===void 0?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return e===void 0?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var a=this._private,r=a.pan,i=a.zoom,s,o,u=!1;if(a.zoomingEnabled||(u=!0),Oe(e)?o=e:wt(e)&&(o=e.level,e.position!=null?s=nh(e.position,i,r):e.renderedPosition!=null&&(s=e.renderedPosition),s!=null&&!a.panningEnabled&&(u=!0)),o=o>a.maxZoom?a.maxZoom:o,o=o<a.minZoom?a.minZoom:o,u||!Oe(o)||o===i||s!=null&&(!Oe(s.x)||!Oe(s.y)))return null;if(s!=null){var d=r,f=i,h=o,p={x:-h/f*(s.x-d.x)+s.x,y:-h/f*(s.y-d.y)+s.y};return{zoomed:!0,panned:!0,zoom:h,pan:p}}else return{zoomed:!0,panned:!1,zoom:o,pan:r}},zoom:function(e){if(e===void 0)return this._private.zoom;var a=this.getZoomedViewport(e),r=this._private;return a==null||!a.zoomed?this:(r.zoom=a.zoom,a.panned&&(r.pan.x=a.pan.x,r.pan.y=a.pan.y),this.emit("zoom"+(a.panned?" pan":"")+" viewport"),this.notify("viewport"),this)},viewport:function(e){var a=this._private,r=!0,i=!0,s=[],o=!1,u=!1;if(!e)return this;if(Oe(e.zoom)||(r=!1),wt(e.pan)||(i=!1),!r&&!i)return this;if(r){var d=e.zoom;d<a.minZoom||d>a.maxZoom||!a.zoomingEnabled?o=!0:(a.zoom=d,s.push("zoom"))}if(i&&(!o||!e.cancelOnFailedZoom)&&a.panningEnabled){var f=e.pan;Oe(f.x)&&(a.pan.x=f.x,u=!1),Oe(f.y)&&(a.pan.y=f.y,u=!1),u||s.push("pan")}return s.length>0&&(s.push("viewport"),this.emit(s.join(" ")),this.notify("viewport")),this},center:function(e){var a=this.getCenterPan(e);return a&&(this._private.pan=a,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,a){if(this._private.panningEnabled){if(Xe(e)){var r=e;e=this.mutableElements().filter(r)}else Mr(e)||(e=this.mutableElements());if(e.length!==0){var i=e.boundingBox(),s=this.width(),o=this.height();a=a===void 0?this._private.zoom:a;var u={x:(s-a*(i.x1+i.x2))/2,y:(o-a*(i.y1+i.y2))/2};return u}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,a=e.container,r=this;return e.sizeCache=e.sizeCache||(a?(function(){var i=r.window().getComputedStyle(a),s=function(u){return parseFloat(i.getPropertyValue(u))};return{width:a.clientWidth-s("padding-left")-s("padding-right"),height:a.clientHeight-s("padding-top")-s("padding-bottom")}})():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,a=this._private.zoom,r=this.renderedExtent(),i={x1:(r.x1-e.x)/a,x2:(r.x2-e.x)/a,y1:(r.y1-e.y)/a,y2:(r.y2-e.y)/a};return i.w=i.x2-i.x1,i.h=i.y2-i.y1,i},renderedExtent:function(){var e=this.width(),a=this.height();return{x1:0,y1:0,x2:e,y2:a,w:e,h:a}},multiClickDebounceTime:function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};tl.centre=tl.center;tl.autolockNodes=tl.autolock;tl.autoungrabifyNodes=tl.autoungrabify;var rc={data:jt.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:jt.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:jt.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:jt.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};rc.attr=rc.data;rc.removeAttr=rc.removeData;var nc=function(e){var a=this;e=et({},e);var r=e.container;r&&!Lf(r)&&Lf(r[0])&&(r=r[0]);var i=r?r._cyreg:null;i=i||{},i&&i.cy&&(i.cy.destroy(),i={});var s=i.readies=i.readies||[];r&&(r._cyreg=i),i.cy=a;var o=ba!==void 0&&r!==void 0&&!e.headless,u=e;u.layout=et({name:o?"grid":"null"},u.layout),u.renderer=et({name:o?"canvas":"null"},u.renderer);var d=function(x,E,S){return E!==void 0?E:S!==void 0?S:x},f=this._private={container:r,ready:!1,options:u,elements:new Ia(this),listeners:[],aniEles:new Ia(this),data:u.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:d(!0,u.zoomingEnabled),userZoomingEnabled:d(!0,u.userZoomingEnabled),panningEnabled:d(!0,u.panningEnabled),userPanningEnabled:d(!0,u.userPanningEnabled),boxSelectionEnabled:d(!0,u.boxSelectionEnabled),autolock:d(!1,u.autolock,u.autolockNodes),autoungrabify:d(!1,u.autoungrabify,u.autoungrabifyNodes),autounselectify:d(!1,u.autounselectify),styleEnabled:u.styleEnabled===void 0?o:u.styleEnabled,zoom:Oe(u.zoom)?u.zoom:1,pan:{x:wt(u.pan)&&Oe(u.pan.x)?u.pan.x:0,y:wt(u.pan)&&Oe(u.pan.y)?u.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:d(250,u.multiClickDebounceTime)};this.createEmitter(),this.selectionType(u.selectionType),this.zoomRange({min:u.minZoom,max:u.maxZoom});var h=function(x,E){var S=x.some(WO);if(S)return Bo.all(x).then(E);E(x)};f.styleEnabled&&a.setStyle([]);var p=et({},u,u.renderer);a.initRenderer(p);var m=function(x,E,S){a.notifications(!1);var T=a.mutableElements();T.length>0&&T.remove(),x!=null&&(wt(x)||_t(x))&&a.add(x),a.one("layoutready",function(N){a.notifications(!0),a.emit(N),a.one("load",E),a.emitAndNotify("load")}).one("layoutstop",function(){a.one("done",S),a.emit("done")});var C=et({},a._private.options.layout);C.eles=a.elements(),a.layout(C).run()};h([u.style,u.elements],function(y){var x=y[0],E=y[1];f.styleEnabled&&a.style().append(x),m(E,function(){a.startAnimationLoop(),f.ready=!0,Zt(u.ready)&&a.on("ready",u.ready);for(var S=0;S<s.length;S++){var T=s[S];a.on("ready",T)}i&&(i.readies=[]),a.emit("ready")},u.done)})},Vf=nc.prototype;et(Vf,{instanceString:function(){return"core"},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(e){return this.isReady()?this.emitter().emit("ready",[],e):this.on("ready",e),this},destroy:function(){var e=this;if(!e.destroyed())return e.stopAnimationLoop(),e.destroyRenderer(),this.emit("destroy"),e._private.destroyed=!0,e},hasElementWithId:function(e){return this._private.elements.hasElementWithId(e)},getElementById:function(e){return this._private.elements.getElementById(e)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(e){return this._private.elements.merge(e),this},removeFromPool:function(e){return this._private.elements.unmerge(e),this},container:function(){return this._private.container||null},window:function(){var e=this._private.container;if(e==null)return ba;var a=this._private.container.ownerDocument;return a===void 0||a==null?ba:a.defaultView||ba},mount:function(e){if(e!=null){var a=this,r=a._private,i=r.options;return!Lf(e)&&Lf(e[0])&&(e=e[0]),a.stopAnimationLoop(),a.destroyRenderer(),r.container=e,r.styleEnabled=!0,a.invalidateSize(),a.initRenderer(et({},i,i.renderer,{name:i.renderer.name==="null"?"canvas":i.renderer.name})),a.startAnimationLoop(),a.style(i.style),a.emit("mount"),a}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:"null"}),e.emit("unmount"),e},options:function(){return xn(this._private.options)},json:function(e){var a=this,r=a._private,i=a.mutableElements(),s=function(A){return a.getElementById(A.id())};if(wt(e)){if(a.startBatch(),e.elements){var o={},u=function(A,M){for(var D=[],j=[],R=0;R<A.length;R++){var L=A[R];if(!L.data.id){At("cy.json() cannot handle elements without an ID attribute");continue}var z=""+L.data.id,_=a.getElementById(z);o[z]=!0,_.length!==0?j.push({ele:_,json:L}):(M&&(L.group=M),D.push(L))}a.add(D);for(var B=0;B<j.length;B++){var q=j[B],V=q.ele,Q=q.json;V.json(Q)}};if(_t(e.elements))u(e.elements);else for(var d=["nodes","edges"],f=0;f<d.length;f++){var h=d[f],p=e.elements[h];_t(p)&&u(p,h)}var m=a.collection();i.filter(function(N){return!o[N.id()]}).forEach(function(N){N.isParent()?m.merge(N):N.remove()}),m.forEach(function(N){return N.children().move({parent:null})}),m.forEach(function(N){return s(N).remove()})}e.style&&a.style(e.style),e.zoom!=null&&e.zoom!==r.zoom&&a.zoom(e.zoom),e.pan&&(e.pan.x!==r.pan.x||e.pan.y!==r.pan.y)&&a.pan(e.pan),e.data&&a.data(e.data);for(var y=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],x=0;x<y.length;x++){var E=y[x];e[E]!=null&&a[E](e[E])}return a.endBatch(),this}else{var S=!!e,T={};S?T.elements=this.elements().map(function(N){return N.json()}):(T.elements={},i.forEach(function(N){var A=N.group();T.elements[A]||(T.elements[A]=[]),T.elements[A].push(N.json())})),this._private.styleEnabled&&(T.style=a.style().json()),T.data=xn(a.data());var C=r.options;return T.zoomingEnabled=r.zoomingEnabled,T.userZoomingEnabled=r.userZoomingEnabled,T.zoom=r.zoom,T.minZoom=r.minZoom,T.maxZoom=r.maxZoom,T.panningEnabled=r.panningEnabled,T.userPanningEnabled=r.userPanningEnabled,T.pan=xn(r.pan),T.boxSelectionEnabled=r.boxSelectionEnabled,T.renderer=xn(C.renderer),T.hideEdgesOnViewport=C.hideEdgesOnViewport,T.textureOnViewport=C.textureOnViewport,T.wheelSensitivity=C.wheelSensitivity,T.motionBlur=C.motionBlur,T.multiClickDebounceTime=C.multiClickDebounceTime,T}}});Vf.$id=Vf.getElementById;[W3,rB,_C,t0,Sf,iB,a0,Ef,oB,tl,rc].forEach(function(t){et(Vf,t)});var cB={fit:!0,directed:!1,direction:"downward",padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,depthSort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,a){return!0},ready:void 0,stop:void 0,transform:function(e,a){return a}},dB={maximal:!1,acyclic:!1},Kl=function(e){return e.scratch("breadthfirst")},BS=function(e,a){return e.scratch("breadthfirst",a)};function UC(t){this.options=et({},cB,dB,t)}UC.prototype.run=function(){var t=this.options,e=t.cy,a=t.eles,r=a.nodes().filter(function(ke){return ke.isChildless()}),i=a,s=t.directed,o=t.acyclic||t.maximal||t.maximalAdjustments>0,u=!!t.boundingBox,d=nr(u?t.boundingBox:structuredClone(e.extent())),f;if(Mr(t.roots))f=t.roots;else if(_t(t.roots)){for(var h=[],p=0;p<t.roots.length;p++){var m=t.roots[p],y=e.getElementById(m);h.push(y)}f=e.collection(h)}else if(Xe(t.roots))f=e.$(t.roots);else if(s)f=r.roots();else{var x=a.components();f=e.collection();for(var E=function(){var De=x[S],Be=De.maxDegree(!1),Ge=De.filter(function(Je){return Je.degree(!1)===Be});f=f.add(Ge)},S=0;S<x.length;S++)E()}var T=[],C={},N=function(De,Be){T[Be]==null&&(T[Be]=[]);var Ge=T[Be].length;T[Be].push(De),BS(De,{index:Ge,depth:Be})},A=function(De,Be){var Ge=Kl(De),Je=Ge.depth,Re=Ge.index;T[Je][Re]=null,De.isChildless()&&N(De,Be)};i.bfs({roots:f,directed:t.directed,visit:function(De,Be,Ge,Je,Re){var nt=De[0],xe=nt.id();nt.isChildless()&&N(nt,Re),C[xe]=!0}});for(var M=[],D=0;D<r.length;D++){var j=r[D];C[j.id()]||M.push(j)}var R=function(De){for(var Be=T[De],Ge=0;Ge<Be.length;Ge++){var Je=Be[Ge];if(Je==null){Be.splice(Ge,1),Ge--;continue}BS(Je,{depth:De,index:Ge})}},L=function(De,Be){for(var Ge=Kl(De),Je=De.incomers().filter(function(Ke){return Ke.isNode()&&a.has(Ke)}),Re=-1,nt=De.id(),xe=0;xe<Je.length;xe++){var pe=Je[xe],Ye=Kl(pe);Re=Math.max(Re,Ye.depth)}if(Ge.depth<=Re){if(!t.acyclic&&Be[nt])return null;var tt=Re+1;return A(De,tt),Be[nt]=tt,!0}return!1};if(s&&o){var z=[],_={},B=function(De){return z.push(De)},q=function(){return z.shift()};for(r.forEach(function(ke){return z.push(ke)});z.length>0;){var V=q(),Q=L(V,_);if(Q)V.outgoers().filter(function(ke){return ke.isNode()&&a.has(ke)}).forEach(B);else if(Q===null){At("Detected double maximal shift for node `"+V.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var P=0;if(t.avoidOverlap)for(var U=0;U<r.length;U++){var F=r[U],K=F.layoutDimensions(t),J=K.w,k=K.h;P=Math.max(P,J,k)}var G={},X=function(De){if(G[De.id()])return G[De.id()];for(var Be=Kl(De).depth,Ge=De.neighborhood(),Je=0,Re=0,nt=0;nt<Ge.length;nt++){var xe=Ge[nt];if(!(xe.isEdge()||xe.isParent()||!r.has(xe))){var pe=Kl(xe);if(pe!=null){var Ye=pe.index,tt=pe.depth;if(!(Ye==null||tt==null)){var Ke=T[tt].length;tt<Be&&(Je+=Ye/Ke,Re++)}}}}return Re=Math.max(1,Re),Je=Je/Re,Re===0&&(Je=0),G[De.id()]=Je,Je},W=function(De,Be){var Ge=X(De),Je=X(Be),Re=Ge-Je;return Re===0?qT(De.id(),Be.id()):Re};t.depthSort!==void 0&&(W=t.depthSort);for(var $=T.length,ee=0;ee<$;ee++)T[ee].sort(W),R(ee);for(var ie=[],he=0;he<M.length;he++)ie.push(M[he]);var oe=function(){for(var De=0;De<$;De++)R(De)};ie.length&&(T.unshift(ie),$=T.length,oe());for(var ae=0,re=0;re<$;re++)ae=Math.max(T[re].length,ae);var le={x:d.x1+d.w/2,y:d.y1+d.h/2},se=r.reduce(function(ke,De){return(function(Be){return{w:ke.w===-1?Be.w:(ke.w+Be.w)/2,h:ke.h===-1?Be.h:(ke.h+Be.h)/2}})(De.boundingBox({includeLabels:t.nodeDimensionsIncludeLabels}))},{w:-1,h:-1}),Ne=Math.max($===1?0:u?(d.h-t.padding*2-se.h)/($-1):(d.h-t.padding*2-se.h)/($+1),P),Ae=T.reduce(function(ke,De){return Math.max(ke,De.length)},0),We=function(De){var Be=Kl(De),Ge=Be.depth,Je=Be.index;if(t.circle){var Re=Math.min(d.w/2/$,d.h/2/$);Re=Math.max(Re,P);var nt=Re*Ge+Re-($>0&&T[0].length<=3?Re/2:0),xe=2*Math.PI/T[Ge].length*Je;return Ge===0&&T[0].length===1&&(nt=1),{x:le.x+nt*Math.cos(xe),y:le.y+nt*Math.sin(xe)}}else{var pe=T[Ge].length,Ye=Math.max(pe===1?0:u?(d.w-t.padding*2-se.w)/((t.grid?Ae:pe)-1):(d.w-t.padding*2-se.w)/((t.grid?Ae:pe)+1),P),tt={x:le.x+(Je+1-(pe+1)/2)*Ye,y:le.y+(Ge+1-($+1)/2)*Ne};return tt}},He={downward:0,leftward:90,upward:180,rightward:-90};Object.keys(He).indexOf(t.direction)===-1&&Qt("Invalid direction '".concat(t.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(He).join(", ")));var Se=function(De){return j4(We(De),d,He[t.direction])};return a.nodes().layoutPositions(this,t,Se),this};var fB={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,a){return!0},ready:void 0,stop:void 0,transform:function(e,a){return a}};function qC(t){this.options=et({},fB,t)}qC.prototype.run=function(){var t=this.options,e=t,a=t.cy,r=e.eles,i=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,s=r.nodes().not(":parent");e.sort&&(s=s.sort(e.sort));for(var o=nr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:a.width(),h:a.height()}),u={x:o.x1+o.w/2,y:o.y1+o.h/2},d=e.sweep===void 0?2*Math.PI-2*Math.PI/s.length:e.sweep,f=d/Math.max(1,s.length-1),h,p=0,m=0;m<s.length;m++){var y=s[m],x=y.layoutDimensions(e),E=x.w,S=x.h;p=Math.max(p,E,S)}if(Oe(e.radius)?h=e.radius:s.length<=1?h=0:h=Math.min(o.h,o.w)/2-p,s.length>1&&e.avoidOverlap){p*=1.75;var T=Math.cos(f)-Math.cos(0),C=Math.sin(f)-Math.sin(0),N=Math.sqrt(p*p/(T*T+C*C));h=Math.max(N,h)}var A=function(D,j){var R=e.startAngle+j*f*(i?1:-1),L=h*Math.cos(R),z=h*Math.sin(R),_={x:u.x+L,y:u.y+z};return _};return r.nodes().layoutPositions(this,e,A),this};var hB={fit:!0,padding:30,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,a){return!0},ready:void 0,stop:void 0,transform:function(e,a){return a}};function IC(t){this.options=et({},hB,t)}IC.prototype.run=function(){for(var t=this.options,e=t,a=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,r=t.cy,i=e.eles,s=i.nodes().not(":parent"),o=nr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),u={x:o.x1+o.w/2,y:o.y1+o.h/2},d=[],f=0,h=0;h<s.length;h++){var p=s[h],m=void 0;m=e.concentric(p),d.push({value:m,node:p}),p._private.scratch.concentric=m}s.updateStyle();for(var y=0;y<s.length;y++){var x=s[y],E=x.layoutDimensions(e);f=Math.max(f,E.w,E.h)}d.sort(function(Ne,Ae){return Ae.value-Ne.value});for(var S=e.levelWidth(s),T=[[]],C=T[0],N=0;N<d.length;N++){var A=d[N];if(C.length>0){var M=Math.abs(C[0].value-A.value);M>=S&&(C=[],T.push(C))}C.push(A)}var D=f+e.minNodeSpacing;if(!e.avoidOverlap){var j=T.length>0&&T[0].length>1,R=Math.min(o.w,o.h)/2-D,L=R/(T.length+j?1:0);D=Math.min(D,L)}for(var z=0,_=0;_<T.length;_++){var B=T[_],q=e.sweep===void 0?2*Math.PI-2*Math.PI/B.length:e.sweep,V=B.dTheta=q/Math.max(1,B.length-1);if(B.length>1&&e.avoidOverlap){var Q=Math.cos(V)-Math.cos(0),P=Math.sin(V)-Math.sin(0),U=Math.sqrt(D*D/(Q*Q+P*P));z=Math.max(U,z)}B.r=z,z+=D}if(e.equidistant){for(var F=0,K=0,J=0;J<T.length;J++){var k=T[J],G=k.r-K;F=Math.max(F,G)}K=0;for(var X=0;X<T.length;X++){var W=T[X];X===0&&(K=W.r),W.r=K,K+=F}}for(var $={},ee=0;ee<T.length;ee++)for(var ie=T[ee],he=ie.dTheta,oe=ie.r,ae=0;ae<ie.length;ae++){var re=ie[ae],le=e.startAngle+(a?1:-1)*he*ae,se={x:u.x+oe*Math.cos(le),y:u.y+oe*Math.sin(le)};$[re.node.id()]=se}return i.nodes().layoutPositions(this,e,function(Ne){var Ae=Ne.id();return $[Ae]}),this};var om,vB={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,a){return!0},animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:function(e){return 2048},nodeOverlap:4,idealEdgeLength:function(e){return 32},edgeElasticity:function(e){return 32},nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function gh(t){this.options=et({},vB,t),this.options.layout=this;var e=this.options.eles.nodes(),a=this.options.eles.edges(),r=a.filter(function(i){var s=i.source().data("id"),o=i.target().data("id"),u=e.some(function(f){return f.data("id")===s}),d=e.some(function(f){return f.data("id")===o});return!u||!d});this.options.eles=this.options.eles.not(r)}gh.prototype.run=function(){var t=this.options,e=t.cy,a=this;a.stopped=!1,(t.animate===!0||t.animate===!1)&&a.emit({type:"layoutstart",layout:a}),t.debug===!0?om=!0:om=!1;var r=pB(e,a,t);om&&mB(r),t.randomize&&yB(r);var i=Zn(),s=function(){xB(r,e,t),t.fit===!0&&e.fit(t.padding)},o=function(m){return!(a.stopped||m>=t.numIter||(bB(r,t),r.temperature=r.temperature*t.coolingFactor,r.temperature<t.minTemp))},u=function(){if(t.animate===!0||t.animate===!1)s(),a.one("layoutstop",t.stop),a.emit({type:"layoutstop",layout:a});else{var m=t.eles.nodes(),y=FC(r,t,m);m.layoutPositions(a,t,y)}},d=0,f=!0;if(t.animate===!0){var h=function(){for(var m=0;f&&m<t.refresh;)f=o(d),d++,m++;if(!f)zS(r,t),u();else{var y=Zn();y-i>=t.animationThreshold&&s(),zf(h)}};h()}else{for(;f;)f=o(d),d++;zS(r,t),u()}return this};gh.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};gh.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var pB=function(e,a,r){for(var i=r.eles.edges(),s=r.eles.nodes(),o=nr(r.boundingBox?r.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),u={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:s.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:i.size(),temperature:r.initialTemp,clientWidth:o.w,clientHeight:o.h,boundingBox:o},d=r.eles.components(),f={},h=0;h<d.length;h++)for(var p=d[h],m=0;m<p.length;m++){var y=p[m];f[y.id()]=h}for(var h=0;h<u.nodeSize;h++){var x=s[h],E=x.layoutDimensions(r),S={};S.isLocked=x.locked(),S.id=x.data("id"),S.parentId=x.data("parent"),S.cmptId=f[x.id()],S.children=[],S.positionX=x.position("x"),S.positionY=x.position("y"),S.offsetX=0,S.offsetY=0,S.height=E.w,S.width=E.h,S.maxX=S.positionX+S.width/2,S.minX=S.positionX-S.width/2,S.maxY=S.positionY+S.height/2,S.minY=S.positionY-S.height/2,S.padLeft=parseFloat(x.style("padding")),S.padRight=parseFloat(x.style("padding")),S.padTop=parseFloat(x.style("padding")),S.padBottom=parseFloat(x.style("padding")),S.nodeRepulsion=Zt(r.nodeRepulsion)?r.nodeRepulsion(x):r.nodeRepulsion,u.layoutNodes.push(S),u.idToIndex[S.id]=h}for(var T=[],C=0,N=-1,A=[],h=0;h<u.nodeSize;h++){var x=u.layoutNodes[h],M=x.parentId;M!=null?u.layoutNodes[u.idToIndex[M]].children.push(x.id):(T[++N]=x.id,A.push(x.id))}for(u.graphSet.push(A);C<=N;){var D=T[C++],j=u.idToIndex[D],y=u.layoutNodes[j],R=y.children;if(R.length>0){u.graphSet.push(R);for(var h=0;h<R.length;h++)T[++N]=R[h]}}for(var h=0;h<u.graphSet.length;h++)for(var L=u.graphSet[h],m=0;m<L.length;m++){var z=u.idToIndex[L[m]];u.indexToGraph[z]=h}for(var h=0;h<u.edgeSize;h++){var _=i[h],B={};B.id=_.data("id"),B.sourceId=_.data("source"),B.targetId=_.data("target");var q=Zt(r.idealEdgeLength)?r.idealEdgeLength(_):r.idealEdgeLength,V=Zt(r.edgeElasticity)?r.edgeElasticity(_):r.edgeElasticity,Q=u.idToIndex[B.sourceId],P=u.idToIndex[B.targetId],U=u.indexToGraph[Q],F=u.indexToGraph[P];if(U!=F){for(var K=gB(B.sourceId,B.targetId,u),J=u.graphSet[K],k=0,S=u.layoutNodes[Q];J.indexOf(S.id)===-1;)S=u.layoutNodes[u.idToIndex[S.parentId]],k++;for(S=u.layoutNodes[P];J.indexOf(S.id)===-1;)S=u.layoutNodes[u.idToIndex[S.parentId]],k++;q*=k*r.nestingFactor}B.idealLength=q,B.elasticity=V,u.layoutEdges.push(B)}return u},gB=function(e,a,r){var i=VC(e,a,0,r);return 2>i.count?0:i.graph},VC=function(e,a,r,i){var s=i.graphSet[r];if(-1<s.indexOf(e)&&-1<s.indexOf(a))return{count:2,graph:r};for(var o=0,u=0;u<s.length;u++){var d=s[u],f=i.idToIndex[d],h=i.layoutNodes[f].children;if(h.length!==0){var p=i.indexToGraph[i.idToIndex[h[0]]],m=VC(e,a,p,i);if(m.count!==0)if(m.count===1){if(o++,o===2)break}else return m}}return{count:o,graph:r}},mB,yB=function(e,a){for(var r=e.clientWidth,i=e.clientHeight,s=0;s<e.nodeSize;s++){var o=e.layoutNodes[s];o.children.length===0&&!o.isLocked&&(o.positionX=Math.random()*r,o.positionY=Math.random()*i)}},FC=function(e,a,r){var i=e.boundingBox,s={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return a.boundingBox&&(r.forEach(function(o){var u=e.layoutNodes[e.idToIndex[o.data("id")]];s.x1=Math.min(s.x1,u.positionX),s.x2=Math.max(s.x2,u.positionX),s.y1=Math.min(s.y1,u.positionY),s.y2=Math.max(s.y2,u.positionY)}),s.w=s.x2-s.x1,s.h=s.y2-s.y1),function(o,u){var d=e.layoutNodes[e.idToIndex[o.data("id")]];if(a.boundingBox){var f=s.w===0?.5:(d.positionX-s.x1)/s.w,h=s.h===0?.5:(d.positionY-s.y1)/s.h;return{x:i.x1+f*i.w,y:i.y1+h*i.h}}else return{x:d.positionX,y:d.positionY}}},xB=function(e,a,r){var i=r.layout,s=r.eles.nodes(),o=FC(e,r,s);s.positions(o),e.ready!==!0&&(e.ready=!0,i.one("layoutready",r.ready),i.emit({type:"layoutready",layout:this}))},bB=function(e,a,r){wB(e,a),TB(e),CB(e,a),NB(e),jB(e)},wB=function(e,a){for(var r=0;r<e.graphSet.length;r++)for(var i=e.graphSet[r],s=i.length,o=0;o<s;o++)for(var u=e.layoutNodes[e.idToIndex[i[o]]],d=o+1;d<s;d++){var f=e.layoutNodes[e.idToIndex[i[d]]];SB(u,f,e,a)}},LS=function(e){return-1+2*e*Math.random()},SB=function(e,a,r,i){var s=e.cmptId,o=a.cmptId;if(!(s!==o&&!r.isCompound)){var u=a.positionX-e.positionX,d=a.positionY-e.positionY,f=1;u===0&&d===0&&(u=LS(f),d=LS(f));var h=EB(e,a,u,d);if(h>0)var p=i.nodeOverlap*h,m=Math.sqrt(u*u+d*d),y=p*u/m,x=p*d/m;else var E=Ff(e,u,d),S=Ff(a,-1*u,-1*d),T=S.x-E.x,C=S.y-E.y,N=T*T+C*C,m=Math.sqrt(N),p=(e.nodeRepulsion+a.nodeRepulsion)/N,y=p*T/m,x=p*C/m;e.isLocked||(e.offsetX-=y,e.offsetY-=x),a.isLocked||(a.offsetX+=y,a.offsetY+=x)}},EB=function(e,a,r,i){if(r>0)var s=e.maxX-a.minX;else var s=a.maxX-e.minX;if(i>0)var o=e.maxY-a.minY;else var o=a.maxY-e.minY;return s>=0&&o>=0?Math.sqrt(s*s+o*o):0},Ff=function(e,a,r){var i=e.positionX,s=e.positionY,o=e.height||1,u=e.width||1,d=r/a,f=o/u,h={};return a===0&&0<r||a===0&&0>r?(h.x=i,h.y=s+o/2,h):0<a&&-1*f<=d&&d<=f?(h.x=i+u/2,h.y=s+u*r/2/a,h):0>a&&-1*f<=d&&d<=f?(h.x=i-u/2,h.y=s-u*r/2/a,h):0<r&&(d<=-1*f||d>=f)?(h.x=i+o*a/2/r,h.y=s+o/2,h):(0>r&&(d<=-1*f||d>=f)&&(h.x=i-o*a/2/r,h.y=s-o/2),h)},TB=function(e,a){for(var r=0;r<e.edgeSize;r++){var i=e.layoutEdges[r],s=e.idToIndex[i.sourceId],o=e.layoutNodes[s],u=e.idToIndex[i.targetId],d=e.layoutNodes[u],f=d.positionX-o.positionX,h=d.positionY-o.positionY;if(!(f===0&&h===0)){var p=Ff(o,f,h),m=Ff(d,-1*f,-1*h),y=m.x-p.x,x=m.y-p.y,E=Math.sqrt(y*y+x*x),S=Math.pow(i.idealLength-E,2)/i.elasticity;if(E!==0)var T=S*y/E,C=S*x/E;else var T=0,C=0;o.isLocked||(o.offsetX+=T,o.offsetY+=C),d.isLocked||(d.offsetX-=T,d.offsetY-=C)}}},CB=function(e,a){if(a.gravity!==0)for(var r=1,i=0;i<e.graphSet.length;i++){var s=e.graphSet[i],o=s.length;if(i===0)var u=e.clientHeight/2,d=e.clientWidth/2;else var f=e.layoutNodes[e.idToIndex[s[0]]],h=e.layoutNodes[e.idToIndex[f.parentId]],u=h.positionX,d=h.positionY;for(var p=0;p<o;p++){var m=e.layoutNodes[e.idToIndex[s[p]]];if(!m.isLocked){var y=u-m.positionX,x=d-m.positionY,E=Math.sqrt(y*y+x*x);if(E>r){var S=a.gravity*y/E,T=a.gravity*x/E;m.offsetX+=S,m.offsetY+=T}}}}},NB=function(e,a){var r=[],i=0,s=-1;for(r.push.apply(r,e.graphSet[0]),s+=e.graphSet[0].length;i<=s;){var o=r[i++],u=e.idToIndex[o],d=e.layoutNodes[u],f=d.children;if(0<f.length&&!d.isLocked){for(var h=d.offsetX,p=d.offsetY,m=0;m<f.length;m++){var y=e.layoutNodes[e.idToIndex[f[m]]];y.offsetX+=h,y.offsetY+=p,r[++s]=f[m]}d.offsetX=0,d.offsetY=0}}},jB=function(e,a){for(var r=0;r<e.nodeSize;r++){var i=e.layoutNodes[r];0<i.children.length&&(i.maxX=void 0,i.minX=void 0,i.maxY=void 0,i.minY=void 0)}for(var r=0;r<e.nodeSize;r++){var i=e.layoutNodes[r];if(!(0<i.children.length||i.isLocked)){var s=AB(i.offsetX,i.offsetY,e.temperature);i.positionX+=s.x,i.positionY+=s.y,i.offsetX=0,i.offsetY=0,i.minX=i.positionX-i.width,i.maxX=i.positionX+i.width,i.minY=i.positionY-i.height,i.maxY=i.positionY+i.height,HC(i,e)}}for(var r=0;r<e.nodeSize;r++){var i=e.layoutNodes[r];0<i.children.length&&!i.isLocked&&(i.positionX=(i.maxX+i.minX)/2,i.positionY=(i.maxY+i.minY)/2,i.width=i.maxX-i.minX,i.height=i.maxY-i.minY)}},AB=function(e,a,r){var i=Math.sqrt(e*e+a*a);if(i>r)var s={x:r*e/i,y:r*a/i};else var s={x:e,y:a};return s},HC=function(e,a){var r=e.parentId;if(r!=null){var i=a.layoutNodes[a.idToIndex[r]],s=!1;if((i.maxX==null||e.maxX+i.padRight>i.maxX)&&(i.maxX=e.maxX+i.padRight,s=!0),(i.minX==null||e.minX-i.padLeft<i.minX)&&(i.minX=e.minX-i.padLeft,s=!0),(i.maxY==null||e.maxY+i.padBottom>i.maxY)&&(i.maxY=e.maxY+i.padBottom,s=!0),(i.minY==null||e.minY-i.padTop<i.minY)&&(i.minY=e.minY-i.padTop,s=!0),s)return HC(i,a)}},zS=function(e,a){for(var r=e.layoutNodes,i=[],s=0;s<r.length;s++){var o=r[s],u=o.cmptId,d=i[u]=i[u]||[];d.push(o)}for(var f=0,s=0;s<i.length;s++){var h=i[s];if(h){h.x1=1/0,h.x2=-1/0,h.y1=1/0,h.y2=-1/0;for(var p=0;p<h.length;p++){var m=h[p];h.x1=Math.min(h.x1,m.positionX-m.width/2),h.x2=Math.max(h.x2,m.positionX+m.width/2),h.y1=Math.min(h.y1,m.positionY-m.height/2),h.y2=Math.max(h.y2,m.positionY+m.height/2)}h.w=h.x2-h.x1,h.h=h.y2-h.y1,f+=h.w*h.h}}i.sort(function(C,N){return N.w*N.h-C.w*C.h});for(var y=0,x=0,E=0,S=0,T=Math.sqrt(f)*e.clientWidth/e.clientHeight,s=0;s<i.length;s++){var h=i[s];if(h){for(var p=0;p<h.length;p++){var m=h[p];m.isLocked||(m.positionX+=y-h.x1,m.positionY+=x-h.y1)}y+=h.w+a.componentSpacing,E+=h.w+a.componentSpacing,S=Math.max(S,h.h),E>T&&(x+=S+a.componentSpacing,y=0,E=0,S=0)}}},MB={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,a){return!0},ready:void 0,stop:void 0,transform:function(e,a){return a}};function GC(t){this.options=et({},MB,t)}GC.prototype.run=function(){var t=this.options,e=t,a=t.cy,r=e.eles,i=r.nodes().not(":parent");e.sort&&(i=i.sort(e.sort));var s=nr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:a.width(),h:a.height()});if(s.h===0||s.w===0)r.nodes().layoutPositions(this,e,function(X){return{x:s.x1,y:s.y1}});else{var o=i.size(),u=Math.sqrt(o*s.h/s.w),d=Math.round(u),f=Math.round(s.w/s.h*u),h=function(W){if(W==null)return Math.min(d,f);var $=Math.min(d,f);$==d?d=W:f=W},p=function(W){if(W==null)return Math.max(d,f);var $=Math.max(d,f);$==d?d=W:f=W},m=e.rows,y=e.cols!=null?e.cols:e.columns;if(m!=null&&y!=null)d=m,f=y;else if(m!=null&&y==null)d=m,f=Math.ceil(o/d);else if(m==null&&y!=null)f=y,d=Math.ceil(o/f);else if(f*d>o){var x=h(),E=p();(x-1)*E>=o?h(x-1):(E-1)*x>=o&&p(E-1)}else for(;f*d<o;){var S=h(),T=p();(T+1)*S>=o?p(T+1):h(S+1)}var C=s.w/f,N=s.h/d;if(e.condense&&(C=0,N=0),e.avoidOverlap)for(var A=0;A<i.length;A++){var M=i[A],D=M._private.position;(D.x==null||D.y==null)&&(D.x=0,D.y=0);var j=M.layoutDimensions(e),R=e.avoidOverlapPadding,L=j.w+R,z=j.h+R;C=Math.max(C,L),N=Math.max(N,z)}for(var _={},B=function(W,$){return!!_["c-"+W+"-"+$]},q=function(W,$){_["c-"+W+"-"+$]=!0},V=0,Q=0,P=function(){Q++,Q>=f&&(Q=0,V++)},U={},F=0;F<i.length;F++){var K=i[F],J=e.position(K);if(J&&(J.row!==void 0||J.col!==void 0)){var k={row:J.row,col:J.col};if(k.col===void 0)for(k.col=0;B(k.row,k.col);)k.col++;else if(k.row===void 0)for(k.row=0;B(k.row,k.col);)k.row++;U[K.id()]=k,q(k.row,k.col)}}var G=function(W,$){var ee,ie;if(W.locked()||W.isParent())return!1;var he=U[W.id()];if(he)ee=he.col*C+C/2+s.x1,ie=he.row*N+N/2+s.y1;else{for(;B(V,Q);)P();ee=Q*C+C/2+s.x1,ie=V*N+N/2+s.y1,q(V,Q),P()}return{x:ee,y:ie}};i.layoutPositions(this,e,G)}return this};var DB={ready:function(){},stop:function(){}};function ey(t){this.options=et({},DB,t)}ey.prototype.run=function(){var t=this.options,e=t.eles,a=this;return t.cy,a.emit("layoutstart"),e.nodes().positions(function(){return{x:0,y:0}}),a.one("layoutready",t.ready),a.emit("layoutready"),a.one("layoutstop",t.stop),a.emit("layoutstop"),this};ey.prototype.stop=function(){return this};var OB={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,spacingFactor:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,a){return!0},ready:void 0,stop:void 0,transform:function(e,a){return a}};function QC(t){this.options=et({},OB,t)}QC.prototype.run=function(){var t=this.options,e=t.eles,a=e.nodes(),r=Zt(t.positions);function i(s){if(t.positions==null)return J4(s.position());if(r)return t.positions(s);var o=t.positions[s._private.data.id];return o??null}return a.layoutPositions(this,t,function(s,o){var u=i(s);return s.locked()||u==null?!1:u}),this};var RB={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,a){return!0},ready:void 0,stop:void 0,transform:function(e,a){return a}};function YC(t){this.options=et({},RB,t)}YC.prototype.run=function(){var t=this.options,e=t.cy,a=t.eles,r=nr(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),i=function(o,u){return{x:r.x1+Math.round(Math.random()*r.w),y:r.y1+Math.round(Math.random()*r.h)}};return a.nodes().layoutPositions(this,t,i),this};var kB=[{name:"breadthfirst",impl:UC},{name:"circle",impl:qC},{name:"concentric",impl:IC},{name:"cose",impl:gh},{name:"grid",impl:GC},{name:"null",impl:ey},{name:"preset",impl:QC},{name:"random",impl:YC}];function KC(t){this.options=t,this.notifications=0}var PS=function(){},_S=function(){throw new Error("A headless instance can not render images")};KC.prototype={recalculateRenderedStyle:PS,notify:function(){this.notifications++},init:PS,isHeadless:function(){return!0},png:_S,jpg:_S};var ty={};ty.arrowShapeWidth=.3;ty.registerArrowShapes=function(){var t=this.arrowShapes={},e=this,a=function(f,h,p,m,y,x,E){var S=y.x-p/2-E,T=y.x+p/2+E,C=y.y-p/2-E,N=y.y+p/2+E,A=S<=f&&f<=T&&C<=h&&h<=N;return A},r=function(f,h,p,m,y){var x=f*Math.cos(m)-h*Math.sin(m),E=f*Math.sin(m)+h*Math.cos(m),S=x*p,T=E*p,C=S+y.x,N=T+y.y;return{x:C,y:N}},i=function(f,h,p,m){for(var y=[],x=0;x<f.length;x+=2){var E=f[x],S=f[x+1];y.push(r(E,S,h,p,m))}return y},s=function(f){for(var h=[],p=0;p<f.length;p++){var m=f[p];h.push(m.x,m.y)}return h},o=function(f){return f.pstyle("width").pfValue*f.pstyle("arrow-scale").pfValue*2},u=function(f,h){Xe(h)&&(h=t[h]),t[f]=et({name:f,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(m,y,x,E,S,T){var C=s(i(this.points,x+2*T,E,S)),N=mr(m,y,C);return N},roughCollide:a,draw:function(m,y,x,E){var S=i(this.points,y,x,E);e.arrowShapeImpl("polygon")(m,S)},spacing:function(m){return 0},gap:o},h)};u("none",{collide:Pf,roughCollide:Pf,draw:q0,spacing:W2,gap:W2}),u("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),u("arrow","triangle"),u("triangle-backcurve",{points:t.triangle.points,controlPoint:[0,-.15],roughCollide:a,draw:function(f,h,p,m,y){var x=i(this.points,h,p,m),E=this.controlPoint,S=r(E[0],E[1],h,p,m);e.arrowShapeImpl(this.name)(f,x,S)},gap:function(f){return o(f)*.8}}),u("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(f,h,p,m,y,x,E){var S=s(i(this.points,p+2*E,m,y)),T=s(i(this.pointsTee,p+2*E,m,y)),C=mr(f,h,S)||mr(f,h,T);return C},draw:function(f,h,p,m,y){var x=i(this.points,h,p,m),E=i(this.pointsTee,h,p,m);e.arrowShapeImpl(this.name)(f,x,E)}}),u("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(f,h,p,m,y,x,E){var S=y,T=Math.pow(S.x-f,2)+Math.pow(S.y-h,2)<=Math.pow((p+2*E)*this.radius,2),C=s(i(this.points,p+2*E,m,y));return mr(f,h,C)||T},draw:function(f,h,p,m,y){var x=i(this.pointsTr,h,p,m);e.arrowShapeImpl(this.name)(f,x,m.x,m.y,this.radius*h)},spacing:function(f){return e.getArrowWidth(f.pstyle("width").pfValue,f.pstyle("arrow-scale").value)*this.radius}}),u("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(f,h){var p=this.baseCrossLinePts.slice(),m=h/f,y=3,x=5;return p[y]=p[y]-m,p[x]=p[x]-m,p},collide:function(f,h,p,m,y,x,E){var S=s(i(this.points,p+2*E,m,y)),T=s(i(this.crossLinePts(p,x),p+2*E,m,y)),C=mr(f,h,S)||mr(f,h,T);return C},draw:function(f,h,p,m,y){var x=i(this.points,h,p,m),E=i(this.crossLinePts(h,y),h,p,m);e.arrowShapeImpl(this.name)(f,x,E)}}),u("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(f){return o(f)*.525}}),u("circle",{radius:.15,collide:function(f,h,p,m,y,x,E){var S=y,T=Math.pow(S.x-f,2)+Math.pow(S.y-h,2)<=Math.pow((p+2*E)*this.radius,2);return T},draw:function(f,h,p,m,y){e.arrowShapeImpl(this.name)(f,m.x,m.y,this.radius*h)},spacing:function(f){return e.getArrowWidth(f.pstyle("width").pfValue,f.pstyle("arrow-scale").value)*this.radius}}),u("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(f){return 1},gap:function(f){return 1}}),u("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),u("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(f){return f.pstyle("width").pfValue*f.pstyle("arrow-scale").value}}),u("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(f){return .95*f.pstyle("width").pfValue*f.pstyle("arrow-scale").value}})};var ll={};ll.projectIntoViewport=function(t,e){var a=this.cy,r=this.findContainerClientCoords(),i=r[0],s=r[1],o=r[4],u=a.pan(),d=a.zoom(),f=((t-i)/o-u.x)/d,h=((e-s)/o-u.y)/d;return[f,h]};ll.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var t=this.container,e=t.getBoundingClientRect(),a=this.cy.window().getComputedStyle(t),r=function(T){return parseFloat(a.getPropertyValue(T))},i={left:r("padding-left"),right:r("padding-right"),top:r("padding-top"),bottom:r("padding-bottom")},s={left:r("border-left-width"),right:r("border-right-width"),top:r("border-top-width"),bottom:r("border-bottom-width")},o=t.clientWidth,u=t.clientHeight,d=i.left+i.right,f=i.top+i.bottom,h=s.left+s.right,p=e.width/(o+h),m=o-d,y=u-f,x=e.left+i.left+s.left,E=e.top+i.top+s.top;return this.containerBB=[x,E,m,y,p]};ll.invalidateContainerClientCoordsCache=function(){this.containerBB=null};ll.findNearestElement=function(t,e,a,r){return this.findNearestElements(t,e,a,r)[0]};ll.findNearestElements=function(t,e,a,r){var i=this,s=this,o=s.getCachedZSortedEles(),u=[],d=s.cy.zoom(),f=s.cy.hasCompoundNodes(),h=(r?24:8)/d,p=(r?8:2)/d,m=(r?8:2)/d,y=1/0,x,E;a&&(o=o.interactive);function S(j,R){if(j.isNode()){if(E)return;E=j,u.push(j)}if(j.isEdge()&&(R==null||R<y))if(x){if(x.pstyle("z-compound-depth").value===j.pstyle("z-compound-depth").value&&x.pstyle("z-compound-depth").value===j.pstyle("z-compound-depth").value){for(var L=0;L<u.length;L++)if(u[L].isEdge()){u[L]=j,x=j,y=R??y;break}}}else u.push(j),x=j,y=R??y}function T(j){var R=j.outerWidth()+2*p,L=j.outerHeight()+2*p,z=R/2,_=L/2,B=j.position(),q=j.pstyle("corner-radius").value==="auto"?"auto":j.pstyle("corner-radius").pfValue,V=j._private.rscratch;if(B.x-z<=t&&t<=B.x+z&&B.y-_<=e&&e<=B.y+_){var Q=s.nodeShapes[i.getNodeShape(j)];if(Q.checkPoint(t,e,0,R,L,B.x,B.y,q,V))return S(j,0),!0}}function C(j){var R=j._private,L=R.rscratch,z=j.pstyle("width").pfValue,_=j.pstyle("arrow-scale").value,B=z/2+h,q=B*B,V=B*2,F=R.source,K=R.target,Q;if(L.edgeType==="segments"||L.edgeType==="straight"||L.edgeType==="haystack"){for(var P=L.allpts,U=0;U+3<P.length;U+=2)if(hR(t,e,P[U],P[U+1],P[U+2],P[U+3],V)&&q>(Q=yR(t,e,P[U],P[U+1],P[U+2],P[U+3])))return S(j,Q),!0}else if(L.edgeType==="bezier"||L.edgeType==="multibezier"||L.edgeType==="self"||L.edgeType==="compound"){for(var P=L.allpts,U=0;U+5<L.allpts.length;U+=4)if(vR(t,e,P[U],P[U+1],P[U+2],P[U+3],P[U+4],P[U+5],V)&&q>(Q=mR(t,e,P[U],P[U+1],P[U+2],P[U+3],P[U+4],P[U+5])))return S(j,Q),!0}for(var F=F||R.source,K=K||R.target,J=i.getArrowWidth(z,_),k=[{name:"source",x:L.arrowStartX,y:L.arrowStartY,angle:L.srcArrowAngle},{name:"target",x:L.arrowEndX,y:L.arrowEndY,angle:L.tgtArrowAngle},{name:"mid-source",x:L.midX,y:L.midY,angle:L.midsrcArrowAngle},{name:"mid-target",x:L.midX,y:L.midY,angle:L.midtgtArrowAngle}],U=0;U<k.length;U++){var G=k[U],X=s.arrowShapes[j.pstyle(G.name+"-arrow-shape").value],W=j.pstyle("width").pfValue;if(X.roughCollide(t,e,J,G.angle,{x:G.x,y:G.y},W,h)&&X.collide(t,e,J,G.angle,{x:G.x,y:G.y},W,h))return S(j),!0}f&&u.length>0&&(T(F),T(K))}function N(j,R,L){return gr(j,R,L)}function A(j,R){var L=j._private,z=m,_;R?_=R+"-":_="",j.boundingBox();var B=L.labelBounds[R||"main"],q=j.pstyle(_+"label").value,V=j.pstyle("text-events").strValue==="yes";if(!(!V||!q)){var Q=N(L.rscratch,"labelX",R),P=N(L.rscratch,"labelY",R),U=N(L.rscratch,"labelAngle",R),F=j.pstyle(_+"text-margin-x").pfValue,K=j.pstyle(_+"text-margin-y").pfValue,J=B.x1-z-F,k=B.x2+z-F,G=B.y1-z-K,X=B.y2+z-K;if(U){var W=Math.cos(U),$=Math.sin(U),ee=function(se,Ne){return se=se-Q,Ne=Ne-P,{x:se*W-Ne*$+Q,y:se*$+Ne*W+P}},ie=ee(J,G),he=ee(J,X),oe=ee(k,G),ae=ee(k,X),re=[ie.x+F,ie.y+K,oe.x+F,oe.y+K,ae.x+F,ae.y+K,he.x+F,he.y+K];if(mr(t,e,re))return S(j),!0}else if(Yi(B,t,e))return S(j),!0}}for(var M=o.length-1;M>=0;M--){var D=o[M];D.isNode()?T(D)||A(D):C(D)||A(D)||A(D,"source")||A(D,"target")}return u};ll.getAllInBox=function(t,e,a,r){var i=this.getCachedZSortedEles().interactive,s=this.cy.zoom(),o=2/s,u=[],d=Math.min(t,a),f=Math.max(t,a),h=Math.min(e,r),p=Math.max(e,r);t=d,a=f,e=h,r=p;var m=nr({x1:t,y1:e,x2:a,y2:r}),y=[{x:m.x1,y:m.y1},{x:m.x2,y:m.y1},{x:m.x2,y:m.y2},{x:m.x1,y:m.y2}],x=[[y[0],y[1]],[y[1],y[2]],[y[2],y[3]],[y[3],y[0]]];function E(se,Ne,Ae){return gr(se,Ne,Ae)}function S(se,Ne){var Ae=se._private,We=o,He="";se.boundingBox();var Se=Ae.labelBounds.main;if(!Se)return null;var ke=E(Ae.rscratch,"labelX",Ne),De=E(Ae.rscratch,"labelY",Ne),Be=E(Ae.rscratch,"labelAngle",Ne),Ge=se.pstyle(He+"text-margin-x").pfValue,Je=se.pstyle(He+"text-margin-y").pfValue,Re=Se.x1-We-Ge,nt=Se.x2+We-Ge,xe=Se.y1-We-Je,pe=Se.y2+We-Je;if(Be){var Ye=Math.cos(Be),tt=Math.sin(Be),Ke=function(we,Y){return we=we-ke,Y=Y-De,{x:we*Ye-Y*tt+ke,y:we*tt+Y*Ye+De}};return[Ke(Re,xe),Ke(nt,xe),Ke(nt,pe),Ke(Re,pe)]}else return[{x:Re,y:xe},{x:nt,y:xe},{x:nt,y:pe},{x:Re,y:pe}]}function T(se,Ne,Ae,We){function He(Se,ke,De){return(De.y-Se.y)*(ke.x-Se.x)>(ke.y-Se.y)*(De.x-Se.x)}return He(se,Ae,We)!==He(Ne,Ae,We)&&He(se,Ne,Ae)!==He(se,Ne,We)}for(var C=0;C<i.length;C++){var N=i[C];if(N.isNode()){var A=N,M=A.pstyle("text-events").strValue==="yes",D=A.pstyle("box-selection").strValue,j=A.pstyle("box-select-labels").strValue==="yes";if(D==="none")continue;var R=(D==="overlap"||j)&&M,L=A.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:R});if(D==="contain"){var z=!1;if(j&&M){var _=S(A);_&&sg(_,y)&&(u.push(A),z=!0)}!z&&tC(m,L)&&u.push(A)}else if(D==="overlap"&&H0(m,L)){var B=A.boundingBox({includeNodes:!0,includeEdges:!0,includeLabels:!1,includeMainLabels:!1,includeSourceLabels:!1,includeTargetLabels:!1}),q=[{x:B.x1,y:B.y1},{x:B.x2,y:B.y1},{x:B.x2,y:B.y2},{x:B.x1,y:B.y2}];if(sg(q,y))u.push(A);else{var V=S(A);V&&sg(V,y)&&u.push(A)}}}else{var Q=N,P=Q._private,U=P.rscratch,F=Q.pstyle("box-selection").strValue;if(F==="none")continue;if(F==="contain"){if(U.startX!=null&&U.startY!=null&&!Yi(m,U.startX,U.startY)||U.endX!=null&&U.endY!=null&&!Yi(m,U.endX,U.endY))continue;if(U.edgeType==="bezier"||U.edgeType==="multibezier"||U.edgeType==="self"||U.edgeType==="compound"||U.edgeType==="segments"||U.edgeType==="haystack"){for(var K=P.rstyle.bezierPts||P.rstyle.linePts||P.rstyle.haystackPts,J=!0,k=0;k<K.length;k++)if(!rw(m,K[k])){J=!1;break}J&&u.push(Q)}else U.edgeType==="straight"&&u.push(Q)}else if(F==="overlap"){var G=!1;if(U.startX!=null&&U.startY!=null&&U.endX!=null&&U.endY!=null&&(Yi(m,U.startX,U.startY)||Yi(m,U.endX,U.endY)))u.push(Q),G=!0;else if(!G&&U.edgeType==="haystack"){for(var X=P.rstyle.haystackPts,W=0;W<X.length;W++)if(rw(m,X[W])){u.push(Q),G=!0;break}}if(!G){var $=P.rstyle.bezierPts||P.rstyle.linePts||P.rstyle.haystackPts;if((!$||$.length<2)&&U.edgeType==="straight"&&U.startX!=null&&U.startY!=null&&U.endX!=null&&U.endY!=null&&($=[{x:U.startX,y:U.startY},{x:U.endX,y:U.endY}]),!$||$.length<2)continue;for(var ee=0;ee<$.length-1;ee++){for(var ie=$[ee],he=$[ee+1],oe=0;oe<x.length;oe++){var ae=ma(x[oe],2),re=ae[0],le=ae[1];if(T(ie,he,re,le)){u.push(Q),G=!0;break}}if(G)break}}}}}return u};var Hf={};Hf.calculateArrowAngles=function(t){var e=t._private.rscratch,a=e.edgeType==="haystack",r=e.edgeType==="bezier",i=e.edgeType==="multibezier",s=e.edgeType==="segments",o=e.edgeType==="compound",u=e.edgeType==="self",d,f,h,p,m,y,T,C;if(a?(h=e.haystackPts[0],p=e.haystackPts[1],m=e.haystackPts[2],y=e.haystackPts[3]):(h=e.arrowStartX,p=e.arrowStartY,m=e.arrowEndX,y=e.arrowEndY),T=e.midX,C=e.midY,s)d=h-e.segpts[0],f=p-e.segpts[1];else if(i||o||u||r){var x=e.allpts,E=Oa(x[0],x[2],x[4],.1),S=Oa(x[1],x[3],x[5],.1);d=h-E,f=p-S}else d=h-T,f=p-C;e.srcArrowAngle=Jd(d,f);var T=e.midX,C=e.midY;if(a&&(T=(h+m)/2,C=(p+y)/2),d=m-h,f=y-p,s){var x=e.allpts;if(x.length/2%2===0){var N=x.length/2,A=N-2;d=x[N]-x[A],f=x[N+1]-x[A+1]}else if(e.isRound)d=e.midVector[1],f=-e.midVector[0];else{var N=x.length/2-1,A=N-2;d=x[N]-x[A],f=x[N+1]-x[A+1]}}else if(i||o||u){var x=e.allpts,M=e.ctrlpts,D,j,R,L;if(M.length/2%2===0){var z=x.length/2-1,_=z+2,B=_+2;D=Oa(x[z],x[_],x[B],0),j=Oa(x[z+1],x[_+1],x[B+1],0),R=Oa(x[z],x[_],x[B],1e-4),L=Oa(x[z+1],x[_+1],x[B+1],1e-4)}else{var _=x.length/2-1,z=_-2,B=_+2;D=Oa(x[z],x[_],x[B],.4999),j=Oa(x[z+1],x[_+1],x[B+1],.4999),R=Oa(x[z],x[_],x[B],.5),L=Oa(x[z+1],x[_+1],x[B+1],.5)}d=R-D,f=L-j}if(e.midtgtArrowAngle=Jd(d,f),e.midDispX=d,e.midDispY=f,d*=-1,f*=-1,s){var x=e.allpts;if(x.length/2%2!==0){if(!e.isRound){var N=x.length/2-1,q=N+2;d=-(x[q]-x[N]),f=-(x[q+1]-x[N+1])}}}if(e.midsrcArrowAngle=Jd(d,f),s)d=m-e.segpts[e.segpts.length-2],f=y-e.segpts[e.segpts.length-1];else if(i||o||u||r){var x=e.allpts,V=x.length,E=Oa(x[V-6],x[V-4],x[V-2],.9),S=Oa(x[V-5],x[V-3],x[V-1],.9);d=m-E,f=y-S}else d=m-T,f=y-C;e.tgtArrowAngle=Jd(d,f)};Hf.getArrowWidth=Hf.getArrowHeight=function(t,e){var a=this.arrowWidthCache=this.arrowWidthCache||{},r=a[t+", "+e];return r||(r=Math.max(Math.pow(t*13.37,.9),29)*e,a[t+", "+e]=r,r)};var r0,n0,vn={},Fr={},US,qS,Ps,Tf,In,Os,Bs,fn,$l,of,$C,XC,i0,s0,IS,VS=function(e,a,r){r.x=a.x-e.x,r.y=a.y-e.y,r.len=Math.sqrt(r.x*r.x+r.y*r.y),r.nx=r.x/r.len,r.ny=r.y/r.len,r.ang=Math.atan2(r.ny,r.nx)},BB=function(e,a){a.x=e.x*-1,a.y=e.y*-1,a.nx=e.nx*-1,a.ny=e.ny*-1,a.ang=e.ang>0?-(Math.PI-e.ang):Math.PI+e.ang},LB=function(e,a,r,i,s){if(e!==IS?VS(a,e,vn):BB(Fr,vn),VS(a,r,Fr),US=vn.nx*Fr.ny-vn.ny*Fr.nx,qS=vn.nx*Fr.nx-vn.ny*-Fr.ny,In=Math.asin(Math.max(-1,Math.min(1,US))),Math.abs(In)<1e-6){r0=a.x,n0=a.y,Bs=$l=0;return}Ps=1,Tf=!1,qS<0?In<0?In=Math.PI+In:(In=Math.PI-In,Ps=-1,Tf=!0):In>0&&(Ps=-1,Tf=!0),a.radius!==void 0?$l=a.radius:$l=i,Os=In/2,of=Math.min(vn.len/2,Fr.len/2),s?(fn=Math.abs(Math.cos(Os)*$l/Math.sin(Os)),fn>of?(fn=of,Bs=Math.abs(fn*Math.sin(Os)/Math.cos(Os))):Bs=$l):(fn=Math.min(of,$l),Bs=Math.abs(fn*Math.sin(Os)/Math.cos(Os))),i0=a.x+Fr.nx*fn,s0=a.y+Fr.ny*fn,r0=i0-Fr.ny*Bs*Ps,n0=s0+Fr.nx*Bs*Ps,$C=a.x+vn.nx*fn,XC=a.y+vn.ny*fn,IS=a};function ZC(t,e){e.radius===0?t.lineTo(e.cx,e.cy):t.arc(e.cx,e.cy,e.radius,e.startAngle,e.endAngle,e.counterClockwise)}function ay(t,e,a,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return r===0||e.radius===0?{cx:e.x,cy:e.y,radius:0,startX:e.x,startY:e.y,stopX:e.x,stopY:e.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(LB(t,e,a,r,i),{cx:r0,cy:n0,radius:Bs,startX:$C,startY:XC,stopX:i0,stopY:s0,startAngle:vn.ang+Math.PI/2*Ps,endAngle:Fr.ang-Math.PI/2*Ps,counterClockwise:Tf})}var ic=.01,zB=Math.sqrt(2*ic),Ja={};Ja.findMidptPtsEtc=function(t,e){var a=e.posPts,r=e.intersectionPts,i=e.vectorNormInverse,s,o=t.pstyle("source-endpoint"),u=t.pstyle("target-endpoint"),d=o.units!=null&&u.units!=null,f=function(M,D,j,R){var L=R-D,z=j-M,_=Math.sqrt(z*z+L*L);return{x:-L/_,y:z/_}},h=t.pstyle("edge-distances").value;switch(h){case"node-position":s=a;break;case"intersection":s=r;break;case"endpoints":{if(d){var p=this.manualEndptToPx(t.source()[0],o),m=ma(p,2),y=m[0],x=m[1],E=this.manualEndptToPx(t.target()[0],u),S=ma(E,2),T=S[0],C=S[1],N={x1:y,y1:x,x2:T,y2:C};i=f(y,x,T,C),s=N}else At("Edge ".concat(t.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),s=r;break}}return{midptPts:s,vectorNormInverse:i}};Ja.findHaystackPoints=function(t){for(var e=0;e<t.length;e++){var a=t[e],r=a._private,i=r.rscratch;if(!i.haystack){var s=Math.random()*2*Math.PI;i.source={x:Math.cos(s),y:Math.sin(s)},s=Math.random()*2*Math.PI,i.target={x:Math.cos(s),y:Math.sin(s)}}var o=r.source,u=r.target,d=o.position(),f=u.position(),h=o.width(),p=u.width(),m=o.height(),y=u.height(),x=a.pstyle("haystack-radius").value,E=x/2;i.haystackPts=i.allpts=[i.source.x*h*E+d.x,i.source.y*m*E+d.y,i.target.x*p*E+f.x,i.target.y*y*E+f.y],i.midX=(i.allpts[0]+i.allpts[2])/2,i.midY=(i.allpts[1]+i.allpts[3])/2,i.edgeType="haystack",i.haystack=!0,this.storeEdgeProjections(a),this.calculateArrowAngles(a),this.recalculateEdgeLabelProjections(a),this.calculateLabelAngles(a)}};Ja.findSegmentsPoints=function(t,e){var a=t._private.rscratch,r=t.pstyle("segment-weights"),i=t.pstyle("segment-distances"),s=t.pstyle("segment-radii"),o=t.pstyle("radius-type"),u=Math.min(r.pfValue.length,i.pfValue.length),d=s.pfValue[s.pfValue.length-1],f=o.pfValue[o.pfValue.length-1];a.edgeType="segments",a.segpts=[],a.radii=[],a.isArcRadius=[];for(var h=0;h<u;h++){var p=r.pfValue[h],m=i.pfValue[h],y=1-p,x=p,E=this.findMidptPtsEtc(t,e),S=E.midptPts,T=E.vectorNormInverse,C={x:S.x1*y+S.x2*x,y:S.y1*y+S.y2*x};a.segpts.push(C.x+T.x*m,C.y+T.y*m),a.radii.push(s.pfValue[h]!==void 0?s.pfValue[h]:d),a.isArcRadius.push((o.pfValue[h]!==void 0?o.pfValue[h]:f)==="arc-radius")}};Ja.findLoopPoints=function(t,e,a,r){var i=t._private.rscratch,s=e.dirCounts,o=e.srcPos,u=t.pstyle("control-point-distances"),d=u?u.pfValue[0]:void 0,f=t.pstyle("loop-direction").pfValue,h=t.pstyle("loop-sweep").pfValue,p=t.pstyle("control-point-step-size").pfValue;i.edgeType="self";var m=a,y=p;r&&(m=0,y=d);var x=f-Math.PI/2,E=x-h/2,S=x+h/2,T=f+"_"+h;m=s[T]===void 0?s[T]=0:++s[T],i.ctrlpts=[o.x+Math.cos(E)*1.4*y*(m/3+1),o.y+Math.sin(E)*1.4*y*(m/3+1),o.x+Math.cos(S)*1.4*y*(m/3+1),o.y+Math.sin(S)*1.4*y*(m/3+1)]};Ja.findCompoundLoopPoints=function(t,e,a,r){var i=t._private.rscratch;i.edgeType="compound";var s=e.srcPos,o=e.tgtPos,u=e.srcW,d=e.srcH,f=e.tgtW,h=e.tgtH,p=t.pstyle("control-point-step-size").pfValue,m=t.pstyle("control-point-distances"),y=m?m.pfValue[0]:void 0,x=a,E=p;r&&(x=0,E=y);var S=50,T={x:s.x-u/2,y:s.y-d/2},C={x:o.x-f/2,y:o.y-h/2},N={x:Math.min(T.x,C.x),y:Math.min(T.y,C.y)},A=.5,M=Math.max(A,Math.log(u*ic)),D=Math.max(A,Math.log(f*ic));i.ctrlpts=[N.x,N.y-(1+Math.pow(S,1.12)/100)*E*(x/3+1)*M,N.x-(1+Math.pow(S,1.12)/100)*E*(x/3+1)*D,N.y]};Ja.findStraightEdgePoints=function(t){t._private.rscratch.edgeType="straight"};Ja.findBezierPoints=function(t,e,a,r,i){var s=t._private.rscratch,o=t.pstyle("control-point-step-size").pfValue,u=t.pstyle("control-point-distances"),d=t.pstyle("control-point-weights"),f=u&&d?Math.min(u.value.length,d.value.length):1,h=u?u.pfValue[0]:void 0,p=d.value[0],m=r;s.edgeType=m?"multibezier":"bezier",s.ctrlpts=[];for(var y=0;y<f;y++){var x=(.5-e.eles.length/2+a)*o*(i?-1:1),E=void 0,S=F0(x);m&&(h=u?u.pfValue[y]:o,p=d.value[y]),r?E=h:E=h!==void 0?S*h:void 0;var T=E!==void 0?E:x,C=1-p,N=p,A=this.findMidptPtsEtc(t,e),M=A.midptPts,D=A.vectorNormInverse,j={x:M.x1*C+M.x2*N,y:M.y1*C+M.y2*N};s.ctrlpts.push(j.x+D.x*T,j.y+D.y*T)}};Ja.findTaxiPoints=function(t,e){var a=t._private.rscratch;a.edgeType="segments";var r="vertical",i="horizontal",s="leftward",o="rightward",u="downward",d="upward",f="auto",h=e.posPts,p=e.srcW,m=e.srcH,y=e.tgtW,x=e.tgtH,E=t.pstyle("edge-distances").value,S=E!=="node-position",T=t.pstyle("taxi-direction").value,C=T,N=t.pstyle("taxi-turn"),A=N.units==="%",M=N.pfValue,D=M<0,j=t.pstyle("taxi-turn-min-distance").pfValue,R=S?(p+y)/2:0,L=S?(m+x)/2:0,z=h.x2-h.x1,_=h.y2-h.y1,B=function(Y,ce){return Y>0?Math.max(Y-ce,0):Math.min(Y+ce,0)},q=B(z,R),V=B(_,L),Q=!1;C===f?T=Math.abs(q)>Math.abs(V)?i:r:C===d||C===u?(T=r,Q=!0):(C===s||C===o)&&(T=i,Q=!0);var P=T===r,U=P?V:q,F=P?_:z,K=F0(F),J=!1;!(Q&&(A||D))&&(C===u&&F<0||C===d&&F>0||C===s&&F>0||C===o&&F<0)&&(K*=-1,U=K*Math.abs(U),J=!0);var k;if(A){var G=M<0?1+M:M;k=G*U}else{var X=M<0?U:0;k=X+M*K}var W=function(Y){return Math.abs(Y)<j||Math.abs(Y)>=Math.abs(U)},$=W(k),ee=W(Math.abs(U)-Math.abs(k)),ie=$||ee;if(ie&&!J)if(P){var he=Math.abs(F)<=m/2,oe=Math.abs(z)<=y/2;if(he){var ae=(h.x1+h.x2)/2,re=h.y1,le=h.y2;a.segpts=[ae,re,ae,le]}else if(oe){var se=(h.y1+h.y2)/2,Ne=h.x1,Ae=h.x2;a.segpts=[Ne,se,Ae,se]}else a.segpts=[h.x1,h.y2]}else{var We=Math.abs(F)<=p/2,He=Math.abs(_)<=x/2;if(We){var Se=(h.y1+h.y2)/2,ke=h.x1,De=h.x2;a.segpts=[ke,Se,De,Se]}else if(He){var Be=(h.x1+h.x2)/2,Ge=h.y1,Je=h.y2;a.segpts=[Be,Ge,Be,Je]}else a.segpts=[h.x2,h.y1]}else if(P){var Re=h.y1+k+(S?m/2*K:0),nt=h.x1,xe=h.x2;a.segpts=[nt,Re,xe,Re]}else{var pe=h.x1+k+(S?p/2*K:0),Ye=h.y1,tt=h.y2;a.segpts=[pe,Ye,pe,tt]}if(a.isRound){var Ke=t.pstyle("taxi-radius").value,Ue=t.pstyle("radius-type").value[0]==="arc-radius";a.radii=new Array(a.segpts.length/2).fill(Ke),a.isArcRadius=new Array(a.segpts.length/2).fill(Ue)}};Ja.tryToCorrectInvalidPoints=function(t,e){var a=t._private.rscratch;if(a.edgeType==="bezier"){var r=e.srcPos,i=e.tgtPos,s=e.srcW,o=e.srcH,u=e.tgtW,d=e.tgtH,f=e.srcShape,h=e.tgtShape,p=e.srcCornerRadius,m=e.tgtCornerRadius,y=e.srcRs,x=e.tgtRs,E=!Oe(a.startX)||!Oe(a.startY),S=!Oe(a.arrowStartX)||!Oe(a.arrowStartY),T=!Oe(a.endX)||!Oe(a.endY),C=!Oe(a.arrowEndX)||!Oe(a.arrowEndY),N=3,A=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth,M=N*A,D=Js({x:a.ctrlpts[0],y:a.ctrlpts[1]},{x:a.startX,y:a.startY}),j=D<M,R=Js({x:a.ctrlpts[0],y:a.ctrlpts[1]},{x:a.endX,y:a.endY}),L=R<M,z=!1;if(E||S||j){z=!0;var _={x:a.ctrlpts[0]-r.x,y:a.ctrlpts[1]-r.y},B=Math.sqrt(_.x*_.x+_.y*_.y),q={x:_.x/B,y:_.y/B},V=Math.max(s,o),Q={x:a.ctrlpts[0]+q.x*2*V,y:a.ctrlpts[1]+q.y*2*V},P=f.intersectLine(r.x,r.y,s,o,Q.x,Q.y,0,p,y);j?(a.ctrlpts[0]=a.ctrlpts[0]+q.x*(M-D),a.ctrlpts[1]=a.ctrlpts[1]+q.y*(M-D)):(a.ctrlpts[0]=P[0]+q.x*M,a.ctrlpts[1]=P[1]+q.y*M)}if(T||C||L){z=!0;var U={x:a.ctrlpts[0]-i.x,y:a.ctrlpts[1]-i.y},F=Math.sqrt(U.x*U.x+U.y*U.y),K={x:U.x/F,y:U.y/F},J=Math.max(s,o),k={x:a.ctrlpts[0]+K.x*2*J,y:a.ctrlpts[1]+K.y*2*J},G=h.intersectLine(i.x,i.y,u,d,k.x,k.y,0,m,x);L?(a.ctrlpts[0]=a.ctrlpts[0]+K.x*(M-R),a.ctrlpts[1]=a.ctrlpts[1]+K.y*(M-R)):(a.ctrlpts[0]=G[0]+K.x*M,a.ctrlpts[1]=G[1]+K.y*M)}z&&this.findEndpoints(t)}};Ja.storeAllpts=function(t){var e=t._private.rscratch;if(e.edgeType==="multibezier"||e.edgeType==="bezier"||e.edgeType==="self"||e.edgeType==="compound"){e.allpts=[],e.allpts.push(e.startX,e.startY);for(var a=0;a+1<e.ctrlpts.length;a+=2)e.allpts.push(e.ctrlpts[a],e.ctrlpts[a+1]),a+3<e.ctrlpts.length&&e.allpts.push((e.ctrlpts[a]+e.ctrlpts[a+2])/2,(e.ctrlpts[a+1]+e.ctrlpts[a+3])/2);e.allpts.push(e.endX,e.endY);var r,i;e.ctrlpts.length/2%2===0?(r=e.allpts.length/2-1,e.midX=e.allpts[r],e.midY=e.allpts[r+1]):(r=e.allpts.length/2-3,i=.5,e.midX=Oa(e.allpts[r],e.allpts[r+2],e.allpts[r+4],i),e.midY=Oa(e.allpts[r+1],e.allpts[r+3],e.allpts[r+5],i))}else if(e.edgeType==="straight")e.allpts=[e.startX,e.startY,e.endX,e.endY],e.midX=(e.startX+e.endX+e.arrowStartX+e.arrowEndX)/4,e.midY=(e.startY+e.endY+e.arrowStartY+e.arrowEndY)/4;else if(e.edgeType==="segments"){if(e.allpts=[],e.allpts.push(e.startX,e.startY),e.allpts.push.apply(e.allpts,e.segpts),e.allpts.push(e.endX,e.endY),e.isRound){e.roundCorners=[];for(var s=2;s+3<e.allpts.length;s+=2){var o=e.radii[s/2-1],u=e.isArcRadius[s/2-1];e.roundCorners.push(ay({x:e.allpts[s-2],y:e.allpts[s-1]},{x:e.allpts[s],y:e.allpts[s+1],radius:o},{x:e.allpts[s+2],y:e.allpts[s+3]},o,u))}}if(e.segpts.length%4===0){var d=e.segpts.length/2,f=d-2;e.midX=(e.segpts[f]+e.segpts[d])/2,e.midY=(e.segpts[f+1]+e.segpts[d+1])/2}else{var h=e.segpts.length/2-1;if(!e.isRound)e.midX=e.segpts[h],e.midY=e.segpts[h+1];else{var p={x:e.segpts[h],y:e.segpts[h+1]},m=e.roundCorners[h/2];if(m.radius===0){var y={x:e.segpts[h+2],y:e.segpts[h+3]};e.midX=p.x,e.midY=p.y,e.midVector=[p.y-y.y,y.x-p.x]}else{var x=[p.x-m.cx,p.y-m.cy],E=m.radius/Math.sqrt(Math.pow(x[0],2)+Math.pow(x[1],2));x=x.map(function(S){return S*E}),e.midX=m.cx+x[0],e.midY=m.cy+x[1],e.midVector=x}}}}};Ja.checkForInvalidEdgeWarning=function(t){var e=t[0]._private.rscratch;e.nodesOverlap||Oe(e.startX)&&Oe(e.startY)&&Oe(e.endX)&&Oe(e.endY)?e.loggedErr=!1:e.loggedErr||(e.loggedErr=!0,At("Edge `"+t.id()+"` has invalid endpoints and so it is impossible to draw. Adjust your edge style (e.g. control points) accordingly or use an alternative edge type. This is expected behaviour when the source node and the target node overlap."))};Ja.findEdgeControlPoints=function(t){var e=this;if(!(!t||t.length===0)){for(var a=this,r=a.cy,i=r.hasCompoundNodes(),s=new Kn,o=function(L,z){return[].concat(Bf(L),[z?1:0]).join("-")},u=[],d=[],f=0;f<t.length;f++){var h=t[f],p=h._private,m=h.pstyle("curve-style").value;if(!(h.removed()||!h.takesUpSpace())){if(m==="haystack"){d.push(h);continue}var y=m==="unbundled-bezier"||Qi(m,"segments")||m==="straight"||m==="straight-triangle"||Qi(m,"taxi"),x=m==="unbundled-bezier"||m==="bezier",E=p.source,S=p.target,T=E.poolIndex(),C=S.poolIndex(),N=[T,C].sort(),A=o(N,y),M=s.get(A);M==null&&(M={eles:[]},u.push({pairId:N,edgeIsUnbundled:y}),s.set(A,M)),M.eles.push(h),y&&(M.hasUnbundled=!0),x&&(M.hasBezier=!0)}}for(var D=function(){var L=u[j],z=L.pairId,_=L.edgeIsUnbundled,B=o(z,_),q=s.get(B),V;if(!q.hasUnbundled){var Q=q.eles[0].parallelEdges().filter(function(Ue){return Ue.isBundledBezier()});I0(q.eles),Q.forEach(function(Ue){return q.eles.push(Ue)}),q.eles.sort(function(Ue,we){return Ue.poolIndex()-we.poolIndex()})}var P=q.eles[0],U=P.source(),F=P.target();if(U.poolIndex()>F.poolIndex()){var K=U;U=F,F=K}var J=q.srcPos=U.position(),k=q.tgtPos=F.position(),G=q.srcW=U.outerWidth(),X=q.srcH=U.outerHeight(),W=q.tgtW=F.outerWidth(),$=q.tgtH=F.outerHeight(),ee=q.srcShape=a.nodeShapes[e.getNodeShape(U)],ie=q.tgtShape=a.nodeShapes[e.getNodeShape(F)],he=q.srcCornerRadius=U.pstyle("corner-radius").value==="auto"?"auto":U.pstyle("corner-radius").pfValue,oe=q.tgtCornerRadius=F.pstyle("corner-radius").value==="auto"?"auto":F.pstyle("corner-radius").pfValue,ae=q.tgtRs=F._private.rscratch,re=q.srcRs=U._private.rscratch;q.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var le=0;le<q.eles.length;le++){var se=q.eles[le],Ne=se[0]._private.rscratch,Ae=se.pstyle("curve-style").value,We=Ae==="unbundled-bezier"||Qi(Ae,"segments")||Qi(Ae,"taxi"),He=!U.same(se.source());if(!q.calculatedIntersection&&U!==F&&(q.hasBezier||q.hasUnbundled)){q.calculatedIntersection=!0;var Se=ee.intersectLine(J.x,J.y,G,X,k.x,k.y,0,he,re),ke=q.srcIntn=Se,De=ie.intersectLine(k.x,k.y,W,$,J.x,J.y,0,oe,ae),Be=q.tgtIntn=De,Ge=q.intersectionPts={x1:Se[0],x2:De[0],y1:Se[1],y2:De[1]},Je=q.posPts={x1:J.x,x2:k.x,y1:J.y,y2:k.y},Re=De[1]-Se[1],nt=De[0]-Se[0],xe=Math.sqrt(nt*nt+Re*Re);Oe(xe)&&xe>=zB||(xe=Math.sqrt(Math.max(nt*nt,ic)+Math.max(Re*Re,ic)));var pe=q.vector={x:nt,y:Re},Ye=q.vectorNorm={x:pe.x/xe,y:pe.y/xe},tt={x:-Ye.y,y:Ye.x};q.nodesOverlap=!Oe(xe)||ie.checkPoint(Se[0],Se[1],0,W,$,k.x,k.y,oe,ae)||ee.checkPoint(De[0],De[1],0,G,X,J.x,J.y,he,re),q.vectorNormInverse=tt,V={nodesOverlap:q.nodesOverlap,dirCounts:q.dirCounts,calculatedIntersection:!0,hasBezier:q.hasBezier,hasUnbundled:q.hasUnbundled,eles:q.eles,srcPos:k,srcRs:ae,tgtPos:J,tgtRs:re,srcW:W,srcH:$,tgtW:G,tgtH:X,srcIntn:Be,tgtIntn:ke,srcShape:ie,tgtShape:ee,posPts:{x1:Je.x2,y1:Je.y2,x2:Je.x1,y2:Je.y1},intersectionPts:{x1:Ge.x2,y1:Ge.y2,x2:Ge.x1,y2:Ge.y1},vector:{x:-pe.x,y:-pe.y},vectorNorm:{x:-Ye.x,y:-Ye.y},vectorNormInverse:{x:-tt.x,y:-tt.y}}}var Ke=He?V:q;Ne.nodesOverlap=Ke.nodesOverlap,Ne.srcIntn=Ke.srcIntn,Ne.tgtIntn=Ke.tgtIntn,Ne.isRound=Ae.startsWith("round"),i&&(U.isParent()||U.isChild()||F.isParent()||F.isChild())&&(U.parents().anySame(F)||F.parents().anySame(U)||U.same(F)&&U.isParent())?e.findCompoundLoopPoints(se,Ke,le,We):U===F?e.findLoopPoints(se,Ke,le,We):Ae.endsWith("segments")?e.findSegmentsPoints(se,Ke):Ae.endsWith("taxi")?e.findTaxiPoints(se,Ke):Ae==="straight"||!We&&q.eles.length%2===1&&le===Math.floor(q.eles.length/2)?e.findStraightEdgePoints(se):e.findBezierPoints(se,Ke,le,We,He),e.findEndpoints(se),e.tryToCorrectInvalidPoints(se,Ke),e.checkForInvalidEdgeWarning(se),e.storeAllpts(se),e.storeEdgeProjections(se),e.calculateArrowAngles(se),e.recalculateEdgeLabelProjections(se),e.calculateLabelAngles(se)}},j=0;j<u.length;j++)D();this.findHaystackPoints(d)}};function WC(t){var e=[];if(t!=null){for(var a=0;a<t.length;a+=2){var r=t[a],i=t[a+1];e.push({x:r,y:i})}return e}}Ja.getSegmentPoints=function(t){var e=t[0]._private.rscratch;this.recalculateRenderedStyle(t);var a=e.edgeType;if(a==="segments")return WC(e.segpts)};Ja.getControlPoints=function(t){var e=t[0]._private.rscratch;this.recalculateRenderedStyle(t);var a=e.edgeType;if(a==="bezier"||a==="multibezier"||a==="self"||a==="compound")return WC(e.ctrlpts)};Ja.getEdgeMidpoint=function(t){var e=t[0]._private.rscratch;return this.recalculateRenderedStyle(t),{x:e.midX,y:e.midY}};var Mc={};Mc.manualEndptToPx=function(t,e){var a=this,r=t.position(),i=t.outerWidth(),s=t.outerHeight(),o=t._private.rscratch;if(e.value.length===2){var u=[e.pfValue[0],e.pfValue[1]];return e.units[0]==="%"&&(u[0]=u[0]*i),e.units[1]==="%"&&(u[1]=u[1]*s),u[0]+=r.x,u[1]+=r.y,u}else{var d=e.pfValue[0];d=-Math.PI/2+d;var f=2*Math.max(i,s),h=[r.x+Math.cos(d)*f,r.y+Math.sin(d)*f];return a.nodeShapes[this.getNodeShape(t)].intersectLine(r.x,r.y,i,s,h[0],h[1],0,t.pstyle("corner-radius").value==="auto"?"auto":t.pstyle("corner-radius").pfValue,o)}};Mc.findEndpoints=function(t){var e,a,r,i,s=this,o,u=t.source()[0],d=t.target()[0],f=u.position(),h=d.position(),p=t.pstyle("target-arrow-shape").value,m=t.pstyle("source-arrow-shape").value,y=t.pstyle("target-distance-from-node").pfValue,x=t.pstyle("source-distance-from-node").pfValue,E=u._private.rscratch,S=d._private.rscratch,T=t.pstyle("curve-style").value,C=t._private.rscratch,N=C.edgeType,A=Qi(T,"taxi"),M=N==="self"||N==="compound",D=N==="bezier"||N==="multibezier"||M,j=N!=="bezier",R=N==="straight"||N==="segments",L=N==="segments",z=D||j||R,_=M||A,B=t.pstyle("source-endpoint"),q=_?"outside-to-node":B.value,V=u.pstyle("corner-radius").value==="auto"?"auto":u.pstyle("corner-radius").pfValue,Q=t.pstyle("target-endpoint"),P=_?"outside-to-node":Q.value,U=d.pstyle("corner-radius").value==="auto"?"auto":d.pstyle("corner-radius").pfValue;C.srcManEndpt=B,C.tgtManEndpt=Q;var F,K,J,k,G=(e=(Q==null||(a=Q.pfValue)===null||a===void 0?void 0:a.length)===2?Q.pfValue:null)!==null&&e!==void 0?e:[0,0],X=(r=(B==null||(i=B.pfValue)===null||i===void 0?void 0:i.length)===2?B.pfValue:null)!==null&&r!==void 0?r:[0,0];if(D){var W=[C.ctrlpts[0],C.ctrlpts[1]],$=j?[C.ctrlpts[C.ctrlpts.length-2],C.ctrlpts[C.ctrlpts.length-1]]:W;F=$,K=W}else if(R){var ee=L?C.segpts.slice(0,2):[h.x+G[0],h.y+G[1]],ie=L?C.segpts.slice(C.segpts.length-2):[f.x+X[0],f.y+X[1]];F=ie,K=ee}if(P==="inside-to-node")o=[h.x,h.y];else if(Q.units)o=this.manualEndptToPx(d,Q);else if(P==="outside-to-line")o=C.tgtIntn;else if(P==="outside-to-node"||P==="outside-to-node-or-label"?J=F:(P==="outside-to-line"||P==="outside-to-line-or-label")&&(J=[f.x,f.y]),o=s.nodeShapes[this.getNodeShape(d)].intersectLine(h.x,h.y,d.outerWidth(),d.outerHeight(),J[0],J[1],0,U,S),P==="outside-to-node-or-label"||P==="outside-to-line-or-label"){var he=d._private.rscratch,oe=he.labelWidth,ae=he.labelHeight,re=he.labelX,le=he.labelY,se=oe/2,Ne=ae/2,Ae=d.pstyle("text-valign").value;Ae==="top"?le-=Ne:Ae==="bottom"&&(le+=Ne);var We=d.pstyle("text-halign").value;We==="left"?re-=se:We==="right"&&(re+=se);var He=ec(J[0],J[1],[re-se,le-Ne,re+se,le-Ne,re+se,le+Ne,re-se,le+Ne],h.x,h.y);if(He.length>0){var Se=f,ke=ks(Se,eo(o)),De=ks(Se,eo(He)),Be=ke;if(De<ke&&(o=He,Be=De),He.length>2){var Ge=ks(Se,{x:He[2],y:He[3]});Ge<Be&&(o=[He[2],He[3]])}}}var Je=ef(o,F,s.arrowShapes[p].spacing(t)+y),Re=ef(o,F,s.arrowShapes[p].gap(t)+y);if(C.endX=Re[0],C.endY=Re[1],C.arrowEndX=Je[0],C.arrowEndY=Je[1],q==="inside-to-node")o=[f.x,f.y];else if(B.units)o=this.manualEndptToPx(u,B);else if(q==="outside-to-line")o=C.srcIntn;else if(q==="outside-to-node"||q==="outside-to-node-or-label"?k=K:(q==="outside-to-line"||q==="outside-to-line-or-label")&&(k=[h.x,h.y]),o=s.nodeShapes[this.getNodeShape(u)].intersectLine(f.x,f.y,u.outerWidth(),u.outerHeight(),k[0],k[1],0,V,E),q==="outside-to-node-or-label"||q==="outside-to-line-or-label"){var nt=u._private.rscratch,xe=nt.labelWidth,pe=nt.labelHeight,Ye=nt.labelX,tt=nt.labelY,Ke=xe/2,Ue=pe/2,we=u.pstyle("text-valign").value;we==="top"?tt-=Ue:we==="bottom"&&(tt+=Ue);var Y=u.pstyle("text-halign").value;Y==="left"?Ye-=Ke:Y==="right"&&(Ye+=Ke);var ce=ec(k[0],k[1],[Ye-Ke,tt-Ue,Ye+Ke,tt-Ue,Ye+Ke,tt+Ue,Ye-Ke,tt+Ue],f.x,f.y);if(ce.length>0){var me=h,ge=ks(me,eo(o)),Ee=ks(me,eo(ce)),Pe=ge;if(Ee<ge&&(o=[ce[0],ce[1]],Pe=Ee),ce.length>2){var je=ks(me,{x:ce[2],y:ce[3]});je<Pe&&(o=[ce[2],ce[3]])}}}var Fe=ef(o,K,s.arrowShapes[m].spacing(t)+x),ze=ef(o,K,s.arrowShapes[m].gap(t)+x);C.startX=ze[0],C.startY=ze[1],C.arrowStartX=Fe[0],C.arrowStartY=Fe[1],z&&(!Oe(C.startX)||!Oe(C.startY)||!Oe(C.endX)||!Oe(C.endY)?C.badLine=!0:C.badLine=!1)};Mc.getSourceEndpoint=function(t){var e=t[0]._private.rscratch;switch(this.recalculateRenderedStyle(t),e.edgeType){case"haystack":return{x:e.haystackPts[0],y:e.haystackPts[1]};default:return{x:e.arrowStartX,y:e.arrowStartY}}};Mc.getTargetEndpoint=function(t){var e=t[0]._private.rscratch;switch(this.recalculateRenderedStyle(t),e.edgeType){case"haystack":return{x:e.haystackPts[2],y:e.haystackPts[3]};default:return{x:e.arrowEndX,y:e.arrowEndY}}};var ry={};function PB(t,e,a){for(var r=function(f,h,p,m){return Oa(f,h,p,m)},i=e._private,s=i.rstyle.bezierPts,o=0;o<t.bezierProjPcts.length;o++){var u=t.bezierProjPcts[o];s.push({x:r(a[0],a[2],a[4],u),y:r(a[1],a[3],a[5],u)})}}ry.storeEdgeProjections=function(t){var e=t._private,a=e.rscratch,r=a.edgeType;if(e.rstyle.bezierPts=null,e.rstyle.linePts=null,e.rstyle.haystackPts=null,r==="multibezier"||r==="bezier"||r==="self"||r==="compound"){e.rstyle.bezierPts=[];for(var i=0;i+5<a.allpts.length;i+=4)PB(this,t,a.allpts.slice(i,i+6))}else if(r==="segments")for(var s=e.rstyle.linePts=[],i=0;i+1<a.allpts.length;i+=2)s.push({x:a.allpts[i],y:a.allpts[i+1]});else if(r==="haystack"){var o=a.haystackPts;e.rstyle.haystackPts=[{x:o[0],y:o[1]},{x:o[2],y:o[3]}]}e.rstyle.arrowWidth=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth};ry.recalculateEdgeProjections=function(t){this.findEdgeControlPoints(t)};var Sn={};Sn.recalculateNodeLabelProjection=function(t){var e=t.pstyle("label").strValue;if(!es(e)){var a,r,i=t._private,s=t.width(),o=t.height(),u=t.padding(),d=t.position(),f=t.pstyle("text-halign").strValue,h=t.pstyle("text-valign").strValue,p=i.rscratch,m=i.rstyle;switch(f){case"left":a=d.x-s/2-u;break;case"right":a=d.x+s/2+u;break;default:a=d.x}switch(h){case"top":r=d.y-o/2-u;break;case"bottom":r=d.y+o/2+u;break;default:r=d.y}p.labelX=a,p.labelY=r,m.labelX=a,m.labelY=r,this.calculateLabelAngles(t),this.applyLabelDimensions(t)}};var JC=function(e,a){var r=Math.atan(a/e);return e===0&&r<0&&(r=r*-1),r},eN=function(e,a){var r=a.x-e.x,i=a.y-e.y;return JC(r,i)},_B=function(e,a,r,i){var s=Ju(0,i-.001,1),o=Ju(0,i+.001,1),u=io(e,a,r,s),d=io(e,a,r,o);return eN(u,d)};Sn.recalculateEdgeLabelProjections=function(t){var e,a=t._private,r=a.rscratch,i=this,s={mid:t.pstyle("label").strValue,source:t.pstyle("source-label").strValue,target:t.pstyle("target-label").strValue};if(s.mid||s.source||s.target){e={x:r.midX,y:r.midY};var o=function(p,m,y){Fn(a.rscratch,p,m,y),Fn(a.rstyle,p,m,y)};o("labelX",null,e.x),o("labelY",null,e.y);var u=JC(r.midDispX,r.midDispY);o("labelAutoAngle",null,u);var d=function(){if(d.cache)return d.cache;for(var p=[],m=0;m+5<r.allpts.length;m+=4){var y={x:r.allpts[m],y:r.allpts[m+1]},x={x:r.allpts[m+2],y:r.allpts[m+3]},E={x:r.allpts[m+4],y:r.allpts[m+5]};p.push({p0:y,p1:x,p2:E,startDist:0,length:0,segments:[]})}var S=a.rstyle.bezierPts,T=i.bezierProjPcts.length;function C(j,R,L,z,_){var B=Js(R,L),q=j.segments[j.segments.length-1],V={p0:R,p1:L,t0:z,t1:_,startDist:q?q.startDist+q.length:0,length:B};j.segments.push(V),j.length+=B}for(var N=0;N<p.length;N++){var A=p[N],M=p[N-1];M&&(A.startDist=M.startDist+M.length),C(A,A.p0,S[N*T],0,i.bezierProjPcts[0]);for(var D=0;D<T-1;D++)C(A,S[N*T+D],S[N*T+D+1],i.bezierProjPcts[D],i.bezierProjPcts[D+1]);C(A,S[N*T+T-1],A.p2,i.bezierProjPcts[T-1],1)}return d.cache=p},f=function(p){var m,y=p==="source";if(s[p]){var x=t.pstyle(p+"-text-offset").pfValue;switch(r.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var E=d(),S,T=0,C=0,N=0;N<E.length;N++){for(var A=E[y?N:E.length-1-N],M=0;M<A.segments.length;M++){var D=A.segments[y?M:A.segments.length-1-M],j=N===E.length-1&&M===A.segments.length-1;if(T=C,C+=D.length,C>=x||j){S={cp:A,segment:D};break}}if(S)break}var R=S.cp,L=S.segment,z=(x-T)/L.length,_=L.t1-L.t0,B=y?L.t0+_*z:L.t1-_*z;B=Ju(0,B,1),e=io(R.p0,R.p1,R.p2,B),m=_B(R.p0,R.p1,R.p2,B);break}case"straight":case"segments":case"haystack":{for(var q=0,V,Q,P,U,F=r.allpts.length,K=0;K+3<F&&(y?(P={x:r.allpts[K],y:r.allpts[K+1]},U={x:r.allpts[K+2],y:r.allpts[K+3]}):(P={x:r.allpts[F-2-K],y:r.allpts[F-1-K]},U={x:r.allpts[F-4-K],y:r.allpts[F-3-K]}),V=Js(P,U),Q=q,q+=V,!(q>=x));K+=2);var J=x-Q,k=J/V;k=Ju(0,k,1),e=sR(P,U,k),m=eN(P,U);break}}o("labelX",p,e.x),o("labelY",p,e.y),o("labelAutoAngle",p,m)}};f("source"),f("target"),this.applyLabelDimensions(t)}};Sn.applyLabelDimensions=function(t){this.applyPrefixedLabelDimensions(t),t.isEdge()&&(this.applyPrefixedLabelDimensions(t,"source"),this.applyPrefixedLabelDimensions(t,"target"))};Sn.applyPrefixedLabelDimensions=function(t,e){var a=t._private,r=this.getLabelText(t,e),i=Ws(r,t._private.labelDimsKey);if(gr(a.rscratch,"prefixedLabelDimsKey",e)!==i){Fn(a.rscratch,"prefixedLabelDimsKey",e,i);var s=this.calculateLabelDimensions(t,r),o=t.pstyle("line-height").pfValue,u=t.pstyle("text-wrap").strValue,d=gr(a.rscratch,"labelWrapCachedLines",e)||[],f=u!=="wrap"?1:Math.max(d.length,1),h=s.height/f,p=h*o,m=s.width,y=s.height+(f-1)*(o-1)*h;Fn(a.rstyle,"labelWidth",e,m),Fn(a.rscratch,"labelWidth",e,m),Fn(a.rstyle,"labelHeight",e,y),Fn(a.rscratch,"labelHeight",e,y),Fn(a.rscratch,"labelLineHeight",e,p)}};Sn.getLabelText=function(t,e){var a=t._private,r=e?e+"-":"",i=t.pstyle(r+"label").strValue,s=t.pstyle("text-transform").value,o=function(X,W){return W?(Fn(a.rscratch,X,e,W),W):gr(a.rscratch,X,e)};if(!i)return"";s=="none"||(s=="uppercase"?i=i.toUpperCase():s=="lowercase"&&(i=i.toLowerCase()));var u=t.pstyle("text-wrap").value;if(u==="wrap"){var d=o("labelKey");if(d!=null&&o("labelWrapKey")===d)return o("labelWrapCachedText");for(var f="",h=i.split(`
|
|
93
|
+
`),p=t.pstyle("text-max-width").pfValue,m=t.pstyle("text-overflow-wrap").value,y=m==="anywhere",x=[],E=/[\s\u200b]+|$/g,S=0;S<h.length;S++){var T=h[S],C=this.calculateLabelDimensions(t,T),N=C.width;if(y){var A=T.split("").join(f);T=A}if(N>p){var M=T.matchAll(E),D="",j=0,R=yr(M),L;try{for(R.s();!(L=R.n()).done;){var z=L.value,_=z[0],B=T.substring(j,z.index);j=z.index+_.length;var q=D.length===0?B:D+B+_,V=this.calculateLabelDimensions(t,q),Q=V.width;Q<=p?D+=B+_:(D&&x.push(D),D=B+_)}}catch(G){R.e(G)}finally{R.f()}D.match(/^[\s\u200b]+$/)||x.push(D)}else x.push(T)}o("labelWrapCachedLines",x),i=o("labelWrapCachedText",x.join(`
|
|
94
|
+
`)),o("labelWrapKey",d)}else if(u==="ellipsis"){var P=t.pstyle("text-max-width").pfValue,U="",F="…",K=!1;if(this.calculateLabelDimensions(t,i).width<P)return i;for(var J=0;J<i.length;J++){var k=this.calculateLabelDimensions(t,U+i[J]+F).width;if(k>P)break;U+=i[J],J===i.length-1&&(K=!0)}return K||(U+=F),U}return i};Sn.getLabelJustification=function(t){var e=t.pstyle("text-justification").strValue,a=t.pstyle("text-halign").strValue;if(e==="auto")if(t.isNode())switch(a){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return e};Sn.calculateLabelDimensions=function(t,e){var a=this,r=a.cy.window(),i=r.document,s=0,o=t.pstyle("font-style").strValue,u=t.pstyle("font-size").pfValue,d=t.pstyle("font-family").strValue,f=t.pstyle("font-weight").strValue,h=this.labelCalcCanvas,p=this.labelCalcCanvasContext;if(!h){h=this.labelCalcCanvas=i.createElement("canvas"),p=this.labelCalcCanvasContext=h.getContext("2d");var m=h.style;m.position="absolute",m.left="-9999px",m.top="-9999px",m.zIndex="-1",m.visibility="hidden",m.pointerEvents="none"}p.font="".concat(o," ").concat(f," ").concat(u,"px ").concat(d);for(var y=0,x=0,E=e.split(`
|
|
95
|
+
`),S=0;S<E.length;S++){var T=E[S],C=p.measureText(T),N=Math.ceil(C.width),A=u;y=Math.max(N,y),x+=A}return y+=s,x+=s,{width:y,height:x}};Sn.calculateLabelAngle=function(t,e){var a=t._private,r=a.rscratch,i=t.isEdge(),s=e?e+"-":"",o=t.pstyle(s+"text-rotation"),u=o.strValue;return u==="none"?0:i&&u==="autorotate"?r.labelAutoAngle:u==="autorotate"?0:o.pfValue};Sn.calculateLabelAngles=function(t){var e=this,a=t.isEdge(),r=t._private,i=r.rscratch;i.labelAngle=e.calculateLabelAngle(t),a&&(i.sourceLabelAngle=e.calculateLabelAngle(t,"source"),i.targetLabelAngle=e.calculateLabelAngle(t,"target"))};var tN={},FS=28,HS=!1;tN.getNodeShape=function(t){var e=this,a=t.pstyle("shape").value;if(a==="cutrectangle"&&(t.width()<FS||t.height()<FS))return HS||(At("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),HS=!0),"rectangle";if(t.isParent())return a==="rectangle"||a==="roundrectangle"||a==="round-rectangle"||a==="cutrectangle"||a==="cut-rectangle"||a==="barrel"?a:"rectangle";if(a==="polygon"){var r=t.pstyle("shape-polygon-points").value;return e.nodeShapes.makePolygon(r).name}return a};var mh={};mh.registerCalculationListeners=function(){var t=this.cy,e=t.collection(),a=this,r=function(o){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(o),u)for(var d=0;d<o.length;d++){var f=o[d],h=f._private,p=h.rstyle;p.clean=!1,p.cleanConnected=!1}};a.binder(t).on("bounds.* dirty.*",function(o){var u=o.target;r(u)}).on("style.* background.*",function(o){var u=o.target;r(u,!1)});var i=function(o){if(o){var u=a.onUpdateEleCalcsFns;e.cleanStyle();for(var d=0;d<e.length;d++){var f=e[d],h=f._private.rstyle;f.isNode()&&!h.cleanConnected&&(r(f.connectedEdges()),h.cleanConnected=!0)}if(u)for(var p=0;p<u.length;p++){var m=u[p];m(o,e)}a.recalculateRenderedStyle(e),e=t.collection()}};a.flushRenderedStyleQueue=function(){i(!0)},a.beforeRender(i,a.beforeRenderPriorities.eleCalcs)};mh.onUpdateEleCalcs=function(t){var e=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];e.push(t)};mh.recalculateRenderedStyle=function(t,e){var a=function(A){return A._private.rstyle.cleanConnected};if(t.length!==0){var r=[],i=[];if(!this.destroyed){e===void 0&&(e=!0);for(var s=0;s<t.length;s++){var o=t[s],u=o._private,d=u.rstyle;o.isEdge()&&(!a(o.source())||!a(o.target()))&&(d.clean=!1),o.isEdge()&&o.isBundledBezier()&&o.parallelEdges().some(function(N){return!N._private.rstyle.clean&&N.isBundledBezier()})&&(d.clean=!1),!(e&&d.clean||o.removed())&&o.pstyle("display").value!=="none"&&(u.group==="nodes"?i.push(o):r.push(o),d.clean=!0)}for(var f=0;f<i.length;f++){var h=i[f],p=h._private,m=p.rstyle,y=h.position();this.recalculateNodeLabelProjection(h),m.nodeX=y.x,m.nodeY=y.y,m.nodeW=h.pstyle("width").pfValue,m.nodeH=h.pstyle("height").pfValue}this.recalculateEdgeProjections(r);for(var x=0;x<r.length;x++){var E=r[x],S=E._private,T=S.rstyle,C=S.rscratch;T.srcX=C.arrowStartX,T.srcY=C.arrowStartY,T.tgtX=C.arrowEndX,T.tgtY=C.arrowEndY,T.midX=C.midX,T.midY=C.midY,T.labelAngle=C.labelAngle,T.sourceLabelAngle=C.sourceLabelAngle,T.targetLabelAngle=C.targetLabelAngle}}}};var yh={};yh.updateCachedGrabbedEles=function(){var t=this.cachedZSortedEles;if(t){t.drag=[],t.nondrag=[];for(var e=[],a=0;a<t.length;a++){var r=t[a],i=r._private.rscratch;r.grabbed()&&!r.isParent()?e.push(r):i.inDragLayer?t.drag.push(r):t.nondrag.push(r)}for(var a=0;a<e.length;a++){var r=e[a];t.drag.push(r)}}};yh.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null};yh.getCachedZSortedEles=function(t){if(t||!this.cachedZSortedEles){var e=this.cy.mutableElements().toArray();e.sort(zC),e.interactive=e.filter(function(a){return a.interactive()}),this.cachedZSortedEles=e,this.updateCachedGrabbedEles()}else e=this.cachedZSortedEles;return e};var aN={};[ll,Hf,Ja,Mc,ry,Sn,tN,mh,yh].forEach(function(t){et(aN,t)});var rN={};rN.getCachedImage=function(t,e,a){var r=this,i=r.imageCache=r.imageCache||{},s=i[t];if(s)return s.image.complete||s.image.addEventListener("load",a),s.image;s=i[t]=i[t]||{};var o=s.image=new Image;o.addEventListener("load",a),o.addEventListener("error",function(){o.error=!0});var u="data:",d=t.substring(0,u.length).toLowerCase()===u;return d||(e=e==="null"?null:e,o.crossOrigin=e),o.src=t,o};var Po={};Po.registerBinding=function(t,e,a,r){var i=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(t)){for(var s=[],o=0;o<t.length;o++){var u=t[o];if(u!==void 0){var d=this.binder(u);s.push(d.on.apply(d,i))}}return s}var d=this.binder(t);return d.on.apply(d,i)};Po.binder=function(t){var e=this,a=e.cy.window(),r=t===a||t===a.document||t===a.document.body||XO(t);if(e.supportsPassiveEvents==null){var i=!1;try{var s=Object.defineProperty({},"passive",{get:function(){return i=!0,!0}});a.addEventListener("test",null,s)}catch{}e.supportsPassiveEvents=i}var o=function(d,f,h){var p=Array.prototype.slice.call(arguments);return r&&e.supportsPassiveEvents&&(p[2]={capture:h??!1,passive:!1,once:!1}),e.bindings.push({target:t,args:p}),(t.addEventListener||t.on).apply(t,p),this};return{on:o,addEventListener:o,addListener:o,bind:o}};Po.nodeIsDraggable=function(t){return t&&t.isNode()&&!t.locked()&&t.grabbable()};Po.nodeIsGrabbable=function(t){return this.nodeIsDraggable(t)&&t.interactive()};Po.load=function(){var t=this,e=t.cy.window(),a=function(Y){return Y.selected()},r=function(Y){var ce=Y.getRootNode();if(ce&&ce.nodeType===11&&ce.host!==void 0)return ce},i=function(Y,ce,me,ge){Y==null&&(Y=t.cy);for(var Ee=0;Ee<ce.length;Ee++){var Pe=ce[Ee];Y.emit({originalEvent:me,type:Pe,position:ge})}},s=function(Y){return Y.shiftKey||Y.metaKey||Y.ctrlKey},o=function(Y,ce){var me=!0;if(t.cy.hasCompoundNodes()&&Y&&Y.pannable())for(var ge=0;ce&&ge<ce.length;ge++){var Y=ce[ge];if(Y.isNode()&&Y.isParent()&&!Y.pannable()){me=!1;break}}else me=!0;return me},u=function(Y){Y[0]._private.grabbed=!0},d=function(Y){Y[0]._private.grabbed=!1},f=function(Y){Y[0]._private.rscratch.inDragLayer=!0},h=function(Y){Y[0]._private.rscratch.inDragLayer=!1},p=function(Y){Y[0]._private.rscratch.isGrabTarget=!0},m=function(Y){Y[0]._private.rscratch.isGrabTarget=!1},y=function(Y,ce){var me=ce.addToList,ge=me.has(Y);!ge&&Y.grabbable()&&!Y.locked()&&(me.merge(Y),u(Y))},x=function(Y,ce){if(Y.cy().hasCompoundNodes()&&!(ce.inDragLayer==null&&ce.addToList==null)){var me=Y.descendants();ce.inDragLayer&&(me.forEach(f),me.connectedEdges().forEach(f)),ce.addToList&&y(me,ce)}},E=function(Y,ce){ce=ce||{};var me=Y.cy().hasCompoundNodes();ce.inDragLayer&&(Y.forEach(f),Y.neighborhood().stdFilter(function(ge){return!me||ge.isEdge()}).forEach(f)),ce.addToList&&Y.forEach(function(ge){y(ge,ce)}),x(Y,ce),C(Y,{inDragLayer:ce.inDragLayer}),t.updateCachedGrabbedEles()},S=E,T=function(Y){Y&&(t.getCachedZSortedEles().forEach(function(ce){d(ce),h(ce),m(ce)}),t.updateCachedGrabbedEles())},C=function(Y,ce){if(!(ce.inDragLayer==null&&ce.addToList==null)&&Y.cy().hasCompoundNodes()){var me=Y.ancestors().orphans();if(!me.same(Y)){var ge=me.descendants().spawnSelf().merge(me).unmerge(Y).unmerge(Y.descendants()),Ee=ge.connectedEdges();ce.inDragLayer&&(Ee.forEach(f),ge.forEach(f)),ce.addToList&&ge.forEach(function(Pe){y(Pe,ce)})}}},N=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},A=typeof MutationObserver<"u",M=typeof ResizeObserver<"u";A?(t.removeObserver=new MutationObserver(function(we){for(var Y=0;Y<we.length;Y++){var ce=we[Y],me=ce.removedNodes;if(me)for(var ge=0;ge<me.length;ge++){var Ee=me[ge];if(Ee===t.container){t.destroy();break}}}}),t.container.parentNode&&t.removeObserver.observe(t.container.parentNode,{childList:!0})):t.registerBinding(t.container,"DOMNodeRemoved",function(we){t.destroy()});var D=Cc(function(){t.cy.resize()},100);A&&(t.styleObserver=new MutationObserver(D),t.styleObserver.observe(t.container,{attributes:!0})),t.registerBinding(e,"resize",D),M&&(t.resizeObserver=new ResizeObserver(D),t.resizeObserver.observe(t.container));var j=function(Y,ce){for(;Y!=null;)ce(Y),Y=Y.parentNode},R=function(){t.invalidateContainerClientCoordsCache()};j(t.container,function(we){t.registerBinding(we,"transitionend",R),t.registerBinding(we,"animationend",R),t.registerBinding(we,"scroll",R)}),t.registerBinding(t.container,"contextmenu",function(we){we.preventDefault()});var L=function(){return t.selection[4]!==0},z=function(Y){for(var ce=t.findContainerClientCoords(),me=ce[0],ge=ce[1],Ee=ce[2],Pe=ce[3],je=Y.touches?Y.touches:[Y],Fe=!1,ze=0;ze<je.length;ze++){var $e=je[ze];if(me<=$e.clientX&&$e.clientX<=me+Ee&&ge<=$e.clientY&&$e.clientY<=ge+Pe){Fe=!0;break}}if(!Fe)return!1;for(var it=t.container,st=Y.target,Ie=st.parentNode,dt=!1;Ie;){if(Ie===it){dt=!0;break}Ie=Ie.parentNode}return!!dt};t.registerBinding(t.container,"mousedown",function(Y){if(z(Y)&&!(t.hoverData.which===1&&Y.which!==1)){Y.preventDefault(),N(),t.hoverData.capture=!0,t.hoverData.which=Y.which;var ce=t.cy,me=[Y.clientX,Y.clientY],ge=t.projectIntoViewport(me[0],me[1]),Ee=t.selection,Pe=t.findNearestElements(ge[0],ge[1],!0,!1),je=Pe[0],Fe=t.dragData.possibleDragElements;t.hoverData.mdownPos=ge,t.hoverData.mdownGPos=me;var ze=function(ut){return{originalEvent:Y,type:ut,position:{x:ge[0],y:ge[1]}}},$e=function(){t.hoverData.tapholdCancelled=!1,clearTimeout(t.hoverData.tapholdTimeout),t.hoverData.tapholdTimeout=setTimeout(function(){if(!t.hoverData.tapholdCancelled){var ut=t.hoverData.down;ut?ut.emit(ze("taphold")):ce.emit(ze("taphold"))}},t.tapholdDuration)};if(Y.which==3){t.hoverData.cxtStarted=!0;var it={originalEvent:Y,type:"cxttapstart",position:{x:ge[0],y:ge[1]}};je?(je.activate(),je.emit(it),t.hoverData.down=je):ce.emit(it),t.hoverData.downTime=new Date().getTime(),t.hoverData.cxtDragged=!1}else if(Y.which==1){je&&je.activate();{if(je!=null&&t.nodeIsGrabbable(je)){var st=function(ut){ut.emit(ze("grab"))};if(p(je),!je.selected())Fe=t.dragData.possibleDragElements=ce.collection(),S(je,{addToList:Fe}),je.emit(ze("grabon")).emit(ze("grab"));else{Fe=t.dragData.possibleDragElements=ce.collection();var Ie=ce.$(function(dt){return dt.isNode()&&dt.selected()&&t.nodeIsGrabbable(dt)});E(Ie,{addToList:Fe}),je.emit(ze("grabon")),Ie.forEach(st)}t.redrawHint("eles",!0),t.redrawHint("drag",!0)}t.hoverData.down=je,t.hoverData.downs=Pe,t.hoverData.downTime=new Date().getTime()}i(je,["mousedown","tapstart","vmousedown"],Y,{x:ge[0],y:ge[1]}),je==null?(Ee[4]=1,t.data.bgActivePosistion={x:ge[0],y:ge[1]},t.redrawHint("select",!0),t.redraw()):je.pannable()&&(Ee[4]=1),$e()}Ee[0]=Ee[2]=ge[0],Ee[1]=Ee[3]=ge[1]}},!1);var _=r(t.container);t.registerBinding([e,_],"mousemove",function(Y){var ce=t.hoverData.capture;if(!(!ce&&!z(Y))){var me=!1,ge=t.cy,Ee=ge.zoom(),Pe=[Y.clientX,Y.clientY],je=t.projectIntoViewport(Pe[0],Pe[1]),Fe=t.hoverData.mdownPos,ze=t.hoverData.mdownGPos,$e=t.selection,it=null;!t.hoverData.draggingEles&&!t.hoverData.dragging&&!t.hoverData.selecting&&(it=t.findNearestElement(je[0],je[1],!0,!1));var st=t.hoverData.last,Ie=t.hoverData.down,dt=[je[0]-$e[2],je[1]-$e[3]],ut=t.dragData.possibleDragElements,Yt;if(ze){var Rt=Pe[0]-ze[0],Ba=Rt*Rt,Kt=Pe[1]-ze[1],ia=Kt*Kt,Wt=Ba+ia;t.hoverData.isOverThresholdDrag=Yt=Wt>=t.desktopTapThreshold2}var sa=s(Y);Yt&&(t.hoverData.tapholdCancelled=!0);var Or=function(){var ja=t.hoverData.dragDelta=t.hoverData.dragDelta||[];ja.length===0?(ja.push(dt[0]),ja.push(dt[1])):(ja[0]+=dt[0],ja[1]+=dt[1])};me=!0,i(it,["mousemove","vmousemove","tapdrag"],Y,{x:je[0],y:je[1]});var $t=function(ja){return{originalEvent:Y,type:ja,position:{x:je[0],y:je[1]}}},Rr=function(){t.data.bgActivePosistion=void 0,t.hoverData.selecting||ge.emit($t("boxstart")),$e[4]=1,t.hoverData.selecting=!0,t.redrawHint("select",!0),t.redraw()};if(t.hoverData.which===3){if(Yt){var Ta=$t("cxtdrag");Ie?Ie.emit(Ta):ge.emit(Ta),t.hoverData.cxtDragged=!0,(!t.hoverData.cxtOver||it!==t.hoverData.cxtOver)&&(t.hoverData.cxtOver&&t.hoverData.cxtOver.emit($t("cxtdragout")),t.hoverData.cxtOver=it,it&&it.emit($t("cxtdragover")))}}else if(t.hoverData.dragging){if(me=!0,ge.panningEnabled()&&ge.userPanningEnabled()){var Ht;if(t.hoverData.justStartedPan){var ya=t.hoverData.mdownPos;Ht={x:(je[0]-ya[0])*Ee,y:(je[1]-ya[1])*Ee},t.hoverData.justStartedPan=!1}else Ht={x:dt[0]*Ee,y:dt[1]*Ee};ge.panBy(Ht),ge.emit($t("dragpan")),t.hoverData.dragged=!0}je=t.projectIntoViewport(Y.clientX,Y.clientY)}else if($e[4]==1&&(Ie==null||Ie.pannable())){if(Yt){if(!t.hoverData.dragging&&ge.boxSelectionEnabled()&&(sa||!ge.panningEnabled()||!ge.userPanningEnabled()))Rr();else if(!t.hoverData.selecting&&ge.panningEnabled()&&ge.userPanningEnabled()){var sr=o(Ie,t.hoverData.downs);sr&&(t.hoverData.dragging=!0,t.hoverData.justStartedPan=!0,$e[4]=0,t.data.bgActivePosistion=eo(Fe),t.redrawHint("select",!0),t.redraw())}Ie&&Ie.pannable()&&Ie.active()&&Ie.unactivate()}}else{if(Ie&&Ie.pannable()&&Ie.active()&&Ie.unactivate(),(!Ie||!Ie.grabbed())&&it!=st&&(st&&i(st,["mouseout","tapdragout"],Y,{x:je[0],y:je[1]}),it&&i(it,["mouseover","tapdragover"],Y,{x:je[0],y:je[1]}),t.hoverData.last=it),Ie)if(Yt){if(ge.boxSelectionEnabled()&&sa)Ie&&Ie.grabbed()&&(T(ut),Ie.emit($t("freeon")),ut.emit($t("free")),t.dragData.didDrag&&(Ie.emit($t("dragfreeon")),ut.emit($t("dragfree")))),Rr();else if(Ie&&Ie.grabbed()&&t.nodeIsDraggable(Ie)){var Ca=!t.dragData.didDrag;Ca&&t.redrawHint("eles",!0),t.dragData.didDrag=!0,t.hoverData.draggingEles||E(ut,{inDragLayer:!0});var Na={x:0,y:0};if(Oe(dt[0])&&Oe(dt[1])&&(Na.x+=dt[0],Na.y+=dt[1],Ca)){var Ga=t.hoverData.dragDelta;Ga&&Oe(Ga[0])&&Oe(Ga[1])&&(Na.x+=Ga[0],Na.y+=Ga[1])}t.hoverData.draggingEles=!0,ut.silentShift(Na).emit($t("position")).emit($t("drag")),t.redrawHint("drag",!0),t.redraw()}}else Or();me=!0}if($e[2]=je[0],$e[3]=je[1],me)return Y.stopPropagation&&Y.stopPropagation(),Y.preventDefault&&Y.preventDefault(),!1}},!1);var B,q,V;t.registerBinding(e,"mouseup",function(Y){if(!(t.hoverData.which===1&&Y.which!==1&&t.hoverData.capture)){var ce=t.hoverData.capture;if(ce){t.hoverData.capture=!1;var me=t.cy,ge=t.projectIntoViewport(Y.clientX,Y.clientY),Ee=t.selection,Pe=t.findNearestElement(ge[0],ge[1],!0,!1),je=t.dragData.possibleDragElements,Fe=t.hoverData.down,ze=s(Y);t.data.bgActivePosistion&&(t.redrawHint("select",!0),t.redraw()),t.hoverData.tapholdCancelled=!0,t.data.bgActivePosistion=void 0,Fe&&Fe.unactivate();var $e=function(Rt){return{originalEvent:Y,type:Rt,position:{x:ge[0],y:ge[1]}}};if(t.hoverData.which===3){var it=$e("cxttapend");if(Fe?Fe.emit(it):me.emit(it),!t.hoverData.cxtDragged){var st=$e("cxttap");Fe?Fe.emit(st):me.emit(st)}t.hoverData.cxtDragged=!1,t.hoverData.which=null}else if(t.hoverData.which===1){if(i(Pe,["mouseup","tapend","vmouseup"],Y,{x:ge[0],y:ge[1]}),!t.dragData.didDrag&&!t.hoverData.dragged&&!t.hoverData.selecting&&!t.hoverData.isOverThresholdDrag&&(i(Fe,["click","tap","vclick"],Y,{x:ge[0],y:ge[1]}),q=!1,Y.timeStamp-V<=me.multiClickDebounceTime()?(B&&clearTimeout(B),q=!0,V=null,i(Fe,["dblclick","dbltap","vdblclick"],Y,{x:ge[0],y:ge[1]})):(B=setTimeout(function(){q||i(Fe,["oneclick","onetap","voneclick"],Y,{x:ge[0],y:ge[1]})},me.multiClickDebounceTime()),V=Y.timeStamp)),Fe==null&&!t.dragData.didDrag&&!t.hoverData.selecting&&!t.hoverData.dragged&&!s(Y)&&(me.$(a).unselect(["tapunselect"]),je.length>0&&t.redrawHint("eles",!0),t.dragData.possibleDragElements=je=me.collection()),Pe==Fe&&!t.dragData.didDrag&&!t.hoverData.selecting&&Pe!=null&&Pe._private.selectable&&(t.hoverData.dragging||(me.selectionType()==="additive"||ze?Pe.selected()?Pe.unselect(["tapunselect"]):Pe.select(["tapselect"]):ze||(me.$(a).unmerge(Pe).unselect(["tapunselect"]),Pe.select(["tapselect"]))),t.redrawHint("eles",!0)),t.hoverData.selecting){var Ie=me.collection(t.getAllInBox(Ee[0],Ee[1],Ee[2],Ee[3]));t.redrawHint("select",!0),Ie.length>0&&t.redrawHint("eles",!0),me.emit($e("boxend"));var dt=function(Rt){return Rt.selectable()&&!Rt.selected()};me.selectionType()==="additive"||ze||me.$(a).unmerge(Ie).unselect(),Ie.emit($e("box")).stdFilter(dt).select().emit($e("boxselect")),t.redraw()}if(t.hoverData.dragging&&(t.hoverData.dragging=!1,t.redrawHint("select",!0),t.redrawHint("eles",!0),t.redraw()),!Ee[4]){t.redrawHint("drag",!0),t.redrawHint("eles",!0);var ut=Fe&&Fe.grabbed();T(je),ut&&(Fe.emit($e("freeon")),je.emit($e("free")),t.dragData.didDrag&&(Fe.emit($e("dragfreeon")),je.emit($e("dragfree"))))}}Ee[4]=0,t.hoverData.down=null,t.hoverData.cxtStarted=!1,t.hoverData.draggingEles=!1,t.hoverData.selecting=!1,t.hoverData.isOverThresholdDrag=!1,t.dragData.didDrag=!1,t.hoverData.dragged=!1,t.hoverData.dragDelta=[],t.hoverData.mdownPos=null,t.hoverData.mdownGPos=null,t.hoverData.which=null}}},!1);var Q=[],P=4,U,F=1e5,K=function(Y,ce){for(var me=0;me<Y.length;me++)if(Y[me]%ce!==0)return!1;return!0},J=function(Y){for(var ce=Math.abs(Y[0]),me=1;me<Y.length;me++)if(Math.abs(Y[me])!==ce)return!1;return!0},k=function(Y){var ce=!1,me=Y.deltaY;if(me==null&&(Y.wheelDeltaY!=null?me=Y.wheelDeltaY/4:Y.wheelDelta!=null&&(me=Y.wheelDelta/4)),me!==0){if(U==null)if(Q.length>=P){var ge=Q;if(U=K(ge,5),!U){var Ee=Math.abs(ge[0]);U=J(ge)&&Ee>5}if(U)for(var Pe=0;Pe<ge.length;Pe++)F=Math.min(Math.abs(ge[Pe]),F)}else Q.push(me),ce=!0;else U&&(F=Math.min(Math.abs(me),F));if(!t.scrollingPage){var je=t.cy,Fe=je.zoom(),ze=je.pan(),$e=t.projectIntoViewport(Y.clientX,Y.clientY),it=[$e[0]*Fe+ze.x,$e[1]*Fe+ze.y];if(t.hoverData.draggingEles||t.hoverData.dragging||t.hoverData.cxtStarted||L()){Y.preventDefault();return}if(je.panningEnabled()&&je.userPanningEnabled()&&je.zoomingEnabled()&&je.userZoomingEnabled()){Y.preventDefault(),t.data.wheelZooming=!0,clearTimeout(t.data.wheelTimeout),t.data.wheelTimeout=setTimeout(function(){t.data.wheelZooming=!1,t.redrawHint("eles",!0),t.redraw()},150);var st;ce&&Math.abs(me)>5&&(me=F0(me)*5),st=me/-250,U&&(st/=F,st*=3),st=st*t.wheelSensitivity;var Ie=Y.deltaMode===1;Ie&&(st*=33);var dt=je.zoom()*Math.pow(10,st);Y.type==="gesturechange"&&(dt=t.gestureStartZoom*Y.scale),je.zoom({level:dt,renderedPosition:{x:it[0],y:it[1]}}),je.emit({type:Y.type==="gesturechange"?"pinchzoom":"scrollzoom",originalEvent:Y,position:{x:$e[0],y:$e[1]}})}}}};t.registerBinding(t.container,"wheel",k,!0),t.registerBinding(e,"scroll",function(Y){t.scrollingPage=!0,clearTimeout(t.scrollingPageTimeout),t.scrollingPageTimeout=setTimeout(function(){t.scrollingPage=!1},250)},!0),t.registerBinding(t.container,"gesturestart",function(Y){t.gestureStartZoom=t.cy.zoom(),t.hasTouchStarted||Y.preventDefault()},!0),t.registerBinding(t.container,"gesturechange",function(we){t.hasTouchStarted||k(we)},!0),t.registerBinding(t.container,"mouseout",function(Y){var ce=t.projectIntoViewport(Y.clientX,Y.clientY);t.cy.emit({originalEvent:Y,type:"mouseout",position:{x:ce[0],y:ce[1]}})},!1),t.registerBinding(t.container,"mouseover",function(Y){var ce=t.projectIntoViewport(Y.clientX,Y.clientY);t.cy.emit({originalEvent:Y,type:"mouseover",position:{x:ce[0],y:ce[1]}})},!1);var G,X,W,$,ee,ie,he,oe,ae,re,le,se,Ne,Ae=function(Y,ce,me,ge){return Math.sqrt((me-Y)*(me-Y)+(ge-ce)*(ge-ce))},We=function(Y,ce,me,ge){return(me-Y)*(me-Y)+(ge-ce)*(ge-ce)},He;t.registerBinding(t.container,"touchstart",He=function(Y){if(t.hasTouchStarted=!0,!!z(Y)){N(),t.touchData.capture=!0,t.data.bgActivePosistion=void 0;var ce=t.cy,me=t.touchData.now,ge=t.touchData.earlier;if(Y.touches[0]){var Ee=t.projectIntoViewport(Y.touches[0].clientX,Y.touches[0].clientY);me[0]=Ee[0],me[1]=Ee[1]}if(Y.touches[1]){var Ee=t.projectIntoViewport(Y.touches[1].clientX,Y.touches[1].clientY);me[2]=Ee[0],me[3]=Ee[1]}if(Y.touches[2]){var Ee=t.projectIntoViewport(Y.touches[2].clientX,Y.touches[2].clientY);me[4]=Ee[0],me[5]=Ee[1]}var Pe=function(sa){return{originalEvent:Y,type:sa,position:{x:me[0],y:me[1]}}};if(Y.touches[1]){t.touchData.singleTouchMoved=!0,T(t.dragData.touchDragEles);var je=t.findContainerClientCoords();ae=je[0],re=je[1],le=je[2],se=je[3],G=Y.touches[0].clientX-ae,X=Y.touches[0].clientY-re,W=Y.touches[1].clientX-ae,$=Y.touches[1].clientY-re,Ne=0<=G&&G<=le&&0<=W&&W<=le&&0<=X&&X<=se&&0<=$&&$<=se;var Fe=ce.pan(),ze=ce.zoom();ee=Ae(G,X,W,$),ie=We(G,X,W,$),he=[(G+W)/2,(X+$)/2],oe=[(he[0]-Fe.x)/ze,(he[1]-Fe.y)/ze];var $e=200,it=$e*$e;if(ie<it&&!Y.touches[2]){var st=t.findNearestElement(me[0],me[1],!0,!0),Ie=t.findNearestElement(me[2],me[3],!0,!0);st&&st.isNode()?(st.activate().emit(Pe("cxttapstart")),t.touchData.start=st):Ie&&Ie.isNode()?(Ie.activate().emit(Pe("cxttapstart")),t.touchData.start=Ie):ce.emit(Pe("cxttapstart")),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!0,t.touchData.cxtDragged=!1,t.data.bgActivePosistion=void 0,t.redraw();return}}if(Y.touches[2])ce.boxSelectionEnabled()&&Y.preventDefault();else if(!Y.touches[1]){if(Y.touches[0]){var dt=t.findNearestElements(me[0],me[1],!0,!0),ut=dt[0];if(ut!=null&&(ut.activate(),t.touchData.start=ut,t.touchData.starts=dt,t.nodeIsGrabbable(ut))){var Yt=t.dragData.touchDragEles=ce.collection(),Rt=null;t.redrawHint("eles",!0),t.redrawHint("drag",!0),ut.selected()?(Rt=ce.$(function(Wt){return Wt.selected()&&t.nodeIsGrabbable(Wt)}),E(Rt,{addToList:Yt})):S(ut,{addToList:Yt}),p(ut),ut.emit(Pe("grabon")),Rt?Rt.forEach(function(Wt){Wt.emit(Pe("grab"))}):ut.emit(Pe("grab"))}i(ut,["touchstart","tapstart","vmousedown"],Y,{x:me[0],y:me[1]}),ut==null&&(t.data.bgActivePosistion={x:Ee[0],y:Ee[1]},t.redrawHint("select",!0),t.redraw()),t.touchData.singleTouchMoved=!1,t.touchData.singleTouchStartTime=+new Date,clearTimeout(t.touchData.tapholdTimeout),t.touchData.tapholdTimeout=setTimeout(function(){t.touchData.singleTouchMoved===!1&&!t.pinching&&!t.touchData.selecting&&i(t.touchData.start,["taphold"],Y,{x:me[0],y:me[1]})},t.tapholdDuration)}}if(Y.touches.length>=1){for(var Ba=t.touchData.startPosition=[null,null,null,null,null,null],Kt=0;Kt<me.length;Kt++)Ba[Kt]=ge[Kt]=me[Kt];var ia=Y.touches[0];t.touchData.startGPosition=[ia.clientX,ia.clientY]}}},!1);var Se;t.registerBinding(e,"touchmove",Se=function(Y){var ce=t.touchData.capture;if(!(!ce&&!z(Y))){var me=t.selection,ge=t.cy,Ee=t.touchData.now,Pe=t.touchData.earlier,je=ge.zoom();if(Y.touches[0]){var Fe=t.projectIntoViewport(Y.touches[0].clientX,Y.touches[0].clientY);Ee[0]=Fe[0],Ee[1]=Fe[1]}if(Y.touches[1]){var Fe=t.projectIntoViewport(Y.touches[1].clientX,Y.touches[1].clientY);Ee[2]=Fe[0],Ee[3]=Fe[1]}if(Y.touches[2]){var Fe=t.projectIntoViewport(Y.touches[2].clientX,Y.touches[2].clientY);Ee[4]=Fe[0],Ee[5]=Fe[1]}var ze=function(Lc){return{originalEvent:Y,type:Lc,position:{x:Ee[0],y:Ee[1]}}},$e=t.touchData.startGPosition,it;if(ce&&Y.touches[0]&&$e){for(var st=[],Ie=0;Ie<Ee.length;Ie++)st[Ie]=Ee[Ie]-Pe[Ie];var dt=Y.touches[0].clientX-$e[0],ut=dt*dt,Yt=Y.touches[0].clientY-$e[1],Rt=Yt*Yt,Ba=ut+Rt;it=Ba>=t.touchTapThreshold2}if(ce&&t.touchData.cxt){Y.preventDefault();var Kt=Y.touches[0].clientX-ae,ia=Y.touches[0].clientY-re,Wt=Y.touches[1].clientX-ae,sa=Y.touches[1].clientY-re,Or=We(Kt,ia,Wt,sa),$t=Or/ie,Rr=150,Ta=Rr*Rr,Ht=1.5,ya=Ht*Ht;if($t>=ya||Or>=Ta){t.touchData.cxt=!1,t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var sr=ze("cxttapend");t.touchData.start?(t.touchData.start.unactivate().emit(sr),t.touchData.start=null):ge.emit(sr)}}if(ce&&t.touchData.cxt){var sr=ze("cxtdrag");t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.touchData.start?t.touchData.start.emit(sr):ge.emit(sr),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxtDragged=!0;var Ca=t.findNearestElement(Ee[0],Ee[1],!0,!0);(!t.touchData.cxtOver||Ca!==t.touchData.cxtOver)&&(t.touchData.cxtOver&&t.touchData.cxtOver.emit(ze("cxtdragout")),t.touchData.cxtOver=Ca,Ca&&Ca.emit(ze("cxtdragover")))}else if(ce&&Y.touches[2]&&ge.boxSelectionEnabled())Y.preventDefault(),t.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,t.touchData.selecting||ge.emit(ze("boxstart")),t.touchData.selecting=!0,t.touchData.didSelect=!0,me[4]=1,!me||me.length===0||me[0]===void 0?(me[0]=(Ee[0]+Ee[2]+Ee[4])/3,me[1]=(Ee[1]+Ee[3]+Ee[5])/3,me[2]=(Ee[0]+Ee[2]+Ee[4])/3+1,me[3]=(Ee[1]+Ee[3]+Ee[5])/3+1):(me[2]=(Ee[0]+Ee[2]+Ee[4])/3,me[3]=(Ee[1]+Ee[3]+Ee[5])/3),t.redrawHint("select",!0),t.redraw();else if(ce&&Y.touches[1]&&!t.touchData.didSelect&&ge.zoomingEnabled()&&ge.panningEnabled()&&ge.userZoomingEnabled()&&ge.userPanningEnabled()){Y.preventDefault(),t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var Na=t.dragData.touchDragEles;if(Na){t.redrawHint("drag",!0);for(var Ga=0;Ga<Na.length;Ga++){var ai=Na[Ga]._private;ai.grabbed=!1,ai.rscratch.inDragLayer=!1}}var ja=t.touchData.start,Kt=Y.touches[0].clientX-ae,ia=Y.touches[0].clientY-re,Wt=Y.touches[1].clientX-ae,sa=Y.touches[1].clientY-re,ul=Ae(Kt,ia,Wt,sa),ri=ul/ee;if(Ne){var ni=Kt-G,vs=ia-X,ii=Wt-W,da=sa-$,Rc=(ni+ii)/2,kc=(vs+da)/2,xr=ge.zoom(),ln=xr*ri,cl=ge.pan(),Uo=oe[0]*xr+cl.x,qo=oe[1]*xr+cl.y,xh={x:-ln/xr*(Uo-cl.x-Rc)+Uo,y:-ln/xr*(qo-cl.y-kc)+qo};if(ja&&ja.active()){var Na=t.dragData.touchDragEles;T(Na),t.redrawHint("drag",!0),t.redrawHint("eles",!0),ja.unactivate().emit(ze("freeon")),Na.emit(ze("free")),t.dragData.didDrag&&(ja.emit(ze("dragfreeon")),Na.emit(ze("dragfree")))}ge.viewport({zoom:ln,pan:xh,cancelOnFailedZoom:!0}),ge.emit(ze("pinchzoom")),ee=ul,G=Kt,X=ia,W=Wt,$=sa,t.pinching=!0}if(Y.touches[0]){var Fe=t.projectIntoViewport(Y.touches[0].clientX,Y.touches[0].clientY);Ee[0]=Fe[0],Ee[1]=Fe[1]}if(Y.touches[1]){var Fe=t.projectIntoViewport(Y.touches[1].clientX,Y.touches[1].clientY);Ee[2]=Fe[0],Ee[3]=Fe[1]}if(Y.touches[2]){var Fe=t.projectIntoViewport(Y.touches[2].clientX,Y.touches[2].clientY);Ee[4]=Fe[0],Ee[5]=Fe[1]}}else if(Y.touches[0]&&!t.touchData.didSelect){var Qa=t.touchData.start,si=t.touchData.last,Ca;if(!t.hoverData.draggingEles&&!t.swipePanning&&(Ca=t.findNearestElement(Ee[0],Ee[1],!0,!0)),ce&&Qa!=null&&Y.preventDefault(),ce&&Qa!=null&&t.nodeIsDraggable(Qa))if(it){var Na=t.dragData.touchDragEles,kr=!t.dragData.didDrag;kr&&E(Na,{inDragLayer:!0}),t.dragData.didDrag=!0;var Aa={x:0,y:0};if(Oe(st[0])&&Oe(st[1])&&(Aa.x+=st[0],Aa.y+=st[1],kr)){t.redrawHint("eles",!0);var lr=t.touchData.dragDelta;lr&&Oe(lr[0])&&Oe(lr[1])&&(Aa.x+=lr[0],Aa.y+=lr[1])}t.hoverData.draggingEles=!0,Na.silentShift(Aa).emit(ze("position")).emit(ze("drag")),t.redrawHint("drag",!0),t.touchData.startPosition[0]==Pe[0]&&t.touchData.startPosition[1]==Pe[1]&&t.redrawHint("eles",!0),t.redraw()}else{var lr=t.touchData.dragDelta=t.touchData.dragDelta||[];lr.length===0?(lr.push(st[0]),lr.push(st[1])):(lr[0]+=st[0],lr[1]+=st[1])}if(i(Qa||Ca,["touchmove","tapdrag","vmousemove"],Y,{x:Ee[0],y:Ee[1]}),(!Qa||!Qa.grabbed())&&Ca!=si&&(si&&si.emit(ze("tapdragout")),Ca&&Ca.emit(ze("tapdragover"))),t.touchData.last=Ca,ce)for(var Ga=0;Ga<Ee.length;Ga++)Ee[Ga]&&t.touchData.startPosition[Ga]&&it&&(t.touchData.singleTouchMoved=!0);if(ce&&(Qa==null||Qa.pannable())&&ge.panningEnabled()&&ge.userPanningEnabled()){var bh=o(Qa,t.touchData.starts);bh&&(Y.preventDefault(),t.data.bgActivePosistion||(t.data.bgActivePosistion=eo(t.touchData.startPosition)),t.swipePanning?(ge.panBy({x:st[0]*je,y:st[1]*je}),ge.emit(ze("dragpan"))):it&&(t.swipePanning=!0,ge.panBy({x:dt*je,y:Yt*je}),ge.emit(ze("dragpan")),Qa&&(Qa.unactivate(),t.redrawHint("select",!0),t.touchData.start=null)));var Fe=t.projectIntoViewport(Y.touches[0].clientX,Y.touches[0].clientY);Ee[0]=Fe[0],Ee[1]=Fe[1]}}for(var Ie=0;Ie<Ee.length;Ie++)Pe[Ie]=Ee[Ie];ce&&Y.touches.length>0&&!t.hoverData.draggingEles&&!t.swipePanning&&t.data.bgActivePosistion!=null&&(t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.redraw())}},!1);var ke;t.registerBinding(e,"touchcancel",ke=function(Y){var ce=t.touchData.start;t.touchData.capture=!1,ce&&ce.unactivate()});var De,Be,Ge,Je;if(t.registerBinding(e,"touchend",De=function(Y){var ce=t.touchData.start,me=t.touchData.capture;if(me)Y.touches.length===0&&(t.touchData.capture=!1),Y.preventDefault();else return;var ge=t.selection;t.swipePanning=!1,t.hoverData.draggingEles=!1;var Ee=t.cy,Pe=Ee.zoom(),je=t.touchData.now,Fe=t.touchData.earlier;if(Y.touches[0]){var ze=t.projectIntoViewport(Y.touches[0].clientX,Y.touches[0].clientY);je[0]=ze[0],je[1]=ze[1]}if(Y.touches[1]){var ze=t.projectIntoViewport(Y.touches[1].clientX,Y.touches[1].clientY);je[2]=ze[0],je[3]=ze[1]}if(Y.touches[2]){var ze=t.projectIntoViewport(Y.touches[2].clientX,Y.touches[2].clientY);je[4]=ze[0],je[5]=ze[1]}var $e=function(Ta){return{originalEvent:Y,type:Ta,position:{x:je[0],y:je[1]}}};ce&&ce.unactivate();var it;if(t.touchData.cxt){if(it=$e("cxttapend"),ce?ce.emit(it):Ee.emit(it),!t.touchData.cxtDragged){var st=$e("cxttap");ce?ce.emit(st):Ee.emit(st)}t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!1,t.touchData.start=null,t.redraw();return}if(!Y.touches[2]&&Ee.boxSelectionEnabled()&&t.touchData.selecting){t.touchData.selecting=!1;var Ie=Ee.collection(t.getAllInBox(ge[0],ge[1],ge[2],ge[3]));ge[0]=void 0,ge[1]=void 0,ge[2]=void 0,ge[3]=void 0,ge[4]=0,t.redrawHint("select",!0),Ee.emit($e("boxend"));var dt=function(Ta){return Ta.selectable()&&!Ta.selected()};Ie.emit($e("box")).stdFilter(dt).select().emit($e("boxselect")),Ie.nonempty()&&t.redrawHint("eles",!0),t.redraw()}if(ce!=null&&ce.unactivate(),Y.touches[2])t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);else if(!Y.touches[1]){if(!Y.touches[0]){if(!Y.touches[0]){t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var ut=t.dragData.touchDragEles;if(ce!=null){var Yt=ce._private.grabbed;T(ut),t.redrawHint("drag",!0),t.redrawHint("eles",!0),Yt&&(ce.emit($e("freeon")),ut.emit($e("free")),t.dragData.didDrag&&(ce.emit($e("dragfreeon")),ut.emit($e("dragfree")))),i(ce,["touchend","tapend","vmouseup","tapdragout"],Y,{x:je[0],y:je[1]}),ce.unactivate(),t.touchData.start=null}else{var Rt=t.findNearestElement(je[0],je[1],!0,!0);i(Rt,["touchend","tapend","vmouseup","tapdragout"],Y,{x:je[0],y:je[1]})}var Ba=t.touchData.startPosition[0]-je[0],Kt=Ba*Ba,ia=t.touchData.startPosition[1]-je[1],Wt=ia*ia,sa=Kt+Wt,Or=sa*Pe*Pe;t.touchData.singleTouchMoved||(ce||Ee.$(":selected").unselect(["tapunselect"]),i(ce,["tap","vclick"],Y,{x:je[0],y:je[1]}),Be=!1,Y.timeStamp-Je<=Ee.multiClickDebounceTime()?(Ge&&clearTimeout(Ge),Be=!0,Je=null,i(ce,["dbltap","vdblclick"],Y,{x:je[0],y:je[1]})):(Ge=setTimeout(function(){Be||i(ce,["onetap","voneclick"],Y,{x:je[0],y:je[1]})},Ee.multiClickDebounceTime()),Je=Y.timeStamp)),ce!=null&&!t.dragData.didDrag&&ce._private.selectable&&Or<t.touchTapThreshold2&&!t.pinching&&(Ee.selectionType()==="single"?(Ee.$(a).unmerge(ce).unselect(["tapunselect"]),ce.select(["tapselect"])):ce.selected()?ce.unselect(["tapunselect"]):ce.select(["tapselect"]),t.redrawHint("eles",!0)),t.touchData.singleTouchMoved=!0}}}for(var $t=0;$t<je.length;$t++)Fe[$t]=je[$t];t.dragData.didDrag=!1,Y.touches.length===0&&(t.touchData.dragDelta=[],t.touchData.startPosition=[null,null,null,null,null,null],t.touchData.startGPosition=null,t.touchData.didSelect=!1),Y.touches.length<2&&(Y.touches.length===1&&(t.touchData.startGPosition=[Y.touches[0].clientX,Y.touches[0].clientY]),t.pinching=!1,t.redrawHint("eles",!0),t.redraw())},!1),typeof TouchEvent>"u"){var Re=[],nt=function(Y){return{clientX:Y.clientX,clientY:Y.clientY,force:1,identifier:Y.pointerId,pageX:Y.pageX,pageY:Y.pageY,radiusX:Y.width/2,radiusY:Y.height/2,screenX:Y.screenX,screenY:Y.screenY,target:Y.target}},xe=function(Y){return{event:Y,touch:nt(Y)}},pe=function(Y){Re.push(xe(Y))},Ye=function(Y){for(var ce=0;ce<Re.length;ce++){var me=Re[ce];if(me.event.pointerId===Y.pointerId){Re.splice(ce,1);return}}},tt=function(Y){var ce=Re.filter(function(me){return me.event.pointerId===Y.pointerId})[0];ce.event=Y,ce.touch=nt(Y)},Ke=function(Y){Y.touches=Re.map(function(ce){return ce.touch})},Ue=function(Y){return Y.pointerType==="mouse"||Y.pointerType===4};t.registerBinding(t.container,"pointerdown",function(we){Ue(we)||(we.preventDefault(),pe(we),Ke(we),He(we))}),t.registerBinding(t.container,"pointerup",function(we){Ue(we)||(Ye(we),Ke(we),De(we))}),t.registerBinding(t.container,"pointercancel",function(we){Ue(we)||(Ye(we),Ke(we),ke(we))}),t.registerBinding(t.container,"pointermove",function(we){Ue(we)||(we.preventDefault(),tt(we),Ke(we),Se(we))})}};var ei={};ei.generatePolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,draw:function(r,i,s,o,u,d){this.renderer.nodeShapeImpl("polygon",r,i,s,o,u,this.points)},intersectLine:function(r,i,s,o,u,d,f,h){return ec(u,d,this.points,r,i,s/2,o/2,f)},checkPoint:function(r,i,s,o,u,d,f,h){return Wn(r,i,this.points,d,f,o,u,[0,-1],s)},hasMiterBounds:t!=="rectangle",miterBounds:function(r,i,s,o,u,d){return fR(this.points,r,i,s,o,u)}}};ei.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,a,r,i,s,o){this.renderer.nodeShapeImpl(this.name,e,a,r,i,s)},intersectLine:function(e,a,r,i,s,o,u,d){return bR(s,o,e,a,r/2+u,i/2+u)},checkPoint:function(e,a,r,i,s,o,u,d){return Us(e,a,i,s,o,u,r)}}};ei.generateRoundPolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,getOrCreateCorners:function(r,i,s,o,u,d,f){if(d[f]!==void 0&&d[f+"-cx"]===r&&d[f+"-cy"]===i)return d[f];d[f]=new Array(e.length/2),d[f+"-cx"]=r,d[f+"-cy"]=i;var h=s/2,p=o/2;u=u==="auto"?nC(s,o):u;for(var m=new Array(e.length/2),y=0;y<e.length/2;y++)m[y]={x:r+h*e[y*2],y:i+p*e[y*2+1]};var x,E,S,T,C=m.length;for(E=m[C-1],x=0;x<C;x++)S=m[x%C],T=m[(x+1)%C],d[f][x]=ay(E,S,T,u),E=S,S=T;return d[f]},draw:function(r,i,s,o,u,d,f){this.renderer.nodeShapeImpl("round-polygon",r,i,s,o,u,this.points,this.getOrCreateCorners(i,s,o,u,d,f,"drawCorners"))},intersectLine:function(r,i,s,o,u,d,f,h,p){return SR(u,d,this.points,r,i,s,o,f,this.getOrCreateCorners(r,i,s,o,h,p,"corners"))},checkPoint:function(r,i,s,o,u,d,f,h,p){return xR(r,i,this.points,d,f,o,u,this.getOrCreateCorners(d,f,o,u,h,p,"corners"))}}};ei.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:ar(4,0),draw:function(e,a,r,i,s,o){this.renderer.nodeShapeImpl(this.name,e,a,r,i,s,this.points,o)},intersectLine:function(e,a,r,i,s,o,u,d){return aC(s,o,e,a,r,i,u,d)},checkPoint:function(e,a,r,i,s,o,u,d){var f=i/2,h=s/2;d=d==="auto"?as(i,s):d,d=Math.min(f,h,d);var p=d*2;return!!(Wn(e,a,this.points,o,u,i,s-p,[0,-1],r)||Wn(e,a,this.points,o,u,i-p,s,[0,-1],r)||Us(e,a,p,p,o-f+d,u-h+d,r)||Us(e,a,p,p,o+f-d,u-h+d,r)||Us(e,a,p,p,o+f-d,u+h-d,r)||Us(e,a,p,p,o-f+d,u+h-d,r))}}};ei.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:G0(),points:ar(4,0),draw:function(e,a,r,i,s,o){this.renderer.nodeShapeImpl(this.name,e,a,r,i,s,null,o)},generateCutTrianglePts:function(e,a,r,i,s){var o=s==="auto"?this.cornerLength:s,u=a/2,d=e/2,f=r-d,h=r+d,p=i-u,m=i+u;return{topLeft:[f,p+o,f+o,p,f+o,p+o],topRight:[h-o,p,h,p+o,h-o,p+o],bottomRight:[h,m-o,h-o,m,h-o,m-o],bottomLeft:[f+o,m,f,m-o,f+o,m-o]}},intersectLine:function(e,a,r,i,s,o,u,d){var f=this.generateCutTrianglePts(r+2*u,i+2*u,e,a,d),h=[].concat.apply([],[f.topLeft.splice(0,4),f.topRight.splice(0,4),f.bottomRight.splice(0,4),f.bottomLeft.splice(0,4)]);return ec(s,o,h,e,a)},checkPoint:function(e,a,r,i,s,o,u,d){var f=d==="auto"?this.cornerLength:d;if(Wn(e,a,this.points,o,u,i,s-2*f,[0,-1],r)||Wn(e,a,this.points,o,u,i-2*f,s,[0,-1],r))return!0;var h=this.generateCutTrianglePts(i,s,o,u);return mr(e,a,h.topLeft)||mr(e,a,h.topRight)||mr(e,a,h.bottomRight)||mr(e,a,h.bottomLeft)}}};ei.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:ar(4,0),draw:function(e,a,r,i,s,o){this.renderer.nodeShapeImpl(this.name,e,a,r,i,s)},intersectLine:function(e,a,r,i,s,o,u,d){var f=.15,h=.5,p=.85,m=this.generateBarrelBezierPts(r+2*u,i+2*u,e,a),y=function(S){var T=io({x:S[0],y:S[1]},{x:S[2],y:S[3]},{x:S[4],y:S[5]},f),C=io({x:S[0],y:S[1]},{x:S[2],y:S[3]},{x:S[4],y:S[5]},h),N=io({x:S[0],y:S[1]},{x:S[2],y:S[3]},{x:S[4],y:S[5]},p);return[S[0],S[1],T.x,T.y,C.x,C.y,N.x,N.y,S[4],S[5]]},x=[].concat(y(m.topLeft),y(m.topRight),y(m.bottomRight),y(m.bottomLeft));return ec(s,o,x,e,a)},generateBarrelBezierPts:function(e,a,r,i){var s=a/2,o=e/2,u=r-o,d=r+o,f=i-s,h=i+s,p=Km(e,a),m=p.heightOffset,y=p.widthOffset,x=p.ctrlPtOffsetPct*e,E={topLeft:[u,f+m,u+x,f,u+y,f],topRight:[d-y,f,d-x,f,d,f+m],bottomRight:[d,h-m,d-x,h,d-y,h],bottomLeft:[u+y,h,u+x,h,u,h-m]};return E.topLeft.isTop=!0,E.topRight.isTop=!0,E.bottomLeft.isBottom=!0,E.bottomRight.isBottom=!0,E},checkPoint:function(e,a,r,i,s,o,u,d){var f=Km(i,s),h=f.heightOffset,p=f.widthOffset;if(Wn(e,a,this.points,o,u,i,s-2*h,[0,-1],r)||Wn(e,a,this.points,o,u,i-2*p,s,[0,-1],r))return!0;for(var m=this.generateBarrelBezierPts(i,s,o,u),y=function(R,L,z){var _=z[4],B=z[2],q=z[0],V=z[5],Q=z[1],P=Math.min(_,q),U=Math.max(_,q),F=Math.min(V,Q),K=Math.max(V,Q);if(P<=R&&R<=U&&F<=L&&L<=K){var J=ER(_,B,q),k=pR(J[0],J[1],J[2],R),G=k.filter(function(X){return 0<=X&&X<=1});if(G.length>0)return G[0]}return null},x=Object.keys(m),E=0;E<x.length;E++){var S=x[E],T=m[S],C=y(e,a,T);if(C!=null){var N=T[5],A=T[3],M=T[1],D=Oa(N,A,M,C);if(T.isTop&&D<=a||T.isBottom&&a<=D)return!0}}return!1}}};ei.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:ar(4,0),draw:function(e,a,r,i,s,o){this.renderer.nodeShapeImpl(this.name,e,a,r,i,s,this.points,o)},intersectLine:function(e,a,r,i,s,o,u,d){var f=e-(r/2+u),h=a-(i/2+u),p=h,m=e+(r/2+u),y=Ki(s,o,e,a,f,h,m,p,!1);return y.length>0?y:aC(s,o,e,a,r,i,u,d)},checkPoint:function(e,a,r,i,s,o,u,d){d=d==="auto"?as(i,s):d;var f=2*d;if(Wn(e,a,this.points,o,u,i,s-f,[0,-1],r)||Wn(e,a,this.points,o,u,i-f,s,[0,-1],r))return!0;var h=i/2+2*r,p=s/2+2*r,m=[o-h,u-p,o-h,u,o+h,u,o+h,u-p];return!!(mr(e,a,m)||Us(e,a,f,f,o+i/2-d,u+s/2-d,r)||Us(e,a,f,f,o-i/2+d,u+s/2-d,r))}}};ei.registerNodeShapes=function(){var t=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",ar(3,0)),this.generateRoundPolygon("round-triangle",ar(3,0)),this.generatePolygon("rectangle",ar(4,0)),t.square=t.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var a=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",a),this.generateRoundPolygon("round-diamond",a)}this.generatePolygon("pentagon",ar(5,0)),this.generateRoundPolygon("round-pentagon",ar(5,0)),this.generatePolygon("hexagon",ar(6,0)),this.generateRoundPolygon("round-hexagon",ar(6,0)),this.generatePolygon("heptagon",ar(7,0)),this.generateRoundPolygon("round-heptagon",ar(7,0)),this.generatePolygon("octagon",ar(8,0)),this.generateRoundPolygon("round-octagon",ar(8,0));var r=new Array(20);{var i=Ym(5,0),s=Ym(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var u=0;u<s.length/2;u++)s[u*2]*=o,s[u*2+1]*=o;for(var u=0;u<20/4;u++)r[u*4]=i[u*2],r[u*4+1]=i[u*2+1],r[u*4+2]=s[u*2],r[u*4+3]=s[u*2+1]}r=rC(r),this.generatePolygon("star",r),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon("right-rhomboid",[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);{var d=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",d),this.generateRoundPolygon("round-tag",d)}t.makePolygon=function(f){var h=f.join("$"),p="polygon-"+h,m;return(m=this[p])?m:e.generatePolygon(p,f)}};var Dc={};Dc.timeToRender=function(){return this.redrawTotalTime/this.redrawCount};Dc.redraw=function(t){t=t||WT();var e=this;e.averageRedrawTime===void 0&&(e.averageRedrawTime=0),e.lastRedrawTime===void 0&&(e.lastRedrawTime=0),e.lastDrawTime===void 0&&(e.lastDrawTime=0),e.requestedFrame=!0,e.renderOptions=t};Dc.beforeRender=function(t,e){if(!this.destroyed){e==null&&Qt("Priority is not optional for beforeRender");var a=this.beforeRenderCallbacks;a.push({fn:t,priority:e}),a.sort(function(r,i){return i.priority-r.priority})}};var GS=function(e,a,r){for(var i=e.beforeRenderCallbacks,s=0;s<i.length;s++)i[s].fn(a,r)};Dc.startRenderLoop=function(){var t=this,e=t.cy;if(!t.renderLoopStarted){t.renderLoopStarted=!0;var a=function(i){if(!t.destroyed){if(!e.batching())if(t.requestedFrame&&!t.skipFrame){GS(t,!0,i);var s=Zn();t.render(t.renderOptions);var o=t.lastDrawTime=Zn();t.averageRedrawTime===void 0&&(t.averageRedrawTime=o-s),t.redrawCount===void 0&&(t.redrawCount=0),t.redrawCount++,t.redrawTotalTime===void 0&&(t.redrawTotalTime=0);var u=o-s;t.redrawTotalTime+=u,t.lastRedrawTime=u,t.averageRedrawTime=t.averageRedrawTime/2+u/2,t.requestedFrame=!1}else GS(t,!1,i);t.skipFrame=!1,zf(a)}};zf(a)}};var UB=function(e){this.init(e)},nN=UB,_o=nN.prototype;_o.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"];_o.init=function(t){var e=this;e.options=t,e.cy=t.cy;var a=e.container=t.cy.container(),r=e.cy.window();if(r){var i=r.document,s=i.head,o="__________cytoscape_stylesheet",u="__________cytoscape_container",d=i.getElementById(o)!=null;if(a.className.indexOf(u)<0&&(a.className=(a.className||"")+" "+u),!d){var f=i.createElement("style");f.id=o,f.textContent="."+u+" { position: relative; }",s.insertBefore(f,s.children[0])}var h=r.getComputedStyle(a),p=h.getPropertyValue("position");p==="static"&&At("A Cytoscape container has style position:static and so can not use UI extensions properly")}e.selection=[void 0,void 0,void 0,void 0,0],e.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],e.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},e.dragData={possibleDragElements:[]},e.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},e.redraws=0,e.showFps=t.showFps,e.debug=t.debug,e.webgl=t.webgl,e.hideEdgesOnViewport=t.hideEdgesOnViewport,e.textureOnViewport=t.textureOnViewport,e.wheelSensitivity=t.wheelSensitivity,e.motionBlurEnabled=t.motionBlur,e.forcedPixelRatio=Oe(t.pixelRatio)?t.pixelRatio:null,e.motionBlur=t.motionBlur,e.motionBlurOpacity=t.motionBlurOpacity,e.motionBlurTransparency=1-e.motionBlurOpacity,e.motionBlurPxRatio=1,e.mbPxRBlurry=1,e.minMbLowQualFrames=4,e.fullQualityMb=!1,e.clearedForMotionBlur=[],e.desktopTapThreshold=t.desktopTapThreshold,e.desktopTapThreshold2=t.desktopTapThreshold*t.desktopTapThreshold,e.touchTapThreshold=t.touchTapThreshold,e.touchTapThreshold2=t.touchTapThreshold*t.touchTapThreshold,e.tapholdDuration=500,e.bindings=[],e.beforeRenderCallbacks=[],e.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},e.registerNodeShapes(),e.registerArrowShapes(),e.registerCalculationListeners()};_o.notify=function(t,e){var a=this,r=a.cy;if(!this.destroyed){if(t==="init"){a.load();return}if(t==="destroy"){a.destroy();return}(t==="add"||t==="remove"||t==="move"&&r.hasCompoundNodes()||t==="load"||t==="zorder"||t==="mount")&&a.invalidateCachedZSortedEles(),t==="viewport"&&a.redrawHint("select",!0),t==="gc"&&a.redrawHint("gc",!0),(t==="load"||t==="resize"||t==="mount")&&(a.invalidateContainerClientCoordsCache(),a.matchCanvasSize(a.container)),a.redrawHint("eles",!0),a.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}};_o.destroy=function(){var t=this;t.destroyed=!0,t.cy.stopAnimationLoop();for(var e=0;e<t.bindings.length;e++){var a=t.bindings[e],r=a,i=r.target;(i.off||i.removeEventListener).apply(i,r.args)}if(t.bindings=[],t.beforeRenderCallbacks=[],t.onUpdateEleCalcsFns=[],t.removeObserver&&t.removeObserver.disconnect(),t.styleObserver&&t.styleObserver.disconnect(),t.resizeObserver&&t.resizeObserver.disconnect(),t.labelCalcDiv)try{document.body.removeChild(t.labelCalcDiv)}catch{}};_o.isHeadless=function(){return!1};[ty,aN,rN,Po,ei,Dc].forEach(function(t){et(_o,t)});var um=1e3/60,iN={setupDequeueing:function(e){return function(){var r=this,i=this.renderer;if(!r.dequeueingSetup){r.dequeueingSetup=!0;var s=Cc(function(){i.redrawHint("eles",!0),i.redrawHint("drag",!0),i.redraw()},e.deqRedrawThreshold),o=function(f,h){var p=Zn(),m=i.averageRedrawTime,y=i.lastRedrawTime,x=[],E=i.cy.extent(),S=i.getPixelRatio();for(f||i.flushRenderedStyleQueue();;){var T=Zn(),C=T-p,N=T-h;if(y<um){var A=um-(f?m:0);if(N>=e.deqFastCost*A)break}else if(f){if(C>=e.deqCost*y||C>=e.deqAvgCost*m)break}else if(N>=e.deqNoDrawCost*um)break;var M=e.deq(r,S,E);if(M.length>0)for(var D=0;D<M.length;D++)x.push(M[D]);else break}x.length>0&&(e.onDeqd(r,x),!f&&e.shouldRedraw(r,x,S,E)&&s())},u=e.priority||q0;i.beforeRender(o,u(r))}}}},qB=(function(){function t(e){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Pf;us(this,t),this.idsByKey=new Kn,this.keyForId=new Kn,this.cachesByLvl=new Kn,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=a}return cs(t,[{key:"getIdsFor",value:function(a){a==null&&Qt("Can not get id list for null key");var r=this.idsByKey,i=this.idsByKey.get(a);return i||(i=new ko,r.set(a,i)),i}},{key:"addIdForKey",value:function(a,r){a!=null&&this.getIdsFor(a).add(r)}},{key:"deleteIdForKey",value:function(a,r){a!=null&&this.getIdsFor(a).delete(r)}},{key:"getNumberOfIdsForKey",value:function(a){return a==null?0:this.getIdsFor(a).size}},{key:"updateKeyMappingFor",value:function(a){var r=a.id(),i=this.keyForId.get(r),s=this.getKey(a);this.deleteIdForKey(i,r),this.addIdForKey(s,r),this.keyForId.set(r,s)}},{key:"deleteKeyMappingFor",value:function(a){var r=a.id(),i=this.keyForId.get(r);this.deleteIdForKey(i,r),this.keyForId.delete(r)}},{key:"keyHasChangedFor",value:function(a){var r=a.id(),i=this.keyForId.get(r),s=this.getKey(a);return i!==s}},{key:"isInvalid",value:function(a){return this.keyHasChangedFor(a)||this.doesEleInvalidateKey(a)}},{key:"getCachesAt",value:function(a){var r=this.cachesByLvl,i=this.lvls,s=r.get(a);return s||(s=new Kn,r.set(a,s),i.push(a)),s}},{key:"getCache",value:function(a,r){return this.getCachesAt(r).get(a)}},{key:"get",value:function(a,r){var i=this.getKey(a),s=this.getCache(i,r);return s!=null&&this.updateKeyMappingFor(a),s}},{key:"getForCachedKey",value:function(a,r){var i=this.keyForId.get(a.id()),s=this.getCache(i,r);return s}},{key:"hasCache",value:function(a,r){return this.getCachesAt(r).has(a)}},{key:"has",value:function(a,r){var i=this.getKey(a);return this.hasCache(i,r)}},{key:"setCache",value:function(a,r,i){i.key=a,this.getCachesAt(r).set(a,i)}},{key:"set",value:function(a,r,i){var s=this.getKey(a);this.setCache(s,r,i),this.updateKeyMappingFor(a)}},{key:"deleteCache",value:function(a,r){this.getCachesAt(r).delete(a)}},{key:"delete",value:function(a,r){var i=this.getKey(a);this.deleteCache(i,r)}},{key:"invalidateKey",value:function(a){var r=this;this.lvls.forEach(function(i){return r.deleteCache(a,i)})}},{key:"invalidate",value:function(a){var r=a.id(),i=this.keyForId.get(r);this.deleteKeyMappingFor(a);var s=this.doesEleInvalidateKey(a);return s&&this.invalidateKey(i),s||this.getNumberOfIdsForKey(i)===0}}])})(),QS=25,uf=50,Cf=-4,l0=3,sN=7.99,IB=8,VB=1024,FB=1024,HB=1024,GB=.2,QB=.8,YB=10,KB=.15,$B=.1,XB=.9,ZB=.9,WB=100,JB=1,ao={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},eL=Fa({getKey:null,doesEleInvalidateKey:Pf,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:$T,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),Iu=function(e,a){var r=this;r.renderer=e,r.onDequeues=[];var i=eL(a);et(r,i),r.lookup=new qB(i.getKey,i.doesEleInvalidateKey),r.setupDequeueing()},Ea=Iu.prototype;Ea.reasons=ao;Ea.getTextureQueue=function(t){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[t]=e.eleImgCaches[t]||[]};Ea.getRetiredTextureQueue=function(t){var e=this,a=e.eleImgCaches.retired=e.eleImgCaches.retired||{},r=a[t]=a[t]||[];return r};Ea.getElementQueue=function(){var t=this,e=t.eleCacheQueue=t.eleCacheQueue||new Nc(function(a,r){return r.reqs-a.reqs});return e};Ea.getElementKeyToQueue=function(){var t=this,e=t.eleKeyToCacheQueue=t.eleKeyToCacheQueue||{};return e};Ea.getElement=function(t,e,a,r,i){var s=this,o=this.renderer,u=o.cy.zoom(),d=this.lookup;if(!e||e.w===0||e.h===0||isNaN(e.w)||isNaN(e.h)||!t.visible()||t.removed()||!s.allowEdgeTxrCaching&&t.isEdge()||!s.allowParentTxrCaching&&t.isParent())return null;if(r==null&&(r=Math.ceil(V0(u*a))),r<Cf)r=Cf;else if(u>=sN||r>l0)return null;var f=Math.pow(2,r),h=e.h*f,p=e.w*f,m=o.eleTextBiggerThanMin(t,f);if(!this.isVisible(t,m))return null;var y=d.get(t,r);if(y&&y.invalidated&&(y.invalidated=!1,y.texture.invalidatedWidth-=y.width),y)return y;var x;if(h<=QS?x=QS:h<=uf?x=uf:x=Math.ceil(h/uf)*uf,h>HB||p>FB)return null;var E=s.getTextureQueue(x),S=E[E.length-2],T=function(){return s.recycleTexture(x,p)||s.addTexture(x,p)};S||(S=E[E.length-1]),S||(S=T()),S.width-S.usedWidth<p&&(S=T());for(var C=function(P){return P&&P.scaledLabelShown===m},N=i&&i===ao.dequeue,A=i&&i===ao.highQuality,M=i&&i===ao.downscale,D,j=r+1;j<=l0;j++){var R=d.get(t,j);if(R){D=R;break}}var L=D&&D.level===r+1?D:null,z=function(){S.context.drawImage(L.texture.canvas,L.x,0,L.width,L.height,S.usedWidth,0,p,h)};if(S.context.setTransform(1,0,0,1,0,0),S.context.clearRect(S.usedWidth,0,p,x),C(L))z();else if(C(D))if(A){for(var _=D.level;_>r;_--)L=s.getElement(t,e,a,_,ao.downscale);z()}else return s.queueElement(t,D.level-1),D;else{var B;if(!N&&!A&&!M)for(var q=r-1;q>=Cf;q--){var V=d.get(t,q);if(V){B=V;break}}if(C(B))return s.queueElement(t,r),B;S.context.translate(S.usedWidth,0),S.context.scale(f,f),this.drawElement(S.context,t,e,m,!1),S.context.scale(1/f,1/f),S.context.translate(-S.usedWidth,0)}return y={x:S.usedWidth,texture:S,level:r,scale:f,width:p,height:h,scaledLabelShown:m},S.usedWidth+=Math.ceil(p+IB),S.eleCaches.push(y),d.set(t,r,y),s.checkTextureFullness(S),y};Ea.invalidateElements=function(t){for(var e=0;e<t.length;e++)this.invalidateElement(t[e])};Ea.invalidateElement=function(t){var e=this,a=e.lookup,r=[],i=a.isInvalid(t);if(i){for(var s=Cf;s<=l0;s++){var o=a.getForCachedKey(t,s);o&&r.push(o)}var u=a.invalidate(t);if(u)for(var d=0;d<r.length;d++){var f=r[d],h=f.texture;h.invalidatedWidth+=f.width,f.invalidated=!0,e.checkTextureUtility(h)}e.removeFromQueue(t)}};Ea.checkTextureUtility=function(t){t.invalidatedWidth>=GB*t.width&&this.retireTexture(t)};Ea.checkTextureFullness=function(t){var e=this,a=e.getTextureQueue(t.height);t.usedWidth/t.width>QB&&t.fullnessChecks>=YB?ts(a,t):t.fullnessChecks++};Ea.retireTexture=function(t){var e=this,a=t.height,r=e.getTextureQueue(a),i=this.lookup;ts(r,t),t.retired=!0;for(var s=t.eleCaches,o=0;o<s.length;o++){var u=s[o];i.deleteCache(u.key,u.level)}I0(s);var d=e.getRetiredTextureQueue(a);d.push(t)};Ea.addTexture=function(t,e){var a=this,r=a.getTextureQueue(t),i={};return r.push(i),i.eleCaches=[],i.height=t,i.width=Math.max(VB,e),i.usedWidth=0,i.invalidatedWidth=0,i.fullnessChecks=0,i.canvas=a.renderer.makeOffscreenCanvas(i.width,i.height),i.context=i.canvas.getContext("2d"),i};Ea.recycleTexture=function(t,e){for(var a=this,r=a.getTextureQueue(t),i=a.getRetiredTextureQueue(t),s=0;s<i.length;s++){var o=i[s];if(o.width>=e)return o.retired=!1,o.usedWidth=0,o.invalidatedWidth=0,o.fullnessChecks=0,I0(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),ts(i,o),r.push(o),o}};Ea.queueElement=function(t,e){var a=this,r=a.getElementQueue(),i=a.getElementKeyToQueue(),s=this.getKey(t),o=i[s];if(o)o.level=Math.max(o.level,e),o.eles.merge(t),o.reqs++,r.updateItem(o);else{var u={eles:t.spawn().merge(t),level:e,reqs:1,key:s};r.push(u),i[s]=u}};Ea.dequeue=function(t){for(var e=this,a=e.getElementQueue(),r=e.getElementKeyToQueue(),i=[],s=e.lookup,o=0;o<JB&&a.size()>0;o++){var u=a.pop(),d=u.key,f=u.eles[0],h=s.hasCache(f,u.level);if(r[d]=null,h)continue;i.push(u);var p=e.getBoundingBox(f);e.getElement(f,p,t,u.level,ao.dequeue)}return i};Ea.removeFromQueue=function(t){var e=this,a=e.getElementQueue(),r=e.getElementKeyToQueue(),i=this.getKey(t),s=r[i];s!=null&&(s.eles.length===1?(s.reqs=U0,a.updateItem(s),a.pop(),r[i]=null):s.eles.unmerge(t))};Ea.onDequeue=function(t){this.onDequeues.push(t)};Ea.offDequeue=function(t){ts(this.onDequeues,t)};Ea.setupDequeueing=iN.setupDequeueing({deqRedrawThreshold:WB,deqCost:KB,deqAvgCost:$B,deqNoDrawCost:XB,deqFastCost:ZB,deq:function(e,a,r){return e.dequeue(a,r)},onDeqd:function(e,a){for(var r=0;r<e.onDequeues.length;r++){var i=e.onDequeues[r];i(a)}},shouldRedraw:function(e,a,r,i){for(var s=0;s<a.length;s++)for(var o=a[s].eles,u=0;u<o.length;u++){var d=o[u].boundingBox();if(H0(d,i))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var tL=1,Hu=-4,Gf=2,aL=3.99,rL=50,nL=50,iL=.15,sL=.1,lL=.9,oL=.9,uL=1,YS=250,cL=4e3*4e3,KS=32767,dL=!0,lN=function(e){var a=this,r=a.renderer=e,i=r.cy;a.layersByLevel={},a.firstGet=!0,a.lastInvalidationTime=Zn()-2*YS,a.skipping=!1,a.eleTxrDeqs=i.collection(),a.scheduleElementRefinement=Cc(function(){a.refineElementTextures(a.eleTxrDeqs),a.eleTxrDeqs.unmerge(a.eleTxrDeqs)},nL),r.beforeRender(function(o,u){u-a.lastInvalidationTime<=YS?a.skipping=!0:a.skipping=!1},r.beforeRenderPriorities.lyrTxrSkip);var s=function(u,d){return d.reqs-u.reqs};a.layersQueue=new Nc(s),a.setupDequeueing()},Ha=lN.prototype,$S=0,fL=Math.pow(2,53)-1;Ha.makeLayer=function(t,e){var a=Math.pow(2,e),r=Math.ceil(t.w*a),i=Math.ceil(t.h*a),s=this.renderer.makeOffscreenCanvas(r,i),o={id:$S=++$S%fL,bb:t,level:e,width:r,height:i,canvas:s,context:s.getContext("2d"),eles:[],elesQueue:[],reqs:0},u=o.context,d=-o.bb.x1,f=-o.bb.y1;return u.scale(a,a),u.translate(d,f),o};Ha.getLayers=function(t,e,a){var r=this,i=r.renderer,s=i.cy,o=s.zoom(),u=r.firstGet;if(r.firstGet=!1,a==null){if(a=Math.ceil(V0(o*e)),a<Hu)a=Hu;else if(o>=aL||a>Gf)return null}r.validateLayersElesOrdering(a,t);var d=r.layersByLevel,f=Math.pow(2,a),h=d[a]=d[a]||[],p,m=r.levelIsComplete(a,t),y,x=function(){var z=function(Q){if(r.validateLayersElesOrdering(Q,t),r.levelIsComplete(Q,t))return y=d[Q],!0},_=function(Q){if(!y)for(var P=a+Q;Hu<=P&&P<=Gf&&!z(P);P+=Q);};_(1),_(-1);for(var B=h.length-1;B>=0;B--){var q=h[B];q.invalid&&ts(h,q)}};if(!m)x();else return h;var E=function(){if(!p){p=nr();for(var z=0;z<t.length;z++)uR(p,t[z].boundingBox())}return p},S=function(z){z=z||{};var _=z.after;E();var B=Math.ceil(p.w*f),q=Math.ceil(p.h*f);if(B>KS||q>KS)return null;var V=B*q;if(V>cL)return null;var Q=r.makeLayer(p,a);if(_!=null){var P=h.indexOf(_)+1;h.splice(P,0,Q)}else(z.insert===void 0||z.insert)&&h.unshift(Q);return Q};if(r.skipping&&!u)return null;for(var T=null,C=t.length/tL,N=!u,A=0;A<t.length;A++){var M=t[A],D=M._private.rscratch,j=D.imgLayerCaches=D.imgLayerCaches||{},R=j[a];if(R){T=R;continue}if((!T||T.eles.length>=C||!tC(T.bb,M.boundingBox()))&&(T=S({insert:!0,after:T}),!T))return null;y||N?r.queueLayer(T,M):r.drawEleInLayer(T,M,a,e),T.eles.push(M),j[a]=T}return y||(N?null:h)};Ha.getEleLevelForLayerLevel=function(t,e){return t};Ha.drawEleInLayer=function(t,e,a,r){var i=this,s=this.renderer,o=t.context,u=e.boundingBox();u.w===0||u.h===0||!e.visible()||(a=i.getEleLevelForLayerLevel(a,r),s.setImgSmoothing(o,!1),s.drawCachedElement(o,e,null,null,a,dL),s.setImgSmoothing(o,!0))};Ha.levelIsComplete=function(t,e){var a=this,r=a.layersByLevel[t];if(!r||r.length===0)return!1;for(var i=0,s=0;s<r.length;s++){var o=r[s];if(o.reqs>0||o.invalid)return!1;i+=o.eles.length}return i===e.length};Ha.validateLayersElesOrdering=function(t,e){var a=this.layersByLevel[t];if(a)for(var r=0;r<a.length;r++){for(var i=a[r],s=-1,o=0;o<e.length;o++)if(i.eles[0]===e[o]){s=o;break}if(s<0){this.invalidateLayer(i);continue}for(var u=s,o=0;o<i.eles.length;o++)if(i.eles[o]!==e[u+o]){this.invalidateLayer(i);break}}};Ha.updateElementsInLayers=function(t,e){for(var a=this,r=wc(t[0]),i=0;i<t.length;i++)for(var s=r?null:t[i],o=r?t[i]:t[i].ele,u=o._private.rscratch,d=u.imgLayerCaches=u.imgLayerCaches||{},f=Hu;f<=Gf;f++){var h=d[f];h&&(s&&a.getEleLevelForLayerLevel(h.level)!==s.level||e(h,o,s))}};Ha.haveLayers=function(){for(var t=this,e=!1,a=Hu;a<=Gf;a++){var r=t.layersByLevel[a];if(r&&r.length>0){e=!0;break}}return e};Ha.invalidateElements=function(t){var e=this;t.length!==0&&(e.lastInvalidationTime=Zn(),!(t.length===0||!e.haveLayers())&&e.updateElementsInLayers(t,function(r,i,s){e.invalidateLayer(r)}))};Ha.invalidateLayer=function(t){if(this.lastInvalidationTime=Zn(),!t.invalid){var e=t.level,a=t.eles,r=this.layersByLevel[e];ts(r,t),t.elesQueue=[],t.invalid=!0,t.replacement&&(t.replacement.invalid=!0);for(var i=0;i<a.length;i++){var s=a[i]._private.rscratch.imgLayerCaches;s&&(s[e]=null)}}};Ha.refineElementTextures=function(t){var e=this;e.updateElementsInLayers(t,function(r,i,s){var o=r.replacement;if(o||(o=r.replacement=e.makeLayer(r.bb,r.level),o.replaces=r,o.eles=r.eles),!o.reqs)for(var u=0;u<o.eles.length;u++)e.queueLayer(o,o.eles[u])})};Ha.enqueueElementRefinement=function(t){this.eleTxrDeqs.merge(t),this.scheduleElementRefinement()};Ha.queueLayer=function(t,e){var a=this,r=a.layersQueue,i=t.elesQueue,s=i.hasId=i.hasId||{};if(!t.replacement){if(e){if(s[e.id()])return;i.push(e),s[e.id()]=!0}t.reqs?(t.reqs++,r.updateItem(t)):(t.reqs=1,r.push(t))}};Ha.dequeue=function(t){for(var e=this,a=e.layersQueue,r=[],i=0;i<uL&&a.size()!==0;){var s=a.peek();if(s.replacement){a.pop();continue}if(s.replaces&&s!==s.replaces.replacement){a.pop();continue}if(s.invalid){a.pop();continue}var o=s.elesQueue.shift();o&&(e.drawEleInLayer(s,o,s.level,t),i++),r.length===0&&r.push(!0),s.elesQueue.length===0&&(a.pop(),s.reqs=0,s.replaces&&e.applyLayerReplacement(s),e.requestRedraw())}return r};Ha.applyLayerReplacement=function(t){var e=this,a=e.layersByLevel[t.level],r=t.replaces,i=a.indexOf(r);if(!(i<0||r.invalid)){a[i]=t;for(var s=0;s<t.eles.length;s++){var o=t.eles[s]._private,u=o.imgLayerCaches=o.imgLayerCaches||{};u&&(u[t.level]=t)}e.requestRedraw()}};Ha.requestRedraw=Cc(function(){var t=this.renderer;t.redrawHint("eles",!0),t.redrawHint("drag",!0),t.redraw()},100);Ha.setupDequeueing=iN.setupDequeueing({deqRedrawThreshold:rL,deqCost:iL,deqAvgCost:sL,deqNoDrawCost:lL,deqFastCost:oL,deq:function(e,a){return e.dequeue(a)},onDeqd:q0,shouldRedraw:$T,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var oN={},XS;function hL(t,e){for(var a=0;a<e.length;a++){var r=e[a];t.lineTo(r.x,r.y)}}function vL(t,e,a){for(var r,i=0;i<e.length;i++){var s=e[i];i===0&&(r=s),t.lineTo(s.x,s.y)}t.quadraticCurveTo(a.x,a.y,r.x,r.y)}function ZS(t,e,a){t.beginPath&&t.beginPath();for(var r=e,i=0;i<r.length;i++){var s=r[i];t.lineTo(s.x,s.y)}var o=a,u=a[0];t.moveTo(u.x,u.y);for(var i=1;i<o.length;i++){var s=o[i];t.lineTo(s.x,s.y)}t.closePath&&t.closePath()}function pL(t,e,a,r,i){t.beginPath&&t.beginPath(),t.arc(a,r,i,0,Math.PI*2,!1);var s=e,o=s[0];t.moveTo(o.x,o.y);for(var u=0;u<s.length;u++){var d=s[u];t.lineTo(d.x,d.y)}t.closePath&&t.closePath()}function gL(t,e,a,r){t.arc(e,a,r,0,Math.PI*2,!1)}oN.arrowShapeImpl=function(t){return(XS||(XS={polygon:hL,"triangle-backcurve":vL,"triangle-tee":ZS,"circle-triangle":pL,"triangle-cross":ZS,circle:gL}))[t]};var En={};En.drawElement=function(t,e,a,r,i,s){var o=this;e.isNode()?o.drawNode(t,e,a,r,i,s):o.drawEdge(t,e,a,r,i,s)};En.drawElementOverlay=function(t,e){var a=this;e.isNode()?a.drawNodeOverlay(t,e):a.drawEdgeOverlay(t,e)};En.drawElementUnderlay=function(t,e){var a=this;e.isNode()?a.drawNodeUnderlay(t,e):a.drawEdgeUnderlay(t,e)};En.drawCachedElementPortion=function(t,e,a,r,i,s,o,u){var d=this,f=a.getBoundingBox(e);if(!(f.w===0||f.h===0)){var h=a.getElement(e,f,r,i,s);if(h!=null){var p=u(d,e);if(p===0)return;var m=o(d,e),y=f.x1,x=f.y1,E=f.w,S=f.h,T,C,N,A,M;if(m!==0){var D=a.getRotationPoint(e);N=D.x,A=D.y,t.translate(N,A),t.rotate(m),M=d.getImgSmoothing(t),M||d.setImgSmoothing(t,!0);var j=a.getRotationOffset(e);T=j.x,C=j.y}else T=y,C=x;var R;p!==1&&(R=t.globalAlpha,t.globalAlpha=R*p),t.drawImage(h.texture.canvas,h.x,0,h.width,h.height,T,C,E,S),p!==1&&(t.globalAlpha=R),m!==0&&(t.rotate(-m),t.translate(-N,-A),M||d.setImgSmoothing(t,!1))}else a.drawElement(t,e)}};var mL=function(){return 0},yL=function(e,a){return e.getTextAngle(a,null)},xL=function(e,a){return e.getTextAngle(a,"source")},bL=function(e,a){return e.getTextAngle(a,"target")},wL=function(e,a){return a.effectiveOpacity()},cm=function(e,a){return a.pstyle("text-opacity").pfValue*a.effectiveOpacity()};En.drawCachedElement=function(t,e,a,r,i,s){var o=this,u=o.data,d=u.eleTxrCache,f=u.lblTxrCache,h=u.slbTxrCache,p=u.tlbTxrCache,m=e.boundingBox(),y=s===!0?d.reasons.highQuality:null;if(!(m.w===0||m.h===0||!e.visible())&&(!r||H0(m,r))){var x=e.isEdge(),E=e.element()._private.rscratch.badLine;o.drawElementUnderlay(t,e),o.drawCachedElementPortion(t,e,d,a,i,y,mL,wL),(!x||!E)&&o.drawCachedElementPortion(t,e,f,a,i,y,yL,cm),x&&!E&&(o.drawCachedElementPortion(t,e,h,a,i,y,xL,cm),o.drawCachedElementPortion(t,e,p,a,i,y,bL,cm)),o.drawElementOverlay(t,e)}};En.drawElements=function(t,e){for(var a=this,r=0;r<e.length;r++){var i=e[r];a.drawElement(t,i)}};En.drawCachedElements=function(t,e,a,r){for(var i=this,s=0;s<e.length;s++){var o=e[s];i.drawCachedElement(t,o,a,r)}};En.drawCachedNodes=function(t,e,a,r){for(var i=this,s=0;s<e.length;s++){var o=e[s];o.isNode()&&i.drawCachedElement(t,o,a,r)}};En.drawLayeredElements=function(t,e,a,r){var i=this,s=i.data.lyrTxrCache.getLayers(e,a);if(s)for(var o=0;o<s.length;o++){var u=s[o],d=u.bb;d.w===0||d.h===0||t.drawImage(u.canvas,d.x1,d.y1,d.w,d.h)}else i.drawCachedElements(t,e,a,r)};var ti={};ti.drawEdge=function(t,e,a){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,u=e._private.rscratch;if(!(s&&!e.visible())&&!(u.badLine||u.allpts==null||isNaN(u.allpts[0]))){var d;a&&(d=a,t.translate(-d.x1,-d.y1));var f=s?e.pstyle("opacity").value:1,h=s?e.pstyle("line-opacity").value:1,p=e.pstyle("curve-style").value,m=e.pstyle("line-style").value,y=e.pstyle("width").pfValue,x=e.pstyle("line-cap").value,E=e.pstyle("line-outline-width").value,S=e.pstyle("line-outline-color").value,T=f*h,C=f*h,N=function(){var Q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:T;p==="straight-triangle"?(o.eleStrokeStyle(t,e,Q),o.drawEdgeTrianglePath(e,t,u.allpts)):(t.lineWidth=y,t.lineCap=x,o.eleStrokeStyle(t,e,Q),o.drawEdgePath(e,t,u.allpts,m),t.lineCap="butt")},A=function(){var Q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:T;if(t.lineWidth=y+E,t.lineCap=x,E>0)o.colorStrokeStyle(t,S[0],S[1],S[2],Q);else{t.lineCap="butt";return}p==="straight-triangle"?o.drawEdgeTrianglePath(e,t,u.allpts):(o.drawEdgePath(e,t,u.allpts,m),t.lineCap="butt")},M=function(){i&&o.drawEdgeOverlay(t,e)},D=function(){i&&o.drawEdgeUnderlay(t,e)},j=function(){var Q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:C;o.drawArrowheads(t,e,Q)},R=function(){o.drawElementText(t,e,null,r)};t.lineJoin="round";var L=e.pstyle("ghost").value==="yes";if(L){var z=e.pstyle("ghost-offset-x").pfValue,_=e.pstyle("ghost-offset-y").pfValue,B=e.pstyle("ghost-opacity").value,q=T*B;t.translate(z,_),N(q),j(q),t.translate(-z,-_)}else A();D(),N(),j(),M(),R(),a&&t.translate(d.x1,d.y1)}};var uN=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(a,r){if(r.visible()){var i=r.pstyle("".concat(e,"-opacity")).value;if(i!==0){var s=this,o=s.usePaths(),u=r._private.rscratch,d=r.pstyle("".concat(e,"-padding")).pfValue,f=2*d,h=r.pstyle("".concat(e,"-color")).value;a.lineWidth=f,u.edgeType==="self"&&!o?a.lineCap="butt":a.lineCap="round",s.colorStrokeStyle(a,h[0],h[1],h[2],i),s.drawEdgePath(r,a,u.allpts,"solid")}}}};ti.drawEdgeOverlay=uN("overlay");ti.drawEdgeUnderlay=uN("underlay");ti.drawEdgePath=function(t,e,a,r){var i=t._private.rscratch,s=e,o,u=!1,d=this.usePaths(),f=t.pstyle("line-dash-pattern").pfValue,h=t.pstyle("line-dash-offset").pfValue;if(d){var p=a.join("$"),m=i.pathCacheKey&&i.pathCacheKey===p;m?(o=e=i.pathCache,u=!0):(o=e=new Path2D,i.pathCacheKey=p,i.pathCache=o)}if(s.setLineDash)switch(r){case"dotted":s.setLineDash([1,1]);break;case"dashed":s.setLineDash(f),s.lineDashOffset=h;break;case"solid":s.setLineDash([]);break}if(!u&&!i.badLine)switch(e.beginPath&&e.beginPath(),e.moveTo(a[0],a[1]),i.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var y=2;y+3<a.length;y+=4)e.quadraticCurveTo(a[y],a[y+1],a[y+2],a[y+3]);break;case"straight":case"haystack":for(var x=2;x+1<a.length;x+=2)e.lineTo(a[x],a[x+1]);break;case"segments":if(i.isRound){var E=yr(i.roundCorners),S;try{for(E.s();!(S=E.n()).done;){var T=S.value;ZC(e,T)}}catch(N){E.e(N)}finally{E.f()}e.lineTo(a[a.length-2],a[a.length-1])}else for(var C=2;C+1<a.length;C+=2)e.lineTo(a[C],a[C+1]);break}e=s,d?e.stroke(o):e.stroke(),e.setLineDash&&e.setLineDash([])};ti.drawEdgeTrianglePath=function(t,e,a){e.fillStyle=e.strokeStyle;for(var r=t.pstyle("width").pfValue,i=0;i+1<a.length;i+=2){var s=[a[i+2]-a[i],a[i+3]-a[i+1]],o=Math.sqrt(s[0]*s[0]+s[1]*s[1]),u=[s[1]/o,-s[0]/o],d=[u[0]*r/2,u[1]*r/2];e.beginPath(),e.moveTo(a[i]-d[0],a[i+1]-d[1]),e.lineTo(a[i]+d[0],a[i+1]+d[1]),e.lineTo(a[i+2],a[i+3]),e.closePath(),e.fill()}};ti.drawArrowheads=function(t,e,a){var r=e._private.rscratch,i=r.edgeType==="haystack";i||this.drawArrowhead(t,e,"source",r.arrowStartX,r.arrowStartY,r.srcArrowAngle,a),this.drawArrowhead(t,e,"mid-target",r.midX,r.midY,r.midtgtArrowAngle,a),this.drawArrowhead(t,e,"mid-source",r.midX,r.midY,r.midsrcArrowAngle,a),i||this.drawArrowhead(t,e,"target",r.arrowEndX,r.arrowEndY,r.tgtArrowAngle,a)};ti.drawArrowhead=function(t,e,a,r,i,s,o){if(!(isNaN(r)||r==null||isNaN(i)||i==null||isNaN(s)||s==null)){var u=this,d=e.pstyle(a+"-arrow-shape").value;if(d!=="none"){var f=e.pstyle(a+"-arrow-fill").value==="hollow"?"both":"filled",h=e.pstyle(a+"-arrow-fill").value,p=e.pstyle("width").pfValue,m=e.pstyle(a+"-arrow-width"),y=m.value==="match-line"?p:m.pfValue;m.units==="%"&&(y*=p);var x=e.pstyle("opacity").value;o===void 0&&(o=x);var E=t.globalCompositeOperation;(o!==1||h==="hollow")&&(t.globalCompositeOperation="destination-out",u.colorFillStyle(t,255,255,255,1),u.colorStrokeStyle(t,255,255,255,1),u.drawArrowShape(e,t,f,p,d,y,r,i,s),t.globalCompositeOperation=E);var S=e.pstyle(a+"-arrow-color").value;u.colorFillStyle(t,S[0],S[1],S[2],o),u.colorStrokeStyle(t,S[0],S[1],S[2],o),u.drawArrowShape(e,t,h,p,d,y,r,i,s)}}};ti.drawArrowShape=function(t,e,a,r,i,s,o,u,d){var f=this,h=this.usePaths()&&i!=="triangle-cross",p=!1,m,y=e,x={x:o,y:u},E=t.pstyle("arrow-scale").value,S=this.getArrowWidth(r,E),T=f.arrowShapes[i];if(h){var C=f.arrowPathCache=f.arrowPathCache||[],N=Ws(i),A=C[N];A!=null?(m=e=A,p=!0):(m=e=new Path2D,C[N]=m)}p||(e.beginPath&&e.beginPath(),h?T.draw(e,1,0,{x:0,y:0},1):T.draw(e,S,d,x,r),e.closePath&&e.closePath()),e=y,h&&(e.translate(o,u),e.rotate(d),e.scale(S,S)),(a==="filled"||a==="both")&&(h?e.fill(m):e.fill()),(a==="hollow"||a==="both")&&(e.lineWidth=s/(h?S:1),e.lineJoin="miter",h?e.stroke(m):e.stroke()),h&&(e.scale(1/S,1/S),e.rotate(-d),e.translate(-o,-u))};var ny={};ny.safeDrawImage=function(t,e,a,r,i,s,o,u,d,f){if(!(i<=0||s<=0||d<=0||f<=0))try{t.drawImage(e,a,r,i,s,o,u,d,f)}catch(h){At(h)}};ny.drawInscribedImage=function(t,e,a,r,i){var s=this,o=a.position(),u=o.x,d=o.y,f=a.cy().style(),h=f.getIndexedStyle.bind(f),p=h(a,"background-fit","value",r),m=h(a,"background-repeat","value",r),y=a.width(),x=a.height(),E=a.padding()*2,S=y+(h(a,"background-width-relative-to","value",r)==="inner"?0:E),T=x+(h(a,"background-height-relative-to","value",r)==="inner"?0:E),C=a._private.rscratch,N=h(a,"background-clip","value",r),A=N==="node",M=h(a,"background-image-opacity","value",r)*i,D=h(a,"background-image-smoothing","value",r),j=a.pstyle("corner-radius").value;j!=="auto"&&(j=a.pstyle("corner-radius").pfValue);var R=e.width||e.cachedW,L=e.height||e.cachedH;(R==null||L==null)&&(document.body.appendChild(e),R=e.cachedW=e.width||e.offsetWidth,L=e.cachedH=e.height||e.offsetHeight,document.body.removeChild(e));var z=R,_=L;if(h(a,"background-width","value",r)!=="auto"&&(h(a,"background-width","units",r)==="%"?z=h(a,"background-width","pfValue",r)*S:z=h(a,"background-width","pfValue",r)),h(a,"background-height","value",r)!=="auto"&&(h(a,"background-height","units",r)==="%"?_=h(a,"background-height","pfValue",r)*T:_=h(a,"background-height","pfValue",r)),!(z===0||_===0)){if(p==="contain"){var B=Math.min(S/z,T/_);z*=B,_*=B}else if(p==="cover"){var B=Math.max(S/z,T/_);z*=B,_*=B}var q=u-S/2,V=h(a,"background-position-x","units",r),Q=h(a,"background-position-x","pfValue",r);V==="%"?q+=(S-z)*Q:q+=Q;var P=h(a,"background-offset-x","units",r),U=h(a,"background-offset-x","pfValue",r);P==="%"?q+=(S-z)*U:q+=U;var F=d-T/2,K=h(a,"background-position-y","units",r),J=h(a,"background-position-y","pfValue",r);K==="%"?F+=(T-_)*J:F+=J;var k=h(a,"background-offset-y","units",r),G=h(a,"background-offset-y","pfValue",r);k==="%"?F+=(T-_)*G:F+=G,C.pathCache&&(q-=u,F-=d,u=0,d=0);var X=t.globalAlpha;t.globalAlpha=M;var W=s.getImgSmoothing(t),$=!1;if(D==="no"&&W?(s.setImgSmoothing(t,!1),$=!0):D==="yes"&&!W&&(s.setImgSmoothing(t,!0),$=!0),m==="no-repeat")A&&(t.save(),C.pathCache?t.clip(C.pathCache):(s.nodeShapes[s.getNodeShape(a)].draw(t,u,d,S,T,j,C),t.clip())),s.safeDrawImage(t,e,0,0,R,L,q,F,z,_),A&&t.restore();else{var ee=t.createPattern(e,m);t.fillStyle=ee,s.nodeShapes[s.getNodeShape(a)].draw(t,u,d,S,T,j,C),t.translate(q,F),t.fill(),t.translate(-q,-F)}t.globalAlpha=X,$&&s.setImgSmoothing(t,W)}};var ol={};ol.eleTextBiggerThanMin=function(t,e){if(!e){var a=t.cy().zoom(),r=this.getPixelRatio(),i=Math.ceil(V0(a*r));e=Math.pow(2,i)}var s=t.pstyle("font-size").pfValue*e,o=t.pstyle("min-zoomed-font-size").pfValue;return!(s<o)};ol.drawElementText=function(t,e,a,r,i){var s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this;if(r==null){if(s&&!o.eleTextBiggerThanMin(e))return}else if(r===!1)return;if(e.isNode()){var u=e.pstyle("label");if(!u||!u.value)return;var d=o.getLabelJustification(e);t.textAlign=d,t.textBaseline="bottom"}else{var f=e.element()._private.rscratch.badLine,h=e.pstyle("label"),p=e.pstyle("source-label"),m=e.pstyle("target-label");if(f||(!h||!h.value)&&(!p||!p.value)&&(!m||!m.value))return;t.textAlign="center",t.textBaseline="bottom"}var y=!a,x;a&&(x=a,t.translate(-x.x1,-x.y1)),i==null?(o.drawText(t,e,null,y,s),e.isEdge()&&(o.drawText(t,e,"source",y,s),o.drawText(t,e,"target",y,s))):o.drawText(t,e,i,y,s),a&&t.translate(x.x1,x.y1)};ol.getFontCache=function(t){var e;this.fontCaches=this.fontCaches||[];for(var a=0;a<this.fontCaches.length;a++)if(e=this.fontCaches[a],e.context===t)return e;return e={context:t},this.fontCaches.push(e),e};ol.setupTextStyle=function(t,e){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=e.pstyle("font-style").strValue,i=e.pstyle("font-size").pfValue+"px",s=e.pstyle("font-family").strValue,o=e.pstyle("font-weight").strValue,u=a?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,d=e.pstyle("text-outline-opacity").value*u,f=e.pstyle("color").value,h=e.pstyle("text-outline-color").value;t.font=r+" "+o+" "+i+" "+s,t.lineJoin="round",this.colorFillStyle(t,f[0],f[1],f[2],u),this.colorStrokeStyle(t,h[0],h[1],h[2],d)};function SL(t,e,a,r,i){var s=Math.min(r,i),o=s/2,u=e+r/2,d=a+i/2;t.beginPath(),t.arc(u,d,o,0,Math.PI*2),t.closePath()}function WS(t,e,a,r,i){var s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,o=Math.min(s,r/2,i/2);t.beginPath(),t.moveTo(e+o,a),t.lineTo(e+r-o,a),t.quadraticCurveTo(e+r,a,e+r,a+o),t.lineTo(e+r,a+i-o),t.quadraticCurveTo(e+r,a+i,e+r-o,a+i),t.lineTo(e+o,a+i),t.quadraticCurveTo(e,a+i,e,a+i-o),t.lineTo(e,a+o),t.quadraticCurveTo(e,a,e+o,a),t.closePath()}ol.getTextAngle=function(t,e){var a,r=t._private,i=r.rscratch,s=e?e+"-":"",o=t.pstyle(s+"text-rotation");if(o.strValue==="autorotate"){var u=gr(i,"labelAngle",e);a=t.isEdge()?u:0}else o.strValue==="none"?a=0:a=o.pfValue;return a};ol.drawText=function(t,e,a){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=e._private,o=s.rscratch,u=i?e.effectiveOpacity():1;if(!(i&&(u===0||e.pstyle("text-opacity").value===0))){a==="main"&&(a=null);var d=gr(o,"labelX",a),f=gr(o,"labelY",a),h,p,m=this.getLabelText(e,a);if(m!=null&&m!==""&&!isNaN(d)&&!isNaN(f)){this.setupTextStyle(t,e,i);var y=a?a+"-":"",x=gr(o,"labelWidth",a),E=gr(o,"labelHeight",a),S=e.pstyle(y+"text-margin-x").pfValue,T=e.pstyle(y+"text-margin-y").pfValue,C=e.isEdge(),N=e.pstyle("text-halign").value,A=e.pstyle("text-valign").value;C&&(N="center",A="center"),d+=S,f+=T;var M;switch(r?M=this.getTextAngle(e,a):M=0,M!==0&&(h=d,p=f,t.translate(h,p),t.rotate(M),d=0,f=0),A){case"top":break;case"center":f+=E/2;break;case"bottom":f+=E;break}var D=e.pstyle("text-background-opacity").value,j=e.pstyle("text-border-opacity").value,R=e.pstyle("text-border-width").pfValue,L=e.pstyle("text-background-padding").pfValue,z=e.pstyle("text-background-shape").strValue,_=z==="round-rectangle"||z==="roundrectangle",B=z==="circle",q=2;if(D>0||R>0&&j>0){var V=t.fillStyle,Q=t.strokeStyle,P=t.lineWidth,U=e.pstyle("text-background-color").value,F=e.pstyle("text-border-color").value,K=e.pstyle("text-border-style").value,J=D>0,k=R>0&&j>0,G=d-L;switch(N){case"left":G-=x;break;case"center":G-=x/2;break}var X=f-E-L,W=x+2*L,$=E+2*L;if(J&&(t.fillStyle="rgba(".concat(U[0],",").concat(U[1],",").concat(U[2],",").concat(D*u,")")),k&&(t.strokeStyle="rgba(".concat(F[0],",").concat(F[1],",").concat(F[2],",").concat(j*u,")"),t.lineWidth=R,t.setLineDash))switch(K){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"double":t.lineWidth=R/4,t.setLineDash([]);break;case"solid":default:t.setLineDash([]);break}if(_?(t.beginPath(),WS(t,G,X,W,$,q)):B?(t.beginPath(),SL(t,G,X,W,$)):(t.beginPath(),t.rect(G,X,W,$)),J&&t.fill(),k&&t.stroke(),k&&K==="double"){var ee=R/2;t.beginPath(),_?WS(t,G+ee,X+ee,W-2*ee,$-2*ee,q):t.rect(G+ee,X+ee,W-2*ee,$-2*ee),t.stroke()}t.fillStyle=V,t.strokeStyle=Q,t.lineWidth=P,t.setLineDash&&t.setLineDash([])}var ie=2*e.pstyle("text-outline-width").pfValue;if(ie>0&&(t.lineWidth=ie),e.pstyle("text-wrap").value==="wrap"){var he=gr(o,"labelWrapCachedLines",a),oe=gr(o,"labelLineHeight",a),ae=x/2,re=this.getLabelJustification(e);switch(re==="auto"||(N==="left"?re==="left"?d+=-x:re==="center"&&(d+=-ae):N==="center"?re==="left"?d+=-ae:re==="right"&&(d+=ae):N==="right"&&(re==="center"?d+=ae:re==="right"&&(d+=x))),A){case"top":f-=(he.length-1)*oe;break;case"center":case"bottom":f-=(he.length-1)*oe;break}for(var le=0;le<he.length;le++)ie>0&&t.strokeText(he[le],d,f),t.fillText(he[le],d,f),f+=oe}else ie>0&&t.strokeText(m,d,f),t.fillText(m,d,f);M!==0&&(t.rotate(-M),t.translate(-h,-p))}}};var fs={};fs.drawNode=function(t,e,a){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,u,d,f=e._private,h=f.rscratch,p=e.position();if(!(!Oe(p.x)||!Oe(p.y))&&!(s&&!e.visible())){var m=s?e.effectiveOpacity():1,y=o.usePaths(),x,E=!1,S=e.padding();u=e.width()+2*S,d=e.height()+2*S;var T;a&&(T=a,t.translate(-T.x1,-T.y1));for(var C=e.pstyle("background-image"),N=C.value,A=new Array(N.length),M=new Array(N.length),D=0,j=0;j<N.length;j++){var R=N[j],L=A[j]=R!=null&&R!=="none";if(L){var z=e.cy().style().getIndexedStyle(e,"background-image-crossorigin","value",j);D++,M[j]=o.getCachedImage(R,z,function(){f.backgroundTimestamp=Date.now(),e.emitAndNotify("background")})}}var _=e.pstyle("background-blacken").value,B=e.pstyle("border-width").pfValue,q=e.pstyle("background-opacity").value*m,V=e.pstyle("border-color").value,Q=e.pstyle("border-style").value,P=e.pstyle("border-join").value,U=e.pstyle("border-cap").value,F=e.pstyle("border-position").value,K=e.pstyle("border-dash-pattern").pfValue,J=e.pstyle("border-dash-offset").pfValue,k=e.pstyle("border-opacity").value*m,G=e.pstyle("outline-width").pfValue,X=e.pstyle("outline-color").value,W=e.pstyle("outline-style").value,$=e.pstyle("outline-opacity").value*m,ee=e.pstyle("outline-offset").value,ie=e.pstyle("corner-radius").value;ie!=="auto"&&(ie=e.pstyle("corner-radius").pfValue);var he=function(){var Ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:q;o.eleFillStyle(t,e,Ue)},oe=function(){var Ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:k;o.colorStrokeStyle(t,V[0],V[1],V[2],Ue)},ae=function(){var Ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:$;o.colorStrokeStyle(t,X[0],X[1],X[2],Ue)},re=function(Ue,we,Y,ce){var me=o.nodePathCache=o.nodePathCache||[],ge=KT(Y==="polygon"?Y+","+ce.join(","):Y,""+we,""+Ue,""+ie),Ee=me[ge],Pe,je=!1;return Ee!=null?(Pe=Ee,je=!0,h.pathCache=Pe):(Pe=new Path2D,me[ge]=h.pathCache=Pe),{path:Pe,cacheHit:je}},le=e.pstyle("shape").strValue,se=e.pstyle("shape-polygon-points").pfValue;if(y){t.translate(p.x,p.y);var Ne=re(u,d,le,se);x=Ne.path,E=Ne.cacheHit}var Ae=function(){if(!E){var Ue=p;y&&(Ue={x:0,y:0}),o.nodeShapes[o.getNodeShape(e)].draw(x||t,Ue.x,Ue.y,u,d,ie,h)}y?t.fill(x):t.fill()},We=function(){for(var Ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m,we=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,Y=f.backgrounding,ce=0,me=0;me<M.length;me++){var ge=e.cy().style().getIndexedStyle(e,"background-image-containment","value",me);if(we&&ge==="over"||!we&&ge==="inside"){ce++;continue}A[me]&&M[me].complete&&!M[me].error&&(ce++,o.drawInscribedImage(t,M[me],e,me,Ue))}f.backgrounding=ce!==D,Y!==f.backgrounding&&e.updateStyle(!1)},He=function(){var Ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,we=arguments.length>1&&arguments[1]!==void 0?arguments[1]:m;o.hasPie(e)&&(o.drawPie(t,e,we),Ue&&(y||o.nodeShapes[o.getNodeShape(e)].draw(t,p.x,p.y,u,d,ie,h)))},Se=function(){var Ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,we=arguments.length>1&&arguments[1]!==void 0?arguments[1]:m;o.hasStripe(e)&&(t.save(),y?t.clip(h.pathCache):(o.nodeShapes[o.getNodeShape(e)].draw(t,p.x,p.y,u,d,ie,h),t.clip()),o.drawStripe(t,e,we),t.restore(),Ue&&(y||o.nodeShapes[o.getNodeShape(e)].draw(t,p.x,p.y,u,d,ie,h)))},ke=function(){var Ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m,we=(_>0?_:-_)*Ue,Y=_>0?0:255;_!==0&&(o.colorFillStyle(t,Y,Y,Y,we),y?t.fill(x):t.fill())},De=function(){if(B>0){if(t.lineWidth=B,t.lineCap=U,t.lineJoin=P,t.setLineDash)switch(Q){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash(K),t.lineDashOffset=J;break;case"solid":case"double":t.setLineDash([]);break}if(F!=="center"){if(t.save(),t.lineWidth*=2,F==="inside")y?t.clip(x):t.clip();else{var Ue=new Path2D;Ue.rect(-u/2-B,-d/2-B,u+2*B,d+2*B),Ue.addPath(x),t.clip(Ue,"evenodd")}y?t.stroke(x):t.stroke(),t.restore()}else y?t.stroke(x):t.stroke();if(Q==="double"){t.lineWidth=B/3;var we=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",y?t.stroke(x):t.stroke(),t.globalCompositeOperation=we}t.setLineDash&&t.setLineDash([])}},Be=function(){if(G>0){if(t.lineWidth=G,t.lineCap="butt",t.setLineDash)switch(W){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"solid":case"double":t.setLineDash([]);break}var Ue=p;y&&(Ue={x:0,y:0});var we=o.getNodeShape(e),Y=B;F==="inside"&&(Y=0),F==="outside"&&(Y*=2);var ce=(u+Y+(G+ee))/u,me=(d+Y+(G+ee))/d,ge=u*ce,Ee=d*me,Pe=o.nodeShapes[we].points,je;if(y){var Fe=re(ge,Ee,we,Pe);je=Fe.path}if(we==="ellipse")o.drawEllipsePath(je||t,Ue.x,Ue.y,ge,Ee);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(we)){var ze=0,$e=0,it=0;we==="round-diamond"?ze=(Y+ee+G)*1.4:we==="round-heptagon"?(ze=(Y+ee+G)*1.075,it=-(Y/2+ee+G)/35):we==="round-hexagon"?ze=(Y+ee+G)*1.12:we==="round-pentagon"?(ze=(Y+ee+G)*1.13,it=-(Y/2+ee+G)/15):we==="round-tag"?(ze=(Y+ee+G)*1.12,$e=(Y/2+G+ee)*.07):we==="round-triangle"&&(ze=(Y+ee+G)*(Math.PI/2),it=-(Y+ee/2+G)/Math.PI),ze!==0&&(ce=(u+ze)/u,ge=u*ce,["round-hexagon","round-tag"].includes(we)||(me=(d+ze)/d,Ee=d*me)),ie=ie==="auto"?nC(ge,Ee):ie;for(var st=ge/2,Ie=Ee/2,dt=ie+(Y+G+ee)/2,ut=new Array(Pe.length/2),Yt=new Array(Pe.length/2),Rt=0;Rt<Pe.length/2;Rt++)ut[Rt]={x:Ue.x+$e+st*Pe[Rt*2],y:Ue.y+it+Ie*Pe[Rt*2+1]};var Ba,Kt,ia,Wt,sa=ut.length;for(Kt=ut[sa-1],Ba=0;Ba<sa;Ba++)ia=ut[Ba%sa],Wt=ut[(Ba+1)%sa],Yt[Ba]=ay(Kt,ia,Wt,dt),Kt=ia,ia=Wt;o.drawRoundPolygonPath(je||t,Ue.x+$e,Ue.y+it,u*ce,d*me,Pe,Yt)}else if(["roundrectangle","round-rectangle"].includes(we))ie=ie==="auto"?as(ge,Ee):ie,o.drawRoundRectanglePath(je||t,Ue.x,Ue.y,ge,Ee,ie+(Y+G+ee)/2);else if(["cutrectangle","cut-rectangle"].includes(we))ie=ie==="auto"?G0():ie,o.drawCutRectanglePath(je||t,Ue.x,Ue.y,ge,Ee,null,ie+(Y+G+ee)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(we))ie=ie==="auto"?as(ge,Ee):ie,o.drawBottomRoundRectanglePath(je||t,Ue.x,Ue.y,ge,Ee,ie+(Y+G+ee)/2);else if(we==="barrel")o.drawBarrelPath(je||t,Ue.x,Ue.y,ge,Ee);else if(we.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(we)){var Or=(Y+G+ee)/u;Pe=_f(Uf(Pe,Or)),o.drawPolygonPath(je||t,Ue.x,Ue.y,u,d,Pe)}else{var $t=(Y+G+ee)/u;Pe=_f(Uf(Pe,-$t)),o.drawPolygonPath(je||t,Ue.x,Ue.y,u,d,Pe)}if(y?t.stroke(je):t.stroke(),W==="double"){t.lineWidth=Y/3;var Rr=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",y?t.stroke(je):t.stroke(),t.globalCompositeOperation=Rr}t.setLineDash&&t.setLineDash([])}},Ge=function(){i&&o.drawNodeOverlay(t,e,p,u,d)},Je=function(){i&&o.drawNodeUnderlay(t,e,p,u,d)},Re=function(){o.drawElementText(t,e,null,r)},nt=e.pstyle("ghost").value==="yes";if(nt){var xe=e.pstyle("ghost-offset-x").pfValue,pe=e.pstyle("ghost-offset-y").pfValue,Ye=e.pstyle("ghost-opacity").value,tt=Ye*m;t.translate(xe,pe),ae(),Be(),he(Ye*q),Ae(),We(tt,!0),oe(Ye*k),De(),He(_!==0||B!==0),Se(_!==0||B!==0),We(tt,!1),ke(tt),t.translate(-xe,-pe)}y&&t.translate(-p.x,-p.y),Je(),y&&t.translate(p.x,p.y),ae(),Be(),he(),Ae(),We(m,!0),oe(),De(),He(_!==0||B!==0),Se(_!==0||B!==0),We(m,!1),ke(),y&&t.translate(-p.x,-p.y),Re(),Ge(),a&&t.translate(T.x1,T.y1)}};var cN=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(a,r,i,s,o){var u=this;if(r.visible()){var d=r.pstyle("".concat(e,"-padding")).pfValue,f=r.pstyle("".concat(e,"-opacity")).value,h=r.pstyle("".concat(e,"-color")).value,p=r.pstyle("".concat(e,"-shape")).value,m=r.pstyle("".concat(e,"-corner-radius")).value;if(f>0){if(i=i||r.position(),s==null||o==null){var y=r.padding();s=r.width()+2*y,o=r.height()+2*y}u.colorFillStyle(a,h[0],h[1],h[2],f),u.nodeShapes[p].draw(a,i.x,i.y,s+d*2,o+d*2,m),a.fill()}}}};fs.drawNodeOverlay=cN("overlay");fs.drawNodeUnderlay=cN("underlay");fs.hasPie=function(t){return t=t[0],t._private.hasPie};fs.hasStripe=function(t){return t=t[0],t._private.hasStripe};fs.drawPie=function(t,e,a,r){e=e[0],r=r||e.position();var i=e.cy().style(),s=e.pstyle("pie-size"),o=e.pstyle("pie-hole"),u=e.pstyle("pie-start-angle").pfValue,d=r.x,f=r.y,h=e.width(),p=e.height(),m=Math.min(h,p)/2,y,x=0,E=this.usePaths();if(E&&(d=0,f=0),s.units==="%"?m=m*s.pfValue:s.pfValue!==void 0&&(m=s.pfValue/2),o.units==="%"?y=m*o.pfValue:o.pfValue!==void 0&&(y=o.pfValue/2),!(y>=m))for(var S=1;S<=i.pieBackgroundN;S++){var T=e.pstyle("pie-"+S+"-background-size").value,C=e.pstyle("pie-"+S+"-background-color").value,N=e.pstyle("pie-"+S+"-background-opacity").value*a,A=T/100;A+x>1&&(A=1-x);var M=1.5*Math.PI+2*Math.PI*x;M+=u;var D=2*Math.PI*A,j=M+D;T===0||x>=1||x+A>1||(y===0?(t.beginPath(),t.moveTo(d,f),t.arc(d,f,m,M,j),t.closePath()):(t.beginPath(),t.arc(d,f,m,M,j),t.arc(d,f,y,j,M,!0),t.closePath()),this.colorFillStyle(t,C[0],C[1],C[2],N),t.fill(),x+=A)}};fs.drawStripe=function(t,e,a,r){e=e[0],r=r||e.position();var i=e.cy().style(),s=r.x,o=r.y,u=e.width(),d=e.height(),f=0,h=this.usePaths();t.save();var p=e.pstyle("stripe-direction").value,m=e.pstyle("stripe-size");switch(p){case"vertical":break;case"righward":t.rotate(-Math.PI/2);break}var y=u,x=d;m.units==="%"?(y=y*m.pfValue,x=x*m.pfValue):m.pfValue!==void 0&&(y=m.pfValue,x=m.pfValue),h&&(s=0,o=0),o-=y/2,s-=x/2;for(var E=1;E<=i.stripeBackgroundN;E++){var S=e.pstyle("stripe-"+E+"-background-size").value,T=e.pstyle("stripe-"+E+"-background-color").value,C=e.pstyle("stripe-"+E+"-background-opacity").value*a,N=S/100;N+f>1&&(N=1-f),!(S===0||f>=1||f+N>1)&&(t.beginPath(),t.rect(s,o+x*f,y,x*N),t.closePath(),this.colorFillStyle(t,T[0],T[1],T[2],C),t.fill(),f+=N)}t.restore()};var ir={},EL=100;ir.getPixelRatio=function(){var t=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var e=this.cy.window(),a=t.backingStorePixelRatio||t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return(e.devicePixelRatio||1)/a};ir.paintCache=function(t){for(var e=this.paintCaches=this.paintCaches||[],a=!0,r,i=0;i<e.length;i++)if(r=e[i],r.context===t){a=!1;break}return a&&(r={context:t},e.push(r)),r};ir.createGradientStyleFor=function(t,e,a,r,i){var s,o=this.usePaths(),u=a.pstyle(e+"-gradient-stop-colors").value,d=a.pstyle(e+"-gradient-stop-positions").pfValue;if(r==="radial-gradient")if(a.isEdge()){var f=a.sourceEndpoint(),h=a.targetEndpoint(),p=a.midpoint(),m=Js(f,p),y=Js(h,p);s=t.createRadialGradient(p.x,p.y,0,p.x,p.y,Math.max(m,y))}else{var x=o?{x:0,y:0}:a.position(),E=a.paddedWidth(),S=a.paddedHeight();s=t.createRadialGradient(x.x,x.y,0,x.x,x.y,Math.max(E,S))}else if(a.isEdge()){var T=a.sourceEndpoint(),C=a.targetEndpoint();s=t.createLinearGradient(T.x,T.y,C.x,C.y)}else{var N=o?{x:0,y:0}:a.position(),A=a.paddedWidth(),M=a.paddedHeight(),D=A/2,j=M/2,R=a.pstyle("background-gradient-direction").value;switch(R){case"to-bottom":s=t.createLinearGradient(N.x,N.y-j,N.x,N.y+j);break;case"to-top":s=t.createLinearGradient(N.x,N.y+j,N.x,N.y-j);break;case"to-left":s=t.createLinearGradient(N.x+D,N.y,N.x-D,N.y);break;case"to-right":s=t.createLinearGradient(N.x-D,N.y,N.x+D,N.y);break;case"to-bottom-right":case"to-right-bottom":s=t.createLinearGradient(N.x-D,N.y-j,N.x+D,N.y+j);break;case"to-top-right":case"to-right-top":s=t.createLinearGradient(N.x-D,N.y+j,N.x+D,N.y-j);break;case"to-bottom-left":case"to-left-bottom":s=t.createLinearGradient(N.x+D,N.y-j,N.x-D,N.y+j);break;case"to-top-left":case"to-left-top":s=t.createLinearGradient(N.x+D,N.y+j,N.x-D,N.y-j);break}}if(!s)return null;for(var L=d.length===u.length,z=u.length,_=0;_<z;_++)s.addColorStop(L?d[_]:_/(z-1),"rgba("+u[_][0]+","+u[_][1]+","+u[_][2]+","+i+")");return s};ir.gradientFillStyle=function(t,e,a,r){var i=this.createGradientStyleFor(t,"background",e,a,r);if(!i)return null;t.fillStyle=i};ir.colorFillStyle=function(t,e,a,r,i){t.fillStyle="rgba("+e+","+a+","+r+","+i+")"};ir.eleFillStyle=function(t,e,a){var r=e.pstyle("background-fill").value;if(r==="linear-gradient"||r==="radial-gradient")this.gradientFillStyle(t,e,r,a);else{var i=e.pstyle("background-color").value;this.colorFillStyle(t,i[0],i[1],i[2],a)}};ir.gradientStrokeStyle=function(t,e,a,r){var i=this.createGradientStyleFor(t,"line",e,a,r);if(!i)return null;t.strokeStyle=i};ir.colorStrokeStyle=function(t,e,a,r,i){t.strokeStyle="rgba("+e+","+a+","+r+","+i+")"};ir.eleStrokeStyle=function(t,e,a){var r=e.pstyle("line-fill").value;if(r==="linear-gradient"||r==="radial-gradient")this.gradientStrokeStyle(t,e,r,a);else{var i=e.pstyle("line-color").value;this.colorStrokeStyle(t,i[0],i[1],i[2],a)}};ir.matchCanvasSize=function(t){var e=this,a=e.data,r=e.findContainerClientCoords(),i=r[2],s=r[3],o=e.getPixelRatio(),u=e.motionBlurPxRatio;(t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE]||t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG])&&(o=u);var d=i*o,f=s*o,h;if(!(d===e.canvasWidth&&f===e.canvasHeight)){e.fontCaches=null;var p=a.canvasContainer;p.style.width=i+"px",p.style.height=s+"px";for(var m=0;m<e.CANVAS_LAYERS;m++)h=a.canvases[m],h.width=d,h.height=f,h.style.width=i+"px",h.style.height=s+"px";for(var m=0;m<e.BUFFER_COUNT;m++)h=a.bufferCanvases[m],h.width=d,h.height=f,h.style.width=i+"px",h.style.height=s+"px";e.textureMult=1,o<=1&&(h=a.bufferCanvases[e.TEXTURE_BUFFER],e.textureMult=2,h.width=d*e.textureMult,h.height=f*e.textureMult),e.canvasWidth=d,e.canvasHeight=f,e.pixelRatio=o}};ir.renderTo=function(t,e,a,r){this.render({forcedContext:t,forcedZoom:e,forcedPan:a,drawAllLayers:!0,forcedPxRatio:r})};ir.clearCanvas=function(){var t=this,e=t.data;function a(r){r.clearRect(0,0,t.canvasWidth,t.canvasHeight)}a(e.contexts[t.NODE]),a(e.contexts[t.DRAG])};ir.render=function(t){var e=this;t=t||WT();var a=e.cy,r=t.forcedContext,i=t.drawAllLayers,s=t.drawOnlyNodeLayer,o=t.forcedZoom,u=t.forcedPan,d=t.forcedPxRatio===void 0?this.getPixelRatio():t.forcedPxRatio,f=e.data,h=f.canvasNeedsRedraw,p=e.textureOnViewport&&!r&&(e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming),m=t.motionBlur!==void 0?t.motionBlur:e.motionBlur,y=e.motionBlurPxRatio,x=a.hasCompoundNodes(),E=e.hoverData.draggingEles,S=!!(e.hoverData.selecting||e.touchData.selecting);m=m&&!r&&e.motionBlurEnabled&&!S;var T=m;r||(e.prevPxRatio!==d&&(e.invalidateContainerClientCoordsCache(),e.matchCanvasSize(e.container),e.redrawHint("eles",!0),e.redrawHint("drag",!0)),e.prevPxRatio=d),!r&&e.motionBlurTimeout&&clearTimeout(e.motionBlurTimeout),m&&(e.mbFrames==null&&(e.mbFrames=0),e.mbFrames++,e.mbFrames<3&&(T=!1),e.mbFrames>e.minMbLowQualFrames&&(e.motionBlurPxRatio=e.mbPxRBlurry)),e.clearingMotionBlur&&(e.motionBlurPxRatio=1),e.textureDrawLastFrame&&!p&&(h[e.NODE]=!0,h[e.SELECT_BOX]=!0);var C=a.style(),N=a.zoom(),A=o!==void 0?o:N,M=a.pan(),D={x:M.x,y:M.y},j={zoom:N,pan:{x:M.x,y:M.y}},R=e.prevViewport,L=R===void 0||j.zoom!==R.zoom||j.pan.x!==R.pan.x||j.pan.y!==R.pan.y;!L&&!(E&&!x)&&(e.motionBlurPxRatio=1),u&&(D=u),A*=d,D.x*=d,D.y*=d;var z=e.getCachedZSortedEles();function _(oe,ae,re,le,se){var Ne=oe.globalCompositeOperation;oe.globalCompositeOperation="destination-out",e.colorFillStyle(oe,255,255,255,e.motionBlurTransparency),oe.fillRect(ae,re,le,se),oe.globalCompositeOperation=Ne}function B(oe,ae){var re,le,se,Ne;!e.clearingMotionBlur&&(oe===f.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]||oe===f.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG])?(re={x:M.x*y,y:M.y*y},le=N*y,se=e.canvasWidth*y,Ne=e.canvasHeight*y):(re=D,le=A,se=e.canvasWidth,Ne=e.canvasHeight),oe.setTransform(1,0,0,1,0,0),ae==="motionBlur"?_(oe,0,0,se,Ne):!r&&(ae===void 0||ae)&&oe.clearRect(0,0,se,Ne),i||(oe.translate(re.x,re.y),oe.scale(le,le)),u&&oe.translate(u.x,u.y),o&&oe.scale(o,o)}if(p||(e.textureDrawLastFrame=!1),p){if(e.textureDrawLastFrame=!0,!e.textureCache){e.textureCache={},e.textureCache.bb=a.mutableElements().boundingBox(),e.textureCache.texture=e.data.bufferCanvases[e.TEXTURE_BUFFER];var q=e.data.bufferContexts[e.TEXTURE_BUFFER];q.setTransform(1,0,0,1,0,0),q.clearRect(0,0,e.canvasWidth*e.textureMult,e.canvasHeight*e.textureMult),e.render({forcedContext:q,drawOnlyNodeLayer:!0,forcedPxRatio:d*e.textureMult});var j=e.textureCache.viewport={zoom:a.zoom(),pan:a.pan(),width:e.canvasWidth,height:e.canvasHeight};j.mpan={x:(0-j.pan.x)/j.zoom,y:(0-j.pan.y)/j.zoom}}h[e.DRAG]=!1,h[e.NODE]=!1;var V=f.contexts[e.NODE],Q=e.textureCache.texture,j=e.textureCache.viewport;V.setTransform(1,0,0,1,0,0),m?_(V,0,0,j.width,j.height):V.clearRect(0,0,j.width,j.height);var P=C.core("outside-texture-bg-color").value,U=C.core("outside-texture-bg-opacity").value;e.colorFillStyle(V,P[0],P[1],P[2],U),V.fillRect(0,0,j.width,j.height);var N=a.zoom();B(V,!1),V.clearRect(j.mpan.x,j.mpan.y,j.width/j.zoom/d,j.height/j.zoom/d),V.drawImage(Q,j.mpan.x,j.mpan.y,j.width/j.zoom/d,j.height/j.zoom/d)}else e.textureOnViewport&&!r&&(e.textureCache=null);var F=a.extent(),K=e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming||e.hoverData.draggingEles||e.cy.animated(),J=e.hideEdgesOnViewport&&K,k=[];if(k[e.NODE]=!h[e.NODE]&&m&&!e.clearedForMotionBlur[e.NODE]||e.clearingMotionBlur,k[e.NODE]&&(e.clearedForMotionBlur[e.NODE]=!0),k[e.DRAG]=!h[e.DRAG]&&m&&!e.clearedForMotionBlur[e.DRAG]||e.clearingMotionBlur,k[e.DRAG]&&(e.clearedForMotionBlur[e.DRAG]=!0),h[e.NODE]||i||s||k[e.NODE]){var G=m&&!k[e.NODE]&&y!==1,V=r||(G?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]:f.contexts[e.NODE]),X=m&&!G?"motionBlur":void 0;B(V,X),J?e.drawCachedNodes(V,z.nondrag,d,F):e.drawLayeredElements(V,z.nondrag,d,F),e.debug&&e.drawDebugPoints(V,z.nondrag),!i&&!m&&(h[e.NODE]=!1)}if(!s&&(h[e.DRAG]||i||k[e.DRAG])){var G=m&&!k[e.DRAG]&&y!==1,V=r||(G?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG]:f.contexts[e.DRAG]);B(V,m&&!G?"motionBlur":void 0),J?e.drawCachedNodes(V,z.drag,d,F):e.drawCachedElements(V,z.drag,d,F),e.debug&&e.drawDebugPoints(V,z.drag),!i&&!m&&(h[e.DRAG]=!1)}if(this.drawSelectionRectangle(t,B),m&&y!==1){var W=f.contexts[e.NODE],$=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE],ee=f.contexts[e.DRAG],ie=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG],he=function(ae,re,le){ae.setTransform(1,0,0,1,0,0),le||!T?ae.clearRect(0,0,e.canvasWidth,e.canvasHeight):_(ae,0,0,e.canvasWidth,e.canvasHeight);var se=y;ae.drawImage(re,0,0,e.canvasWidth*se,e.canvasHeight*se,0,0,e.canvasWidth,e.canvasHeight)};(h[e.NODE]||k[e.NODE])&&(he(W,$,k[e.NODE]),h[e.NODE]=!1),(h[e.DRAG]||k[e.DRAG])&&(he(ee,ie,k[e.DRAG]),h[e.DRAG]=!1)}e.prevViewport=j,e.clearingMotionBlur&&(e.clearingMotionBlur=!1,e.motionBlurCleared=!0,e.motionBlur=!0),m&&(e.motionBlurTimeout=setTimeout(function(){e.motionBlurTimeout=null,e.clearedForMotionBlur[e.NODE]=!1,e.clearedForMotionBlur[e.DRAG]=!1,e.motionBlur=!1,e.clearingMotionBlur=!p,e.mbFrames=0,h[e.NODE]=!0,h[e.DRAG]=!0,e.redraw()},EL)),r||a.emit("render")};var Lu;ir.drawSelectionRectangle=function(t,e){var a=this,r=a.cy,i=a.data,s=r.style(),o=t.drawOnlyNodeLayer,u=t.drawAllLayers,d=i.canvasNeedsRedraw,f=t.forcedContext;if(a.showFps||!o&&d[a.SELECT_BOX]&&!u){var h=f||i.contexts[a.SELECT_BOX];if(e(h),a.selection[4]==1&&(a.hoverData.selecting||a.touchData.selecting)){var p=a.cy.zoom(),m=s.core("selection-box-border-width").value/p;h.lineWidth=m,h.fillStyle="rgba("+s.core("selection-box-color").value[0]+","+s.core("selection-box-color").value[1]+","+s.core("selection-box-color").value[2]+","+s.core("selection-box-opacity").value+")",h.fillRect(a.selection[0],a.selection[1],a.selection[2]-a.selection[0],a.selection[3]-a.selection[1]),m>0&&(h.strokeStyle="rgba("+s.core("selection-box-border-color").value[0]+","+s.core("selection-box-border-color").value[1]+","+s.core("selection-box-border-color").value[2]+","+s.core("selection-box-opacity").value+")",h.strokeRect(a.selection[0],a.selection[1],a.selection[2]-a.selection[0],a.selection[3]-a.selection[1]))}if(i.bgActivePosistion&&!a.hoverData.selecting){var p=a.cy.zoom(),y=i.bgActivePosistion;h.fillStyle="rgba("+s.core("active-bg-color").value[0]+","+s.core("active-bg-color").value[1]+","+s.core("active-bg-color").value[2]+","+s.core("active-bg-opacity").value+")",h.beginPath(),h.arc(y.x,y.y,s.core("active-bg-size").pfValue/p,0,2*Math.PI),h.fill()}var x=a.lastRedrawTime;if(a.showFps&&x){x=Math.round(x);var E=Math.round(1e3/x),S="1 frame = "+x+" ms = "+E+" fps";if(h.setTransform(1,0,0,1,0,0),h.fillStyle="rgba(255, 0, 0, 0.75)",h.strokeStyle="rgba(255, 0, 0, 0.75)",h.font="30px Arial",!Lu){var T=h.measureText(S);Lu=T.actualBoundingBoxAscent}h.fillText(S,0,Lu);var C=60;h.strokeRect(0,Lu+10,250,20),h.fillRect(0,Lu+10,250*Math.min(E/C,1),20)}u||(d[a.SELECT_BOX]=!1)}};function JS(t,e,a){var r=t.createShader(e);if(t.shaderSource(r,a),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS))throw new Error(t.getShaderInfoLog(r));return r}function TL(t,e,a){var r=JS(t,t.VERTEX_SHADER,e),i=JS(t,t.FRAGMENT_SHADER,a),s=t.createProgram();if(t.attachShader(s,r),t.attachShader(s,i),t.linkProgram(s),!t.getProgramParameter(s,t.LINK_STATUS))throw new Error("Could not initialize shaders");return s}function CL(t,e,a){a===void 0&&(a=e);var r=t.makeOffscreenCanvas(e,a),i=r.context=r.getContext("2d");return r.clear=function(){return i.clearRect(0,0,r.width,r.height)},r.clear(),r}function iy(t){var e=t.pixelRatio,a=t.cy.zoom(),r=t.cy.pan();return{zoom:a*e,pan:{x:r.x*e,y:r.y*e}}}function NL(t){var e=t.pixelRatio,a=t.cy.zoom();return a*e}function jL(t,e,a,r,i){var s=r*a+e.x,o=i*a+e.y;return o=Math.round(t.canvasHeight-o),[s,o]}function AL(t){return t.pstyle("background-fill").value!=="solid"||t.pstyle("background-image").strValue!=="none"?!1:t.pstyle("border-width").value===0||t.pstyle("border-opacity").value===0?!0:t.pstyle("border-style").value==="solid"}function ML(t,e){if(t.length!==e.length)return!1;for(var a=0;a<t.length;a++)if(t[a]!==e[a])return!1;return!0}function Rs(t,e,a){var r=t[0]/255,i=t[1]/255,s=t[2]/255,o=e,u=a||new Array(4);return u[0]=r*o,u[1]=i*o,u[2]=s*o,u[3]=o,u}function Xl(t,e){var a=e||new Array(4);return a[0]=(t>>0&255)/255,a[1]=(t>>8&255)/255,a[2]=(t>>16&255)/255,a[3]=(t>>24&255)/255,a}function DL(t){return t[0]+(t[1]<<8)+(t[2]<<16)+(t[3]<<24)}function OL(t,e){var a=t.createTexture();return a.buffer=function(r){t.bindTexture(t.TEXTURE_2D,a),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR_MIPMAP_NEAREST),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r),t.generateMipmap(t.TEXTURE_2D),t.bindTexture(t.TEXTURE_2D,null)},a.deleteTexture=function(){t.deleteTexture(a)},a}function dN(t,e){switch(e){case"float":return[1,t.FLOAT,4];case"vec2":return[2,t.FLOAT,4];case"vec3":return[3,t.FLOAT,4];case"vec4":return[4,t.FLOAT,4];case"int":return[1,t.INT,4];case"ivec2":return[2,t.INT,4]}}function fN(t,e,a){switch(e){case t.FLOAT:return new Float32Array(a);case t.INT:return new Int32Array(a)}}function RL(t,e,a,r,i,s){switch(e){case t.FLOAT:return new Float32Array(a.buffer,s*r,i);case t.INT:return new Int32Array(a.buffer,s*r,i)}}function kL(t,e,a,r){var i=dN(t,e),s=ma(i,2),o=s[0],u=s[1],d=fN(t,u,r),f=t.createBuffer();return t.bindBuffer(t.ARRAY_BUFFER,f),t.bufferData(t.ARRAY_BUFFER,d,t.STATIC_DRAW),u===t.FLOAT?t.vertexAttribPointer(a,o,u,!1,0,0):u===t.INT&&t.vertexAttribIPointer(a,o,u,0,0),t.enableVertexAttribArray(a),t.bindBuffer(t.ARRAY_BUFFER,null),f}function hn(t,e,a,r){var i=dN(t,a),s=ma(i,3),o=s[0],u=s[1],d=s[2],f=fN(t,u,e*o),h=o*d,p=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,p),t.bufferData(t.ARRAY_BUFFER,e*h,t.DYNAMIC_DRAW),t.enableVertexAttribArray(r),u===t.FLOAT?t.vertexAttribPointer(r,o,u,!1,h,0):u===t.INT&&t.vertexAttribIPointer(r,o,u,h,0),t.vertexAttribDivisor(r,1),t.bindBuffer(t.ARRAY_BUFFER,null);for(var m=new Array(e),y=0;y<e;y++)m[y]=RL(t,u,f,h,o,y);return p.dataArray=f,p.stride=h,p.size=o,p.getView=function(x){return m[x]},p.setPoint=function(x,E,S){var T=m[x];T[0]=E,T[1]=S},p.bufferSubData=function(x){t.bindBuffer(t.ARRAY_BUFFER,p),x?t.bufferSubData(t.ARRAY_BUFFER,0,f,0,x*o):t.bufferSubData(t.ARRAY_BUFFER,0,f)},p}function BL(t,e,a){for(var r=9,i=new Float32Array(e*r),s=new Array(e),o=0;o<e;o++){var u=o*r*4;s[o]=new Float32Array(i.buffer,u,r)}var d=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,d),t.bufferData(t.ARRAY_BUFFER,i.byteLength,t.DYNAMIC_DRAW);for(var f=0;f<3;f++){var h=a+f;t.enableVertexAttribArray(h),t.vertexAttribPointer(h,3,t.FLOAT,!1,36,f*12),t.vertexAttribDivisor(h,1)}return t.bindBuffer(t.ARRAY_BUFFER,null),d.getMatrixView=function(p){return s[p]},d.setData=function(p,m){s[m].set(p,0)},d.bufferSubData=function(){t.bindBuffer(t.ARRAY_BUFFER,d),t.bufferSubData(t.ARRAY_BUFFER,0,i)},d}function LL(t){var e=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,e);var a=t.createTexture();return t.bindTexture(t.TEXTURE_2D,a),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,a,0),t.bindFramebuffer(t.FRAMEBUFFER,null),e.setFramebufferAttachmentSizes=function(r,i){t.bindTexture(t.TEXTURE_2D,a),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,r,i,0,t.RGBA,t.UNSIGNED_BYTE,null)},e}var eE=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});function dm(){var t=new eE(9);return eE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function tE(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function zL(t,e,a){var r=e[0],i=e[1],s=e[2],o=e[3],u=e[4],d=e[5],f=e[6],h=e[7],p=e[8],m=a[0],y=a[1],x=a[2],E=a[3],S=a[4],T=a[5],C=a[6],N=a[7],A=a[8];return t[0]=m*r+y*o+x*f,t[1]=m*i+y*u+x*h,t[2]=m*s+y*d+x*p,t[3]=E*r+S*o+T*f,t[4]=E*i+S*u+T*h,t[5]=E*s+S*d+T*p,t[6]=C*r+N*o+A*f,t[7]=C*i+N*u+A*h,t[8]=C*s+N*d+A*p,t}function Nf(t,e,a){var r=e[0],i=e[1],s=e[2],o=e[3],u=e[4],d=e[5],f=e[6],h=e[7],p=e[8],m=a[0],y=a[1];return t[0]=r,t[1]=i,t[2]=s,t[3]=o,t[4]=u,t[5]=d,t[6]=m*r+y*o+f,t[7]=m*i+y*u+h,t[8]=m*s+y*d+p,t}function aE(t,e,a){var r=e[0],i=e[1],s=e[2],o=e[3],u=e[4],d=e[5],f=e[6],h=e[7],p=e[8],m=Math.sin(a),y=Math.cos(a);return t[0]=y*r+m*o,t[1]=y*i+m*u,t[2]=y*s+m*d,t[3]=y*o-m*r,t[4]=y*u-m*i,t[5]=y*d-m*s,t[6]=f,t[7]=h,t[8]=p,t}function o0(t,e,a){var r=a[0],i=a[1];return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=i*e[3],t[4]=i*e[4],t[5]=i*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function PL(t,e,a){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/a,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t}var _L=(function(){function t(e,a,r,i){us(this,t),this.debugID=Math.floor(Math.random()*1e4),this.r=e,this.texSize=a,this.texRows=r,this.texHeight=Math.floor(a/r),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=i(e,a,a),this.scratch=i(e,a,this.texHeight,"scratch")}return cs(t,[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(a){var r=a.w,i=a.h,s=this.texHeight,o=this.texSize,u=s/i,d=r*u,f=i*u;return d>o&&(u=o/r,d=r*u,f=i*u),{scale:u,texW:d,texH:f}}},{key:"draw",value:function(a,r,i){var s=this;if(this.locked)throw new Error("can't draw, atlas is locked");var o=this.texSize,u=this.texRows,d=this.texHeight,f=this.getScale(r),h=f.scale,p=f.texW,m=f.texH,y=function(N,A){if(i&&A){var M=A.context,D=N.x,j=N.row,R=D,L=d*j;M.save(),M.translate(R,L),M.scale(h,h),i(M,r),M.restore()}},x=[null,null],E=function(){y(s.freePointer,s.canvas),x[0]={x:s.freePointer.x,y:s.freePointer.row*d,w:p,h:m},x[1]={x:s.freePointer.x+p,y:s.freePointer.row*d,w:0,h:m},s.freePointer.x+=p,s.freePointer.x==o&&(s.freePointer.x=0,s.freePointer.row++)},S=function(){var N=s.scratch,A=s.canvas;N.clear(),y({x:0,row:0},N);var M=o-s.freePointer.x,D=p-M,j=d;{var R=s.freePointer.x,L=s.freePointer.row*d,z=M;A.context.drawImage(N,0,0,z,j,R,L,z,j),x[0]={x:R,y:L,w:z,h:m}}{var _=M,B=(s.freePointer.row+1)*d,q=D;A&&A.context.drawImage(N,_,0,q,j,0,B,q,j),x[1]={x:0,y:B,w:q,h:m}}s.freePointer.x=D,s.freePointer.row++},T=function(){s.freePointer.x=0,s.freePointer.row++};if(this.freePointer.x+p<=o)E();else{if(this.freePointer.row>=u-1)return!1;this.freePointer.x===o?(T(),E()):this.enableWrapping?S():(T(),E())}return this.keyToLocation.set(a,x),this.needsBuffer=!0,x}},{key:"getOffsets",value:function(a){return this.keyToLocation.get(a)}},{key:"isEmpty",value:function(){return this.freePointer.x===0&&this.freePointer.row===0}},{key:"canFit",value:function(a){if(this.locked)return!1;var r=this.texSize,i=this.texRows,s=this.getScale(a),o=s.texW;return this.freePointer.x+o>r?this.freePointer.row<i-1:!0}},{key:"bufferIfNeeded",value:function(a){this.texture||(this.texture=OL(a,this.debugID)),this.needsBuffer&&(this.texture.buffer(this.canvas),this.needsBuffer=!1,this.locked&&(this.canvas=null,this.scratch=null))}},{key:"dispose",value:function(){this.texture&&(this.texture.deleteTexture(),this.texture=null),this.canvas=null,this.scratch=null,this.locked=!0}}])})(),UL=(function(){function t(e,a,r,i){us(this,t),this.r=e,this.texSize=a,this.texRows=r,this.createTextureCanvas=i,this.atlases=[],this.styleKeyToAtlas=new Map,this.markedKeys=new Set}return cs(t,[{key:"getKeys",value:function(){return new Set(this.styleKeyToAtlas.keys())}},{key:"_createAtlas",value:function(){var a=this.r,r=this.texSize,i=this.texRows,s=this.createTextureCanvas;return new _L(a,r,i,s)}},{key:"_getScratchCanvas",value:function(){if(!this.scratch){var a=this.r,r=this.texSize,i=this.texRows,s=this.createTextureCanvas,o=Math.floor(r/i);this.scratch=s(a,r,o,"scratch")}return this.scratch}},{key:"draw",value:function(a,r,i){var s=this.styleKeyToAtlas.get(a);return s||(s=this.atlases[this.atlases.length-1],(!s||!s.canFit(r))&&(s&&s.lock(),s=this._createAtlas(),this.atlases.push(s)),s.draw(a,r,i),this.styleKeyToAtlas.set(a,s)),s}},{key:"getAtlas",value:function(a){return this.styleKeyToAtlas.get(a)}},{key:"hasAtlas",value:function(a){return this.styleKeyToAtlas.has(a)}},{key:"markKeyForGC",value:function(a){this.markedKeys.add(a)}},{key:"gc",value:function(){var a=this,r=this.markedKeys;if(r.size===0){console.log("nothing to garbage collect");return}var i=[],s=new Map,o=null,u=yr(this.atlases),d;try{var f=function(){var p=d.value,m=p.getKeys(),y=qL(r,m);if(y.size===0)return i.push(p),m.forEach(function(M){return s.set(M,p)}),1;o||(o=a._createAtlas(),i.push(o));var x=yr(m),E;try{for(x.s();!(E=x.n()).done;){var S=E.value;if(!y.has(S)){var T=p.getOffsets(S),C=ma(T,2),N=C[0],A=C[1];o.canFit({w:N.w+A.w,h:N.h})||(o.lock(),o=a._createAtlas(),i.push(o)),p.canvas&&(a._copyTextureToNewAtlas(S,p,o),s.set(S,o))}}}catch(M){x.e(M)}finally{x.f()}p.dispose()};for(u.s();!(d=u.n()).done;)f()}catch(h){u.e(h)}finally{u.f()}this.atlases=i,this.styleKeyToAtlas=s,this.markedKeys=new Set}},{key:"_copyTextureToNewAtlas",value:function(a,r,i){var s=r.getOffsets(a),o=ma(s,2),u=o[0],d=o[1];if(d.w===0)i.draw(a,u,function(m){m.drawImage(r.canvas,u.x,u.y,u.w,u.h,0,0,u.w,u.h)});else{var f=this._getScratchCanvas();f.clear(),f.context.drawImage(r.canvas,u.x,u.y,u.w,u.h,0,0,u.w,u.h),f.context.drawImage(r.canvas,d.x,d.y,d.w,d.h,u.w,0,d.w,d.h);var h=u.w+d.w,p=u.h;i.draw(a,{w:h,h:p},function(m){m.drawImage(f,0,0,h,p,0,0,h,p)})}}},{key:"getCounts",value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}])})();function qL(t,e){return t.intersection?t.intersection(e):new Set(Bf(t).filter(function(a){return e.has(a)}))}var IL=(function(){function t(e,a){us(this,t),this.r=e,this.globalOptions=a,this.atlasSize=a.webglTexSize,this.maxAtlasesPerBatch=a.webglTexPerBatch,this.renderTypes=new Map,this.collections=new Map,this.typeAndIdToKey=new Map}return cs(t,[{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"addAtlasCollection",value:function(a,r){var i=this.globalOptions,s=i.webglTexSize,o=i.createTextureCanvas,u=r.texRows,d=this._cacheScratchCanvas(o),f=new UL(this.r,s,u,d);this.collections.set(a,f)}},{key:"addRenderType",value:function(a,r){var i=r.collection;if(!this.collections.has(i))throw new Error("invalid atlas collection name '".concat(i,"'"));var s=this.collections.get(i),o=et({type:a,atlasCollection:s},r);this.renderTypes.set(a,o)}},{key:"getRenderTypeOpts",value:function(a){return this.renderTypes.get(a)}},{key:"getAtlasCollection",value:function(a){return this.collections.get(a)}},{key:"_cacheScratchCanvas",value:function(a){var r=-1,i=-1,s=null;return function(o,u,d,f){return f?((!s||u!=r||d!=i)&&(r=u,i=d,s=a(o,u,d)),s):a(o,u,d)}}},{key:"_key",value:function(a,r){return"".concat(a,"-").concat(r)}},{key:"invalidate",value:function(a){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=i.forceRedraw,o=s===void 0?!1:s,u=i.filterEle,d=u===void 0?function(){return!0}:u,f=i.filterType,h=f===void 0?function(){return!0}:f,p=!1,m=!1,y=yr(a),x;try{for(y.s();!(x=y.n()).done;){var E=x.value;if(d(E)){var S=yr(this.renderTypes.values()),T;try{var C=function(){var A=T.value,M=A.type;if(h(M)){var D=r.collections.get(A.collection),j=A.getKey(E),R=Array.isArray(j)?j:[j];if(o)R.forEach(function(B){return D.markKeyForGC(B)}),m=!0;else{var L=A.getID?A.getID(E):E.id(),z=r._key(M,L),_=r.typeAndIdToKey.get(z);_!==void 0&&!ML(R,_)&&(p=!0,r.typeAndIdToKey.delete(z),_.forEach(function(B){return D.markKeyForGC(B)}))}}};for(S.s();!(T=S.n()).done;)C()}catch(N){S.e(N)}finally{S.f()}}}}catch(N){y.e(N)}finally{y.f()}return m&&(this.gc(),p=!1),p}},{key:"gc",value:function(){var a=yr(this.collections.values()),r;try{for(a.s();!(r=a.n()).done;){var i=r.value;i.gc()}}catch(s){a.e(s)}finally{a.f()}}},{key:"getOrCreateAtlas",value:function(a,r,i,s){var o=this.renderTypes.get(r),u=this.collections.get(o.collection),d=!1,f=u.draw(s,i,function(m){o.drawClipped?(m.save(),m.beginPath(),m.rect(0,0,i.w,i.h),m.clip(),o.drawElement(m,a,i,!0,!0),m.restore()):o.drawElement(m,a,i,!0,!0),d=!0});if(d){var h=o.getID?o.getID(a):a.id(),p=this._key(r,h);this.typeAndIdToKey.has(p)?this.typeAndIdToKey.get(p).push(s):this.typeAndIdToKey.set(p,[s])}return f}},{key:"getAtlasInfo",value:function(a,r){var i=this,s=this.renderTypes.get(r),o=s.getKey(a),u=Array.isArray(o)?o:[o];return u.map(function(d){var f=s.getBoundingBox(a,d),h=i.getOrCreateAtlas(a,r,f,d),p=h.getOffsets(d),m=ma(p,2),y=m[0],x=m[1];return{atlas:h,tex:y,tex1:y,tex2:x,bb:f}})}},{key:"getDebugInfo",value:function(){var a=[],r=yr(this.collections),i;try{for(r.s();!(i=r.n()).done;){var s=ma(i.value,2),o=s[0],u=s[1],d=u.getCounts(),f=d.keyCount,h=d.atlasCount;a.push({type:o,keyCount:f,atlasCount:h})}}catch(p){r.e(p)}finally{r.f()}return a}}])})(),VL=(function(){function t(e){us(this,t),this.globalOptions=e,this.atlasSize=e.webglTexSize,this.maxAtlasesPerBatch=e.webglTexPerBatch,this.batchAtlases=[]}return cs(t,[{key:"getMaxAtlasesPerBatch",value:function(){return this.maxAtlasesPerBatch}},{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"getIndexArray",value:function(){return Array.from({length:this.maxAtlasesPerBatch},function(a,r){return r})}},{key:"startBatch",value:function(){this.batchAtlases=[]}},{key:"getAtlasCount",value:function(){return this.batchAtlases.length}},{key:"getAtlases",value:function(){return this.batchAtlases}},{key:"canAddToCurrentBatch",value:function(a){return this.batchAtlases.length===this.maxAtlasesPerBatch?this.batchAtlases.includes(a):!0}},{key:"getAtlasIndexForBatch",value:function(a){var r=this.batchAtlases.indexOf(a);if(r<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw new Error("cannot add more atlases to batch");this.batchAtlases.push(a),r=this.batchAtlases.length-1}return r}}])})(),FL=`
|
|
96
|
+
float circleSD(vec2 p, float r) {
|
|
97
|
+
return distance(vec2(0), p) - r; // signed distance
|
|
98
|
+
}
|
|
99
|
+
`,HL=`
|
|
100
|
+
float rectangleSD(vec2 p, vec2 b) {
|
|
101
|
+
vec2 d = abs(p)-b;
|
|
102
|
+
return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);
|
|
103
|
+
}
|
|
104
|
+
`,GL=`
|
|
105
|
+
float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {
|
|
106
|
+
cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;
|
|
107
|
+
cr.x = (p.y > 0.0) ? cr.x : cr.y;
|
|
108
|
+
vec2 q = abs(p) - b + cr.x;
|
|
109
|
+
return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;
|
|
110
|
+
}
|
|
111
|
+
`,QL=`
|
|
112
|
+
float ellipseSD(vec2 p, vec2 ab) {
|
|
113
|
+
p = abs( p ); // symmetry
|
|
114
|
+
|
|
115
|
+
// find root with Newton solver
|
|
116
|
+
vec2 q = ab*(p-ab);
|
|
117
|
+
float w = (q.x<q.y)? 1.570796327 : 0.0;
|
|
118
|
+
for( int i=0; i<5; i++ ) {
|
|
119
|
+
vec2 cs = vec2(cos(w),sin(w));
|
|
120
|
+
vec2 u = ab*vec2( cs.x,cs.y);
|
|
121
|
+
vec2 v = ab*vec2(-cs.y,cs.x);
|
|
122
|
+
w = w + dot(p-u,v)/(dot(p-u,u)+dot(v,v));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// compute final point and distance
|
|
126
|
+
float d = length(p-ab*vec2(cos(w),sin(w)));
|
|
127
|
+
|
|
128
|
+
// return signed distance
|
|
129
|
+
return (dot(p/ab,p/ab)>1.0) ? d : -d;
|
|
130
|
+
}
|
|
131
|
+
`,Gu={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},Qf={IGNORE:1,USE_BB:2},fm=0,rE=1,nE=2,hm=3,Zl=4,cf=5,zu=6,Pu=7,YL=(function(){function t(e,a,r){us(this,t),this.r=e,this.gl=a,this.maxInstances=r.webglBatchSize,this.atlasSize=r.webglTexSize,this.bgColor=r.bgColor,this.debug=r.webglDebug,this.batchDebugInfo=[],r.enableWrapping=!0,r.createTextureCanvas=CL,this.atlasManager=new IL(e,r),this.batchManager=new VL(r),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(Gu.SCREEN),this.pickingProgram=this._createShaderProgram(Gu.PICKING),this.vao=this._createVAO()}return cs(t,[{key:"addAtlasCollection",value:function(a,r){this.atlasManager.addAtlasCollection(a,r)}},{key:"addTextureAtlasRenderType",value:function(a,r){this.atlasManager.addRenderType(a,r)}},{key:"addSimpleShapeRenderType",value:function(a,r){this.simpleShapeOptions.set(a,r)}},{key:"invalidate",value:function(a){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=r.type,s=this.atlasManager;return i?s.invalidate(a,{filterType:function(u){return u===i},forceRedraw:!0}):s.invalidate(a)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(a){var r=this.gl,i=`#version 300 es
|
|
132
|
+
precision highp float;
|
|
133
|
+
|
|
134
|
+
uniform mat3 uPanZoomMatrix;
|
|
135
|
+
uniform int uAtlasSize;
|
|
136
|
+
|
|
137
|
+
// instanced
|
|
138
|
+
in vec2 aPosition; // a vertex from the unit square
|
|
139
|
+
|
|
140
|
+
in mat3 aTransform; // used to transform verticies, eg into a bounding box
|
|
141
|
+
in int aVertType; // the type of thing we are rendering
|
|
142
|
+
|
|
143
|
+
// the z-index that is output when using picking mode
|
|
144
|
+
in vec4 aIndex;
|
|
145
|
+
|
|
146
|
+
// For textures
|
|
147
|
+
in int aAtlasId; // which shader unit/atlas to use
|
|
148
|
+
in vec4 aTex; // x/y/w/h of texture in atlas
|
|
149
|
+
|
|
150
|
+
// for edges
|
|
151
|
+
in vec4 aPointAPointB;
|
|
152
|
+
in vec4 aPointCPointD;
|
|
153
|
+
in vec2 aLineWidth; // also used for node border width
|
|
154
|
+
|
|
155
|
+
// simple shapes
|
|
156
|
+
in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]
|
|
157
|
+
in vec4 aColor; // also used for edges
|
|
158
|
+
in vec4 aBorderColor; // aLineWidth is used for border width
|
|
159
|
+
|
|
160
|
+
// output values passed to the fragment shader
|
|
161
|
+
out vec2 vTexCoord;
|
|
162
|
+
out vec4 vColor;
|
|
163
|
+
out vec2 vPosition;
|
|
164
|
+
// flat values are not interpolated
|
|
165
|
+
flat out int vAtlasId;
|
|
166
|
+
flat out int vVertType;
|
|
167
|
+
flat out vec2 vTopRight;
|
|
168
|
+
flat out vec2 vBotLeft;
|
|
169
|
+
flat out vec4 vCornerRadius;
|
|
170
|
+
flat out vec4 vBorderColor;
|
|
171
|
+
flat out vec2 vBorderWidth;
|
|
172
|
+
flat out vec4 vIndex;
|
|
173
|
+
|
|
174
|
+
void main(void) {
|
|
175
|
+
int vid = gl_VertexID;
|
|
176
|
+
vec2 position = aPosition; // TODO make this a vec3, simplifies some code below
|
|
177
|
+
|
|
178
|
+
if(aVertType == `.concat(fm,`) {
|
|
179
|
+
float texX = aTex.x; // texture coordinates
|
|
180
|
+
float texY = aTex.y;
|
|
181
|
+
float texW = aTex.z;
|
|
182
|
+
float texH = aTex.w;
|
|
183
|
+
|
|
184
|
+
if(vid == 1 || vid == 2 || vid == 4) {
|
|
185
|
+
texX += texW;
|
|
186
|
+
}
|
|
187
|
+
if(vid == 2 || vid == 4 || vid == 5) {
|
|
188
|
+
texY += texH;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
float d = float(uAtlasSize);
|
|
192
|
+
vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1
|
|
193
|
+
|
|
194
|
+
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
|
|
195
|
+
}
|
|
196
|
+
else if(aVertType == `).concat(Zl," || aVertType == ").concat(Pu,`
|
|
197
|
+
|| aVertType == `).concat(cf," || aVertType == ").concat(zu,`) { // simple shapes
|
|
198
|
+
|
|
199
|
+
// the bounding box is needed by the fragment shader
|
|
200
|
+
vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat
|
|
201
|
+
vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat
|
|
202
|
+
vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated
|
|
203
|
+
|
|
204
|
+
// calculations are done in the fragment shader, just pass these along
|
|
205
|
+
vColor = aColor;
|
|
206
|
+
vCornerRadius = aCornerRadius;
|
|
207
|
+
vBorderColor = aBorderColor;
|
|
208
|
+
vBorderWidth = aLineWidth;
|
|
209
|
+
|
|
210
|
+
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
|
|
211
|
+
}
|
|
212
|
+
else if(aVertType == `).concat(rE,`) {
|
|
213
|
+
vec2 source = aPointAPointB.xy;
|
|
214
|
+
vec2 target = aPointAPointB.zw;
|
|
215
|
+
|
|
216
|
+
// adjust the geometry so that the line is centered on the edge
|
|
217
|
+
position.y = position.y - 0.5;
|
|
218
|
+
|
|
219
|
+
// stretch the unit square into a long skinny rectangle
|
|
220
|
+
vec2 xBasis = target - source;
|
|
221
|
+
vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));
|
|
222
|
+
vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;
|
|
223
|
+
|
|
224
|
+
gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);
|
|
225
|
+
vColor = aColor;
|
|
226
|
+
}
|
|
227
|
+
else if(aVertType == `).concat(nE,`) {
|
|
228
|
+
vec2 pointA = aPointAPointB.xy;
|
|
229
|
+
vec2 pointB = aPointAPointB.zw;
|
|
230
|
+
vec2 pointC = aPointCPointD.xy;
|
|
231
|
+
vec2 pointD = aPointCPointD.zw;
|
|
232
|
+
|
|
233
|
+
// adjust the geometry so that the line is centered on the edge
|
|
234
|
+
position.y = position.y - 0.5;
|
|
235
|
+
|
|
236
|
+
vec2 p0, p1, p2, pos;
|
|
237
|
+
if(position.x == 0.0) { // The left side of the unit square
|
|
238
|
+
p0 = pointA;
|
|
239
|
+
p1 = pointB;
|
|
240
|
+
p2 = pointC;
|
|
241
|
+
pos = position;
|
|
242
|
+
} else { // The right side of the unit square, use same approach but flip the geometry upside down
|
|
243
|
+
p0 = pointD;
|
|
244
|
+
p1 = pointC;
|
|
245
|
+
p2 = pointB;
|
|
246
|
+
pos = vec2(0.0, -position.y);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
vec2 p01 = p1 - p0;
|
|
250
|
+
vec2 p12 = p2 - p1;
|
|
251
|
+
vec2 p21 = p1 - p2;
|
|
252
|
+
|
|
253
|
+
// Find the normal vector.
|
|
254
|
+
vec2 tangent = normalize(normalize(p12) + normalize(p01));
|
|
255
|
+
vec2 normal = vec2(-tangent.y, tangent.x);
|
|
256
|
+
|
|
257
|
+
// Find the vector perpendicular to p0 -> p1.
|
|
258
|
+
vec2 p01Norm = normalize(vec2(-p01.y, p01.x));
|
|
259
|
+
|
|
260
|
+
// Determine the bend direction.
|
|
261
|
+
float sigma = sign(dot(p01 + p21, normal));
|
|
262
|
+
float width = aLineWidth[0];
|
|
263
|
+
|
|
264
|
+
if(sign(pos.y) == -sigma) {
|
|
265
|
+
// This is an intersecting vertex. Adjust the position so that there's no overlap.
|
|
266
|
+
vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);
|
|
267
|
+
gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
|
|
268
|
+
} else {
|
|
269
|
+
// This is a non-intersecting vertex. Treat it like a mitre join.
|
|
270
|
+
vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);
|
|
271
|
+
gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
vColor = aColor;
|
|
275
|
+
}
|
|
276
|
+
else if(aVertType == `).concat(hm,` && vid < 3) {
|
|
277
|
+
// massage the first triangle into an edge arrow
|
|
278
|
+
if(vid == 0)
|
|
279
|
+
position = vec2(-0.15, -0.3);
|
|
280
|
+
if(vid == 1)
|
|
281
|
+
position = vec2( 0.0, 0.0);
|
|
282
|
+
if(vid == 2)
|
|
283
|
+
position = vec2( 0.15, -0.3);
|
|
284
|
+
|
|
285
|
+
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
|
|
286
|
+
vColor = aColor;
|
|
287
|
+
}
|
|
288
|
+
else {
|
|
289
|
+
gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
vAtlasId = aAtlasId;
|
|
293
|
+
vVertType = aVertType;
|
|
294
|
+
vIndex = aIndex;
|
|
295
|
+
}
|
|
296
|
+
`),s=this.batchManager.getIndexArray(),o=`#version 300 es
|
|
297
|
+
precision highp float;
|
|
298
|
+
|
|
299
|
+
// declare texture unit for each texture atlas in the batch
|
|
300
|
+
`.concat(s.map(function(f){return"uniform sampler2D uTexture".concat(f,";")}).join(`
|
|
301
|
+
`),`
|
|
302
|
+
|
|
303
|
+
uniform vec4 uBGColor;
|
|
304
|
+
uniform float uZoom;
|
|
305
|
+
|
|
306
|
+
in vec2 vTexCoord;
|
|
307
|
+
in vec4 vColor;
|
|
308
|
+
in vec2 vPosition; // model coordinates
|
|
309
|
+
|
|
310
|
+
flat in int vAtlasId;
|
|
311
|
+
flat in vec4 vIndex;
|
|
312
|
+
flat in int vVertType;
|
|
313
|
+
flat in vec2 vTopRight;
|
|
314
|
+
flat in vec2 vBotLeft;
|
|
315
|
+
flat in vec4 vCornerRadius;
|
|
316
|
+
flat in vec4 vBorderColor;
|
|
317
|
+
flat in vec2 vBorderWidth;
|
|
318
|
+
|
|
319
|
+
out vec4 outColor;
|
|
320
|
+
|
|
321
|
+
`).concat(FL,`
|
|
322
|
+
`).concat(HL,`
|
|
323
|
+
`).concat(GL,`
|
|
324
|
+
`).concat(QL,`
|
|
325
|
+
|
|
326
|
+
vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha
|
|
327
|
+
return vec4(
|
|
328
|
+
top.rgb + (bot.rgb * (1.0 - top.a)),
|
|
329
|
+
top.a + (bot.a * (1.0 - top.a))
|
|
330
|
+
);
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance
|
|
334
|
+
// scale to the zoom level so that borders don't look blurry when zoomed in
|
|
335
|
+
// note 1.5 is an aribitrary value chosen because it looks good
|
|
336
|
+
return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d)));
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
void main(void) {
|
|
340
|
+
if(vVertType == `).concat(fm,`) {
|
|
341
|
+
// look up the texel from the texture unit
|
|
342
|
+
`).concat(s.map(function(f){return"if(vAtlasId == ".concat(f,") outColor = texture(uTexture").concat(f,", vTexCoord);")}).join(`
|
|
343
|
+
else `),`
|
|
344
|
+
}
|
|
345
|
+
else if(vVertType == `).concat(hm,`) {
|
|
346
|
+
// mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';
|
|
347
|
+
outColor = blend(vColor, uBGColor);
|
|
348
|
+
outColor.a = 1.0; // make opaque, masks out line under arrow
|
|
349
|
+
}
|
|
350
|
+
else if(vVertType == `).concat(Zl,` && vBorderWidth == vec2(0.0)) { // simple rectangle with no border
|
|
351
|
+
outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done
|
|
352
|
+
}
|
|
353
|
+
else if(vVertType == `).concat(Zl," || vVertType == ").concat(Pu,`
|
|
354
|
+
|| vVertType == `).concat(cf," || vVertType == ").concat(zu,`) { // use SDF
|
|
355
|
+
|
|
356
|
+
float outerBorder = vBorderWidth[0];
|
|
357
|
+
float innerBorder = vBorderWidth[1];
|
|
358
|
+
float borderPadding = outerBorder * 2.0;
|
|
359
|
+
float w = vTopRight.x - vBotLeft.x - borderPadding;
|
|
360
|
+
float h = vTopRight.y - vBotLeft.y - borderPadding;
|
|
361
|
+
vec2 b = vec2(w/2.0, h/2.0); // half width, half height
|
|
362
|
+
vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center
|
|
363
|
+
|
|
364
|
+
float d; // signed distance
|
|
365
|
+
if(vVertType == `).concat(Zl,`) {
|
|
366
|
+
d = rectangleSD(p, b);
|
|
367
|
+
} else if(vVertType == `).concat(Pu,` && w == h) {
|
|
368
|
+
d = circleSD(p, b.x); // faster than ellipse
|
|
369
|
+
} else if(vVertType == `).concat(Pu,`) {
|
|
370
|
+
d = ellipseSD(p, b);
|
|
371
|
+
} else {
|
|
372
|
+
d = roundRectangleSD(p, b, vCornerRadius.wzyx);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
// use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling
|
|
376
|
+
// we must smooth colors inwards, because we can't change pixels outside the shape's bounding box
|
|
377
|
+
if(d > 0.0) {
|
|
378
|
+
if(d > outerBorder) {
|
|
379
|
+
discard;
|
|
380
|
+
} else {
|
|
381
|
+
outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);
|
|
382
|
+
}
|
|
383
|
+
} else {
|
|
384
|
+
if(d > innerBorder) {
|
|
385
|
+
vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;
|
|
386
|
+
vec4 innerBorderColor = blend(vBorderColor, vColor);
|
|
387
|
+
outColor = distInterp(innerBorderColor, outerColor, d);
|
|
388
|
+
}
|
|
389
|
+
else {
|
|
390
|
+
vec4 outerColor;
|
|
391
|
+
if(innerBorder == 0.0 && outerBorder == 0.0) {
|
|
392
|
+
outerColor = vec4(0);
|
|
393
|
+
} else if(innerBorder == 0.0) {
|
|
394
|
+
outerColor = vBorderColor;
|
|
395
|
+
} else {
|
|
396
|
+
outerColor = blend(vBorderColor, vColor);
|
|
397
|
+
}
|
|
398
|
+
outColor = distInterp(vColor, outerColor, d - innerBorder);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
else {
|
|
403
|
+
outColor = vColor;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
`).concat(a.picking?`if(outColor.a == 0.0) discard;
|
|
407
|
+
else outColor = vIndex;`:"",`
|
|
408
|
+
}
|
|
409
|
+
`),u=TL(r,i,o);u.aPosition=r.getAttribLocation(u,"aPosition"),u.aIndex=r.getAttribLocation(u,"aIndex"),u.aVertType=r.getAttribLocation(u,"aVertType"),u.aTransform=r.getAttribLocation(u,"aTransform"),u.aAtlasId=r.getAttribLocation(u,"aAtlasId"),u.aTex=r.getAttribLocation(u,"aTex"),u.aPointAPointB=r.getAttribLocation(u,"aPointAPointB"),u.aPointCPointD=r.getAttribLocation(u,"aPointCPointD"),u.aLineWidth=r.getAttribLocation(u,"aLineWidth"),u.aColor=r.getAttribLocation(u,"aColor"),u.aCornerRadius=r.getAttribLocation(u,"aCornerRadius"),u.aBorderColor=r.getAttribLocation(u,"aBorderColor"),u.uPanZoomMatrix=r.getUniformLocation(u,"uPanZoomMatrix"),u.uAtlasSize=r.getUniformLocation(u,"uAtlasSize"),u.uBGColor=r.getUniformLocation(u,"uBGColor"),u.uZoom=r.getUniformLocation(u,"uZoom"),u.uTextures=[];for(var d=0;d<this.batchManager.getMaxAtlasesPerBatch();d++)u.uTextures.push(r.getUniformLocation(u,"uTexture".concat(d)));return u}},{key:"_createVAO",value:function(){var a=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=a.length/2;var r=this.maxInstances,i=this.gl,s=this.program,o=i.createVertexArray();return i.bindVertexArray(o),kL(i,"vec2",s.aPosition,a),this.transformBuffer=BL(i,r,s.aTransform),this.indexBuffer=hn(i,r,"vec4",s.aIndex),this.vertTypeBuffer=hn(i,r,"int",s.aVertType),this.atlasIdBuffer=hn(i,r,"int",s.aAtlasId),this.texBuffer=hn(i,r,"vec4",s.aTex),this.pointAPointBBuffer=hn(i,r,"vec4",s.aPointAPointB),this.pointCPointDBuffer=hn(i,r,"vec4",s.aPointCPointD),this.lineWidthBuffer=hn(i,r,"vec2",s.aLineWidth),this.colorBuffer=hn(i,r,"vec4",s.aColor),this.cornerRadiusBuffer=hn(i,r,"vec4",s.aCornerRadius),this.borderColorBuffer=hn(i,r,"vec4",s.aBorderColor),i.bindVertexArray(null),o}},{key:"buffers",get:function(){var a=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(r){return Qi(r,"Buffer")}).map(function(r){return a[r]})),this._buffers}},{key:"startFrame",value:function(a){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Gu.SCREEN;this.panZoomMatrix=a,this.renderTarget=r,this.batchDebugInfo=[],this.wrappedCount=0,this.simpleCount=0,this.startBatch()}},{key:"startBatch",value:function(){this.instanceCount=0,this.batchManager.startBatch()}},{key:"endFrame",value:function(){this.endBatch()}},{key:"_isVisible",value:function(a,r){return a.visible()?r&&r.isVisible?r.isVisible(a):!0:!1}},{key:"drawTexture",value:function(a,r,i){var s=this.atlasManager,o=this.batchManager,u=s.getRenderTypeOpts(i);if(this._isVisible(a,u)&&!(a.isEdge()&&!this._isValidEdge(a))){if(this.renderTarget.picking&&u.getTexPickingMode){var d=u.getTexPickingMode(a);if(d===Qf.IGNORE)return;if(d==Qf.USE_BB){this.drawPickingRectangle(a,r,i);return}}var f=s.getAtlasInfo(a,i),h=yr(f),p;try{for(h.s();!(p=h.n()).done;){var m=p.value,y=m.atlas,x=m.tex1,E=m.tex2;o.canAddToCurrentBatch(y)||this.endBatch();for(var S=o.getAtlasIndexForBatch(y),T=0,C=[[x,!0],[E,!1]];T<C.length;T++){var N=ma(C[T],2),A=N[0],M=N[1];if(A.w!=0){var D=this.instanceCount;this.vertTypeBuffer.getView(D)[0]=fm;var j=this.indexBuffer.getView(D);Xl(r,j);var R=this.atlasIdBuffer.getView(D);R[0]=S;var L=this.texBuffer.getView(D);L[0]=A.x,L[1]=A.y,L[2]=A.w,L[3]=A.h;var z=this.transformBuffer.getMatrixView(D);this.setTransformMatrix(a,z,u,m,M),this.instanceCount++,M||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(_){h.e(_)}finally{h.f()}}}},{key:"setTransformMatrix",value:function(a,r,i,s){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,u=0;if(i.shapeProps&&i.shapeProps.padding&&(u=a.pstyle(i.shapeProps.padding).pfValue),s){var d=s.bb,f=s.tex1,h=s.tex2,p=f.w/(f.w+h.w);o||(p=1-p);var m=this._getAdjustedBB(d,u,o,p);this._applyTransformMatrix(r,m,i,a)}else{var y=i.getBoundingBox(a),x=this._getAdjustedBB(y,u,!0,1);this._applyTransformMatrix(r,x,i,a)}}},{key:"_applyTransformMatrix",value:function(a,r,i,s){var o,u;tE(a);var d=i.getRotation?i.getRotation(s):0;if(d!==0){var f=i.getRotationPoint(s),h=f.x,p=f.y;Nf(a,a,[h,p]),aE(a,a,d);var m=i.getRotationOffset(s);o=m.x+(r.xOffset||0),u=m.y+(r.yOffset||0)}else o=r.x1,u=r.y1;Nf(a,a,[o,u]),o0(a,a,[r.w,r.h])}},{key:"_getAdjustedBB",value:function(a,r,i,s){var o=a.x1,u=a.y1,d=a.w,f=a.h,h=a.yOffset;r&&(o-=r,u-=r,d+=2*r,f+=2*r);var p=0,m=d*s;return i&&s<1?d=m:!i&&s<1&&(p=d-m,o+=p,d=m),{x1:o,y1:u,w:d,h:f,xOffset:p,yOffset:h}}},{key:"drawPickingRectangle",value:function(a,r,i){var s=this.atlasManager.getRenderTypeOpts(i),o=this.instanceCount;this.vertTypeBuffer.getView(o)[0]=Zl;var u=this.indexBuffer.getView(o);Xl(r,u);var d=this.colorBuffer.getView(o);Rs([0,0,0],1,d);var f=this.transformBuffer.getMatrixView(o);this.setTransformMatrix(a,f,s),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(a,r,i){var s=this.simpleShapeOptions.get(i);if(this._isVisible(a,s)){var o=s.shapeProps,u=this._getVertTypeForShape(a,o.shape);if(u===void 0||s.isSimple&&!s.isSimple(a)){this.drawTexture(a,r,i);return}var d=this.instanceCount;if(this.vertTypeBuffer.getView(d)[0]=u,u===cf||u===zu){var f=s.getBoundingBox(a),h=this._getCornerRadius(a,o.radius,f),p=this.cornerRadiusBuffer.getView(d);p[0]=h,p[1]=h,p[2]=h,p[3]=h,u===zu&&(p[0]=0,p[2]=0)}var m=this.indexBuffer.getView(d);Xl(r,m);var y=a.pstyle(o.color).value,x=a.pstyle(o.opacity).value,E=this.colorBuffer.getView(d);Rs(y,x,E);var S=this.lineWidthBuffer.getView(d);if(S[0]=0,S[1]=0,o.border){var T=a.pstyle("border-width").value;if(T>0){var C=a.pstyle("border-color").value,N=a.pstyle("border-opacity").value,A=this.borderColorBuffer.getView(d);Rs(C,N,A);var M=a.pstyle("border-position").value;if(M==="inside")S[0]=0,S[1]=-T;else if(M==="outside")S[0]=T,S[1]=0;else{var D=T/2;S[0]=D,S[1]=-D}}}var j=this.transformBuffer.getMatrixView(d);this.setTransformMatrix(a,j,s),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"_getVertTypeForShape",value:function(a,r){var i=a.pstyle(r).value;switch(i){case"rectangle":return Zl;case"ellipse":return Pu;case"roundrectangle":case"round-rectangle":return cf;case"bottom-round-rectangle":return zu;default:return}}},{key:"_getCornerRadius",value:function(a,r,i){var s=i.w,o=i.h;if(a.pstyle(r).value==="auto")return as(s,o);var u=a.pstyle(r).pfValue,d=s/2,f=o/2;return Math.min(u,f,d)}},{key:"drawEdgeArrow",value:function(a,r,i){if(a.visible()){var s=a._private.rscratch,o,u,d;if(i==="source"?(o=s.arrowStartX,u=s.arrowStartY,d=s.srcArrowAngle):(o=s.arrowEndX,u=s.arrowEndY,d=s.tgtArrowAngle),!(isNaN(o)||o==null||isNaN(u)||u==null||isNaN(d)||d==null)){var f=a.pstyle(i+"-arrow-shape").value;if(f!=="none"){var h=a.pstyle(i+"-arrow-color").value,p=a.pstyle("opacity").value,m=a.pstyle("line-opacity").value,y=p*m,x=a.pstyle("width").pfValue,E=a.pstyle("arrow-scale").value,S=this.r.getArrowWidth(x,E),T=this.instanceCount,C=this.transformBuffer.getMatrixView(T);tE(C),Nf(C,C,[o,u]),o0(C,C,[S,S]),aE(C,C,d),this.vertTypeBuffer.getView(T)[0]=hm;var N=this.indexBuffer.getView(T);Xl(r,N);var A=this.colorBuffer.getView(T);Rs(h,y,A),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"drawEdgeLine",value:function(a,r){if(a.visible()){var i=this._getEdgePoints(a);if(i){var s=a.pstyle("opacity").value,o=a.pstyle("line-opacity").value,u=a.pstyle("width").pfValue,d=a.pstyle("line-color").value,f=s*o;if(i.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),i.length==4){var h=this.instanceCount;this.vertTypeBuffer.getView(h)[0]=rE;var p=this.indexBuffer.getView(h);Xl(r,p);var m=this.colorBuffer.getView(h);Rs(d,f,m);var y=this.lineWidthBuffer.getView(h);y[0]=u;var x=this.pointAPointBBuffer.getView(h);x[0]=i[0],x[1]=i[1],x[2]=i[2],x[3]=i[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var E=0;E<i.length-2;E+=2){var S=this.instanceCount;this.vertTypeBuffer.getView(S)[0]=nE;var T=this.indexBuffer.getView(S);Xl(r,T);var C=this.colorBuffer.getView(S);Rs(d,f,C);var N=this.lineWidthBuffer.getView(S);N[0]=u;var A=i[E-2],M=i[E-1],D=i[E],j=i[E+1],R=i[E+2],L=i[E+3],z=i[E+4],_=i[E+5];E==0&&(A=2*D-R+.001,M=2*j-L+.001),E==i.length-4&&(z=2*R-D+.001,_=2*L-j+.001);var B=this.pointAPointBBuffer.getView(S);B[0]=A,B[1]=M,B[2]=D,B[3]=j;var q=this.pointCPointDBuffer.getView(S);q[0]=R,q[1]=L,q[2]=z,q[3]=_,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"_isValidEdge",value:function(a){var r=a._private.rscratch;return!(r.badLine||r.allpts==null||isNaN(r.allpts[0]))}},{key:"_getEdgePoints",value:function(a){var r=a._private.rscratch;if(this._isValidEdge(a)){var i=r.allpts;if(i.length==4)return i;var s=this._getNumSegments(a);return this._getCurveSegmentPoints(i,s)}}},{key:"_getNumSegments",value:function(a){var r=15;return Math.min(Math.max(r,5),this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(a,r){if(a.length==4)return a;for(var i=Array((r+1)*2),s=0;s<=r;s++)if(s==0)i[0]=a[0],i[1]=a[1];else if(s==r)i[s*2]=a[a.length-2],i[s*2+1]=a[a.length-1];else{var o=s/r;this._setCurvePoint(a,o,i,s*2)}return i}},{key:"_setCurvePoint",value:function(a,r,i,s){if(a.length<=2)i[s]=a[0],i[s+1]=a[1];else{for(var o=Array(a.length-2),u=0;u<o.length;u+=2){var d=(1-r)*a[u]+r*a[u+2],f=(1-r)*a[u+1]+r*a[u+3];o[u]=d,o[u+1]=f}return this._setCurvePoint(o,r,i,s)}}},{key:"endBatch",value:function(){var a=this.gl,r=this.vao,i=this.vertexCount,s=this.instanceCount;if(s!==0){var o=this.renderTarget.picking?this.pickingProgram:this.program;a.useProgram(o),a.bindVertexArray(r);var u=yr(this.buffers),d;try{for(u.s();!(d=u.n()).done;){var f=d.value;f.bufferSubData(s)}}catch(x){u.e(x)}finally{u.f()}for(var h=this.batchManager.getAtlases(),p=0;p<h.length;p++)h[p].bufferIfNeeded(a);for(var m=0;m<h.length;m++)a.activeTexture(a.TEXTURE0+m),a.bindTexture(a.TEXTURE_2D,h[m].texture),a.uniform1i(o.uTextures[m],m);a.uniform1f(o.uZoom,NL(this.r)),a.uniformMatrix3fv(o.uPanZoomMatrix,!1,this.panZoomMatrix),a.uniform1i(o.uAtlasSize,this.batchManager.getAtlasSize());var y=Rs(this.bgColor,1);a.uniform4fv(o.uBGColor,y),a.drawArraysInstanced(a.TRIANGLES,0,i,s),a.bindVertexArray(null),a.bindTexture(a.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:s,atlasCount:h.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var a=this.atlasManager.getDebugInfo(),r=a.reduce(function(o,u){return o+u.atlasCount},0),i=this.batchDebugInfo,s=i.reduce(function(o,u){return o+u.count},0);return{atlasInfo:a,totalAtlases:r,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:i.length,batchInfo:i,totalInstances:s}}}])})(),hN={};hN.initWebgl=function(t,e){var a=this,r=a.data.contexts[a.WEBGL];t.bgColor=KL(a),t.webglTexSize=Math.min(t.webglTexSize,r.getParameter(r.MAX_TEXTURE_SIZE)),t.webglTexRows=Math.min(t.webglTexRows,54),t.webglTexRowsNodes=Math.min(t.webglTexRowsNodes,54),t.webglBatchSize=Math.min(t.webglBatchSize,16384),t.webglTexPerBatch=Math.min(t.webglTexPerBatch,r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS)),a.webglDebug=t.webglDebug,a.webglDebugShowAtlases=t.webglDebugShowAtlases,a.pickingFrameBuffer=LL(r),a.pickingFrameBuffer.needsDraw=!0,a.drawing=new YL(a,r,t);var i=function(p){return function(m){return a.getTextAngle(m,p)}},s=function(p){return function(m){var y=m.pstyle(p);return y&&y.value}},o=function(p){return function(m){return m.pstyle("".concat(p,"-opacity")).value>0}},u=function(p){var m=p.pstyle("text-events").strValue==="yes";return m?Qf.USE_BB:Qf.IGNORE},d=function(p){var m=p.position(),y=m.x,x=m.y,E=p.outerWidth(),S=p.outerHeight();return{w:E,h:S,x1:y-E/2,y1:x-S/2}};a.drawing.addAtlasCollection("node",{texRows:t.webglTexRowsNodes}),a.drawing.addAtlasCollection("label",{texRows:t.webglTexRows}),a.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:e.getStyleKey,getBoundingBox:e.getElementBox,drawElement:e.drawElement}),a.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:d,isSimple:AL,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),a.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:d,isVisible:o("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),a.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:d,isVisible:o("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),a.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:u,getKey:vm(e.getLabelKey,null),getBoundingBox:pm(e.getLabelBox,null),drawClipped:!0,drawElement:e.drawLabel,getRotation:i(null),getRotationPoint:e.getLabelRotationPoint,getRotationOffset:e.getLabelRotationOffset,isVisible:s("label")}),a.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:u,getKey:vm(e.getSourceLabelKey,"source"),getBoundingBox:pm(e.getSourceLabelBox,"source"),drawClipped:!0,drawElement:e.drawSourceLabel,getRotation:i("source"),getRotationPoint:e.getSourceLabelRotationPoint,getRotationOffset:e.getSourceLabelRotationOffset,isVisible:s("source-label")}),a.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:u,getKey:vm(e.getTargetLabelKey,"target"),getBoundingBox:pm(e.getTargetLabelBox,"target"),drawClipped:!0,drawElement:e.drawTargetLabel,getRotation:i("target"),getRotationPoint:e.getTargetLabelRotationPoint,getRotationOffset:e.getTargetLabelRotationOffset,isVisible:s("target-label")});var f=Cc(function(){console.log("garbage collect flag set"),a.data.gc=!0},1e4);a.onUpdateEleCalcs(function(h,p){var m=!1;p&&p.length>0&&(m|=a.drawing.invalidate(p)),m&&f()}),$L(a)};function KL(t){var e=t.cy.container(),a=e&&e.style&&e.style.backgroundColor||"white";return IT(a)}function vN(t,e){var a=t._private.rscratch;return gr(a,"labelWrapCachedLines",e)||[]}var vm=function(e,a){return function(r){var i=e(r),s=vN(r,a);return s.length>1?s.map(function(o,u){return"".concat(i,"_").concat(u)}):i}},pm=function(e,a){return function(r,i){var s=e(r);if(typeof i=="string"){var o=i.indexOf("_");if(o>0){var u=Number(i.substring(o+1)),d=vN(r,a),f=s.h/d.length,h=f*u,p=s.y1+h;return{x1:s.x1,w:s.w,y1:p,h:f,yOffset:h}}}return s}};function $L(t){{var e=t.render;t.render=function(s){s=s||{};var o=t.cy;t.webgl&&(o.zoom()>sN?(XL(t),e.call(t,s)):(ZL(t),gN(t,s,Gu.SCREEN)))}}{var a=t.matchCanvasSize;t.matchCanvasSize=function(s){a.call(t,s),t.pickingFrameBuffer.setFramebufferAttachmentSizes(t.canvasWidth,t.canvasHeight),t.pickingFrameBuffer.needsDraw=!0}}t.findNearestElements=function(s,o,u,d){return rz(t,s,o)};{var r=t.invalidateCachedZSortedEles;t.invalidateCachedZSortedEles=function(){r.call(t),t.pickingFrameBuffer.needsDraw=!0}}{var i=t.notify;t.notify=function(s,o){i.call(t,s,o),s==="viewport"||s==="bounds"?t.pickingFrameBuffer.needsDraw=!0:s==="background"&&t.drawing.invalidate(o,{type:"node-body"})}}}function XL(t){var e=t.data.contexts[t.WEBGL];e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}function ZL(t){var e=function(r){r.save(),r.setTransform(1,0,0,1,0,0),r.clearRect(0,0,t.canvasWidth,t.canvasHeight),r.restore()};e(t.data.contexts[t.NODE]),e(t.data.contexts[t.DRAG])}function WL(t){var e=t.canvasWidth,a=t.canvasHeight,r=iy(t),i=r.pan,s=r.zoom,o=dm();Nf(o,o,[i.x,i.y]),o0(o,o,[s,s]);var u=dm();PL(u,e,a);var d=dm();return zL(d,u,o),d}function pN(t,e){var a=t.canvasWidth,r=t.canvasHeight,i=iy(t),s=i.pan,o=i.zoom;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,a,r),e.translate(s.x,s.y),e.scale(o,o)}function JL(t,e){t.drawSelectionRectangle(e,function(a){return pN(t,a)})}function ez(t){var e=t.data.contexts[t.NODE];e.save(),pN(t,e),e.strokeStyle="rgba(0, 0, 0, 0.3)",e.beginPath(),e.moveTo(-1e3,0),e.lineTo(1e3,0),e.stroke(),e.beginPath(),e.moveTo(0,-1e3),e.lineTo(0,1e3),e.stroke(),e.restore()}function tz(t){var e=function(i,s,o){for(var u=i.atlasManager.getAtlasCollection(s),d=t.data.contexts[t.NODE],f=u.atlases,h=0;h<f.length;h++){var p=f[h],m=p.canvas;if(m){var y=m.width,x=m.height,E=y*h,S=m.height*o,T=.4;d.save(),d.scale(T,T),d.drawImage(m,E,S),d.strokeStyle="black",d.rect(E,S,y,x),d.stroke(),d.restore()}}},a=0;e(t.drawing,"node",a++),e(t.drawing,"label",a++)}function az(t,e,a,r,i){var s,o,u,d,f=iy(t),h=f.pan,p=f.zoom;{var m=jL(t,h,p,e,a),y=ma(m,2),x=y[0],E=y[1],S=6;s=x-S/2,o=E-S/2,u=S,d=S}if(u===0||d===0)return[];var T=t.data.contexts[t.WEBGL];T.bindFramebuffer(T.FRAMEBUFFER,t.pickingFrameBuffer),t.pickingFrameBuffer.needsDraw&&(T.viewport(0,0,T.canvas.width,T.canvas.height),gN(t,null,Gu.PICKING),t.pickingFrameBuffer.needsDraw=!1);var C=u*d,N=new Uint8Array(C*4);T.readPixels(s,o,u,d,T.RGBA,T.UNSIGNED_BYTE,N),T.bindFramebuffer(T.FRAMEBUFFER,null);for(var A=new Set,M=0;M<C;M++){var D=N.slice(M*4,M*4+4),j=DL(D)-1;j>=0&&A.add(j)}return A}function rz(t,e,a){var r=az(t,e,a),i=t.getCachedZSortedEles(),s,o,u=yr(r),d;try{for(u.s();!(d=u.n()).done;){var f=d.value,h=i[f];if(!s&&h.isNode()&&(s=h),!o&&h.isEdge()&&(o=h),s&&o)break}}catch(p){u.e(p)}finally{u.f()}return[s,o].filter(Boolean)}function gm(t,e,a){var r=t.drawing;e+=1,a.isNode()?(r.drawNode(a,e,"node-underlay"),r.drawNode(a,e,"node-body"),r.drawTexture(a,e,"label"),r.drawNode(a,e,"node-overlay")):(r.drawEdgeLine(a,e),r.drawEdgeArrow(a,e,"source"),r.drawEdgeArrow(a,e,"target"),r.drawTexture(a,e,"label"),r.drawTexture(a,e,"edge-source-label"),r.drawTexture(a,e,"edge-target-label"))}function gN(t,e,a){var r;t.webglDebug&&(r=performance.now());var i=t.drawing,s=0;if(a.screen&&t.data.canvasNeedsRedraw[t.SELECT_BOX]&&JL(t,e),t.data.canvasNeedsRedraw[t.NODE]||a.picking){var o=t.data.contexts[t.WEBGL];a.screen?(o.clearColor(0,0,0,0),o.enable(o.BLEND),o.blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA)):o.disable(o.BLEND),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT),o.viewport(0,0,o.canvas.width,o.canvas.height);var u=WL(t),d=t.getCachedZSortedEles();if(s=d.length,i.startFrame(u,a),a.screen){for(var f=0;f<d.nondrag.length;f++)gm(t,f,d.nondrag[f]);for(var h=0;h<d.drag.length;h++)gm(t,h,d.drag[h])}else if(a.picking)for(var p=0;p<d.length;p++)gm(t,p,d[p]);i.endFrame(),a.screen&&t.webglDebugShowAtlases&&(ez(t),tz(t)),t.data.canvasNeedsRedraw[t.NODE]=!1,t.data.canvasNeedsRedraw[t.DRAG]=!1}if(t.webglDebug){var m=performance.now(),y=!1,x=Math.ceil(m-r),E=i.getDebugInfo(),S=["".concat(s," elements"),"".concat(E.totalInstances," instances"),"".concat(E.batchCount," batches"),"".concat(E.totalAtlases," atlases"),"".concat(E.wrappedCount," wrapped textures"),"".concat(E.simpleCount," simple shapes")].join(", ");if(y)console.log("WebGL (".concat(a.name,") - time ").concat(x,"ms, ").concat(S));else{console.log("WebGL (".concat(a.name,") - frame time ").concat(x,"ms")),console.log("Totals:"),console.log(" ".concat(S)),console.log("Texture Atlases Used:");var T=E.atlasInfo,C=yr(T),N;try{for(C.s();!(N=C.n()).done;){var A=N.value;console.log(" ".concat(A.type,": ").concat(A.keyCount," keys, ").concat(A.atlasCount," atlases"))}}catch(M){C.e(M)}finally{C.f()}console.log("")}}t.data.gc&&(console.log("Garbage Collect!"),t.data.gc=!1,i.gc())}var hs={};hs.drawPolygonPath=function(t,e,a,r,i,s){var o=r/2,u=i/2;t.beginPath&&t.beginPath(),t.moveTo(e+o*s[0],a+u*s[1]);for(var d=1;d<s.length/2;d++)t.lineTo(e+o*s[d*2],a+u*s[d*2+1]);t.closePath()};hs.drawRoundPolygonPath=function(t,e,a,r,i,s,o){o.forEach(function(u){return ZC(t,u)}),t.closePath()};hs.drawRoundRectanglePath=function(t,e,a,r,i,s){var o=r/2,u=i/2,d=s==="auto"?as(r,i):Math.min(s,u,o);t.beginPath&&t.beginPath(),t.moveTo(e,a-u),t.arcTo(e+o,a-u,e+o,a,d),t.arcTo(e+o,a+u,e,a+u,d),t.arcTo(e-o,a+u,e-o,a,d),t.arcTo(e-o,a-u,e,a-u,d),t.lineTo(e,a-u),t.closePath()};hs.drawBottomRoundRectanglePath=function(t,e,a,r,i,s){var o=r/2,u=i/2,d=s==="auto"?as(r,i):s;t.beginPath&&t.beginPath(),t.moveTo(e,a-u),t.lineTo(e+o,a-u),t.lineTo(e+o,a),t.arcTo(e+o,a+u,e,a+u,d),t.arcTo(e-o,a+u,e-o,a,d),t.lineTo(e-o,a-u),t.lineTo(e,a-u),t.closePath()};hs.drawCutRectanglePath=function(t,e,a,r,i,s,o){var u=r/2,d=i/2,f=o==="auto"?G0():o;t.beginPath&&t.beginPath(),t.moveTo(e-u+f,a-d),t.lineTo(e+u-f,a-d),t.lineTo(e+u,a-d+f),t.lineTo(e+u,a+d-f),t.lineTo(e+u-f,a+d),t.lineTo(e-u+f,a+d),t.lineTo(e-u,a+d-f),t.lineTo(e-u,a-d+f),t.closePath()};hs.drawBarrelPath=function(t,e,a,r,i){var s=r/2,o=i/2,u=e-s,d=e+s,f=a-o,h=a+o,p=Km(r,i),m=p.widthOffset,y=p.heightOffset,x=p.ctrlPtOffsetPct*m;t.beginPath&&t.beginPath(),t.moveTo(u,f+y),t.lineTo(u,h-y),t.quadraticCurveTo(u+x,h,u+m,h),t.lineTo(d-m,h),t.quadraticCurveTo(d-x,h,d,h-y),t.lineTo(d,f+y),t.quadraticCurveTo(d-x,f,d-m,f),t.lineTo(u+m,f),t.quadraticCurveTo(u+x,f,u,f+y),t.closePath()};var iE=Math.sin(0),sE=Math.cos(0),u0={},c0={},mN=Math.PI/40;for(var Wl=0*Math.PI;Wl<2*Math.PI;Wl+=mN)u0[Wl]=Math.sin(Wl),c0[Wl]=Math.cos(Wl);hs.drawEllipsePath=function(t,e,a,r,i){if(t.beginPath&&t.beginPath(),t.ellipse)t.ellipse(e,a,r/2,i/2,0,0,2*Math.PI);else for(var s,o,u=r/2,d=i/2,f=0*Math.PI;f<2*Math.PI;f+=mN)s=e-u*u0[f]*iE+u*c0[f]*sE,o=a+d*c0[f]*iE+d*u0[f]*sE,f===0?t.moveTo(s,o):t.lineTo(s,o);t.closePath()};var Oc={};Oc.createBuffer=function(t,e){var a=document.createElement("canvas");return a.width=t,a.height=e,[a,a.getContext("2d")]};Oc.bufferCanvasImage=function(t){var e=this.cy,a=e.mutableElements(),r=a.boundingBox(),i=this.findContainerClientCoords(),s=t.full?Math.ceil(r.w):i[2],o=t.full?Math.ceil(r.h):i[3],u=Oe(t.maxWidth)||Oe(t.maxHeight),d=this.getPixelRatio(),f=1;if(t.scale!==void 0)s*=t.scale,o*=t.scale,f=t.scale;else if(u){var h=1/0,p=1/0;Oe(t.maxWidth)&&(h=f*t.maxWidth/s),Oe(t.maxHeight)&&(p=f*t.maxHeight/o),f=Math.min(h,p),s*=f,o*=f}u||(s*=d,o*=d,f*=d);var m=document.createElement("canvas");m.width=s,m.height=o,m.style.width=s+"px",m.style.height=o+"px";var y=m.getContext("2d");if(s>0&&o>0){y.clearRect(0,0,s,o),y.globalCompositeOperation="source-over";var x=this.getCachedZSortedEles();if(t.full)y.translate(-r.x1*f,-r.y1*f),y.scale(f,f),this.drawElements(y,x),y.scale(1/f,1/f),y.translate(r.x1*f,r.y1*f);else{var E=e.pan(),S={x:E.x*f,y:E.y*f};f*=e.zoom(),y.translate(S.x,S.y),y.scale(f,f),this.drawElements(y,x),y.scale(1/f,1/f),y.translate(-S.x,-S.y)}t.bg&&(y.globalCompositeOperation="destination-over",y.fillStyle=t.bg,y.rect(0,0,s,o),y.fill())}return m};function nz(t,e){for(var a=atob(t),r=new ArrayBuffer(a.length),i=new Uint8Array(r),s=0;s<a.length;s++)i[s]=a.charCodeAt(s);return new Blob([r],{type:e})}function lE(t){var e=t.indexOf(",");return t.substr(e+1)}function yN(t,e,a){var r=function(){return e.toDataURL(a,t.quality)};switch(t.output){case"blob-promise":return new Bo(function(i,s){try{e.toBlob(function(o){o!=null?i(o):s(new Error("`canvas.toBlob()` sent a null value in its callback"))},a,t.quality)}catch(o){s(o)}});case"blob":return nz(lE(r()),a);case"base64":return lE(r());case"base64uri":default:return r()}}Oc.png=function(t){return yN(t,this.bufferCanvasImage(t),"image/png")};Oc.jpg=function(t){return yN(t,this.bufferCanvasImage(t),"image/jpeg")};var xN={};xN.nodeShapeImpl=function(t,e,a,r,i,s,o,u){switch(t){case"ellipse":return this.drawEllipsePath(e,a,r,i,s);case"polygon":return this.drawPolygonPath(e,a,r,i,s,o);case"round-polygon":return this.drawRoundPolygonPath(e,a,r,i,s,o,u);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(e,a,r,i,s,u);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(e,a,r,i,s,o,u);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(e,a,r,i,s,u);case"barrel":return this.drawBarrelPath(e,a,r,i,s)}};var iz=bN,ft=bN.prototype;ft.CANVAS_LAYERS=3;ft.SELECT_BOX=0;ft.DRAG=1;ft.NODE=2;ft.WEBGL=3;ft.CANVAS_TYPES=["2d","2d","2d","webgl2"];ft.BUFFER_COUNT=3;ft.TEXTURE_BUFFER=0;ft.MOTIONBLUR_BUFFER_NODE=1;ft.MOTIONBLUR_BUFFER_DRAG=2;function bN(t){var e=this,a=e.cy.window(),r=a.document;t.webgl&&(ft.CANVAS_LAYERS=e.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),e.data={canvases:new Array(ft.CANVAS_LAYERS),contexts:new Array(ft.CANVAS_LAYERS),canvasNeedsRedraw:new Array(ft.CANVAS_LAYERS),bufferCanvases:new Array(ft.BUFFER_COUNT),bufferContexts:new Array(ft.CANVAS_LAYERS)};var i="-webkit-tap-highlight-color",s="rgba(0,0,0,0)";e.data.canvasContainer=r.createElement("div");var o=e.data.canvasContainer.style;e.data.canvasContainer.style[i]=s,o.position="relative",o.zIndex="0",o.overflow="hidden";var u=t.cy.container();u.appendChild(e.data.canvasContainer),u.style[i]=s;var d={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};JO()&&(d["-ms-touch-action"]="none",d["touch-action"]="none");for(var f=0;f<ft.CANVAS_LAYERS;f++){var h=e.data.canvases[f]=r.createElement("canvas"),p=ft.CANVAS_TYPES[f];e.data.contexts[f]=h.getContext(p),e.data.contexts[f]||Qt("Could not create canvas of type "+p),Object.keys(d).forEach(function(oe){h.style[oe]=d[oe]}),h.style.position="absolute",h.setAttribute("data-id","layer"+f),h.style.zIndex=String(ft.CANVAS_LAYERS-f),e.data.canvasContainer.appendChild(h),e.data.canvasNeedsRedraw[f]=!1}e.data.topCanvas=e.data.canvases[0],e.data.canvases[ft.NODE].setAttribute("data-id","layer"+ft.NODE+"-node"),e.data.canvases[ft.SELECT_BOX].setAttribute("data-id","layer"+ft.SELECT_BOX+"-selectbox"),e.data.canvases[ft.DRAG].setAttribute("data-id","layer"+ft.DRAG+"-drag"),e.data.canvases[ft.WEBGL]&&e.data.canvases[ft.WEBGL].setAttribute("data-id","layer"+ft.WEBGL+"-webgl");for(var f=0;f<ft.BUFFER_COUNT;f++)e.data.bufferCanvases[f]=r.createElement("canvas"),e.data.bufferContexts[f]=e.data.bufferCanvases[f].getContext("2d"),e.data.bufferCanvases[f].style.position="absolute",e.data.bufferCanvases[f].setAttribute("data-id","buffer"+f),e.data.bufferCanvases[f].style.zIndex=String(-f-1),e.data.bufferCanvases[f].style.visibility="hidden";e.pathsEnabled=!0;var m=nr(),y=function(ae){return{x:(ae.x1+ae.x2)/2,y:(ae.y1+ae.y2)/2}},x=function(ae){return{x:-ae.w/2,y:-ae.h/2}},E=function(ae){var re=ae[0]._private,le=re.oldBackgroundTimestamp===re.backgroundTimestamp;return!le},S=function(ae){return ae[0]._private.nodeKey},T=function(ae){return ae[0]._private.labelStyleKey},C=function(ae){return ae[0]._private.sourceLabelStyleKey},N=function(ae){return ae[0]._private.targetLabelStyleKey},A=function(ae,re,le,se,Ne){return e.drawElement(ae,re,le,!1,!1,Ne)},M=function(ae,re,le,se,Ne){return e.drawElementText(ae,re,le,se,"main",Ne)},D=function(ae,re,le,se,Ne){return e.drawElementText(ae,re,le,se,"source",Ne)},j=function(ae,re,le,se,Ne){return e.drawElementText(ae,re,le,se,"target",Ne)},R=function(ae){return ae.boundingBox(),ae[0]._private.bodyBounds},L=function(ae){return ae.boundingBox(),ae[0]._private.labelBounds.main||m},z=function(ae){return ae.boundingBox(),ae[0]._private.labelBounds.source||m},_=function(ae){return ae.boundingBox(),ae[0]._private.labelBounds.target||m},B=function(ae,re){return re},q=function(ae){return y(R(ae))},V=function(ae,re,le){var se=ae?ae+"-":"";return{x:re.x+le.pstyle(se+"text-margin-x").pfValue,y:re.y+le.pstyle(se+"text-margin-y").pfValue}},Q=function(ae,re,le){var se=ae[0]._private.rscratch;return{x:se[re],y:se[le]}},P=function(ae){return V("",Q(ae,"labelX","labelY"),ae)},U=function(ae){return V("source",Q(ae,"sourceLabelX","sourceLabelY"),ae)},F=function(ae){return V("target",Q(ae,"targetLabelX","targetLabelY"),ae)},K=function(ae){return x(R(ae))},J=function(ae){return x(z(ae))},k=function(ae){return x(_(ae))},G=function(ae){var re=L(ae),le=x(L(ae));if(ae.isNode()){switch(ae.pstyle("text-halign").value){case"left":le.x=-re.w-(re.leftPad||0);break;case"right":le.x=-(re.rightPad||0);break}switch(ae.pstyle("text-valign").value){case"top":le.y=-re.h-(re.topPad||0);break;case"bottom":le.y=-(re.botPad||0);break}}return le},X=e.data.eleTxrCache=new Iu(e,{getKey:S,doesEleInvalidateKey:E,drawElement:A,getBoundingBox:R,getRotationPoint:q,getRotationOffset:K,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),W=e.data.lblTxrCache=new Iu(e,{getKey:T,drawElement:M,getBoundingBox:L,getRotationPoint:P,getRotationOffset:G,isVisible:B}),$=e.data.slbTxrCache=new Iu(e,{getKey:C,drawElement:D,getBoundingBox:z,getRotationPoint:U,getRotationOffset:J,isVisible:B}),ee=e.data.tlbTxrCache=new Iu(e,{getKey:N,drawElement:j,getBoundingBox:_,getRotationPoint:F,getRotationOffset:k,isVisible:B}),ie=e.data.lyrTxrCache=new lN(e);e.onUpdateEleCalcs(function(ae,re){X.invalidateElements(re),W.invalidateElements(re),$.invalidateElements(re),ee.invalidateElements(re),ie.invalidateElements(re);for(var le=0;le<re.length;le++){var se=re[le]._private;se.oldBackgroundTimestamp=se.backgroundTimestamp}});var he=function(ae){for(var re=0;re<ae.length;re++)ie.enqueueElementRefinement(ae[re].ele)};X.onDequeue(he),W.onDequeue(he),$.onDequeue(he),ee.onDequeue(he),t.webgl&&e.initWebgl(t,{getStyleKey:S,getLabelKey:T,getSourceLabelKey:C,getTargetLabelKey:N,drawElement:A,drawLabel:M,drawSourceLabel:D,drawTargetLabel:j,getElementBox:R,getLabelBox:L,getSourceLabelBox:z,getTargetLabelBox:_,getElementRotationPoint:q,getElementRotationOffset:K,getLabelRotationPoint:P,getSourceLabelRotationPoint:U,getTargetLabelRotationPoint:F,getLabelRotationOffset:G,getSourceLabelRotationOffset:J,getTargetLabelRotationOffset:k})}ft.redrawHint=function(t,e){var a=this;switch(t){case"eles":a.data.canvasNeedsRedraw[ft.NODE]=e;break;case"drag":a.data.canvasNeedsRedraw[ft.DRAG]=e;break;case"select":a.data.canvasNeedsRedraw[ft.SELECT_BOX]=e;break;case"gc":a.data.gc=!0;break}};var sz=typeof Path2D<"u";ft.path2dEnabled=function(t){if(t===void 0)return this.pathsEnabled;this.pathsEnabled=!!t};ft.usePaths=function(){return sz&&this.pathsEnabled};ft.setImgSmoothing=function(t,e){t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled=e:(t.webkitImageSmoothingEnabled=e,t.mozImageSmoothingEnabled=e,t.msImageSmoothingEnabled=e)};ft.getImgSmoothing=function(t){return t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled:t.webkitImageSmoothingEnabled||t.mozImageSmoothingEnabled||t.msImageSmoothingEnabled};ft.makeOffscreenCanvas=function(t,e){var a;if((typeof OffscreenCanvas>"u"?"undefined":Sa(OffscreenCanvas))!=="undefined")a=new OffscreenCanvas(t,e);else{var r=this.cy.window(),i=r.document;a=i.createElement("canvas"),a.width=t,a.height=e}return a};[oN,En,ti,ny,ol,fs,ir,hN,hs,Oc,xN].forEach(function(t){et(ft,t)});var lz=[{name:"null",impl:KC},{name:"base",impl:nN},{name:"canvas",impl:iz}],oz=[{type:"layout",extensions:kB},{type:"renderer",extensions:lz}],wN={},SN={};function EN(t,e,a){var r=a,i=function(R){At("Can not register `"+e+"` for `"+t+"` since `"+R+"` already exists in the prototype and can not be overridden")};if(t==="core"){if(nc.prototype[e])return i(e);nc.prototype[e]=a}else if(t==="collection"){if(Ia.prototype[e])return i(e);Ia.prototype[e]=a}else if(t==="layout"){for(var s=function(R){this.options=R,a.call(this,R),wt(this._private)||(this._private={}),this._private.cy=R.cy,this._private.listeners=[],this.createEmitter()},o=s.prototype=Object.create(a.prototype),u=[],d=0;d<u.length;d++){var f=u[d];o[f]=o[f]||function(){return this}}o.start&&!o.run?o.run=function(){return this.start(),this}:!o.start&&o.run&&(o.start=function(){return this.run(),this});var h=a.prototype.stop;o.stop=function(){var j=this.options;if(j&&j.animate){var R=this.animations;if(R)for(var L=0;L<R.length;L++)R[L].stop()}return h?h.call(this):this.emit("layoutstop"),this},o.destroy||(o.destroy=function(){return this}),o.cy=function(){return this._private.cy};var p=function(R){return R._private.cy},m={addEventFields:function(R,L){L.layout=R,L.cy=p(R),L.target=R},bubble:function(){return!0},parent:function(R){return p(R)}};et(o,{createEmitter:function(){return this._private.emitter=new dh(m,this),this},emitter:function(){return this._private.emitter},on:function(R,L){return this.emitter().on(R,L),this},one:function(R,L){return this.emitter().one(R,L),this},once:function(R,L){return this.emitter().one(R,L),this},removeListener:function(R,L){return this.emitter().removeListener(R,L),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(R,L){return this.emitter().emit(R,L),this}}),jt.eventAliasesOn(o),r=s}else if(t==="renderer"&&e!=="null"&&e!=="base"){var y=TN("renderer","base"),x=y.prototype,E=a,S=a.prototype,T=function(){y.apply(this,arguments),E.apply(this,arguments)},C=T.prototype;for(var N in x){var A=x[N],M=S[N]!=null;if(M)return i(N);C[N]=A}for(var D in S)C[D]=S[D];x.clientFunctions.forEach(function(j){C[j]=C[j]||function(){Qt("Renderer does not implement `renderer."+j+"()` on its prototype")}}),r=T}else if(t==="__proto__"||t==="constructor"||t==="prototype")return Qt(t+" is an illegal type to be registered, possibly lead to prototype pollutions");return VT({map:wN,keys:[t,e],value:r})}function TN(t,e){return FT({map:wN,keys:[t,e]})}function uz(t,e,a,r,i){return VT({map:SN,keys:[t,e,a,r],value:i})}function cz(t,e,a,r){return FT({map:SN,keys:[t,e,a,r]})}var d0=function(){if(arguments.length===2)return TN.apply(null,arguments);if(arguments.length===3)return EN.apply(null,arguments);if(arguments.length===4)return cz.apply(null,arguments);if(arguments.length===5)return uz.apply(null,arguments);Qt("Invalid extension access syntax")};nc.prototype.extension=d0;oz.forEach(function(t){t.extensions.forEach(function(e){EN(t.type,e.name,e.impl)})});var Yf=function(){if(!(this instanceof Yf))return new Yf;this.length=0},al=Yf.prototype;al.instanceString=function(){return"stylesheet"};al.selector=function(t){var e=this.length++;return this[e]={selector:t,properties:[]},this};al.css=function(t,e){var a=this.length-1;if(Xe(t))this[a].properties.push({name:t,value:e});else if(wt(t))for(var r=t,i=Object.keys(r),s=0;s<i.length;s++){var o=i[s],u=r[o];if(u!=null){var d=Ra.properties[o]||Ra.properties[th(o)];if(d!=null){var f=d.name,h=u;this[a].properties.push({name:f,value:h})}}}return this};al.style=al.css;al.generateStyle=function(t){var e=new Ra(t);return this.appendToStyle(e)};al.appendToStyle=function(t){for(var e=0;e<this.length;e++){var a=this[e],r=a.selector,i=a.properties;t.selector(r);for(var s=0;s<i.length;s++){var o=i[s];t.css(o.name,o.value)}}return t};var dz="3.33.1",rl=function(e){if(e===void 0&&(e={}),wt(e))return new nc(e);if(Xe(e))return d0.apply(d0,arguments)};rl.use=function(t){var e=Array.prototype.slice.call(arguments,1);return e.unshift(rl),t.apply(null,e),this};rl.warnings=function(t){return XT(t)};rl.version=dz;rl.stylesheet=rl.Stylesheet=Yf;const fz={projectId:"",collection:"",readonly:!0},hz=["title","name","label","displayName","summary","description","text","subject"];function vz(t){const e={};if(!t)return e;for(const a of t.nodeSchemas??[])(a.titleField||a.subtitleField)&&(e[a.aType]={titleField:a.titleField,subtitleField:a.subtitleField});for(const a of t.edgeSchemas??[])(a.titleField||a.subtitleField)&&(e[a.axbType]={titleField:a.titleField,subtitleField:a.subtitleField});return e}function pz(t,e,a){const r=i=>i.length>24?i.slice(0,22)+"…":i;if(a){const i=t[a];if(typeof i=="string"&&i.length>0)return r(i);if(typeof i=="number"||typeof i=="boolean")return r(String(i))}for(const i of hz){const s=t[i];if(typeof s=="string"&&s.length>0)return r(s)}for(const i of Object.values(t))if(typeof i=="string"&&i.length>0&&i.length<=80)return r(i);return e.slice(0,8)}function uo(t,e,a,r){var i;return pz(t,e,(i=r[a])==null?void 0:i.titleField)}function gz(t,e,a,r,i){const s=[],o=[],u=new Set,d=new Set;u.add(t.aUid),s.push({data:{id:t.aUid,label:uo(t.data,t.aUid,t.aType,i),nodeType:t.aType,isFocus:!0}});for(const f of e){if(!u.has(f.bUid)){u.add(f.bUid);const p=r[f.bUid];s.push({data:{id:f.bUid,label:p?uo(p.data,f.bUid,f.bType,i):f.bUid.slice(0,8),nodeType:f.bType}})}const h=`${f.aUid}:${f.axbType}:${f.bUid}`;d.has(h)||(d.add(h),o.push({data:{id:h,source:f.aUid,target:f.bUid,label:f.axbType,edgeType:f.axbType}}))}for(const f of a){if(!u.has(f.aUid)){u.add(f.aUid);const p=r[f.aUid];s.push({data:{id:f.aUid,label:p?uo(p.data,f.aUid,f.aType,i):f.aUid.slice(0,8),nodeType:f.aType}})}const h=`${f.aUid}:${f.axbType}:${f.bUid}`;d.has(h)||(d.add(h),o.push({data:{id:h,source:f.aUid,target:f.bUid,label:f.axbType,edgeType:f.axbType}}))}return[...s,...o]}function mz(t,e,a,r){const i=[],s=[],o=new Set,u=new Set;if(!o.has(t)){o.add(t);const d=a[t];i.push({data:{id:t,label:d?uo(d.data,t,d.aType,r):t.slice(0,8),nodeType:(d==null?void 0:d.aType)??"",isFocus:!0}})}for(const d of e){if(!o.has(d.aUid)){o.add(d.aUid);const h=a[d.aUid];i.push({data:{id:d.aUid,label:h?uo(h.data,d.aUid,d.aType,r):d.aUid.slice(0,8),nodeType:d.aType}})}if(!o.has(d.bUid)){o.add(d.bUid);const h=a[d.bUid];i.push({data:{id:d.bUid,label:h?uo(h.data,d.bUid,d.bType,r):d.bUid.slice(0,8),nodeType:d.bType}})}const f=`${d.aUid}:${d.axbType}:${d.bUid}`;u.has(f)||(u.add(f),s.push({data:{id:f,source:d.aUid,target:d.bUid,label:d.axbType,edgeType:d.axbType}}))}return[...i,...s]}const yz=[{selector:"node",style:{"background-color":"data(color)",label:"data(label)",color:"#e2e8f0","text-valign":"bottom","text-halign":"center","font-size":"11px","font-family":"ui-monospace, SFMono-Regular, Menlo, monospace","text-margin-y":6,"text-outline-color":"#020617","text-outline-width":2,width:28,height:28,"border-width":2,"border-color":"#334155"}},{selector:"node[?isFocus]",style:{width:42,height:42,"border-width":3,"border-color":"#818cf8","font-size":"13px","font-weight":"bold"}},{selector:"edge",style:{width:1.5,"line-color":"#475569","target-arrow-color":"#475569","target-arrow-shape":"triangle","curve-style":"bezier",label:"data(label)",color:"#94a3b8","font-size":"9px","font-family":"ui-monospace, SFMono-Regular, Menlo, monospace","text-rotation":"autorotate","text-background-color":"#0f172a","text-background-opacity":.85,"text-background-padding":"2px","text-background-shape":"round-rectangle"}},{selector:"node:active",style:{"overlay-color":"#818cf8","overlay-padding":4,"overlay-opacity":.2}},{selector:"node:selected",style:{"border-color":"#818cf8","border-width":3}}];function xz(t,e){switch(t){case"concentric":return{name:"concentric",concentric:a=>a.id()===e?10:1,levelWidth:()=>1,minNodeSpacing:50,animate:!0,animationDuration:300};case"breadthfirst":return{name:"breadthfirst",roots:`#${CSS.escape(e)}`,directed:!0,spacingFactor:1.25,animate:!0,animationDuration:300};case"cose":default:return{name:"cose",animate:!0,animationDuration:300,nodeRepulsion:()=>8e3,idealEdgeLength:()=>80,gravity:.25}}}function CN({node:t,focusUid:e,edges:a,schema:r,viewRegistry:i,config:s,onClose:o,onNodeClick:u}){const d=I.useRef(null),f=I.useRef(null),[h,p]=I.useState("breadthfirst"),[m,y]=I.useState(null),x=s??fz,{scopePath:E}=Wa(),S=(t==null?void 0:t.aUid)??e??"",T=Ro(),C=!!a,N=a??[],A=C?[]:(T==null?void 0:T.edgeResults.out.edges)??[],M=C?[]:(T==null?void 0:T.edgeResults.in.edges)??[],D=I.useMemo(()=>{const F=new Set;if(C){for(const K of N)F.add(K.aUid),F.add(K.bUid);F.add(S)}else{for(const K of A)F.add(K.bUid);for(const K of M)F.add(K.aUid)}return t&&F.delete(t.aUid),[...F]},[C,N,A,M,t,S]),{data:j}=xt.getNodesBatch.useQuery({uids:D,...Xt(E)},{enabled:D.length>0}),R=I.useMemo(()=>{const F=(j==null?void 0:j.nodes)??{};return t&&(F[t.aUid]=t),F},[j,t]),L=C?N:[...A,...M],z=I.useMemo(()=>{const F={};for(const K of L){const J=`${K.aUid}:${K.axbType}:${K.bUid}`;F[J]||(F[J]={edgeType:K.axbType,data:K.data,aType:K.aType,bType:K.bType})}return F},[L]),_=I.useMemo(()=>vz(r),[r]),B=I.useMemo(()=>C?mz(S,N,R,_):gz(t,A,M,R,_),[C,S,N,t,A,M,R,_]),q=B.filter(F=>!F.data.source).length,V=B.filter(F=>F.data.source).length;for(const F of B)!F.data.source&&F.data.nodeType&&(F.data.color=M2(F.data.nodeType));I.useEffect(()=>{const F=K=>{K.key==="Escape"&&o()};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[o]),I.useEffect(()=>{if(!d.current)return;f.current&&(f.current.destroy(),f.current=null);const F=rl({container:d.current,elements:B,style:yz,layout:xz(h,S),minZoom:.2,maxZoom:4,wheelSensitivity:.3});return F.on("tap","node",K=>{const J=K.target,k=J.id(),G=J.data("nodeType");k!==S&&u(k,G)}),F.on("mouseover","node",K=>{const J=K.target,k=K.originalEvent;y({kind:"node",uid:J.id(),nodeType:J.data("nodeType"),x:k.clientX,y:k.clientY})}),F.on("mouseover","edge",K=>{const J=K.target,k=K.originalEvent;y({kind:"edge",edgeId:J.id(),edgeType:J.data("edgeType"),x:k.clientX,y:k.clientY})}),F.on("mouseout","node, edge",()=>{y(null)}),F.on("viewport",()=>y(null)),f.current=F,()=>{F.destroy(),f.current=null}},[h,S,B.length]);const Q=I.useCallback(()=>{var F;(F=f.current)==null||F.fit(void 0,40)},[]),P=[...new Set(B.filter(F=>!F.data.source).map(F=>F.data.nodeType))],U=I.useMemo(()=>{var $,ee,ie,he,oe,ae,re,le,se;if(!m)return null;if(m.kind==="node"){const{uid:Ne,nodeType:Ae}=m,We=t&&Ne===t.aUid?t.data:(($=R[Ne])==null?void 0:$.data)??null;if(!We)return{title:`${Ae} ${Ne}`,tagName:null,data:null};const He=((ee=i==null?void 0:i.nodes[Ae])==null?void 0:ee.views)??[],Se=(he=(ie=x.viewDefaults)==null?void 0:ie.nodes)==null?void 0:he[Ae],ke=an(Se,He),De=ke!=="json"?((oe=He.find(Be=>Be.viewName===ke))==null?void 0:oe.tagName)??null:null;return{title:`${Ae} ${Ne}`,tagName:De,data:We}}const{edgeId:F,edgeType:K}=m,J=z[F];if(!J)return null;const k=((ae=i==null?void 0:i.edges[K])==null?void 0:ae.views)??[],G=(le=(re=x.viewDefaults)==null?void 0:re.edges)==null?void 0:le[K],X=an(G,k),W=X!=="json"?((se=k.find(Ne=>Ne.viewName===X))==null?void 0:se.tagName)??null:null;return{title:`${J.aType} —[${K}]→ ${J.bType}`,tagName:W,data:J.data}},[m,t,R,i,x,z]);return jf.createPortal(g.jsxs("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50",onClick:o,children:[g.jsxs("div",{className:"bg-slate-900 border border-slate-700 rounded-xl shadow-2xl flex flex-col overflow-hidden",style:{width:"90vw",height:"85vh"},onClick:F=>F.stopPropagation(),children:[g.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 border-b border-slate-700/60 bg-slate-900/80 shrink-0",children:[g.jsx("span",{className:"text-sm font-medium text-slate-200",children:"Graph"}),g.jsxs("span",{className:"text-xs text-slate-500",children:[q," nodes, ",V," edges"]}),g.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[g.jsxs("select",{value:h,onChange:F=>p(F.target.value),className:"bg-slate-800 border border-slate-700 rounded-lg px-2.5 py-1 text-xs text-slate-300 focus:outline-none focus:border-slate-500",children:[g.jsx("option",{value:"breadthfirst",children:"Tree"}),g.jsx("option",{value:"concentric",children:"Concentric"}),g.jsx("option",{value:"cose",children:"Force-directed"})]}),g.jsx("button",{onClick:Q,className:"px-2.5 py-1 bg-slate-800 border border-slate-700 text-slate-300 rounded-lg text-xs hover:bg-slate-700 transition-colors",title:"Fit to viewport",children:"Fit"}),g.jsx("button",{onClick:o,className:"px-2 py-1 text-slate-400 hover:text-slate-200 transition-colors text-lg leading-none",title:"Close",children:"×"})]})]}),g.jsx("div",{ref:d,className:"flex-1 bg-slate-950"}),g.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 border-t border-slate-700/60 bg-slate-900/80 shrink-0 overflow-x-auto",children:[P.map(F=>g.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-slate-400 whitespace-nowrap",children:[g.jsx("span",{className:"inline-block w-2.5 h-2.5 rounded-full shrink-0",style:{backgroundColor:M2(F)}}),F]},F)),g.jsx("span",{className:"text-xs text-slate-600 ml-auto whitespace-nowrap",children:"Click a node to drill in"})]})]}),m&&U&&U.data&&g.jsx(bz,{x:m.x,y:m.y,title:U.title,tagName:U.tagName,data:U.data})]}),document.body)}function bz({x:t,y:e,title:a,tagName:r,data:i}){const s=I.useRef(null),[o,u]=I.useState({left:t+12,top:e+12}),[d,f]=I.useState(!1);return I.useEffect(()=>{const h=s.current;if(!h)return;const p=h.getBoundingClientRect(),m=12;let y=t+m,x=e+m;y+p.width>window.innerWidth-m&&(y=t-p.width-m),x+p.height>window.innerHeight-m&&(x=e-p.height-m),u({left:y,top:x})},[t,e]),g.jsxs("div",{ref:s,className:"fixed z-[60] max-w-sm rounded-lg border border-slate-600 bg-slate-900 shadow-2xl overflow-hidden pointer-events-none",style:{left:o.left,top:o.top},onClick:h=>h.stopPropagation(),children:[g.jsx("div",{className:"px-3 py-1.5 border-b border-slate-700/60 text-xs text-slate-400 font-mono truncate",children:a}),g.jsx("div",{className:"p-2 max-h-64 overflow-auto",children:r&&!d?g.jsx(Xn,{tagName:r,data:i,onError:()=>f(!0)}):g.jsx("div",{className:"text-xs font-mono",children:g.jsx(Dr,{data:i,defaultExpanded:!0,depth:0})})})]})}function df(t,e,a){if(!e)return t.edgeTypes;const r=t.edgeTypes.filter(i=>a==="forward"?i.aType===e:i.bType===e);return r.length>0?r:t.edgeTypes}function ff(t){return[...new Set(t.map(e=>e.axbType))]}function oE(t,e,a){const r=[];let i=e;for(const s of a){const o=t.edgeTypes.filter(d=>d.axbType===s.axbType);let u;if(i&&o.length>0)if(s.direction==="forward"){const d=o.find(f=>f.aType===i);u=d==null?void 0:d.bType}else{const d=o.find(f=>f.bType===i);u=d==null?void 0:d.aType}else o.length===1&&(u=s.direction==="forward"?o[0].bType:o[0].aType);r.push({sourceType:i,targetType:u}),i=u}return r}function wz(t,e){var r;const a=(r=t.edgeSchemas)==null?void 0:r.find(i=>i.axbType===e&&!i.isNodeEntry);return(a==null?void 0:a.fields)??[]}function Sz({schema:t}){const[e,a]=I.useState(""),[r,i]=I.useState("");return g.jsxs("div",{className:"p-6 max-w-6xl mx-auto",children:[g.jsxs("div",{className:"mb-6",children:[g.jsx("h1",{className:"text-xl font-bold mb-1",children:"Graph Traversal"}),g.jsx("p",{className:"text-sm text-slate-400",children:"Build multi-hop traversals to explore graph relationships"})]}),g.jsxs("div",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[g.jsxs("div",{className:"mb-5 flex gap-4 items-end",children:[g.jsxs("div",{className:"flex-1 max-w-sm",children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1.5",children:"Start Node UID"}),g.jsx("input",{type:"text",value:e,onChange:s=>a(s.target.value),placeholder:"paste a node UID",className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm font-mono text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 transition-colors"})]}),g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1.5",children:"Node Type"}),g.jsxs("select",{value:r,onChange:s=>i(s.target.value),className:"bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-slate-200 focus:outline-none focus:border-indigo-500 transition-colors",children:[g.jsx("option",{value:"",children:"Any type"}),t.nodeTypes.map(s=>g.jsx("option",{value:s.type,children:s.type},s.type))]})]})]}),g.jsx(NN,{schema:t,startUid:e,startNodeType:r||void 0})]})]})}function NN({schema:t,startUid:e,startNodeType:a,viewRegistry:r,config:i}){const{scopePath:s,scopedPath:o}=Wa(),u=I.useMemo(()=>{var B,q;if(a){const V=df(t,a,"forward");return ff(V)[0]||((B=t.edgeTypes[0])==null?void 0:B.axbType)||""}return((q=t.edgeTypes[0])==null?void 0:q.axbType)||""},[t,a]),[d,f]=I.useState([{axbType:u,direction:"forward",limit:10}]),[h,p]=I.useState(100),[m,y]=I.useState(5),[x,E]=I.useState(null),[S,T]=I.useState(null),[C,N]=I.useState(new Set),A=xt.traverse.useMutation({onSuccess:B=>E(B),onError:B=>T(B.message)}),M=A.isPending,D=I.useMemo(()=>oE(t,a,d),[t,a,d]),j=()=>{var Q;const B=(Q=D[D.length-1])==null?void 0:Q.targetType,q=df(t,B,"forward"),V=ff(q);f([...d,{axbType:V[0]||"",direction:"forward",limit:10}])},R=B=>{d.length<=1||(f(d.filter((q,V)=>V!==B)),N(q=>{const V=new Set;for(const Q of q)Q<B?V.add(Q):Q>B&&V.add(Q-1);return V}))},L=(B,q)=>{f(V=>{var P;const Q=[...V];if(Q[B]={...Q[B],...q},"direction"in q){const F=(P=oE(t,a,Q)[B])==null?void 0:P.sourceType,K=ff(df(t,F,Q[B].direction));K.length>0&&!K.includes(Q[B].axbType)&&(Q[B]={...Q[B],axbType:K[0]})}return Q})},z=B=>{N(q=>{const V=new Set(q);return V.has(B)?V.delete(B):V.add(B),V})},_=()=>{e.trim()&&(T(null),E(null),A.mutate({startUid:e.trim(),hops:d,maxReads:h,concurrency:m,...Xt(s)}))};return g.jsxs(g.Fragment,{children:[a&&g.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[g.jsx("span",{className:"text-xs text-slate-500",children:"Starting from"}),g.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono font-medium ${ra(a)}`,children:a}),g.jsx("span",{className:"text-xs text-slate-400 font-mono",children:e})]}),g.jsxs("div",{className:"mb-5",children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-2",children:"Hops"}),g.jsx("div",{className:"space-y-2",children:d.map((B,q)=>{const V=D[q],Q=V==null?void 0:V.sourceType,P=V==null?void 0:V.targetType,U=df(t,Q,B.direction),F=ff(U),K=C.has(q),J=wz(t,B.axbType);return g.jsxs("div",{className:"bg-slate-800/50 rounded-lg",children:[g.jsxs("div",{className:"flex items-center gap-2 p-3",children:[g.jsxs("span",{className:"text-xs text-slate-500 w-6 shrink-0",children:["#",q+1]}),Q?g.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono shrink-0 ${ra(Q)}`,children:Q}):g.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono bg-slate-700 text-slate-500 shrink-0",children:"?"}),g.jsxs("select",{value:B.direction,onChange:k=>L(q,{direction:k.target.value}),className:"bg-slate-800 border border-slate-700 rounded-lg px-2 py-1.5 text-xs text-slate-200 focus:outline-none focus:border-indigo-500",children:[g.jsx("option",{value:"forward",children:"Forward"}),g.jsx("option",{value:"reverse",children:"Reverse"})]}),g.jsx("select",{value:B.axbType,onChange:k=>L(q,{axbType:k.target.value}),className:"bg-slate-800 border border-slate-700 rounded-lg px-2 py-1.5 text-xs text-slate-200 focus:outline-none focus:border-indigo-500 flex-1 max-w-xs",children:F.map(k=>g.jsx("option",{value:k,children:k},k))}),g.jsx("span",{className:"text-slate-600 text-xs",children:"→"}),P?g.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono shrink-0 ${ra(P)}`,children:P}):g.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono bg-slate-700 text-slate-500 shrink-0",children:"?"}),g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"text-xs text-slate-500",children:"limit:"}),g.jsx("input",{type:"number",value:B.limit,onChange:k=>L(q,{limit:parseInt(k.target.value)||10}),className:"w-14 bg-slate-800 border border-slate-700 rounded-lg px-2 py-1.5 text-xs text-slate-200 focus:outline-none focus:border-indigo-500",min:1,max:200})]}),g.jsx("button",{onClick:()=>z(q),className:`p-1 transition-colors ${K?"text-indigo-400":"text-slate-600 hover:text-slate-400"}`,title:"Advanced options",children:g.jsxs("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}),d.length>1&&g.jsx("button",{onClick:()=>R(q),className:"text-slate-600 hover:text-red-400 transition-colors p-1",title:"Remove hop",children:g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),K&&g.jsx(Ez,{hop:B,index:q,fields:J,updateHop:L})]},q)})}),g.jsxs("button",{onClick:j,className:"mt-2 text-xs text-indigo-400 hover:text-indigo-300 transition-colors flex items-center gap-1",children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"Add Hop"]})]}),g.jsxs("div",{className:"mb-5 flex gap-5 items-end",children:[g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1.5",children:"Read Budget"}),g.jsx("input",{type:"number",value:h,onChange:B=>p(parseInt(B.target.value)||100),className:"w-24 bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-slate-200 focus:outline-none focus:border-indigo-500",min:1,max:1e3})]}),g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1.5",children:"Concurrency"}),g.jsx("input",{type:"number",value:m,onChange:B=>y(parseInt(B.target.value)||5),className:"w-20 bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-slate-200 focus:outline-none focus:border-indigo-500",min:1,max:20})]})]}),g.jsxs("div",{className:"mb-5 bg-slate-950 rounded-lg p-3",children:[g.jsx("p",{className:"text-xs text-slate-500 mb-1",children:"Query Preview"}),g.jsxs("div",{className:"flex items-center gap-1.5 text-sm font-mono flex-wrap",children:[g.jsx("span",{className:"text-indigo-400",children:e||"?"}),a&&g.jsxs("span",{className:"text-slate-500 text-xs",children:["(",a,")"]}),d.map((B,q)=>{var Q;const V=(Q=D[q])==null?void 0:Q.targetType;return g.jsxs("span",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"text-slate-600",children:B.direction==="forward"?"→":"←"}),g.jsx("span",{className:"text-emerald-400",children:B.axbType||"?"}),V&&g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"text-slate-600",children:"→"}),g.jsx("span",{className:"text-cyan-400 text-xs",children:V})]})]},q)})]})]}),g.jsx("button",{onClick:_,disabled:M||!e.trim(),className:"px-5 py-2 bg-indigo-600 text-white rounded-lg text-sm font-medium hover:bg-indigo-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:M?g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"w-3.5 h-3.5 border-2 border-white border-t-transparent rounded-full animate-spin"}),"Running..."]}):g.jsxs(g.Fragment,{children:[g.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"Run Traversal"]})}),S&&g.jsx("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-3 mt-4 text-sm text-red-400",children:S}),x&&g.jsx("div",{className:"mt-5",children:g.jsx(Nz,{result:x,startUid:e,schema:t,viewRegistry:r,config:i})})]})}function Ez({hop:t,index:e,fields:a,updateHop:r}){var u,d;const i=()=>{var h;const f=t.where??[];r(e,{where:[...f,{field:((h=a[0])==null?void 0:h.name)||"",op:"==",value:""}]})},s=(f,h)=>{const p=[...t.where??[]];p[f]={...p[f],...h},r(e,{where:p})},o=f=>{const h=(t.where??[]).filter((p,m)=>m!==f);r(e,{where:h.length>0?h:void 0})};return g.jsxs("div",{className:"border-t border-slate-700/50 px-3 pb-3 pt-2 space-y-3",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-[10px] text-slate-500 w-16 shrink-0",children:"Order By"}),a.length>0?g.jsxs("select",{value:((u=t.orderBy)==null?void 0:u.field)||"",onChange:f=>{var h;return r(e,{orderBy:f.target.value?{field:f.target.value,direction:((h=t.orderBy)==null?void 0:h.direction)??"asc"}:void 0})},className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 focus:outline-none focus:border-indigo-500",children:[g.jsx("option",{value:"",children:"None"}),a.map(f=>g.jsx("option",{value:f.name,children:f.name},f.name))]}):g.jsx("input",{type:"text",value:((d=t.orderBy)==null?void 0:d.field)||"",onChange:f=>{var h;return r(e,{orderBy:f.target.value?{field:f.target.value,direction:((h=t.orderBy)==null?void 0:h.direction)??"asc"}:void 0})},placeholder:"field name",className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 w-32"}),t.orderBy&&g.jsxs("select",{value:t.orderBy.direction,onChange:f=>r(e,{orderBy:{...t.orderBy,direction:f.target.value}}),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 focus:outline-none focus:border-indigo-500",children:[g.jsx("option",{value:"asc",children:"asc"}),g.jsx("option",{value:"desc",children:"desc"})]})]}),g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[g.jsx("span",{className:"text-[10px] text-slate-500 w-16 shrink-0",children:"Where"}),g.jsx("button",{onClick:i,className:"text-[10px] text-indigo-400 hover:text-indigo-300 transition-colors",children:"+ Add filter"})]}),(t.where??[]).map((f,h)=>g.jsxs("div",{className:"flex items-center gap-1.5 ml-[4.5rem] mb-1",children:[a.length>0?g.jsx("select",{value:f.field,onChange:p=>s(h,{field:p.target.value}),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 focus:outline-none focus:border-indigo-500",children:a.map(p=>g.jsx("option",{value:p.name,children:p.name},p.name))}):g.jsx("input",{type:"text",value:f.field,onChange:p=>s(h,{field:p.target.value}),placeholder:"field",className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 w-24"}),g.jsxs("select",{value:f.op,onChange:p=>s(h,{op:p.target.value}),className:"bg-slate-800 border border-slate-700 rounded px-1.5 py-1 text-[11px] text-slate-200 focus:outline-none focus:border-indigo-500 w-14",children:[g.jsx("option",{value:"==",children:"=="}),g.jsx("option",{value:"!=",children:"!="}),g.jsx("option",{value:"<",children:"<"}),g.jsx("option",{value:"<=",children:"<="}),g.jsx("option",{value:">",children:">"}),g.jsx("option",{value:">=",children:">="})]}),g.jsx("input",{type:"text",value:String(f.value),onChange:p=>{const m=Number(p.target.value),y=p.target.value==="true"?!0:p.target.value==="false"?!1:!isNaN(m)&&p.target.value!==""?m:p.target.value;s(h,{value:y})},placeholder:"value",className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 w-28"}),g.jsx("button",{onClick:()=>o(h),className:"text-slate-600 hover:text-red-400 transition-colors p-0.5",children:g.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},h))]})]})}function jN(t,e,a){const r=[],i=t[e].direction;let s=i==="forward"?a.aUid:a.bUid;for(let u=e-1;u>=0;u--){const d=t[u],f=d.edges.find(h=>d.direction==="forward"?h.bUid===s:h.aUid===s);if(!f)break;r.unshift({edge:f,direction:d.direction}),s=d.direction==="forward"?f.aUid:f.bUid}const o=r.map(({edge:u,direction:d})=>({uid:d==="forward"?u.bUid:u.aUid,nodeType:d==="forward"?u.bType:u.aType,edgeType:u.axbType,direction:d==="forward"?"out":"in"}));return o.push({uid:i==="forward"?a.bUid:a.aUid,nodeType:i==="forward"?a.bType:a.aType,edgeType:a.axbType,direction:i==="forward"?"out":"in"}),o}const Tz=20;function Cz(t){return{uid:t,nodeType:"",edgeType:"",direction:"out"}}function Nz({result:t,startUid:e,schema:a,viewRegistry:r,config:i}){const s=kT(),o=$r(),{scopedPath:u}=Wa(),[d,f]=I.useState(!1),h=I.useMemo(()=>t.hops.flatMap(m=>m.edges),[t.hops]),p=m=>{const E=t.hops[m].edges.slice(0,Tz).map(S=>jN(t.hops,m,S));if(s)for(const S of E)s.createLane([Cz(e),...S]);else o(u(`/node/${encodeURIComponent(e)}`),{state:{initialPaths:E}})};return g.jsxs("div",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[g.jsxs("div",{className:"flex items-center gap-6 mb-5",children:[g.jsxs("div",{children:[g.jsx("div",{className:"text-lg font-bold",children:t.nodes.length}),g.jsx("div",{className:"text-[10px] text-slate-500",children:"Result Nodes"})]}),g.jsxs("div",{children:[g.jsx("div",{className:"text-lg font-bold",children:t.hops.length}),g.jsx("div",{className:"text-[10px] text-slate-500",children:"Hops"})]}),g.jsxs("div",{children:[g.jsx("div",{className:"text-lg font-bold",children:t.totalReads}),g.jsx("div",{className:"text-[10px] text-slate-500",children:"Firestore Reads"})]}),t.truncated&&g.jsx("div",{className:"px-2 py-1 bg-amber-500/10 text-amber-400 rounded text-xs",children:"Truncated (budget exceeded)"}),g.jsx("button",{onClick:()=>f(!0),className:"ml-auto px-3 py-1.5 bg-slate-800 text-slate-300 rounded-lg text-xs hover:bg-slate-700 transition-colors",children:"Graph"})]}),g.jsx("div",{className:"space-y-4",children:t.hops.map((m,y)=>g.jsxs("div",{className:"border-l-2 border-indigo-500/30 pl-4",children:[g.jsxs("h3",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[g.jsxs("span",{className:"text-slate-500",children:["Hop ",y+1,":"]}),g.jsx("span",{className:"text-indigo-400 font-mono",children:m.axbType}),g.jsxs("span",{className:"text-slate-600 text-xs",children:["(",m.direction,", ",m.edges.length," edges from ",m.sourceCount," sources)"]}),m.truncated&&g.jsx("span",{className:"text-amber-400 text-[10px]",children:"truncated"}),m.edges.length>0&&g.jsx("button",{onClick:()=>p(y),className:"text-[10px] text-indigo-400 hover:text-indigo-300 transition-colors ml-auto",children:"show paths"})]}),g.jsxs("div",{className:"space-y-1.5",children:[m.edges.slice(0,20).map((x,E)=>{var S,T;return g.jsx(jz,{edge:x,direction:m.direction,allHops:t.hops,hopIndex:y,edgeViews:((S=r==null?void 0:r.edges[x.axbType])==null?void 0:S.views)??[],nodeViews:((T=r==null?void 0:r.nodes[m.direction==="forward"?x.bType:x.aType])==null?void 0:T.views)??[],config:i},E)}),m.edges.length>20&&g.jsxs("p",{className:"text-xs text-slate-500 pl-2",children:["... and ",m.edges.length-20," more"]}),m.edges.length===0&&g.jsx("p",{className:"text-xs text-slate-500",children:"No edges found"})]})]},y))}),d&&h.length>0&&g.jsx(CN,{focusUid:e,edges:h,schema:a,viewRegistry:r,config:i,onClose:()=>f(!1),onNodeClick:(m,y)=>{f(!1),s?s.drillIn({uid:m,nodeType:y,edgeType:"",direction:"out"}):o(u(`/node/${encodeURIComponent(m)}`))}})]})}function jz({edge:t,direction:e,allHops:a,hopIndex:r,edgeViews:i=[],nodeViews:s=[],config:o}){const{scopePath:u,scopedPath:d}=Wa(),f=kT(),h=xt.useUtils(),[p,m]=I.useState(!1),[y,x]=I.useState(!1),[E,S]=I.useState(void 0),[T,C]=I.useState(!1),{aType:N,aUid:A,bType:M,bUid:D,data:j}=t,R=j&&Object.keys(j).length>0,L=e==="forward"?D:A,z=e==="forward"?M:N,_=e==="forward"?A:D,B=e==="forward"?N:M,q=E!==void 0,V=()=>{var X,W;const G=(W=(X=o==null?void 0:o.viewDefaults)==null?void 0:X.edges)==null?void 0:W[t.axbType];if(G&&i.length>0){const $=an(G,i,"inline");if($!=="json"){const ee=i.find(ie=>ie.viewName===$);if(ee)return ee.tagName}}return"json"},[Q,P]=I.useState(V),U=()=>{var X,W;const G=(W=(X=o==null?void 0:o.viewDefaults)==null?void 0:X.nodes)==null?void 0:W[z];if(G&&s.length>0){const $=an(G,s,"inline");if($!=="json"){const ee=s.find(ie=>ie.viewName===$);if(ee)return ee.tagName}}return"json"},[F,K]=I.useState(U),J=()=>{if(!f)return;const G=jN(a,r,t);f.drillPath(G)},k=async()=>{var G,X;C(!0);try{const $=(await h.getNodesBatch.fetch({uids:[L],...Xt(u)})).nodes[L]??null;if(S($),x(!0),$){const ee=(X=(G=o==null?void 0:o.viewDefaults)==null?void 0:G.nodes)==null?void 0:X[z];if(ee&&s.length>0){const ie=an(ee,s,"inline");if(ie!=="json"){const he=s.find(oe=>oe.viewName===ie);he&&K(he.tagName)}}}}catch{}finally{C(!1)}};return g.jsxs("div",{className:"bg-slate-800/50 rounded-lg",children:[g.jsxs("div",{className:"px-3 pt-2 pb-1 flex items-center gap-2 text-xs text-slate-500",children:[g.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono ${ra(B)}`,children:B}),g.jsx("span",{className:"font-mono text-slate-400",children:_}),g.jsx("span",{className:"text-slate-600",children:e==="forward"?"→":"←"}),g.jsx("span",{className:"text-slate-600 font-mono text-[10px]",children:t.axbType})]}),g.jsxs("div",{className:"px-3 pb-2 flex items-center gap-3",children:[g.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono ${ra(z)}`,children:z}),f?g.jsx("button",{onClick:J,className:"text-sm font-mono text-indigo-400 hover:text-indigo-300 transition-colors",title:"Dive into this node",children:L}):g.jsx(Ua,{to:d(`/node/${encodeURIComponent(L)}`),className:"text-sm font-mono text-indigo-400 hover:text-indigo-300 transition-colors",children:L}),g.jsx(Ua,{to:d(`/node/${encodeURIComponent(L)}`),className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",title:"Navigate to this node's page",children:"go to"}),R&&g.jsx("button",{onClick:()=>m(!p),className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",children:p?"hide edge":"show edge"}),!q&&!T&&g.jsx("button",{onClick:k,className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",children:"resolve"}),T&&g.jsx("span",{className:"w-2.5 h-2.5 border border-slate-400 border-t-transparent rounded-full animate-spin"}),q&&g.jsx("button",{onClick:()=>x(!y),className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",children:y?"hide node":"show node"})]}),p&&R&&g.jsxs("div",{className:"px-3 pb-2",children:[i.length>0&&g.jsx("div",{className:"mb-2",children:g.jsx(No,{views:i,activeView:Q,onSwitch:P})}),Q==="json"?g.jsx("div",{className:"font-mono text-[11px] leading-relaxed bg-slate-950 rounded p-2 overflow-auto max-h-40",children:g.jsx(Dr,{data:j,defaultExpanded:!0})}):g.jsx(Xn,{tagName:Q,data:j,onError:()=>P("json")})]}),y&&q&&g.jsx("div",{className:"px-3 pb-2",children:E===null?g.jsx("p",{className:"text-[11px] text-slate-500 italic",children:"Node not found"}):g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[g.jsx("span",{className:"text-[10px] text-slate-500 uppercase tracking-wider font-semibold",children:"Node Data"}),s.length>0&&g.jsx(No,{views:s,activeView:F,onSwitch:K})]}),F==="json"?g.jsx("div",{className:"font-mono text-[11px] leading-relaxed bg-slate-950 rounded p-2 overflow-auto max-h-40",children:g.jsx(Dr,{data:E.data,defaultExpanded:!0})}):g.jsx(Xn,{tagName:F,data:E.data,onError:()=>K("json")})]})})]})}function sc({fields:t,values:e,onChange:a,errors:r}){return g.jsx("div",{className:"space-y-4",children:t.map(i=>g.jsx(AN,{field:i,value:e[i.name],error:r==null?void 0:r[i.name],onChange:s=>a({...e,[i.name]:s})},i.name))})}function AN({field:t,value:e,error:a,onChange:r}){const i=`${t.name}${t.required?"":" (optional)"}`;return t.type==="string"?g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:i}),g.jsx("input",{type:"text",value:e??"",onChange:s=>r(s.target.value),placeholder:t.pattern?`Pattern: ${t.pattern}`:void 0,minLength:t.minLength,maxLength:t.maxLength,className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm font-mono text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 transition-colors"}),t.minLength!==void 0&&g.jsxs("p",{className:"text-[10px] text-slate-600 mt-0.5",children:["Min length: ",t.minLength]}),a&&g.jsx("p",{className:"text-xs text-red-400 mt-1",children:a})]}):t.type==="number"?g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:i}),g.jsx("input",{type:"number",value:e!=null?String(e):"",onChange:s=>{const o=s.target.value;if(o==="")return r(void 0);r(t.isInt?parseInt(o,10):parseFloat(o))},min:t.min,max:t.max,step:t.isInt?1:"any",className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm font-mono text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 transition-colors"}),a&&g.jsx("p",{className:"text-xs text-red-400 mt-1",children:a})]}):t.type==="boolean"?g.jsxs("div",{children:[g.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[g.jsx("input",{type:"checkbox",checked:!!e,onChange:s=>r(s.target.checked),className:"w-4 h-4 bg-slate-800 border-slate-700 rounded text-indigo-600 focus:ring-indigo-500"}),g.jsx("span",{className:"text-xs text-slate-400",children:i})]}),a&&g.jsx("p",{className:"text-xs text-red-400 mt-1",children:a})]}):t.type==="enum"&&t.enumValues?g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:i}),g.jsxs("select",{value:e??"",onChange:s=>r(s.target.value||void 0),className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-slate-200 focus:outline-none focus:border-indigo-500 transition-colors",children:[g.jsx("option",{value:"",children:"Select..."}),t.enumValues.map(s=>g.jsx("option",{value:s,children:s},s))]}),a&&g.jsx("p",{className:"text-xs text-red-400 mt-1",children:a})]}):t.type==="array"&&t.itemMeta?g.jsx(Az,{field:t,value:e,onChange:r,error:a}):t.type==="object"&&t.fields?g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:i}),g.jsx("div",{className:"pl-4 border-l-2 border-slate-700",children:g.jsx(sc,{fields:t.fields,values:e??{},onChange:s=>r(s)})}),a&&g.jsx("p",{className:"text-xs text-red-400 mt-1",children:a})]}):g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:i}),g.jsx("textarea",{value:e!==void 0?JSON.stringify(e,null,2):"",onChange:s=>{try{r(JSON.parse(s.target.value))}catch{}},rows:3,className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm font-mono text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 transition-colors",placeholder:"JSON value"}),a&&g.jsx("p",{className:"text-xs text-red-400 mt-1",children:a})]})}function Az({field:t,value:e,onChange:a,error:r}){const i=Array.isArray(e)?e:[],[s,o]=I.useState(!1),u=()=>{var m,y,x;const p=((m=t.itemMeta)==null?void 0:m.type)==="object"?{}:((y=t.itemMeta)==null?void 0:y.type)==="string"?"":((x=t.itemMeta)==null?void 0:x.type)==="number"?0:null;a([...i,p])},d=p=>{a(i.filter((m,y)=>y!==p))},f=(p,m)=>{a(i.map((y,x)=>x===p?m:y))},h=`${t.name}${t.required?"":" (optional)"}`;return g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[g.jsx("label",{className:"text-xs text-slate-400",children:h}),g.jsxs("button",{type:"button",onClick:()=>o(!s),className:"text-[10px] text-slate-600 hover:text-slate-400",children:["[",i.length," items] ",s?"+":"-"]})]}),!s&&g.jsxs("div",{className:"pl-4 border-l-2 border-slate-700 space-y-2",children:[i.map((p,m)=>g.jsxs("div",{className:"flex items-start gap-2",children:[g.jsx("span",{className:"text-[10px] text-slate-600 mt-2 w-4 shrink-0",children:m}),g.jsx("div",{className:"flex-1",children:t.itemMeta&&g.jsx(AN,{field:{...t.itemMeta,name:`${t.name}[${m}]`},value:p,onChange:y=>f(m,y)})}),g.jsx("button",{type:"button",onClick:()=>d(m),className:"text-slate-600 hover:text-red-400 transition-colors mt-2",children:g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},m)),g.jsxs("button",{type:"button",onClick:u,className:"text-xs text-indigo-400 hover:text-indigo-300 transition-colors flex items-center gap-1",children:[g.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"Add item"]})]}),r&&g.jsx("p",{className:"text-xs text-red-400 mt-1",children:r})]})}function MN({schema:t,existingNode:e,defaultType:a,onSaved:r,onCancel:i}){var D;const{scopePath:s}=Wa(),o=!!e,u=t.nodeSchemas??[],[d,f]=I.useState((e==null?void 0:e.aType)??a??((D=u[0])==null?void 0:D.aType)??""),[h,p]=I.useState((e==null?void 0:e.aUid)??""),[m,y]=I.useState((e==null?void 0:e.data)??{}),[x,E]=I.useState(null),S=xt.createNode.useMutation({onSuccess:j=>r(j.uid),onError:j=>E(j.message)}),T=xt.updateNode.useMutation({onSuccess:()=>r(e.aUid),onError:j=>E(j.message)}),C=S.isPending||T.isPending,N=I.useMemo(()=>u.find(j=>j.aType===d),[u,d]),A=j=>{f(j),o||y({})},M=()=>{E(null),o?T.mutate({uid:e.aUid,data:m,...Xt(s)}):S.mutate({aType:d,uid:h||void 0,data:m,...Xt(s)})};return g.jsxs("div",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[g.jsx("h2",{className:"text-sm font-semibold mb-4",children:o?`Edit Node: ${e.aUid}`:"Create Node"}),!o&&g.jsxs("div",{className:"mb-4",children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:"Node Type"}),g.jsx("select",{value:d,onChange:j=>A(j.target.value),className:"w-full max-w-xs bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-slate-200 focus:outline-none focus:border-indigo-500 transition-colors",children:u.map(j=>g.jsxs("option",{value:j.aType,children:[j.aType,j.description?` — ${j.description}`:""]},j.aType))})]}),!o&&g.jsxs("div",{className:"mb-4",children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:"UID (optional, auto-generated if empty)"}),g.jsx("input",{type:"text",value:h,onChange:j=>p(j.target.value),placeholder:"Leave empty to auto-generate",className:"w-full max-w-sm bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm font-mono text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 transition-colors"})]}),N&&N.fields.length>0?g.jsxs("div",{className:"mb-5",children:[g.jsx("label",{className:"block text-xs text-slate-500 mb-2 uppercase tracking-wider font-semibold",children:"Data Fields"}),g.jsx(sc,{fields:N.fields,values:m,onChange:y})]}):g.jsxs("div",{className:"mb-5",children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:"Data (JSON)"}),g.jsx("textarea",{value:JSON.stringify(m,null,2),onChange:j=>{try{y(JSON.parse(j.target.value))}catch{}},rows:6,className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm font-mono text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 transition-colors"})]}),x&&g.jsx("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-3 mb-4 text-sm text-red-400",children:x}),g.jsxs("div",{className:"flex gap-3",children:[g.jsxs("button",{onClick:M,disabled:C||!d,className:"px-5 py-2 bg-indigo-600 text-white rounded-lg text-sm font-medium hover:bg-indigo-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[C&&g.jsx("div",{className:"w-3.5 h-3.5 border-2 border-white border-t-transparent rounded-full animate-spin"}),o?"Save Changes":"Create Node"]}),g.jsx("button",{onClick:i,disabled:C,className:"px-4 py-2 text-sm text-slate-400 hover:text-slate-200 transition-colors disabled:opacity-50",children:"Cancel"})]})]})}const Mz=[10,25,50,100],Dz=[{value:"aUid",label:"UID"},{value:"createdAt",label:"Created"},{value:"updatedAt",label:"Updated"}],Oz=["==","!=","<","<=",">",">="];function Rz(t){if(t==="true")return!0;if(t==="false")return!1;const e=Number(t);return!isNaN(e)&&t!==""?e:t}function DN({type:t,schema:e,viewRegistry:a,config:r,onPick:i,compact:s=!1}){var oe,ae,re,le;const{scopePath:o,scopedPath:u}=Wa(),d=s?10:25,[f,h]=I.useState(d),[p,m]=I.useState("aUid"),[y,x]=I.useState("asc"),[E,S]=I.useState([]),[T,C]=I.useState(!1),[N,A]=I.useState(1),[M,D]=I.useState([]),[j,R]=I.useState(void 0),L=E.filter(se=>se.field&&se.value!==""),z={type:t,limit:f,sortBy:p,sortDir:y,startAfter:j,...L.length>0?{where:L}:{},...Xt(o)},{data:_,isLoading:B,error:q,refetch:V}=xt.getNodes.useQuery(z,{placeholderData:se=>se}),Q=(_==null?void 0:_.nodes)??[],P=(_==null?void 0:_.hasMore)??!1,U=(_==null?void 0:_.nextCursor)??null,F=(q==null?void 0:q.message)??null;I.useEffect(()=>{A(1),D([]),R(void 0)},[t,f,p,y,E,o]),I.useEffect(()=>{S([]),m("aUid"),x("asc"),C(!1)},[t]);const K=()=>{U&&(D(se=>[...se,U]),A(se=>se+1),R(U))},J=()=>{if(N<=1)return;const se=[...M];se.pop();const Ne=se.length>0?se[se.length-1]:void 0;D(se),A(Ae=>Ae-1),R(Ne)},k=()=>{A(1),D([]),R(void 0),V()},G=(oe=e.nodeSchemas)==null?void 0:oe.find(se=>se.aType===t&&se.isNodeEntry),X=(G==null?void 0:G.fields)??[],W=X.map(se=>se.name),$=[...Dz,...X.filter(se=>se.type==="string"||se.type==="number"||se.type==="boolean"||se.type==="enum").map(se=>({value:se.name,label:`data.${se.name}`}))],ee=((ae=a==null?void 0:a.nodes[t])==null?void 0:ae.views)??[],ie=(le=(re=r==null?void 0:r.viewDefaults)==null?void 0:re.nodes)==null?void 0:le[t],he=s?[10,25,50]:Mz;return g.jsxs("div",{children:[g.jsxs("div",{className:`bg-slate-900 rounded-xl border border-slate-800 ${s?"p-2":"p-3"} mb-4 space-y-3`,children:[g.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("label",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold",children:"Show"}),g.jsx("select",{value:f,onChange:se=>h(Number(se.target.value)),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-xs text-slate-200 focus:outline-none focus:border-indigo-500",children:he.map(se=>g.jsx("option",{value:se,children:se},se))})]}),g.jsx("div",{className:"w-px h-5 bg-slate-700"}),g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("label",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold",children:"Sort"}),g.jsx("select",{value:p,onChange:se=>m(se.target.value),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-xs text-slate-200 focus:outline-none focus:border-indigo-500",children:$.map(se=>g.jsx("option",{value:se.value,children:se.label},se.value))}),g.jsx("button",{onClick:()=>x(se=>se==="asc"?"desc":"asc"),className:"px-2 py-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 hover:bg-slate-700 transition-colors",title:y==="asc"?"Ascending":"Descending",children:y==="asc"?"↑ Asc":"↓ Desc"})]}),g.jsx("div",{className:"w-px h-5 bg-slate-700"}),g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("button",{onClick:J,disabled:N<=1||B,className:"px-2 py-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 hover:bg-slate-700 transition-colors disabled:opacity-30 disabled:cursor-not-allowed",children:"Prev"}),g.jsxs("span",{className:"text-xs text-slate-400 px-1",children:["Page ",N]}),g.jsx("button",{onClick:K,disabled:!P||B,className:"px-2 py-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 hover:bg-slate-700 transition-colors disabled:opacity-30 disabled:cursor-not-allowed",children:"Next"})]}),g.jsx("div",{className:"w-px h-5 bg-slate-700"}),g.jsxs("button",{onClick:()=>C(!T),className:`px-2 py-1 rounded text-xs flex items-center gap-1.5 transition-colors ${T||E.length>0?"bg-indigo-600/20 text-indigo-400 border border-indigo-500/30":"bg-slate-800 border border-slate-700 text-slate-300 hover:bg-slate-700"}`,children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"})}),"Filters",E.length>0&&g.jsx("span",{className:"bg-indigo-500 text-white text-[10px] w-4 h-4 rounded-full inline-flex items-center justify-center font-bold",children:E.length})]}),g.jsx("button",{onClick:k,disabled:B,className:"ml-auto px-2 py-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 hover:bg-slate-700 transition-colors disabled:opacity-50",title:"Refresh",children:g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})})]}),E.length>0&&!T&&g.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[g.jsx("span",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold",children:"Active"}),E.map((se,Ne)=>g.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-indigo-600/20 text-indigo-300 rounded text-xs",children:[g.jsx("span",{className:"text-slate-400",children:"data."}),se.field," ",se.op," ",g.jsx("span",{className:"text-indigo-200",children:String(se.value)}),g.jsx("button",{onClick:()=>S(Ae=>Ae.filter((We,He)=>He!==Ne)),className:"ml-0.5 text-indigo-400 hover:text-indigo-200",children:"×"})]},Ne)),g.jsx("button",{onClick:()=>S([]),className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",children:"Clear all"})]}),T&&g.jsx(kz,{filters:E,onFiltersChange:S,fieldMetas:X,fieldNames:W})]}),F&&g.jsx("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-3 mb-4 text-sm text-red-400",children:F}),B?g.jsxs("div",{className:`flex items-center gap-2 text-slate-400 ${s?"py-6":"py-12"} justify-center`,children:[g.jsx("div",{className:"w-4 h-4 border-2 border-indigo-500 border-t-transparent rounded-full animate-spin"}),g.jsx("span",{className:"text-sm",children:"Loading nodes..."})]}):Q.length===0?g.jsx("div",{className:`text-center ${s?"py-6":"py-12"} text-slate-500`,children:g.jsxs("p",{children:["No nodes found",E.length>0?" matching filters":` of type "${t}"`]})}):g.jsxs(g.Fragment,{children:[g.jsx("div",{className:`bg-slate-900 rounded-xl border border-slate-800 overflow-hidden ${s?"max-h-64 overflow-y-auto":""}`,children:g.jsxs("table",{className:"w-full",children:[g.jsx("thead",{children:g.jsxs("tr",{className:"border-b border-slate-800",children:[g.jsx("th",{className:"text-left text-[10px] uppercase tracking-wider text-slate-500 font-semibold px-4 py-3",children:"UID"}),g.jsx("th",{className:"text-left text-[10px] uppercase tracking-wider text-slate-500 font-semibold px-4 py-3",children:"Data"}),!s&&g.jsx("th",{className:"text-left text-[10px] uppercase tracking-wider text-slate-500 font-semibold px-4 py-3 w-44",children:"Created"})]})}),g.jsx("tbody",{children:Q.map(se=>g.jsxs("tr",{className:`border-b border-slate-800/50 transition-colors ${i?"hover:bg-indigo-600/10 cursor-pointer":"hover:bg-slate-800/30"}`,onClick:i?()=>i(se.aUid):void 0,children:[g.jsx("td",{className:"px-4 py-3",children:i?g.jsx("span",{className:"text-sm font-mono text-indigo-400",children:se.aUid}):g.jsx(Ua,{to:u(`/node/${encodeURIComponent(se.aUid)}`),className:"text-sm font-mono text-indigo-400 hover:text-indigo-300 transition-colors",children:se.aUid})}),g.jsx("td",{className:"px-4 py-3",children:g.jsx(Lz,{node:se,views:ee,resolverConfig:ie})}),!s&&g.jsx("td",{className:"px-4 py-3 text-xs text-slate-500",children:no(se.createdAt)})]},se.aUid))})]})}),!s&&g.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[g.jsxs("span",{className:"text-xs text-slate-500",children:[Q.length," result",Q.length!==1?"s":""," on this page"]}),g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("button",{onClick:J,disabled:N<=1||B,className:"px-3 py-1.5 bg-slate-800 text-slate-300 rounded-lg text-xs hover:bg-slate-700 transition-colors disabled:opacity-30 disabled:cursor-not-allowed",children:"Previous"}),g.jsxs("span",{className:"text-xs text-slate-400 px-2",children:["Page ",N]}),g.jsx("button",{onClick:K,disabled:!P||B,className:"px-3 py-1.5 bg-slate-800 text-slate-300 rounded-lg text-xs hover:bg-slate-700 transition-colors disabled:opacity-30 disabled:cursor-not-allowed",children:"Next"})]})]})]})]})}function kz({filters:t,onFiltersChange:e,fieldMetas:a,fieldNames:r}){const i=()=>{var p;const d=r[0]??"",f=a.find(m=>m.name===d);let h="";(f==null?void 0:f.type)==="boolean"?h=!0:(f==null?void 0:f.type)==="enum"&&((p=f.enumValues)!=null&&p.length)&&(h=f.enumValues[0]),e([...t,{field:d,op:"==",value:h}])},s=d=>{e(t.filter((f,h)=>h!==d))},o=(d,f)=>{const h=[...t];h[d]={...h[d],...f},e(h)},u=d=>a.find(f=>f.name===d);return g.jsxs("div",{className:"border-t border-slate-700/50 pt-3 space-y-2",children:[g.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[g.jsx("span",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold",children:"Where"}),g.jsx("span",{className:"text-[10px] text-slate-600",children:t.length===0?'No filters — click "Add filter" to start':`${t.length} active filter${t.length>1?"s":""}`}),t.length>0&&g.jsx("button",{onClick:()=>e([]),className:"text-[10px] text-red-400/60 hover:text-red-400 transition-colors ml-auto",children:"Clear all"})]}),t.map((d,f)=>g.jsx(Bz,{index:f,clause:d,fieldNames:r,fieldMeta:u(d.field),allFieldMetas:a,totalFilters:t.length,onUpdate:h=>o(f,h),onRemove:()=>s(f)},f)),g.jsxs("button",{onClick:i,className:"flex items-center gap-1.5 text-[11px] text-indigo-400 hover:text-indigo-300 transition-colors py-1",children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"Add filter"]})]})}function Bz({index:t,clause:e,fieldNames:a,fieldMeta:r,allFieldMetas:i,totalFilters:s,onUpdate:o,onRemove:u}){var S;const[d,f]=I.useState(String(e.value)),h=I.useRef(null);I.useEffect(()=>{f(String(e.value))},[e.value]);const p=()=>{const T=Rz(d.trim());T!==e.value&&o({value:T})},m=T=>{var A;const C=i.find(M=>M.name===T);let N="";(C==null?void 0:C.type)==="boolean"?N=!0:(C==null?void 0:C.type)==="enum"&&((A=C.enumValues)!=null&&A.length)&&(N=C.enumValues[0]),o({field:T,value:N}),f(String(N))},y=(r==null?void 0:r.type)==="enum"&&((S=r.enumValues)==null?void 0:S.length),x=(r==null?void 0:r.type)==="boolean",E=y||x;return g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"text-[10px] text-slate-600 w-8 shrink-0 text-right",children:t===0?"":"AND"}),a.length>0?g.jsx("select",{value:e.field,onChange:T=>m(T.target.value),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 focus:outline-none focus:border-indigo-500",children:a.map(T=>g.jsx("option",{value:T,children:T},T))}):g.jsx("input",{type:"text",value:e.field,onChange:T=>o({field:T.target.value}),onBlur:p,placeholder:"field",className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 w-28"}),g.jsx("select",{value:e.op,onChange:T=>o({op:T.target.value}),className:"bg-slate-800 border border-slate-700 rounded px-1.5 py-1 text-[11px] text-slate-200 focus:outline-none focus:border-indigo-500 w-14",children:Oz.map(T=>g.jsx("option",{value:T,children:T},T))}),y?g.jsx("select",{value:String(e.value),onChange:T=>o({value:T.target.value}),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 focus:outline-none focus:border-indigo-500",children:r.enumValues.map(T=>g.jsx("option",{value:T,children:T},T))}):x?g.jsxs("select",{value:String(e.value),onChange:T=>o({value:T.target.value==="true"}),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 focus:outline-none focus:border-indigo-500",children:[g.jsx("option",{value:"true",children:"true"}),g.jsx("option",{value:"false",children:"false"})]}):g.jsx("input",{ref:h,type:"text",value:d,onChange:T=>f(T.target.value),onBlur:p,onKeyDown:T=>{var C;T.key==="Enter"&&(p(),(C=h.current)==null||C.blur())},placeholder:"value (Enter to apply)",className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 w-36"}),r&&g.jsx("span",{className:"text-[9px] text-slate-600 shrink-0",children:r.type}),!E&&d!==String(e.value)&&d.trim()!==""&&g.jsx("span",{className:"text-[9px] text-amber-500 shrink-0",title:"Press Enter to apply",children:"pending"}),g.jsx("button",{onClick:u,className:"text-slate-600 hover:text-red-400 transition-colors p-0.5 shrink-0",title:"Remove filter",children:g.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})}function Lz({node:t,views:e,resolverConfig:a}){const[r,i]=I.useState(!1);if(!r&&e.length>0){const s=an(a,e,"listing");if(s!=="json"){const o=e.find(u=>u.viewName===s);if(o)return g.jsx("div",{children:g.jsx(Xn,{tagName:o.tagName,data:t.data,onError:()=>i(!0)})})}}return g.jsx("span",{className:"text-xs text-slate-400 font-mono",children:jT(t.data,100)})}function uE({schema:t,viewRegistry:e,config:a,defaultUid:r,defaultType:i,direction:s="out",onSaved:o,onCancel:u}){var Ne,Ae,We,He;const{scopePath:d}=Wa(),f=t.edgeSchemas??[],h=t.nodeSchemas??[],p=I.useMemo(()=>i?s==="out"?f.filter(Se=>Se.aType===i):f.filter(Se=>Se.bType===i):f,[f,i,s]),[m,y]=I.useState(()=>{const Se=p[0];return Se?`${Se.aType}:${Se.axbType}:${Se.bType}`:""}),[x,E]=I.useState(""),[S,T]=I.useState("create"),[C,N]=I.useState({}),[A,M]=I.useState({}),[D,j]=I.useState(""),[R,L]=I.useState(null),[z,_]=I.useState(""),B=I.useMemo(()=>f.find(Se=>`${Se.aType}:${Se.axbType}:${Se.bType}`===m),[f,m]),q=s==="out"?B==null?void 0:B.bType:B==null?void 0:B.aType,V=I.useMemo(()=>h.find(Se=>Se.aType===q&&Se.isNodeEntry),[h,q]),Q=xt.checkNode.useQuery({uid:z,...Xt(d)},{enabled:!!z&&(S==="existing"||S==="manual")}),P=r&&z?s==="out"?r:z:"",U=r&&z?s==="out"?z:r:"",F=(B==null?void 0:B.axbType)??"",K=xt.checkEdge.useQuery({aUid:P,axbType:F,bUid:U,...Xt(d)},{enabled:!!P&&!!U&&!!F&&(S==="existing"||S==="manual")}),J=Se=>{E(Se),_(Se)},k=I.useRef(null),G=()=>{const Se=x.trim();Se&&Se!==z&&_(Se)};I.useEffect(()=>{_("")},[S,m]);const X=xt.createEdge.useMutation({onSuccess:()=>o(),onError:Se=>L(Se.message)}),W=xt.createEdgeWithNode.useMutation({onSuccess:()=>o(),onError:Se=>L(Se.message)}),$=X.isPending||W.isPending,ee=Se=>{y(Se),N({}),M({}),E(""),j(""),_("")},ie=()=>{if(!B||!r)return;L(null);const Se=B.aType,ke=B.axbType,De=B.bType,Be=s==="out"?"b":"a";if(S==="create")W.mutate({aType:Se,axbType:ke,bType:De,newNodeSide:Be,existingUid:r,newNodeUid:D||void 0,edgeData:C,nodeData:A,...Xt(d)});else{if(!x)return;X.mutate({aType:Se,aUid:s==="out"?r:x,axbType:ke,bType:De,bUid:s==="out"?x:r,data:C,...Xt(d)})}},he=z&&((Ne=Q.data)==null?void 0:Ne.exists)===!0,oe=z&&((Ae=Q.data)==null?void 0:Ae.exists)===!1,ae=z&&Q.isLoading,re=z&&((We=K.data)==null?void 0:We.exists)===!0,le=!B||$?!1:S==="create"?!0:!(!x||oe),se=q??"target";return g.jsxs("div",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[g.jsxs("h2",{className:"text-sm font-semibold mb-4",children:["Create ",s==="out"?"Outgoing":"Incoming"," Edge"]}),p.length>1&&g.jsxs("div",{className:"mb-4",children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:"Edge Type"}),g.jsx("select",{value:m,onChange:Se=>ee(Se.target.value),className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-slate-200 focus:outline-none focus:border-indigo-500 transition-colors",children:p.map(Se=>{const ke=`${Se.aType}:${Se.axbType}:${Se.bType}`;return g.jsxs("option",{value:ke,children:[Se.aType," —[",Se.axbType,"]→ ",Se.bType,Se.description?` — ${Se.description}`:""]},ke)})})]}),B&&g.jsxs("div",{className:"mb-4 flex items-center gap-2 text-xs font-mono text-slate-400",children:[g.jsx("span",{className:`px-1.5 py-0.5 rounded ${ra(B.aType)}`,children:B.aType}),g.jsxs("span",{className:"text-slate-600",children:["—[",B.axbType,"]→"]}),g.jsx("span",{className:`px-1.5 py-0.5 rounded ${ra(B.bType)}`,children:B.bType})]}),g.jsxs("div",{className:"mb-4",children:[g.jsxs("label",{className:"block text-xs text-slate-400 mb-3",children:[s==="out"?"Target":"Source"," Node (",se,")"]}),g.jsx("div",{className:"flex gap-4 border-b border-slate-700/50 mb-3 pt-1",children:["create","existing","manual"].map(Se=>g.jsxs("button",{onClick:()=>T(Se),className:`pb-2 text-xs transition-colors relative ${S===Se?"text-slate-200":"text-slate-500 hover:text-slate-300"}`,children:[Se==="create"?"Create new":Se==="existing"?"Select existing":"Enter UID",S===Se&&g.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-px bg-indigo-500"})]},Se))}),S==="create"&&q&&g.jsxs("div",{children:[g.jsxs("div",{className:"mb-3",children:[g.jsx("label",{className:"block text-[11px] text-slate-500 mb-1",children:"UID (optional, auto-generated if empty)"}),g.jsx("input",{type:"text",value:D,onChange:Se=>j(Se.target.value),placeholder:"Leave empty to auto-generate",className:"w-full max-w-sm bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm font-mono text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 transition-colors"}),D&&g.jsx("p",{className:"mt-1.5 text-xs text-amber-400",children:"Custom UIDs can cause Firestore hotspots. Recommended to leave empty for auto-generated IDs."})]}),V&&V.fields.length>0?g.jsxs("div",{children:[g.jsxs("label",{className:"block text-[11px] text-slate-500 mb-2 uppercase tracking-wider font-semibold",children:[q," Data"]}),g.jsx(sc,{fields:V.fields,values:A,onChange:M})]}):g.jsxs("div",{children:[g.jsx("label",{className:"block text-[11px] text-slate-500 mb-1",children:"Data (JSON)"}),g.jsx("textarea",{value:JSON.stringify(A,null,2),onChange:Se=>{try{M(JSON.parse(Se.target.value))}catch{}},rows:4,className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm font-mono text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 transition-colors"})]})]}),S==="existing"&&q&&g.jsxs("div",{children:[x&&g.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[g.jsx("span",{className:"text-[11px] text-slate-500",children:"Selected:"}),g.jsx("span",{className:"font-mono text-sm text-indigo-400",children:x}),g.jsx(cE,{checking:!!ae,valid:!!he,invalid:!!oe}),g.jsx("button",{onClick:()=>{E(""),_("")},className:"text-[11px] text-slate-500 hover:text-slate-300 transition-colors",children:"clear"})]}),x&&re&&g.jsx(dE,{}),!x&&g.jsx(DN,{type:q,schema:t,viewRegistry:e,config:a,onPick:J,compact:!0})]}),S==="manual"&&g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("input",{ref:k,type:"text",value:x,onChange:Se=>E(Se.target.value),onBlur:G,onKeyDown:Se=>{var ke;Se.key==="Enter"&&(G(),(ke=k.current)==null||ke.blur())},placeholder:`e.g., ${se}1 (Enter to validate)`,className:"flex-1 max-w-sm bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm font-mono text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 transition-colors"}),g.jsx(cE,{checking:!!ae,valid:!!he,invalid:!!oe})]}),oe&&g.jsxs("p",{className:"mt-1.5 text-xs text-red-400",children:['No node found with UID "',z,'"']}),he&&((He=Q.data)==null?void 0:He.node)&&Q.data.node.aType!==q&&g.jsxs("p",{className:"mt-1.5 text-xs text-amber-400",children:['Node exists but is type "',Q.data.node.aType,'" (expected "',q,'")']}),re&&g.jsx(dE,{})]})]}),B&&B.fields.length>0&&g.jsxs("div",{className:"mb-5",children:[g.jsx("label",{className:"block text-xs text-slate-500 mb-2 uppercase tracking-wider font-semibold",children:"Edge Data"}),g.jsx(sc,{fields:B.fields,values:C,onChange:N})]}),R&&g.jsx("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-3 mb-4 text-sm text-red-400",children:R}),g.jsxs("div",{className:"flex gap-3",children:[g.jsxs("button",{onClick:ie,disabled:!le,className:"px-5 py-2 bg-indigo-600 text-white rounded-lg text-sm font-medium hover:bg-indigo-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[$&&g.jsx("div",{className:"w-3.5 h-3.5 border-2 border-white border-t-transparent rounded-full animate-spin"}),S==="create"?`Create ${se} + Edge`:re?"Update Edge":"Create Edge"]}),g.jsx("button",{onClick:u,disabled:$,className:"px-4 py-2 text-sm text-slate-400 hover:text-slate-200 transition-colors disabled:opacity-50",children:"Cancel"})]})]})}function cE({checking:t,valid:e,invalid:a}){return t?g.jsx("div",{className:"w-3.5 h-3.5 border-2 border-slate-500 border-t-transparent rounded-full animate-spin shrink-0"}):e?g.jsx("svg",{className:"w-4 h-4 text-emerald-400 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):a?g.jsx("svg",{className:"w-4 h-4 text-red-400 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}):null}function dE(){return g.jsxs("div",{className:"flex items-center gap-1.5 mt-1.5 mb-2 text-xs text-amber-400",children:[g.jsx("svg",{className:"w-3.5 h-3.5 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Edge already exists — submitting will update it"]})}function fE({title:t,message:e,confirmLabel:a="Delete",onConfirm:r,onCancel:i,loading:s,requireConfirmText:o}){const[u,d]=I.useState(""),f=!o||u===o;return jf.createPortal(g.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",onClick:i,children:g.jsxs("div",{className:"bg-slate-900 border border-slate-700 rounded-xl p-6 max-w-sm w-full mx-4 shadow-2xl",onClick:h=>h.stopPropagation(),children:[g.jsx("h3",{className:"text-lg font-semibold mb-2",children:t}),g.jsx("p",{className:"text-sm text-slate-400 mb-4",children:e}),o&&g.jsxs("div",{className:"mb-4",children:[g.jsxs("p",{className:"text-xs text-slate-500 mb-2",children:["Type ",g.jsx("span",{className:"font-mono text-slate-300",children:o})," to confirm:"]}),g.jsx("input",{type:"text",value:u,onChange:h=>d(h.target.value),className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-slate-200 font-mono focus:outline-none focus:border-red-500/50 placeholder:text-slate-600",placeholder:o,autoFocus:!0,onKeyDown:h=>{h.key==="Enter"&&f&&!s&&r()}})]}),g.jsxs("div",{className:"flex justify-end gap-3",children:[g.jsx("button",{onClick:i,disabled:s,className:"px-4 py-2 text-sm text-slate-400 hover:text-slate-200 transition-colors disabled:opacity-50",children:"Cancel"}),g.jsxs("button",{onClick:r,disabled:s||!f,className:"px-4 py-2 bg-red-600 text-white rounded-lg text-sm font-medium hover:bg-red-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[s&&g.jsx("div",{className:"w-3.5 h-3.5 border-2 border-white border-t-transparent rounded-full animate-spin"}),a]})]})]})}),document.body)}function zz(t){if(t.length===0||t[0].frames.length===0)return null;function e(a,r){const i=new Map;for(const s of a){if(r>=s.frames.length)continue;const o=s.frames[r].uid;i.has(o)||i.set(o,[]),i.get(o).push(s)}return Array.from(i.values()).map(s=>({frame:s[0].frames[r],depth:r,laneIds:s.map(o=>o.id),children:e(s,r+1)}))}return{frame:t[0].frames[0],depth:0,laneIds:t.map(a=>a.id),children:e(t,1)}}function Pz({peek:t,onPeek:e,schema:a}){const r=$r(),{lanes:i,activeLaneId:s,activeIndex:o,previewLaneId:u,popTo:d,closeLane:f,switchLane:h}=eh(),{scopedPath:p}=Wa(),m=I.useMemo(()=>{const j={};for(const R of a.edgeTypes)R.inverseLabel&&(j[R.axbType]=R.inverseLabel);return j},[a.edgeTypes]),y=I.useMemo(()=>u?i.map(j=>j.id===u?{...j,frames:j.frames.slice(0,-1)}:j):i,[i,u]),x=I.useMemo(()=>zz(y),[y]);if(!(y.length>1||y.length===1&&y[0].frames.length>1)||!x)return null;const S=y.length>1,T=(t==null?void 0:t.laneId)??s,C=(t==null?void 0:t.frameIndex)??o;function N(j){return j.laneIds.includes(s)?s:j.laneIds[0]}function A(j){return g.jsx("span",{className:"text-slate-600 font-mono mx-0.5 shrink-0",children:j.direction==="out"?g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"text-indigo-500/60",children:j.edgeType}),g.jsx("span",{className:"ml-0.5",children:"→"})]}):m[j.edgeType]?g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"text-amber-500/60 cursor-help",title:`Inverse of: ${j.edgeType}`,children:m[j.edgeType]}),g.jsx("span",{className:"ml-0.5",children:"→"})]}):g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"mr-0.5",children:"←"}),g.jsx("span",{className:"text-indigo-500/60",children:j.edgeType})]})})}function M(j){const R=N(j),L=j.laneIds.includes(s)&&j.depth===o,z=j.laneIds.includes(T)&&j.depth===C;return g.jsxs("button",{onClick:()=>{L?r(p(`/node/${encodeURIComponent(j.frame.uid)}`)):(h(R),d(R,j.depth))},onMouseEnter:()=>e(R,j.depth),className:`flex items-center gap-1 px-1.5 py-0.5 rounded transition-colors shrink-0 ${z?"bg-slate-800 text-slate-200":"text-slate-400 hover:text-slate-200 hover:bg-slate-800/60"}`,children:[j.frame.nodeType&&g.jsx("span",{className:`px-1 py-px rounded text-[9px] font-mono ${ra(j.frame.nodeType)}`,children:j.frame.nodeType}),g.jsx("span",{className:"font-mono truncate max-w-[120px]",children:j.frame.uid})]})}function D(j,R){const L=[j];let z=j;for(;z.children.length===1;)z=z.children[0],L.push(z);return g.jsxs(g.Fragment,{children:[L.map((_,B)=>g.jsxs(I.Fragment,{children:[(B>0||!R)&&A(_.frame),M(_)]},_.depth)),z.children.length>1&&g.jsx("div",{className:"flex flex-col border-l border-slate-700/50 ml-1.5 my-0.5",children:z.children.map((_,B)=>{const q=_.laneIds.includes(s);return g.jsxs("div",{className:`flex items-center transition-opacity ${!q&&S?"opacity-50 hover:opacity-80":""}`,children:[g.jsx("span",{className:"w-2 h-px bg-slate-700/50 shrink-0"}),D(_,!1)]},B)})}),z.children.length===0&&S&&g.jsx("button",{onClick:_=>{_.stopPropagation(),f(z.laneIds[0])},className:"ml-1 text-slate-600 hover:text-slate-400 transition-colors shrink-0 text-sm leading-none",title:"Close this lane",children:"×"})]})}return g.jsx("nav",{className:"flex items-center px-4 py-2 bg-slate-900/80 border-b border-slate-800 overflow-x-auto overflow-y-auto max-h-32 text-xs",children:D(x,!0)})}function hE(t,e){const a=Math.min(t.length,e.length);for(let r=0;r<a;r++)if(t[r].uid!==e[r].uid)return r;return a}function _z({schema:t,viewRegistry:e,config:a,onDataChanged:r}){var $;const{lanes:i,activeLaneId:s,activeLane:o,activeIndex:u,previewLaneId:d,previewFrame:f,clearPreview:h,extendLane:p,extendPath:m,forkAndDrill:y,createLane:x,switchLane:E,popTo:S}=eh(),T=Ro(),[C,N]=I.useState(null),A=I.useRef(null),M=I.useRef(new Set),[,D]=I.useState(0),j=I.useRef(new Map);I.useEffect(()=>{N(null)},[s]);const R=I.useRef(i);R.current=i;const L=I.useRef(s);L.current=s;const z=I.useRef(f);z.current=f;const _=I.useRef(h);_.current=h,I.useEffect(()=>{if(T)return T.registerCallbacks({peek:ee=>{for(const ie of R.current){const he=ie.frames.findIndex(oe=>oe.uid===ee.uid);if(he>=0){_.current(),N({laneId:ie.id,frameIndex:he});return}}N(null),z.current(ee)},clearPeek:()=>{N(null),_.current()}}),()=>{T.registerCallbacks(null)}},[T]);const B=(C==null?void 0:C.laneId)??s,q=(C==null?void 0:C.frameIndex)??u,V=I.useMemo(()=>i.find(ee=>ee.id===B)??i[0],[i,B]),Q=($=V==null?void 0:V.frames[q])==null?void 0:$.uid,P=I.useMemo(()=>{const ee=new Set,ie=[];for(const he of i)for(const oe of he.frames)ee.has(oe.uid)||(ee.add(oe.uid),ie.push(oe.uid));return ie},[i]);I.useEffect(()=>{if(!Q)return;const ee=j.current.get(Q);ee&&(ee.scrollTop=0)},[Q]),I.useEffect(()=>{const ee=ie=>{ie.key==="Escape"&&(C?N(null):u>0&&S(s,u-1))};return window.addEventListener("keydown",ee),()=>window.removeEventListener("keydown",ee)},[C,u,s,S]);const U=I.useMemo(()=>{var ie;if(!d)return;const ee=i.find(he=>he.id===d);return(ie=ee==null?void 0:ee.frames[ee.frames.length-1])==null?void 0:ie.uid},[d,i]);I.useEffect(()=>{const ee=new Set(P);for(const ie of ee)if(!M.current.has(ie)){ie!==U&&(A.current=ie,requestAnimationFrame(()=>{requestAnimationFrame(()=>{A.current=null,D(he=>he+1)})}));break}M.current=ee},[P,U]);const F=I.useCallback(ee=>{var he;if(A.current===ee)return"drill-frame drill-frame--entering";if(ee===Q)return"drill-frame drill-frame--active";if(U&&ee===U)return"drill-frame drill-frame--behind";const ie=(he=V==null?void 0:V.frames[q+1])==null?void 0:he.uid;return ee===ie?"drill-frame drill-frame--behind":"drill-frame drill-frame--hidden"},[Q,U,V,q]),K=I.useMemo(()=>{const ee=new Map;for(const ie of i)for(let he=0;he<ie.frames.length;he++){const oe=ie.frames[he].uid;ee.has(oe)||ee.set(oe,{laneId:ie.id,index:he,isDrilled:he>0})}if(V)for(let ie=0;ie<V.frames.length;ie++){const he=V.frames[ie].uid;ee.set(he,{laneId:V.id,index:ie,isDrilled:ie>0})}return ee},[i,V]),J=I.useCallback(ee=>{if(!V)return;const ie=V.frames.findIndex(he=>he.uid===ee.uid);if(ie>=0){N({laneId:V.id,frameIndex:ie});return}q<V.frames.length-1?y(B,q,ee):(B!==s&&E(B),p(B,ee)),N(null)},[V,B,q,s,p,y,E]),k=I.useCallback(ee=>{if(ee.length===0||!V)return;const ie=[...V.frames.slice(0,q+1),...ee];for(const ae of i)if(hE(ae.frames,ie)>=ie.length){E(ae.id),ae.frames.length>ie.length&&S(ae.id,ie.length-1),N(null);return}let he=null,oe=0;for(const ae of i){const re=hE(ae.frames,ie);re===ae.frames.length&&re>oe&&(he=ae,oe=re)}if(he){const ae=ie.slice(oe);m(he.id,ae)}else x(ie);N(null)},[V,B,q,i,s,m,x,E,S]),G=I.useCallback((ee,ie)=>{S(ee,ie),N(null)},[S]),X=I.useMemo(()=>({drillIn:J,drillPath:k,popTo:G}),[J,k,G]),W=I.useCallback((ee,ie)=>{N({laneId:ee,frameIndex:ie})},[]);return g.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[g.jsx(Pz,{peek:C,onPeek:W,schema:t}),g.jsx(B0.Provider,{value:X,children:g.jsx("div",{className:"drill-perspective flex-1",children:P.map(ee=>{const ie=K.get(ee);return g.jsx("div",{ref:he=>{he?j.current.set(ee,he):j.current.delete(ee)},className:F(ee),children:g.jsx(Iz,{uid:ee,schema:t,viewRegistry:e,config:a,onDataChanged:r,isDrilled:ie.isDrilled,drillIndex:ie.index,laneId:ie.laneId})},ee)})})})]})}function ON({nodeType:t,data:e,viewRegistry:a,config:r}){var f;const i=((f=a==null?void 0:a.nodes[t])==null?void 0:f.views)??[],[s,o]=I.useState("json"),[u,d]=I.useState(!1);return I.useEffect(()=>{var p,m;if(u)return;const h=(m=(p=r.viewDefaults)==null?void 0:p.nodes)==null?void 0:m[t];if(h&&i.length>0){const y=an(h,i,"detail");if(y!=="json"){const x=i.find(E=>E.viewName===y);x&&o(x.tagName)}}d(!0)},[u,i,r,t]),g.jsxs("section",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[g.jsxs("div",{className:"flex items-center justify-between mb-3",children:[g.jsx("h2",{className:"text-sm font-semibold",children:"Data"}),g.jsx(No,{views:i,activeView:s,onSwitch:o})]}),s==="json"?g.jsx("div",{className:"font-mono text-xs leading-relaxed bg-slate-950 rounded-lg p-4 overflow-auto max-h-96",children:g.jsx(Dr,{data:e,defaultExpanded:!0})}):g.jsx(Xn,{tagName:s,data:e,onError:()=>o("json")})]})}const Uz=[10,25,50,100];function ro(t,e){return e?`${e} (${t})`:t}function qz({schema:t,viewRegistry:e,config:a,onDataChanged:r,uidParam:i}){var f;const{uid:s}=PE(),o=ls(),u=i??s;if(!u)return null;const d=(f=o.state)==null?void 0:f.initialPaths;return g.jsx(LO,{rootUid:u,initialPaths:d,children:g.jsx(_z,{schema:t,viewRegistry:e,config:a,onDataChanged:r})})}function Iz({uid:t,schema:e,viewRegistry:a,config:r,onDataChanged:i,isDrilled:s=!1,drillIndex:o=0,laneId:u}){var nt,xe;const d=$r(),{drillIn:f,popTo:h,setRootType:p}=eh(),{scopePath:m,scopeUrlPrefix:y,scopedPath:x,enterSubgraph:E}=Wa(),S=Ro(),T=xt.useUtils(),[C,N]=I.useState(!1),[A,M]=I.useState(!1),[D,j]=I.useState(null),[R,L]=I.useState(""),[z,_]=I.useState(!1),[B,q]=I.useState(!1),[V,Q]=I.useState(null),[P,U]=I.useState(null),[F,K]=I.useState(null),J=!e.readonly,{data:k,isLoading:G,error:X,refetch:W}=xt.getNodeDetail.useQuery({uid:t,...Xt(m)},{enabled:!!t}),$=(k==null?void 0:k.node)??null,ee=(((nt=k==null?void 0:k.outEdges)==null?void 0:nt.length)??0)+(((xe=k==null?void 0:k.inEdges)==null?void 0:xe.length)??0),ie=(X==null?void 0:X.message)??F??null,[he,oe]=I.useState(0),ae=()=>oe(pe=>pe+1),re=()=>{T.getNodeDetail.invalidate({uid:t,...Xt(m)}),T.getEdges.invalidate()};I.useEffect(()=>{N(!1),_(!1),q(!1),K(null)},[t]),I.useEffect(()=>{$&&o===0&&p($.aType)},[$,o,p]),I.useEffect(()=>{if(!(!S||!$||o!==0))return S.setFocused({uid:$.aUid,nodeType:$.aType}),()=>{S.setFocused(null)}},[$==null?void 0:$.aUid,$==null?void 0:$.aType,o,S]);const le=xt.deleteNode.useMutation({onSuccess:()=>{re(),i==null||i(),s&&u?h(u,o-1):d(y)},onError:pe=>K(pe.message),onSettled:()=>{j(null),L("")}}),se=xt.deleteNodeCascade.useMutation({onSuccess:pe=>{re(),K(pe.errors.length>0?`Cascade partially failed: ${pe.errors.map(Ye=>Ye.message).join(", ")}`:null),i==null||i(),pe.success&&(s&&u?h(u,o-1):d(y))},onError:pe=>K(pe.message),onSettled:()=>{j(null),L("")}}),Ne=xt.deleteEdge.useMutation({onSuccess:()=>{Q(null),re(),ae(),i==null||i()},onError:pe=>K(pe.message)}),Ae=xt.bulkDeleteEdges.useMutation({onSuccess:pe=>{U(null),re(),ae(),i==null||i(),pe.errors.length>0&&K(`Bulk delete partially failed: deleted ${pe.deleted}, ${pe.errors.length} batch(es) failed`)},onError:pe=>{K(pe.message),U(null)}}),We=xt.deleteEdgesBatch.useMutation({onSuccess:()=>{U(null),re(),ae(),i==null||i()},onError:pe=>{K(pe.message),U(null)}}),He=()=>{t&&le.mutate({uid:t,...Xt(m)})},Se=()=>{t&&se.mutate({uid:t,...Xt(m)})},ke=()=>{V&&Ne.mutate({aUid:V.aUid,axbType:V.axbType,bUid:V.bUid,...Xt(m)})},De=()=>{if(!P)return;const pe=P;if(pe.mode==="visible")We.mutate({edges:pe.edges,...Xt(m)});else if(pe.mode==="filtered"){const Ye={axbType:pe.axbType,...pe.direction==="out"?{aUid:pe.uid}:{bUid:pe.uid},...Xt(m)};pe.where.length>0&&(Ye.where=pe.where),Ae.mutate(Ye)}else Ae.mutate(pe.direction==="out"?{aUid:pe.uid,axbType:pe.axbType,...Xt(m)}:{bUid:pe.uid,axbType:pe.axbType,...Xt(m)})},Be=I.useMemo(()=>{if(!$)return[];const pe=[],Ye=new Set;for(const tt of e.edgeTypes)tt.aType===$.aType&&tt.targetGraph&&!Ye.has(tt.targetGraph)&&(Ye.add(tt.targetGraph),pe.push({name:tt.targetGraph,edgeType:tt.axbType,targetType:tt.bType}));return pe},[e.edgeTypes,$]);if(G)return g.jsx("div",{className:"flex items-center justify-center py-20",children:g.jsx("div",{className:"w-5 h-5 border-2 border-indigo-500 border-t-transparent rounded-full animate-spin"})});if(ie)return g.jsx("div",{className:"p-6",children:g.jsx("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-4 text-sm text-red-400",children:ie})});if(!$)return g.jsx("div",{className:"p-6",children:g.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-8 text-center",children:[g.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Node Not Found"}),g.jsxs("p",{className:"text-sm text-slate-400",children:["No node with UID ",g.jsx("code",{className:"text-indigo-400 font-mono",children:t})," was found."]})]})});if(C)return g.jsx("div",{className:"p-6 max-w-6xl mx-auto",children:g.jsx(MN,{schema:e,existingNode:$,onSaved:()=>{N(!1),W(),i==null||i()},onCancel:()=>N(!1)})});const Ge=e.edgeTypes.filter(pe=>pe.aType===$.aType).map(pe=>pe.axbType),Je=e.edgeTypes.filter(pe=>pe.bType===$.aType).map(pe=>pe.axbType),Re={};for(const pe of e.edgeTypes)pe.inverseLabel&&(Re[pe.axbType]=pe.inverseLabel);return g.jsxs("div",{className:"p-6 max-w-6xl mx-auto",children:[g.jsxs("div",{className:"mb-6",children:[g.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[g.jsx(Ua,{to:x(`/browse/${encodeURIComponent($.aType)}`),className:`px-2 py-0.5 rounded text-xs font-mono hover:opacity-80 transition-opacity ${ra($.aType)}`,children:$.aType}),g.jsx("h1",{className:"text-xl font-bold font-mono",children:$.aUid}),g.jsxs("div",{className:"ml-auto flex gap-2",children:[g.jsx("button",{onClick:()=>M(!0),className:"px-3 py-1.5 bg-slate-800 text-slate-300 rounded-lg text-xs hover:bg-slate-700 transition-colors",children:"Graph"}),J&&g.jsxs(g.Fragment,{children:[g.jsx("button",{onClick:()=>N(!0),className:"px-3 py-1.5 bg-slate-800 text-slate-300 rounded-lg text-xs hover:bg-slate-700 transition-colors",children:"Edit"}),g.jsx("button",{onClick:()=>j("choose"),className:"px-3 py-1.5 bg-red-600/20 text-red-400 rounded-lg text-xs hover:bg-red-600/30 transition-colors",children:"Delete"})]})]})]}),g.jsxs("div",{className:"flex gap-4 text-xs text-slate-500 mt-2",children:[g.jsxs("span",{children:["Created: ",no($.createdAt)]}),g.jsxs("span",{children:["Updated: ",no($.updatedAt)]})]})]}),g.jsx("div",{className:"mb-6",children:g.jsx(ON,{nodeType:$.aType,data:$.data,viewRegistry:a,config:r},t)}),Be.length>0&&g.jsx("div",{className:"mb-6",children:g.jsxs("section",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[g.jsxs("h3",{className:"text-sm font-semibold text-slate-300 mb-3 flex items-center gap-2",children:[g.jsx("svg",{className:"w-4 h-4 text-indigo-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4"})}),"Subgraphs"]}),g.jsx("div",{className:"flex flex-wrap gap-2",children:Be.map(pe=>g.jsxs("button",{onClick:()=>E($.aUid,pe.name),className:"flex items-center gap-2 px-3 py-2 bg-slate-800 rounded-lg hover:bg-slate-700 transition-colors text-left group",children:[g.jsx("span",{className:"text-indigo-400 text-sm font-mono",children:pe.name}),g.jsxs("span",{className:"text-slate-500 text-xs",children:["via ",pe.edgeType]}),g.jsx("svg",{className:"w-3 h-3 text-slate-600 group-hover:text-indigo-400 transition-colors",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]},pe.name))})]})}),g.jsxs("section",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5 mb-6",children:[g.jsxs("div",{className:"flex items-center justify-between mb-3",children:[g.jsx("h2",{className:"text-sm font-semibold",children:"Outgoing Edges"}),J&&!z&&g.jsxs("button",{onClick:()=>_(!0),className:"px-3 py-1 bg-indigo-600/20 text-indigo-400 rounded-lg text-xs hover:bg-indigo-600/30 transition-colors flex items-center gap-1",children:[g.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"Add Edge"]})]}),z&&g.jsx("div",{className:"mb-4",children:g.jsx(uE,{schema:e,viewRegistry:a,config:r,defaultUid:$.aUid,defaultType:$.aType,direction:"out",onSaved:()=>{_(!1),ae(),i==null||i()},onCancel:()=>_(!1)})}),!z&&g.jsx(vE,{uid:$.aUid,direction:"out",axbTypes:Ge,canWrite:J,onDeleteEdge:pe=>Q({aUid:pe.aUid,axbType:pe.axbType,bUid:pe.bUid}),onBulkDelete:pe=>U(pe),nodeUid:$.aUid,reloadKey:he,viewRegistry:a,config:r,schema:e,publishToNearby:o===0})]}),g.jsxs("section",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5 mb-6",children:[g.jsxs("div",{className:"flex items-center justify-between mb-3",children:[g.jsx("h2",{className:"text-sm font-semibold",children:"Incoming Edges"}),J&&!B&&Je.length>0&&g.jsxs("button",{onClick:()=>q(!0),className:"px-3 py-1 bg-indigo-600/20 text-indigo-400 rounded-lg text-xs hover:bg-indigo-600/30 transition-colors flex items-center gap-1",children:[g.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"Add Edge"]})]}),B&&g.jsx("div",{className:"mb-4",children:g.jsx(uE,{schema:e,viewRegistry:a,config:r,defaultUid:$.aUid,defaultType:$.aType,direction:"in",onSaved:()=>{q(!1),ae(),i==null||i()},onCancel:()=>q(!1)})}),!B&&g.jsx(vE,{uid:$.aUid,direction:"in",axbTypes:Je,inverseLabelMap:Re,canWrite:J,onDeleteEdge:pe=>Q({aUid:pe.aUid,axbType:pe.axbType,bUid:pe.bUid,inverseLabel:Re[pe.axbType]}),onBulkDelete:pe=>U(pe),nodeUid:$.aUid,reloadKey:he,viewRegistry:a,config:r,schema:e,publishToNearby:o===0})]}),e.edgeTypes.length>0&&g.jsxs("section",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[g.jsxs("h2",{className:"text-sm font-semibold mb-4 flex items-center gap-2",children:[g.jsx("svg",{className:"w-4 h-4 text-indigo-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"Traverse from this node"]}),g.jsx(NN,{schema:e,startUid:$.aUid,startNodeType:$.aType,viewRegistry:a,config:r})]}),(e.collections??[]).filter(pe=>pe.parentNodeType===$.aType).length>0&&g.jsxs("section",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[g.jsxs("h2",{className:"text-sm font-semibold mb-3 flex items-center gap-2",children:[g.jsx("svg",{className:"w-4 h-4 text-amber-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),"Attached Collections"]}),g.jsx("div",{className:"space-y-1.5",children:(e.collections??[]).filter(pe=>pe.parentNodeType===$.aType).map(pe=>g.jsxs(Ua,{to:Zs(pe.name,pe.pathParams.length>0?{[pe.pathParams[0]]:$.aUid}:{},pe.pathParams),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-xs text-slate-400 hover:text-slate-200 hover:bg-slate-800 transition-colors",children:[g.jsx("svg",{className:"w-3.5 h-3.5 text-amber-400/70 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),g.jsx("span",{className:"font-medium text-slate-300",children:pe.name}),pe.description&&g.jsx("span",{className:"text-slate-600 truncate",children:pe.description})]},pe.name))})]}),D==="choose"&&jf.createPortal(g.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",onClick:()=>j(null),children:g.jsxs("div",{className:"bg-slate-900 border border-slate-700 rounded-xl p-6 max-w-md w-full mx-4 shadow-2xl",onClick:pe=>pe.stopPropagation(),children:[g.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Delete Node"}),g.jsxs("p",{className:"text-sm text-slate-400 mb-2",children:["How do you want to delete ",g.jsxs("span",{className:"font-mono text-slate-300",children:['"',$.aUid,'"']})," (",$.aType,")?"]}),ee>0&&g.jsxs("p",{className:"text-xs text-amber-400/80 mb-4",children:["This node has ",ee,"+ connected edge",ee!==1?"s":"","."]}),g.jsxs("div",{className:"flex flex-col gap-2 mt-4",children:[g.jsxs("button",{onClick:()=>{L(""),j("confirm-cascade")},className:"w-full px-4 py-2.5 bg-red-600 text-white rounded-lg text-sm font-medium hover:bg-red-500 transition-colors flex items-center justify-center gap-2",children:["Delete node + ",g.jsx("span",{className:"font-bold uppercase",children:"ALL"})," edges"]}),g.jsx("button",{onClick:()=>{L(""),j("confirm-node-only")},className:"w-full px-4 py-2 bg-slate-800 text-slate-300 rounded-lg text-sm hover:bg-slate-700 transition-colors flex items-center justify-center gap-2",children:"Delete node only"}),g.jsx("button",{onClick:()=>j(null),className:"w-full px-4 py-2 text-sm text-slate-500 hover:text-slate-300 transition-colors",children:"Cancel"})]})]})}),document.body),(D==="confirm-cascade"||D==="confirm-node-only")&&jf.createPortal(g.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",onClick:()=>{j(null),L("")},children:g.jsxs("div",{className:"bg-slate-900 border border-slate-700 rounded-xl p-6 max-w-md w-full mx-4 shadow-2xl",onClick:pe=>pe.stopPropagation(),children:[g.jsx("h3",{className:"text-lg font-semibold mb-2",children:D==="confirm-cascade"?g.jsxs(g.Fragment,{children:["Confirm: Delete node + ",g.jsx("span",{className:"text-red-400 uppercase",children:"ALL"})," edges"]}):"Confirm: Delete node only"}),g.jsx("p",{className:"text-sm text-slate-400 mb-4",children:D==="confirm-cascade"?g.jsxs(g.Fragment,{children:["This will permanently delete the node and ",g.jsx("span",{className:"text-red-400 font-semibold uppercase",children:"ALL"})," connected edges."]}):"This will delete only the node record. Connected edges will remain."}),g.jsxs("div",{className:"mb-4",children:[g.jsxs("p",{className:"text-xs text-slate-500 mb-2",children:["Type ",g.jsx("span",{className:"font-mono text-slate-300",children:$.aUid})," to confirm:"]}),g.jsx("input",{type:"text",value:R,onChange:pe=>L(pe.target.value),className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-slate-200 font-mono focus:outline-none focus:border-red-500/50 placeholder:text-slate-600",placeholder:$.aUid,autoFocus:!0,onKeyDown:pe=>{pe.key==="Enter"&&R===$.aUid&&(D==="confirm-cascade"?Se():He())}})]}),g.jsxs("div",{className:"flex justify-end gap-3",children:[g.jsx("button",{onClick:()=>{j("choose"),L("")},disabled:le.isPending||se.isPending,className:"px-4 py-2 text-sm text-slate-400 hover:text-slate-200 transition-colors disabled:opacity-50",children:"Back"}),g.jsxs("button",{onClick:D==="confirm-cascade"?Se:He,disabled:R!==$.aUid||le.isPending||se.isPending,className:"px-4 py-2 bg-red-600 text-white rounded-lg text-sm font-medium hover:bg-red-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[(le.isPending||se.isPending)&&g.jsx("div",{className:"w-3.5 h-3.5 border-2 border-white border-t-transparent rounded-full animate-spin"}),D==="confirm-cascade"?"Delete":"Delete node only"]})]})]})}),document.body),V&&g.jsx(fE,{title:"Delete Edge",message:`Delete edge ${V.aUid} —[${ro(V.axbType,V.inverseLabel)}]→ ${V.bUid}?`,requireConfirmText:V.axbType,onConfirm:ke,onCancel:()=>Q(null),loading:Ne.isPending}),P&&g.jsx(fE,{title:P.mode==="visible"?`Delete ${P.edges.length} Edge${P.edges.length!==1?"s":""}`:P.mode==="filtered"?"Delete Filtered Edges":g.jsxs(g.Fragment,{children:["Delete ",g.jsx("span",{className:"text-red-400 uppercase font-bold",children:"ALL"})," Edges"]}),message:P.mode==="visible"?`Delete the ${P.edges.length} "${ro(P.axbType,P.inverseLabel)}" edge${P.edges.length!==1?"s":""} currently visible on this page?`:P.mode==="filtered"?`Delete all "${ro(P.axbType,P.inverseLabel)}" edges ${P.direction==="out"?"from":"to"} this node that match the current filters? This may include edges on other pages.`:g.jsxs(g.Fragment,{children:["Delete ",g.jsx("span",{className:"text-red-400 font-semibold uppercase",children:"ALL"}),' "',ro(P.axbType,P.inverseLabel),'" edges ',P.direction==="out"?"from":"to"," this node? This cannot be undone."]}),confirmLabel:P.mode==="visible"?`Delete ${P.edges.length}`:"Delete All",requireConfirmText:P.axbType,onConfirm:De,onCancel:()=>U(null),loading:Ae.isPending||We.isPending}),A&&$&&g.jsx(CN,{node:$,schema:e,viewRegistry:a,config:r,onClose:()=>M(!1),onNodeClick:(pe,Ye)=>{M(!1),f({uid:pe,nodeType:Ye,edgeType:"",direction:"out"})}})]})}function vE({uid:t,direction:e,axbTypes:a,inverseLabelMap:r={},canWrite:i,onDeleteEdge:s,onBulkDelete:o,nodeUid:u,reloadKey:d,viewRegistry:f,config:h,schema:p,publishToNearby:m=!1}){const{scopePath:y}=Wa(),[x,E]=I.useState(25),[S,T]=I.useState(""),[C,N]=I.useState(""),[A,M]=I.useState("asc"),[D,j]=I.useState(""),[R,L]=I.useState("=="),[z,_]=I.useState(""),[B,q]=I.useState([]),[V,Q]=I.useState(!1),[P,U]=I.useState(1),[F,K]=I.useState([]),[J,k]=I.useState(void 0),[G,X]=I.useState(!1),[W,$]=I.useState(!1),[ee,ie]=I.useState({}),he=["axbType","aType","aUid","bType","bUid","createdAt","updatedAt"],oe=I.useMemo(()=>{const xe=p.edgeSchemas??[],pe=S?xe.filter(tt=>tt.axbType===S):xe.filter(tt=>a.includes(tt.axbType)),Ye=new Set;for(const tt of pe)for(const Ke of tt.fields)Ye.add(Ke.name);return[...Ye].sort()},[p.edgeSchemas,S,a]),ae={...e==="out"?{aUid:t}:{bUid:t},...S?{axbType:S}:{},limit:x,startAfter:J,...C?{sortBy:C,sortDir:A}:{},...B.length>0?{where:B}:{},...Xt(y)},{data:re,isLoading:le,error:se,refetch:Ne}=xt.getEdges.useQuery(ae,{placeholderData:xe=>xe}),Ae=(re==null?void 0:re.edges)??[],We=(re==null?void 0:re.hasMore)??!1,He=(re==null?void 0:re.nextCursor)??null,Se=(se==null?void 0:se.message)??null,ke=Ro();I.useEffect(()=>{!m||!ke||ke.setEdgeResults(e,{edges:Ae,hasMore:We,loading:le})},[m,ke,e,Ae,We,le]);const De=W&&Ae.length>0?[...new Set(Ae.map(xe=>e==="out"?xe.bUid:xe.aUid))].filter(xe=>!(xe in ee)):[],{data:Be,isFetching:Ge}=xt.getNodesBatch.useQuery({uids:De,...Xt(y)},{enabled:De.length>0});I.useEffect(()=>{if(!Be)return;const xe={};for(const[pe,Ye]of Object.entries(Be.nodes))xe[pe]=Ye;ie(pe=>({...pe,...xe}))},[Be]),I.useEffect(()=>{U(1),K([]),k(void 0),ie({})},[t,e,x,S,C,A,B,d,y]);const Je=()=>{He&&(K(xe=>[...xe,He]),U(xe=>xe+1),k(He))},Re=()=>{if(P<=1)return;const xe=[...F];xe.pop();const pe=xe.length>0?xe[xe.length-1]:void 0;K(xe),U(Ye=>Ye-1),k(pe)},nt={};for(const xe of Ae){const pe=xe.axbType;nt[pe]||(nt[pe]=[]),nt[pe].push(xe)}return g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-3",children:[g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("label",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold",children:"Show"}),g.jsx("select",{value:x,onChange:xe=>E(Number(xe.target.value)),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-xs text-slate-200 focus:outline-none focus:border-indigo-500",children:Uz.map(xe=>g.jsx("option",{value:xe,children:xe},xe))})]}),a.length>0&&g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"w-px h-4 bg-slate-700"}),g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("label",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold",children:"Type"}),g.jsxs("select",{value:S,onChange:xe=>T(xe.target.value),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-xs text-slate-200 focus:outline-none focus:border-indigo-500",children:[g.jsx("option",{value:"",children:"All"}),a.map(xe=>g.jsx("option",{value:xe,children:xe},xe))]})]})]}),g.jsx("div",{className:"w-px h-4 bg-slate-700"}),g.jsxs("button",{onClick:()=>Q(xe=>!xe),className:`px-2 py-1 border rounded text-xs transition-colors flex items-center gap-1 ${V||C||B.length>0?"bg-indigo-600/20 border-indigo-500/40 text-indigo-300":"bg-slate-800 border-slate-700 text-slate-400 hover:bg-slate-700"}`,children:[g.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"})}),B.length>0?`Filter (${B.length})`:C?"Sort":"Sort / Filter"]}),g.jsx("div",{className:"w-px h-4 bg-slate-700"}),g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("button",{onClick:Re,disabled:P<=1||le,className:"px-2 py-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 hover:bg-slate-700 transition-colors disabled:opacity-30 disabled:cursor-not-allowed",children:"Prev"}),g.jsxs("span",{className:"text-xs text-slate-400 px-1",children:["Page ",P]}),g.jsx("button",{onClick:Je,disabled:!We||le,className:"px-2 py-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 hover:bg-slate-700 transition-colors disabled:opacity-30 disabled:cursor-not-allowed",children:"Next"})]}),g.jsx("button",{onClick:()=>{U(1),K([]),k(void 0),Ne()},disabled:le,className:"px-2 py-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 hover:bg-slate-700 transition-colors disabled:opacity-50",title:"Refresh",children:g.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}),g.jsx("div",{className:"w-px h-4 bg-slate-700"}),g.jsx("button",{onClick:()=>X(xe=>!xe),className:`px-2 py-1 border rounded text-xs transition-colors ${G?"bg-indigo-600/30 border-indigo-500/50 text-indigo-300":"bg-slate-800 border-slate-700 text-slate-400 hover:bg-slate-700"}`,title:G?"Collapse all edge details":"Expand all edge details",children:G?"Collapse all":"Expand all"}),g.jsx("button",{onClick:()=>$(xe=>!xe),className:`px-2 py-1 border rounded text-xs transition-colors ${W?"bg-indigo-600/30 border-indigo-500/50 text-indigo-300":"bg-slate-800 border-slate-700 text-slate-400 hover:bg-slate-700"}`,title:W?"Stop resolving target nodes":"Resolve all target nodes inline",children:Ge?g.jsxs("span",{className:"flex items-center gap-1",children:[g.jsx("span",{className:"w-2.5 h-2.5 border border-indigo-400 border-t-transparent rounded-full animate-spin"}),"Resolving..."]}):W?"Resolved":"Resolve all"})]}),V&&g.jsxs("div",{className:"bg-slate-800/50 border border-slate-700 rounded-lg p-3 mb-3 space-y-3",children:[g.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[g.jsx("label",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold w-10",children:"Sort"}),g.jsxs("select",{value:C,onChange:xe=>N(xe.target.value),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-xs text-slate-200 focus:outline-none focus:border-indigo-500",children:[g.jsx("option",{value:"",children:"Default (axbType)"}),he.map(xe=>g.jsx("option",{value:xe,children:xe},xe)),oe.length>0&&g.jsx("optgroup",{label:"Data fields",children:oe.map(xe=>g.jsx("option",{value:xe,children:xe},xe))})]}),g.jsxs("select",{value:A,onChange:xe=>M(xe.target.value),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-xs text-slate-200 focus:outline-none focus:border-indigo-500",children:[g.jsx("option",{value:"asc",children:"asc"}),g.jsx("option",{value:"desc",children:"desc"})]})]}),B.length>0&&g.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[B.map((xe,pe)=>g.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-indigo-600/20 border border-indigo-500/30 rounded text-[11px] text-indigo-300",children:[g.jsx("span",{className:"font-mono",children:xe.field}),g.jsx("span",{className:"text-indigo-400",children:xe.op}),g.jsx("span",{className:"font-mono",children:String(xe.value)}),g.jsx("button",{onClick:()=>q(Ye=>Ye.filter((tt,Ke)=>Ke!==pe)),className:"ml-0.5 text-indigo-400 hover:text-red-400 transition-colors",children:"×"})]},pe)),g.jsx("button",{onClick:()=>q([]),className:"text-[10px] text-slate-500 hover:text-red-400 transition-colors",children:"Clear all"})]}),g.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[g.jsx("label",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold w-10",children:"Where"}),g.jsxs("select",{value:D,onChange:xe=>j(xe.target.value),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-xs text-slate-200 focus:outline-none focus:border-indigo-500",children:[g.jsx("option",{value:"",children:"Field..."}),he.map(xe=>g.jsx("option",{value:xe,children:xe},xe)),oe.length>0&&g.jsx("optgroup",{label:"Data fields",children:oe.map(xe=>g.jsx("option",{value:xe,children:xe},xe))})]}),g.jsx("select",{value:R,onChange:xe=>L(xe.target.value),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-xs text-slate-200 focus:outline-none focus:border-indigo-500",children:["==","!=","<","<=",">",">="].map(xe=>g.jsx("option",{value:xe,children:xe},xe))}),g.jsx("input",{type:"text",value:z,onChange:xe=>_(xe.target.value),placeholder:"value",className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-xs text-slate-200 focus:outline-none focus:border-indigo-500 w-28",onKeyDown:xe=>{if(xe.key==="Enter"&&D&&z){let pe=z;z==="true"?pe=!0:z==="false"?pe=!1:!isNaN(Number(z))&&z.trim()!==""&&(pe=Number(z)),q(Ye=>[...Ye,{field:D,op:R,value:pe}]),_("")}}}),g.jsx("button",{onClick:()=>{if(!D||!z)return;let xe=z;z==="true"?xe=!0:z==="false"?xe=!1:!isNaN(Number(z))&&z.trim()!==""&&(xe=Number(z)),q(pe=>[...pe,{field:D,op:R,value:xe}]),_("")},disabled:!D||!z,className:"px-2 py-1 bg-indigo-600/30 text-indigo-300 rounded text-xs hover:bg-indigo-600/40 transition-colors disabled:opacity-30 disabled:cursor-not-allowed",children:"Add"})]})]}),Se&&g.jsx("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-2 mb-3 text-xs text-red-400",children:Se}),le?g.jsxs("div",{className:"flex items-center gap-2 text-slate-400 py-6 justify-center",children:[g.jsx("div",{className:"w-3.5 h-3.5 border-2 border-indigo-500 border-t-transparent rounded-full animate-spin"}),g.jsx("span",{className:"text-xs",children:"Loading edges..."})]}):Ae.length===0?g.jsxs("p",{className:"text-sm text-slate-500",children:["No ",e==="out"?"outgoing":"incoming"," edges",S?` of type "${S}"`:""]}):g.jsx("div",{className:"space-y-4",children:Object.entries(nt).map(([xe,pe])=>g.jsx(Vz,{axbType:xe,edges:pe,direction:e,inverseLabel:e==="in"?r[xe]:void 0,canWrite:i,onDeleteEdge:s,onBulkDelete:o&&u?Ye=>{const tt=e==="in"?r[xe]:void 0;o(Ye==="visible"?{mode:"visible",axbType:xe,inverseLabel:tt,edges:pe.map(Ke=>({aUid:Ke.aUid,axbType:Ke.axbType,bUid:Ke.bUid}))}:Ye==="filtered"?{mode:"filtered",axbType:xe,inverseLabel:tt,direction:e,uid:u,where:B}:{mode:"all",axbType:xe,inverseLabel:tt,direction:e,uid:u})}:void 0,hasActiveFilters:B.length>0,expandAll:G,resolveAll:W,resolvedNodes:ee,viewRegistry:f,config:h},xe))}),Ae.length>0&&(We||P>1)&&g.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[g.jsxs("span",{className:"text-[10px] text-slate-500",children:[Ae.length," edge",Ae.length!==1?"s":""," on this page"]}),g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("button",{onClick:Re,disabled:P<=1||le,className:"px-2 py-1 bg-slate-800 text-slate-300 rounded text-xs hover:bg-slate-700 transition-colors disabled:opacity-30 disabled:cursor-not-allowed",children:"Previous"}),g.jsxs("span",{className:"text-[10px] text-slate-400 px-1",children:["Page ",P]}),g.jsx("button",{onClick:Je,disabled:!We||le,className:"px-2 py-1 bg-slate-800 text-slate-300 rounded text-xs hover:bg-slate-700 transition-colors disabled:opacity-30 disabled:cursor-not-allowed",children:"Next"})]})]})]})}function Vz({axbType:t,edges:e,direction:a,inverseLabel:r,canWrite:i,onDeleteEdge:s,onBulkDelete:o,hasActiveFilters:u=!1,expandAll:d,resolveAll:f,resolvedNodes:h,viewRegistry:p,config:m}){var J;const{scopePath:y}=Wa(),[x,E]=I.useState(!1),[S,T]=I.useState(""),[C,N]=I.useState(""),[A,M]=I.useState(!1),[D,j]=I.useState(!1),[R,L]=I.useState({}),z=d||A,_=f||D,[B,q]=I.useState(!0),V=((J=p==null?void 0:p.edges[t])==null?void 0:J.views)??[],Q=I.useMemo(()=>{var G;const k=new Map;if(!p)return[];for(const X of e){const W=a==="out"?X.bType:X.aType;for(const $ of((G=p.nodes[W])==null?void 0:G.views)??[])k.has($.viewName)||k.set($.viewName,$)}return[...k.values()]},[p,e,a]),P={...h,...R},U=D&&!f&&e.length>0?[...new Set(e.map(k=>a==="out"?k.bUid:k.aUid))].filter(k=>!(k in P)):[],{data:F,isFetching:K}=xt.getNodesBatch.useQuery({uids:U,...Xt(y)},{enabled:U.length>0});return I.useEffect(()=>{if(!F)return;const k={};for(const[G,X]of Object.entries(F.nodes))k[G]=X;L(G=>({...G,...k}))},[F]),g.jsxs("div",{children:[g.jsxs("div",{className:"text-xs font-mono mb-2 flex items-center gap-2",children:[a==="out"?g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"text-slate-500",children:"—"}),g.jsx("span",{className:"text-indigo-400",children:t}),g.jsx("span",{className:"text-slate-500",children:"→"})]}):r?g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"text-slate-500",children:"—"}),g.jsx("span",{className:"text-amber-400 cursor-help",title:`Inverse of: ${t}`,children:r}),g.jsx("span",{className:"text-slate-500",children:"→"})]}):g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"text-slate-500",children:"←"}),g.jsx("span",{className:"text-indigo-400",children:t}),g.jsx("span",{className:"text-slate-500",children:"—"})]}),g.jsxs("span",{className:"text-slate-600 text-[10px]",children:["(",e.length,")"]}),g.jsxs("div",{className:"ml-auto flex items-center gap-1.5",children:[g.jsx("button",{onClick:()=>M(k=>!k),className:`p-1 border rounded transition-colors ${z?"bg-indigo-600/30 border-indigo-500/50 text-indigo-300":"bg-slate-800 border-slate-700 text-slate-500 hover:text-slate-300 hover:bg-slate-700"}`,title:z?"Collapse edges":"Expand edges",children:g.jsx("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:z?g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 14h6v6M20 10h-6V4M14 10l7-7M3 21l7-7"}):g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"})})}),g.jsx("button",{onClick:()=>{_?q(k=>!k):(j(!0),q(!0))},className:`p-1 border rounded transition-colors ${_?B?"bg-indigo-600/30 border-indigo-500/50 text-indigo-300":"bg-slate-800 border-indigo-500/50 text-slate-500 hover:text-slate-300":"bg-slate-800 border-slate-700 text-slate-500 hover:text-slate-300 hover:bg-slate-700"}`,title:_?B?"Hide node data":"Show node data":"Resolve target nodes","aria-label":_?B?"Hide node data":"Show node data":"Resolve target nodes",children:K?g.jsx("span",{className:"w-3 h-3 border-[1.5px] border-indigo-400 border-t-transparent rounded-full animate-spin block"}):_&&B?g.jsx("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M3 3l18 18"})}):g.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]})}),V.length>0&&g.jsxs("span",{className:"relative inline-flex items-center",children:[g.jsx("svg",{className:"w-3 h-3 text-slate-500 absolute left-1.5 pointer-events-none",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 5l7 7-7 7M5 12h14"})}),g.jsxs("select",{value:S,onChange:k=>T(k.target.value),className:"bg-slate-800 border border-slate-700 rounded pl-6 pr-1.5 py-0.5 text-[10px] text-slate-300 focus:outline-none focus:border-indigo-500 appearance-none",style:{direction:"rtl"},title:"Edge data view",children:[g.jsx("option",{value:"",dir:"ltr",children:"default"}),g.jsx("option",{value:"json",dir:"ltr",children:"JSON"}),V.map(k=>g.jsx("option",{value:k.viewName,dir:"ltr",children:k.viewName},k.viewName))]})]}),Q.length>0&&g.jsxs("span",{className:"relative inline-flex items-center",children:[g.jsx("svg",{className:"w-3 h-3 text-slate-500 absolute left-1.5 pointer-events-none",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:g.jsx("circle",{cx:"12",cy:"12",r:"8"})}),g.jsxs("select",{value:C,onChange:k=>N(k.target.value),className:"bg-slate-800 border border-slate-700 rounded pl-6 pr-1.5 py-0.5 text-[10px] text-slate-300 focus:outline-none focus:border-indigo-500 appearance-none",style:{direction:"rtl"},title:"Node data view",children:[g.jsx("option",{value:"",dir:"ltr",children:"default"}),g.jsx("option",{value:"json",dir:"ltr",children:"JSON"}),Q.map(k=>g.jsx("option",{value:k.viewName,dir:"ltr",children:k.viewName},k.viewName))]})]}),i&&o&&g.jsxs("div",{className:"relative",children:[g.jsx("button",{onClick:()=>E(k=>!k),className:`p-1 border rounded transition-colors ${x?"bg-red-600/20 border-red-500/50 text-red-400":"bg-slate-800 border-slate-700 text-slate-600 hover:text-red-400 hover:border-red-500/50"}`,title:`Bulk delete ${ro(t,r)} edges`,children:g.jsx("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})}),x&&g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"fixed inset-0 z-30",onClick:()=>E(!1)}),g.jsxs("div",{className:"absolute right-0 top-full mt-1 z-40 bg-slate-800 border border-slate-700 rounded-lg shadow-xl py-1 min-w-[200px]",children:[g.jsxs("button",{onClick:()=>{E(!1),o("visible")},className:"w-full text-left px-3 py-2 text-xs text-slate-300 hover:bg-slate-700 transition-colors",children:["Delete visible (",e.length,")"]}),u&&g.jsx("button",{onClick:()=>{E(!1),o("filtered")},className:"w-full text-left px-3 py-2 text-xs text-slate-300 hover:bg-slate-700 transition-colors",children:"Delete all matching filters"}),g.jsxs("button",{onClick:()=>{E(!1),o("all")},className:"w-full text-left px-3 py-2 text-xs text-red-400 hover:bg-slate-700 transition-colors",children:["Delete ",g.jsx("span",{className:"font-bold uppercase",children:"ALL"})," ",ro(t,r)," edges"]})]})]})]})]})]}),g.jsx("div",{className:"space-y-1",children:e.map((k,G)=>{var $,ee;const X=a==="out"?k.bUid:k.aUid,W=a==="out"?k.bType:k.aType;return g.jsx(Fz,{edge:k,targetUid:X,targetType:W,direction:a,canWrite:i,onDelete:()=>s(k),expandAllActive:z,resolvedNode:P[X],resolveAllActive:_,edgeViews:(($=p==null?void 0:p.edges[k.axbType])==null?void 0:$.views)??[],nodeViews:((ee=p==null?void 0:p.nodes[W])==null?void 0:ee.views)??[],config:m,groupEdgeView:S,groupNodeView:C,groupNodeVisible:B},G)})})]})}function Fz({edge:t,targetUid:e,targetType:a,direction:r,canWrite:i,onDelete:s,expandAllActive:o,resolvedNode:u,resolveAllActive:d,edgeViews:f=[],nodeViews:h=[],config:p,groupEdgeView:m="",groupNodeView:y="",groupNodeVisible:x=!0}){const{drillIn:E}=eh(),{scopePath:S,scopedPath:T}=Wa(),C=xt.useUtils(),[N,A]=I.useState(!1),M=N||!!o,[D,j]=I.useState(!1),R=()=>{var oe,ae;const he=(ae=(oe=p.viewDefaults)==null?void 0:oe.edges)==null?void 0:ae[t.axbType];if(he&&f.length>0){const re=an(he,f,"inline");if(re!=="json"){const le=f.find(se=>se.viewName===re);if(le)return le.tagName}}return"json"},[L,z]=I.useState(R),_=()=>{var oe,ae;const he=(ae=(oe=p.viewDefaults)==null?void 0:oe.nodes)==null?void 0:ae[a];if(he&&h.length>0){const re=an(he,h,"inline");if(re!=="json"){const le=h.find(se=>se.viewName===re);if(le)return le.tagName}}return"json"},[B,q]=I.useState(_),V=(he,oe,ae)=>{if(!he)return ae;if(he==="json")return"json";const re=oe.find(le=>le.viewName===he);return re?re.tagName:ae},Q=V(m,f,L),P=z,U=V(y,h,B),F=q,[K,J]=I.useState(void 0),[k,G]=I.useState(!1),X=Object.keys(t.data).length>0,W=K!==void 0?K:u,$=W!==void 0;I.useEffect(()=>{var he,oe;if(d&&u!==void 0&&(j(!0),u)){const ae=(oe=(he=p.viewDefaults)==null?void 0:he.nodes)==null?void 0:oe[a];if(ae&&h.length>0){const re=an(ae,h,"inline");if(re!=="json"){const le=h.find(se=>se.viewName===re);le&&F(le.tagName)}}}},[d,u]);const ee=async()=>{var he,oe;G(!0);try{const re=(await C.getNodesBatch.fetch({uids:[e],...Xt(S)})).nodes[e]??null;if(J(re),j(!0),re){const le=(oe=(he=p.viewDefaults)==null?void 0:he.nodes)==null?void 0:oe[a];if(le&&h.length>0){const se=an(le,h,"inline");if(se!=="json"){const Ne=h.find(Ae=>Ae.viewName===se);Ne&&F(Ne.tagName)}}}}catch{}finally{G(!1)}},ie=()=>{E({uid:e,nodeType:a,edgeType:t.axbType,direction:r})};return g.jsxs("div",{className:"bg-slate-800/50 rounded-lg",children:[g.jsxs("div",{className:"flex items-center gap-3 px-3 py-2",children:[g.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono ${ra(a)}`,children:a}),g.jsx("button",{onClick:ie,className:"text-sm font-mono text-indigo-400 hover:text-indigo-300 transition-colors",title:"Dive into this node",children:e}),g.jsx(Ua,{to:T(`/node/${encodeURIComponent(e)}`),className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",title:"Navigate to this node's page",children:"go to"}),g.jsx("button",{onClick:()=>A(!N),className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",children:M?"hide edge":"show edge"}),!$&&!k&&g.jsx("button",{onClick:ee,className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",children:"resolve"}),k&&g.jsx("span",{className:"w-2.5 h-2.5 border border-slate-400 border-t-transparent rounded-full animate-spin"}),$&&g.jsx("button",{onClick:()=>j(!D),className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",children:D?"hide node":"show node"}),i&&g.jsx("button",{onClick:s,className:"ml-auto text-[10px] text-slate-600 hover:text-red-400 transition-colors",children:"delete"})]}),M&&g.jsxs("div",{className:"px-3 pb-2 space-y-2",children:[g.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-[11px] font-mono bg-slate-950 rounded p-2",children:[g.jsx("span",{className:"text-slate-500",children:"aType"}),g.jsx("span",{className:"text-slate-300",children:t.aType}),g.jsx("span",{className:"text-slate-500",children:"aUid"}),g.jsx("span",{className:"text-slate-300",children:t.aUid}),g.jsx("span",{className:"text-slate-500",children:"axbType"}),g.jsx("span",{className:"text-slate-300",children:t.axbType}),g.jsx("span",{className:"text-slate-500",children:"bType"}),g.jsx("span",{className:"text-slate-300",children:t.bType}),g.jsx("span",{className:"text-slate-500",children:"bUid"}),g.jsx("span",{className:"text-slate-300",children:t.bUid}),g.jsx("span",{className:"text-slate-500",children:"createdAt"}),g.jsx("span",{className:"text-slate-300",children:no(t.createdAt)}),g.jsx("span",{className:"text-slate-500",children:"updatedAt"}),g.jsx("span",{className:"text-slate-300",children:no(t.updatedAt)})]}),X&&g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[g.jsx("span",{className:"text-[10px] text-slate-500 uppercase tracking-wider font-semibold",children:"Data"}),f.length>0&&g.jsx(No,{views:f,activeView:Q,onSwitch:P})]}),Q==="json"?g.jsx("div",{className:"font-mono text-[11px] leading-relaxed bg-slate-950 rounded p-2 overflow-auto max-h-40",children:g.jsx(Dr,{data:t.data,defaultExpanded:!0})}):g.jsx(Xn,{tagName:Q,data:t.data,onError:()=>P("json")})]})]}),D&&$&&x&&g.jsx("div",{className:"px-3 pb-2",children:W===null?g.jsx("p",{className:"text-[11px] text-slate-500 italic",children:"Node not found"}):g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[g.jsx("span",{className:"text-[10px] text-slate-500 uppercase tracking-wider font-semibold",children:"Node Data"}),g.jsx("span",{className:"text-[10px] text-slate-600",children:no(W.updatedAt)}),h.length>0&&g.jsx(No,{views:h,activeView:U,onSwitch:F})]}),U==="json"?g.jsx("div",{className:"font-mono text-[11px] leading-relaxed bg-slate-950 rounded p-2 overflow-auto max-h-40",children:g.jsx(Dr,{data:W.data,defaultExpanded:!0})}):g.jsx(Xn,{tagName:U,data:W.data,onError:()=>F("json")})]})})]})}function Hz(t){const e=t.data;switch(t.kind){case"node-detail":{const a=e.node;return a?`${a.type}:${a.uid}`:"Node Not Found"}case"nodes-list":return`${(Array.isArray(e.nodes)?e.nodes:[]).length} Nodes`;case"edges-list":return`${(Array.isArray(e.edges)?e.edges:[]).length} Edges`;case"traverse":return`Traversal (${(Array.isArray(e.hops)?e.hops:[]).length} hops)`;case"search":return"Search Results";case"schema":return"Schema";default:return"Query Result"}}function Gz({artifact:t,viewRegistry:e,config:a,onNavigate:r}){switch(t.kind){case"node-detail":return g.jsx(Qz,{data:t.data,viewRegistry:e,config:a,onNavigate:r});case"nodes-list":return g.jsx(Yz,{data:t.data,onNavigate:r});case"edges-list":return g.jsx(Kz,{data:t.data,onNavigate:r});case"traverse":return g.jsx($z,{data:t.data,onNavigate:r});case"search":return g.jsx(Xz,{data:t.data,onNavigate:r});case"schema":return g.jsx(Zz,{data:t.data});default:return g.jsx(Dr,{data:t.data??{},defaultExpanded:!0})}}function Qz({data:t,viewRegistry:e,config:a,onNavigate:r}){const i=t.node;return i?g.jsxs("div",{className:"space-y-4",children:[g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-mono ${ra(i.type)}`,children:i.type}),g.jsx("h1",{className:"text-xl font-bold font-mono",children:i.uid}),g.jsx("button",{onClick:()=>r(i.uid),className:"ml-auto px-3 py-1.5 bg-indigo-600/20 text-indigo-400 rounded-lg text-xs hover:bg-indigo-600/30 transition-colors",children:"View full details"})]}),g.jsx(ON,{nodeType:i.type,data:i.data??{},viewRegistry:e,config:a})]}):g.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-8 text-center",children:[g.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Node Not Found"}),g.jsx("p",{className:"text-sm text-slate-400",children:"The queried node was not found."})]})}function Yz({data:t,onNavigate:e}){const a=t.nodes??[],r=t.hasMore;return g.jsxs("div",{className:"space-y-2",children:[a.map((i,s)=>g.jsxs("div",{className:"bg-slate-900 rounded-lg border border-slate-800 px-4 py-3",children:[g.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[g.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono ${ra(i.type)}`,children:i.type}),g.jsx("button",{onClick:()=>e(i.uid),className:"font-mono text-xs text-indigo-400 hover:text-indigo-300 transition-colors",children:i.uid})]}),i.data&&Object.keys(i.data).length>0&&g.jsx("div",{className:"mt-1",children:g.jsx(Dr,{data:i.data,defaultExpanded:!1})})]},s)),r&&g.jsx("p",{className:"text-[10px] text-slate-500 text-center py-1",children:"Results truncated — use a higher limit to see more"})]})}function Kz({data:t,onNavigate:e}){const a=t.edges??[],r=t.hasMore;return g.jsxs("div",{className:"space-y-1",children:[g.jsx(RN,{edges:a,onNavigate:e}),r&&g.jsx("p",{className:"text-[10px] text-slate-500 text-center py-1",children:"Results truncated — use a higher limit to see more"})]})}function $z({data:t,onNavigate:e}){const a=t.hops??[],r=t.totalReads;return g.jsxs("div",{className:"space-y-4",children:[a.map((i,s)=>g.jsxs(f0,{title:`Hop ${i.depth}: ${i.relation} (${i.direction})`,badge:`${i.edgeCount} edges`,children:[g.jsx(RN,{edges:i.edges,onNavigate:e}),i.truncated&&g.jsx("p",{className:"text-[10px] text-amber-500 mt-1",children:"Truncated — increase limit to see more"})]},s)),r!=null&&g.jsxs("p",{className:"text-[10px] text-slate-500 text-right",children:[r," total reads"]})]})}function Xz({data:t,onNavigate:e}){const a=t.results??[];return a.length===0?g.jsx("p",{className:"text-slate-400 text-sm",children:"No results found"}):g.jsx("div",{className:"space-y-2",children:a.map((r,i)=>g.jsxs("div",{className:"bg-slate-900 rounded-lg border border-slate-800 px-4 py-3",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono ${ra(r.type)}`,children:r.type}),g.jsx("button",{onClick:()=>e(r.uid),className:"font-mono text-xs text-indigo-400 hover:text-indigo-300 transition-colors",children:r.uid}),r.matchType&&g.jsx("span",{className:"text-[9px] text-slate-500 ml-auto",children:r.matchType})]}),r.data&&Object.keys(r.data).length>0&&g.jsx("div",{className:"mt-1",children:g.jsx(Dr,{data:r.data,defaultExpanded:!1})})]},i))})}function Zz({data:t}){const e=t.nodeTypes??[],a=t.edgeTypes??[];return g.jsxs("div",{className:"space-y-4",children:[g.jsx(f0,{title:`Node Types (${e.length})`,children:g.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.map(r=>g.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-mono ${ra(r)}`,children:r},r))})}),g.jsx(f0,{title:`Edge Types (${a.length})`,children:g.jsx("div",{className:"space-y-1",children:a.map((r,i)=>g.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-mono",children:[g.jsx("span",{className:`px-1 py-0.5 rounded text-[10px] ${ra(r.from)}`,children:r.from}),g.jsx("span",{className:"text-slate-500",children:"--["}),g.jsx("span",{className:"text-indigo-400",children:r.relation}),g.jsx("span",{className:"text-slate-500",children:"]-->"}),g.jsx("span",{className:`px-1 py-0.5 rounded text-[10px] ${ra(r.to)}`,children:r.to}),r.inverseLabel&&g.jsxs("span",{className:"text-[10px] text-slate-600 ml-1",children:["(",r.inverseLabel,")"]})]},i))})})]})}function f0({title:t,badge:e,trailing:a,children:r}){return g.jsxs("section",{className:"bg-slate-900 rounded-xl border border-slate-800 p-4",children:[g.jsxs("div",{className:"flex items-center justify-between mb-3",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("h3",{className:"text-sm font-semibold text-slate-200",children:t}),e&&g.jsx("span",{className:"text-[10px] text-slate-500",children:e})]}),a]}),r]})}function RN({edges:t,onNavigate:e}){const[a,r]=I.useState(new Set);return g.jsx("div",{className:"space-y-0.5",children:t.map((i,s)=>g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-1.5 py-1.5 text-xs",children:[g.jsx("span",{className:`px-1 py-0.5 rounded text-[10px] font-mono ${ra(i.fromType)}`,children:i.fromType}),g.jsx("button",{onClick:()=>e(i.fromUid),className:"font-mono text-indigo-400 hover:text-indigo-300 transition-colors truncate max-w-[100px]",title:i.fromUid,children:i.fromUid}),g.jsx("span",{className:"text-slate-500 shrink-0",children:"--["}),g.jsx("span",{className:"text-indigo-400 shrink-0",children:i.relation}),g.jsx("span",{className:"text-slate-500 shrink-0",children:"]-->"}),g.jsx("span",{className:`px-1 py-0.5 rounded text-[10px] font-mono ${ra(i.toType)}`,children:i.toType}),g.jsx("button",{onClick:()=>e(i.toUid),className:"font-mono text-indigo-400 hover:text-indigo-300 transition-colors truncate max-w-[100px]",title:i.toUid,children:i.toUid}),i.data&&Object.keys(i.data).length>0&&g.jsx("button",{onClick:()=>{r(o=>{const u=new Set(o);return u.has(s)?u.delete(s):u.add(s),u})},className:"text-[10px] text-slate-500 hover:text-slate-300 ml-auto shrink-0",children:a.has(s)?"hide":"data"})]}),a.has(s)&&i.data&&g.jsx("div",{className:"ml-4 mb-1",children:g.jsx(Dr,{data:i.data,defaultExpanded:!0})})]},s))})}function Wz({schema:t,viewRegistry:e,config:a}){const{messages:r,status:i,isStreaming:s,sendMessage:o,clearHistory:u,chatEnabled:d}=CO(),{mode:f,expand:h,collapse:p}=MO(),{activeArtifact:m,showArtifact:y,dismissArtifact:x}=jO(),E=Ro(),S=$r(),[T,C]=I.useState(""),N=I.useRef(null),A=I.useRef(null),M=I.useRef(null),D=I.useRef(null),j=I.useRef(typeof window<"u"&&("ontouchstart"in window||navigator.maxTouchPoints>0)),R=m!==null;I.useEffect(()=>{var U;(U=N.current)==null||U.scrollIntoView({behavior:"smooth"})},[r]),I.useEffect(()=>{const U=A.current;U&&(U.style.height="auto",U.style.height=Math.min(U.scrollHeight,120)+"px")},[T]),I.useEffect(()=>{f==="expanded"&&setTimeout(()=>{var U;return(U=A.current)==null?void 0:U.focus()},100)},[f]),I.useEffect(()=>{if(!d)return;const U=F=>{const K=F.target.tagName,J=F.target===A.current;if((F.metaKey||F.ctrlKey)&&F.key==="k"){F.preventDefault(),f==="collapsed"?h():p();return}F.key==="Escape"&&f==="expanded"&&(J||K!=="INPUT"&&K!=="TEXTAREA"&&K!=="SELECT")&&(R?x():p())};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[d,f,h,p,R,x]);const L=I.useCallback(()=>{j.current||f!=="collapsed"||(M.current=window.setTimeout(()=>{h()},200))},[f,h]),z=I.useCallback(()=>{M.current!==null&&(clearTimeout(M.current),M.current=null)},[]),_=I.useCallback(()=>{s||j.current||(D.current=window.setTimeout(()=>{p()},300))},[s,p]),B=I.useCallback(()=>{D.current!==null&&(clearTimeout(D.current),D.current=null)},[]),q=I.useCallback(()=>{const U=T.trim();if(!U||s||i!=="connected")return;const F=DO(E,t);o(U,F),C("")},[T,s,i,E,t,o]),V=U=>{U.key==="Enter"&&!U.shiftKey&&(U.preventDefault(),q())},Q=I.useCallback(U=>{y(U)},[y]),P=I.useCallback(U=>{x(),p(),S(`/node/${encodeURIComponent(U)}`)},[x,p,S]);return d?f==="collapsed"?g.jsx("div",{className:"fixed bottom-0 left-0 right-0 z-50 flex justify-center pointer-events-none",style:{height:40},children:g.jsx("div",{className:"pointer-events-auto cursor-pointer flex items-end pb-3",style:{width:160},onMouseEnter:L,onMouseLeave:z,onClick:()=>{z(),h()},children:g.jsx("div",{className:"chat-breathe-line w-full h-[2px] bg-emerald-400 rounded-full",style:{animation:"chat-breathe 3s ease-in-out infinite"}})})}):g.jsxs("div",{className:"fixed inset-0 z-50 flex",style:{animation:"chat-overlay-in 0.2s ease-out"},onMouseEnter:B,onMouseLeave:_,children:[g.jsx("div",{className:"absolute inset-0 bg-slate-950/90 backdrop-blur-md",onClick:()=>{R?x():p()}}),g.jsxs("div",{className:"relative flex w-full h-full",children:[g.jsxs("div",{className:`flex flex-col h-full transition-all duration-300 ease-out ${R?"w-[420px] shrink-0 border-r border-slate-800":"w-full max-w-[700px] mx-auto"}`,children:[g.jsxs("div",{className:"shrink-0 border-b border-slate-800 px-5 py-3 flex items-center justify-between",children:[g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx("span",{className:`w-2 h-2 rounded-full ${i==="connected"?"bg-emerald-500":i==="checking"?"bg-amber-500 animate-pulse":"bg-slate-600"}`}),g.jsx("span",{className:"text-xs text-slate-400 font-medium",children:i==="connected"?"Connected":i==="checking"?"Checking...":"Offline"})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[r.length>0&&g.jsx("button",{onClick:u,className:"text-[11px] text-slate-600 hover:text-slate-400 transition-colors px-2 py-1",children:"Clear"}),g.jsx("button",{onClick:p,className:"p-1.5 text-slate-500 hover:text-slate-200 transition-colors",title:"Close (Esc)",children:g.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:g.jsx("path",{d:"M1 1l12 12M13 1L1 13"})})})]})]}),g.jsxs("div",{className:"flex-1 overflow-auto px-5 py-6 space-y-4",children:[r.length===0&&g.jsx("div",{className:"text-center text-slate-600 text-sm mt-12",children:i==="connected"?g.jsx("p",{children:"Ask a question about your graph data."}):g.jsx("p",{children:"Waiting for chat service to connect..."})}),r.map(U=>g.jsx(Jz,{message:U,activeArtifactId:(m==null?void 0:m.id)??null,onArtifactClick:Q},U.id)),g.jsx("div",{ref:N})]}),g.jsx("div",{className:"px-5 py-1 shrink-0",children:g.jsx("span",{className:"text-[10px] text-slate-600",children:E!=null&&E.focused?`Context: ${E.focused.nodeType}:${E.focused.uid.slice(0,16)}${E.focused.uid.length>16?"...":""}`:"Context: schema only"})}),g.jsx("div",{className:"px-5 pb-5 shrink-0",children:g.jsxs("div",{className:"flex gap-3 items-end",children:[g.jsx("textarea",{ref:A,value:T,onChange:U=>C(U.target.value),onKeyDown:V,placeholder:i==="connected"?"Ask about your graph...":"Agent offline",disabled:i!=="connected"||s,rows:1,className:"flex-1 bg-slate-800/60 border border-slate-700 rounded-xl px-4 py-3 text-sm text-slate-200 placeholder:text-slate-500 focus:outline-none focus:border-emerald-500/50 focus:ring-1 focus:ring-emerald-500/20 transition-all resize-none disabled:opacity-50 disabled:cursor-not-allowed"}),g.jsx("button",{onClick:q,disabled:!T.trim()||i!=="connected"||s,className:"px-4 py-3 bg-emerald-600 text-white rounded-xl text-sm font-medium hover:bg-emerald-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed shrink-0",children:s?g.jsx("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin inline-block"}):g.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:g.jsx("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})})})]})})]}),R&&g.jsxs("div",{className:"flex-1 flex flex-col h-full overflow-hidden animate-[slide-in-right_0.2s_ease-out]",children:[g.jsxs("div",{className:"shrink-0 border-b border-slate-800 px-5 py-3 flex items-center justify-between",children:[g.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[g.jsx("span",{className:"text-sm font-semibold text-slate-200 shrink-0",children:Hz(m)}),g.jsx("span",{className:"text-[10px] text-slate-500 font-mono truncate",children:m.command.replace(/^npx\s+firegraph\s+/,"")})]}),g.jsx("button",{onClick:x,className:"p-1.5 text-slate-400 hover:text-slate-200 transition-colors shrink-0 ml-3",title:"Close artifact",children:g.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:g.jsx("path",{d:"M1 1l12 12M13 1L1 13"})})})]}),g.jsx("div",{className:"flex-1 overflow-auto p-5",children:g.jsx(Gz,{artifact:m,viewRegistry:e,config:a,onNavigate:P},m.id)})]})]})]}):null}function Jz({message:t,activeArtifactId:e,onArtifactClick:a}){var r;return t.role==="user"?g.jsx("div",{className:"flex justify-end",children:g.jsx("div",{className:"bg-indigo-600/20 border border-indigo-500/20 rounded-xl px-4 py-3 max-w-[80%]",children:g.jsx("p",{className:"text-sm text-slate-200 whitespace-pre-wrap break-words",children:t.content})})}):t.role==="error"?g.jsx("div",{className:"flex justify-start",children:g.jsx("div",{className:"bg-red-500/10 border border-red-500/20 rounded-xl px-4 py-3 max-w-[80%]",children:g.jsx("p",{className:"text-sm text-red-400 whitespace-pre-wrap break-words",children:t.content})})}):g.jsxs("div",{className:"flex flex-col gap-2 items-start",children:[(t.content||t.streaming)&&g.jsx("div",{className:"bg-slate-800/40 border border-slate-700/40 rounded-xl px-4 py-3 max-w-[85%]",children:g.jsxs("pre",{className:"text-sm text-slate-300 whitespace-pre-wrap break-words font-sans leading-relaxed",children:[t.content,t.streaming&&!t.activeToolCall&&g.jsx("span",{className:"inline-block w-1.5 h-4 bg-emerald-400 animate-pulse ml-0.5 align-text-bottom rounded-sm"})]})}),t.activeToolCall&&g.jsx("div",{className:"bg-slate-800/40 border border-amber-500/20 rounded-xl px-4 py-3 max-w-[85%]",children:g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"w-3 h-3 border-2 border-amber-400 border-t-transparent rounded-full animate-spin shrink-0"}),g.jsx("span",{className:"text-xs text-amber-400 font-mono truncate",children:t.activeToolCall.replace(/^npx\s+firegraph\s+/,"")})]})}),(r=t.artifacts)==null?void 0:r.map(i=>{const{icon:s,label:o,detail:u}=OO(i),d=e===i.id;return g.jsx("button",{onClick:()=>a(i),className:`w-full max-w-[85%] text-left bg-slate-800/60 border rounded-xl px-4 py-3
|
|
410
|
+
transition-all hover:bg-slate-700/60 hover:border-indigo-500/50 group
|
|
411
|
+
${d?"border-indigo-500/60 ring-1 ring-indigo-500/30":"border-slate-700/50"}`,children:g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-indigo-400 text-sm shrink-0",children:s}),g.jsx("span",{className:"text-sm font-medium text-slate-200 truncate",children:o}),g.jsx("span",{className:"text-xs text-slate-500 ml-auto shrink-0",children:u})]})},i.id)})]})}function eP({schema:t,config:e,viewRegistry:a,warnings:r=[],children:i}){const s=a??{nodes:{},edges:{},collections:{},hasViews:!1};return g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"flex h-screen overflow-hidden",children:[g.jsx(mO,{schema:t,config:e,viewRegistry:a}),g.jsxs("main",{className:"flex-1 overflow-auto relative",children:[g.jsx(yO,{}),g.jsx(xO,{warnings:r}),i]})]}),g.jsx(Wz,{schema:t,viewRegistry:s,config:e})]})}function pE({schema:t,viewRegistry:e,config:a,onDataChanged:r,typeParam:i}){const{scopedPath:s}=Wa(),o=$r(),[u,d]=I.useState(!1),f=i??"",h=!t.readonly;return f?g.jsxs("div",{className:"p-6 max-w-6xl mx-auto",children:[g.jsxs("div",{className:"mb-4",children:[g.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[g.jsx("h1",{className:"text-xl font-bold",children:f}),g.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-mono ${ra(f)}`,children:"node"}),h&&!u&&g.jsxs("button",{onClick:()=>d(!0),className:"ml-auto px-3 py-1.5 bg-indigo-600 text-white rounded-lg text-xs font-medium hover:bg-indigo-500 transition-colors flex items-center gap-1.5",children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"Create ",f]})]}),g.jsxs("p",{className:"text-sm text-slate-400",children:["Browse all ",g.jsx("strong",{children:f})," nodes"]})]}),u&&g.jsx("div",{className:"mb-6",children:g.jsx(MN,{schema:t,defaultType:f,onSaved:p=>{d(!1),r==null||r(),o(s(`/node/${encodeURIComponent(p)}`))},onCancel:()=>d(!1)})}),g.jsx(DN,{type:f,schema:t,viewRegistry:e,config:a})]}):g.jsxs("div",{className:"p-6 max-w-6xl mx-auto",children:[g.jsxs("div",{className:"mb-4",children:[g.jsx("h1",{className:"text-xl font-bold text-slate-300",children:"Graph"}),g.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"Select a node type from the sidebar to browse."})]}),t.nodeTypes.length>0&&g.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:t.nodeTypes.map(p=>g.jsx("button",{onClick:()=>o(s(`/browse/${encodeURIComponent(p.type)}`)),className:"block w-full text-left px-4 py-3 bg-slate-900 border border-slate-800 rounded-xl hover:border-indigo-500/40 transition-colors",children:g.jsx("span",{className:`inline-block px-2 py-0.5 rounded text-xs font-mono mb-1 ${ra(p.type)}`,children:p.type})},p.type))})]})}function tP({viewRegistry:t,schema:e}){if(!t||!t.hasViews)return g.jsxs("div",{className:"p-6 max-w-6xl mx-auto",children:[g.jsx("h1",{className:"text-xl font-bold mb-2",children:"Views"}),g.jsxs("p",{className:"text-sm text-slate-400",children:["No views configured. Use ",g.jsx("code",{className:"text-slate-300",children:"--views <path>"})," to load a views file."]})]});const a=Object.entries(t.nodes).filter(([,s])=>s.views.length>0),r=Object.entries(t.edges).filter(([,s])=>s.views.length>0),i=Object.entries(t.collections??{}).filter(([,s])=>s.views.length>0);return g.jsxs("div",{className:"p-6 max-w-6xl mx-auto",children:[g.jsxs("div",{className:"mb-6",children:[g.jsx("h1",{className:"text-xl font-bold mb-1",children:"View Gallery"}),g.jsx("p",{className:"text-sm text-slate-400",children:"Preview all registered views with sample data"})]}),a.length>0&&g.jsxs("section",{className:"mb-8",children:[g.jsx("h2",{className:"text-sm font-semibold mb-4 uppercase tracking-wider text-slate-500",children:"Node Views"}),g.jsx("div",{className:"space-y-6",children:a.map(([s,o])=>g.jsx(mm,{entityType:s,meta:o,kind:"node"},s))})]}),r.length>0&&g.jsxs("section",{className:"mb-8",children:[g.jsx("h2",{className:"text-sm font-semibold mb-4 uppercase tracking-wider text-slate-500",children:"Edge Views"}),g.jsx("div",{className:"space-y-6",children:r.map(([s,o])=>g.jsx(mm,{entityType:s,meta:o,kind:"edge"},s))})]}),i.length>0&&g.jsxs("section",{children:[g.jsx("h2",{className:"text-sm font-semibold mb-4 uppercase tracking-wider text-slate-500",children:"Collection Views"}),g.jsx("div",{className:"space-y-6",children:i.map(([s,o])=>g.jsx(mm,{entityType:s,meta:o,kind:"collection"},s))})]})]})}function mm({entityType:t,meta:e,kind:a}){const r=e.sampleData??{},[i,s]=I.useState(JSON.stringify(r,null,2)),[o,u]=I.useState(r),[d,f]=I.useState(null),[h,p]=I.useState(!1),m=y=>{s(y);try{const x=JSON.parse(y);u(x),f(null)}catch{f("Invalid JSON")}};return g.jsxs("div",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[g.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[g.jsx("span",{className:"px-2 py-0.5 rounded text-xs font-mono bg-indigo-500/15 text-indigo-400",children:a}),g.jsx("h3",{className:"text-sm font-semibold",children:t}),g.jsxs("span",{className:"text-slate-500 text-xs",children:["(",e.views.length," view",e.views.length!==1?"s":"",")"]}),g.jsx("button",{onClick:()=>p(!h),className:"ml-auto text-xs text-slate-400 hover:text-slate-200 transition-colors",children:h?"Hide data editor":"Edit sample data"})]}),h&&g.jsxs("div",{className:"mb-4",children:[g.jsx("label",{className:"block text-xs text-slate-500 mb-1",children:"Sample Data (JSON)"}),g.jsx("textarea",{value:i,onChange:y=>m(y.target.value),rows:6,className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs font-mono text-slate-200 focus:outline-none focus:border-indigo-500 resize-y"}),d&&g.jsx("p",{className:"text-xs text-red-400 mt-1",children:d})]}),g.jsx("div",{className:`grid gap-4 ${e.views.length===1?"grid-cols-1":"grid-cols-1 md:grid-cols-2"}`,children:e.views.map(y=>g.jsxs("div",{className:"bg-slate-950 rounded-lg p-4",children:[g.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[g.jsx("span",{className:"text-xs font-semibold text-slate-300",children:y.viewName}),y.description&&g.jsx("span",{className:"text-[10px] text-slate-500",children:y.description}),g.jsxs("span",{className:"ml-auto text-[10px] text-slate-600 font-mono",children:["<",y.tagName,">"]})]}),g.jsx(Xn,{tagName:y.tagName,data:o})]},y.tagName))})]})}function kN({collectionDef:t,params:e,existingDoc:a,onSaved:r,onCancel:i}){const s=!!a,[o,u]=I.useState((a==null?void 0:a.data)??{}),[d,f]=I.useState(a?JSON.stringify(a.data,null,2):"{}"),[h,p]=I.useState(null),[m,y]=I.useState(null),x=xt.createCollectionDoc.useMutation({onSuccess:N=>r(N.id),onError:N=>y(N.message)}),E=xt.updateCollectionDoc.useMutation({onSuccess:()=>r(a.id),onError:N=>y(N.message)}),S=x.isPending||E.isPending,T=t.hasSchema&&t.fields.length>0,C=()=>{y(null);let N;if(T)N=o;else try{N=JSON.parse(d),p(null)}catch{p("Invalid JSON");return}s?E.mutate({collectionName:t.name,params:e,docId:a.id,data:N}):x.mutate({collectionName:t.name,params:e,data:N})};return g.jsxs("div",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[g.jsx("h2",{className:"text-sm font-semibold mb-1",children:s?`Edit Document: ${a.id}`:`New Document in ${t.name}`}),t.description&&g.jsx("p",{className:"text-xs text-slate-500 mb-4",children:t.description}),g.jsx("div",{className:"mb-5",children:T?g.jsx(sc,{fields:t.fields,values:o,onChange:u}):g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:"Data (JSON)"}),g.jsx("textarea",{value:d,onChange:N=>{f(N.target.value),p(null)},rows:10,className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs font-mono text-slate-200 focus:outline-none focus:border-indigo-500 transition-colors resize-y",spellCheck:!1}),h&&g.jsx("p",{className:"mt-1 text-xs text-red-400",children:h})]})}),m&&g.jsx("div",{className:"mb-4 px-3 py-2 bg-red-500/10 border border-red-500/30 rounded-lg text-xs text-red-400",children:m}),g.jsxs("div",{className:"flex gap-2",children:[g.jsx("button",{onClick:C,disabled:S,className:"px-4 py-2 bg-indigo-600 hover:bg-indigo-500 disabled:opacity-50 text-white rounded-lg text-xs font-medium transition-colors",children:S?"Saving...":s?"Save Changes":"Create Document"}),g.jsx("button",{onClick:i,disabled:S,className:"px-4 py-2 bg-slate-800 hover:bg-slate-700 disabled:opacity-50 text-slate-300 rounded-lg text-xs font-medium transition-colors",children:"Cancel"})]})]})}function aP({collectionDef:t,params:e,readonly:a}){const r=$r(),[i,s]=I.useState(!1),[o,u]=I.useState(void 0),d=JSON.stringify(e);I.useEffect(()=>{u(void 0)},[t.name,d]);const f=t.pathParams.filter(C=>!e[C]),[h,p]=I.useState(Object.fromEntries(t.pathParams.map(C=>[C,e[C]??""])));I.useEffect(()=>{p(Object.fromEntries(t.pathParams.map(C=>[C,e[C]??""])))},[t.name]);const m=f.length===0||f.every(C=>{var N;return(N=h[C])==null?void 0:N.trim()}),y={...e,...h},{data:x,isLoading:E,error:S,refetch:T}=xt.getCollectionDocs.useQuery({collectionName:t.name,params:y,cursor:o,limit:50},{enabled:m});if(f.length>0){const C=N=>{if(N.preventDefault(),!f.every(M=>{var D;return(D=h[M])==null?void 0:D.trim()}))return;const A={...e};for(const M of f)A[M]=h[M];r(Zs(t.name,A,t.pathParams))};return g.jsxs("div",{className:"p-6 max-w-lg",children:[g.jsxs("div",{className:"mb-4",children:[g.jsx("h2",{className:"text-sm font-semibold text-slate-200",children:t.name}),t.description&&g.jsx("p",{className:"text-xs text-slate-500 mt-1",children:t.description}),g.jsx("p",{className:"text-xs text-slate-500 mt-1 font-mono",children:t.path})]}),g.jsxs("form",{onSubmit:C,className:"space-y-3",children:[f.map(N=>g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:N}),g.jsx("input",{type:"text",value:h[N]??"",onChange:A=>p(M=>({...M,[N]:A.target.value})),placeholder:`Enter ${N}...`,className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-xs text-slate-200 placeholder:text-slate-500 focus:outline-none focus:border-indigo-500 transition-colors"})]},N)),g.jsx("button",{type:"submit",disabled:!f.every(N=>{var A;return(A=h[N])==null?void 0:A.trim()}),className:"px-4 py-2 bg-indigo-600 hover:bg-indigo-500 disabled:opacity-50 text-white rounded-lg text-xs font-medium transition-colors",children:"Browse"})]})]})}return g.jsxs("div",{className:"flex flex-col h-full",children:[g.jsxs("div",{className:"px-6 py-4 border-b border-slate-800 flex items-center justify-between shrink-0",children:[g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("svg",{className:"w-4 h-4 text-amber-400 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),g.jsx("h1",{className:"text-sm font-semibold text-slate-200",children:t.name})]}),t.description&&g.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:t.description}),g.jsx("p",{className:"text-[10px] text-slate-600 font-mono mt-0.5",children:t.path.replace(/\{([^}]+)\}/g,(C,N)=>y[N]??`{${N}}`)})]}),!a&&g.jsxs("button",{onClick:()=>s(!0),className:"flex items-center gap-1.5 px-3 py-1.5 bg-indigo-600 hover:bg-indigo-500 text-white rounded-lg text-xs font-medium transition-colors",children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"New Document"]})]}),i&&g.jsx("div",{className:"px-6 py-4 border-b border-slate-800 shrink-0",children:g.jsx(kN,{collectionDef:t,params:y,onSaved:C=>{s(!1),T(),r(D2(t.name,C,y,t.pathParams))},onCancel:()=>s(!1)})}),g.jsxs("div",{className:"flex-1 overflow-auto",children:[E&&g.jsx("div",{className:"flex items-center justify-center py-12",children:g.jsx("div",{className:"w-6 h-6 border-2 border-indigo-500 border-t-transparent rounded-full animate-spin"})}),S&&g.jsx("div",{className:"px-6 py-4 text-sm text-red-400",children:S.message}),x&&x.documents.length===0&&g.jsxs("div",{className:"px-6 py-8 text-center text-xs text-slate-500",children:["No documents found",t.typeField&&g.jsxs("span",{className:"block mt-1",children:["(filtered by ",t.typeField," = ",String(t.typeValue),")"]})]}),x&&x.documents.length>0&&g.jsxs("table",{className:"w-full text-xs",children:[g.jsx("thead",{className:"sticky top-0 bg-slate-950 border-b border-slate-800",children:g.jsxs("tr",{children:[g.jsx("th",{className:"px-6 py-2 text-left text-[10px] uppercase tracking-wider text-slate-500 font-semibold w-48",children:"ID"}),t.fields.slice(0,3).map(C=>g.jsx("th",{className:"px-4 py-2 text-left text-[10px] uppercase tracking-wider text-slate-500 font-semibold",children:C.name},C.name)),t.fields.length===0&&g.jsx("th",{className:"px-4 py-2 text-left text-[10px] uppercase tracking-wider text-slate-500 font-semibold",children:"Data"})]})}),g.jsx("tbody",{className:"divide-y divide-slate-800/50",children:x.documents.map(C=>g.jsxs("tr",{className:"hover:bg-slate-800/30 transition-colors cursor-pointer",children:[g.jsx("td",{className:"px-6 py-2.5",children:g.jsx(Ua,{to:D2(t.name,C.id,y,t.pathParams),className:"text-indigo-400 hover:text-indigo-300 font-mono transition-colors",children:C.id.length>16?`${C.id.slice(0,14)}…`:C.id})}),t.fields.slice(0,3).map(N=>g.jsx("td",{className:"px-4 py-2.5 text-slate-400 truncate max-w-xs",children:C.data[N.name]!==void 0?String(C.data[N.name]):g.jsx("span",{className:"text-slate-600",children:"—"})},N.name)),t.fields.length===0&&g.jsx("td",{className:"px-4 py-2.5 text-slate-600 font-mono text-[10px] truncate max-w-xs",children:jT(C.data,60)})]},C.id))})]}),(x==null?void 0:x.hasMore)&&g.jsx("div",{className:"px-6 py-4 border-t border-slate-800",children:g.jsx("button",{onClick:()=>u(x.nextCursor??void 0),className:"text-xs text-indigo-400 hover:text-indigo-300 transition-colors",children:"Load more →"})})]})]})}function rP({collectionDef:t,docId:e,params:a,readonly:r,viewRegistry:i}){var C,N;const s=$r(),[o,u]=I.useState(!1),[d,f]=I.useState(!1),[h,p]=I.useState("json");I.useEffect(()=>{p("json")},[e,t.name]);const m=((N=(C=i==null?void 0:i.collections)==null?void 0:C[t.name])==null?void 0:N.views)??[],{data:y,isLoading:x,error:E,refetch:S}=xt.getCollectionDoc.useQuery({collectionName:t.name,params:a,docId:e}),T=xt.deleteCollectionDoc.useMutation({onSuccess:()=>{s(Zs(t.name,a,t.pathParams))},onError:A=>alert(`Delete failed: ${A.message}`)});return x?g.jsx("div",{className:"flex items-center justify-center py-12",children:g.jsx("div",{className:"w-6 h-6 border-2 border-indigo-500 border-t-transparent rounded-full animate-spin"})}):E?g.jsx("div",{className:"px-6 py-4 text-sm text-red-400",children:E.message}):y?g.jsxs("div",{className:"flex flex-col h-full",children:[g.jsxs("div",{className:"px-6 py-4 border-b border-slate-800 shrink-0",children:[g.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-slate-500 mb-3",children:[g.jsx("svg",{className:"w-3.5 h-3.5 text-amber-400 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),g.jsx(Ua,{to:Zs(t.name,a,t.pathParams),className:"text-amber-400 hover:text-amber-300 transition-colors",children:t.name}),g.jsx("span",{children:"/"}),g.jsx("span",{className:"font-mono text-slate-400",children:e})]}),g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsxs("div",{children:[g.jsx("h1",{className:"text-sm font-semibold text-slate-200 font-mono",children:e}),g.jsx("p",{className:"text-[10px] text-slate-600 font-mono mt-0.5",children:t.path.replace(/\{([^}]+)\}/g,(A,M)=>a[M]??`{${M}}`)})]}),!r&&!o&&g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsxs("button",{onClick:()=>u(!0),className:"flex items-center gap-1.5 px-3 py-1.5 bg-slate-800 hover:bg-slate-700 text-slate-300 rounded-lg text-xs font-medium transition-colors",children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})}),"Edit"]}),d?g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"text-xs text-slate-400",children:"Confirm?"}),g.jsx("button",{onClick:()=>T.mutate({collectionName:t.name,params:a,docId:e}),disabled:T.isPending,className:"px-2 py-1 bg-red-600 hover:bg-red-500 disabled:opacity-50 text-white rounded text-xs transition-colors",children:T.isPending?"...":"Yes, delete"}),g.jsx("button",{onClick:()=>f(!1),className:"px-2 py-1 bg-slate-800 hover:bg-slate-700 text-slate-400 rounded text-xs transition-colors",children:"Cancel"})]}):g.jsxs("button",{onClick:()=>f(!0),className:"flex items-center gap-1.5 px-3 py-1.5 bg-red-600/20 hover:bg-red-600/30 text-red-400 rounded-lg text-xs font-medium transition-colors",children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),"Delete"]})]})]})]}),g.jsx("div",{className:"flex-1 overflow-auto p-6",children:o?g.jsx(kN,{collectionDef:t,params:a,existingDoc:{id:y.id,data:y.data},onSaved:()=>{u(!1),S()},onCancel:()=>u(!1)}):g.jsxs(g.Fragment,{children:[m.length>0&&g.jsx(No,{views:m,activeView:h,onSwitch:p}),h!=="json"?g.jsx(Xn,{tagName:h,data:y.data,onError:()=>p("json")}):g.jsx("div",{className:"space-y-4",children:t.fields.length>0?g.jsxs("div",{className:"space-y-2",children:[t.fields.map(A=>g.jsxs("div",{className:"flex gap-3 py-2 border-b border-slate-800/50",children:[g.jsx("span",{className:"text-xs text-slate-500 w-36 shrink-0 font-mono",children:A.name}),g.jsx("span",{className:"text-xs text-slate-300 break-all",children:y.data[A.name]!==void 0?typeof y.data[A.name]=="object"?g.jsx("code",{className:"text-[10px] font-mono text-slate-400",children:JSON.stringify(y.data[A.name])}):String(y.data[A.name]):g.jsx("span",{className:"text-slate-600",children:"—"})})]},A.name)),Object.entries(y.data).filter(([A])=>!t.fields.some(M=>M.name===A)).map(([A,M])=>g.jsxs("div",{className:"flex gap-3 py-2 border-b border-slate-800/50",children:[g.jsx("span",{className:"text-xs text-slate-600 w-36 shrink-0 font-mono",children:A}),g.jsx("span",{className:"text-xs text-slate-500 break-all",children:typeof M=="object"?g.jsx("code",{className:"text-[10px] font-mono",children:JSON.stringify(M)}):String(M)})]},A))]}):g.jsx(Dr,{data:y.data})})]})})]}):null}function nP(){const{data:t,error:e,isLoading:a}=xt.getSchema.useQuery(),{data:r,error:i,isLoading:s}=xt.getConfig.useQuery(),{data:o,error:u,isLoading:d}=xt.getViews.useQuery(),{data:f}=xt.getWarnings.useQuery(),h=a||s||d,p=e||i||u,m=I.useRef(0),y=I.useCallback(()=>{if(o!=null&&o.hasViews&&!document.querySelector('script[src="/api/views/bundle"]')){const E=document.createElement("script");E.type="module",E.src="/api/views/bundle",document.head.appendChild(E)}},[o]);if(o&&!h&&y(),I.useEffect(()=>{if(!(t!=null&&t.dynamicMode)||!(o!=null&&o.hasViews))return;const E=document.querySelector("script[data-dynamic-views]");E&&E.remove(),m.current++;const S=document.createElement("script");return S.type="module",S.src=`/api/views/dynamic-bundle?v=${m.current}`,S.setAttribute("data-dynamic-views","true"),document.head.appendChild(S),()=>{S.remove()}},[t,o]),h)return g.jsx("div",{className:"flex items-center justify-center h-screen",children:g.jsxs("div",{className:"text-center",children:[g.jsx("div",{className:"w-8 h-8 border-2 border-indigo-500 border-t-transparent rounded-full animate-spin mx-auto mb-4"}),g.jsx("p",{className:"text-slate-400",children:"Connecting to Firestore..."})]})});if(p)return g.jsx("div",{className:"flex items-center justify-center h-screen",children:g.jsxs("div",{className:"bg-slate-900 border border-red-500/30 rounded-xl p-8 max-w-lg",children:[g.jsx("h2",{className:"text-red-400 text-lg font-semibold mb-2",children:"Connection Error"}),g.jsx("p",{className:"text-slate-300 text-sm mb-4",children:p.message}),g.jsxs("p",{className:"text-slate-500 text-xs mb-4",children:["Make sure you have ADC configured (run ",g.jsx("code",{className:"text-slate-300",children:"gcloud auth application-default login"}),") and the server is running with the correct --project, --collection, and --registry flags."]}),g.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-indigo-600 text-white rounded-lg text-sm hover:bg-indigo-500 transition-colors",children:"Retry"})]})});const x=o??{nodes:{},edges:{},collections:{},hasViews:!1};return g.jsx(cO,{children:g.jsx(TO,{chatEnabled:(r==null?void 0:r.chatEnabled)??!1,children:g.jsx(NO,{children:g.jsx(AO,{children:g.jsx(hO,{children:g.jsx(eP,{schema:t,config:r,viewRegistry:x,warnings:(f==null?void 0:f.warnings)??[],children:g.jsxs(GA,{children:[g.jsx(xm,{path:"/",element:g.jsx(FA,{to:"/g",replace:!0})}),g.jsx(xm,{path:"/g/*",element:g.jsx(iP,{schema:t,viewRegistry:x,config:r})})]})})})})})})})}function iP({schema:t,viewRegistry:e,config:a}){const{"*":r=""}=PE(),{pageRoute:i}=MT(r),s=i.match(/^\/browse\/(.+)$/),o=i.match(/^\/node\/(.+)$/);if(s)return g.jsx(pE,{schema:t,viewRegistry:e,config:a,typeParam:decodeURIComponent(s[1])});if(o)return g.jsx(qz,{schema:t,viewRegistry:e,config:a,uidParam:decodeURIComponent(o[1])});if(i==="/traverse")return g.jsx(Sz,{schema:t});if(i==="/views")return g.jsx(tP,{viewRegistry:e,schema:t});if(i.startsWith("/col/")){const u=i.slice(5),d=u.indexOf("/doc/");let f,h,p;if(d>=0){const y=u.slice(0,d);p=decodeURIComponent(u.slice(d+5));const x=y.split("/");f=decodeURIComponent(x[0]),h=x.slice(1).filter(Boolean).map(decodeURIComponent)}else{const y=u.split("/");f=decodeURIComponent(y[0]),h=y.slice(1).filter(Boolean).map(decodeURIComponent)}const m=(t.collections??[]).find(y=>y.name===f);if(m){const y={};for(let x=0;x<Math.min(h.length,m.pathParams.length);x++)y[m.pathParams[x]]=h[x];return p!==void 0?g.jsx(rP,{collectionDef:m,docId:p,params:y,readonly:a.readonly,viewRegistry:e}):g.jsx(aP,{collectionDef:m,params:y,readonly:a.readonly})}}return g.jsx(pE,{schema:t,viewRegistry:e,config:a,typeParam:""})}function sP(){const[t]=I.useState(()=>new jM({defaultOptions:{queries:{staleTime:3e4,refetchOnWindowFocus:!1}}})),[e]=I.useState(()=>xt.createClient({links:[TD({url:"/api/trpc"})]}));return g.jsx(xt.Provider,{client:e,queryClient:t,children:g.jsx(AM,{client:t,children:g.jsx(WA,{children:g.jsx(nP,{})})})})}W5.createRoot(document.getElementById("root")).render(g.jsx(ME.StrictMode,{children:g.jsx(sP,{})}));
|