@typicalday/firegraph 0.1.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/LICENSE +27 -0
- package/README.md +527 -0
- package/bin/firegraph.mjs +129 -0
- package/dist/chunk-KFA7G37W.js +443 -0
- package/dist/chunk-KFA7G37W.js.map +1 -0
- package/dist/chunk-YLGXLEUE.js +47 -0
- package/dist/chunk-YLGXLEUE.js.map +1 -0
- package/dist/client-Bk2Cm6xv.d.cts +131 -0
- package/dist/client-Bk2Cm6xv.d.ts +131 -0
- package/dist/codegen/index.cjs +81 -0
- package/dist/codegen/index.cjs.map +1 -0
- package/dist/codegen/index.d.cts +2 -0
- package/dist/codegen/index.d.ts +2 -0
- package/dist/codegen/index.js +7 -0
- package/dist/codegen/index.js.map +1 -0
- package/dist/editor/client/assets/index-DJJ_b0jI.js +411 -0
- package/dist/editor/client/assets/index-Q0QBYrMV.css +1 -0
- package/dist/editor/client/index.html +16 -0
- package/dist/editor/server/index.mjs +49597 -0
- package/dist/index-CG3R68Hu.d.cts +414 -0
- package/dist/index-CG3R68Hu.d.ts +414 -0
- package/dist/index.cjs +1953 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +186 -0
- package/dist/index.d.ts +186 -0
- package/dist/index.js +1569 -0
- package/dist/index.js.map +1 -0
- package/dist/query-client/index.cjs +484 -0
- package/dist/query-client/index.cjs.map +1 -0
- package/dist/query-client/index.d.cts +15 -0
- package/dist/query-client/index.d.ts +15 -0
- package/dist/query-client/index.js +17 -0
- package/dist/query-client/index.js.map +1 -0
- package/dist/react.cjs +85 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +44 -0
- package/dist/react.d.ts +44 -0
- package/dist/react.js +60 -0
- package/dist/react.js.map +1 -0
- package/dist/svelte.cjs +90 -0
- package/dist/svelte.cjs.map +1 -0
- package/dist/svelte.d.cts +46 -0
- package/dist/svelte.d.ts +46 -0
- package/dist/svelte.js +65 -0
- package/dist/svelte.js.map +1 -0
- package/dist/views-DL60k0cf.d.cts +91 -0
- package/dist/views-DL60k0cf.d.ts +91 -0
- package/package.json +122 -0
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
var MA=Object.defineProperty;var z1=t=>{throw TypeError(t)};var RA=(t,e,r)=>e in t?MA(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Tp=(t,e,r)=>RA(t,typeof e!="symbol"?e+"":e,r),Cp=(t,e,r)=>e.has(t)||z1("Cannot "+r);var W=(t,e,r)=>(Cp(t,e,"read from private field"),r?r.call(t):e.get(t)),Pe=(t,e,r)=>e.has(t)?z1("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),je=(t,e,r,a)=>(Cp(t,e,"write to private field"),a?a.call(t,r):e.set(t,r),r),tt=(t,e,r)=>(Cp(t,e,"access private method"),r);var Hf=(t,e,r,a)=>({set _(i){je(t,e,i,r)},get _(){return W(t,e,a)}});function kA(t,e){for(var r=0;r<e.length;r++){const a=e[r];if(typeof a!="string"&&!Array.isArray(a)){for(const i in a)if(i!=="default"&&!(i in t)){const s=Object.getOwnPropertyDescriptor(a,i);s&&Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>a[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"]'))a(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"&&a(o)}).observe(document,{childList:!0,subtree:!0});function r(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 a(i){if(i.ep)return;i.ep=!0;const s=r(i);fetch(i.href,s)}})();function bE(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Np={exports:{}},Tu={};/**
|
|
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 _1;function BA(){if(_1)return Tu;_1=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function r(a,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:a,key:o,ref:i!==void 0?i:null,props:s}}return Tu.Fragment=e,Tu.jsx=r,Tu.jsxs=r,Tu}var P1;function LA(){return P1||(P1=1,Np.exports=BA()),Np.exports}var m=LA(),Ap={exports:{}},st={};/**
|
|
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 U1;function zA(){if(U1)return st;U1=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=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"),f=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),g=Symbol.iterator;function y(k){return k===null||typeof k!="object"?null:(k=g&&k[g]||k["@@iterator"],typeof k=="function"?k:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,S={};function T(k,G,$){this.props=k,this.context=G,this.refs=S,this.updater=$||b}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,$){this.props=k,this.context=G,this.refs=S,this.updater=$||b}var j=N.prototype=new C;j.constructor=N,E(j,T.prototype),j.isPureReactComponent=!0;var M=Array.isArray;function D(){}var A={H:null,A:null,T:null,S:null},B=Object.prototype.hasOwnProperty;function R(k,G,$){var J=$.ref;return{$$typeof:t,type:k,key:G,ref:J!==void 0?J:null,props:$}}function L(k,G){return R(k.type,G,k.props)}function _(k){return typeof k=="object"&&k!==null&&k.$$typeof===t}function P(k){var G={"=":"=0",":":"=2"};return"$"+k.replace(/[=:]/g,function($){return G[$]})}var q=/\/+/g;function F(k,G){return typeof k=="object"&&k!==null&&k.key!=null?P(""+k.key):G.toString(36)}function Y(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 U(k,G,$,J,ne){var ee=typeof k;(ee==="undefined"||ee==="boolean")&&(k=null);var ae=!1;if(k===null)ae=!0;else switch(ee){case"bigint":case"string":case"number":ae=!0;break;case"object":switch(k.$$typeof){case t:case e:ae=!0;break;case h:return ae=k._init,U(ae(k._payload),G,$,J,ne)}}if(ae)return ne=ne(k),ae=J===""?"."+F(k,0):J,M(ne)?($="",ae!=null&&($=ae.replace(q,"$&/")+"/"),U(ne,G,$,"",function(re){return re})):ne!=null&&(_(ne)&&(ne=L(ne,$+(ne.key==null||k&&k.key===ne.key?"":(""+ne.key).replace(q,"$&/")+"/")+ae)),G.push(ne)),1;ae=0;var de=J===""?".":J+":";if(M(k))for(var le=0;le<k.length;le++)J=k[le],ee=de+F(J,le),ae+=U(J,G,$,ee,ne);else if(le=y(k),typeof le=="function")for(k=le.call(k),le=0;!(J=k.next()).done;)J=J.value,ee=de+F(J,le++),ae+=U(J,G,$,ee,ne);else if(ee==="object"){if(typeof k.then=="function")return U(Y(k),G,$,J,ne);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 ae}function z(k,G,$){if(k==null)return k;var J=[],ne=0;return U(k,J,"","",function(ee){return G.call($,ee,ne++)}),J}function H(k){if(k._status===-1){var G=k._result;G=G(),G.then(function($){(k._status===0||k._status===-1)&&(k._status=1,k._result=$)},function($){(k._status===0||k._status===-1)&&(k._status=2,k._result=$)}),k._status===-1&&(k._status=0,k._result=G)}if(k._status===1)return k._result.default;throw k._result}var X=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)},K={map:z,forEach:function(k,G,$){z(k,function(){G.apply(this,arguments)},$)},count:function(k){var G=0;return z(k,function(){G++}),G},toArray:function(k){return z(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 st.Activity=p,st.Children=K,st.Component=T,st.Fragment=r,st.Profiler=i,st.PureComponent=N,st.StrictMode=a,st.Suspense=f,st.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=A,st.__COMPILER_RUNTIME={__proto__:null,c:function(k){return A.H.useMemoCache(k)}},st.cache=function(k){return function(){return k.apply(null,arguments)}},st.cacheSignal=function(){return null},st.cloneElement=function(k,G,$){if(k==null)throw Error("The argument must be a React element, but you passed "+k+".");var J=E({},k.props),ne=k.key;if(G!=null)for(ee in G.key!==void 0&&(ne=""+G.key),G)!B.call(G,ee)||ee==="key"||ee==="__self"||ee==="__source"||ee==="ref"&&G.ref===void 0||(J[ee]=G[ee]);var ee=arguments.length-2;if(ee===1)J.children=$;else if(1<ee){for(var ae=Array(ee),de=0;de<ee;de++)ae[de]=arguments[de+2];J.children=ae}return R(k.type,ne,J)},st.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},st.createElement=function(k,G,$){var J,ne={},ee=null;if(G!=null)for(J in G.key!==void 0&&(ee=""+G.key),G)B.call(G,J)&&J!=="key"&&J!=="__self"&&J!=="__source"&&(ne[J]=G[J]);var ae=arguments.length-2;if(ae===1)ne.children=$;else if(1<ae){for(var de=Array(ae),le=0;le<ae;le++)de[le]=arguments[le+2];ne.children=de}if(k&&k.defaultProps)for(J in ae=k.defaultProps,ae)ne[J]===void 0&&(ne[J]=ae[J]);return R(k,ee,ne)},st.createRef=function(){return{current:null}},st.forwardRef=function(k){return{$$typeof:u,render:k}},st.isValidElement=_,st.lazy=function(k){return{$$typeof:h,_payload:{_status:-1,_result:k},_init:H}},st.memo=function(k,G){return{$$typeof:d,type:k,compare:G===void 0?null:G}},st.startTransition=function(k){var G=A.T,$={};A.T=$;try{var J=k(),ne=A.S;ne!==null&&ne($,J),typeof J=="object"&&J!==null&&typeof J.then=="function"&&J.then(D,X)}catch(ee){X(ee)}finally{G!==null&&$.types!==null&&(G.types=$.types),A.T=G}},st.unstable_useCacheRefresh=function(){return A.H.useCacheRefresh()},st.use=function(k){return A.H.use(k)},st.useActionState=function(k,G,$){return A.H.useActionState(k,G,$)},st.useCallback=function(k,G){return A.H.useCallback(k,G)},st.useContext=function(k){return A.H.useContext(k)},st.useDebugValue=function(){},st.useDeferredValue=function(k,G){return A.H.useDeferredValue(k,G)},st.useEffect=function(k,G){return A.H.useEffect(k,G)},st.useEffectEvent=function(k){return A.H.useEffectEvent(k)},st.useId=function(){return A.H.useId()},st.useImperativeHandle=function(k,G,$){return A.H.useImperativeHandle(k,G,$)},st.useInsertionEffect=function(k,G){return A.H.useInsertionEffect(k,G)},st.useLayoutEffect=function(k,G){return A.H.useLayoutEffect(k,G)},st.useMemo=function(k,G){return A.H.useMemo(k,G)},st.useOptimistic=function(k,G){return A.H.useOptimistic(k,G)},st.useReducer=function(k,G,$){return A.H.useReducer(k,G,$)},st.useRef=function(k){return A.H.useRef(k)},st.useState=function(k){return A.H.useState(k)},st.useSyncExternalStore=function(k,G,$){return A.H.useSyncExternalStore(k,G,$)},st.useTransition=function(){return A.H.useTransition()},st.version="19.2.4",st}var q1;function u0(){return q1||(q1=1,Ap.exports=zA()),Ap.exports}var I=u0();const wE=bE(I),SE=kA({__proto__:null,default:wE},[I]);var jp={exports:{}},Cu={},Dp={exports:{}},Op={};/**
|
|
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 I1;function _A(){return I1||(I1=1,(function(t){function e(U,z){var H=U.length;U.push(z);e:for(;0<H;){var X=H-1>>>1,K=U[X];if(0<i(K,z))U[X]=z,U[H]=K,H=X;else break e}}function r(U){return U.length===0?null:U[0]}function a(U){if(U.length===0)return null;var z=U[0],H=U.pop();if(H!==z){U[0]=H;e:for(var X=0,K=U.length,k=K>>>1;X<k;){var G=2*(X+1)-1,$=U[G],J=G+1,ne=U[J];if(0>i($,H))J<K&&0>i(ne,$)?(U[X]=ne,U[J]=H,X=J):(U[X]=$,U[G]=H,X=G);else if(J<K&&0>i(ne,H))U[X]=ne,U[J]=H,X=J;else break e}}return z}function i(U,z){var H=U.sortIndex-z.sortIndex;return H!==0?H:U.id-z.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 f=[],d=[],h=1,p=null,g=3,y=!1,b=!1,E=!1,S=!1,T=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function j(U){for(var z=r(d);z!==null;){if(z.callback===null)a(d);else if(z.startTime<=U)a(d),z.sortIndex=z.expirationTime,e(f,z);else break;z=r(d)}}function M(U){if(E=!1,j(U),!b)if(r(f)!==null)b=!0,D||(D=!0,P());else{var z=r(d);z!==null&&Y(M,z.startTime-U)}}var D=!1,A=-1,B=5,R=-1;function L(){return S?!0:!(t.unstable_now()-R<B)}function _(){if(S=!1,D){var U=t.unstable_now();R=U;var z=!0;try{e:{b=!1,E&&(E=!1,C(A),A=-1),y=!0;var H=g;try{t:{for(j(U),p=r(f);p!==null&&!(p.expirationTime>U&&L());){var X=p.callback;if(typeof X=="function"){p.callback=null,g=p.priorityLevel;var K=X(p.expirationTime<=U);if(U=t.unstable_now(),typeof K=="function"){p.callback=K,j(U),z=!0;break t}p===r(f)&&a(f),j(U)}else a(f);p=r(f)}if(p!==null)z=!0;else{var k=r(d);k!==null&&Y(M,k.startTime-U),z=!1}}break e}finally{p=null,g=H,y=!1}z=void 0}}finally{z?P():D=!1}}}var P;if(typeof N=="function")P=function(){N(_)};else if(typeof MessageChannel<"u"){var q=new MessageChannel,F=q.port2;q.port1.onmessage=_,P=function(){F.postMessage(null)}}else P=function(){T(_,0)};function Y(U,z){A=T(function(){U(t.unstable_now())},z)}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(U){U.callback=null},t.unstable_forceFrameRate=function(U){0>U||125<U?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):B=0<U?Math.floor(1e3/U):5},t.unstable_getCurrentPriorityLevel=function(){return g},t.unstable_next=function(U){switch(g){case 1:case 2:case 3:var z=3;break;default:z=g}var H=g;g=z;try{return U()}finally{g=H}},t.unstable_requestPaint=function(){S=!0},t.unstable_runWithPriority=function(U,z){switch(U){case 1:case 2:case 3:case 4:case 5:break;default:U=3}var H=g;g=U;try{return z()}finally{g=H}},t.unstable_scheduleCallback=function(U,z,H){var X=t.unstable_now();switch(typeof H=="object"&&H!==null?(H=H.delay,H=typeof H=="number"&&0<H?X+H:X):H=X,U){case 1:var K=-1;break;case 2:K=250;break;case 5:K=1073741823;break;case 4:K=1e4;break;default:K=5e3}return K=H+K,U={id:h++,callback:z,priorityLevel:U,startTime:H,expirationTime:K,sortIndex:-1},H>X?(U.sortIndex=H,e(d,U),r(f)===null&&U===r(d)&&(E?(C(A),A=-1):E=!0,Y(M,H-X))):(U.sortIndex=K,e(f,U),b||y||(b=!0,D||(D=!0,P()))),U},t.unstable_shouldYield=L,t.unstable_wrapCallback=function(U){var z=g;return function(){var H=g;g=z;try{return U.apply(this,arguments)}finally{g=H}}}})(Op)),Op}var V1;function PA(){return V1||(V1=1,Dp.exports=_A()),Dp.exports}var Mp={exports:{}},Gr={};/**
|
|
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 F1;function UA(){if(F1)return Gr;F1=1;var t=u0();function e(f){var d="https://react.dev/errors/"+f;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)d+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+f+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var a={d:{f:r,r:function(){throw Error(e(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},i=Symbol.for("react.portal");function s(f,d,h){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:p==null?null:""+p,children:f,containerInfo:d,implementation:h}}var o=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(f,d){if(f==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return Gr.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,Gr.createPortal=function(f,d){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(e(299));return s(f,d,null,h)},Gr.flushSync=function(f){var d=o.T,h=a.p;try{if(o.T=null,a.p=2,f)return f()}finally{o.T=d,a.p=h,a.d.f()}},Gr.preconnect=function(f,d){typeof f=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,a.d.C(f,d))},Gr.prefetchDNS=function(f){typeof f=="string"&&a.d.D(f)},Gr.preinit=function(f,d){if(typeof f=="string"&&d&&typeof d.as=="string"){var h=d.as,p=u(h,d.crossOrigin),g=typeof d.integrity=="string"?d.integrity:void 0,y=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;h==="style"?a.d.S(f,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:p,integrity:g,fetchPriority:y}):h==="script"&&a.d.X(f,{crossOrigin:p,integrity:g,fetchPriority:y,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},Gr.preinitModule=function(f,d){if(typeof f=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var h=u(d.as,d.crossOrigin);a.d.M(f,{crossOrigin:h,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&a.d.M(f)},Gr.preload=function(f,d){if(typeof f=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var h=d.as,p=u(h,d.crossOrigin);a.d.L(f,h,{crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},Gr.preloadModule=function(f,d){if(typeof f=="string")if(d){var h=u(d.as,d.crossOrigin);a.d.m(f,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:h,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else a.d.m(f)},Gr.requestFormReset=function(f){a.d.r(f)},Gr.unstable_batchedUpdates=function(f,d){return f(d)},Gr.useFormState=function(f,d,h){return o.H.useFormState(f,d,h)},Gr.useFormStatus=function(){return o.H.useHostTransitionStatus()},Gr.version="19.2.4",Gr}var H1;function EE(){if(H1)return Mp.exports;H1=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(),Mp.exports=UA(),Mp.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 G1;function qA(){if(G1)return Cu;G1=1;var t=PA(),e=u0(),r=EE();function a(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 f(n){if(s(n)!==n)throw Error(a(188))}function d(n){var l=n.alternate;if(!l){if(l=s(n),l===null)throw Error(a(188));return l!==n?null:n}for(var c=n,v=l;;){var x=c.return;if(x===null)break;var w=x.alternate;if(w===null){if(v=x.return,v!==null){c=v;continue}break}if(x.child===w.child){for(w=x.child;w;){if(w===c)return f(x),n;if(w===v)return f(x),l;w=w.sibling}throw Error(a(188))}if(c.return!==v.return)c=x,v=w;else{for(var O=!1,V=x.child;V;){if(V===c){O=!0,c=x,v=w;break}if(V===v){O=!0,v=x,c=w;break}V=V.sibling}if(!O){for(V=w.child;V;){if(V===c){O=!0,c=w,v=x;break}if(V===v){O=!0,v=w,c=x;break}V=V.sibling}if(!O)throw Error(a(189))}}if(c.alternate!==v)throw Error(a(190))}if(c.tag!==3)throw Error(a(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,g=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),b=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"),j=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),A=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),R=Symbol.for("react.activity"),L=Symbol.for("react.memo_cache_sentinel"),_=Symbol.iterator;function P(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 F(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 R:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case b:return"Portal";case N:return n.displayName||"Context";case C:return(n._context.displayName||"Context")+".Consumer";case j:var l=n.render;return n=n.displayName,n||(n=l.displayName||l.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case A:return l=n.displayName||null,l!==null?l:F(n.type)||"Memo";case B:l=n._payload,n=n._init;try{return F(n(l))}catch{}}return null}var Y=Array.isArray,U=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,z=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,H={pending:!1,data:null,method:null,action:null},X=[],K=-1;function k(n){return{current:n}}function G(n){0>K||(n.current=X[K],X[K]=null,K--)}function $(n,l){K++,X[K]=n.current,n.current=l}var J=k(null),ne=k(null),ee=k(null),ae=k(null);function de(n,l){switch($(ee,l),$(ne,n),$(J,null),l.nodeType){case 9:case 11:n=(n=l.documentElement)&&(n=n.namespaceURI)?i1(n):0;break;default:if(n=l.tagName,l=l.namespaceURI)l=i1(l),n=s1(l,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}G(J),$(J,n)}function le(){G(J),G(ne),G(ee)}function re(n){n.memoizedState!==null&&$(ae,n);var l=J.current,c=s1(l,n.type);l!==c&&($(ne,n),$(J,c))}function Z(n){ne.current===n&&(G(J),G(ne)),ae.current===n&&(G(ae),bu._currentValue=H)}var oe,ve;function Ne(n){if(oe===void 0)try{throw Error()}catch(c){var l=c.stack.trim().match(/\n( *(at )?)/);oe=l&&l[1]||"",ve=-1<c.stack.indexOf(`
|
|
42
|
+
at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
+
`+oe+n+ve}var Me=!1;function Je(n,l){if(!n||Me)return"";Me=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var v={DetermineComponentFrameRoot:function(){try{if(l){var Te=function(){throw Error()};if(Object.defineProperty(Te.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Te,[])}catch(me){var he=me}Reflect.construct(n,[],Te)}else{try{Te.call()}catch(me){he=me}n.call(Te.prototype)}}else{try{throw Error()}catch(me){he=me}(Te=n())&&typeof Te.catch=="function"&&Te.catch(function(){})}}catch(me){if(me&&he&&typeof me.stack=="string")return[me.stack,he.stack]}return[null,null]}};v.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var x=Object.getOwnPropertyDescriptor(v.DetermineComponentFrameRoot,"name");x&&x.configurable&&Object.defineProperty(v.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var w=v.DetermineComponentFrameRoot(),O=w[0],V=w[1];if(O&&V){var te=O.split(`
|
|
44
|
+
`),fe=V.split(`
|
|
45
|
+
`);for(x=v=0;v<te.length&&!te[v].includes("DetermineComponentFrameRoot");)v++;for(;x<fe.length&&!fe[x].includes("DetermineComponentFrameRoot");)x++;if(v===te.length||x===fe.length)for(v=te.length-1,x=fe.length-1;1<=v&&0<=x&&te[v]!==fe[x];)x--;for(;1<=v&&0<=x;v--,x--)if(te[v]!==fe[x]){if(v!==1||x!==1)do if(v--,x--,0>x||te[v]!==fe[x]){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<=x);break}}}finally{Me=!1,Error.prepareStackTrace=c}return(c=n?n.displayName||n.name:"")?Ne(c):""}function Ce(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 Je(n.type,!1);case 11:return Je(n.type.render,!1);case 1:return Je(n.type,!0);case 31:return Ne("Activity");default:return""}}function ke(n){try{var l="",c=null;do l+=Ce(n,c),c=n,n=n.return;while(n);return l}catch(v){return`
|
|
47
|
+
Error generating stack: `+v.message+`
|
|
48
|
+
`+v.stack}}var Le=Object.prototype.hasOwnProperty,De=t.unstable_scheduleCallback,Ue=t.unstable_cancelCallback,xe=t.unstable_shouldYield,Ye=t.unstable_requestPaint,Re=t.unstable_now,ye=t.unstable_getCurrentPriorityLevel,Ge=t.unstable_ImmediatePriority,rt=t.unstable_UserBlockingPriority,at=t.unstable_NormalPriority,ct=t.unstable_LowPriority,et=t.unstable_IdlePriority,qe=t.log,we=t.unstable_setDisableYieldValue,Q=null,ue=null;function ge(n){if(typeof qe=="function"&&we(n),ue&&typeof ue.setStrictMode=="function")try{ue.setStrictMode(Q,n)}catch{}}var pe=Math.clz32?Math.clz32:Ae,Se=Math.log,_e=Math.LN2;function Ae(n){return n>>>=0,n===0?32:31-(Se(n)/_e|0)|0}var He=256,ze=262144,Ke=4194304;function nt(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 it(n,l,c){var v=n.pendingLanes;if(v===0)return 0;var x=0,w=n.suspendedLanes,O=n.pingedLanes;n=n.warmLanes;var V=v&134217727;return V!==0?(v=V&~w,v!==0?x=nt(v):(O&=V,O!==0?x=nt(O):c||(c=V&~n,c!==0&&(x=nt(c))))):(V=v&~w,V!==0?x=nt(V):O!==0?x=nt(O):c||(c=v&~n,c!==0&&(x=nt(c)))),x===0?0:l!==0&&l!==x&&(l&w)===0&&(w=x&-x,c=l&-l,w>=c||w===32&&(c&4194048)!==0)?l:x}function Ve(n,l){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&l)===0}function ft(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 ot(){var n=Ke;return Ke<<=1,(Ke&62914560)===0&&(Ke=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 kr(n,l,c,v,x,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 V=n.entanglements,te=n.expirationTimes,fe=n.hiddenUpdates;for(c=O&~c;0<c;){var be=31-pe(c),Te=1<<be;V[be]=0,te[be]=-1;var he=fe[be];if(he!==null)for(fe[be]=null,be=0;be<he.length;be++){var me=he[be];me!==null&&(me.lane&=-536870913)}c&=~Te}v!==0&&Kt(n,v,0),w!==0&&x===0&&n.tag!==0&&(n.suspendedLanes|=w&~(O&~l))}function Kt(n,l,c){n.pendingLanes|=l,n.suspendedLanes&=~l;var v=31-pe(l);n.entangledLanes|=l,n.entanglements[v]=n.entanglements[v]|1073741824|c&261930}function nr(n,l){var c=n.entangledLanes|=l;for(n=n.entanglements;c;){var v=31-pe(c),x=1<<v;x&l|n[v]&l&&(n[v]|=l),c&=~x}}function Wt(n,l){var c=l&-l;return c=(c&42)!==0?1:ir(c),(c&(n.suspendedLanes|l))!==0?0:c}function ir(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 ja(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function Xt(){var n=z.p;return n!==0?n:(n=window.event,n===void 0?32:D1(n.type))}function Da(n,l){var c=z.p;try{return z.p=n,l()}finally{z.p=c}}var Er=Math.random().toString(36).slice(2),Ht="__reactFiber$"+Er,mr="__reactProps$"+Er,aa="__reactContainer$"+Er,Tr="__reactEvents$"+Er,Cr="__reactListeners$"+Er,Fr="__reactHandles$"+Er,Zn="__reactResources$"+Er,Nr="__reactMarker$"+Er;function il(n){delete n[Ht],delete n[mr],delete n[Tr],delete n[Cr],delete n[Fr]}function Wn(n){var l=n[Ht];if(l)return l;for(var c=n.parentNode;c;){if(l=c[aa]||c[Ht]){if(c=l.alternate,l.child!==null||c!==null&&c.child!==null)for(n=h1(n);n!==null;){if(c=n[Ht])return c;n=h1(n)}return l}n=c,c=n.parentNode}return null}function Jn(n){if(n=n[Ht]||n[aa]){var l=n.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return n}return null}function cs(n){var l=n.tag;if(l===5||l===26||l===27||l===6)return n.stateNode;throw Error(a(33))}function ei(n){var l=n[Zn];return l||(l=n[Zn]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function ur(n){n[Nr]=!0}var Dc=new Set,Oc={};function ga(n,l){an(n,l),an(n+"Capture",l)}function an(n,l){for(Oc[n]=l,n=0;n<l.length;n++)Dc.add(l[n])}var sl=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]*$"),Lo={},zo={};function gh(n){return Le.call(zo,n)?!0:Le.call(Lo,n)?!1:sl.test(n)?zo[n]=!0:(Lo[n]=!0,!1)}function Hr(n,l,c){if(gh(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 ti(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 Oa(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 Ar(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function na(n){var l=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function mh(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 x=v.get,w=v.set;return Object.defineProperty(n,l,{configurable:!0,get:function(){return x.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 Mc(n){if(!n._valueTracker){var l=na(n)?"checked":"value";n._valueTracker=mh(n,l,""+n[l])}}function Rc(n){if(!n)return!1;var l=n._valueTracker;if(!l)return!0;var c=l.getValue(),v="";return n&&(v=na(n)?n.checked?"true":"false":n.value),n=v,n!==c?(l.setValue(n),!0):!1}function kc(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 CN=/[\n"\\]/g;function Ma(n){return n.replace(CN,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function yh(n,l,c,v,x,w,O,V){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=""+Ar(l)):n.value!==""+Ar(l)&&(n.value=""+Ar(l)):O!=="submit"&&O!=="reset"||n.removeAttribute("value"),l!=null?xh(n,O,Ar(l)):c!=null?xh(n,O,Ar(c)):v!=null&&n.removeAttribute("value"),x==null&&w!=null&&(n.defaultChecked=!!w),x!=null&&(n.checked=x&&typeof x!="function"&&typeof x!="symbol"),V!=null&&typeof V!="function"&&typeof V!="symbol"&&typeof V!="boolean"?n.name=""+Ar(V):n.removeAttribute("name")}function J0(n,l,c,v,x,w,O,V){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)){Mc(n);return}c=c!=null?""+Ar(c):"",l=l!=null?""+Ar(l):c,V||l===n.value||(n.value=l),n.defaultValue=l}v=v??x,v=typeof v!="function"&&typeof v!="symbol"&&!!v,n.checked=V?n.checked:!!v,n.defaultChecked=!!v,O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"&&(n.name=O),Mc(n)}function xh(n,l,c){l==="number"&&kc(n.ownerDocument)===n||n.defaultValue===""+c||(n.defaultValue=""+c)}function ll(n,l,c,v){if(n=n.options,l){l={};for(var x=0;x<c.length;x++)l["$"+c[x]]=!0;for(c=0;c<n.length;c++)x=l.hasOwnProperty("$"+n[c].value),n[c].selected!==x&&(n[c].selected=x),x&&v&&(n[c].defaultSelected=!0)}else{for(c=""+Ar(c),l=null,x=0;x<n.length;x++){if(n[x].value===c){n[x].selected=!0,v&&(n[x].defaultSelected=!0);return}l!==null||n[x].disabled||(l=n[x])}l!==null&&(l.selected=!0)}}function ey(n,l,c){if(l!=null&&(l=""+Ar(l),l!==n.value&&(n.value=l),c==null)){n.defaultValue!==l&&(n.defaultValue=l);return}n.defaultValue=c!=null?""+Ar(c):""}function ty(n,l,c,v){if(l==null){if(v!=null){if(c!=null)throw Error(a(92));if(Y(v)){if(1<v.length)throw Error(a(93));v=v[0]}c=v}c==null&&(c=""),l=c}c=Ar(l),n.defaultValue=c,v=n.textContent,v===c&&v!==""&&v!==null&&(n.value=v),Mc(n)}function ol(n,l){if(l){var c=n.firstChild;if(c&&c===n.lastChild&&c.nodeType===3){c.nodeValue=l;return}}n.textContent=l}var NN=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 ry(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||NN.has(l)?l==="float"?n.cssFloat=c:n[l]=(""+c).trim():n[l]=c+"px"}function ay(n,l,c){if(l!=null&&typeof l!="object")throw Error(a(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 x in l)v=l[x],l.hasOwnProperty(x)&&c[x]!==v&&ry(n,x,v)}else for(var w in l)l.hasOwnProperty(w)&&ry(n,w,l[w])}function bh(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 AN=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"]]),jN=/^[\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 Bc(n){return jN.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function wn(){}var wh=null;function Sh(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var ul=null,cl=null;function ny(n){var l=Jn(n);if(l&&(n=l.stateNode)){var c=n[mr]||null;e:switch(n=l.stateNode,l.type){case"input":if(yh(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="'+Ma(""+l)+'"][type="radio"]'),l=0;l<c.length;l++){var v=c[l];if(v!==n&&v.form===n.form){var x=v[mr]||null;if(!x)throw Error(a(90));yh(v,x.value,x.defaultValue,x.defaultValue,x.checked,x.defaultChecked,x.type,x.name)}}for(l=0;l<c.length;l++)v=c[l],v.form===n.form&&Rc(v)}break e;case"textarea":ey(n,c.value,c.defaultValue);break e;case"select":l=c.value,l!=null&&ll(n,!!c.multiple,l,!1)}}}var Eh=!1;function iy(n,l,c){if(Eh)return n(l,c);Eh=!0;try{var v=n(l);return v}finally{if(Eh=!1,(ul!==null||cl!==null)&&(Sf(),ul&&(l=ul,n=cl,cl=ul=null,ny(l),n)))for(l=0;l<n.length;l++)ny(n[l])}}function _o(n,l){var c=n.stateNode;if(c===null)return null;var v=c[mr]||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(a(231,l,typeof c));return c}var Sn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Th=!1;if(Sn)try{var Po={};Object.defineProperty(Po,"passive",{get:function(){Th=!0}}),window.addEventListener("test",Po,Po),window.removeEventListener("test",Po,Po)}catch{Th=!1}var ri=null,Ch=null,Lc=null;function sy(){if(Lc)return Lc;var n,l=Ch,c=l.length,v,x="value"in ri?ri.value:ri.textContent,w=x.length;for(n=0;n<c&&l[n]===x[n];n++);var O=c-n;for(v=1;v<=O&&l[c-v]===x[w-v];v++);return Lc=x.slice(n,1<v?1-v:void 0)}function zc(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 _c(){return!0}function ly(){return!1}function ia(n){function l(c,v,x,w,O){this._reactName=c,this._targetInst=x,this.type=v,this.nativeEvent=w,this.target=O,this.currentTarget=null;for(var V in n)n.hasOwnProperty(V)&&(c=n[V],this[V]=c?c(w):w[V]);return this.isDefaultPrevented=(w.defaultPrevented!=null?w.defaultPrevented:w.returnValue===!1)?_c:ly,this.isPropagationStopped=ly,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=_c)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=_c)},persist:function(){},isPersistent:_c}),l}var fs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Pc=ia(fs),Uo=p({},fs,{view:0,detail:0}),DN=ia(Uo),Nh,Ah,qo,Uc=p({},Uo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Dh,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!==qo&&(qo&&n.type==="mousemove"?(Nh=n.screenX-qo.screenX,Ah=n.screenY-qo.screenY):Ah=Nh=0,qo=n),Nh)},movementY:function(n){return"movementY"in n?n.movementY:Ah}}),oy=ia(Uc),ON=p({},Uc,{dataTransfer:0}),MN=ia(ON),RN=p({},Uo,{relatedTarget:0}),jh=ia(RN),kN=p({},fs,{animationName:0,elapsedTime:0,pseudoElement:0}),BN=ia(kN),LN=p({},fs,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),zN=ia(LN),_N=p({},fs,{data:0}),uy=ia(_N),PN={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},UN={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"},qN={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function IN(n){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(n):(n=qN[n])?!!l[n]:!1}function Dh(){return IN}var VN=p({},Uo,{key:function(n){if(n.key){var l=PN[n.key]||n.key;if(l!=="Unidentified")return l}return n.type==="keypress"?(n=zc(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?UN[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Dh,charCode:function(n){return n.type==="keypress"?zc(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?zc(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),FN=ia(VN),HN=p({},Uc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),cy=ia(HN),GN=p({},Uo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Dh}),QN=ia(GN),YN=p({},fs,{propertyName:0,elapsedTime:0,pseudoElement:0}),KN=ia(YN),XN=p({},Uc,{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}),$N=ia(XN),ZN=p({},fs,{newState:0,oldState:0}),WN=ia(ZN),JN=[9,13,27,32],Oh=Sn&&"CompositionEvent"in window,Io=null;Sn&&"documentMode"in document&&(Io=document.documentMode);var e5=Sn&&"TextEvent"in window&&!Io,fy=Sn&&(!Oh||Io&&8<Io&&11>=Io),dy=" ",hy=!1;function vy(n,l){switch(n){case"keyup":return JN.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function py(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var fl=!1;function t5(n,l){switch(n){case"compositionend":return py(l);case"keypress":return l.which!==32?null:(hy=!0,dy);case"textInput":return n=l.data,n===dy&&hy?null:n;default:return null}}function r5(n,l){if(fl)return n==="compositionend"||!Oh&&vy(n,l)?(n=sy(),Lc=Ch=ri=null,fl=!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 fy&&l.locale!=="ko"?null:l.data;default:return null}}var a5={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 gy(n){var l=n&&n.nodeName&&n.nodeName.toLowerCase();return l==="input"?!!a5[n.type]:l==="textarea"}function my(n,l,c,v){ul?cl?cl.push(v):cl=[v]:ul=v,l=Df(l,"onChange"),0<l.length&&(c=new Pc("onChange","change",null,c,v),n.push({event:c,listeners:l}))}var Vo=null,Fo=null;function n5(n){Jb(n,0)}function qc(n){var l=cs(n);if(Rc(l))return n}function yy(n,l){if(n==="change")return l}var xy=!1;if(Sn){var Mh;if(Sn){var Rh="oninput"in document;if(!Rh){var by=document.createElement("div");by.setAttribute("oninput","return;"),Rh=typeof by.oninput=="function"}Mh=Rh}else Mh=!1;xy=Mh&&(!document.documentMode||9<document.documentMode)}function wy(){Vo&&(Vo.detachEvent("onpropertychange",Sy),Fo=Vo=null)}function Sy(n){if(n.propertyName==="value"&&qc(Fo)){var l=[];my(l,Fo,n,Sh(n)),iy(n5,l)}}function i5(n,l,c){n==="focusin"?(wy(),Vo=l,Fo=c,Vo.attachEvent("onpropertychange",Sy)):n==="focusout"&&wy()}function s5(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return qc(Fo)}function l5(n,l){if(n==="click")return qc(l)}function o5(n,l){if(n==="input"||n==="change")return qc(l)}function u5(n,l){return n===l&&(n!==0||1/n===1/l)||n!==n&&l!==l}var ma=typeof Object.is=="function"?Object.is:u5;function Ho(n,l){if(ma(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 x=c[v];if(!Le.call(l,x)||!ma(n[x],l[x]))return!1}return!0}function Ey(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Ty(n,l){var c=Ey(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=Ey(c)}}function Cy(n,l){return n&&l?n===l?!0:n&&n.nodeType===3?!1:l&&l.nodeType===3?Cy(n,l.parentNode):"contains"in n?n.contains(l):n.compareDocumentPosition?!!(n.compareDocumentPosition(l)&16):!1:!1}function Ny(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var l=kc(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=kc(n.document)}return l}function kh(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 c5=Sn&&"documentMode"in document&&11>=document.documentMode,dl=null,Bh=null,Go=null,Lh=!1;function Ay(n,l,c){var v=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Lh||dl==null||dl!==kc(v)||(v=dl,"selectionStart"in v&&kh(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}),Go&&Ho(Go,v)||(Go=v,v=Df(Bh,"onSelect"),0<v.length&&(l=new Pc("onSelect","select",null,l,c),n.push({event:l,listeners:v}),l.target=dl)))}function ds(n,l){var c={};return c[n.toLowerCase()]=l.toLowerCase(),c["Webkit"+n]="webkit"+l,c["Moz"+n]="moz"+l,c}var hl={animationend:ds("Animation","AnimationEnd"),animationiteration:ds("Animation","AnimationIteration"),animationstart:ds("Animation","AnimationStart"),transitionrun:ds("Transition","TransitionRun"),transitionstart:ds("Transition","TransitionStart"),transitioncancel:ds("Transition","TransitionCancel"),transitionend:ds("Transition","TransitionEnd")},zh={},jy={};Sn&&(jy=document.createElement("div").style,"AnimationEvent"in window||(delete hl.animationend.animation,delete hl.animationiteration.animation,delete hl.animationstart.animation),"TransitionEvent"in window||delete hl.transitionend.transition);function hs(n){if(zh[n])return zh[n];if(!hl[n])return n;var l=hl[n],c;for(c in l)if(l.hasOwnProperty(c)&&c in jy)return zh[n]=l[c];return n}var Dy=hs("animationend"),Oy=hs("animationiteration"),My=hs("animationstart"),f5=hs("transitionrun"),d5=hs("transitionstart"),h5=hs("transitioncancel"),Ry=hs("transitionend"),ky=new Map,_h="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(" ");_h.push("scrollEnd");function Ya(n,l){ky.set(n,l),ga(l,[n])}var Ic=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)},Ra=[],vl=0,Ph=0;function Vc(){for(var n=vl,l=Ph=vl=0;l<n;){var c=Ra[l];Ra[l++]=null;var v=Ra[l];Ra[l++]=null;var x=Ra[l];Ra[l++]=null;var w=Ra[l];if(Ra[l++]=null,v!==null&&x!==null){var O=v.pending;O===null?x.next=x:(x.next=O.next,O.next=x),v.pending=x}w!==0&&By(c,x,w)}}function Fc(n,l,c,v){Ra[vl++]=n,Ra[vl++]=l,Ra[vl++]=c,Ra[vl++]=v,Ph|=v,n.lanes|=v,n=n.alternate,n!==null&&(n.lanes|=v)}function Uh(n,l,c,v){return Fc(n,l,c,v),Hc(n)}function vs(n,l){return Fc(n,null,null,l),Hc(n)}function By(n,l,c){n.lanes|=c;var v=n.alternate;v!==null&&(v.lanes|=c);for(var x=!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||(x=!0)),n=w,w=w.return;return n.tag===3?(w=n.stateNode,x&&l!==null&&(x=31-pe(c),n=w.hiddenUpdates,v=n[x],v===null?n[x]=[l]:v.push(l),l.lane=c|536870912),w):null}function Hc(n){if(50<hu)throw hu=0,Kv=null,Error(a(185));for(var l=n.return;l!==null;)n=l,l=n.return;return n.tag===3?n.stateNode:null}var pl={};function v5(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 ya(n,l,c,v){return new v5(n,l,c,v)}function qh(n){return n=n.prototype,!(!n||!n.isReactComponent)}function En(n,l){var c=n.alternate;return c===null?(c=ya(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 Ly(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 Gc(n,l,c,v,x,w){var O=0;if(v=n,typeof n=="function")qh(n)&&(O=1);else if(typeof n=="string")O=xA(n,c,J.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case R:return n=ya(31,c,l,x),n.elementType=R,n.lanes=w,n;case E:return ps(c.children,x,w,l);case S:O=8,x|=24;break;case T:return n=ya(12,c,l,x|2),n.elementType=T,n.lanes=w,n;case M:return n=ya(13,c,l,x),n.elementType=M,n.lanes=w,n;case D:return n=ya(19,c,l,x),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 j:O=11;break e;case A:O=14;break e;case B:O=16,v=null;break e}O=29,c=Error(a(130,n===null?"null":typeof n,"")),v=null}return l=ya(O,c,l,x),l.elementType=n,l.type=v,l.lanes=w,l}function ps(n,l,c,v){return n=ya(7,n,v,l),n.lanes=c,n}function Ih(n,l,c){return n=ya(6,n,null,l),n.lanes=c,n}function zy(n){var l=ya(18,null,null,0);return l.stateNode=n,l}function Vh(n,l,c){return l=ya(4,n.children!==null?n.children:[],n.key,l),l.lanes=c,l.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},l}var _y=new WeakMap;function ka(n,l){if(typeof n=="object"&&n!==null){var c=_y.get(n);return c!==void 0?c:(l={value:n,source:l,stack:ke(l)},_y.set(n,l),l)}return{value:n,source:l,stack:ke(l)}}var gl=[],ml=0,Qc=null,Qo=0,Ba=[],La=0,ai=null,nn=1,sn="";function Tn(n,l){gl[ml++]=Qo,gl[ml++]=Qc,Qc=n,Qo=l}function Py(n,l,c){Ba[La++]=nn,Ba[La++]=sn,Ba[La++]=ai,ai=n;var v=nn;n=sn;var x=32-pe(v)-1;v&=~(1<<x),c+=1;var w=32-pe(l)+x;if(30<w){var O=x-x%5;w=(v&(1<<O)-1).toString(32),v>>=O,x-=O,nn=1<<32-pe(l)+x|c<<x|v,sn=w+n}else nn=1<<w|c<<x|v,sn=n}function Fh(n){n.return!==null&&(Tn(n,1),Py(n,1,0))}function Hh(n){for(;n===Qc;)Qc=gl[--ml],gl[ml]=null,Qo=gl[--ml],gl[ml]=null;for(;n===ai;)ai=Ba[--La],Ba[La]=null,sn=Ba[--La],Ba[La]=null,nn=Ba[--La],Ba[La]=null}function Uy(n,l){Ba[La++]=nn,Ba[La++]=sn,Ba[La++]=ai,nn=l.id,sn=l.overflow,ai=n}var Br=null,It=null,mt=!1,ni=null,za=!1,Gh=Error(a(519));function ii(n){var l=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Yo(ka(l,n)),Gh}function qy(n){var l=n.stateNode,c=n.type,v=n.memoizedProps;switch(l[Ht]=n,l[mr]=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<pu.length;c++)vt(pu[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),J0(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),ty(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||a1(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=wn),l=!0):l=!1,l||ii(n,!0)}function Iy(n){for(Br=n.return;Br;)switch(Br.tag){case 5:case 31:case 13:za=!1;return;case 27:case 3:za=!0;return;default:Br=Br.return}}function yl(n){if(n!==Br)return!1;if(!mt)return Iy(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")||up(n.type,n.memoizedProps)),c=!c),c&&It&&ii(n),Iy(n),l===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(a(317));It=d1(n)}else if(l===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(a(317));It=d1(n)}else l===27?(l=It,xi(n.type)?(n=vp,vp=null,It=n):It=l):It=Br?Pa(n.stateNode.nextSibling):null;return!0}function gs(){It=Br=null,mt=!1}function Qh(){var n=ni;return n!==null&&(ua===null?ua=n:ua.push.apply(ua,n),ni=null),n}function Yo(n){ni===null?ni=[n]:ni.push(n)}var Yh=k(null),ms=null,Cn=null;function si(n,l,c){$(Yh,l._currentValue),l._currentValue=c}function Nn(n){n._currentValue=Yh.current,G(Yh)}function Kh(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 Xh(n,l,c,v){var x=n.child;for(x!==null&&(x.return=n);x!==null;){var w=x.dependencies;if(w!==null){var O=x.child;w=w.firstContext;e:for(;w!==null;){var V=w;w=x;for(var te=0;te<l.length;te++)if(V.context===l[te]){w.lanes|=c,V=w.alternate,V!==null&&(V.lanes|=c),Kh(w.return,c,n),v||(O=null);break e}w=V.next}}else if(x.tag===18){if(O=x.return,O===null)throw Error(a(341));O.lanes|=c,w=O.alternate,w!==null&&(w.lanes|=c),Kh(O,c,n),O=null}else O=x.child;if(O!==null)O.return=x;else for(O=x;O!==null;){if(O===n){O=null;break}if(x=O.sibling,x!==null){x.return=O.return,O=x;break}O=O.return}x=O}}function xl(n,l,c,v){n=null;for(var x=l,w=!1;x!==null;){if(!w){if((x.flags&524288)!==0)w=!0;else if((x.flags&262144)!==0)break}if(x.tag===10){var O=x.alternate;if(O===null)throw Error(a(387));if(O=O.memoizedProps,O!==null){var V=x.type;ma(x.pendingProps.value,O.value)||(n!==null?n.push(V):n=[V])}}else if(x===ae.current){if(O=x.alternate,O===null)throw Error(a(387));O.memoizedState.memoizedState!==x.memoizedState.memoizedState&&(n!==null?n.push(bu):n=[bu])}x=x.return}n!==null&&Xh(l,n,c,v),l.flags|=262144}function Yc(n){for(n=n.firstContext;n!==null;){if(!ma(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function ys(n){ms=n,Cn=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function Lr(n){return Vy(ms,n)}function Kc(n,l){return ms===null&&ys(n),Vy(n,l)}function Vy(n,l){var c=l._currentValue;if(l={context:l,memoizedValue:c,next:null},Cn===null){if(n===null)throw Error(a(308));Cn=l,n.dependencies={lanes:0,firstContext:l},n.flags|=524288}else Cn=Cn.next=l;return c}var p5=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()})}},g5=t.unstable_scheduleCallback,m5=t.unstable_NormalPriority,cr={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function $h(){return{controller:new p5,data:new Map,refCount:0}}function Ko(n){n.refCount--,n.refCount===0&&g5(m5,function(){n.controller.abort()})}var Xo=null,Zh=0,bl=0,wl=null;function y5(n,l){if(Xo===null){var c=Xo=[];Zh=0,bl=ep(),wl={status:"pending",value:void 0,then:function(v){c.push(v)}}}return Zh++,l.then(Fy,Fy),l}function Fy(){if(--Zh===0&&Xo!==null){wl!==null&&(wl.status="fulfilled");var n=Xo;Xo=null,bl=0,wl=null;for(var l=0;l<n.length;l++)(0,n[l])()}}function x5(n,l){var c=[],v={status:"pending",value:null,reason:null,then:function(x){c.push(x)}};return n.then(function(){v.status="fulfilled",v.value=l;for(var x=0;x<c.length;x++)(0,c[x])(l)},function(x){for(v.status="rejected",v.reason=x,x=0;x<c.length;x++)(0,c[x])(void 0)}),v}var Hy=U.S;U.S=function(n,l){Ab=Re(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&y5(n,l),Hy!==null&&Hy(n,l)};var xs=k(null);function Wh(){var n=xs.current;return n!==null?n:_t.pooledCache}function Xc(n,l){l===null?$(xs,xs.current):$(xs,l.pool)}function Gy(){var n=Wh();return n===null?null:{parent:cr._currentValue,pool:n}}var Sl=Error(a(460)),Jh=Error(a(474)),$c=Error(a(542)),Zc={then:function(){}};function Qy(n){return n=n.status,n==="fulfilled"||n==="rejected"}function Yy(n,l,c){switch(c=n[c],c===void 0?n.push(l):c!==l&&(l.then(wn,wn),l=c),l.status){case"fulfilled":return l.value;case"rejected":throw n=l.reason,Xy(n),n;default:if(typeof l.status=="string")l.then(wn,wn);else{if(n=_t,n!==null&&100<n.shellSuspendCounter)throw Error(a(482));n=l,n.status="pending",n.then(function(v){if(l.status==="pending"){var x=l;x.status="fulfilled",x.value=v}},function(v){if(l.status==="pending"){var x=l;x.status="rejected",x.reason=v}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw n=l.reason,Xy(n),n}throw ws=l,Sl}}function bs(n){try{var l=n._init;return l(n._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(ws=c,Sl):c}}var ws=null;function Ky(){if(ws===null)throw Error(a(459));var n=ws;return ws=null,n}function Xy(n){if(n===Sl||n===$c)throw Error(a(483))}var El=null,$o=0;function Wc(n){var l=$o;return $o+=1,El===null&&(El=[]),Yy(El,n,l)}function Zo(n,l){l=l.props.ref,n.ref=l!==void 0?l:null}function Jc(n,l){throw l.$$typeof===g?Error(a(525)):(n=Object.prototype.toString.call(l),Error(a(31,n==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":n)))}function $y(n){function l(se,ie){if(n){var ce=se.deletions;ce===null?(se.deletions=[ie],se.flags|=16):ce.push(ie)}}function c(se,ie){if(!n)return null;for(;ie!==null;)l(se,ie),ie=ie.sibling;return null}function v(se){for(var ie=new Map;se!==null;)se.key!==null?ie.set(se.key,se):ie.set(se.index,se),se=se.sibling;return ie}function x(se,ie){return se=En(se,ie),se.index=0,se.sibling=null,se}function w(se,ie,ce){return se.index=ce,n?(ce=se.alternate,ce!==null?(ce=ce.index,ce<ie?(se.flags|=67108866,ie):ce):(se.flags|=67108866,ie)):(se.flags|=1048576,ie)}function O(se){return n&&se.alternate===null&&(se.flags|=67108866),se}function V(se,ie,ce,Ee){return ie===null||ie.tag!==6?(ie=Ih(ce,se.mode,Ee),ie.return=se,ie):(ie=x(ie,ce),ie.return=se,ie)}function te(se,ie,ce,Ee){var $e=ce.type;return $e===E?be(se,ie,ce.props.children,Ee,ce.key):ie!==null&&(ie.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===B&&bs($e)===ie.type)?(ie=x(ie,ce.props),Zo(ie,ce),ie.return=se,ie):(ie=Gc(ce.type,ce.key,ce.props,null,se.mode,Ee),Zo(ie,ce),ie.return=se,ie)}function fe(se,ie,ce,Ee){return ie===null||ie.tag!==4||ie.stateNode.containerInfo!==ce.containerInfo||ie.stateNode.implementation!==ce.implementation?(ie=Vh(ce,se.mode,Ee),ie.return=se,ie):(ie=x(ie,ce.children||[]),ie.return=se,ie)}function be(se,ie,ce,Ee,$e){return ie===null||ie.tag!==7?(ie=ps(ce,se.mode,Ee,$e),ie.return=se,ie):(ie=x(ie,ce),ie.return=se,ie)}function Te(se,ie,ce){if(typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint")return ie=Ih(""+ie,se.mode,ce),ie.return=se,ie;if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case y:return ce=Gc(ie.type,ie.key,ie.props,null,se.mode,ce),Zo(ce,ie),ce.return=se,ce;case b:return ie=Vh(ie,se.mode,ce),ie.return=se,ie;case B:return ie=bs(ie),Te(se,ie,ce)}if(Y(ie)||P(ie))return ie=ps(ie,se.mode,ce,null),ie.return=se,ie;if(typeof ie.then=="function")return Te(se,Wc(ie),ce);if(ie.$$typeof===N)return Te(se,Kc(se,ie),ce);Jc(se,ie)}return null}function he(se,ie,ce,Ee){var $e=ie!==null?ie.key:null;if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return $e!==null?null:V(se,ie,""+ce,Ee);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case y:return ce.key===$e?te(se,ie,ce,Ee):null;case b:return ce.key===$e?fe(se,ie,ce,Ee):null;case B:return ce=bs(ce),he(se,ie,ce,Ee)}if(Y(ce)||P(ce))return $e!==null?null:be(se,ie,ce,Ee,null);if(typeof ce.then=="function")return he(se,ie,Wc(ce),Ee);if(ce.$$typeof===N)return he(se,ie,Kc(se,ce),Ee);Jc(se,ce)}return null}function me(se,ie,ce,Ee,$e){if(typeof Ee=="string"&&Ee!==""||typeof Ee=="number"||typeof Ee=="bigint")return se=se.get(ce)||null,V(ie,se,""+Ee,$e);if(typeof Ee=="object"&&Ee!==null){switch(Ee.$$typeof){case y:return se=se.get(Ee.key===null?ce:Ee.key)||null,te(ie,se,Ee,$e);case b:return se=se.get(Ee.key===null?ce:Ee.key)||null,fe(ie,se,Ee,$e);case B:return Ee=bs(Ee),me(se,ie,ce,Ee,$e)}if(Y(Ee)||P(Ee))return se=se.get(ce)||null,be(ie,se,Ee,$e,null);if(typeof Ee.then=="function")return me(se,ie,ce,Wc(Ee),$e);if(Ee.$$typeof===N)return me(se,ie,ce,Kc(ie,Ee),$e);Jc(ie,Ee)}return null}function Fe(se,ie,ce,Ee){for(var $e=null,wt=null,Qe=ie,ut=ie=0,gt=null;Qe!==null&&ut<ce.length;ut++){Qe.index>ut?(gt=Qe,Qe=null):gt=Qe.sibling;var St=he(se,Qe,ce[ut],Ee);if(St===null){Qe===null&&(Qe=gt);break}n&&Qe&&St.alternate===null&&l(se,Qe),ie=w(St,ie,ut),wt===null?$e=St:wt.sibling=St,wt=St,Qe=gt}if(ut===ce.length)return c(se,Qe),mt&&Tn(se,ut),$e;if(Qe===null){for(;ut<ce.length;ut++)Qe=Te(se,ce[ut],Ee),Qe!==null&&(ie=w(Qe,ie,ut),wt===null?$e=Qe:wt.sibling=Qe,wt=Qe);return mt&&Tn(se,ut),$e}for(Qe=v(Qe);ut<ce.length;ut++)gt=me(Qe,se,ut,ce[ut],Ee),gt!==null&&(n&>.alternate!==null&&Qe.delete(gt.key===null?ut:gt.key),ie=w(gt,ie,ut),wt===null?$e=gt:wt.sibling=gt,wt=gt);return n&&Qe.forEach(function(Ti){return l(se,Ti)}),mt&&Tn(se,ut),$e}function We(se,ie,ce,Ee){if(ce==null)throw Error(a(151));for(var $e=null,wt=null,Qe=ie,ut=ie=0,gt=null,St=ce.next();Qe!==null&&!St.done;ut++,St=ce.next()){Qe.index>ut?(gt=Qe,Qe=null):gt=Qe.sibling;var Ti=he(se,Qe,St.value,Ee);if(Ti===null){Qe===null&&(Qe=gt);break}n&&Qe&&Ti.alternate===null&&l(se,Qe),ie=w(Ti,ie,ut),wt===null?$e=Ti:wt.sibling=Ti,wt=Ti,Qe=gt}if(St.done)return c(se,Qe),mt&&Tn(se,ut),$e;if(Qe===null){for(;!St.done;ut++,St=ce.next())St=Te(se,St.value,Ee),St!==null&&(ie=w(St,ie,ut),wt===null?$e=St:wt.sibling=St,wt=St);return mt&&Tn(se,ut),$e}for(Qe=v(Qe);!St.done;ut++,St=ce.next())St=me(Qe,se,ut,St.value,Ee),St!==null&&(n&&St.alternate!==null&&Qe.delete(St.key===null?ut:St.key),ie=w(St,ie,ut),wt===null?$e=St:wt.sibling=St,wt=St);return n&&Qe.forEach(function(OA){return l(se,OA)}),mt&&Tn(se,ut),$e}function Lt(se,ie,ce,Ee){if(typeof ce=="object"&&ce!==null&&ce.type===E&&ce.key===null&&(ce=ce.props.children),typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case y:e:{for(var $e=ce.key;ie!==null;){if(ie.key===$e){if($e=ce.type,$e===E){if(ie.tag===7){c(se,ie.sibling),Ee=x(ie,ce.props.children),Ee.return=se,se=Ee;break e}}else if(ie.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===B&&bs($e)===ie.type){c(se,ie.sibling),Ee=x(ie,ce.props),Zo(Ee,ce),Ee.return=se,se=Ee;break e}c(se,ie);break}else l(se,ie);ie=ie.sibling}ce.type===E?(Ee=ps(ce.props.children,se.mode,Ee,ce.key),Ee.return=se,se=Ee):(Ee=Gc(ce.type,ce.key,ce.props,null,se.mode,Ee),Zo(Ee,ce),Ee.return=se,se=Ee)}return O(se);case b:e:{for($e=ce.key;ie!==null;){if(ie.key===$e)if(ie.tag===4&&ie.stateNode.containerInfo===ce.containerInfo&&ie.stateNode.implementation===ce.implementation){c(se,ie.sibling),Ee=x(ie,ce.children||[]),Ee.return=se,se=Ee;break e}else{c(se,ie);break}else l(se,ie);ie=ie.sibling}Ee=Vh(ce,se.mode,Ee),Ee.return=se,se=Ee}return O(se);case B:return ce=bs(ce),Lt(se,ie,ce,Ee)}if(Y(ce))return Fe(se,ie,ce,Ee);if(P(ce)){if($e=P(ce),typeof $e!="function")throw Error(a(150));return ce=$e.call(ce),We(se,ie,ce,Ee)}if(typeof ce.then=="function")return Lt(se,ie,Wc(ce),Ee);if(ce.$$typeof===N)return Lt(se,ie,Kc(se,ce),Ee);Jc(se,ce)}return typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint"?(ce=""+ce,ie!==null&&ie.tag===6?(c(se,ie.sibling),Ee=x(ie,ce),Ee.return=se,se=Ee):(c(se,ie),Ee=Ih(ce,se.mode,Ee),Ee.return=se,se=Ee),O(se)):c(se,ie)}return function(se,ie,ce,Ee){try{$o=0;var $e=Lt(se,ie,ce,Ee);return El=null,$e}catch(Qe){if(Qe===Sl||Qe===$c)throw Qe;var wt=ya(29,Qe,null,se.mode);return wt.lanes=Ee,wt.return=se,wt}finally{}}}var Ss=$y(!0),Zy=$y(!1),li=!1;function ev(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function tv(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 oi(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function ui(n,l,c){var v=n.updateQueue;if(v===null)return null;if(v=v.shared,(Ct&2)!==0){var x=v.pending;return x===null?l.next=l:(l.next=x.next,x.next=l),v.pending=l,l=Hc(n),By(n,null,c),l}return Fc(n,v,l,c),Hc(n)}function Wo(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,nr(n,c)}}function rv(n,l){var c=n.updateQueue,v=n.alternate;if(v!==null&&(v=v.updateQueue,c===v)){var x=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?x=w=O:w=w.next=O,c=c.next}while(c!==null);w===null?x=w=l:w=w.next=l}else x=w=l;c={baseState:v.baseState,firstBaseUpdate:x,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 av=!1;function Jo(){if(av){var n=wl;if(n!==null)throw n}}function eu(n,l,c,v){av=!1;var x=n.updateQueue;li=!1;var w=x.firstBaseUpdate,O=x.lastBaseUpdate,V=x.shared.pending;if(V!==null){x.shared.pending=null;var te=V,fe=te.next;te.next=null,O===null?w=fe:O.next=fe,O=te;var be=n.alternate;be!==null&&(be=be.updateQueue,V=be.lastBaseUpdate,V!==O&&(V===null?be.firstBaseUpdate=fe:V.next=fe,be.lastBaseUpdate=te))}if(w!==null){var Te=x.baseState;O=0,be=fe=te=null,V=w;do{var he=V.lane&-536870913,me=he!==V.lane;if(me?(pt&he)===he:(v&he)===he){he!==0&&he===bl&&(av=!0),be!==null&&(be=be.next={lane:0,tag:V.tag,payload:V.payload,callback:null,next:null});e:{var Fe=n,We=V;he=l;var Lt=c;switch(We.tag){case 1:if(Fe=We.payload,typeof Fe=="function"){Te=Fe.call(Lt,Te,he);break e}Te=Fe;break e;case 3:Fe.flags=Fe.flags&-65537|128;case 0:if(Fe=We.payload,he=typeof Fe=="function"?Fe.call(Lt,Te,he):Fe,he==null)break e;Te=p({},Te,he);break e;case 2:li=!0}}he=V.callback,he!==null&&(n.flags|=64,me&&(n.flags|=8192),me=x.callbacks,me===null?x.callbacks=[he]:me.push(he))}else me={lane:he,tag:V.tag,payload:V.payload,callback:V.callback,next:null},be===null?(fe=be=me,te=Te):be=be.next=me,O|=he;if(V=V.next,V===null){if(V=x.shared.pending,V===null)break;me=V,V=me.next,me.next=null,x.lastBaseUpdate=me,x.shared.pending=null}}while(!0);be===null&&(te=Te),x.baseState=te,x.firstBaseUpdate=fe,x.lastBaseUpdate=be,w===null&&(x.shared.lanes=0),vi|=O,n.lanes=O,n.memoizedState=Te}}function Wy(n,l){if(typeof n!="function")throw Error(a(191,n));n.call(l)}function Jy(n,l){var c=n.callbacks;if(c!==null)for(n.callbacks=null,n=0;n<c.length;n++)Wy(c[n],l)}var Tl=k(null),ef=k(0);function ex(n,l){n=Ln,$(ef,n),$(Tl,l),Ln=n|l.baseLanes}function nv(){$(ef,Ln),$(Tl,Tl.current)}function iv(){Ln=ef.current,G(Tl),G(ef)}var xa=k(null),_a=null;function ci(n){var l=n.alternate;$(sr,sr.current&1),$(xa,n),_a===null&&(l===null||Tl.current!==null||l.memoizedState!==null)&&(_a=n)}function sv(n){$(sr,sr.current),$(xa,n),_a===null&&(_a=n)}function tx(n){n.tag===22?($(sr,sr.current),$(xa,n),_a===null&&(_a=n)):fi()}function fi(){$(sr,sr.current),$(xa,xa.current)}function ba(n){G(xa),_a===n&&(_a=null),G(sr)}var sr=k(0);function tf(n){for(var l=n;l!==null;){if(l.tag===13){var c=l.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||dp(c)||hp(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 An=0,lt=null,kt=null,fr=null,rf=!1,Cl=!1,Es=!1,af=0,tu=0,Nl=null,b5=0;function Jt(){throw Error(a(321))}function lv(n,l){if(l===null)return!1;for(var c=0;c<l.length&&c<n.length;c++)if(!ma(n[c],l[c]))return!1;return!0}function ov(n,l,c,v,x,w){return An=w,lt=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,U.H=n===null||n.memoizedState===null?Px:Ev,Es=!1,w=c(v,x),Es=!1,Cl&&(w=ax(l,c,v,x)),rx(n),w}function rx(n){U.H=nu;var l=kt!==null&&kt.next!==null;if(An=0,fr=kt=lt=null,rf=!1,tu=0,Nl=null,l)throw Error(a(300));n===null||dr||(n=n.dependencies,n!==null&&Yc(n)&&(dr=!0))}function ax(n,l,c,v){lt=n;var x=0;do{if(Cl&&(Nl=null),tu=0,Cl=!1,25<=x)throw Error(a(301));if(x+=1,fr=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)}U.H=Ux,w=l(c,v)}while(Cl);return w}function w5(){var n=U.H,l=n.useState()[0];return l=typeof l.then=="function"?ru(l):l,n=n.useState()[0],(kt!==null?kt.memoizedState:null)!==n&&(lt.flags|=1024),l}function uv(){var n=af!==0;return af=0,n}function cv(n,l,c){l.updateQueue=n.updateQueue,l.flags&=-2053,n.lanes&=~c}function fv(n){if(rf){for(n=n.memoizedState;n!==null;){var l=n.queue;l!==null&&(l.pending=null),n=n.next}rf=!1}An=0,fr=kt=lt=null,Cl=!1,tu=af=0,Nl=null}function Zr(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return fr===null?lt.memoizedState=fr=n:fr=fr.next=n,fr}function lr(){if(kt===null){var n=lt.alternate;n=n!==null?n.memoizedState:null}else n=kt.next;var l=fr===null?lt.memoizedState:fr.next;if(l!==null)fr=l,kt=n;else{if(n===null)throw lt.alternate===null?Error(a(467)):Error(a(310));kt=n,n={memoizedState:kt.memoizedState,baseState:kt.baseState,baseQueue:kt.baseQueue,queue:kt.queue,next:null},fr===null?lt.memoizedState=fr=n:fr=fr.next=n}return fr}function nf(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ru(n){var l=tu;return tu+=1,Nl===null&&(Nl=[]),n=Yy(Nl,n,l),l=lt,(fr===null?l.memoizedState:fr.next)===null&&(l=l.alternate,U.H=l===null||l.memoizedState===null?Px:Ev),n}function sf(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return ru(n);if(n.$$typeof===N)return Lr(n)}throw Error(a(438,String(n)))}function dv(n){var l=null,c=lt.updateQueue;if(c!==null&&(l=c.memoCache),l==null){var v=lt.alternate;v!==null&&(v=v.updateQueue,v!==null&&(v=v.memoCache,v!=null&&(l={data:v.data.map(function(x){return x.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),c===null&&(c=nf(),lt.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]=L;return l.index++,c}function jn(n,l){return typeof l=="function"?l(n):l}function lf(n){var l=lr();return hv(l,kt,n)}function hv(n,l,c){var v=n.queue;if(v===null)throw Error(a(311));v.lastRenderedReducer=c;var x=n.baseQueue,w=v.pending;if(w!==null){if(x!==null){var O=x.next;x.next=w.next,w.next=O}l.baseQueue=x=w,v.pending=null}if(w=n.baseState,x===null)n.memoizedState=w;else{l=x.next;var V=O=null,te=null,fe=l,be=!1;do{var Te=fe.lane&-536870913;if(Te!==fe.lane?(pt&Te)===Te:(An&Te)===Te){var he=fe.revertLane;if(he===0)te!==null&&(te=te.next={lane:0,revertLane:0,gesture:null,action:fe.action,hasEagerState:fe.hasEagerState,eagerState:fe.eagerState,next:null}),Te===bl&&(be=!0);else if((An&he)===he){fe=fe.next,he===bl&&(be=!0);continue}else Te={lane:0,revertLane:fe.revertLane,gesture:null,action:fe.action,hasEagerState:fe.hasEagerState,eagerState:fe.eagerState,next:null},te===null?(V=te=Te,O=w):te=te.next=Te,lt.lanes|=he,vi|=he;Te=fe.action,Es&&c(w,Te),w=fe.hasEagerState?fe.eagerState:c(w,Te)}else he={lane:Te,revertLane:fe.revertLane,gesture:fe.gesture,action:fe.action,hasEagerState:fe.hasEagerState,eagerState:fe.eagerState,next:null},te===null?(V=te=he,O=w):te=te.next=he,lt.lanes|=Te,vi|=Te;fe=fe.next}while(fe!==null&&fe!==l);if(te===null?O=w:te.next=V,!ma(w,n.memoizedState)&&(dr=!0,be&&(c=wl,c!==null)))throw c;n.memoizedState=w,n.baseState=O,n.baseQueue=te,v.lastRenderedState=w}return x===null&&(v.lanes=0),[n.memoizedState,v.dispatch]}function vv(n){var l=lr(),c=l.queue;if(c===null)throw Error(a(311));c.lastRenderedReducer=n;var v=c.dispatch,x=c.pending,w=l.memoizedState;if(x!==null){c.pending=null;var O=x=x.next;do w=n(w,O.action),O=O.next;while(O!==x);ma(w,l.memoizedState)||(dr=!0),l.memoizedState=w,l.baseQueue===null&&(l.baseState=w),c.lastRenderedState=w}return[w,v]}function nx(n,l,c){var v=lt,x=lr(),w=mt;if(w){if(c===void 0)throw Error(a(407));c=c()}else c=l();var O=!ma((kt||x).memoizedState,c);if(O&&(x.memoizedState=c,dr=!0),x=x.queue,mv(lx.bind(null,v,x,n),[n]),x.getSnapshot!==l||O||fr!==null&&fr.memoizedState.tag&1){if(v.flags|=2048,Al(9,{destroy:void 0},sx.bind(null,v,x,c,l),null),_t===null)throw Error(a(349));w||(An&127)!==0||ix(v,l,c)}return c}function ix(n,l,c){n.flags|=16384,n={getSnapshot:l,value:c},l=lt.updateQueue,l===null?(l=nf(),lt.updateQueue=l,l.stores=[n]):(c=l.stores,c===null?l.stores=[n]:c.push(n))}function sx(n,l,c,v){l.value=c,l.getSnapshot=v,ox(l)&&ux(n)}function lx(n,l,c){return c(function(){ox(l)&&ux(n)})}function ox(n){var l=n.getSnapshot;n=n.value;try{var c=l();return!ma(n,c)}catch{return!0}}function ux(n){var l=vs(n,2);l!==null&&ca(l,n,2)}function pv(n){var l=Zr();if(typeof n=="function"){var c=n;if(n=c(),Es){ge(!0);try{c()}finally{ge(!1)}}}return l.memoizedState=l.baseState=n,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:jn,lastRenderedState:n},l}function cx(n,l,c,v){return n.baseState=c,hv(n,kt,typeof v=="function"?v:jn)}function S5(n,l,c,v,x){if(cf(n))throw Error(a(485));if(n=l.action,n!==null){var w={payload:x,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(O){w.listeners.push(O)}};U.T!==null?c(!0):w.isTransition=!1,v(w),c=l.pending,c===null?(w.next=l.pending=w,fx(l,w)):(w.next=c.next,l.pending=c.next=w)}}function fx(n,l){var c=l.action,v=l.payload,x=n.state;if(l.isTransition){var w=U.T,O={};U.T=O;try{var V=c(x,v),te=U.S;te!==null&&te(O,V),dx(n,l,V)}catch(fe){gv(n,l,fe)}finally{w!==null&&O.types!==null&&(w.types=O.types),U.T=w}}else try{w=c(x,v),dx(n,l,w)}catch(fe){gv(n,l,fe)}}function dx(n,l,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(v){hx(n,l,v)},function(v){return gv(n,l,v)}):hx(n,l,c)}function hx(n,l,c){l.status="fulfilled",l.value=c,vx(l),n.state=c,l=n.pending,l!==null&&(c=l.next,c===l?n.pending=null:(c=c.next,l.next=c,fx(n,c)))}function gv(n,l,c){var v=n.pending;if(n.pending=null,v!==null){v=v.next;do l.status="rejected",l.reason=c,vx(l),l=l.next;while(l!==v)}n.action=null}function vx(n){n=n.listeners;for(var l=0;l<n.length;l++)(0,n[l])()}function px(n,l){return l}function gx(n,l){if(mt){var c=_t.formState;if(c!==null){e:{var v=lt;if(mt){if(It){t:{for(var x=It,w=za;x.nodeType!==8;){if(!w){x=null;break t}if(x=Pa(x.nextSibling),x===null){x=null;break t}}w=x.data,x=w==="F!"||w==="F"?x:null}if(x){It=Pa(x.nextSibling),v=x.data==="F!";break e}}ii(v)}v=!1}v&&(l=c[0])}}return c=Zr(),c.memoizedState=c.baseState=l,v={pending:null,lanes:0,dispatch:null,lastRenderedReducer:px,lastRenderedState:l},c.queue=v,c=Lx.bind(null,lt,v),v.dispatch=c,v=pv(!1),w=Sv.bind(null,lt,!1,v.queue),v=Zr(),x={state:l,dispatch:null,action:n,pending:null},v.queue=x,c=S5.bind(null,lt,x,w,c),x.dispatch=c,v.memoizedState=n,[l,c,!1]}function mx(n){var l=lr();return yx(l,kt,n)}function yx(n,l,c){if(l=hv(n,l,px)[0],n=lf(jn)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var v=ru(l)}catch(O){throw O===Sl?$c:O}else v=l;l=lr();var x=l.queue,w=x.dispatch;return c!==l.memoizedState&&(lt.flags|=2048,Al(9,{destroy:void 0},E5.bind(null,x,c),null)),[v,w,n]}function E5(n,l){n.action=l}function xx(n){var l=lr(),c=kt;if(c!==null)return yx(l,c,n);lr(),l=l.memoizedState,c=lr();var v=c.queue.dispatch;return c.memoizedState=n,[l,v,!1]}function Al(n,l,c,v){return n={tag:n,create:c,deps:v,inst:l,next:null},l=lt.updateQueue,l===null&&(l=nf(),lt.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 bx(){return lr().memoizedState}function of(n,l,c,v){var x=Zr();lt.flags|=n,x.memoizedState=Al(1|l,{destroy:void 0},c,v===void 0?null:v)}function uf(n,l,c,v){var x=lr();v=v===void 0?null:v;var w=x.memoizedState.inst;kt!==null&&v!==null&&lv(v,kt.memoizedState.deps)?x.memoizedState=Al(l,w,c,v):(lt.flags|=n,x.memoizedState=Al(1|l,w,c,v))}function wx(n,l){of(8390656,8,n,l)}function mv(n,l){uf(2048,8,n,l)}function T5(n){lt.flags|=4;var l=lt.updateQueue;if(l===null)l=nf(),lt.updateQueue=l,l.events=[n];else{var c=l.events;c===null?l.events=[n]:c.push(n)}}function Sx(n){var l=lr().memoizedState;return T5({ref:l,nextImpl:n}),function(){if((Ct&2)!==0)throw Error(a(440));return l.impl.apply(void 0,arguments)}}function Ex(n,l){return uf(4,2,n,l)}function Tx(n,l){return uf(4,4,n,l)}function Cx(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 Nx(n,l,c){c=c!=null?c.concat([n]):null,uf(4,4,Cx.bind(null,l,n),c)}function yv(){}function Ax(n,l){var c=lr();l=l===void 0?null:l;var v=c.memoizedState;return l!==null&&lv(l,v[1])?v[0]:(c.memoizedState=[n,l],n)}function jx(n,l){var c=lr();l=l===void 0?null:l;var v=c.memoizedState;if(l!==null&&lv(l,v[1]))return v[0];if(v=n(),Es){ge(!0);try{n()}finally{ge(!1)}}return c.memoizedState=[v,l],v}function xv(n,l,c){return c===void 0||(An&1073741824)!==0&&(pt&261930)===0?n.memoizedState=l:(n.memoizedState=c,n=Db(),lt.lanes|=n,vi|=n,c)}function Dx(n,l,c,v){return ma(c,l)?c:Tl.current!==null?(n=xv(n,c,v),ma(n,l)||(dr=!0),n):(An&42)===0||(An&1073741824)!==0&&(pt&261930)===0?(dr=!0,n.memoizedState=c):(n=Db(),lt.lanes|=n,vi|=n,l)}function Ox(n,l,c,v,x){var w=z.p;z.p=w!==0&&8>w?w:8;var O=U.T,V={};U.T=V,Sv(n,!1,l,c);try{var te=x(),fe=U.S;if(fe!==null&&fe(V,te),te!==null&&typeof te=="object"&&typeof te.then=="function"){var be=x5(te,v);au(n,l,be,Ea(n))}else au(n,l,v,Ea(n))}catch(Te){au(n,l,{then:function(){},status:"rejected",reason:Te},Ea())}finally{z.p=w,O!==null&&V.types!==null&&(O.types=V.types),U.T=O}}function C5(){}function bv(n,l,c,v){if(n.tag!==5)throw Error(a(476));var x=Mx(n).queue;Ox(n,x,l,H,c===null?C5:function(){return Rx(n),c(v)})}function Mx(n){var l=n.memoizedState;if(l!==null)return l;l={memoizedState:H,baseState:H,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jn,lastRenderedState:H},next:null};var c={};return l.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jn,lastRenderedState:c},next:null},n.memoizedState=l,n=n.alternate,n!==null&&(n.memoizedState=l),l}function Rx(n){var l=Mx(n);l.next===null&&(l=n.alternate.memoizedState),au(n,l.next.queue,{},Ea())}function wv(){return Lr(bu)}function kx(){return lr().memoizedState}function Bx(){return lr().memoizedState}function N5(n){for(var l=n.return;l!==null;){switch(l.tag){case 24:case 3:var c=Ea();n=oi(c);var v=ui(l,n,c);v!==null&&(ca(v,l,c),Wo(v,l,c)),l={cache:$h()},n.payload=l;return}l=l.return}}function A5(n,l,c){var v=Ea();c={lane:v,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},cf(n)?zx(l,c):(c=Uh(n,l,c,v),c!==null&&(ca(c,n,v),_x(c,l,v)))}function Lx(n,l,c){var v=Ea();au(n,l,c,v)}function au(n,l,c,v){var x={lane:v,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(cf(n))zx(l,x);else{var w=n.alternate;if(n.lanes===0&&(w===null||w.lanes===0)&&(w=l.lastRenderedReducer,w!==null))try{var O=l.lastRenderedState,V=w(O,c);if(x.hasEagerState=!0,x.eagerState=V,ma(V,O))return Fc(n,l,x,0),_t===null&&Vc(),!1}catch{}finally{}if(c=Uh(n,l,x,v),c!==null)return ca(c,n,v),_x(c,l,v),!0}return!1}function Sv(n,l,c,v){if(v={lane:2,revertLane:ep(),gesture:null,action:v,hasEagerState:!1,eagerState:null,next:null},cf(n)){if(l)throw Error(a(479))}else l=Uh(n,c,v,2),l!==null&&ca(l,n,2)}function cf(n){var l=n.alternate;return n===lt||l!==null&&l===lt}function zx(n,l){Cl=rf=!0;var c=n.pending;c===null?l.next=l:(l.next=c.next,c.next=l),n.pending=l}function _x(n,l,c){if((c&4194048)!==0){var v=l.lanes;v&=n.pendingLanes,c|=v,l.lanes=c,nr(n,c)}}var nu={readContext:Lr,use:sf,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};nu.useEffectEvent=Jt;var Px={readContext:Lr,use:sf,useCallback:function(n,l){return Zr().memoizedState=[n,l===void 0?null:l],n},useContext:Lr,useEffect:wx,useImperativeHandle:function(n,l,c){c=c!=null?c.concat([n]):null,of(4194308,4,Cx.bind(null,l,n),c)},useLayoutEffect:function(n,l){return of(4194308,4,n,l)},useInsertionEffect:function(n,l){of(4,2,n,l)},useMemo:function(n,l){var c=Zr();l=l===void 0?null:l;var v=n();if(Es){ge(!0);try{n()}finally{ge(!1)}}return c.memoizedState=[v,l],v},useReducer:function(n,l,c){var v=Zr();if(c!==void 0){var x=c(l);if(Es){ge(!0);try{c(l)}finally{ge(!1)}}}else x=l;return v.memoizedState=v.baseState=x,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:x},v.queue=n,n=n.dispatch=A5.bind(null,lt,n),[v.memoizedState,n]},useRef:function(n){var l=Zr();return n={current:n},l.memoizedState=n},useState:function(n){n=pv(n);var l=n.queue,c=Lx.bind(null,lt,l);return l.dispatch=c,[n.memoizedState,c]},useDebugValue:yv,useDeferredValue:function(n,l){var c=Zr();return xv(c,n,l)},useTransition:function(){var n=pv(!1);return n=Ox.bind(null,lt,n.queue,!0,!1),Zr().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,l,c){var v=lt,x=Zr();if(mt){if(c===void 0)throw Error(a(407));c=c()}else{if(c=l(),_t===null)throw Error(a(349));(pt&127)!==0||ix(v,l,c)}x.memoizedState=c;var w={value:c,getSnapshot:l};return x.queue=w,wx(lx.bind(null,v,w,n),[n]),v.flags|=2048,Al(9,{destroy:void 0},sx.bind(null,v,w,c,l),null),c},useId:function(){var n=Zr(),l=_t.identifierPrefix;if(mt){var c=sn,v=nn;c=(v&~(1<<32-pe(v)-1)).toString(32)+c,l="_"+l+"R_"+c,c=af++,0<c&&(l+="H"+c.toString(32)),l+="_"}else c=b5++,l="_"+l+"r_"+c.toString(32)+"_";return n.memoizedState=l},useHostTransitionStatus:wv,useFormState:gx,useActionState:gx,useOptimistic:function(n){var l=Zr();l.memoizedState=l.baseState=n;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=c,l=Sv.bind(null,lt,!0,c),c.dispatch=l,[n,l]},useMemoCache:dv,useCacheRefresh:function(){return Zr().memoizedState=N5.bind(null,lt)},useEffectEvent:function(n){var l=Zr(),c={impl:n};return l.memoizedState=c,function(){if((Ct&2)!==0)throw Error(a(440));return c.impl.apply(void 0,arguments)}}},Ev={readContext:Lr,use:sf,useCallback:Ax,useContext:Lr,useEffect:mv,useImperativeHandle:Nx,useInsertionEffect:Ex,useLayoutEffect:Tx,useMemo:jx,useReducer:lf,useRef:bx,useState:function(){return lf(jn)},useDebugValue:yv,useDeferredValue:function(n,l){var c=lr();return Dx(c,kt.memoizedState,n,l)},useTransition:function(){var n=lf(jn)[0],l=lr().memoizedState;return[typeof n=="boolean"?n:ru(n),l]},useSyncExternalStore:nx,useId:kx,useHostTransitionStatus:wv,useFormState:mx,useActionState:mx,useOptimistic:function(n,l){var c=lr();return cx(c,kt,n,l)},useMemoCache:dv,useCacheRefresh:Bx};Ev.useEffectEvent=Sx;var Ux={readContext:Lr,use:sf,useCallback:Ax,useContext:Lr,useEffect:mv,useImperativeHandle:Nx,useInsertionEffect:Ex,useLayoutEffect:Tx,useMemo:jx,useReducer:vv,useRef:bx,useState:function(){return vv(jn)},useDebugValue:yv,useDeferredValue:function(n,l){var c=lr();return kt===null?xv(c,n,l):Dx(c,kt.memoizedState,n,l)},useTransition:function(){var n=vv(jn)[0],l=lr().memoizedState;return[typeof n=="boolean"?n:ru(n),l]},useSyncExternalStore:nx,useId:kx,useHostTransitionStatus:wv,useFormState:xx,useActionState:xx,useOptimistic:function(n,l){var c=lr();return kt!==null?cx(c,kt,n,l):(c.baseState=n,[n,c.queue.dispatch])},useMemoCache:dv,useCacheRefresh:Bx};Ux.useEffectEvent=Sx;function Tv(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 Cv={enqueueSetState:function(n,l,c){n=n._reactInternals;var v=Ea(),x=oi(v);x.payload=l,c!=null&&(x.callback=c),l=ui(n,x,v),l!==null&&(ca(l,n,v),Wo(l,n,v))},enqueueReplaceState:function(n,l,c){n=n._reactInternals;var v=Ea(),x=oi(v);x.tag=1,x.payload=l,c!=null&&(x.callback=c),l=ui(n,x,v),l!==null&&(ca(l,n,v),Wo(l,n,v))},enqueueForceUpdate:function(n,l){n=n._reactInternals;var c=Ea(),v=oi(c);v.tag=2,l!=null&&(v.callback=l),l=ui(n,v,c),l!==null&&(ca(l,n,c),Wo(l,n,c))}};function qx(n,l,c,v,x,w,O){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(v,w,O):l.prototype&&l.prototype.isPureReactComponent?!Ho(c,v)||!Ho(x,w):!0}function Ix(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&&Cv.enqueueReplaceState(l,l.state,null)}function Ts(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 x in n)c[x]===void 0&&(c[x]=n[x])}return c}function Vx(n){Ic(n)}function Fx(n){console.error(n)}function Hx(n){Ic(n)}function ff(n,l){try{var c=n.onUncaughtError;c(l.value,{componentStack:l.stack})}catch(v){setTimeout(function(){throw v})}}function Gx(n,l,c){try{var v=n.onCaughtError;v(c.value,{componentStack:c.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(x){setTimeout(function(){throw x})}}function Nv(n,l,c){return c=oi(c),c.tag=3,c.payload={element:null},c.callback=function(){ff(n,l)},c}function Qx(n){return n=oi(n),n.tag=3,n}function Yx(n,l,c,v){var x=c.type.getDerivedStateFromError;if(typeof x=="function"){var w=v.value;n.payload=function(){return x(w)},n.callback=function(){Gx(l,c,v)}}var O=c.stateNode;O!==null&&typeof O.componentDidCatch=="function"&&(n.callback=function(){Gx(l,c,v),typeof x!="function"&&(pi===null?pi=new Set([this]):pi.add(this));var V=v.stack;this.componentDidCatch(v.value,{componentStack:V!==null?V:""})})}function j5(n,l,c,v,x){if(c.flags|=32768,v!==null&&typeof v=="object"&&typeof v.then=="function"){if(l=c.alternate,l!==null&&xl(l,c,x,!0),c=xa.current,c!==null){switch(c.tag){case 31:case 13:return _a===null?Ef():c.alternate===null&&er===0&&(er=3),c.flags&=-257,c.flags|=65536,c.lanes=x,v===Zc?c.flags|=16384:(l=c.updateQueue,l===null?c.updateQueue=new Set([v]):l.add(v),Zv(n,v,x)),!1;case 22:return c.flags|=65536,v===Zc?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)),Zv(n,v,x)),!1}throw Error(a(435,c.tag))}return Zv(n,v,x),Ef(),!1}if(mt)return l=xa.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=x,v!==Gh&&(n=Error(a(422),{cause:v}),Yo(ka(n,c)))):(v!==Gh&&(l=Error(a(423),{cause:v}),Yo(ka(l,c))),n=n.current.alternate,n.flags|=65536,x&=-x,n.lanes|=x,v=ka(v,c),x=Nv(n.stateNode,v,x),rv(n,x),er!==4&&(er=2)),!1;var w=Error(a(520),{cause:v});if(w=ka(w,c),du===null?du=[w]:du.push(w),er!==4&&(er=2),l===null)return!0;v=ka(v,c),c=l;do{switch(c.tag){case 3:return c.flags|=65536,n=x&-x,c.lanes|=n,n=Nv(c.stateNode,v,n),rv(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"&&(pi===null||!pi.has(w))))return c.flags|=65536,x&=-x,c.lanes|=x,x=Qx(x),Yx(x,n,c,v),rv(c,x),!1}c=c.return}while(c!==null);return!1}var Av=Error(a(461)),dr=!1;function zr(n,l,c,v){l.child=n===null?Zy(l,null,c,v):Ss(l,n.child,c,v)}function Kx(n,l,c,v,x){c=c.render;var w=l.ref;if("ref"in v){var O={};for(var V in v)V!=="ref"&&(O[V]=v[V])}else O=v;return ys(l),v=ov(n,l,c,O,w,x),V=uv(),n!==null&&!dr?(cv(n,l,x),Dn(n,l,x)):(mt&&V&&Fh(l),l.flags|=1,zr(n,l,v,x),l.child)}function Xx(n,l,c,v,x){if(n===null){var w=c.type;return typeof w=="function"&&!qh(w)&&w.defaultProps===void 0&&c.compare===null?(l.tag=15,l.type=w,$x(n,l,w,v,x)):(n=Gc(c.type,null,v,l,l.mode,x),n.ref=l.ref,n.return=l,l.child=n)}if(w=n.child,!Lv(n,x)){var O=w.memoizedProps;if(c=c.compare,c=c!==null?c:Ho,c(O,v)&&n.ref===l.ref)return Dn(n,l,x)}return l.flags|=1,n=En(w,v),n.ref=l.ref,n.return=l,l.child=n}function $x(n,l,c,v,x){if(n!==null){var w=n.memoizedProps;if(Ho(w,v)&&n.ref===l.ref)if(dr=!1,l.pendingProps=v=w,Lv(n,x))(n.flags&131072)!==0&&(dr=!0);else return l.lanes=n.lanes,Dn(n,l,x)}return jv(n,l,c,v,x)}function Zx(n,l,c,v){var x=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,x=0;v!==null;)x=x|v.lanes|v.childLanes,v=v.sibling;v=x&~w}else v=0,l.child=null;return Wx(n,l,w,c,v)}if((c&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},n!==null&&Xc(l,w!==null?w.cachePool:null),w!==null?ex(l,w):nv(),tx(l);else return v=l.lanes=536870912,Wx(n,l,w!==null?w.baseLanes|c:c,c,v)}else w!==null?(Xc(l,w.cachePool),ex(l,w),fi(),l.memoizedState=null):(n!==null&&Xc(l,null),nv(),fi());return zr(n,l,x,c),l.child}function iu(n,l){return n!==null&&n.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function Wx(n,l,c,v,x){var w=Wh();return w=w===null?null:{parent:cr._currentValue,pool:w},l.memoizedState={baseLanes:c,cachePool:w},n!==null&&Xc(l,null),nv(),tx(l),n!==null&&xl(n,l,v,!0),l.childLanes=x,null}function df(n,l){return l=vf({mode:l.mode,children:l.children},n.mode),l.ref=n.ref,n.child=l,l.return=n,l}function Jx(n,l,c){return Ss(l,n.child,null,c),n=df(l,l.pendingProps),n.flags|=2,ba(l),l.memoizedState=null,n}function D5(n,l,c){var v=l.pendingProps,x=(l.flags&128)!==0;if(l.flags&=-129,n===null){if(mt){if(v.mode==="hidden")return n=df(l,v),l.lanes=536870912,iu(null,n);if(sv(l),(n=It)?(n=f1(n,za),n=n!==null&&n.data==="&"?n:null,n!==null&&(l.memoizedState={dehydrated:n,treeContext:ai!==null?{id:nn,overflow:sn}:null,retryLane:536870912,hydrationErrors:null},c=zy(n),c.return=l,l.child=c,Br=l,It=null)):n=null,n===null)throw ii(l);return l.lanes=536870912,null}return df(l,v)}var w=n.memoizedState;if(w!==null){var O=w.dehydrated;if(sv(l),x)if(l.flags&256)l.flags&=-257,l=Jx(n,l,c);else if(l.memoizedState!==null)l.child=n.child,l.flags|=128,l=null;else throw Error(a(558));else if(dr||xl(n,l,c,!1),x=(c&n.childLanes)!==0,dr||x){if(v=_t,v!==null&&(O=Wt(v,c),O!==0&&O!==w.retryLane))throw w.retryLane=O,vs(n,O),ca(v,n,O),Av;Ef(),l=Jx(n,l,c)}else n=w.treeContext,It=Pa(O.nextSibling),Br=l,mt=!0,ni=null,za=!1,n!==null&&Uy(l,n),l=df(l,v),l.flags|=4096;return l}return n=En(n.child,{mode:v.mode,children:v.children}),n.ref=l.ref,l.child=n,n.return=l,n}function hf(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(a(284));(n===null||n.ref!==c)&&(l.flags|=4194816)}}function jv(n,l,c,v,x){return ys(l),c=ov(n,l,c,v,void 0,x),v=uv(),n!==null&&!dr?(cv(n,l,x),Dn(n,l,x)):(mt&&v&&Fh(l),l.flags|=1,zr(n,l,c,x),l.child)}function eb(n,l,c,v,x,w){return ys(l),l.updateQueue=null,c=ax(l,v,c,x),rx(n),v=uv(),n!==null&&!dr?(cv(n,l,w),Dn(n,l,w)):(mt&&v&&Fh(l),l.flags|=1,zr(n,l,c,w),l.child)}function tb(n,l,c,v,x){if(ys(l),l.stateNode===null){var w=pl,O=c.contextType;typeof O=="object"&&O!==null&&(w=Lr(O)),w=new c(v,w),l.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,w.updater=Cv,l.stateNode=w,w._reactInternals=l,w=l.stateNode,w.props=v,w.state=l.memoizedState,w.refs={},ev(l),O=c.contextType,w.context=typeof O=="object"&&O!==null?Lr(O):pl,w.state=l.memoizedState,O=c.getDerivedStateFromProps,typeof O=="function"&&(Tv(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&&Cv.enqueueReplaceState(w,w.state,null),eu(l,v,w,x),Jo(),w.state=l.memoizedState),typeof w.componentDidMount=="function"&&(l.flags|=4194308),v=!0}else if(n===null){w=l.stateNode;var V=l.memoizedProps,te=Ts(c,V);w.props=te;var fe=w.context,be=c.contextType;O=pl,typeof be=="object"&&be!==null&&(O=Lr(be));var Te=c.getDerivedStateFromProps;be=typeof Te=="function"||typeof w.getSnapshotBeforeUpdate=="function",V=l.pendingProps!==V,be||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(V||fe!==O)&&Ix(l,w,v,O),li=!1;var he=l.memoizedState;w.state=he,eu(l,v,w,x),Jo(),fe=l.memoizedState,V||he!==fe||li?(typeof Te=="function"&&(Tv(l,c,Te,v),fe=l.memoizedState),(te=li||qx(l,c,te,v,he,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,tv(n,l),O=l.memoizedProps,be=Ts(c,O),w.props=be,Te=l.pendingProps,he=w.context,fe=c.contextType,te=pl,typeof fe=="object"&&fe!==null&&(te=Lr(fe)),V=c.getDerivedStateFromProps,(fe=typeof V=="function"||typeof w.getSnapshotBeforeUpdate=="function")||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(O!==Te||he!==te)&&Ix(l,w,v,te),li=!1,he=l.memoizedState,w.state=he,eu(l,v,w,x),Jo();var me=l.memoizedState;O!==Te||he!==me||li||n!==null&&n.dependencies!==null&&Yc(n.dependencies)?(typeof V=="function"&&(Tv(l,c,V,v),me=l.memoizedState),(be=li||qx(l,c,be,v,he,me,te)||n!==null&&n.dependencies!==null&&Yc(n.dependencies))?(fe||typeof w.UNSAFE_componentWillUpdate!="function"&&typeof w.componentWillUpdate!="function"||(typeof w.componentWillUpdate=="function"&&w.componentWillUpdate(v,me,te),typeof w.UNSAFE_componentWillUpdate=="function"&&w.UNSAFE_componentWillUpdate(v,me,te)),typeof w.componentDidUpdate=="function"&&(l.flags|=4),typeof w.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof w.componentDidUpdate!="function"||O===n.memoizedProps&&he===n.memoizedState||(l.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||O===n.memoizedProps&&he===n.memoizedState||(l.flags|=1024),l.memoizedProps=v,l.memoizedState=me),w.props=v,w.state=me,w.context=te,v=be):(typeof w.componentDidUpdate!="function"||O===n.memoizedProps&&he===n.memoizedState||(l.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||O===n.memoizedProps&&he===n.memoizedState||(l.flags|=1024),v=!1)}return w=v,hf(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=Ss(l,n.child,null,x),l.child=Ss(l,null,c,x)):zr(n,l,c,x),l.memoizedState=w.state,n=l.child):n=Dn(n,l,x),n}function rb(n,l,c,v){return gs(),l.flags|=256,zr(n,l,c,v),l.child}var Dv={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Ov(n){return{baseLanes:n,cachePool:Gy()}}function Mv(n,l,c){return n=n!==null?n.childLanes&~c:0,l&&(n|=Sa),n}function ab(n,l,c){var v=l.pendingProps,x=!1,w=(l.flags&128)!==0,O;if((O=w)||(O=n!==null&&n.memoizedState===null?!1:(sr.current&2)!==0),O&&(x=!0,l.flags&=-129),O=(l.flags&32)!==0,l.flags&=-33,n===null){if(mt){if(x?ci(l):fi(),(n=It)?(n=f1(n,za),n=n!==null&&n.data!=="&"?n:null,n!==null&&(l.memoizedState={dehydrated:n,treeContext:ai!==null?{id:nn,overflow:sn}:null,retryLane:536870912,hydrationErrors:null},c=zy(n),c.return=l,l.child=c,Br=l,It=null)):n=null,n===null)throw ii(l);return hp(n)?l.lanes=32:l.lanes=536870912,null}var V=v.children;return v=v.fallback,x?(fi(),x=l.mode,V=vf({mode:"hidden",children:V},x),v=ps(v,x,c,null),V.return=l,v.return=l,V.sibling=v,l.child=V,v=l.child,v.memoizedState=Ov(c),v.childLanes=Mv(n,O,c),l.memoizedState=Dv,iu(null,v)):(ci(l),Rv(l,V))}var te=n.memoizedState;if(te!==null&&(V=te.dehydrated,V!==null)){if(w)l.flags&256?(ci(l),l.flags&=-257,l=kv(n,l,c)):l.memoizedState!==null?(fi(),l.child=n.child,l.flags|=128,l=null):(fi(),V=v.fallback,x=l.mode,v=vf({mode:"visible",children:v.children},x),V=ps(V,x,c,null),V.flags|=2,v.return=l,V.return=l,v.sibling=V,l.child=v,Ss(l,n.child,null,c),v=l.child,v.memoizedState=Ov(c),v.childLanes=Mv(n,O,c),l.memoizedState=Dv,l=iu(null,v));else if(ci(l),hp(V)){if(O=V.nextSibling&&V.nextSibling.dataset,O)var fe=O.dgst;O=fe,v=Error(a(419)),v.stack="",v.digest=O,Yo({value:v,source:null,stack:null}),l=kv(n,l,c)}else if(dr||xl(n,l,c,!1),O=(c&n.childLanes)!==0,dr||O){if(O=_t,O!==null&&(v=Wt(O,c),v!==0&&v!==te.retryLane))throw te.retryLane=v,vs(n,v),ca(O,n,v),Av;dp(V)||Ef(),l=kv(n,l,c)}else dp(V)?(l.flags|=192,l.child=n.child,l=null):(n=te.treeContext,It=Pa(V.nextSibling),Br=l,mt=!0,ni=null,za=!1,n!==null&&Uy(l,n),l=Rv(l,v.children),l.flags|=4096);return l}return x?(fi(),V=v.fallback,x=l.mode,te=n.child,fe=te.sibling,v=En(te,{mode:"hidden",children:v.children}),v.subtreeFlags=te.subtreeFlags&65011712,fe!==null?V=En(fe,V):(V=ps(V,x,c,null),V.flags|=2),V.return=l,v.return=l,v.sibling=V,l.child=v,iu(null,v),v=l.child,V=n.child.memoizedState,V===null?V=Ov(c):(x=V.cachePool,x!==null?(te=cr._currentValue,x=x.parent!==te?{parent:te,pool:te}:x):x=Gy(),V={baseLanes:V.baseLanes|c,cachePool:x}),v.memoizedState=V,v.childLanes=Mv(n,O,c),l.memoizedState=Dv,iu(n.child,v)):(ci(l),c=n.child,n=c.sibling,c=En(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 Rv(n,l){return l=vf({mode:"visible",children:l},n.mode),l.return=n,n.child=l}function vf(n,l){return n=ya(22,n,null,l),n.lanes=0,n}function kv(n,l,c){return Ss(l,n.child,null,c),n=Rv(l,l.pendingProps.children),n.flags|=2,l.memoizedState=null,n}function nb(n,l,c){n.lanes|=l;var v=n.alternate;v!==null&&(v.lanes|=l),Kh(n.return,l,c)}function Bv(n,l,c,v,x,w){var O=n.memoizedState;O===null?n.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:v,tail:c,tailMode:x,treeForkCount:w}:(O.isBackwards=l,O.rendering=null,O.renderingStartTime=0,O.last=v,O.tail=c,O.tailMode=x,O.treeForkCount=w)}function ib(n,l,c){var v=l.pendingProps,x=v.revealOrder,w=v.tail;v=v.children;var O=sr.current,V=(O&2)!==0;if(V?(O=O&1|2,l.flags|=128):O&=1,$(sr,O),zr(n,l,v,c),v=mt?Qo:0,!V&&n!==null&&(n.flags&128)!==0)e:for(n=l.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&nb(n,c,l);else if(n.tag===19)nb(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(x){case"forwards":for(c=l.child,x=null;c!==null;)n=c.alternate,n!==null&&tf(n)===null&&(x=c),c=c.sibling;c=x,c===null?(x=l.child,l.child=null):(x=c.sibling,c.sibling=null),Bv(l,!1,x,c,w,v);break;case"backwards":case"unstable_legacy-backwards":for(c=null,x=l.child,l.child=null;x!==null;){if(n=x.alternate,n!==null&&tf(n)===null){l.child=x;break}n=x.sibling,x.sibling=c,c=x,x=n}Bv(l,!0,c,null,w,v);break;case"together":Bv(l,!1,null,null,void 0,v);break;default:l.memoizedState=null}return l.child}function Dn(n,l,c){if(n!==null&&(l.dependencies=n.dependencies),vi|=l.lanes,(c&l.childLanes)===0)if(n!==null){if(xl(n,l,c,!1),(c&l.childLanes)===0)return null}else return null;if(n!==null&&l.child!==n.child)throw Error(a(153));if(l.child!==null){for(n=l.child,c=En(n,n.pendingProps),l.child=c,c.return=l;n.sibling!==null;)n=n.sibling,c=c.sibling=En(n,n.pendingProps),c.return=l;c.sibling=null}return l.child}function Lv(n,l){return(n.lanes&l)!==0?!0:(n=n.dependencies,!!(n!==null&&Yc(n)))}function O5(n,l,c){switch(l.tag){case 3:de(l,l.stateNode.containerInfo),si(l,cr,n.memoizedState.cache),gs();break;case 27:case 5:re(l);break;case 4:de(l,l.stateNode.containerInfo);break;case 10:si(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,sv(l),null;break;case 13:var v=l.memoizedState;if(v!==null)return v.dehydrated!==null?(ci(l),l.flags|=128,null):(c&l.child.childLanes)!==0?ab(n,l,c):(ci(l),n=Dn(n,l,c),n!==null?n.sibling:null);ci(l);break;case 19:var x=(n.flags&128)!==0;if(v=(c&l.childLanes)!==0,v||(xl(n,l,c,!1),v=(c&l.childLanes)!==0),x){if(v)return ib(n,l,c);l.flags|=128}if(x=l.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),$(sr,sr.current),v)break;return null;case 22:return l.lanes=0,Zx(n,l,c,l.pendingProps);case 24:si(l,cr,n.memoizedState.cache)}return Dn(n,l,c)}function sb(n,l,c){if(n!==null)if(n.memoizedProps!==l.pendingProps)dr=!0;else{if(!Lv(n,c)&&(l.flags&128)===0)return dr=!1,O5(n,l,c);dr=(n.flags&131072)!==0}else dr=!1,mt&&(l.flags&1048576)!==0&&Py(l,Qo,l.index);switch(l.lanes=0,l.tag){case 16:e:{var v=l.pendingProps;if(n=bs(l.elementType),l.type=n,typeof n=="function")qh(n)?(v=Ts(n,v),l.tag=1,l=tb(null,l,n,v,c)):(l.tag=0,l=jv(null,l,n,v,c));else{if(n!=null){var x=n.$$typeof;if(x===j){l.tag=11,l=Kx(null,l,n,v,c);break e}else if(x===A){l.tag=14,l=Xx(null,l,n,v,c);break e}}throw l=F(n)||n,Error(a(306,l,""))}}return l;case 0:return jv(n,l,l.type,l.pendingProps,c);case 1:return v=l.type,x=Ts(v,l.pendingProps),tb(n,l,v,x,c);case 3:e:{if(de(l,l.stateNode.containerInfo),n===null)throw Error(a(387));v=l.pendingProps;var w=l.memoizedState;x=w.element,tv(n,l),eu(l,v,null,c);var O=l.memoizedState;if(v=O.cache,si(l,cr,v),v!==w.cache&&Xh(l,[cr],c,!0),Jo(),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=rb(n,l,v,c);break e}else if(v!==x){x=ka(Error(a(424)),l),Yo(x),l=rb(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=Pa(n.firstChild),Br=l,mt=!0,ni=null,za=!0,c=Zy(l,null,v,c),l.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(gs(),v===x){l=Dn(n,l,c);break e}zr(n,l,v,c)}l=l.child}return l;case 26:return hf(n,l),n===null?(c=m1(l.type,null,l.pendingProps,null))?l.memoizedState=c:mt||(c=l.type,n=l.pendingProps,v=Of(ee.current).createElement(c),v[Ht]=l,v[mr]=n,_r(v,c,n),ur(v),l.stateNode=v):l.memoizedState=m1(l.type,n.memoizedProps,l.pendingProps,n.memoizedState),null;case 27:return re(l),n===null&&mt&&(v=l.stateNode=v1(l.type,l.pendingProps,ee.current),Br=l,za=!0,x=It,xi(l.type)?(vp=x,It=Pa(v.firstChild)):It=x),zr(n,l,l.pendingProps.children,c),hf(n,l),n===null&&(l.flags|=4194304),l.child;case 5:return n===null&&mt&&((x=v=It)&&(v=sA(v,l.type,l.pendingProps,za),v!==null?(l.stateNode=v,Br=l,It=Pa(v.firstChild),za=!1,x=!0):x=!1),x||ii(l)),re(l),x=l.type,w=l.pendingProps,O=n!==null?n.memoizedProps:null,v=w.children,up(x,w)?v=null:O!==null&&up(x,O)&&(l.flags|=32),l.memoizedState!==null&&(x=ov(n,l,w5,null,null,c),bu._currentValue=x),hf(n,l),zr(n,l,v,c),l.child;case 6:return n===null&&mt&&((n=c=It)&&(c=lA(c,l.pendingProps,za),c!==null?(l.stateNode=c,Br=l,It=null,n=!0):n=!1),n||ii(l)),null;case 13:return ab(n,l,c);case 4:return de(l,l.stateNode.containerInfo),v=l.pendingProps,n===null?l.child=Ss(l,null,v,c):zr(n,l,v,c),l.child;case 11:return Kx(n,l,l.type,l.pendingProps,c);case 7:return zr(n,l,l.pendingProps,c),l.child;case 8:return zr(n,l,l.pendingProps.children,c),l.child;case 12:return zr(n,l,l.pendingProps.children,c),l.child;case 10:return v=l.pendingProps,si(l,l.type,v.value),zr(n,l,v.children,c),l.child;case 9:return x=l.type._context,v=l.pendingProps.children,ys(l),x=Lr(x),v=v(x),l.flags|=1,zr(n,l,v,c),l.child;case 14:return Xx(n,l,l.type,l.pendingProps,c);case 15:return $x(n,l,l.type,l.pendingProps,c);case 19:return ib(n,l,c);case 31:return D5(n,l,c);case 22:return Zx(n,l,c,l.pendingProps);case 24:return ys(l),v=Lr(cr),n===null?(x=Wh(),x===null&&(x=_t,w=$h(),x.pooledCache=w,w.refCount++,w!==null&&(x.pooledCacheLanes|=c),x=w),l.memoizedState={parent:v,cache:x},ev(l),si(l,cr,x)):((n.lanes&c)!==0&&(tv(n,l),eu(l,null,null,c),Jo()),x=n.memoizedState,w=l.memoizedState,x.parent!==v?(x={parent:v,cache:v},l.memoizedState=x,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=x),si(l,cr,v)):(v=w.cache,si(l,cr,v),v!==x.cache&&Xh(l,[cr],c,!0))),zr(n,l,l.pendingProps.children,c),l.child;case 29:throw l.pendingProps}throw Error(a(156,l.tag))}function On(n){n.flags|=4}function zv(n,l,c,v,x){if((l=(n.mode&32)!==0)&&(l=!1),l){if(n.flags|=16777216,(x&335544128)===x)if(n.stateNode.complete)n.flags|=8192;else if(kb())n.flags|=8192;else throw ws=Zc,Jh}else n.flags&=-16777217}function lb(n,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!S1(l))if(kb())n.flags|=8192;else throw ws=Zc,Jh}function pf(n,l){l!==null&&(n.flags|=4),n.flags&16384&&(l=n.tag!==22?ot():536870912,n.lanes|=l,Ml|=l)}function su(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 x=n.child;x!==null;)c|=x.lanes|x.childLanes,v|=x.subtreeFlags&65011712,v|=x.flags&65011712,x.return=n,x=x.sibling;else for(x=n.child;x!==null;)c|=x.lanes|x.childLanes,v|=x.subtreeFlags,v|=x.flags,x.return=n,x=x.sibling;return n.subtreeFlags|=v,n.childLanes=c,l}function M5(n,l,c){var v=l.pendingProps;switch(Hh(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),Nn(cr),le(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(n===null||n.child===null)&&(yl(l)?On(l):n===null||n.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,Qh())),Vt(l),null;case 26:var x=l.type,w=l.memoizedState;return n===null?(On(l),w!==null?(Vt(l),lb(l,w)):(Vt(l),zv(l,x,null,v,c))):w?w!==n.memoizedState?(On(l),Vt(l),lb(l,w)):(Vt(l),l.flags&=-16777217):(n=n.memoizedProps,n!==v&&On(l),Vt(l),zv(l,x,n,v,c)),null;case 27:if(Z(l),c=ee.current,x=l.type,n!==null&&l.stateNode!=null)n.memoizedProps!==v&&On(l);else{if(!v){if(l.stateNode===null)throw Error(a(166));return Vt(l),null}n=J.current,yl(l)?qy(l):(n=v1(x,v,c),l.stateNode=n,On(l))}return Vt(l),null;case 5:if(Z(l),x=l.type,n!==null&&l.stateNode!=null)n.memoizedProps!==v&&On(l);else{if(!v){if(l.stateNode===null)throw Error(a(166));return Vt(l),null}if(w=J.current,yl(l))qy(l);else{var O=Of(ee.current);switch(w){case 1:w=O.createElementNS("http://www.w3.org/2000/svg",x);break;case 2:w=O.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;default:switch(x){case"svg":w=O.createElementNS("http://www.w3.org/2000/svg",x);break;case"math":w=O.createElementNS("http://www.w3.org/1998/Math/MathML",x);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(x,{is:v.is}):O.createElement(x)}}w[Ht]=l,w[mr]=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(_r(w,x,v),x){case"button":case"input":case"select":case"textarea":v=!!v.autoFocus;break e;case"img":v=!0;break e;default:v=!1}v&&On(l)}}return Vt(l),zv(l,l.type,n===null?null:n.memoizedProps,l.pendingProps,c),null;case 6:if(n&&l.stateNode!=null)n.memoizedProps!==v&&On(l);else{if(typeof v!="string"&&l.stateNode===null)throw Error(a(166));if(n=ee.current,yl(l)){if(n=l.stateNode,c=l.memoizedProps,v=null,x=Br,x!==null)switch(x.tag){case 27:case 5:v=x.memoizedProps}n[Ht]=l,n=!!(n.nodeValue===c||v!==null&&v.suppressHydrationWarning===!0||a1(n.nodeValue,c)),n||ii(l,!0)}else n=Of(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=yl(l),c!==null){if(n===null){if(!v)throw Error(a(318));if(n=l.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(a(557));n[Ht]=l}else gs(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Vt(l),n=!1}else c=Qh(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=c),n=!0;if(!n)return l.flags&256?(ba(l),l):(ba(l),null);if((l.flags&128)!==0)throw Error(a(558))}return Vt(l),null;case 13:if(v=l.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(x=yl(l),v!==null&&v.dehydrated!==null){if(n===null){if(!x)throw Error(a(318));if(x=l.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(a(317));x[Ht]=l}else gs(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Vt(l),x=!1}else x=Qh(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=x),x=!0;if(!x)return l.flags&256?(ba(l),l):(ba(l),null)}return ba(l),(l.flags&128)!==0?(l.lanes=c,l):(c=v!==null,n=n!==null&&n.memoizedState!==null,c&&(v=l.child,x=null,v.alternate!==null&&v.alternate.memoizedState!==null&&v.alternate.memoizedState.cachePool!==null&&(x=v.alternate.memoizedState.cachePool.pool),w=null,v.memoizedState!==null&&v.memoizedState.cachePool!==null&&(w=v.memoizedState.cachePool.pool),w!==x&&(v.flags|=2048)),c!==n&&c&&(l.child.flags|=8192),pf(l,l.updateQueue),Vt(l),null);case 4:return le(),n===null&&np(l.stateNode.containerInfo),Vt(l),null;case 10:return Nn(l.type),Vt(l),null;case 19:if(G(sr),v=l.memoizedState,v===null)return Vt(l),null;if(x=(l.flags&128)!==0,w=v.rendering,w===null)if(x)su(v,!1);else{if(er!==0||n!==null&&(n.flags&128)!==0)for(n=l.child;n!==null;){if(w=tf(n),w!==null){for(l.flags|=128,su(v,!1),n=w.updateQueue,l.updateQueue=n,pf(l,n),l.subtreeFlags=0,n=c,c=l.child;c!==null;)Ly(c,n),c=c.sibling;return $(sr,sr.current&1|2),mt&&Tn(l,v.treeForkCount),l.child}n=n.sibling}v.tail!==null&&Re()>bf&&(l.flags|=128,x=!0,su(v,!1),l.lanes=4194304)}else{if(!x)if(n=tf(w),n!==null){if(l.flags|=128,x=!0,n=n.updateQueue,l.updateQueue=n,pf(l,n),su(v,!0),v.tail===null&&v.tailMode==="hidden"&&!w.alternate&&!mt)return Vt(l),null}else 2*Re()-v.renderingStartTime>bf&&c!==536870912&&(l.flags|=128,x=!0,su(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=sr.current,$(sr,x?c&1|2:c&1),mt&&Tn(l,v.treeForkCount),n):(Vt(l),null);case 22:case 23:return ba(l),iv(),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&&pf(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(xs),null;case 24:return c=null,n!==null&&(c=n.memoizedState.cache),l.memoizedState.cache!==c&&(l.flags|=2048),Nn(cr),Vt(l),null;case 25:return null;case 30:return null}throw Error(a(156,l.tag))}function R5(n,l){switch(Hh(l),l.tag){case 1:return n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 3:return Nn(cr),le(),n=l.flags,(n&65536)!==0&&(n&128)===0?(l.flags=n&-65537|128,l):null;case 26:case 27:case 5:return Z(l),null;case 31:if(l.memoizedState!==null){if(ba(l),l.alternate===null)throw Error(a(340));gs()}return n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 13:if(ba(l),n=l.memoizedState,n!==null&&n.dehydrated!==null){if(l.alternate===null)throw Error(a(340));gs()}return n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 19:return G(sr),null;case 4:return le(),null;case 10:return Nn(l.type),null;case 22:case 23:return ba(l),iv(),n!==null&&G(xs),n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 24:return Nn(cr),null;case 25:return null;default:return null}}function ob(n,l){switch(Hh(l),l.tag){case 3:Nn(cr),le();break;case 26:case 27:case 5:Z(l);break;case 4:le();break;case 31:l.memoizedState!==null&&ba(l);break;case 13:ba(l);break;case 19:G(sr);break;case 10:Nn(l.type);break;case 22:case 23:ba(l),iv(),n!==null&&G(xs);break;case 24:Nn(cr)}}function lu(n,l){try{var c=l.updateQueue,v=c!==null?c.lastEffect:null;if(v!==null){var x=v.next;c=x;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!==x)}}catch(V){Ot(l,l.return,V)}}function di(n,l,c){try{var v=l.updateQueue,x=v!==null?v.lastEffect:null;if(x!==null){var w=x.next;v=w;do{if((v.tag&n)===n){var O=v.inst,V=O.destroy;if(V!==void 0){O.destroy=void 0,x=l;var te=c,fe=V;try{fe()}catch(be){Ot(x,te,be)}}}v=v.next}while(v!==w)}}catch(be){Ot(l,l.return,be)}}function ub(n){var l=n.updateQueue;if(l!==null){var c=n.stateNode;try{Jy(l,c)}catch(v){Ot(n,n.return,v)}}}function cb(n,l,c){c.props=Ts(n.type,n.memoizedProps),c.state=n.memoizedState;try{c.componentWillUnmount()}catch(v){Ot(n,l,v)}}function ou(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(x){Ot(n,l,x)}}function ln(n,l){var c=n.ref,v=n.refCleanup;if(c!==null)if(typeof v=="function")try{v()}catch(x){Ot(n,l,x)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(x){Ot(n,l,x)}else c.current=null}function fb(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(x){Ot(n,n.return,x)}}function _v(n,l,c){try{var v=n.stateNode;eA(v,n.type,c,l),v[mr]=l}catch(x){Ot(n,n.return,x)}}function db(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&xi(n.type)||n.tag===4}function Pv(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||db(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&&xi(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 Uv(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=wn));else if(v!==4&&(v===27&&xi(n.type)&&(c=n.stateNode,l=null),n=n.child,n!==null))for(Uv(n,l,c),n=n.sibling;n!==null;)Uv(n,l,c),n=n.sibling}function gf(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&&xi(n.type)&&(c=n.stateNode),n=n.child,n!==null))for(gf(n,l,c),n=n.sibling;n!==null;)gf(n,l,c),n=n.sibling}function hb(n){var l=n.stateNode,c=n.memoizedProps;try{for(var v=n.type,x=l.attributes;x.length;)l.removeAttributeNode(x[0]);_r(l,v,c),l[Ht]=n,l[mr]=c}catch(w){Ot(n,n.return,w)}}var Mn=!1,hr=!1,qv=!1,vb=typeof WeakSet=="function"?WeakSet:Set,jr=null;function k5(n,l){if(n=n.containerInfo,lp=_f,n=Ny(n),kh(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 x=v.anchorOffset,w=v.focusNode;v=v.focusOffset;try{c.nodeType,w.nodeType}catch{c=null;break e}var O=0,V=-1,te=-1,fe=0,be=0,Te=n,he=null;t:for(;;){for(var me;Te!==c||x!==0&&Te.nodeType!==3||(V=O+x),Te!==w||v!==0&&Te.nodeType!==3||(te=O+v),Te.nodeType===3&&(O+=Te.nodeValue.length),(me=Te.firstChild)!==null;)he=Te,Te=me;for(;;){if(Te===n)break t;if(he===c&&++fe===x&&(V=O),he===w&&++be===v&&(te=O),(me=Te.nextSibling)!==null)break;Te=he,he=Te.parentNode}Te=me}c=V===-1||te===-1?null:{start:V,end:te}}else c=null}c=c||{start:0,end:0}}else c=null;for(op={focusedElem:n,selectionRange:c},_f=!1,jr=l;jr!==null;)if(l=jr,n=l.child,(l.subtreeFlags&1028)!==0&&n!==null)n.return=l,jr=n;else for(;jr!==null;){switch(l=jr,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++)x=n[c],x.ref.impl=x.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&w!==null){n=void 0,c=l,x=w.memoizedProps,w=w.memoizedState,v=c.stateNode;try{var Fe=Ts(c.type,x);n=v.getSnapshotBeforeUpdate(Fe,w),v.__reactInternalSnapshotBeforeUpdate=n}catch(We){Ot(c,c.return,We)}}break;case 3:if((n&1024)!==0){if(n=l.stateNode.containerInfo,c=n.nodeType,c===9)fp(n);else if(c===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":fp(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(a(163))}if(n=l.sibling,n!==null){n.return=l.return,jr=n;break}jr=l.return}}function pb(n,l,c){var v=c.flags;switch(c.tag){case 0:case 11:case 15:kn(n,c),v&4&&lu(5,c);break;case 1:if(kn(n,c),v&4)if(n=c.stateNode,l===null)try{n.componentDidMount()}catch(O){Ot(c,c.return,O)}else{var x=Ts(c.type,l.memoizedProps);l=l.memoizedState;try{n.componentDidUpdate(x,l,n.__reactInternalSnapshotBeforeUpdate)}catch(O){Ot(c,c.return,O)}}v&64&&ub(c),v&512&&ou(c,c.return);break;case 3:if(kn(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{Jy(n,l)}catch(O){Ot(c,c.return,O)}}break;case 27:l===null&&v&4&&hb(c);case 26:case 5:kn(n,c),l===null&&v&4&&fb(c),v&512&&ou(c,c.return);break;case 12:kn(n,c);break;case 31:kn(n,c),v&4&&yb(n,c);break;case 13:kn(n,c),v&4&&xb(n,c),v&64&&(n=c.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(c=V5.bind(null,c),oA(n,c))));break;case 22:if(v=c.memoizedState!==null||Mn,!v){l=l!==null&&l.memoizedState!==null||hr,x=Mn;var w=hr;Mn=v,(hr=l)&&!w?Bn(n,c,(c.subtreeFlags&8772)!==0):kn(n,c),Mn=x,hr=w}break;case 30:break;default:kn(n,c)}}function gb(n){var l=n.alternate;l!==null&&(n.alternate=null,gb(l)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(l=n.stateNode,l!==null&&il(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,sa=!1;function Rn(n,l,c){for(c=c.child;c!==null;)mb(n,l,c),c=c.sibling}function mb(n,l,c){if(ue&&typeof ue.onCommitFiberUnmount=="function")try{ue.onCommitFiberUnmount(Q,c)}catch{}switch(c.tag){case 26:hr||ln(c,l),Rn(n,l,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:hr||ln(c,l);var v=Gt,x=sa;xi(c.type)&&(Gt=c.stateNode,sa=!1),Rn(n,l,c),mu(c.stateNode),Gt=v,sa=x;break;case 5:hr||ln(c,l);case 6:if(v=Gt,x=sa,Gt=null,Rn(n,l,c),Gt=v,sa=x,Gt!==null)if(sa)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&&(sa?(n=Gt,u1(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,c.stateNode),Ul(n)):u1(Gt,c.stateNode));break;case 4:v=Gt,x=sa,Gt=c.stateNode.containerInfo,sa=!0,Rn(n,l,c),Gt=v,sa=x;break;case 0:case 11:case 14:case 15:di(2,c,l),hr||di(4,c,l),Rn(n,l,c);break;case 1:hr||(ln(c,l),v=c.stateNode,typeof v.componentWillUnmount=="function"&&cb(c,l,v)),Rn(n,l,c);break;case 21:Rn(n,l,c);break;case 22:hr=(v=hr)||c.memoizedState!==null,Rn(n,l,c),hr=v;break;default:Rn(n,l,c)}}function yb(n,l){if(l.memoizedState===null&&(n=l.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{Ul(n)}catch(c){Ot(l,l.return,c)}}}function xb(n,l){if(l.memoizedState===null&&(n=l.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{Ul(n)}catch(c){Ot(l,l.return,c)}}function B5(n){switch(n.tag){case 31:case 13:case 19:var l=n.stateNode;return l===null&&(l=n.stateNode=new vb),l;case 22:return n=n.stateNode,l=n._retryCache,l===null&&(l=n._retryCache=new vb),l;default:throw Error(a(435,n.tag))}}function mf(n,l){var c=B5(n);l.forEach(function(v){if(!c.has(v)){c.add(v);var x=F5.bind(null,n,v);v.then(x,x)}})}function la(n,l){var c=l.deletions;if(c!==null)for(var v=0;v<c.length;v++){var x=c[v],w=n,O=l,V=O;e:for(;V!==null;){switch(V.tag){case 27:if(xi(V.type)){Gt=V.stateNode,sa=!1;break e}break;case 5:Gt=V.stateNode,sa=!1;break e;case 3:case 4:Gt=V.stateNode.containerInfo,sa=!0;break e}V=V.return}if(Gt===null)throw Error(a(160));mb(w,O,x),Gt=null,sa=!1,w=x.alternate,w!==null&&(w.return=null),x.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)bb(l,n),l=l.sibling}var Ka=null;function bb(n,l){var c=n.alternate,v=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:la(l,n),oa(n),v&4&&(di(3,n,n.return),lu(3,n),di(5,n,n.return));break;case 1:la(l,n),oa(n),v&512&&(hr||c===null||ln(c,c.return)),v&64&&Mn&&(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 x=Ka;if(la(l,n),oa(n),v&512&&(hr||c===null||ln(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,x=x.ownerDocument||x;t:switch(v){case"title":w=x.getElementsByTagName("title")[0],(!w||w[Nr]||w[Ht]||w.namespaceURI==="http://www.w3.org/2000/svg"||w.hasAttribute("itemprop"))&&(w=x.createElement(v),x.head.insertBefore(w,x.querySelector("head > title"))),_r(w,v,c),w[Ht]=n,ur(w),v=w;break e;case"link":var O=b1("link","href",x).get(v+(c.href||""));if(O){for(var V=0;V<O.length;V++)if(w=O[V],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(V,1);break t}}w=x.createElement(v),_r(w,v,c),x.head.appendChild(w);break;case"meta":if(O=b1("meta","content",x).get(v+(c.content||""))){for(V=0;V<O.length;V++)if(w=O[V],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(V,1);break t}}w=x.createElement(v),_r(w,v,c),x.head.appendChild(w);break;default:throw Error(a(468,v))}w[Ht]=n,ur(w),v=w}n.stateNode=v}else w1(x,n.type,n.stateNode);else n.stateNode=x1(x,v,n.memoizedProps);else w!==v?(w===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):w.count--,v===null?w1(x,n.type,n.stateNode):x1(x,v,n.memoizedProps)):v===null&&n.stateNode!==null&&_v(n,n.memoizedProps,c.memoizedProps)}break;case 27:la(l,n),oa(n),v&512&&(hr||c===null||ln(c,c.return)),c!==null&&v&4&&_v(n,n.memoizedProps,c.memoizedProps);break;case 5:if(la(l,n),oa(n),v&512&&(hr||c===null||ln(c,c.return)),n.flags&32){x=n.stateNode;try{ol(x,"")}catch(Fe){Ot(n,n.return,Fe)}}v&4&&n.stateNode!=null&&(x=n.memoizedProps,_v(n,x,c!==null?c.memoizedProps:x)),v&1024&&(qv=!0);break;case 6:if(la(l,n),oa(n),v&4){if(n.stateNode===null)throw Error(a(162));v=n.memoizedProps,c=n.stateNode;try{c.nodeValue=v}catch(Fe){Ot(n,n.return,Fe)}}break;case 3:if(kf=null,x=Ka,Ka=Mf(l.containerInfo),la(l,n),Ka=x,oa(n),v&4&&c!==null&&c.memoizedState.isDehydrated)try{Ul(l.containerInfo)}catch(Fe){Ot(n,n.return,Fe)}qv&&(qv=!1,wb(n));break;case 4:v=Ka,Ka=Mf(n.stateNode.containerInfo),la(l,n),oa(n),Ka=v;break;case 12:la(l,n),oa(n);break;case 31:la(l,n),oa(n),v&4&&(v=n.updateQueue,v!==null&&(n.updateQueue=null,mf(n,v)));break;case 13:la(l,n),oa(n),n.child.flags&8192&&n.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(xf=Re()),v&4&&(v=n.updateQueue,v!==null&&(n.updateQueue=null,mf(n,v)));break;case 22:x=n.memoizedState!==null;var te=c!==null&&c.memoizedState!==null,fe=Mn,be=hr;if(Mn=fe||x,hr=be||te,la(l,n),hr=be,Mn=fe,oa(n),v&8192)e:for(l=n.stateNode,l._visibility=x?l._visibility&-2:l._visibility|1,x&&(c===null||te||Mn||hr||Cs(n)),c=null,l=n;;){if(l.tag===5||l.tag===26){if(c===null){te=c=l;try{if(w=te.stateNode,x)O=w.style,typeof O.setProperty=="function"?O.setProperty("display","none","important"):O.display="none";else{V=te.stateNode;var Te=te.memoizedProps.style,he=Te!=null&&Te.hasOwnProperty("display")?Te.display:null;V.style.display=he==null||typeof he=="boolean"?"":(""+he).trim()}}catch(Fe){Ot(te,te.return,Fe)}}}else if(l.tag===6){if(c===null){te=l;try{te.stateNode.nodeValue=x?"":te.memoizedProps}catch(Fe){Ot(te,te.return,Fe)}}}else if(l.tag===18){if(c===null){te=l;try{var me=te.stateNode;x?c1(me,!0):c1(te.stateNode,!1)}catch(Fe){Ot(te,te.return,Fe)}}}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,mf(n,c))));break;case 19:la(l,n),oa(n),v&4&&(v=n.updateQueue,v!==null&&(n.updateQueue=null,mf(n,v)));break;case 30:break;case 21:break;default:la(l,n),oa(n)}}function oa(n){var l=n.flags;if(l&2){try{for(var c,v=n.return;v!==null;){if(db(v)){c=v;break}v=v.return}if(c==null)throw Error(a(160));switch(c.tag){case 27:var x=c.stateNode,w=Pv(n);gf(n,w,x);break;case 5:var O=c.stateNode;c.flags&32&&(ol(O,""),c.flags&=-33);var V=Pv(n);gf(n,V,O);break;case 3:case 4:var te=c.stateNode.containerInfo,fe=Pv(n);Uv(n,fe,te);break;default:throw Error(a(161))}}catch(be){Ot(n,n.return,be)}n.flags&=-3}l&4096&&(n.flags&=-4097)}function wb(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var l=n;wb(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),n=n.sibling}}function kn(n,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)pb(n,l.alternate,l),l=l.sibling}function Cs(n){for(n=n.child;n!==null;){var l=n;switch(l.tag){case 0:case 11:case 14:case 15:di(4,l,l.return),Cs(l);break;case 1:ln(l,l.return);var c=l.stateNode;typeof c.componentWillUnmount=="function"&&cb(l,l.return,c),Cs(l);break;case 27:mu(l.stateNode);case 26:case 5:ln(l,l.return),Cs(l);break;case 22:l.memoizedState===null&&Cs(l);break;case 30:Cs(l);break;default:Cs(l)}n=n.sibling}}function Bn(n,l,c){for(c=c&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var v=l.alternate,x=n,w=l,O=w.flags;switch(w.tag){case 0:case 11:case 15:Bn(x,w,c),lu(4,w);break;case 1:if(Bn(x,w,c),v=w,x=v.stateNode,typeof x.componentDidMount=="function")try{x.componentDidMount()}catch(fe){Ot(v,v.return,fe)}if(v=w,x=v.updateQueue,x!==null){var V=v.stateNode;try{var te=x.shared.hiddenCallbacks;if(te!==null)for(x.shared.hiddenCallbacks=null,x=0;x<te.length;x++)Wy(te[x],V)}catch(fe){Ot(v,v.return,fe)}}c&&O&64&&ub(w),ou(w,w.return);break;case 27:hb(w);case 26:case 5:Bn(x,w,c),c&&v===null&&O&4&&fb(w),ou(w,w.return);break;case 12:Bn(x,w,c);break;case 31:Bn(x,w,c),c&&O&4&&yb(x,w);break;case 13:Bn(x,w,c),c&&O&4&&xb(x,w);break;case 22:w.memoizedState===null&&Bn(x,w,c),ou(w,w.return);break;case 30:break;default:Bn(x,w,c)}l=l.sibling}}function Iv(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&&Ko(c))}function Vv(n,l){n=null,l.alternate!==null&&(n=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==n&&(l.refCount++,n!=null&&Ko(n))}function Xa(n,l,c,v){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)Sb(n,l,c,v),l=l.sibling}function Sb(n,l,c,v){var x=l.flags;switch(l.tag){case 0:case 11:case 15:Xa(n,l,c,v),x&2048&&lu(9,l);break;case 1:Xa(n,l,c,v);break;case 3:Xa(n,l,c,v),x&2048&&(n=null,l.alternate!==null&&(n=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==n&&(l.refCount++,n!=null&&Ko(n)));break;case 12:if(x&2048){Xa(n,l,c,v),n=l.stateNode;try{var w=l.memoizedProps,O=w.id,V=w.onPostCommit;typeof V=="function"&&V(O,l.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(te){Ot(l,l.return,te)}}else Xa(n,l,c,v);break;case 31:Xa(n,l,c,v);break;case 13:Xa(n,l,c,v);break;case 23:break;case 22:w=l.stateNode,O=l.alternate,l.memoizedState!==null?w._visibility&2?Xa(n,l,c,v):uu(n,l):w._visibility&2?Xa(n,l,c,v):(w._visibility|=2,jl(n,l,c,v,(l.subtreeFlags&10256)!==0||!1)),x&2048&&Iv(O,l);break;case 24:Xa(n,l,c,v),x&2048&&Vv(l.alternate,l);break;default:Xa(n,l,c,v)}}function jl(n,l,c,v,x){for(x=x&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var w=n,O=l,V=c,te=v,fe=O.flags;switch(O.tag){case 0:case 11:case 15:jl(w,O,V,te,x),lu(8,O);break;case 23:break;case 22:var be=O.stateNode;O.memoizedState!==null?be._visibility&2?jl(w,O,V,te,x):uu(w,O):(be._visibility|=2,jl(w,O,V,te,x)),x&&fe&2048&&Iv(O.alternate,O);break;case 24:jl(w,O,V,te,x),x&&fe&2048&&Vv(O.alternate,O);break;default:jl(w,O,V,te,x)}l=l.sibling}}function uu(n,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var c=n,v=l,x=v.flags;switch(v.tag){case 22:uu(c,v),x&2048&&Iv(v.alternate,v);break;case 24:uu(c,v),x&2048&&Vv(v.alternate,v);break;default:uu(c,v)}l=l.sibling}}var cu=8192;function Dl(n,l,c){if(n.subtreeFlags&cu)for(n=n.child;n!==null;)Eb(n,l,c),n=n.sibling}function Eb(n,l,c){switch(n.tag){case 26:Dl(n,l,c),n.flags&cu&&n.memoizedState!==null&&bA(c,Ka,n.memoizedState,n.memoizedProps);break;case 5:Dl(n,l,c);break;case 3:case 4:var v=Ka;Ka=Mf(n.stateNode.containerInfo),Dl(n,l,c),Ka=v;break;case 22:n.memoizedState===null&&(v=n.alternate,v!==null&&v.memoizedState!==null?(v=cu,cu=16777216,Dl(n,l,c),cu=v):Dl(n,l,c));break;default:Dl(n,l,c)}}function Tb(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 fu(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];jr=v,Nb(v,n)}Tb(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Cb(n),n=n.sibling}function Cb(n){switch(n.tag){case 0:case 11:case 15:fu(n),n.flags&2048&&di(9,n,n.return);break;case 3:fu(n);break;case 12:fu(n);break;case 22:var l=n.stateNode;n.memoizedState!==null&&l._visibility&2&&(n.return===null||n.return.tag!==13)?(l._visibility&=-3,yf(n)):fu(n);break;default:fu(n)}}function yf(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];jr=v,Nb(v,n)}Tb(n)}for(n=n.child;n!==null;){switch(l=n,l.tag){case 0:case 11:case 15:di(8,l,l.return),yf(l);break;case 22:c=l.stateNode,c._visibility&2&&(c._visibility&=-3,yf(l));break;default:yf(l)}n=n.sibling}}function Nb(n,l){for(;jr!==null;){var c=jr;switch(c.tag){case 0:case 11:case 15:di(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:Ko(c.memoizedState.cache)}if(v=c.child,v!==null)v.return=c,jr=v;else e:for(c=n;jr!==null;){v=jr;var x=v.sibling,w=v.return;if(gb(v),v===c){jr=null;break e}if(x!==null){x.return=w,jr=x;break e}jr=w}}}var L5={getCacheForType:function(n){var l=Lr(cr),c=l.data.get(n);return c===void 0&&(c=n(),l.data.set(n,c)),c},cacheSignal:function(){return Lr(cr).controller.signal}},z5=typeof WeakMap=="function"?WeakMap:Map,Ct=0,_t=null,ht=null,pt=0,Dt=0,wa=null,hi=!1,Ol=!1,Fv=!1,Ln=0,er=0,vi=0,Ns=0,Hv=0,Sa=0,Ml=0,du=null,ua=null,Gv=!1,xf=0,Ab=0,bf=1/0,wf=null,pi=null,yr=0,gi=null,Rl=null,zn=0,Qv=0,Yv=null,jb=null,hu=0,Kv=null;function Ea(){return(Ct&2)!==0&&pt!==0?pt&-pt:U.T!==null?ep():Xt()}function Db(){if(Sa===0)if((pt&536870912)===0||mt){var n=ze;ze<<=1,(ze&3932160)===0&&(ze=262144),Sa=n}else Sa=536870912;return n=xa.current,n!==null&&(n.flags|=32),Sa}function ca(n,l,c){(n===_t&&(Dt===2||Dt===9)||n.cancelPendingCommit!==null)&&(kl(n,0),mi(n,pt,Sa,!1)),Rt(n,c),((Ct&2)===0||n!==_t)&&(n===_t&&((Ct&2)===0&&(Ns|=c),er===4&&mi(n,pt,Sa,!1)),on(n))}function Ob(n,l,c){if((Ct&6)!==0)throw Error(a(327));var v=!c&&(l&127)===0&&(l&n.expiredLanes)===0||Ve(n,l),x=v?U5(n,l):$v(n,l,!0),w=v;do{if(x===0){Ol&&!v&&mi(n,l,0,!1);break}else{if(c=n.current.alternate,w&&!_5(c)){x=$v(n,l,!1),w=!1;continue}if(x===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 V=n;x=du;var te=V.current.memoizedState.isDehydrated;if(te&&(kl(V,O).flags|=256),O=$v(V,O,!1),O!==2){if(Fv&&!te){V.errorRecoveryDisabledLanes|=w,Ns|=w,x=4;break e}w=ua,ua=x,w!==null&&(ua===null?ua=w:ua.push.apply(ua,w))}x=O}if(w=!1,x!==2)continue}}if(x===1){kl(n,0),mi(n,l,0,!0);break}e:{switch(v=n,w=x,w){case 0:case 1:throw Error(a(345));case 4:if((l&4194048)!==l)break;case 6:mi(v,l,Sa,!hi);break e;case 2:ua=null;break;case 3:case 5:break;default:throw Error(a(329))}if((l&62914560)===l&&(x=xf+300-Re(),10<x)){if(mi(v,l,Sa,!hi),it(v,0,!0)!==0)break e;zn=l,v.timeoutHandle=l1(Mb.bind(null,v,c,ua,wf,Gv,l,Sa,Ns,Ml,hi,w,"Throttled",-0,0),x);break e}Mb(v,c,ua,wf,Gv,l,Sa,Ns,Ml,hi,w,null,-0,0)}}break}while(!0);on(n)}function Mb(n,l,c,v,x,w,O,V,te,fe,be,Te,he,me){if(n.timeoutHandle=-1,Te=l.subtreeFlags,Te&8192||(Te&16785408)===16785408){Te={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:wn},Eb(l,w,Te);var Fe=(w&62914560)===w?xf-Re():(w&4194048)===w?Ab-Re():0;if(Fe=wA(Te,Fe),Fe!==null){zn=w,n.cancelPendingCommit=Fe(Ub.bind(null,n,l,w,c,v,x,O,V,te,be,Te,null,he,me)),mi(n,w,O,!fe);return}}Ub(n,l,w,c,v,x,O,V,te)}function _5(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 x=c[v],w=x.getSnapshot;x=x.value;try{if(!ma(w(),x))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 mi(n,l,c,v){l&=~Hv,l&=~Ns,n.suspendedLanes|=l,n.pingedLanes&=~l,v&&(n.warmLanes|=l),v=n.expirationTimes;for(var x=l;0<x;){var w=31-pe(x),O=1<<w;v[w]=-1,x&=~O}c!==0&&Kt(n,c,l)}function Sf(){return(Ct&6)===0?(vu(0),!1):!0}function Xv(){if(ht!==null){if(Dt===0)var n=ht.return;else n=ht,Cn=ms=null,fv(n),El=null,$o=0,n=ht;for(;n!==null;)ob(n.alternate,n),n=n.return;ht=null}}function kl(n,l){var c=n.timeoutHandle;c!==-1&&(n.timeoutHandle=-1,aA(c)),c=n.cancelPendingCommit,c!==null&&(n.cancelPendingCommit=null,c()),zn=0,Xv(),_t=n,ht=c=En(n.current,null),pt=l,Dt=0,wa=null,hi=!1,Ol=Ve(n,l),Fv=!1,Ml=Sa=Hv=Ns=vi=er=0,ua=du=null,Gv=!1,(l&8)!==0&&(l|=l&32);var v=n.entangledLanes;if(v!==0)for(n=n.entanglements,v&=l;0<v;){var x=31-pe(v),w=1<<x;l|=n[x],v&=~w}return Ln=l,Vc(),c}function Rb(n,l){lt=null,U.H=nu,l===Sl||l===$c?(l=Ky(),Dt=3):l===Jh?(l=Ky(),Dt=4):Dt=l===Av?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,wa=l,ht===null&&(er=1,ff(n,ka(l,n.current)))}function kb(){var n=xa.current;return n===null?!0:(pt&4194048)===pt?_a===null:(pt&62914560)===pt||(pt&536870912)!==0?n===_a:!1}function Bb(){var n=U.H;return U.H=nu,n===null?nu:n}function Lb(){var n=U.A;return U.A=L5,n}function Ef(){er=4,hi||(pt&4194048)!==pt&&xa.current!==null||(Ol=!0),(vi&134217727)===0&&(Ns&134217727)===0||_t===null||mi(_t,pt,Sa,!1)}function $v(n,l,c){var v=Ct;Ct|=2;var x=Bb(),w=Lb();(_t!==n||pt!==l)&&(wf=null,kl(n,l)),l=!1;var O=er;e:do try{if(Dt!==0&&ht!==null){var V=ht,te=wa;switch(Dt){case 8:Xv(),O=6;break e;case 3:case 2:case 9:case 6:xa.current===null&&(l=!0);var fe=Dt;if(Dt=0,wa=null,Bl(n,V,te,fe),c&&Ol){O=0;break e}break;default:fe=Dt,Dt=0,wa=null,Bl(n,V,te,fe)}}P5(),O=er;break}catch(be){Rb(n,be)}while(!0);return l&&n.shellSuspendCounter++,Cn=ms=null,Ct=v,U.H=x,U.A=w,ht===null&&(_t=null,pt=0,Vc()),O}function P5(){for(;ht!==null;)zb(ht)}function U5(n,l){var c=Ct;Ct|=2;var v=Bb(),x=Lb();_t!==n||pt!==l?(wf=null,bf=Re()+500,kl(n,l)):Ol=Ve(n,l);e:do try{if(Dt!==0&&ht!==null){l=ht;var w=wa;t:switch(Dt){case 1:Dt=0,wa=null,Bl(n,l,w,1);break;case 2:case 9:if(Qy(w)){Dt=0,wa=null,_b(l);break}l=function(){Dt!==2&&Dt!==9||_t!==n||(Dt=7),on(n)},w.then(l,l);break e;case 3:Dt=7;break e;case 4:Dt=5;break e;case 7:Qy(w)?(Dt=0,wa=null,_b(l)):(Dt=0,wa=null,Bl(n,l,w,7));break;case 5:var O=null;switch(ht.tag){case 26:O=ht.memoizedState;case 5:case 27:var V=ht;if(O?S1(O):V.stateNode.complete){Dt=0,wa=null;var te=V.sibling;if(te!==null)ht=te;else{var fe=V.return;fe!==null?(ht=fe,Tf(fe)):ht=null}break t}}Dt=0,wa=null,Bl(n,l,w,5);break;case 6:Dt=0,wa=null,Bl(n,l,w,6);break;case 8:Xv(),er=6;break e;default:throw Error(a(462))}}q5();break}catch(be){Rb(n,be)}while(!0);return Cn=ms=null,U.H=v,U.A=x,Ct=c,ht!==null?0:(_t=null,pt=0,Vc(),er)}function q5(){for(;ht!==null&&!xe();)zb(ht)}function zb(n){var l=sb(n.alternate,n,Ln);n.memoizedProps=n.pendingProps,l===null?Tf(n):ht=l}function _b(n){var l=n,c=l.alternate;switch(l.tag){case 15:case 0:l=eb(c,l,l.pendingProps,l.type,void 0,pt);break;case 11:l=eb(c,l,l.pendingProps,l.type.render,l.ref,pt);break;case 5:fv(l);default:ob(c,l),l=ht=Ly(l,Ln),l=sb(c,l,Ln)}n.memoizedProps=n.pendingProps,l===null?Tf(n):ht=l}function Bl(n,l,c,v){Cn=ms=null,fv(l),El=null,$o=0;var x=l.return;try{if(j5(n,x,l,c,pt)){er=1,ff(n,ka(c,n.current)),ht=null;return}}catch(w){if(x!==null)throw ht=x,w;er=1,ff(n,ka(c,n.current)),ht=null;return}l.flags&32768?(mt||v===1?n=!0:Ol||(pt&536870912)!==0?n=!1:(hi=n=!0,(v===2||v===9||v===3||v===6)&&(v=xa.current,v!==null&&v.tag===13&&(v.flags|=16384))),Pb(l,n)):Tf(l)}function Tf(n){var l=n;do{if((l.flags&32768)!==0){Pb(l,hi);return}n=l.return;var c=M5(l.alternate,l,Ln);if(c!==null){ht=c;return}if(l=l.sibling,l!==null){ht=l;return}ht=l=n}while(l!==null);er===0&&(er=5)}function Pb(n,l){do{var c=R5(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);er=6,ht=null}function Ub(n,l,c,v,x,w,O,V,te){n.cancelPendingCommit=null;do Cf();while(yr!==0);if((Ct&6)!==0)throw Error(a(327));if(l!==null){if(l===n.current)throw Error(a(177));if(w=l.lanes|l.childLanes,w|=Ph,kr(n,c,w,O,V,te),n===_t&&(ht=_t=null,pt=0),Rl=l,gi=n,zn=c,Qv=w,Yv=x,jb=v,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,H5(at,function(){return Hb(),null})):(n.callbackNode=null,n.callbackPriority=0),v=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||v){v=U.T,U.T=null,x=z.p,z.p=2,O=Ct,Ct|=4;try{k5(n,l,c)}finally{Ct=O,z.p=x,U.T=v}}yr=1,qb(),Ib(),Vb()}}function qb(){if(yr===1){yr=0;var n=gi,l=Rl,c=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||c){c=U.T,U.T=null;var v=z.p;z.p=2;var x=Ct;Ct|=4;try{bb(l,n);var w=op,O=Ny(n.containerInfo),V=w.focusedElem,te=w.selectionRange;if(O!==V&&V&&V.ownerDocument&&Cy(V.ownerDocument.documentElement,V)){if(te!==null&&kh(V)){var fe=te.start,be=te.end;if(be===void 0&&(be=fe),"selectionStart"in V)V.selectionStart=fe,V.selectionEnd=Math.min(be,V.value.length);else{var Te=V.ownerDocument||document,he=Te&&Te.defaultView||window;if(he.getSelection){var me=he.getSelection(),Fe=V.textContent.length,We=Math.min(te.start,Fe),Lt=te.end===void 0?We:Math.min(te.end,Fe);!me.extend&&We>Lt&&(O=Lt,Lt=We,We=O);var se=Ty(V,We),ie=Ty(V,Lt);if(se&&ie&&(me.rangeCount!==1||me.anchorNode!==se.node||me.anchorOffset!==se.offset||me.focusNode!==ie.node||me.focusOffset!==ie.offset)){var ce=Te.createRange();ce.setStart(se.node,se.offset),me.removeAllRanges(),We>Lt?(me.addRange(ce),me.extend(ie.node,ie.offset)):(ce.setEnd(ie.node,ie.offset),me.addRange(ce))}}}}for(Te=[],me=V;me=me.parentNode;)me.nodeType===1&&Te.push({element:me,left:me.scrollLeft,top:me.scrollTop});for(typeof V.focus=="function"&&V.focus(),V=0;V<Te.length;V++){var Ee=Te[V];Ee.element.scrollLeft=Ee.left,Ee.element.scrollTop=Ee.top}}_f=!!lp,op=lp=null}finally{Ct=x,z.p=v,U.T=c}}n.current=l,yr=2}}function Ib(){if(yr===2){yr=0;var n=gi,l=Rl,c=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||c){c=U.T,U.T=null;var v=z.p;z.p=2;var x=Ct;Ct|=4;try{pb(n,l.alternate,l)}finally{Ct=x,z.p=v,U.T=c}}yr=3}}function Vb(){if(yr===4||yr===3){yr=0,Ye();var n=gi,l=Rl,c=zn,v=jb;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?yr=5:(yr=0,Rl=gi=null,Fb(n,n.pendingLanes));var x=n.pendingLanes;if(x===0&&(pi=null),ja(c),l=l.stateNode,ue&&typeof ue.onCommitFiberRoot=="function")try{ue.onCommitFiberRoot(Q,l,void 0,(l.current.flags&128)===128)}catch{}if(v!==null){l=U.T,x=z.p,z.p=2,U.T=null;try{for(var w=n.onRecoverableError,O=0;O<v.length;O++){var V=v[O];w(V.value,{componentStack:V.stack})}}finally{U.T=l,z.p=x}}(zn&3)!==0&&Cf(),on(n),x=n.pendingLanes,(c&261930)!==0&&(x&42)!==0?n===Kv?hu++:(hu=0,Kv=n):hu=0,vu(0)}}function Fb(n,l){(n.pooledCacheLanes&=l)===0&&(l=n.pooledCache,l!=null&&(n.pooledCache=null,Ko(l)))}function Cf(){return qb(),Ib(),Vb(),Hb()}function Hb(){if(yr!==5)return!1;var n=gi,l=Qv;Qv=0;var c=ja(zn),v=U.T,x=z.p;try{z.p=32>c?32:c,U.T=null,c=Yv,Yv=null;var w=gi,O=zn;if(yr=0,Rl=gi=null,zn=0,(Ct&6)!==0)throw Error(a(331));var V=Ct;if(Ct|=4,Cb(w.current),Sb(w,w.current,O,c),Ct=V,vu(0,!1),ue&&typeof ue.onPostCommitFiberRoot=="function")try{ue.onPostCommitFiberRoot(Q,w)}catch{}return!0}finally{z.p=x,U.T=v,Fb(n,l)}}function Gb(n,l,c){l=ka(c,l),l=Nv(n.stateNode,l,2),n=ui(n,l,2),n!==null&&(Rt(n,2),on(n))}function Ot(n,l,c){if(n.tag===3)Gb(n,n,c);else for(;l!==null;){if(l.tag===3){Gb(l,n,c);break}else if(l.tag===1){var v=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof v.componentDidCatch=="function"&&(pi===null||!pi.has(v))){n=ka(c,n),c=Qx(2),v=ui(l,c,2),v!==null&&(Yx(c,v,l,n),Rt(v,2),on(v));break}}l=l.return}}function Zv(n,l,c){var v=n.pingCache;if(v===null){v=n.pingCache=new z5;var x=new Set;v.set(l,x)}else x=v.get(l),x===void 0&&(x=new Set,v.set(l,x));x.has(c)||(Fv=!0,x.add(c),n=I5.bind(null,n,l,c),l.then(n,n))}function I5(n,l,c){var v=n.pingCache;v!==null&&v.delete(l),n.pingedLanes|=n.suspendedLanes&c,n.warmLanes&=~c,_t===n&&(pt&c)===c&&(er===4||er===3&&(pt&62914560)===pt&&300>Re()-xf?(Ct&2)===0&&kl(n,0):Hv|=c,Ml===pt&&(Ml=0)),on(n)}function Qb(n,l){l===0&&(l=ot()),n=vs(n,l),n!==null&&(Rt(n,l),on(n))}function V5(n){var l=n.memoizedState,c=0;l!==null&&(c=l.retryLane),Qb(n,c)}function F5(n,l){var c=0;switch(n.tag){case 31:case 13:var v=n.stateNode,x=n.memoizedState;x!==null&&(c=x.retryLane);break;case 19:v=n.stateNode;break;case 22:v=n.stateNode._retryCache;break;default:throw Error(a(314))}v!==null&&v.delete(l),Qb(n,c)}function H5(n,l){return De(n,l)}var Nf=null,Ll=null,Wv=!1,Af=!1,Jv=!1,yi=0;function on(n){n!==Ll&&n.next===null&&(Ll===null?Nf=Ll=n:Ll=Ll.next=n),Af=!0,Wv||(Wv=!0,Q5())}function vu(n,l){if(!Jv&&Af){Jv=!0;do for(var c=!1,v=Nf;v!==null;){if(n!==0){var x=v.pendingLanes;if(x===0)var w=0;else{var O=v.suspendedLanes,V=v.pingedLanes;w=(1<<31-pe(42|n)+1)-1,w&=x&~(O&~V),w=w&201326741?w&201326741|1:w?w|2:0}w!==0&&(c=!0,$b(v,w))}else w=pt,w=it(v,v===_t?w:0,v.cancelPendingCommit!==null||v.timeoutHandle!==-1),(w&3)===0||Ve(v,w)||(c=!0,$b(v,w));v=v.next}while(c);Jv=!1}}function G5(){Yb()}function Yb(){Af=Wv=!1;var n=0;yi!==0&&rA()&&(n=yi);for(var l=Re(),c=null,v=Nf;v!==null;){var x=v.next,w=Kb(v,l);w===0?(v.next=null,c===null?Nf=x:c.next=x,x===null&&(Ll=c)):(c=v,(n!==0||(w&3)!==0)&&(Af=!0)),v=x}yr!==0&&yr!==5||vu(n),yi!==0&&(yi=0)}function Kb(n,l){for(var c=n.suspendedLanes,v=n.pingedLanes,x=n.expirationTimes,w=n.pendingLanes&-62914561;0<w;){var O=31-pe(w),V=1<<O,te=x[O];te===-1?((V&c)===0||(V&v)!==0)&&(x[O]=ft(V,l)):te<=l&&(n.expiredLanes|=V),w&=~V}if(l=_t,c=pt,c=it(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&&Ue(v),n.callbackNode=null,n.callbackPriority=0;if((c&3)===0||Ve(n,c)){if(l=c&-c,l===n.callbackPriority)return l;switch(v!==null&&Ue(v),ja(c)){case 2:case 8:c=rt;break;case 32:c=at;break;case 268435456:c=et;break;default:c=at}return v=Xb.bind(null,n),c=De(c,v),n.callbackPriority=l,n.callbackNode=c,l}return v!==null&&v!==null&&Ue(v),n.callbackPriority=2,n.callbackNode=null,2}function Xb(n,l){if(yr!==0&&yr!==5)return n.callbackNode=null,n.callbackPriority=0,null;var c=n.callbackNode;if(Cf()&&n.callbackNode!==c)return null;var v=pt;return v=it(n,n===_t?v:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),v===0?null:(Ob(n,v,l),Kb(n,Re()),n.callbackNode!=null&&n.callbackNode===c?Xb.bind(null,n):null)}function $b(n,l){if(Cf())return null;Ob(n,l,!0)}function Q5(){nA(function(){(Ct&6)!==0?De(Ge,G5):Yb()})}function ep(){if(yi===0){var n=bl;n===0&&(n=He,He<<=1,(He&261888)===0&&(He=256)),yi=n}return yi}function Zb(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:Bc(""+n)}function Wb(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 Y5(n,l,c,v,x){if(l==="submit"&&c&&c.stateNode===x){var w=Zb((x[mr]||null).action),O=v.submitter;O&&(l=(l=O[mr]||null)?Zb(l.formAction):O.getAttribute("formAction"),l!==null&&(w=l,O=null));var V=new Pc("action","action",null,v,x);n.push({event:V,listeners:[{instance:null,listener:function(){if(v.defaultPrevented){if(yi!==0){var te=O?Wb(x,O):new FormData(x);bv(c,{pending:!0,data:te,method:x.method,action:w},null,te)}}else typeof w=="function"&&(V.preventDefault(),te=O?Wb(x,O):new FormData(x),bv(c,{pending:!0,data:te,method:x.method,action:w},w,te))},currentTarget:x}]})}}for(var tp=0;tp<_h.length;tp++){var rp=_h[tp],K5=rp.toLowerCase(),X5=rp[0].toUpperCase()+rp.slice(1);Ya(K5,"on"+X5)}Ya(Dy,"onAnimationEnd"),Ya(Oy,"onAnimationIteration"),Ya(My,"onAnimationStart"),Ya("dblclick","onDoubleClick"),Ya("focusin","onFocus"),Ya("focusout","onBlur"),Ya(f5,"onTransitionRun"),Ya(d5,"onTransitionStart"),Ya(h5,"onTransitionCancel"),Ya(Ry,"onTransitionEnd"),an("onMouseEnter",["mouseout","mouseover"]),an("onMouseLeave",["mouseout","mouseover"]),an("onPointerEnter",["pointerout","pointerover"]),an("onPointerLeave",["pointerout","pointerover"]),ga("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ga("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ga("onBeforeInput",["compositionend","keypress","textInput","paste"]),ga("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ga("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ga("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var pu="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(" "),$5=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(pu));function Jb(n,l){l=(l&4)!==0;for(var c=0;c<n.length;c++){var v=n[c],x=v.event;v=v.listeners;e:{var w=void 0;if(l)for(var O=v.length-1;0<=O;O--){var V=v[O],te=V.instance,fe=V.currentTarget;if(V=V.listener,te!==w&&x.isPropagationStopped())break e;w=V,x.currentTarget=fe;try{w(x)}catch(be){Ic(be)}x.currentTarget=null,w=te}else for(O=0;O<v.length;O++){if(V=v[O],te=V.instance,fe=V.currentTarget,V=V.listener,te!==w&&x.isPropagationStopped())break e;w=V,x.currentTarget=fe;try{w(x)}catch(be){Ic(be)}x.currentTarget=null,w=te}}}}function vt(n,l){var c=l[Tr];c===void 0&&(c=l[Tr]=new Set);var v=n+"__bubble";c.has(v)||(e1(l,n,2,!1),c.add(v))}function ap(n,l,c){var v=0;l&&(v|=4),e1(c,n,v,l)}var jf="_reactListening"+Math.random().toString(36).slice(2);function np(n){if(!n[jf]){n[jf]=!0,Dc.forEach(function(c){c!=="selectionchange"&&($5.has(c)||ap(c,!1,n),ap(c,!0,n))});var l=n.nodeType===9?n:n.ownerDocument;l===null||l[jf]||(l[jf]=!0,ap("selectionchange",!1,l))}}function e1(n,l,c,v){switch(D1(l)){case 2:var x=TA;break;case 8:x=CA;break;default:x=xp}c=x.bind(null,l,c,n),x=void 0,!Th||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(x=!0),v?x!==void 0?n.addEventListener(l,c,{capture:!0,passive:x}):n.addEventListener(l,c,!0):x!==void 0?n.addEventListener(l,c,{passive:x}):n.addEventListener(l,c,!1)}function ip(n,l,c,v,x){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 V=v.stateNode.containerInfo;if(V===x)break;if(O===4)for(O=v.return;O!==null;){var te=O.tag;if((te===3||te===4)&&O.stateNode.containerInfo===x)return;O=O.return}for(;V!==null;){if(O=Wn(V),O===null)return;if(te=O.tag,te===5||te===6||te===26||te===27){v=w=O;continue e}V=V.parentNode}}v=v.return}iy(function(){var fe=w,be=Sh(c),Te=[];e:{var he=ky.get(n);if(he!==void 0){var me=Pc,Fe=n;switch(n){case"keypress":if(zc(c)===0)break e;case"keydown":case"keyup":me=FN;break;case"focusin":Fe="focus",me=jh;break;case"focusout":Fe="blur",me=jh;break;case"beforeblur":case"afterblur":me=jh;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":me=oy;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":me=MN;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":me=QN;break;case Dy:case Oy:case My:me=BN;break;case Ry:me=KN;break;case"scroll":case"scrollend":me=DN;break;case"wheel":me=$N;break;case"copy":case"cut":case"paste":me=zN;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":me=cy;break;case"toggle":case"beforetoggle":me=WN}var We=(l&4)!==0,Lt=!We&&(n==="scroll"||n==="scrollend"),se=We?he!==null?he+"Capture":null:he;We=[];for(var ie=fe,ce;ie!==null;){var Ee=ie;if(ce=Ee.stateNode,Ee=Ee.tag,Ee!==5&&Ee!==26&&Ee!==27||ce===null||se===null||(Ee=_o(ie,se),Ee!=null&&We.push(gu(ie,Ee,ce))),Lt)break;ie=ie.return}0<We.length&&(he=new me(he,Fe,null,c,be),Te.push({event:he,listeners:We}))}}if((l&7)===0){e:{if(he=n==="mouseover"||n==="pointerover",me=n==="mouseout"||n==="pointerout",he&&c!==wh&&(Fe=c.relatedTarget||c.fromElement)&&(Wn(Fe)||Fe[aa]))break e;if((me||he)&&(he=be.window===be?be:(he=be.ownerDocument)?he.defaultView||he.parentWindow:window,me?(Fe=c.relatedTarget||c.toElement,me=fe,Fe=Fe?Wn(Fe):null,Fe!==null&&(Lt=s(Fe),We=Fe.tag,Fe!==Lt||We!==5&&We!==27&&We!==6)&&(Fe=null)):(me=null,Fe=fe),me!==Fe)){if(We=oy,Ee="onMouseLeave",se="onMouseEnter",ie="mouse",(n==="pointerout"||n==="pointerover")&&(We=cy,Ee="onPointerLeave",se="onPointerEnter",ie="pointer"),Lt=me==null?he:cs(me),ce=Fe==null?he:cs(Fe),he=new We(Ee,ie+"leave",me,c,be),he.target=Lt,he.relatedTarget=ce,Ee=null,Wn(be)===fe&&(We=new We(se,ie+"enter",Fe,c,be),We.target=ce,We.relatedTarget=Lt,Ee=We),Lt=Ee,me&&Fe)t:{for(We=Z5,se=me,ie=Fe,ce=0,Ee=se;Ee;Ee=We(Ee))ce++;Ee=0;for(var $e=ie;$e;$e=We($e))Ee++;for(;0<ce-Ee;)se=We(se),ce--;for(;0<Ee-ce;)ie=We(ie),Ee--;for(;ce--;){if(se===ie||ie!==null&&se===ie.alternate){We=se;break t}se=We(se),ie=We(ie)}We=null}else We=null;me!==null&&t1(Te,he,me,We,!1),Fe!==null&&Lt!==null&&t1(Te,Lt,Fe,We,!0)}}e:{if(he=fe?cs(fe):window,me=he.nodeName&&he.nodeName.toLowerCase(),me==="select"||me==="input"&&he.type==="file")var wt=yy;else if(gy(he))if(xy)wt=o5;else{wt=s5;var Qe=i5}else me=he.nodeName,!me||me.toLowerCase()!=="input"||he.type!=="checkbox"&&he.type!=="radio"?fe&&bh(fe.elementType)&&(wt=yy):wt=l5;if(wt&&(wt=wt(n,fe))){my(Te,wt,c,be);break e}Qe&&Qe(n,he,fe),n==="focusout"&&fe&&he.type==="number"&&fe.memoizedProps.value!=null&&xh(he,"number",he.value)}switch(Qe=fe?cs(fe):window,n){case"focusin":(gy(Qe)||Qe.contentEditable==="true")&&(dl=Qe,Bh=fe,Go=null);break;case"focusout":Go=Bh=dl=null;break;case"mousedown":Lh=!0;break;case"contextmenu":case"mouseup":case"dragend":Lh=!1,Ay(Te,c,be);break;case"selectionchange":if(c5)break;case"keydown":case"keyup":Ay(Te,c,be)}var ut;if(Oh)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 fl?vy(n,c)&&(gt="onCompositionEnd"):n==="keydown"&&c.keyCode===229&&(gt="onCompositionStart");gt&&(fy&&c.locale!=="ko"&&(fl||gt!=="onCompositionStart"?gt==="onCompositionEnd"&&fl&&(ut=sy()):(ri=be,Ch="value"in ri?ri.value:ri.textContent,fl=!0)),Qe=Df(fe,gt),0<Qe.length&&(gt=new uy(gt,n,null,c,be),Te.push({event:gt,listeners:Qe}),ut?gt.data=ut:(ut=py(c),ut!==null&&(gt.data=ut)))),(ut=e5?t5(n,c):r5(n,c))&&(gt=Df(fe,"onBeforeInput"),0<gt.length&&(Qe=new uy("onBeforeInput","beforeinput",null,c,be),Te.push({event:Qe,listeners:gt}),Qe.data=ut)),Y5(Te,n,fe,c,be)}Jb(Te,l)})}function gu(n,l,c){return{instance:n,listener:l,currentTarget:c}}function Df(n,l){for(var c=l+"Capture",v=[];n!==null;){var x=n,w=x.stateNode;if(x=x.tag,x!==5&&x!==26&&x!==27||w===null||(x=_o(n,c),x!=null&&v.unshift(gu(n,x,w)),x=_o(n,l),x!=null&&v.push(gu(n,x,w))),n.tag===3)return v;n=n.return}return[]}function Z5(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function t1(n,l,c,v,x){for(var w=l._reactName,O=[];c!==null&&c!==v;){var V=c,te=V.alternate,fe=V.stateNode;if(V=V.tag,te!==null&&te===v)break;V!==5&&V!==26&&V!==27||fe===null||(te=fe,x?(fe=_o(c,w),fe!=null&&O.unshift(gu(c,fe,te))):x||(fe=_o(c,w),fe!=null&&O.push(gu(c,fe,te)))),c=c.return}O.length!==0&&n.push({event:l,listeners:O})}var W5=/\r\n?/g,J5=/\u0000|\uFFFD/g;function r1(n){return(typeof n=="string"?n:""+n).replace(W5,`
|
|
49
|
+
`).replace(J5,"")}function a1(n,l){return l=r1(l),r1(n)===l}function Bt(n,l,c,v,x,w){switch(c){case"children":typeof v=="string"?l==="body"||l==="textarea"&&v===""||ol(n,v):(typeof v=="number"||typeof v=="bigint")&&l!=="body"&&ol(n,""+v);break;case"className":ti(n,"class",v);break;case"tabIndex":ti(n,"tabindex",v);break;case"dir":case"role":case"viewBox":case"width":case"height":ti(n,c,v);break;case"style":ay(n,v,w);break;case"data":if(l!=="object"){ti(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=Bc(""+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",x.name,x,null),Bt(n,l,"formEncType",x.formEncType,x,null),Bt(n,l,"formMethod",x.formMethod,x,null),Bt(n,l,"formTarget",x.formTarget,x,null)):(Bt(n,l,"encType",x.encType,x,null),Bt(n,l,"method",x.method,x,null),Bt(n,l,"target",x.target,x,null)));if(v==null||typeof v=="symbol"||typeof v=="boolean"){n.removeAttribute(c);break}v=Bc(""+v),n.setAttribute(c,v);break;case"onClick":v!=null&&(n.onclick=wn);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(a(61));if(c=v.__html,c!=null){if(x.children!=null)throw Error(a(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=Bc(""+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),Hr(n,"popover",v);break;case"xlinkActuate":Oa(n,"http://www.w3.org/1999/xlink","xlink:actuate",v);break;case"xlinkArcrole":Oa(n,"http://www.w3.org/1999/xlink","xlink:arcrole",v);break;case"xlinkRole":Oa(n,"http://www.w3.org/1999/xlink","xlink:role",v);break;case"xlinkShow":Oa(n,"http://www.w3.org/1999/xlink","xlink:show",v);break;case"xlinkTitle":Oa(n,"http://www.w3.org/1999/xlink","xlink:title",v);break;case"xlinkType":Oa(n,"http://www.w3.org/1999/xlink","xlink:type",v);break;case"xmlBase":Oa(n,"http://www.w3.org/XML/1998/namespace","xml:base",v);break;case"xmlLang":Oa(n,"http://www.w3.org/XML/1998/namespace","xml:lang",v);break;case"xmlSpace":Oa(n,"http://www.w3.org/XML/1998/namespace","xml:space",v);break;case"is":Hr(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=AN.get(c)||c,Hr(n,c,v))}}function sp(n,l,c,v,x,w){switch(c){case"style":ay(n,v,w);break;case"dangerouslySetInnerHTML":if(v!=null){if(typeof v!="object"||!("__html"in v))throw Error(a(61));if(c=v.__html,c!=null){if(x.children!=null)throw Error(a(60));n.innerHTML=c}}break;case"children":typeof v=="string"?ol(n,v):(typeof v=="number"||typeof v=="bigint")&&ol(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=wn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Oc.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(x=c.endsWith("Capture"),l=c.slice(2,x?c.length-7:void 0),w=n[mr]||null,w=w!=null?w[c]:null,typeof w=="function"&&n.removeEventListener(l,w,x),typeof v=="function")){typeof w!="function"&&w!==null&&(c in n?n[c]=null:n.hasAttribute(c)&&n.removeAttribute(c)),n.addEventListener(l,v,x);break e}c in n?n[c]=v:v===!0?n.setAttribute(c,""):Hr(n,c,v)}}}function _r(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,x=!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":x=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,l));default:Bt(n,l,w,O,c,null)}}x&&Bt(n,l,"srcSet",c.srcSet,c,null),v&&Bt(n,l,"src",c.src,c,null);return;case"input":vt("invalid",n);var V=w=O=x=null,te=null,fe=null;for(v in c)if(c.hasOwnProperty(v)){var be=c[v];if(be!=null)switch(v){case"name":x=be;break;case"type":O=be;break;case"checked":te=be;break;case"defaultChecked":fe=be;break;case"value":w=be;break;case"defaultValue":V=be;break;case"children":case"dangerouslySetInnerHTML":if(be!=null)throw Error(a(137,l));break;default:Bt(n,l,v,be,c,null)}}J0(n,w,V,te,fe,O,x,!1);return;case"select":vt("invalid",n),v=O=w=null;for(x in c)if(c.hasOwnProperty(x)&&(V=c[x],V!=null))switch(x){case"value":w=V;break;case"defaultValue":O=V;break;case"multiple":v=V;default:Bt(n,l,x,V,c,null)}l=w,c=O,n.multiple=!!v,l!=null?ll(n,!!v,l,!1):c!=null&&ll(n,!!v,c,!0);return;case"textarea":vt("invalid",n),w=x=v=null;for(O in c)if(c.hasOwnProperty(O)&&(V=c[O],V!=null))switch(O){case"value":v=V;break;case"defaultValue":x=V;break;case"children":w=V;break;case"dangerouslySetInnerHTML":if(V!=null)throw Error(a(91));break;default:Bt(n,l,O,V,c,null)}ty(n,v,x,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<pu.length;v++)vt(pu[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(a(137,l));default:Bt(n,l,fe,v,c,null)}return;default:if(bh(l)){for(be in c)c.hasOwnProperty(be)&&(v=c[be],v!==void 0&&sp(n,l,be,v,c,void 0));return}}for(V in c)c.hasOwnProperty(V)&&(v=c[V],v!=null&&Bt(n,l,V,v,c,null))}function eA(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 x=null,w=null,O=null,V=null,te=null,fe=null,be=null;for(me in c){var Te=c[me];if(c.hasOwnProperty(me)&&Te!=null)switch(me){case"checked":break;case"value":break;case"defaultValue":te=Te;default:v.hasOwnProperty(me)||Bt(n,l,me,null,v,Te)}}for(var he in v){var me=v[he];if(Te=c[he],v.hasOwnProperty(he)&&(me!=null||Te!=null))switch(he){case"type":w=me;break;case"name":x=me;break;case"checked":fe=me;break;case"defaultChecked":be=me;break;case"value":O=me;break;case"defaultValue":V=me;break;case"children":case"dangerouslySetInnerHTML":if(me!=null)throw Error(a(137,l));break;default:me!==Te&&Bt(n,l,he,me,v,Te)}}yh(n,O,V,te,fe,be,w,x);return;case"select":me=O=V=he=null;for(w in c)if(te=c[w],c.hasOwnProperty(w)&&te!=null)switch(w){case"value":break;case"multiple":me=te;default:v.hasOwnProperty(w)||Bt(n,l,w,null,v,te)}for(x in v)if(w=v[x],te=c[x],v.hasOwnProperty(x)&&(w!=null||te!=null))switch(x){case"value":he=w;break;case"defaultValue":V=w;break;case"multiple":O=w;default:w!==te&&Bt(n,l,x,w,v,te)}l=V,c=O,v=me,he!=null?ll(n,!!c,he,!1):!!v!=!!c&&(l!=null?ll(n,!!c,l,!0):ll(n,!!c,c?[]:"",!1));return;case"textarea":me=he=null;for(V in c)if(x=c[V],c.hasOwnProperty(V)&&x!=null&&!v.hasOwnProperty(V))switch(V){case"value":break;case"children":break;default:Bt(n,l,V,null,v,x)}for(O in v)if(x=v[O],w=c[O],v.hasOwnProperty(O)&&(x!=null||w!=null))switch(O){case"value":he=x;break;case"defaultValue":me=x;break;case"children":break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(a(91));break;default:x!==w&&Bt(n,l,O,x,v,w)}ey(n,he,me);return;case"option":for(var Fe in c)if(he=c[Fe],c.hasOwnProperty(Fe)&&he!=null&&!v.hasOwnProperty(Fe))switch(Fe){case"selected":n.selected=!1;break;default:Bt(n,l,Fe,null,v,he)}for(te in v)if(he=v[te],me=c[te],v.hasOwnProperty(te)&&he!==me&&(he!=null||me!=null))switch(te){case"selected":n.selected=he&&typeof he!="function"&&typeof he!="symbol";break;default:Bt(n,l,te,he,v,me)}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 We in c)he=c[We],c.hasOwnProperty(We)&&he!=null&&!v.hasOwnProperty(We)&&Bt(n,l,We,null,v,he);for(fe in v)if(he=v[fe],me=c[fe],v.hasOwnProperty(fe)&&he!==me&&(he!=null||me!=null))switch(fe){case"children":case"dangerouslySetInnerHTML":if(he!=null)throw Error(a(137,l));break;default:Bt(n,l,fe,he,v,me)}return;default:if(bh(l)){for(var Lt in c)he=c[Lt],c.hasOwnProperty(Lt)&&he!==void 0&&!v.hasOwnProperty(Lt)&&sp(n,l,Lt,void 0,v,he);for(be in v)he=v[be],me=c[be],!v.hasOwnProperty(be)||he===me||he===void 0&&me===void 0||sp(n,l,be,he,v,me);return}}for(var se in c)he=c[se],c.hasOwnProperty(se)&&he!=null&&!v.hasOwnProperty(se)&&Bt(n,l,se,null,v,he);for(Te in v)he=v[Te],me=c[Te],!v.hasOwnProperty(Te)||he===me||he==null&&me==null||Bt(n,l,Te,he,v,me)}function n1(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function tA(){if(typeof performance.getEntriesByType=="function"){for(var n=0,l=0,c=performance.getEntriesByType("resource"),v=0;v<c.length;v++){var x=c[v],w=x.transferSize,O=x.initiatorType,V=x.duration;if(w&&V&&n1(O)){for(O=0,V=x.responseEnd,v+=1;v<c.length;v++){var te=c[v],fe=te.startTime;if(fe>V)break;var be=te.transferSize,Te=te.initiatorType;be&&n1(Te)&&(te=te.responseEnd,O+=be*(te<V?1:(V-fe)/(te-fe)))}if(--v,l+=8*(w+O)/(x.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 lp=null,op=null;function Of(n){return n.nodeType===9?n:n.ownerDocument}function i1(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 s1(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 up(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 cp=null;function rA(){var n=window.event;return n&&n.type==="popstate"?n===cp?!1:(cp=n,!0):(cp=null,!1)}var l1=typeof setTimeout=="function"?setTimeout:void 0,aA=typeof clearTimeout=="function"?clearTimeout:void 0,o1=typeof Promise=="function"?Promise:void 0,nA=typeof queueMicrotask=="function"?queueMicrotask:typeof o1<"u"?function(n){return o1.resolve(null).then(n).catch(iA)}:l1;function iA(n){setTimeout(function(){throw n})}function xi(n){return n==="head"}function u1(n,l){var c=l,v=0;do{var x=c.nextSibling;if(n.removeChild(c),x&&x.nodeType===8)if(c=x.data,c==="/$"||c==="/&"){if(v===0){n.removeChild(x),Ul(l);return}v--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")v++;else if(c==="html")mu(n.ownerDocument.documentElement);else if(c==="head"){c=n.ownerDocument.head,mu(c);for(var w=c.firstChild;w;){var O=w.nextSibling,V=w.nodeName;w[Nr]||V==="SCRIPT"||V==="STYLE"||V==="LINK"&&w.rel.toLowerCase()==="stylesheet"||c.removeChild(w),w=O}}else c==="body"&&mu(n.ownerDocument.body);c=x}while(c);Ul(l)}function c1(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 fp(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":fp(c),il(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}n.removeChild(c)}}function sA(n,l,c,v){for(;n.nodeType===1;){var x=c;if(n.nodeName.toLowerCase()!==l.toLowerCase()){if(!v&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(v){if(!n[Nr])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!==x.rel||n.getAttribute("href")!==(x.href==null||x.href===""?null:x.href)||n.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin)||n.getAttribute("title")!==(x.title==null?null:x.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(w=n.getAttribute("src"),(w!==(x.src==null?null:x.src)||n.getAttribute("type")!==(x.type==null?null:x.type)||n.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin))&&w&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(l==="input"&&n.type==="hidden"){var w=x.name==null?null:""+x.name;if(x.type==="hidden"&&n.getAttribute("name")===w)return n}else return n;if(n=Pa(n.nextSibling),n===null)break}return null}function lA(n,l,c){if(l==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!c||(n=Pa(n.nextSibling),n===null))return null;return n}function f1(n,l){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!l||(n=Pa(n.nextSibling),n===null))return null;return n}function dp(n){return n.data==="$?"||n.data==="$~"}function hp(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function oA(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 Pa(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 vp=null;function d1(n){n=n.nextSibling;for(var l=0;n;){if(n.nodeType===8){var c=n.data;if(c==="/$"||c==="/&"){if(l===0)return Pa(n.nextSibling);l--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||l++}n=n.nextSibling}return null}function h1(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 v1(n,l,c){switch(l=Of(c),n){case"html":if(n=l.documentElement,!n)throw Error(a(452));return n;case"head":if(n=l.head,!n)throw Error(a(453));return n;case"body":if(n=l.body,!n)throw Error(a(454));return n;default:throw Error(a(451))}}function mu(n){for(var l=n.attributes;l.length;)n.removeAttributeNode(l[0]);il(n)}var Ua=new Map,p1=new Set;function Mf(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var _n=z.d;z.d={f:uA,r:cA,D:fA,C:dA,L:hA,m:vA,X:gA,S:pA,M:mA};function uA(){var n=_n.f(),l=Sf();return n||l}function cA(n){var l=Jn(n);l!==null&&l.tag===5&&l.type==="form"?Rx(l):_n.r(n)}var zl=typeof document>"u"?null:document;function g1(n,l,c){var v=zl;if(v&&typeof l=="string"&&l){var x=Ma(l);x='link[rel="'+n+'"][href="'+x+'"]',typeof c=="string"&&(x+='[crossorigin="'+c+'"]'),p1.has(x)||(p1.add(x),n={rel:n,crossOrigin:c,href:l},v.querySelector(x)===null&&(l=v.createElement("link"),_r(l,"link",n),ur(l),v.head.appendChild(l)))}}function fA(n){_n.D(n),g1("dns-prefetch",n,null)}function dA(n,l){_n.C(n,l),g1("preconnect",n,l)}function hA(n,l,c){_n.L(n,l,c);var v=zl;if(v&&n&&l){var x='link[rel="preload"][as="'+Ma(l)+'"]';l==="image"&&c&&c.imageSrcSet?(x+='[imagesrcset="'+Ma(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(x+='[imagesizes="'+Ma(c.imageSizes)+'"]')):x+='[href="'+Ma(n)+'"]';var w=x;switch(l){case"style":w=_l(n);break;case"script":w=Pl(n)}Ua.has(w)||(n=p({rel:"preload",href:l==="image"&&c&&c.imageSrcSet?void 0:n,as:l},c),Ua.set(w,n),v.querySelector(x)!==null||l==="style"&&v.querySelector(yu(w))||l==="script"&&v.querySelector(xu(w))||(l=v.createElement("link"),_r(l,"link",n),ur(l),v.head.appendChild(l)))}}function vA(n,l){_n.m(n,l);var c=zl;if(c&&n){var v=l&&typeof l.as=="string"?l.as:"script",x='link[rel="modulepreload"][as="'+Ma(v)+'"][href="'+Ma(n)+'"]',w=x;switch(v){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":w=Pl(n)}if(!Ua.has(w)&&(n=p({rel:"modulepreload",href:n},l),Ua.set(w,n),c.querySelector(x)===null)){switch(v){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(xu(w)))return}v=c.createElement("link"),_r(v,"link",n),ur(v),c.head.appendChild(v)}}}function pA(n,l,c){_n.S(n,l,c);var v=zl;if(v&&n){var x=ei(v).hoistableStyles,w=_l(n);l=l||"default";var O=x.get(w);if(!O){var V={loading:0,preload:null};if(O=v.querySelector(yu(w)))V.loading=5;else{n=p({rel:"stylesheet",href:n,"data-precedence":l},c),(c=Ua.get(w))&&pp(n,c);var te=O=v.createElement("link");ur(te),_r(te,"link",n),te._p=new Promise(function(fe,be){te.onload=fe,te.onerror=be}),te.addEventListener("load",function(){V.loading|=1}),te.addEventListener("error",function(){V.loading|=2}),V.loading|=4,Rf(O,l,v)}O={type:"stylesheet",instance:O,count:1,state:V},x.set(w,O)}}}function gA(n,l){_n.X(n,l);var c=zl;if(c&&n){var v=ei(c).hoistableScripts,x=Pl(n),w=v.get(x);w||(w=c.querySelector(xu(x)),w||(n=p({src:n,async:!0},l),(l=Ua.get(x))&&gp(n,l),w=c.createElement("script"),ur(w),_r(w,"link",n),c.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},v.set(x,w))}}function mA(n,l){_n.M(n,l);var c=zl;if(c&&n){var v=ei(c).hoistableScripts,x=Pl(n),w=v.get(x);w||(w=c.querySelector(xu(x)),w||(n=p({src:n,async:!0,type:"module"},l),(l=Ua.get(x))&&gp(n,l),w=c.createElement("script"),ur(w),_r(w,"link",n),c.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},v.set(x,w))}}function m1(n,l,c,v){var x=(x=ee.current)?Mf(x):null;if(!x)throw Error(a(446));switch(n){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(l=_l(c.href),c=ei(x).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=_l(c.href);var w=ei(x).hoistableStyles,O=w.get(n);if(O||(x=x.ownerDocument||x,O={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},w.set(n,O),(w=x.querySelector(yu(n)))&&!w._p&&(O.instance=w,O.state.loading=5),Ua.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},Ua.set(n,c),w||yA(x,n,c,O.state))),l&&v===null)throw Error(a(528,""));return O}if(l&&v!==null)throw Error(a(529,""));return null;case"script":return l=c.async,c=c.src,typeof c=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=Pl(c),c=ei(x).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(a(444,n))}}function _l(n){return'href="'+Ma(n)+'"'}function yu(n){return'link[rel="stylesheet"]['+n+"]"}function y1(n){return p({},n,{"data-precedence":n.precedence,precedence:null})}function yA(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}),_r(l,"link",c),ur(l),n.head.appendChild(l))}function Pl(n){return'[src="'+Ma(n)+'"]'}function xu(n){return"script[async]"+n}function x1(n,l,c){if(l.count++,l.instance===null)switch(l.type){case"style":var v=n.querySelector('style[data-href~="'+Ma(c.href)+'"]');if(v)return l.instance=v,ur(v),v;var x=p({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return v=(n.ownerDocument||n).createElement("style"),ur(v),_r(v,"style",x),Rf(v,c.precedence,n),l.instance=v;case"stylesheet":x=_l(c.href);var w=n.querySelector(yu(x));if(w)return l.state.loading|=4,l.instance=w,ur(w),w;v=y1(c),(x=Ua.get(x))&&pp(v,x),w=(n.ownerDocument||n).createElement("link"),ur(w);var O=w;return O._p=new Promise(function(V,te){O.onload=V,O.onerror=te}),_r(w,"link",v),l.state.loading|=4,Rf(w,c.precedence,n),l.instance=w;case"script":return w=Pl(c.src),(x=n.querySelector(xu(w)))?(l.instance=x,ur(x),x):(v=c,(x=Ua.get(w))&&(v=p({},c),gp(v,x)),n=n.ownerDocument||n,x=n.createElement("script"),ur(x),_r(x,"link",v),n.head.appendChild(x),l.instance=x);case"void":return null;default:throw Error(a(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(v=l.instance,l.state.loading|=4,Rf(v,c.precedence,n));return l.instance}function Rf(n,l,c){for(var v=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),x=v.length?v[v.length-1]:null,w=x,O=0;O<v.length;O++){var V=v[O];if(V.dataset.precedence===l)w=V;else if(w!==x)break}w?w.parentNode.insertBefore(n,w.nextSibling):(l=c.nodeType===9?c.head:c,l.insertBefore(n,l.firstChild))}function pp(n,l){n.crossOrigin==null&&(n.crossOrigin=l.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=l.referrerPolicy),n.title==null&&(n.title=l.title)}function gp(n,l){n.crossOrigin==null&&(n.crossOrigin=l.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=l.referrerPolicy),n.integrity==null&&(n.integrity=l.integrity)}var kf=null;function b1(n,l,c){if(kf===null){var v=new Map,x=kf=new Map;x.set(c,v)}else x=kf,v=x.get(c),v||(v=new Map,x.set(c,v));if(v.has(n))return v;for(v.set(n,null),c=c.getElementsByTagName(n),x=0;x<c.length;x++){var w=c[x];if(!(w[Nr]||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 V=v.get(O);V?V.push(w):v.set(O,[w])}}return v}function w1(n,l,c){n=n.ownerDocument||n,n.head.insertBefore(c,l==="title"?n.querySelector("head > title"):null)}function xA(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 S1(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function bA(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 x=_l(v.href),w=l.querySelector(yu(x));if(w){l=w._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(n.count++,n=Bf.bind(n),l.then(n,n)),c.state.loading|=4,c.instance=w,ur(w);return}w=l.ownerDocument||l,v=y1(v),(x=Ua.get(x))&&pp(v,x),w=w.createElement("link"),ur(w);var O=w;O._p=new Promise(function(V,te){O.onload=V,O.onerror=te}),_r(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=Bf.bind(n),l.addEventListener("load",c),l.addEventListener("error",c))}}var mp=0;function wA(n,l){return n.stylesheets&&n.count===0&&zf(n,n.stylesheets),0<n.count||0<n.imgCount?function(c){var v=setTimeout(function(){if(n.stylesheets&&zf(n,n.stylesheets),n.unsuspend){var w=n.unsuspend;n.unsuspend=null,w()}},6e4+l);0<n.imgBytes&&mp===0&&(mp=62500*tA());var x=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&zf(n,n.stylesheets),n.unsuspend)){var w=n.unsuspend;n.unsuspend=null,w()}},(n.imgBytes>mp?50:800)+l);return n.unsuspend=c,function(){n.unsuspend=null,clearTimeout(v),clearTimeout(x)}}:null}function Bf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)zf(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var Lf=null;function zf(n,l){n.stylesheets=null,n.unsuspend!==null&&(n.count++,Lf=new Map,l.forEach(SA,n),Lf=null,Bf.call(n))}function SA(n,l){if(!(l.state.loading&4)){var c=Lf.get(n);if(c)var v=c.get(null);else{c=new Map,Lf.set(n,c);for(var x=n.querySelectorAll("link[data-precedence],style[data-precedence]"),w=0;w<x.length;w++){var O=x[w];(O.nodeName==="LINK"||O.getAttribute("media")!=="not all")&&(c.set(O.dataset.precedence,O),v=O)}v&&c.set(null,v)}x=l.instance,O=x.getAttribute("data-precedence"),w=c.get(O)||v,w===v&&c.set(null,x),c.set(O,x),this.count++,v=Bf.bind(this),x.addEventListener("load",v),x.addEventListener("error",v),w?w.parentNode.insertBefore(x,w.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(x,n.firstChild)),l.state.loading|=4}}var bu={$$typeof:N,Provider:null,Consumer:null,_currentValue:H,_currentValue2:H,_threadCount:0};function EA(n,l,c,v,x,w,O,V,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=x,this.onCaughtError=w,this.onRecoverableError=O,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=te,this.incompleteTransitions=new Map}function E1(n,l,c,v,x,w,O,V,te,fe,be,Te){return n=new EA(n,l,c,O,te,fe,be,Te,V),l=1,w===!0&&(l|=24),w=ya(3,null,null,l),n.current=w,w.stateNode=n,l=$h(),l.refCount++,n.pooledCache=l,l.refCount++,w.memoizedState={element:v,isDehydrated:c,cache:l},ev(w),n}function T1(n){return n?(n=pl,n):pl}function C1(n,l,c,v,x,w){x=T1(x),v.context===null?v.context=x:v.pendingContext=x,v=oi(l),v.payload={element:c},w=w===void 0?null:w,w!==null&&(v.callback=w),c=ui(n,v,l),c!==null&&(ca(c,n,l),Wo(c,n,l))}function N1(n,l){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var c=n.retryLane;n.retryLane=c!==0&&c<l?c:l}}function yp(n,l){N1(n,l),(n=n.alternate)&&N1(n,l)}function A1(n){if(n.tag===13||n.tag===31){var l=vs(n,67108864);l!==null&&ca(l,n,67108864),yp(n,67108864)}}function j1(n){if(n.tag===13||n.tag===31){var l=Ea();l=ir(l);var c=vs(n,l);c!==null&&ca(c,n,l),yp(n,l)}}var _f=!0;function TA(n,l,c,v){var x=U.T;U.T=null;var w=z.p;try{z.p=2,xp(n,l,c,v)}finally{z.p=w,U.T=x}}function CA(n,l,c,v){var x=U.T;U.T=null;var w=z.p;try{z.p=8,xp(n,l,c,v)}finally{z.p=w,U.T=x}}function xp(n,l,c,v){if(_f){var x=bp(v);if(x===null)ip(n,l,v,Pf,c),O1(n,v);else if(AA(x,n,l,c,v))v.stopPropagation();else if(O1(n,v),l&4&&-1<NA.indexOf(n)){for(;x!==null;){var w=Jn(x);if(w!==null)switch(w.tag){case 3:if(w=w.stateNode,w.current.memoizedState.isDehydrated){var O=nt(w.pendingLanes);if(O!==0){var V=w;for(V.pendingLanes|=2,V.entangledLanes|=2;O;){var te=1<<31-pe(O);V.entanglements[1]|=te,O&=~te}on(w),(Ct&6)===0&&(bf=Re()+500,vu(0))}}break;case 31:case 13:V=vs(w,2),V!==null&&ca(V,w,2),Sf(),yp(w,2)}if(w=bp(v),w===null&&ip(n,l,v,Pf,c),w===x)break;x=w}x!==null&&v.stopPropagation()}else ip(n,l,v,null,c)}}function bp(n){return n=Sh(n),wp(n)}var Pf=null;function wp(n){if(Pf=null,n=Wn(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 Pf=n,null}function D1(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(ye()){case Ge:return 2;case rt:return 8;case at:case ct:return 32;case et:return 268435456;default:return 32}default:return 32}}var Sp=!1,bi=null,wi=null,Si=null,wu=new Map,Su=new Map,Ei=[],NA="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 O1(n,l){switch(n){case"focusin":case"focusout":bi=null;break;case"dragenter":case"dragleave":wi=null;break;case"mouseover":case"mouseout":Si=null;break;case"pointerover":case"pointerout":wu.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":Su.delete(l.pointerId)}}function Eu(n,l,c,v,x,w){return n===null||n.nativeEvent!==w?(n={blockedOn:l,domEventName:c,eventSystemFlags:v,nativeEvent:w,targetContainers:[x]},l!==null&&(l=Jn(l),l!==null&&A1(l)),n):(n.eventSystemFlags|=v,l=n.targetContainers,x!==null&&l.indexOf(x)===-1&&l.push(x),n)}function AA(n,l,c,v,x){switch(l){case"focusin":return bi=Eu(bi,n,l,c,v,x),!0;case"dragenter":return wi=Eu(wi,n,l,c,v,x),!0;case"mouseover":return Si=Eu(Si,n,l,c,v,x),!0;case"pointerover":var w=x.pointerId;return wu.set(w,Eu(wu.get(w)||null,n,l,c,v,x)),!0;case"gotpointercapture":return w=x.pointerId,Su.set(w,Eu(Su.get(w)||null,n,l,c,v,x)),!0}return!1}function M1(n){var l=Wn(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,Da(n.priority,function(){j1(c)});return}}else if(l===31){if(l=u(c),l!==null){n.blockedOn=l,Da(n.priority,function(){j1(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 Uf(n){if(n.blockedOn!==null)return!1;for(var l=n.targetContainers;0<l.length;){var c=bp(n.nativeEvent);if(c===null){c=n.nativeEvent;var v=new c.constructor(c.type,c);wh=v,c.target.dispatchEvent(v),wh=null}else return l=Jn(c),l!==null&&A1(l),n.blockedOn=c,!1;l.shift()}return!0}function R1(n,l,c){Uf(n)&&c.delete(l)}function jA(){Sp=!1,bi!==null&&Uf(bi)&&(bi=null),wi!==null&&Uf(wi)&&(wi=null),Si!==null&&Uf(Si)&&(Si=null),wu.forEach(R1),Su.forEach(R1)}function qf(n,l){n.blockedOn===l&&(n.blockedOn=null,Sp||(Sp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,jA)))}var If=null;function k1(n){If!==n&&(If=n,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){If===n&&(If=null);for(var l=0;l<n.length;l+=3){var c=n[l],v=n[l+1],x=n[l+2];if(typeof v!="function"){if(wp(v||c)===null)continue;break}var w=Jn(c);w!==null&&(n.splice(l,3),l-=3,bv(w,{pending:!0,data:x,method:c.method,action:v},v,x))}}))}function Ul(n){function l(te){return qf(te,n)}bi!==null&&qf(bi,n),wi!==null&&qf(wi,n),Si!==null&&qf(Si,n),wu.forEach(l),Su.forEach(l);for(var c=0;c<Ei.length;c++){var v=Ei[c];v.blockedOn===n&&(v.blockedOn=null)}for(;0<Ei.length&&(c=Ei[0],c.blockedOn===null);)M1(c),c.blockedOn===null&&Ei.shift();if(c=(n.ownerDocument||n).$$reactFormReplay,c!=null)for(v=0;v<c.length;v+=3){var x=c[v],w=c[v+1],O=x[mr]||null;if(typeof w=="function")O||k1(c);else if(O){var V=null;if(w&&w.hasAttribute("formAction")){if(x=w,O=w[mr]||null)V=O.formAction;else if(wp(x)!==null)continue}else V=O.action;typeof V=="function"?c[v+1]=V:(c.splice(v,3),v-=3),k1(c)}}}function B1(){function n(w){w.canIntercept&&w.info==="react-transition"&&w.intercept({handler:function(){return new Promise(function(O){return x=O})},focusReset:"manual",scroll:"manual"})}function l(){x!==null&&(x(),x=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,x=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),x!==null&&(x(),x=null)}}}function Ep(n){this._internalRoot=n}Vf.prototype.render=Ep.prototype.render=function(n){var l=this._internalRoot;if(l===null)throw Error(a(409));var c=l.current,v=Ea();C1(c,v,n,l,null,null)},Vf.prototype.unmount=Ep.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var l=n.containerInfo;C1(n.current,2,null,n,null,null),Sf(),l[aa]=null}};function Vf(n){this._internalRoot=n}Vf.prototype.unstable_scheduleHydration=function(n){if(n){var l=Xt();n={blockedOn:null,target:n,priority:l};for(var c=0;c<Ei.length&&l!==0&&l<Ei[c].priority;c++);Ei.splice(c,0,n),c===0&&M1(n)}};var L1=e.version;if(L1!=="19.2.4")throw Error(a(527,L1,"19.2.4"));z.findDOMNode=function(n){var l=n._reactInternals;if(l===void 0)throw typeof n.render=="function"?Error(a(188)):(n=Object.keys(n).join(","),Error(a(268,n)));return n=d(l),n=n!==null?h(n):null,n=n===null?null:n.stateNode,n};var DA={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:U,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ff=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ff.isDisabled&&Ff.supportsFiber)try{Q=Ff.inject(DA),ue=Ff}catch{}}return Cu.createRoot=function(n,l){if(!i(n))throw Error(a(299));var c=!1,v="",x=Vx,w=Fx,O=Hx;return l!=null&&(l.unstable_strictMode===!0&&(c=!0),l.identifierPrefix!==void 0&&(v=l.identifierPrefix),l.onUncaughtError!==void 0&&(x=l.onUncaughtError),l.onCaughtError!==void 0&&(w=l.onCaughtError),l.onRecoverableError!==void 0&&(O=l.onRecoverableError)),l=E1(n,1,!1,null,null,c,v,null,x,w,O,B1),n[aa]=l.current,np(n),new Ep(l)},Cu.hydrateRoot=function(n,l,c){if(!i(n))throw Error(a(299));var v=!1,x="",w=Vx,O=Fx,V=Hx,te=null;return c!=null&&(c.unstable_strictMode===!0&&(v=!0),c.identifierPrefix!==void 0&&(x=c.identifierPrefix),c.onUncaughtError!==void 0&&(w=c.onUncaughtError),c.onCaughtError!==void 0&&(O=c.onCaughtError),c.onRecoverableError!==void 0&&(V=c.onRecoverableError),c.formState!==void 0&&(te=c.formState)),l=E1(n,1,!0,l,c??null,v,x,te,w,O,V,B1),l.context=T1(null),c=l.current,v=Ea(),v=ir(v),x=oi(v),x.callback=null,ui(c,x,v),c=v,l.current.lanes=c,Rt(l,c),on(l),n[aa]=l.current,np(n),new Vf(l)},Cu.version="19.2.4",Cu}var Q1;function IA(){if(Q1)return jp.exports;Q1=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(),jp.exports=qA(),jp.exports}var VA=IA();const FA=bE(VA);var Td=EE();/**
|
|
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 Vu(){return Vu=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},Vu.apply(this,arguments)}var qi;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(qi||(qi={}));const Y1="popstate";function HA(t){t===void 0&&(t={});function e(a,i){let{pathname:s,search:o,hash:u}=a.location;return vm("",{pathname:s,search:o,hash:u},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function r(a,i){return typeof i=="string"?i:Cd(i)}return QA(e,r,null,t)}function gr(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function c0(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function GA(){return Math.random().toString(36).substr(2,8)}function K1(t,e){return{usr:t.state,key:t.key,idx:e}}function vm(t,e,r,a){return r===void 0&&(r=null),Vu({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?No(e):e,{state:r,key:e&&e.key||a||GA()})}function Cd(t){let{pathname:e="/",search:r="",hash:a=""}=t;return r&&r!=="?"&&(e+=r.charAt(0)==="?"?r:"?"+r),a&&a!=="#"&&(e+=a.charAt(0)==="#"?a:"#"+a),e}function No(t){let e={};if(t){let r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));let a=t.indexOf("?");a>=0&&(e.search=t.substr(a),t=t.substr(0,a)),t&&(e.pathname=t)}return e}function QA(t,e,r,a){a===void 0&&(a={});let{window:i=document.defaultView,v5Compat:s=!1}=a,o=i.history,u=qi.Pop,f=null,d=h();d==null&&(d=0,o.replaceState(Vu({},o.state,{idx:d}),""));function h(){return(o.state||{idx:null}).idx}function p(){u=qi.Pop;let S=h(),T=S==null?null:S-d;d=S,f&&f({action:u,location:E.location,delta:T})}function g(S,T){u=qi.Push;let C=vm(E.location,S,T);d=h()+1;let N=K1(C,d),j=E.createHref(C);try{o.pushState(N,"",j)}catch(M){if(M instanceof DOMException&&M.name==="DataCloneError")throw M;i.location.assign(j)}s&&f&&f({action:u,location:E.location,delta:1})}function y(S,T){u=qi.Replace;let C=vm(E.location,S,T);d=h();let N=K1(C,d),j=E.createHref(C);o.replaceState(N,"",j),s&&f&&f({action:u,location:E.location,delta:0})}function b(S){let T=i.location.origin!=="null"?i.location.origin:i.location.href,C=typeof S=="string"?S:Cd(S);return C=C.replace(/ $/,"%20"),gr(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(f)throw new Error("A history only accepts one active listener");return i.addEventListener(Y1,p),f=S,()=>{i.removeEventListener(Y1,p),f=null}},createHref(S){return e(i,S)},createURL:b,encodeLocation(S){let T=b(S);return{pathname:T.pathname,search:T.search,hash:T.hash}},push:g,replace:y,go(S){return o.go(S)}};return E}var X1;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(X1||(X1={}));function YA(t,e,r){return r===void 0&&(r="/"),KA(t,e,r)}function KA(t,e,r,a){let i=typeof e=="string"?No(e):e,s=f0(i.pathname||"/",r);if(s==null)return null;let o=TE(t);XA(o);let u=null;for(let f=0;u==null&&f<o.length;++f){let d=lj(s);u=nj(o[f],d)}return u}function TE(t,e,r,a){e===void 0&&(e=[]),r===void 0&&(r=[]),a===void 0&&(a="");let i=(s,o,u)=>{let f={relativePath:u===void 0?s.path||"":u,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};f.relativePath.startsWith("/")&&(gr(f.relativePath.startsWith(a),'Absolute route path "'+f.relativePath+'" nested under path '+('"'+a+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),f.relativePath=f.relativePath.slice(a.length));let d=Hi([a,f.relativePath]),h=r.concat(f);s.children&&s.children.length>0&&(gr(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+d+'".')),TE(s.children,e,h,d)),!(s.path==null&&!s.index)&&e.push({path:d,score:rj(d,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 f of CE(s.path))i(s,o,f)}),e}function CE(t){let e=t.split("/");if(e.length===0)return[];let[r,...a]=e,i=r.endsWith("?"),s=r.replace(/\?$/,"");if(a.length===0)return i?[s,""]:[s];let o=CE(a.join("/")),u=[];return u.push(...o.map(f=>f===""?s:[s,f].join("/"))),i&&u.push(...o),u.map(f=>t.startsWith("/")&&f===""?"/":f)}function XA(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:aj(e.routesMeta.map(a=>a.childrenIndex),r.routesMeta.map(a=>a.childrenIndex)))}const $A=/^:[\w-]+$/,ZA=3,WA=2,JA=1,ej=10,tj=-2,$1=t=>t==="*";function rj(t,e){let r=t.split("/"),a=r.length;return r.some($1)&&(a+=tj),e&&(a+=WA),r.filter(i=>!$1(i)).reduce((i,s)=>i+($A.test(s)?ZA:s===""?JA:ej),a)}function aj(t,e){return t.length===e.length&&t.slice(0,-1).every((a,i)=>a===e[i])?t[t.length-1]-e[e.length-1]:0}function nj(t,e,r){let{routesMeta:a}=t,i={},s="/",o=[];for(let u=0;u<a.length;++u){let f=a[u],d=u===a.length-1,h=s==="/"?e:e.slice(s.length)||"/",p=ij({path:f.relativePath,caseSensitive:f.caseSensitive,end:d},h),g=f.route;if(!p)return null;Object.assign(i,p.params),o.push({params:i,pathname:Hi([s,p.pathname]),pathnameBase:dj(Hi([s,p.pathnameBase])),route:g}),p.pathnameBase!=="/"&&(s=Hi([s,p.pathnameBase]))}return o}function ij(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[r,a]=sj(t.path,t.caseSensitive,t.end),i=e.match(r);if(!i)return null;let s=i[0],o=s.replace(/(.)\/+$/,"$1"),u=i.slice(1);return{params:a.reduce((d,h,p)=>{let{paramName:g,isOptional:y}=h;if(g==="*"){let E=u[p]||"";o=s.slice(0,s.length-E.length).replace(/(.)\/+$/,"$1")}const b=u[p];return y&&!b?d[g]=void 0:d[g]=(b||"").replace(/%2F/g,"/"),d},{}),pathname:s,pathnameBase:o,pattern:t}}function sj(t,e,r){e===void 0&&(e=!1),r===void 0&&(r=!0),c0(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 a=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,u,f)=>(a.push({paramName:u,isOptional:f!=null}),f?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(a.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),a]}function lj(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return c0(!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 f0(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let r=e.endsWith("/")?e.length-1:e.length,a=t.charAt(r);return a&&a!=="/"?null:t.slice(r)||"/"}const oj=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,uj=t=>oj.test(t);function cj(t,e){e===void 0&&(e="/");let{pathname:r,search:a="",hash:i=""}=typeof t=="string"?No(t):t,s;if(r)if(uj(r))s=r;else{if(r.includes("//")){let o=r;r=r.replace(/\/\/+/g,"/"),c0(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+r))}r.startsWith("/")?s=Z1(r.substring(1),"/"):s=Z1(r,e)}else s=e;return{pathname:s,search:hj(a),hash:vj(i)}}function Z1(t,e){let r=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function Rp(t,e,r,a){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(a)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function fj(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function NE(t,e){let r=fj(t);return e?r.map((a,i)=>i===r.length-1?a.pathname:a.pathnameBase):r.map(a=>a.pathnameBase)}function AE(t,e,r,a){a===void 0&&(a=!1);let i;typeof t=="string"?i=No(t):(i=Vu({},t),gr(!i.pathname||!i.pathname.includes("?"),Rp("?","pathname","search",i)),gr(!i.pathname||!i.pathname.includes("#"),Rp("#","pathname","hash",i)),gr(!i.search||!i.search.includes("#"),Rp("#","search","hash",i)));let s=t===""||i.pathname==="",o=s?"/":i.pathname,u;if(o==null)u=r;else{let p=e.length-1;if(!a&&o.startsWith("..")){let g=o.split("/");for(;g[0]==="..";)g.shift(),p-=1;i.pathname=g.join("/")}u=p>=0?e[p]:"/"}let f=cj(i,u),d=o&&o!=="/"&&o.endsWith("/"),h=(s||o===".")&&r.endsWith("/");return!f.pathname.endsWith("/")&&(d||h)&&(f.pathname+="/"),f}const Hi=t=>t.join("/").replace(/\/\/+/g,"/"),dj=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),hj=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,vj=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function pj(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const jE=["post","put","patch","delete"];new Set(jE);const gj=["get",...jE];new Set(gj);/**
|
|
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 Fu(){return Fu=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},Fu.apply(this,arguments)}const d0=I.createContext(null),mj=I.createContext(null),Js=I.createContext(null),Gd=I.createContext(null),rs=I.createContext({outlet:null,matches:[],isDataRoute:!1}),DE=I.createContext(null);function yj(t,e){let{relative:r}=e===void 0?{}:e;dc()||gr(!1);let{basename:a,navigator:i}=I.useContext(Js),{hash:s,pathname:o,search:u}=RE(t,{relative:r}),f=o;return a!=="/"&&(f=o==="/"?a:Hi([a,o])),i.createHref({pathname:f,search:u,hash:s})}function dc(){return I.useContext(Gd)!=null}function Ao(){return dc()||gr(!1),I.useContext(Gd).location}function OE(t){I.useContext(Js).static||I.useLayoutEffect(t)}function as(){let{isDataRoute:t}=I.useContext(rs);return t?Mj():xj()}function xj(){dc()||gr(!1);let t=I.useContext(d0),{basename:e,future:r,navigator:a}=I.useContext(Js),{matches:i}=I.useContext(rs),{pathname:s}=Ao(),o=JSON.stringify(NE(i,r.v7_relativeSplatPath)),u=I.useRef(!1);return OE(()=>{u.current=!0}),I.useCallback(function(d,h){if(h===void 0&&(h={}),!u.current)return;if(typeof d=="number"){a.go(d);return}let p=AE(d,JSON.parse(o),s,h.relative==="path");t==null&&e!=="/"&&(p.pathname=p.pathname==="/"?e:Hi([e,p.pathname])),(h.replace?a.replace:a.push)(p,h.state,h)},[e,a,o,s,t])}function ME(){let{matches:t}=I.useContext(rs),e=t[t.length-1];return e?e.params:{}}function RE(t,e){let{relative:r}=e===void 0?{}:e,{future:a}=I.useContext(Js),{matches:i}=I.useContext(rs),{pathname:s}=Ao(),o=JSON.stringify(NE(i,a.v7_relativeSplatPath));return I.useMemo(()=>AE(t,JSON.parse(o),s,r==="path"),[t,o,s,r])}function bj(t,e){return wj(t,e)}function wj(t,e,r,a){dc()||gr(!1);let{navigator:i}=I.useContext(Js),{matches:s}=I.useContext(rs),o=s[s.length-1],u=o?o.params:{};o&&o.pathname;let f=o?o.pathnameBase:"/";o&&o.route;let d=Ao(),h;if(e){var p;let S=typeof e=="string"?No(e):e;f==="/"||(p=S.pathname)!=null&&p.startsWith(f)||gr(!1),h=S}else h=d;let g=h.pathname||"/",y=g;if(f!=="/"){let S=f.replace(/^\//,"").split("/");y="/"+g.replace(/^\//,"").split("/").slice(S.length).join("/")}let b=YA(t,{pathname:y}),E=Nj(b&&b.map(S=>Object.assign({},S,{params:Object.assign({},u,S.params),pathname:Hi([f,i.encodeLocation?i.encodeLocation(S.pathname).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?f:Hi([f,i.encodeLocation?i.encodeLocation(S.pathnameBase).pathname:S.pathnameBase])})),s,r,a);return e&&E?I.createElement(Gd.Provider,{value:{location:Fu({pathname:"/",search:"",hash:"",state:null,key:"default"},h),navigationType:qi.Pop}},E):E}function Sj(){let t=Oj(),e=pj(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),r=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),r?I.createElement("pre",{style:i},r):null,null)}const Ej=I.createElement(Sj,null);class Tj 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,r){return r.location!==e.location||r.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:r.error,location:r.location,revalidation:e.revalidation||r.revalidation}}componentDidCatch(e,r){console.error("React Router caught the following error during render",e,r)}render(){return this.state.error!==void 0?I.createElement(rs.Provider,{value:this.props.routeContext},I.createElement(DE.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Cj(t){let{routeContext:e,match:r,children:a}=t,i=I.useContext(d0);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),I.createElement(rs.Provider,{value:e},a)}function Nj(t,e,r,a){var i;if(e===void 0&&(e=[]),r===void 0&&(r=null),a===void 0&&(a=null),t==null){var s;if(!r)return null;if(r.errors)t=r.matches;else if((s=a)!=null&&s.v7_partialHydration&&e.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let o=t,u=(i=r)==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||gr(!1),o=o.slice(0,Math.min(o.length,h+1))}let f=!1,d=-1;if(r&&a&&a.v7_partialHydration)for(let h=0;h<o.length;h++){let p=o[h];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(d=h),p.route.id){let{loaderData:g,errors:y}=r,b=p.route.loader&&g[p.route.id]===void 0&&(!y||y[p.route.id]===void 0);if(p.route.lazy||b){f=!0,d>=0?o=o.slice(0,d+1):o=[o[0]];break}}}return o.reduceRight((h,p,g)=>{let y,b=!1,E=null,S=null;r&&(y=u&&p.route.id?u[p.route.id]:void 0,E=p.route.errorElement||Ej,f&&(d<0&&g===0?(Rj("route-fallback"),b=!0,S=null):d===g&&(b=!0,S=p.route.hydrateFallbackElement||null)));let T=e.concat(o.slice(0,g+1)),C=()=>{let N;return y?N=E:b?N=S:p.route.Component?N=I.createElement(p.route.Component,null):p.route.element?N=p.route.element:N=h,I.createElement(Cj,{match:p,routeContext:{outlet:h,matches:T,isDataRoute:r!=null},children:N})};return r&&(p.route.ErrorBoundary||p.route.errorElement||g===0)?I.createElement(Tj,{location:r.location,revalidation:r.revalidation,component:E,error:y,children:C(),routeContext:{outlet:null,matches:T,isDataRoute:!0}}):C()},null)}var kE=(function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t})(kE||{}),BE=(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})(BE||{});function Aj(t){let e=I.useContext(d0);return e||gr(!1),e}function jj(t){let e=I.useContext(mj);return e||gr(!1),e}function Dj(t){let e=I.useContext(rs);return e||gr(!1),e}function LE(t){let e=Dj(),r=e.matches[e.matches.length-1];return r.route.id||gr(!1),r.route.id}function Oj(){var t;let e=I.useContext(DE),r=jj(),a=LE();return e!==void 0?e:(t=r.errors)==null?void 0:t[a]}function Mj(){let{router:t}=Aj(kE.UseNavigateStable),e=LE(BE.UseNavigateStable),r=I.useRef(!1);return OE(()=>{r.current=!0}),I.useCallback(function(i,s){s===void 0&&(s={}),r.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,Fu({fromRouteId:e},s)))},[t,e])}const W1={};function Rj(t,e,r){W1[t]||(W1[t]=!0)}function kj(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function Xl(t){gr(!1)}function Bj(t){let{basename:e="/",children:r=null,location:a,navigationType:i=qi.Pop,navigator:s,static:o=!1,future:u}=t;dc()&&gr(!1);let f=e.replace(/^\/*/,"/"),d=I.useMemo(()=>({basename:f,navigator:s,static:o,future:Fu({v7_relativeSplatPath:!1},u)}),[f,u,s,o]);typeof a=="string"&&(a=No(a));let{pathname:h="/",search:p="",hash:g="",state:y=null,key:b="default"}=a,E=I.useMemo(()=>{let S=f0(h,f);return S==null?null:{location:{pathname:S,search:p,hash:g,state:y,key:b},navigationType:i}},[f,h,p,g,y,b,i]);return E==null?null:I.createElement(Js.Provider,{value:d},I.createElement(Gd.Provider,{children:r,value:E}))}function Lj(t){let{children:e,location:r}=t;return bj(pm(e),r)}new Promise(()=>{});function pm(t,e){e===void 0&&(e=[]);let r=[];return I.Children.forEach(t,(a,i)=>{if(!I.isValidElement(a))return;let s=[...e,i];if(a.type===I.Fragment){r.push.apply(r,pm(a.props.children,s));return}a.type!==Xl&&gr(!1),!a.props.index||!a.props.children||gr(!1);let o={id:a.props.id||s.join("-"),caseSensitive:a.props.caseSensitive,element:a.props.element,Component:a.props.Component,index:a.props.index,path:a.props.path,loader:a.props.loader,action:a.props.action,errorElement:a.props.errorElement,ErrorBoundary:a.props.ErrorBoundary,hasErrorBoundary:a.props.ErrorBoundary!=null||a.props.errorElement!=null,shouldRevalidate:a.props.shouldRevalidate,handle:a.props.handle,lazy:a.props.lazy};a.props.children&&(o.children=pm(a.props.children,s)),r.push(o)}),r}/**
|
|
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 gm(){return gm=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},gm.apply(this,arguments)}function zj(t,e){if(t==null)return{};var r={},a=Object.keys(t),i,s;for(s=0;s<a.length;s++)i=a[s],!(e.indexOf(i)>=0)&&(r[i]=t[i]);return r}function _j(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function Pj(t,e){return t.button===0&&(!e||e==="_self")&&!_j(t)}const Uj=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],qj="6";try{window.__reactRouterVersion=qj}catch{}const Ij="startTransition",J1=SE[Ij];function Vj(t){let{basename:e,children:r,future:a,window:i}=t,s=I.useRef();s.current==null&&(s.current=HA({window:i,v5Compat:!0}));let o=s.current,[u,f]=I.useState({action:o.action,location:o.location}),{v7_startTransition:d}=a||{},h=I.useCallback(p=>{d&&J1?J1(()=>f(p)):f(p)},[f,d]);return I.useLayoutEffect(()=>o.listen(h),[o,h]),I.useEffect(()=>kj(a),[a]),I.createElement(Bj,{basename:e,children:r,location:u.location,navigationType:u.action,navigator:o,future:a})}const Fj=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Hj=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ca=I.forwardRef(function(e,r){let{onClick:a,relative:i,reloadDocument:s,replace:o,state:u,target:f,to:d,preventScrollReset:h,viewTransition:p}=e,g=zj(e,Uj),{basename:y}=I.useContext(Js),b,E=!1;if(typeof d=="string"&&Hj.test(d)&&(b=d,Fj))try{let N=new URL(window.location.href),j=d.startsWith("//")?new URL(N.protocol+d):new URL(d),M=f0(j.pathname,y);j.origin===N.origin&&M!=null?d=M+j.search+j.hash:E=!0}catch{}let S=yj(d,{relative:i}),T=Gj(d,{replace:o,state:u,target:f,preventScrollReset:h,relative:i,viewTransition:p});function C(N){a&&a(N),N.defaultPrevented||T(N)}return I.createElement("a",gm({},g,{href:b||S,onClick:E||s?a:C,ref:r,target:f}))});var ew;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(ew||(ew={}));var tw;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(tw||(tw={}));function Gj(t,e){let{target:r,replace:a,state:i,preventScrollReset:s,relative:o,viewTransition:u}=e===void 0?{}:e,f=as(),d=Ao(),h=RE(t,{relative:o});return I.useCallback(p=>{if(Pj(p,r)){p.preventDefault();let g=a!==void 0?a:Cd(d)===Cd(h);f(t,{replace:g,state:i,preventScrollReset:s,relative:o,viewTransition:u})}},[d,f,h,a,i,r,t,s,o,u])}var el=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(){}},Qj={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},Oi,o0,oE,Yj=(oE=class{constructor(){Pe(this,Oi,Qj);Pe(this,o0,!1)}setTimeoutProvider(t){je(this,Oi,t)}setTimeout(t,e){return W(this,Oi).setTimeout(t,e)}clearTimeout(t){W(this,Oi).clearTimeout(t)}setInterval(t,e){return W(this,Oi).setInterval(t,e)}clearInterval(t){W(this,Oi).clearInterval(t)}},Oi=new WeakMap,o0=new WeakMap,oE),Bs=new Yj;function Kj(t){setTimeout(t,0)}var Gs=typeof window>"u"||"Deno"in globalThis;function Yr(){}function Xj(t,e){return typeof t=="function"?t(e):t}function mm(t){return typeof t=="number"&&t>=0&&t!==1/0}function zE(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Gi(t,e){return typeof t=="function"?t(e):t}function Fa(t,e){return typeof t=="function"?t(e):t}function rw(t,e){const{type:r="all",exact:a,fetchStatus:i,predicate:s,queryKey:o,stale:u}=t;if(o){if(a){if(e.queryHash!==h0(o,e.options))return!1}else if(!Hu(e.queryKey,o))return!1}if(r!=="all"){const f=e.isActive();if(r==="active"&&!f||r==="inactive"&&f)return!1}return!(typeof u=="boolean"&&e.isStale()!==u||i&&i!==e.state.fetchStatus||s&&!s(e))}function aw(t,e){const{exact:r,status:a,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(r){if(Ki(e.options.mutationKey)!==Ki(s))return!1}else if(!Hu(e.options.mutationKey,s))return!1}return!(a&&e.state.status!==a||i&&!i(e))}function h0(t,e){return((e==null?void 0:e.queryKeyHashFn)||Ki)(t)}function Ki(t){return JSON.stringify(t,(e,r)=>ym(r)?Object.keys(r).sort().reduce((a,i)=>(a[i]=r[i],a),{}):r)}function Hu(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(r=>Hu(t[r],e[r])):!1}var $j=Object.prototype.hasOwnProperty;function v0(t,e,r=0){if(t===e)return t;if(r>500)return e;const a=nw(t)&&nw(e);if(!a&&!(ym(t)&&ym(e)))return e;const s=(a?t:Object.keys(t)).length,o=a?e:Object.keys(e),u=o.length,f=a?new Array(u):{};let d=0;for(let h=0;h<u;h++){const p=a?h:o[h],g=t[p],y=e[p];if(g===y){f[p]=g,(a?h<s:$j.call(t,p))&&d++;continue}if(g===null||y===null||typeof g!="object"||typeof y!="object"){f[p]=y;continue}const b=v0(g,y,r+1);f[p]=b,b===g&&d++}return s===u&&d===s?t:f}function Gu(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const r in t)if(t[r]!==e[r])return!1;return!0}function nw(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function ym(t){if(!iw(t))return!1;const e=t.constructor;if(e===void 0)return!0;const r=e.prototype;return!(!iw(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function iw(t){return Object.prototype.toString.call(t)==="[object Object]"}function Zj(t){return new Promise(e=>{Bs.setTimeout(e,t)})}function xm(t,e,r){return typeof r.structuralSharing=="function"?r.structuralSharing(t,e):r.structuralSharing!==!1?v0(t,e):e}function Wj(t,e,r=0){const a=[...t,e];return r&&a.length>r?a.slice(1):a}function Jj(t,e,r=0){const a=[e,...t];return r&&a.length>r?a.slice(0,-1):a}var Na=Symbol();function _E(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===Na?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function p0(t,e){return typeof t=="function"?t(...e):!!t}function eD(t,e,r){let a=!1,i;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(i??(i=e()),a||(a=!0,i.aborted?r():i.addEventListener("abort",r,{once:!0})),i)}),t}var zs,Mi,lo,uE,tD=(uE=class extends el{constructor(){super();Pe(this,zs);Pe(this,Mi);Pe(this,lo);je(this,lo,e=>{if(!Gs&&window.addEventListener){const r=()=>e();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){W(this,Mi)||this.setEventListener(W(this,lo))}onUnsubscribe(){var e;this.hasListeners()||((e=W(this,Mi))==null||e.call(this),je(this,Mi,void 0))}setEventListener(e){var r;je(this,lo,e),(r=W(this,Mi))==null||r.call(this),je(this,Mi,e(a=>{typeof a=="boolean"?this.setFocused(a):this.onFocus()}))}setFocused(e){W(this,zs)!==e&&(je(this,zs,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(r=>{r(e)})}isFocused(){var e;return typeof W(this,zs)=="boolean"?W(this,zs):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},zs=new WeakMap,Mi=new WeakMap,lo=new WeakMap,uE),g0=new tD;function bm(){let t,e;const r=new Promise((i,s)=>{t=i,e=s});r.status="pending",r.catch(()=>{});function a(i){Object.assign(r,i),delete r.resolve,delete r.reject}return r.resolve=i=>{a({status:"fulfilled",value:i}),t(i)},r.reject=i=>{a({status:"rejected",reason:i}),e(i)},r}var rD=Kj;function aD(){let t=[],e=0,r=u=>{u()},a=u=>{u()},i=rD;const s=u=>{e?t.push(u):i(()=>{r(u)})},o=()=>{const u=t;t=[],u.length&&i(()=>{a(()=>{u.forEach(f=>{r(f)})})})};return{batch:u=>{let f;e++;try{f=u()}finally{e--,e||o()}return f},batchCalls:u=>(...f)=>{s(()=>{u(...f)})},schedule:s,setNotifyFunction:u=>{r=u},setBatchNotifyFunction:u=>{a=u},setScheduler:u=>{i=u}}}var rr=aD(),oo,Ri,uo,cE,nD=(cE=class extends el{constructor(){super();Pe(this,oo,!0);Pe(this,Ri);Pe(this,uo);je(this,uo,e=>{if(!Gs&&window.addEventListener){const r=()=>e(!0),a=()=>e(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",a,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",a)}}})}onSubscribe(){W(this,Ri)||this.setEventListener(W(this,uo))}onUnsubscribe(){var e;this.hasListeners()||((e=W(this,Ri))==null||e.call(this),je(this,Ri,void 0))}setEventListener(e){var r;je(this,uo,e),(r=W(this,Ri))==null||r.call(this),je(this,Ri,e(this.setOnline.bind(this)))}setOnline(e){W(this,oo)!==e&&(je(this,oo,e),this.listeners.forEach(a=>{a(e)}))}isOnline(){return W(this,oo)}},oo=new WeakMap,Ri=new WeakMap,uo=new WeakMap,cE),Nd=new nD;function iD(t){return Math.min(1e3*2**t,3e4)}function PE(t){return(t??"online")==="online"?Nd.isOnline():!0}var wm=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function UE(t){let e=!1,r=0,a;const i=bm(),s=()=>i.status!=="pending",o=E=>{var S;if(!s()){const T=new wm(E);g(T),(S=t.onCancel)==null||S.call(t,T)}},u=()=>{e=!0},f=()=>{e=!1},d=()=>g0.isFocused()&&(t.networkMode==="always"||Nd.isOnline())&&t.canRun(),h=()=>PE(t.networkMode)&&t.canRun(),p=E=>{s()||(a==null||a(),i.resolve(E))},g=E=>{s()||(a==null||a(),i.reject(E))},y=()=>new Promise(E=>{var S;a=T=>{(s()||d())&&E(T)},(S=t.onPause)==null||S.call(t)}).then(()=>{var E;a=void 0,s()||(E=t.onContinue)==null||E.call(t)}),b=()=>{if(s())return;let E;const S=r===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??(Gs?0:3),N=t.retryDelay??iD,j=typeof N=="function"?N(r,T):N,M=C===!0||typeof C=="number"&&r<C||typeof C=="function"&&C(r,T);if(e||!M){g(T);return}r++,(D=t.onFail)==null||D.call(t,r,T),Zj(j).then(()=>d()?void 0:y()).then(()=>{e?g(T):b()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(a==null||a(),i),cancelRetry:u,continueRetry:f,canStart:h,start:()=>(h()?b():y().then(b),i)}}var _s,fE,qE=(fE=class{constructor(){Pe(this,_s)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),mm(this.gcTime)&&je(this,_s,Bs.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Gs?1/0:300*1e3))}clearGcTimeout(){W(this,_s)&&(Bs.clearTimeout(W(this,_s)),je(this,_s,void 0))}},_s=new WeakMap,fE),Ps,co,Ia,Us,Dr,ac,qs,$a,Un,dE,sD=(dE=class extends qE{constructor(e){super();Pe(this,$a);Pe(this,Ps);Pe(this,co);Pe(this,Ia);Pe(this,Us);Pe(this,Dr);Pe(this,ac);Pe(this,qs);je(this,qs,!1),je(this,ac,e.defaultOptions),this.setOptions(e.options),this.observers=[],je(this,Us,e.client),je(this,Ia,W(this,Us).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,je(this,Ps,lw(this.options)),this.state=e.state??W(this,Ps),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=W(this,Dr))==null?void 0:e.promise}setOptions(e){if(this.options={...W(this,ac),...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=lw(this.options);r.data!==void 0&&(this.setState(sw(r.data,r.dataUpdatedAt)),je(this,Ps,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&W(this,Ia).remove(this)}setData(e,r){const a=xm(this.state.data,e,this.options);return tt(this,$a,Un).call(this,{data:a,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),a}setState(e,r){tt(this,$a,Un).call(this,{type:"setState",state:e,setStateOptions:r})}cancel(e){var a,i;const r=(a=W(this,Dr))==null?void 0:a.promise;return(i=W(this,Dr))==null||i.cancel(e),r?r.then(Yr).catch(Yr):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(W(this,Ps))}isActive(){return this.observers.some(e=>Fa(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Na||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Gi(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:!zE(this.state.dataUpdatedAt,e)}onFocus(){var r;const e=this.observers.find(a=>a.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(r=W(this,Dr))==null||r.continue()}onOnline(){var r;const e=this.observers.find(a=>a.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(r=W(this,Dr))==null||r.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),W(this,Ia).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(r=>r!==e),this.observers.length||(W(this,Dr)&&(W(this,qs)?W(this,Dr).cancel({revert:!0}):W(this,Dr).cancelRetry()),this.scheduleGc()),W(this,Ia).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||tt(this,$a,Un).call(this,{type:"invalidate"})}async fetch(e,r){var f,d,h,p,g,y,b,E,S,T,C,N;if(this.state.fetchStatus!=="idle"&&((f=W(this,Dr))==null?void 0:f.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(W(this,Dr))return W(this,Dr).continueRetry(),W(this,Dr).promise}if(e&&this.setOptions(e),!this.options.queryFn){const j=this.observers.find(M=>M.options.queryFn);j&&this.setOptions(j.options)}const a=new AbortController,i=j=>{Object.defineProperty(j,"signal",{enumerable:!0,get:()=>(je(this,qs,!0),a.signal)})},s=()=>{const j=_E(this.options,r),D=(()=>{const A={client:W(this,Us),queryKey:this.queryKey,meta:this.meta};return i(A),A})();return je(this,qs,!1),this.options.persister?this.options.persister(j,D,this):j(D)},u=(()=>{const j={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:W(this,Us),state:this.state,fetchFn:s};return i(j),j})();(d=this.options.behavior)==null||d.onFetch(u,this),je(this,co,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((h=u.fetchOptions)==null?void 0:h.meta))&&tt(this,$a,Un).call(this,{type:"fetch",meta:(p=u.fetchOptions)==null?void 0:p.meta}),je(this,Dr,UE({initialPromise:r==null?void 0:r.initialPromise,fn:u.fetchFn,onCancel:j=>{j instanceof wm&&j.revert&&this.setState({...W(this,co),fetchStatus:"idle"}),a.abort()},onFail:(j,M)=>{tt(this,$a,Un).call(this,{type:"failed",failureCount:j,error:M})},onPause:()=>{tt(this,$a,Un).call(this,{type:"pause"})},onContinue:()=>{tt(this,$a,Un).call(this,{type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0}));try{const j=await W(this,Dr).start();if(j===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(j),(y=(g=W(this,Ia).config).onSuccess)==null||y.call(g,j,this),(E=(b=W(this,Ia).config).onSettled)==null||E.call(b,j,this.state.error,this),j}catch(j){if(j instanceof wm){if(j.silent)return W(this,Dr).promise;if(j.revert){if(this.state.data===void 0)throw j;return this.state.data}}throw tt(this,$a,Un).call(this,{type:"error",error:j}),(T=(S=W(this,Ia).config).onError)==null||T.call(S,j,this),(N=(C=W(this,Ia).config).onSettled)==null||N.call(C,this.state.data,j,this),j}finally{this.scheduleGc()}}},Ps=new WeakMap,co=new WeakMap,Ia=new WeakMap,Us=new WeakMap,Dr=new WeakMap,ac=new WeakMap,qs=new WeakMap,$a=new WeakSet,Un=function(e){const r=a=>{switch(e.type){case"failed":return{...a,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...a,fetchStatus:"paused"};case"continue":return{...a,fetchStatus:"fetching"};case"fetch":return{...a,...IE(a.data,this.options),fetchMeta:e.meta??null};case"success":const i={...a,...sw(e.data,e.dataUpdatedAt),dataUpdateCount:a.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return je(this,co,e.manual?i:void 0),i;case"error":const s=e.error;return{...a,error:s,errorUpdateCount:a.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:a.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...a,isInvalidated:!0};case"setState":return{...a,...e.state}}};this.state=r(this.state),rr.batch(()=>{this.observers.forEach(a=>{a.onQueryUpdate()}),W(this,Ia).notify({query:this,type:"updated",action:e})})},dE);function IE(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:PE(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function sw(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function lw(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,r=e!==void 0,a=r?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:r?a??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var fa,yt,nc,Wr,Is,fo,In,ki,ic,ho,vo,Vs,Fs,Bi,po,jt,Bu,Sm,Em,Tm,Cm,Nm,Am,jm,VE,hE,hc=(hE=class extends el{constructor(e,r){super();Pe(this,jt);Pe(this,fa);Pe(this,yt);Pe(this,nc);Pe(this,Wr);Pe(this,Is);Pe(this,fo);Pe(this,In);Pe(this,ki);Pe(this,ic);Pe(this,ho);Pe(this,vo);Pe(this,Vs);Pe(this,Fs);Pe(this,Bi);Pe(this,po,new Set);this.options=r,je(this,fa,e),je(this,ki,null),je(this,In,bm()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(W(this,yt).addObserver(this),ow(W(this,yt),this.options)?tt(this,jt,Bu).call(this):this.updateResult(),tt(this,jt,Cm).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Dm(W(this,yt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Dm(W(this,yt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,tt(this,jt,Nm).call(this),tt(this,jt,Am).call(this),W(this,yt).removeObserver(this)}setOptions(e){const r=this.options,a=W(this,yt);if(this.options=W(this,fa).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Fa(this.options.enabled,W(this,yt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");tt(this,jt,jm).call(this),W(this,yt).setOptions(this.options),r._defaulted&&!Gu(this.options,r)&&W(this,fa).getQueryCache().notify({type:"observerOptionsUpdated",query:W(this,yt),observer:this});const i=this.hasListeners();i&&uw(W(this,yt),a,this.options,r)&&tt(this,jt,Bu).call(this),this.updateResult(),i&&(W(this,yt)!==a||Fa(this.options.enabled,W(this,yt))!==Fa(r.enabled,W(this,yt))||Gi(this.options.staleTime,W(this,yt))!==Gi(r.staleTime,W(this,yt)))&&tt(this,jt,Sm).call(this);const s=tt(this,jt,Em).call(this);i&&(W(this,yt)!==a||Fa(this.options.enabled,W(this,yt))!==Fa(r.enabled,W(this,yt))||s!==W(this,Bi))&&tt(this,jt,Tm).call(this,s)}getOptimisticResult(e){const r=W(this,fa).getQueryCache().build(W(this,fa),e),a=this.createResult(r,e);return oD(this,a)&&(je(this,Wr,a),je(this,fo,this.options),je(this,Is,W(this,yt).state)),a}getCurrentResult(){return W(this,Wr)}trackResult(e,r){return new Proxy(e,{get:(a,i)=>(this.trackProp(i),r==null||r(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&W(this,In).status==="pending"&&W(this,In).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(a,i))})}trackProp(e){W(this,po).add(e)}getCurrentQuery(){return W(this,yt)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const r=W(this,fa).defaultQueryOptions(e),a=W(this,fa).getQueryCache().build(W(this,fa),r);return a.fetch().then(()=>this.createResult(a,r))}fetch(e){return tt(this,jt,Bu).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),W(this,Wr)))}createResult(e,r){var R;const a=W(this,yt),i=this.options,s=W(this,Wr),o=W(this,Is),u=W(this,fo),d=e!==a?e.state:W(this,nc),{state:h}=e;let p={...h},g=!1,y;if(r._optimisticResults){const L=this.hasListeners(),_=!L&&ow(e,r),P=L&&uw(e,a,r,i);(_||P)&&(p={...p,...IE(h.data,e.options)}),r._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:b,errorUpdatedAt:E,status:S}=p;y=p.data;let T=!1;if(r.placeholderData!==void 0&&y===void 0&&S==="pending"){let L;s!=null&&s.isPlaceholderData&&r.placeholderData===(u==null?void 0:u.placeholderData)?(L=s.data,T=!0):L=typeof r.placeholderData=="function"?r.placeholderData((R=W(this,vo))==null?void 0:R.state.data,W(this,vo)):r.placeholderData,L!==void 0&&(S="success",y=xm(s==null?void 0:s.data,L,r),g=!0)}if(r.select&&y!==void 0&&!T)if(s&&y===(o==null?void 0:o.data)&&r.select===W(this,ic))y=W(this,ho);else try{je(this,ic,r.select),y=r.select(y),y=xm(s==null?void 0:s.data,y,r),je(this,ho,y),je(this,ki,null)}catch(L){je(this,ki,L)}W(this,ki)&&(b=W(this,ki),y=W(this,ho),E=Date.now(),S="error");const C=p.fetchStatus==="fetching",N=S==="pending",j=S==="error",M=N&&C,D=y!==void 0,B={status:S,fetchStatus:p.fetchStatus,isPending:N,isSuccess:S==="success",isError:j,isInitialLoading:M,isLoading:M,data:y,dataUpdatedAt:p.dataUpdatedAt,error:b,errorUpdatedAt:E,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:p.dataUpdateCount>0||p.errorUpdateCount>0,isFetchedAfterMount:p.dataUpdateCount>d.dataUpdateCount||p.errorUpdateCount>d.errorUpdateCount,isFetching:C,isRefetching:C&&!N,isLoadingError:j&&!D,isPaused:p.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:j&&D,isStale:m0(e,r),refetch:this.refetch,promise:W(this,In),isEnabled:Fa(r.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const L=B.data!==void 0,_=B.status==="error"&&!L,P=Y=>{_?Y.reject(B.error):L&&Y.resolve(B.data)},q=()=>{const Y=je(this,In,B.promise=bm());P(Y)},F=W(this,In);switch(F.status){case"pending":e.queryHash===a.queryHash&&P(F);break;case"fulfilled":(_||B.data!==F.value)&&q();break;case"rejected":(!_||B.error!==F.reason)&&q();break}}return B}updateResult(){const e=W(this,Wr),r=this.createResult(W(this,yt),this.options);if(je(this,Is,W(this,yt).state),je(this,fo,this.options),W(this,Is).data!==void 0&&je(this,vo,W(this,yt)),Gu(r,e))return;je(this,Wr,r);const a=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,s=typeof i=="function"?i():i;if(s==="all"||!s&&!W(this,po).size)return!0;const o=new Set(s??W(this,po));return this.options.throwOnError&&o.add("error"),Object.keys(W(this,Wr)).some(u=>{const f=u;return W(this,Wr)[f]!==e[f]&&o.has(f)})};tt(this,jt,VE).call(this,{listeners:a()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&tt(this,jt,Cm).call(this)}},fa=new WeakMap,yt=new WeakMap,nc=new WeakMap,Wr=new WeakMap,Is=new WeakMap,fo=new WeakMap,In=new WeakMap,ki=new WeakMap,ic=new WeakMap,ho=new WeakMap,vo=new WeakMap,Vs=new WeakMap,Fs=new WeakMap,Bi=new WeakMap,po=new WeakMap,jt=new WeakSet,Bu=function(e){tt(this,jt,jm).call(this);let r=W(this,yt).fetch(this.options,e);return e!=null&&e.throwOnError||(r=r.catch(Yr)),r},Sm=function(){tt(this,jt,Nm).call(this);const e=Gi(this.options.staleTime,W(this,yt));if(Gs||W(this,Wr).isStale||!mm(e))return;const a=zE(W(this,Wr).dataUpdatedAt,e)+1;je(this,Vs,Bs.setTimeout(()=>{W(this,Wr).isStale||this.updateResult()},a))},Em=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(W(this,yt)):this.options.refetchInterval)??!1},Tm=function(e){tt(this,jt,Am).call(this),je(this,Bi,e),!(Gs||Fa(this.options.enabled,W(this,yt))===!1||!mm(W(this,Bi))||W(this,Bi)===0)&&je(this,Fs,Bs.setInterval(()=>{(this.options.refetchIntervalInBackground||g0.isFocused())&&tt(this,jt,Bu).call(this)},W(this,Bi)))},Cm=function(){tt(this,jt,Sm).call(this),tt(this,jt,Tm).call(this,tt(this,jt,Em).call(this))},Nm=function(){W(this,Vs)&&(Bs.clearTimeout(W(this,Vs)),je(this,Vs,void 0))},Am=function(){W(this,Fs)&&(Bs.clearInterval(W(this,Fs)),je(this,Fs,void 0))},jm=function(){const e=W(this,fa).getQueryCache().build(W(this,fa),this.options);if(e===W(this,yt))return;const r=W(this,yt);je(this,yt,e),je(this,nc,e.state),this.hasListeners()&&(r==null||r.removeObserver(this),e.addObserver(this))},VE=function(e){rr.batch(()=>{e.listeners&&this.listeners.forEach(r=>{r(W(this,Wr))}),W(this,fa).getQueryCache().notify({query:W(this,yt),type:"observerResultsUpdated"})})},hE);function lD(t,e){return Fa(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function ow(t,e){return lD(t,e)||t.state.data!==void 0&&Dm(t,e,e.refetchOnMount)}function Dm(t,e,r){if(Fa(e.enabled,t)!==!1&&Gi(e.staleTime,t)!=="static"){const a=typeof r=="function"?r(t):r;return a==="always"||a!==!1&&m0(t,e)}return!1}function uw(t,e,r,a){return(t!==e||Fa(a.enabled,t)===!1)&&(!r.suspense||t.state.status!=="error")&&m0(t,r)}function m0(t,e){return Fa(e.enabled,t)!==!1&&t.isStaleByTime(Gi(e.staleTime,t))}function oD(t,e){return!Gu(t.getCurrentResult(),e)}function Ad(t){return{onFetch:(e,r)=>{var h,p,g,y,b;const a=e.options,i=(g=(p=(h=e.fetchOptions)==null?void 0:h.meta)==null?void 0:p.fetchMore)==null?void 0:g.direction,s=((y=e.state.data)==null?void 0:y.pages)||[],o=((b=e.state.data)==null?void 0:b.pageParams)||[];let u={pages:[],pageParams:[]},f=0;const d=async()=>{let E=!1;const S=N=>{eD(N,()=>e.signal,()=>E=!0)},T=_E(e.options,e.fetchOptions),C=async(N,j,M)=>{if(E)return Promise.reject();if(j==null&&N.pages.length)return Promise.resolve(N);const A=(()=>{const _={client:e.client,queryKey:e.queryKey,pageParam:j,direction:M?"backward":"forward",meta:e.options.meta};return S(_),_})(),B=await T(A),{maxPages:R}=e.options,L=M?Jj:Wj;return{pages:L(N.pages,B,R),pageParams:L(N.pageParams,j,R)}};if(i&&s.length){const N=i==="backward",j=N?FE:Om,M={pages:s,pageParams:o},D=j(a,M);u=await C(M,D,N)}else{const N=t??s.length;do{const j=f===0?o[0]??a.initialPageParam:Om(a,u);if(f>0&&j==null)break;u=await C(u,j),f++}while(f<N)}return u};e.options.persister?e.fetchFn=()=>{var E,S;return(S=(E=e.options).persister)==null?void 0:S.call(E,d,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},r)}:e.fetchFn=d}}}function Om(t,{pages:e,pageParams:r}){const a=e.length-1;return e.length>0?t.getNextPageParam(e[a],e,r[a],r):void 0}function FE(t,{pages:e,pageParams:r}){var a;return e.length>0?(a=t.getPreviousPageParam)==null?void 0:a.call(t,e[0],e,r[0],r):void 0}function uD(t,e){return e?Om(t,e)!=null:!1}function cD(t,e){return!e||!t.getPreviousPageParam?!1:FE(t,e)!=null}var HE=class extends hc{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:Ad()})}getOptimisticResult(t){return t.behavior=Ad(),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 b,E;const{state:r}=t,a=super.createResult(t,e),{isFetching:i,isRefetching:s,isError:o,isRefetchError:u}=a,f=(E=(b=r.fetchMeta)==null?void 0:b.fetchMore)==null?void 0:E.direction,d=o&&f==="forward",h=i&&f==="forward",p=o&&f==="backward",g=i&&f==="backward";return{...a,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:uD(e,r.data),hasPreviousPage:cD(e,r.data),isFetchNextPageError:d,isFetchingNextPage:h,isFetchPreviousPageError:p,isFetchingPreviousPage:g,isRefetchError:u&&!d&&!p,isRefetching:s&&!h&&!g}}},sc,hn,Qr,Hs,vn,Ai,vE,fD=(vE=class extends qE{constructor(e){super();Pe(this,vn);Pe(this,sc);Pe(this,hn);Pe(this,Qr);Pe(this,Hs);je(this,sc,e.client),this.mutationId=e.mutationId,je(this,Qr,e.mutationCache),je(this,hn,[]),this.state=e.state||GE(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){W(this,hn).includes(e)||(W(this,hn).push(e),this.clearGcTimeout(),W(this,Qr).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){je(this,hn,W(this,hn).filter(r=>r!==e)),this.scheduleGc(),W(this,Qr).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){W(this,hn).length||(this.state.status==="pending"?this.scheduleGc():W(this,Qr).remove(this))}continue(){var e;return((e=W(this,Hs))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var o,u,f,d,h,p,g,y,b,E,S,T,C,N,j,M,D,A;const r=()=>{tt(this,vn,Ai).call(this,{type:"continue"})},a={client:W(this,sc),meta:this.options.meta,mutationKey:this.options.mutationKey};je(this,Hs,UE({fn:()=>this.options.mutationFn?this.options.mutationFn(e,a):Promise.reject(new Error("No mutationFn found")),onFail:(B,R)=>{tt(this,vn,Ai).call(this,{type:"failed",failureCount:B,error:R})},onPause:()=>{tt(this,vn,Ai).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>W(this,Qr).canRun(this)}));const i=this.state.status==="pending",s=!W(this,Hs).canStart();try{if(i)r();else{tt(this,vn,Ai).call(this,{type:"pending",variables:e,isPaused:s}),W(this,Qr).config.onMutate&&await W(this,Qr).config.onMutate(e,this,a);const R=await((u=(o=this.options).onMutate)==null?void 0:u.call(o,e,a));R!==this.state.context&&tt(this,vn,Ai).call(this,{type:"pending",context:R,variables:e,isPaused:s})}const B=await W(this,Hs).start();return await((d=(f=W(this,Qr).config).onSuccess)==null?void 0:d.call(f,B,e,this.state.context,this,a)),await((p=(h=this.options).onSuccess)==null?void 0:p.call(h,B,e,this.state.context,a)),await((y=(g=W(this,Qr).config).onSettled)==null?void 0:y.call(g,B,null,this.state.variables,this.state.context,this,a)),await((E=(b=this.options).onSettled)==null?void 0:E.call(b,B,null,e,this.state.context,a)),tt(this,vn,Ai).call(this,{type:"success",data:B}),B}catch(B){try{await((T=(S=W(this,Qr).config).onError)==null?void 0:T.call(S,B,e,this.state.context,this,a))}catch(R){Promise.reject(R)}try{await((N=(C=this.options).onError)==null?void 0:N.call(C,B,e,this.state.context,a))}catch(R){Promise.reject(R)}try{await((M=(j=W(this,Qr).config).onSettled)==null?void 0:M.call(j,void 0,B,this.state.variables,this.state.context,this,a))}catch(R){Promise.reject(R)}try{await((A=(D=this.options).onSettled)==null?void 0:A.call(D,void 0,B,e,this.state.context,a))}catch(R){Promise.reject(R)}throw tt(this,vn,Ai).call(this,{type:"error",error:B}),B}finally{W(this,Qr).runNext(this)}}},sc=new WeakMap,hn=new WeakMap,Qr=new WeakMap,Hs=new WeakMap,vn=new WeakSet,Ai=function(e){const r=a=>{switch(e.type){case"failed":return{...a,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...a,isPaused:!0};case"continue":return{...a,isPaused:!1};case"pending":return{...a,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{...a,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...a,data:void 0,error:e.error,failureCount:a.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=r(this.state),rr.batch(()=>{W(this,hn).forEach(a=>{a.onMutationUpdate(e)}),W(this,Qr).notify({mutation:this,type:"updated",action:e})})},vE);function GE(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Vn,Za,lc,pE,dD=(pE=class extends el{constructor(e={}){super();Pe(this,Vn);Pe(this,Za);Pe(this,lc);this.config=e,je(this,Vn,new Set),je(this,Za,new Map),je(this,lc,0)}build(e,r,a){const i=new fD({client:e,mutationCache:this,mutationId:++Hf(this,lc)._,options:e.defaultMutationOptions(r),state:a});return this.add(i),i}add(e){W(this,Vn).add(e);const r=Gf(e);if(typeof r=="string"){const a=W(this,Za).get(r);a?a.push(e):W(this,Za).set(r,[e])}this.notify({type:"added",mutation:e})}remove(e){if(W(this,Vn).delete(e)){const r=Gf(e);if(typeof r=="string"){const a=W(this,Za).get(r);if(a)if(a.length>1){const i=a.indexOf(e);i!==-1&&a.splice(i,1)}else a[0]===e&&W(this,Za).delete(r)}}this.notify({type:"removed",mutation:e})}canRun(e){const r=Gf(e);if(typeof r=="string"){const a=W(this,Za).get(r),i=a==null?void 0:a.find(s=>s.state.status==="pending");return!i||i===e}else return!0}runNext(e){var a;const r=Gf(e);if(typeof r=="string"){const i=(a=W(this,Za).get(r))==null?void 0:a.find(s=>s!==e&&s.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){rr.batch(()=>{W(this,Vn).forEach(e=>{this.notify({type:"removed",mutation:e})}),W(this,Vn).clear(),W(this,Za).clear()})}getAll(){return Array.from(W(this,Vn))}find(e){const r={exact:!0,...e};return this.getAll().find(a=>aw(r,a))}findAll(e={}){return this.getAll().filter(r=>aw(e,r))}notify(e){rr.batch(()=>{this.listeners.forEach(r=>{r(e)})})}resumePausedMutations(){const e=this.getAll().filter(r=>r.state.isPaused);return rr.batch(()=>Promise.all(e.map(r=>r.continue().catch(Yr))))}},Vn=new WeakMap,Za=new WeakMap,lc=new WeakMap,pE);function Gf(t){var e;return(e=t.options.scope)==null?void 0:e.id}var Fn,Li,da,Hn,Qn,cd,Mm,gE,hD=(gE=class extends el{constructor(r,a){super();Pe(this,Qn);Pe(this,Fn);Pe(this,Li);Pe(this,da);Pe(this,Hn);je(this,Fn,r),this.setOptions(a),this.bindMethods(),tt(this,Qn,cd).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(r){var i;const a=this.options;this.options=W(this,Fn).defaultMutationOptions(r),Gu(this.options,a)||W(this,Fn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:W(this,da),observer:this}),a!=null&&a.mutationKey&&this.options.mutationKey&&Ki(a.mutationKey)!==Ki(this.options.mutationKey)?this.reset():((i=W(this,da))==null?void 0:i.state.status)==="pending"&&W(this,da).setOptions(this.options)}onUnsubscribe(){var r;this.hasListeners()||(r=W(this,da))==null||r.removeObserver(this)}onMutationUpdate(r){tt(this,Qn,cd).call(this),tt(this,Qn,Mm).call(this,r)}getCurrentResult(){return W(this,Li)}reset(){var r;(r=W(this,da))==null||r.removeObserver(this),je(this,da,void 0),tt(this,Qn,cd).call(this),tt(this,Qn,Mm).call(this)}mutate(r,a){var i;return je(this,Hn,a),(i=W(this,da))==null||i.removeObserver(this),je(this,da,W(this,Fn).getMutationCache().build(W(this,Fn),this.options)),W(this,da).addObserver(this),W(this,da).execute(r)}},Fn=new WeakMap,Li=new WeakMap,da=new WeakMap,Hn=new WeakMap,Qn=new WeakSet,cd=function(){var a;const r=((a=W(this,da))==null?void 0:a.state)??GE();je(this,Li,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},Mm=function(r){rr.batch(()=>{var a,i,s,o,u,f,d,h;if(W(this,Hn)&&this.hasListeners()){const p=W(this,Li).variables,g=W(this,Li).context,y={client:W(this,Fn),meta:this.options.meta,mutationKey:this.options.mutationKey};if((r==null?void 0:r.type)==="success"){try{(i=(a=W(this,Hn)).onSuccess)==null||i.call(a,r.data,p,g,y)}catch(b){Promise.reject(b)}try{(o=(s=W(this,Hn)).onSettled)==null||o.call(s,r.data,null,p,g,y)}catch(b){Promise.reject(b)}}else if((r==null?void 0:r.type)==="error"){try{(f=(u=W(this,Hn)).onError)==null||f.call(u,r.error,p,g,y)}catch(b){Promise.reject(b)}try{(h=(d=W(this,Hn)).onSettled)==null||h.call(d,void 0,r.error,p,g,y)}catch(b){Promise.reject(b)}}}this.listeners.forEach(p=>{p(W(this,Li))})})},gE);function cw(t,e){const r=new Set(e);return t.filter(a=>!r.has(a))}function vD(t,e,r){const a=t.slice(0);return a[e]=r,a}var go,Ta,mo,yo,Va,zi,oc,uc,cc,fc,qr,Rm,km,Bm,Lm,zm,mE,pD=(mE=class extends el{constructor(e,r,a){super();Pe(this,qr);Pe(this,go);Pe(this,Ta);Pe(this,mo);Pe(this,yo);Pe(this,Va);Pe(this,zi);Pe(this,oc);Pe(this,uc);Pe(this,cc);Pe(this,fc,[]);je(this,go,e),je(this,yo,a),je(this,mo,[]),je(this,Va,[]),je(this,Ta,[]),this.setQueries(r)}onSubscribe(){this.listeners.size===1&&W(this,Va).forEach(e=>{e.subscribe(r=>{tt(this,qr,Lm).call(this,e,r)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,W(this,Va).forEach(e=>{e.destroy()})}setQueries(e,r){je(this,mo,e),je(this,yo,r),rr.batch(()=>{const a=W(this,Va),i=tt(this,qr,Bm).call(this,W(this,mo));i.forEach(p=>p.observer.setOptions(p.defaultedQueryOptions));const s=i.map(p=>p.observer),o=s.map(p=>p.getCurrentResult()),u=a.length!==s.length,f=s.some((p,g)=>p!==a[g]),d=u||f,h=d?!0:o.some((p,g)=>{const y=W(this,Ta)[g];return!y||!Gu(p,y)});!d&&!h||(d&&(je(this,fc,i),je(this,Va,s)),je(this,Ta,o),this.hasListeners()&&(d&&(cw(a,s).forEach(p=>{p.destroy()}),cw(s,a).forEach(p=>{p.subscribe(g=>{tt(this,qr,Lm).call(this,p,g)})})),tt(this,qr,zm).call(this)))})}getCurrentResult(){return W(this,Ta)}getQueries(){return W(this,Va).map(e=>e.getCurrentQuery())}getObservers(){return W(this,Va)}getOptimisticResult(e,r){const a=tt(this,qr,Bm).call(this,e),i=a.map(o=>o.observer.getOptimisticResult(o.defaultedQueryOptions)),s=a.map(o=>o.defaultedQueryOptions.queryHash);return[i,o=>tt(this,qr,km).call(this,o??i,r,s),()=>tt(this,qr,Rm).call(this,i,a)]}},go=new WeakMap,Ta=new WeakMap,mo=new WeakMap,yo=new WeakMap,Va=new WeakMap,zi=new WeakMap,oc=new WeakMap,uc=new WeakMap,cc=new WeakMap,fc=new WeakMap,qr=new WeakSet,Rm=function(e,r){return r.map((a,i)=>{const s=e[i];return a.defaultedQueryOptions.notifyOnChangeProps?s:a.observer.trackResult(s,o=>{r.forEach(u=>{u.observer.trackProp(o)})})})},km=function(e,r,a){if(r){const i=W(this,cc),s=a!==void 0&&i!==void 0&&(i.length!==a.length||a.some((o,u)=>o!==i[u]));return(!W(this,zi)||W(this,Ta)!==W(this,uc)||s||r!==W(this,oc))&&(je(this,oc,r),je(this,uc,W(this,Ta)),a!==void 0&&je(this,cc,a),je(this,zi,v0(W(this,zi),r(e)))),W(this,zi)}return e},Bm=function(e){const r=new Map;W(this,Va).forEach(i=>{const s=i.options.queryHash;if(!s)return;const o=r.get(s);o?o.push(i):r.set(s,[i])});const a=[];return e.forEach(i=>{var f;const s=W(this,go).defaultQueryOptions(i),u=((f=r.get(s.queryHash))==null?void 0:f.shift())??new hc(W(this,go),s);a.push({defaultedQueryOptions:s,observer:u})}),a},Lm=function(e,r){const a=W(this,Va).indexOf(e);a!==-1&&(je(this,Ta,vD(W(this,Ta),a,r)),tt(this,qr,zm).call(this))},zm=function(){var e;if(this.hasListeners()){const r=W(this,zi),a=tt(this,qr,Rm).call(this,W(this,Ta),W(this,fc)),i=tt(this,qr,km).call(this,a,(e=W(this,yo))==null?void 0:e.combine);r!==i&&rr.batch(()=>{this.listeners.forEach(s=>{s(W(this,Ta))})})}},mE),pn,yE,gD=(yE=class extends el{constructor(e={}){super();Pe(this,pn);this.config=e,je(this,pn,new Map)}build(e,r,a){const i=r.queryKey,s=r.queryHash??h0(i,r);let o=this.get(s);return o||(o=new sD({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(r),state:a,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){W(this,pn).has(e.queryHash)||(W(this,pn).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const r=W(this,pn).get(e.queryHash);r&&(e.destroy(),r===e&&W(this,pn).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){rr.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return W(this,pn).get(e)}getAll(){return[...W(this,pn).values()]}find(e){const r={exact:!0,...e};return this.getAll().find(a=>rw(r,a))}findAll(e={}){const r=this.getAll();return Object.keys(e).length>0?r.filter(a=>rw(e,a)):r}notify(e){rr.batch(()=>{this.listeners.forEach(r=>{r(e)})})}onFocus(){rr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){rr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},pn=new WeakMap,yE),tr,_i,Pi,xo,bo,Ui,wo,So,xE,mD=(xE=class{constructor(t={}){Pe(this,tr);Pe(this,_i);Pe(this,Pi);Pe(this,xo);Pe(this,bo);Pe(this,Ui);Pe(this,wo);Pe(this,So);je(this,tr,t.queryCache||new gD),je(this,_i,t.mutationCache||new dD),je(this,Pi,t.defaultOptions||{}),je(this,xo,new Map),je(this,bo,new Map),je(this,Ui,0)}mount(){Hf(this,Ui)._++,W(this,Ui)===1&&(je(this,wo,g0.subscribe(async t=>{t&&(await this.resumePausedMutations(),W(this,tr).onFocus())})),je(this,So,Nd.subscribe(async t=>{t&&(await this.resumePausedMutations(),W(this,tr).onOnline())})))}unmount(){var t,e;Hf(this,Ui)._--,W(this,Ui)===0&&((t=W(this,wo))==null||t.call(this),je(this,wo,void 0),(e=W(this,So))==null||e.call(this),je(this,So,void 0))}isFetching(t){return W(this,tr).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return W(this,_i).findAll({...t,status:"pending"}).length}getQueryData(t){var r;const e=this.defaultQueryOptions({queryKey:t});return(r=W(this,tr).get(e.queryHash))==null?void 0:r.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),r=W(this,tr).build(this,e),a=r.state.data;return a===void 0?this.fetchQuery(t):(t.revalidateIfStale&&r.isStaleByTime(Gi(e.staleTime,r))&&this.prefetchQuery(e),Promise.resolve(a))}getQueriesData(t){return W(this,tr).findAll(t).map(({queryKey:e,state:r})=>{const a=r.data;return[e,a]})}setQueryData(t,e,r){const a=this.defaultQueryOptions({queryKey:t}),i=W(this,tr).get(a.queryHash),s=i==null?void 0:i.state.data,o=Xj(e,s);if(o!==void 0)return W(this,tr).build(this,a).setData(o,{...r,manual:!0})}setQueriesData(t,e,r){return rr.batch(()=>W(this,tr).findAll(t).map(({queryKey:a})=>[a,this.setQueryData(a,e,r)]))}getQueryState(t){var r;const e=this.defaultQueryOptions({queryKey:t});return(r=W(this,tr).get(e.queryHash))==null?void 0:r.state}removeQueries(t){const e=W(this,tr);rr.batch(()=>{e.findAll(t).forEach(r=>{e.remove(r)})})}resetQueries(t,e){const r=W(this,tr);return rr.batch(()=>(r.findAll(t).forEach(a=>{a.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const r={revert:!0,...e},a=rr.batch(()=>W(this,tr).findAll(t).map(i=>i.cancel(r)));return Promise.all(a).then(Yr).catch(Yr)}invalidateQueries(t,e={}){return rr.batch(()=>(W(this,tr).findAll(t).forEach(r=>{r.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 r={...e,cancelRefetch:e.cancelRefetch??!0},a=rr.batch(()=>W(this,tr).findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,r);return r.throwOnError||(s=s.catch(Yr)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(a).then(Yr)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const r=W(this,tr).build(this,e);return r.isStaleByTime(Gi(e.staleTime,r))?r.fetch(e):Promise.resolve(r.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Yr).catch(Yr)}fetchInfiniteQuery(t){return t.behavior=Ad(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Yr).catch(Yr)}ensureInfiniteQueryData(t){return t.behavior=Ad(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Nd.isOnline()?W(this,_i).resumePausedMutations():Promise.resolve()}getQueryCache(){return W(this,tr)}getMutationCache(){return W(this,_i)}getDefaultOptions(){return W(this,Pi)}setDefaultOptions(t){je(this,Pi,t)}setQueryDefaults(t,e){W(this,xo).set(Ki(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...W(this,xo).values()],r={};return e.forEach(a=>{Hu(t,a.queryKey)&&Object.assign(r,a.defaultOptions)}),r}setMutationDefaults(t,e){W(this,bo).set(Ki(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...W(this,bo).values()],r={};return e.forEach(a=>{Hu(t,a.mutationKey)&&Object.assign(r,a.defaultOptions)}),r}defaultQueryOptions(t){if(t._defaulted)return t;const e={...W(this,Pi).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=h0(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===Na&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...W(this,Pi).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){W(this,tr).clear(),W(this,_i).clear()}},tr=new WeakMap,_i=new WeakMap,Pi=new WeakMap,xo=new WeakMap,bo=new WeakMap,Ui=new WeakMap,wo=new WeakMap,So=new WeakMap,xE),QE=I.createContext(void 0),vc=t=>{const e=I.useContext(QE);if(t)return t;if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},yD=({client:t,children:e})=>(I.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),m.jsx(QE.Provider,{value:t,children:e})),YE=I.createContext(!1),KE=()=>I.useContext(YE);YE.Provider;function xD(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var bD=I.createContext(xD()),XE=()=>I.useContext(bD),$E=(t,e,r)=>{const a=r!=null&&r.state.error&&typeof t.throwOnError=="function"?p0(t.throwOnError,[r.state.error,r]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||a)&&(e.isReset()||(t.retryOnMount=!1))},ZE=t=>{I.useEffect(()=>{t.clearReset()},[t])},WE=({result:t,errorResetBoundary:e,throwOnError:r,query:a,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&a&&(i&&t.data===void 0||p0(r,[t.error,a])),y0=(t,e)=>e.state.data===void 0,JE=t=>{if(t.suspense){const r=i=>i==="static"?i:Math.max(i??1e3,1e3),a=t.staleTime;t.staleTime=typeof a=="function"?(...i)=>r(a(...i)):r(a),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},wD=(t,e)=>t.isLoading&&t.isFetching&&!e,_m=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,Pm=(t,e,r)=>e.fetchOptimistic(t).catch(()=>{r.clearReset()});function eT({queries:t,...e},r){const a=vc(r),i=KE(),s=XE(),o=I.useMemo(()=>t.map(E=>{const S=a.defaultQueryOptions(E);return S._optimisticResults=i?"isRestoring":"optimistic",S}),[t,a,i]);o.forEach(E=>{JE(E);const S=a.getQueryCache().get(E.queryHash);$E(E,s,S)}),ZE(s);const[u]=I.useState(()=>new pD(a,o,e)),[f,d,h]=u.getOptimisticResult(o,e.combine),p=!i&&e.subscribed!==!1;I.useSyncExternalStore(I.useCallback(E=>p?u.subscribe(rr.batchCalls(E)):Yr,[u,p]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),I.useEffect(()=>{u.setQueries(o,e)},[o,e,u]);const y=f.some((E,S)=>_m(o[S],E))?f.flatMap((E,S)=>{const T=o[S];if(T&&_m(T,E)){const C=new hc(a,T);return Pm(T,C,s)}return[]}):[];if(y.length>0)throw Promise.all(y);const b=f.find((E,S)=>{const T=o[S];return T&&WE({result:E,errorResetBoundary:s,throwOnError:T.throwOnError,query:a.getQueryCache().get(T.queryHash),suspense:T.suspense})});if(b!=null&&b.error)throw b.error;return d(h())}function Qd(t,e,r){var g,y,b,E;const a=KE(),i=XE(),s=vc(r),o=s.defaultQueryOptions(t);(y=(g=s.getDefaultOptions().queries)==null?void 0:g._experimental_beforeQuery)==null||y.call(g,o);const u=s.getQueryCache().get(o.queryHash);o._optimisticResults=a?"isRestoring":"optimistic",JE(o),$E(o,i,u),ZE(i);const f=!s.getQueryCache().get(o.queryHash),[d]=I.useState(()=>new e(s,o)),h=d.getOptimisticResult(o),p=!a&&t.subscribed!==!1;if(I.useSyncExternalStore(I.useCallback(S=>{const T=p?d.subscribe(rr.batchCalls(S)):Yr;return d.updateResult(),T},[d,p]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),I.useEffect(()=>{d.setOptions(o)},[o,d]),_m(o,h))throw Pm(o,d,i);if(WE({result:h,errorResetBoundary:i,throwOnError:o.throwOnError,query:u,suspense:o.suspense}))throw h.error;if((E=(b=s.getDefaultOptions().queries)==null?void 0:b._experimental_afterQuery)==null||E.call(b,o,h),o.experimental_prefetchInRender&&!Gs&&wD(h,a)){const S=f?Pm(o,d,i):u==null?void 0:u.promise;S==null||S.catch(Yr).finally(()=>{d.updateResult()})}return o.notifyOnChangeProps?h:d.trackResult(h)}function SD(t,e){return Qd(t,hc,e)}function ED(t,e){return Qd({...t,enabled:!0,suspense:!0,throwOnError:y0,placeholderData:void 0},hc,e)}function TD(t,e){return Qd({...t,enabled:!0,suspense:!0,throwOnError:y0},HE,e)}function CD(t,e){return eT({...t,queries:t.queries.map(r=>({...r,suspense:!0,throwOnError:y0,enabled:!0,placeholderData:void 0}))},e)}function ND(t,e){const r=vc(e);r.getQueryState(t.queryKey)||r.prefetchQuery(t)}function AD(t,e){const r=vc(e);r.getQueryState(t.queryKey)||r.prefetchInfiniteQuery(t)}function jD(t,e){const r=vc(e),[a]=I.useState(()=>new hD(r,t));I.useEffect(()=>{a.setOptions(t)},[a,t]);const i=I.useSyncExternalStore(I.useCallback(o=>a.subscribe(rr.batchCalls(o)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),s=I.useCallback((o,u)=>{a.mutate(o,u).catch(Yr)},[a]);if(i.error&&p0(a.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:s,mutateAsync:i.mutate}}function DD(t,e){return Qd(t,HE,e)}var OD=Object.create,tT=Object.defineProperty,MD=Object.getOwnPropertyDescriptor,rT=Object.getOwnPropertyNames,RD=Object.getPrototypeOf,kD=Object.prototype.hasOwnProperty,yn=(t,e)=>function(){return e||(0,t[rT(t)[0]])((e={exports:{}}).exports,e),e.exports},BD=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(var i=rT(e),s=0,o=i.length,u;s<o;s++)u=i[s],!kD.call(t,u)&&u!==r&&tT(t,u,{get:(f=>e[f]).bind(null,u),enumerable:!(a=MD(e,u))||a.enumerable});return t},or=(t,e,r)=>(r=t!=null?OD(RD(t)):{},BD(e||!t||!t.__esModule?tT(r,"default",{value:t,enumerable:!0}):r,t)),aT=yn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(t,e){function r(a){"@babel/helpers - typeof";return e.exports=r=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,r(a)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),LD=yn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(t,e){var r=aT().default;function a(i,s){if(r(i)!="object"||!i)return i;var o=i[Symbol.toPrimitive];if(o!==void 0){var u=o.call(i,s||"default");if(r(u)!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(i)}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}}),zD=yn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(t,e){var r=aT().default,a=LD();function i(s){var o=a(s,"string");return r(o)=="symbol"?o:o+""}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports}}),tl=yn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,e){var r=zD();function a(i,s,o){return(s=r(s))in i?Object.defineProperty(i,s,{value:o,enumerable:!0,configurable:!0,writable:!0}):i[s]=o,i}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}}),rn=yn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,e){var r=tl();function a(s,o){var u=Object.keys(s);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(s);o&&(f=f.filter(function(d){return Object.getOwnPropertyDescriptor(s,d).enumerable})),u.push.apply(u,f)}return u}function i(s){for(var o=1;o<arguments.length;o++){var u=arguments[o]!=null?arguments[o]:{};o%2?a(Object(u),!0).forEach(function(f){r(s,f,u[f])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(u)):a(Object(u)).forEach(function(f){Object.defineProperty(s,f,Object.getOwnPropertyDescriptor(u,f))})}return s}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports}});function Yd(t){const e={subscribe(r){let a=null,i=!1,s=!1,o=!1;function u(){if(a===null){o=!0;return}s||(s=!0,typeof a=="function"?a():a&&a.unsubscribe())}return a=t({next(f){var d;i||(d=r.next)===null||d===void 0||d.call(r,f)},error(f){var d;i||(i=!0,(d=r.error)===null||d===void 0||d.call(r,f),u())},complete(){var f;i||(i=!0,(f=r.complete)===null||f===void 0||f.call(r),u())}}),o&&u(),{unsubscribe:u}},pipe(...r){return r.reduce(_D,e)}};return e}function _D(t,e){return e(t)}function PD(t){const e=new AbortController;return new Promise((a,i)=>{let s=!1;function o(){s||(s=!0,u.unsubscribe())}e.signal.addEventListener("abort",()=>{i(e.signal.reason)});const u=t.subscribe({next(f){s=!0,a(f),o()},error(f){i(f)},complete(){e.abort(),o()}})})}function UD(t){return e=>{let r=0,a=null;const i=[];function s(){a||(a=e.subscribe({next(u){for(const d of i){var f;(f=d.next)===null||f===void 0||f.call(d,u)}},error(u){for(const d of i){var f;(f=d.error)===null||f===void 0||f.call(d,u)}},complete(){for(const f of i){var u;(u=f.complete)===null||u===void 0||u.call(f)}}}))}function o(){if(r===0&&a){const u=a;a=null,u.unsubscribe()}}return Yd(u=>(r++,i.push(u),s(),{unsubscribe(){r--,o();const f=i.findIndex(d=>d===u);f>-1&&i.splice(f,1)}}))}}function qD(t){let e=t;const r=[],a=o=>{e!==void 0&&o.next(e),r.push(o)},i=o=>{r.splice(r.indexOf(o),1)},s=Yd(o=>(a(o),()=>{i(o)}));return s.next=o=>{if(e!==o){e=o;for(const u of r)u.next(o)}},s.get=()=>e,s}function ID(t){return Yd(e=>{function r(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(f){return r(i+1,f)}})}return r().subscribe(e)})}function Qs(t){return!!t&&!Array.isArray(t)&&typeof t=="object"}function VD(){return Object.create(null)}const FD=typeof Symbol=="function"&&!!Symbol.asyncIterator;function nT(t){return FD&&Qs(t)&&Symbol.asyncIterator in t}var HD=Object.create,iT=Object.defineProperty,GD=Object.getOwnPropertyDescriptor,sT=Object.getOwnPropertyNames,QD=Object.getPrototypeOf,YD=Object.prototype.hasOwnProperty,pc=(t,e)=>function(){return e||(0,t[sT(t)[0]])((e={exports:{}}).exports,e),e.exports},KD=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(var i=sT(e),s=0,o=i.length,u;s<o;s++)u=i[s],!YD.call(t,u)&&u!==r&&iT(t,u,{get:(f=>e[f]).bind(null,u),enumerable:!(a=GD(e,u))||a.enumerable});return t},Kd=(t,e,r)=>(r=t!=null?HD(QD(t)):{},KD(iT(r,"default",{value:t,enumerable:!0}),t));const lT=()=>{},fw=t=>{Object.freeze&&Object.freeze(t)};function oT(t,e,r){var a;const i=e.join(".");return(a=r[i])!==null&&a!==void 0||(r[i]=new Proxy(lT,{get(s,o){if(!(typeof o!="string"||o==="then"))return oT(t,[...e,o],r)},apply(s,o,u){const f=e[e.length-1];let d={args:u,path:e};return f==="call"?d={args:u.length>=2?[u[1]]:[],path:e.slice(0,-1)}:f==="apply"&&(d={args:u.length>=2?u[1]:[],path:e.slice(0,-1)}),fw(d.args),fw(d.path),t(d)}})),r[i]}const Xd=t=>oT(t,[],VD()),x0=t=>new Proxy(lT,{get(e,r){if(r!=="then")return t(r)}});var uT=pc({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(t,e){function r(a){"@babel/helpers - typeof";return e.exports=r=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,r(a)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),XD=pc({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(t,e){var r=uT().default;function a(i,s){if(r(i)!="object"||!i)return i;var o=i[Symbol.toPrimitive];if(o!==void 0){var u=o.call(i,s||"default");if(r(u)!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(i)}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}}),$D=pc({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(t,e){var r=uT().default,a=XD();function i(s){var o=a(s,"string");return r(o)=="symbol"?o:o+""}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports}}),cT=pc({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,e){var r=$D();function a(i,s,o){return(s=r(s))in i?Object.defineProperty(i,s,{value:o,enumerable:!0,configurable:!0,writable:!0}):i[s]=o,i}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}}),b0=pc({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,e){var r=cT();function a(s,o){var u=Object.keys(s);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(s);o&&(f=f.filter(function(d){return Object.getOwnPropertyDescriptor(s,d).enumerable})),u.push.apply(u,f)}return u}function i(s){for(var o=1;o<arguments.length;o++){var u=arguments[o]!=null?arguments[o]:{};o%2?a(Object(u),!0).forEach(function(f){r(s,f,u[f])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(u)):a(Object(u)).forEach(function(f){Object.defineProperty(s,f,Object.getOwnPropertyDescriptor(u,f))})}return s}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports}});Kd(b0());Kd(cT());var Qf=Kd(b0());function ZD(t,e){if("error"in t){const a=e.deserialize(t.error);return{ok:!1,error:(0,Qf.default)((0,Qf.default)({},t),{},{error:a})}}return{ok:!0,result:(0,Qf.default)((0,Qf.default)({},t.result),(!t.result.type||t.result.type==="data")&&{type:"data",data:e.deserialize(t.result.data)})}}var kp=class extends Error{constructor(){super("Unable to transform response from server")}};function WD(t,e){let r;try{r=ZD(t,e)}catch{throw new kp}if(!r.ok&&(!Qs(r.error.error)||typeof r.error.error.code!="number"))throw new kp;if(r.ok&&!Qs(r.result))throw new kp;return r}Kd(b0());var Yf=or(tl(),1),ql=or(rn(),1);function JD(t){return t instanceof jd}function eO(t){return Qs(t)&&Qs(t.error)&&typeof t.error.code=="number"&&typeof t.error.message=="string"}function tO(t,e){return typeof t=="string"?t:Qs(t)&&typeof t.message=="string"?t.message:e}var jd=class fd extends Error{constructor(e,r){var a,i;const s=r==null?void 0:r.cause;super(e,{cause:s}),(0,Yf.default)(this,"cause",void 0),(0,Yf.default)(this,"shape",void 0),(0,Yf.default)(this,"data",void 0),(0,Yf.default)(this,"meta",void 0),this.meta=r==null?void 0:r.meta,this.cause=s,this.shape=r==null||(a=r.result)===null||a===void 0?void 0:a.error,this.data=r==null||(i=r.result)===null||i===void 0?void 0:i.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,fd.prototype)}static from(e,r={}){const a=e;return JD(a)?(r.meta&&(a.meta=(0,ql.default)((0,ql.default)({},a.meta),r.meta)),a):eO(a)?new fd(a.error.message,(0,ql.default)((0,ql.default)({},r),{},{result:a,cause:r.cause})):new fd(tO(a,"Unknown error"),(0,ql.default)((0,ql.default)({},r),{},{cause:a}))}};function rO(t){const e=t;return e?"input"in e?e:{input:e,output:e}:{input:{serialize:r=>r,deserialize:r=>r},output:{serialize:r=>r,deserialize:r=>r}}}const dw=t=>typeof t=="function";function aO(t){if(t)return t;if(typeof window<"u"&&dw(window.fetch))return window.fetch;if(typeof globalThis<"u"&&dw(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}var Pu=or(rn());function nO(t){return{url:t.url.toString(),fetch:t.fetch,transformer:rO(t.transformer),methodOverride:t.methodOverride}}function iO(t){const e={};for(let r=0;r<t.length;r++){const a=t[r];e[r]=a}return e}const sO={query:"GET",mutation:"POST",subscription:"PATCH"};function fT(t){return"input"in t?t.transformer.input.serialize(t.input):iO(t.inputs.map(e=>t.transformer.input.serialize(e)))}const dT=t=>{const e=t.url.split("?");let a=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=fT(t);s!==void 0&&t.methodOverride!=="POST"&&i.push(`input=${encodeURIComponent(JSON.stringify(s))}`)}return i.length&&(a+="?"+i.join("&")),a},lO=t=>{if(t.type==="query"&&t.methodOverride!=="POST")return;const e=fT(t);return e!==void 0?JSON.stringify(e):void 0},oO=t=>dO((0,Pu.default)((0,Pu.default)({},t),{},{contentTypeHeader:"application/json",getUrl:dT,getBody:lO}));var uO=class extends Error{constructor(){const t="AbortError";super(t),this.name=t,this.message=t}};const cO=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 uO};async function fO(t){var e;cO(t.signal);const r=t.getUrl(t),a=t.getBody(t),i=(e=t.methodOverride)!==null&&e!==void 0?e:sO[t.type],s=await(async()=>{const u=await t.headers();return Symbol.iterator in u?Object.fromEntries(u):u})(),o=(0,Pu.default)((0,Pu.default)((0,Pu.default)({},t.contentTypeHeader&&i!=="GET"?{"content-type":t.contentTypeHeader}:{}),t.trpcAcceptHeader?{"trpc-accept":t.trpcAcceptHeader}:void 0),s);return aO(t.fetch)(r,{method:i,signal:t.signal,body:a,headers:o})}async function dO(t){const e={},r=await fO(t);e.response=r;const a=await r.json();return e.responseJSON=a,{json:a,meta:e}}or(rn(),1);const hw=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function vw(t){let e=null,r=null;const a=()=>{clearTimeout(r),r=null,e=null};function i(u){const f=[[]];let d=0;for(;;){const g=u[d];if(!g)break;const y=f[f.length-1];if(g.aborted){var h;(h=g.reject)===null||h===void 0||h.call(g,new Error("Aborted")),d++;continue}if(t.validate(y.concat(g).map(E=>E.key))){y.push(g),d++;continue}if(y.length===0){var p;(p=g.reject)===null||p===void 0||p.call(g,new Error("Input is too big for a single dispatch")),d++;continue}f.push([])}return f}function s(){const u=i(e);a();for(const f of u){if(!f.length)continue;const d={items:f};for(const p of f)p.batch=d;t.fetch(d.items.map(p=>p.key)).then(async p=>{await Promise.all(p.map(async(y,b)=>{const E=d.items[b];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 d.items){var g;(g=y.reject)===null||g===void 0||g.call(y,new Error("Missing result")),y.batch=null}}).catch(p=>{for(const y of d.items){var g;(g=y.reject)===null||g===void 0||g.call(y,p),y.batch=null}})}}function o(u){var f;const d={aborted:!1,key:u,batch:null,resolve:hw,reject:hw},h=new Promise((p,g)=>{var y;d.reject=g,d.resolve=p,(y=e)!==null&&y!==void 0||(e=[]),e.push(d)});return(f=r)!==null&&f!==void 0||(r=setTimeout(s)),h}return{load:o}}function hO(...t){const e=new AbortController,r=t.length;let a=0;const i=()=>{++a===r&&e.abort()};for(const s of t)s!=null&&s.aborted?i():s==null||s.addEventListener("abort",i,{once:!0});return e.signal}var Kf=or(rn(),1);function vO(t){var e,r;const a=nO(t),i=(e=t.maxURLLength)!==null&&e!==void 0?e:1/0,s=(r=t.maxItems)!==null&&r!==void 0?r:1/0;return()=>{const o=h=>({validate(p){if(i===1/0&&s===1/0)return!0;if(p.length>s)return!1;const g=p.map(E=>E.path).join(","),y=p.map(E=>E.input);return dT((0,Kf.default)((0,Kf.default)({},a),{},{type:h,path:g,inputs:y,signal:null})).length<=i},async fetch(p){const g=p.map(C=>C.path).join(","),y=p.map(C=>C.input),b=hO(...p.map(C=>C.signal)),E=await oO((0,Kf.default)((0,Kf.default)({},a),{},{path:g,inputs:y,type:h,headers(){return t.headers?typeof t.headers=="function"?t.headers({opList:p}):t.headers:{}},signal:b}));return(Array.isArray(E.json)?E.json:p.map(()=>E.json)).map(C=>({meta:E.meta,json:C}))}}),u=vw(o("query")),f=vw(o("mutation")),d={query:u,mutation:f};return({op:h})=>Yd(p=>{/* istanbul ignore if -- @preserve */if(h.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const y=d[h.type].load(h);let b;return y.then(E=>{b=E;const S=WD(E.json,a.transformer.output);if(!S.ok){p.error(jd.from(S.error,{meta:E.meta}));return}p.next({context:E.meta,result:S.result}),p.complete()}).catch(E=>{p.error(jd.from(E,{meta:b==null?void 0:b.meta}))}),()=>{}})}}or(rn(),1);const hT=(t,...e)=>typeof t=="function"?t(...e):t;or(tl(),1);function pO(){let t,e;return{promise:new Promise((a,i)=>{t=a,e=i}),resolve:t,reject:e}}async function gO(t){const e=await hT(t.url);if(!t.connectionParams)return e;const a=`${e.includes("?")?"&":"?"}connectionParams=1`;return e+a}async function mO(t,e){const r={method:"connectionParams",data:await hT(t)};return e.encode(r)}or(tl(),1);var ji=or(tl(),1);function yO(t){const{promise:e,resolve:r,reject:a}=pO();return t.addEventListener("open",()=>{t.removeEventListener("error",a),r()}),t.addEventListener("error",a),e}function xO(t,{intervalMs:e,pongTimeoutMs:r}){let a,i;function s(){a=setTimeout(()=>{t.send("PING"),i=setTimeout(()=>{t.close()},r)},e)}function o(){clearTimeout(a),s()}function u(){clearTimeout(i),o()}t.addEventListener("open",s),t.addEventListener("message",({data:f})=>{clearTimeout(a),s(),f==="PONG"&&u()}),t.addEventListener("close",()=>{clearTimeout(a),clearTimeout(i)})}var bO=class Um{constructor(e){var r;if((0,ji.default)(this,"id",++Um.connectCount),(0,ji.default)(this,"WebSocketPonyfill",void 0),(0,ji.default)(this,"urlOptions",void 0),(0,ji.default)(this,"keepAliveOpts",void 0),(0,ji.default)(this,"encoder",void 0),(0,ji.default)(this,"wsObservable",qD(null)),(0,ji.default)(this,"openPromise",null),this.WebSocketPonyfill=(r=e.WebSocketPonyfill)!==null&&r!==void 0?r: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=++Um.connectCount;const r=gO(e.urlOptions).then(a=>new e.WebSocketPonyfill(a));e.openPromise=r.then(async a=>{e.ws=a,a.binaryType="arraybuffer",a.addEventListener("message",function({data:i}){i==="PING"&&this.send("PONG")}),e.keepAliveOpts.enabled&&xO(a,e.keepAliveOpts),a.addEventListener("close",()=>{e.ws===a&&(e.ws=null)}),await yO(a),e.urlOptions.connectionParams&&a.send(await mO(e.urlOptions.connectionParams,e.encoder))});try{await e.openPromise}finally{e.openPromise=null}}async close(){var e=this;try{await e.openPromise}finally{var r;(r=e.ws)===null||r===void 0||r.close()}}};(0,ji.default)(bO,"connectCount",0);or(tl(),1);or(rn(),1);var Bp=or(tl(),1),pw=or(rn(),1),$d=class{constructor(t){(0,Bp.default)(this,"links",void 0),(0,Bp.default)(this,"runtime",void 0),(0,Bp.default)(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=t.links.map(e=>e(this.runtime))}$request(t){var e;return ID({links:this.links,op:(0,pw.default)((0,pw.default)({},t),{},{context:(e=t.context)!==null&&e!==void 0?e:{},id:++this.requestId})}).pipe(UD())}async requestAsPromise(t){var e=this;try{const r=e.$request(t);return(await PD(r)).result.data}catch(r){throw jd.from(r)}}query(t,e,r){return this.requestAsPromise({type:"query",path:t,input:e,context:r==null?void 0:r.context,signal:r==null?void 0:r.signal})}mutation(t,e,r){return this.requestAsPromise({type:"mutation",path:t,input:e,context:r==null?void 0:r.context,signal:r==null?void 0:r.signal})}subscription(t,e,r){return this.$request({type:"subscription",path:t,input:e,context:r.context,signal:r.signal}).subscribe({next(i){switch(i.result.type){case"state":{var s;(s=r.onConnectionStateChange)===null||s===void 0||s.call(r,i.result);break}case"started":{var o;(o=r.onStarted)===null||o===void 0||o.call(r,{context:i.context});break}case"stopped":{var u;(u=r.onStopped)===null||u===void 0||u.call(r);break}case"data":case void 0:{var f;(f=r.onData)===null||f===void 0||f.call(r,i.result.data);break}}},error(i){var s;(s=r.onError)===null||s===void 0||s.call(r,i)},complete(){var i;(i=r.onComplete)===null||i===void 0||i.call(r)}})}};const vT=Symbol.for("trpc_untypedClient"),wO={query:"query",mutate:"mutation",subscribe:"subscription"},SO=t=>wO[t];function pT(t){const e=Xd(({path:r,args:a})=>{const i=[...r],s=SO(i.pop()),o=i.join(".");return t[s](o,...a)});return x0(r=>r===vT?t:e[r])}function EO(t){const e=new $d(t);return pT(e)}function w0(t){return t[vT]}or(rn(),1);or(rn(),1);var TO=yn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(t,e){function r(i){var s,o,u,f=2;for(typeof Symbol<"u"&&(o=Symbol.asyncIterator,u=Symbol.iterator);f--;){if(o&&(s=i[o])!=null)return s.call(i);if(u&&(s=i[u])!=null)return new a(s.call(i));o="@@asyncIterator",u="@@iterator"}throw new TypeError("Object is not async iterable")}function a(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(f){return{value:f,done:u}})}return a=function(u){this.s=u,this.n=u.next},a.prototype={s:null,n:null,next:function(){return s(this.n.apply(this.s,arguments))},return:function(u){var f=this.s.return;return f===void 0?Promise.resolve({value:u,done:!0}):s(f.apply(this.s,arguments))},throw:function(u){var f=this.s.return;return f===void 0?Promise.reject(u):s(f.apply(this.s,arguments))}},new a(i)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}});or(TO(),1);or(rn(),1);var CO=yn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(t,e){function r(){var a=typeof SuppressedError=="function"?SuppressedError:function(u,f){var d=Error();return d.name="SuppressedError",d.error=u,d.suppressed=f,d},i={},s=[];function o(u,f){if(f!=null){if(Object(f)!==f)throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(u)var d=f[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(d===void 0&&(d=f[Symbol.dispose||Symbol.for("Symbol.dispose")],u))var h=d;if(typeof d!="function")throw new TypeError("Object is not disposable.");h&&(d=function(){try{h.call(f)}catch(g){return Promise.reject(g)}}),s.push({v:f,d,a:u})}else u&&s.push({d:f,a:u});return f}return{e:i,u:o.bind(null,!1),a:o.bind(null,!0),d:function(){var f,d=this.e,h=0;function p(){for(;f=s.pop();)try{if(!f.a&&h===1)return h=0,s.push(f),Promise.resolve().then(p);if(f.d){var y=f.d.call(f.v);if(f.a)return h|=2,Promise.resolve(y).then(p,g)}else h|=1}catch(b){return g(b)}if(h===1)return d!==i?Promise.reject(d):Promise.resolve();if(d!==i)throw d}function g(y){return d=d!==i?new a(y,d):y,p()}return p()}}}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),gT=yn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js"(t,e){function r(a,i){this.v=a,this.k=i}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),NO=yn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(t,e){var r=gT();function a(i){return new r(i,0)}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}}),AO=yn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(t,e){var r=gT();function a(s){return function(){return new i(s.apply(this,arguments))}}function i(s){var o,u;function f(h,p){try{var g=s[h](p),y=g.value,b=y instanceof r;Promise.resolve(b?y.v:y).then(function(E){if(b){var S=h==="return"?"return":"next";if(!y.k||E.done)return f(S,E);E=s[S](E).value}d(g.done?"return":"normal",E)},function(E){f("throw",E)})}catch(E){d("throw",E)}}function d(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)?f(o.key,o.arg):u=null}this._invoke=function(h,p){return new Promise(function(g,y){var b={key:h,arg:p,resolve:g,reject:y,next:null};u?u=u.next=b:(o=u=b,f(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=a,e.exports.__esModule=!0,e.exports.default=e.exports}});or(CO(),1);or(NO(),1);or(AO(),1);or(rn(),1);var jO=Object.create,mT=Object.defineProperty,DO=Object.getOwnPropertyDescriptor,yT=Object.getOwnPropertyNames,OO=Object.getPrototypeOf,MO=Object.prototype.hasOwnProperty,ns=(t,e)=>function(){return e||(0,t[yT(t)[0]])((e={exports:{}}).exports,e),e.exports},RO=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(var i=yT(e),s=0,o=i.length,u;s<o;s++)u=i[s],!MO.call(t,u)&&u!==r&&mT(t,u,{get:(f=>e[f]).bind(null,u),enumerable:!(a=DO(e,u))||a.enumerable});return t},rl=(t,e,r)=>(r=t!=null?jO(OO(t)):{},RO(e||!t||!t.__esModule?mT(r,"default",{value:t,enumerable:!0}):r,t)),kO=ns({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutPropertiesLoose.js"(t,e){function r(a,i){if(a==null)return{};var s={};for(var o in a)if({}.hasOwnProperty.call(a,o)){if(i.includes(o))continue;s[o]=a[o]}return s}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),BO=ns({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutProperties.js"(t,e){var r=kO();function a(i,s){if(i==null)return{};var o,u,f=r(i,s);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(i);for(u=0;u<d.length;u++)o=d[u],s.includes(o)||{}.propertyIsEnumerable.call(i,o)&&(f[o]=i[o])}return f}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}}),xT=ns({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(t,e){function r(a){"@babel/helpers - typeof";return e.exports=r=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,r(a)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),LO=ns({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(t,e){var r=xT().default;function a(i,s){if(r(i)!="object"||!i)return i;var o=i[Symbol.toPrimitive];if(o!==void 0){var u=o.call(i,s||"default");if(r(u)!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(i)}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}}),zO=ns({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(t,e){var r=xT().default,a=LO();function i(s){var o=a(s,"string");return r(o)=="symbol"?o:o+""}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports}}),_O=ns({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,e){var r=zO();function a(i,s,o){return(s=r(s))in i?Object.defineProperty(i,s,{value:o,enumerable:!0,configurable:!0,writable:!0}):i[s]=o,i}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}}),gc=ns({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,e){var r=_O();function a(s,o){var u=Object.keys(s);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(s);o&&(f=f.filter(function(d){return Object.getOwnPropertyDescriptor(s,d).enumerable})),u.push.apply(u,f)}return u}function i(s){for(var o=1;o<arguments.length;o++){var u=arguments[o]!=null?arguments[o]:{};o%2?a(Object(u),!0).forEach(function(f){r(s,f,u[f])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(u)):a(Object(u)).forEach(function(f){Object.defineProperty(s,f,Object.getOwnPropertyDescriptor(u,f))})}return s}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports}}),PO=rl(BO(),1),gw=rl(gc(),1);const UO=["cursor","direction"];function dn(t,e,r){const a=t.flatMap(i=>i.split("."));if(!e&&(!r||r==="any"))return a.length?[a]:[];if(r==="infinite"&&Qs(e)&&("direction"in e||"cursor"in e)){const{cursor:i,direction:s}=e,o=(0,PO.default)(e,UO);return[a,{input:o,type:"infinite"}]}return[a,(0,gw.default)((0,gw.default)({},typeof e<"u"&&e!==Na&&{input:e}),r&&r!=="any"&&{type:r})]}function dd(t){return dn(t,void 0,"any")}function qO(t){return Xd(({path:e,args:r})=>{var a;const i=[...e],s=i.pop();if(s==="useMutation")return t[s](i,...r);if(s==="_def")return{path:i};const[o,...u]=r,f=(a=u[0])!==null&&a!==void 0?a:{};return t[s](i,o,f)})}var Lp;const IO=["client","ssrContext","ssrState","abortOnUnmount"],VO=(Lp=I.createContext)===null||Lp===void 0?void 0:Lp.call(SE,null),FO=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 HO(t){return Xd(e=>{const r=[...e.path],a=r.pop(),i=[...e.args],s=i.shift(),o=FO(a),u=dn(r,s,o);return{infiniteQueryOptions:()=>t.infiniteQueryOptions(r,u,i[0]),queryOptions:()=>t.queryOptions(r,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(dd(r),s),getMutationDefaults:()=>t.getMutationDefaults(dd(r)),isMutating:()=>t.isMutating({mutationKey:dd(r)})}[a]()})}function GO(t){const e=pT(t.client),r=HO(t);return x0(a=>{const i=a;return i==="client"?e:IO.includes(i)?t[i]:r[a]})}var QO=rl(gc(),1);function mw(t){const e=t instanceof $d?t:w0(t);return Xd(r=>{const a=r.path,i=a.join("."),[s,o]=r.args;return(0,QO.default)({queryKey:dn(a,s,"query"),queryFn:()=>e.query(i,s,o==null?void 0:o.trpc)},o)})}var zp=rl(gc(),1);function ea(t,e,r){var a;const i=t[0];let s=(a=t[1])===null||a===void 0?void 0:a.input;if(r){var o;s=(0,zp.default)((0,zp.default)((0,zp.default)({},(o=s)!==null&&o!==void 0?o:{}),r.pageParam?{cursor:r.pageParam}:{}),{},{direction:r.direction})}return[i.join("."),s,e==null?void 0:e.trpc]}var YO=ns({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(t,e){function r(i){var s,o,u,f=2;for(typeof Symbol<"u"&&(o=Symbol.asyncIterator,u=Symbol.iterator);f--;){if(o&&(s=i[o])!=null)return s.call(i);if(u&&(s=i[u])!=null)return new a(s.call(i));o="@@asyncIterator",u="@@iterator"}throw new TypeError("Object is not async iterable")}function a(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(f){return{value:f,done:u}})}return a=function(u){this.s=u,this.n=u.next},a.prototype={s:null,n:null,next:function(){return s(this.n.apply(this.s,arguments))},return:function(u){var f=this.s.return;return f===void 0?Promise.resolve({value:u,done:!0}):s(f.apply(this.s,arguments))},throw:function(u){var f=this.s.return;return f===void 0?Promise.reject(u):s(f.apply(this.s,arguments))}},new a(i)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),KO=rl(YO(),1);function qm(t){return{path:t.path.join(".")}}function Nu(t){const e=qm(t);return I.useMemo(()=>e,[e])}async function bT(t,e,r){const i=e.getQueryCache().build(e,{queryKey:r});i.setState({data:[],status:"success"});const s=[];var o=!1,u=!1,f;try{for(var d=(0,KO.default)(t),h;o=!(h=await d.next()).done;o=!1){const p=h.value;s.push(p),i.setState({data:[...s]})}}catch(p){u=!0,f=p}finally{try{o&&d.return!=null&&await d.return()}finally{if(u)throw f}}return s}var Et=rl(gc(),1);function XO(t){const{client:e,queryClient:r}=t,a=e instanceof $d?e:w0(e);return{infiniteQueryOptions:(i,s,o)=>{var u,f;const d=((u=s[1])===null||u===void 0?void 0:u.input)===Na,h=async p=>{var g;const y=(0,Et.default)((0,Et.default)({},o),{},{trpc:(0,Et.default)((0,Et.default)({},o==null?void 0:o.trpc),!(o==null||(g=o.trpc)===null||g===void 0)&&g.abortOnUnmount?{signal:p.signal}:{signal:null})});return await a.query(...ea(s,y,{direction:p.direction,pageParam:p.pageParam}))};return Object.assign((0,Et.default)((0,Et.default)({},o),{},{initialData:o==null?void 0:o.initialData,queryKey:s,queryFn:d?Na:h,initialPageParam:(f=o==null?void 0:o.initialCursor)!==null&&f!==void 0?f:null}),{trpc:qm({path:i})})},queryOptions:(i,s,o)=>{var u;const f=((u=s[1])===null||u===void 0?void 0:u.input)===Na,d=async h=>{var p;const g=(0,Et.default)((0,Et.default)({},o),{},{trpc:(0,Et.default)((0,Et.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 a.query(...ea(s,g));return nT(y)?bT(y,r,s):y};return Object.assign((0,Et.default)((0,Et.default)({},o),{},{initialData:o==null?void 0:o.initialData,queryKey:s,queryFn:f?Na:d}),{trpc:qm({path:i})})},fetchQuery:(i,s)=>r.fetchQuery((0,Et.default)((0,Et.default)({},s),{},{queryKey:i,queryFn:()=>a.query(...ea(i,s))})),fetchInfiniteQuery:(i,s)=>{var o;return r.fetchInfiniteQuery((0,Et.default)((0,Et.default)({},s),{},{queryKey:i,queryFn:({pageParam:u,direction:f})=>a.query(...ea(i,s,{pageParam:u,direction:f})),initialPageParam:(o=s==null?void 0:s.initialCursor)!==null&&o!==void 0?o:null}))},prefetchQuery:(i,s)=>r.prefetchQuery((0,Et.default)((0,Et.default)({},s),{},{queryKey:i,queryFn:()=>a.query(...ea(i,s))})),prefetchInfiniteQuery:(i,s)=>{var o;return r.prefetchInfiniteQuery((0,Et.default)((0,Et.default)({},s),{},{queryKey:i,queryFn:({pageParam:u,direction:f})=>a.query(...ea(i,s,{pageParam:u,direction:f})),initialPageParam:(o=s==null?void 0:s.initialCursor)!==null&&o!==void 0?o:null}))},ensureQueryData:(i,s)=>r.ensureQueryData((0,Et.default)((0,Et.default)({},s),{},{queryKey:i,queryFn:()=>a.query(...ea(i,s))})),invalidateQueries:(i,s,o)=>r.invalidateQueries((0,Et.default)((0,Et.default)({},s),{},{queryKey:i}),o),resetQueries:(i,s,o)=>r.resetQueries((0,Et.default)((0,Et.default)({},s),{},{queryKey:i}),o),refetchQueries:(i,s,o)=>r.refetchQueries((0,Et.default)((0,Et.default)({},s),{},{queryKey:i}),o),cancelQuery:(i,s)=>r.cancelQueries({queryKey:i},s),setQueryData:(i,s,o)=>r.setQueryData(i,s,o),setQueriesData:(i,s,o,u)=>r.setQueriesData((0,Et.default)((0,Et.default)({},s),{},{queryKey:i}),o,u),getQueryData:i=>r.getQueryData(i),setInfiniteQueryData:(i,s,o)=>r.setQueryData(i,s,o),getInfiniteQueryData:i=>r.getQueryData(i),setMutationDefaults:(i,s)=>{const o=i[0],u=f=>a.mutation(...ea([o,{input:f}],t));return r.setMutationDefaults(i,typeof s=="function"?s({canonicalMutationFn:u}):s)},getMutationDefaults:i=>r.getMutationDefaults(i),isMutating:i=>r.isMutating((0,Et.default)((0,Et.default)({},i),{},{exact:!0}))}}var Be=rl(gc());const yw=(t,e)=>new Proxy(t,{get(a,i){return e(i),a[i]}});function $O(t){var e,r;const a=(e=void 0)!==null&&e!==void 0?e:M=>M.originalFn(),i=(r=void 0)!==null&&r!==void 0?r:VO,s=EO,o=M=>{var D;const{abortOnUnmount:A=!1,queryClient:B,ssrContext:R}=M,[L,_]=I.useState((D=M.ssrState)!==null&&D!==void 0?D:!1),P=M.client instanceof $d?M.client:w0(M.client),q=I.useMemo(()=>XO({client:P,queryClient:B}),[P,B]),F=I.useMemo(()=>(0,Be.default)({abortOnUnmount:A,queryClient:B,client:P,ssrContext:R??null,ssrState:L},q),[A,P,q,B,R,L]);return I.useEffect(()=>{_(Y=>Y?"mounted":!1)},[]),m.jsx(i.Provider,{value:F,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 f(M,D){var A;const{queryClient:B,ssrState:R}=u();return R&&R!=="mounted"&&((A=B.getQueryCache().find({queryKey:M}))===null||A===void 0?void 0:A.state.status)==="error"?(0,Be.default)({retryOnMount:!1},D):D}function d(M,D,A){var B,R,L,_,P;const q=u(),{abortOnUnmount:F,client:Y,ssrState:U,queryClient:z,prefetchQuery:H}=q,X=dn(M,D,"query"),K=z.getQueryDefaults(X),k=D===Na;typeof window>"u"&&U==="prepass"&&(A==null||(B=A.trpc)===null||B===void 0?void 0:B.ssr)!==!1&&((R=A==null?void 0:A.enabled)!==null&&R!==void 0?R:K==null?void 0:K.enabled)!==!1&&!k&&!z.getQueryCache().find({queryKey:X})&&H(X,A);const G=f(X,(0,Be.default)((0,Be.default)({},K),A)),$=(L=(_=A==null||(P=A.trpc)===null||P===void 0?void 0:P.abortOnUnmount)!==null&&_!==void 0?_:void 0)!==null&&L!==void 0?L:F,J=SD((0,Be.default)((0,Be.default)({},G),{},{queryKey:X,queryFn:k?D:async ne=>{const ee=(0,Be.default)((0,Be.default)({},G),{},{trpc:(0,Be.default)((0,Be.default)({},G==null?void 0:G.trpc),$?{signal:ne.signal}:{signal:null})}),ae=await Y.query(...ea(X,ee));return nT(ae)?bT(ae,z,X):ae}}),z);return J.trpc=Nu({path:M}),J}function h(M,D,A){var B,R,L;const _=u(),P=dn(M,D,"query"),q=D===Na,F=(B=(R=A==null||(L=A.trpc)===null||L===void 0?void 0:L.abortOnUnmount)!==null&&R!==void 0?R:void 0)!==null&&B!==void 0?B:_.abortOnUnmount;ND((0,Be.default)((0,Be.default)({},A),{},{queryKey:P,queryFn:q?D:Y=>{const U={trpc:(0,Be.default)((0,Be.default)({},A==null?void 0:A.trpc),F?{signal:Y.signal}:{})};return _.client.query(...ea(P,U))}}))}function p(M,D,A){var B,R,L;const _=u(),P=dn(M,D,"query"),q=(B=(R=A==null||(L=A.trpc)===null||L===void 0?void 0:L.abortOnUnmount)!==null&&R!==void 0?R:void 0)!==null&&B!==void 0?B:_.abortOnUnmount,F=ED((0,Be.default)((0,Be.default)({},A),{},{queryKey:P,queryFn:Y=>{const U=(0,Be.default)((0,Be.default)({},A),{},{trpc:(0,Be.default)((0,Be.default)({},A==null?void 0:A.trpc),q?{signal:Y.signal}:{signal:null})});return _.client.query(...ea(P,U))}}),_.queryClient);return F.trpc=Nu({path:M}),[F.data,F]}function g(M,D){const{client:A,queryClient:B}=u(),R=dd(M),L=B.defaultMutationOptions(B.getMutationDefaults(R)),_=jD((0,Be.default)((0,Be.default)({},D),{},{mutationKey:R,mutationFn:P=>A.mutation(...ea([M,{input:P}],D)),onSuccess(...P){var q,F;return a({originalFn:()=>{var U,z,H;return(U=D==null||(z=D.onSuccess)===null||z===void 0?void 0:z.call(D,...P))!==null&&U!==void 0?U:L==null||(H=L.onSuccess)===null||H===void 0?void 0:H.call(L,...P)},queryClient:B,meta:(q=(F=D==null?void 0:D.meta)!==null&&F!==void 0?F:L==null?void 0:L.meta)!==null&&q!==void 0?q:{}})}}),B);return _.trpc=Nu({path:M}),_}const y={data:void 0,error:null,status:"idle"},b={data:void 0,error:null,status:"connecting"};/* istanbul ignore next -- @preserve */function E(M,D,A){var B;const R=(B=A==null?void 0:A.enabled)!==null&&B!==void 0?B:D!==Na,L=Ki(dn(M,D,"any")),{client:_}=u(),P=I.useRef(A);I.useEffect(()=>{P.current=A});const[q]=I.useState(new Set([])),F=I.useCallback(k=>{q.add(k)},[q]),Y=I.useRef(null),U=I.useCallback(k=>{const G=H.current,$=H.current=k(G);let J=!1;for(const ne of q)if(G[ne]!==$[ne]){J=!0;break}J&&K(yw($,F))},[F,q]),z=I.useCallback(()=>{var k;if((k=Y.current)===null||k===void 0||k.unsubscribe(),!R){U(()=>(0,Be.default)((0,Be.default)({},y),{},{reset:z}));return}U(()=>(0,Be.default)((0,Be.default)({},b),{},{reset:z}));const G=_.subscription(M.join("."),D??void 0,{onStarted:()=>{var $,J;($=(J=P.current).onStarted)===null||$===void 0||$.call(J),U(ne=>(0,Be.default)((0,Be.default)({},ne),{},{status:"pending",error:null}))},onData:$=>{var J,ne;(J=(ne=P.current).onData)===null||J===void 0||J.call(ne,$),U(ee=>(0,Be.default)((0,Be.default)({},ee),{},{status:"pending",data:$,error:null}))},onError:$=>{var J,ne;(J=(ne=P.current).onError)===null||J===void 0||J.call(ne,$),U(ee=>(0,Be.default)((0,Be.default)({},ee),{},{status:"error",error:$}))},onConnectionStateChange:$=>{U(J=>{switch($.state){case"idle":return(0,Be.default)((0,Be.default)({},J),{},{status:$.state,error:null,data:void 0});case"connecting":return(0,Be.default)((0,Be.default)({},J),{},{error:$.error,status:$.state});case"pending":return J}})},onComplete:()=>{var $,J;($=(J=P.current).onComplete)===null||$===void 0||$.call(J),U(ne=>(0,Be.default)((0,Be.default)({},ne),{},{status:"idle",error:null,data:void 0}))}});Y.current=G},[_,L,R,U]);I.useEffect(()=>(z(),()=>{var k;(k=Y.current)===null||k===void 0||k.unsubscribe()}),[z]);const H=I.useRef(R?(0,Be.default)((0,Be.default)({},b),{},{reset:z}):(0,Be.default)((0,Be.default)({},y),{},{reset:z})),[X,K]=I.useState(yw(H.current,F));return X}function S(M,D,A){var B,R,L,_,P;const{client:q,ssrState:F,prefetchInfiniteQuery:Y,queryClient:U,abortOnUnmount:z}=u(),H=dn(M,D,"infinite"),X=U.getQueryDefaults(H),K=D===Na;typeof window>"u"&&F==="prepass"&&(A==null||(B=A.trpc)===null||B===void 0?void 0:B.ssr)!==!1&&((R=A==null?void 0:A.enabled)!==null&&R!==void 0?R:X==null?void 0:X.enabled)!==!1&&!K&&!U.getQueryCache().find({queryKey:H})&&Y(H,(0,Be.default)((0,Be.default)({},X),A));const k=f(H,(0,Be.default)((0,Be.default)({},X),A)),G=(L=A==null||(_=A.trpc)===null||_===void 0?void 0:_.abortOnUnmount)!==null&&L!==void 0?L:z,$=DD((0,Be.default)((0,Be.default)({},k),{},{initialPageParam:(P=A.initialCursor)!==null&&P!==void 0?P:null,persister:A.persister,queryKey:H,queryFn:K?D:J=>{var ne;const ee=(0,Be.default)((0,Be.default)({},k),{},{trpc:(0,Be.default)((0,Be.default)({},k==null?void 0:k.trpc),G?{signal:J.signal}:{signal:null})});return q.query(...ea(H,ee,{pageParam:(ne=J.pageParam)!==null&&ne!==void 0?ne:A.initialCursor,direction:J.direction}))}}),U);return $.trpc=Nu({path:M}),$}function T(M,D,A){var B,R,L;const _=u(),P=dn(M,D,"infinite"),q=_.queryClient.getQueryDefaults(P),F=D===Na,Y=f(P,(0,Be.default)((0,Be.default)({},q),A)),U=(B=A==null||(R=A.trpc)===null||R===void 0?void 0:R.abortOnUnmount)!==null&&B!==void 0?B:_.abortOnUnmount;AD((0,Be.default)((0,Be.default)({},A),{},{initialPageParam:(L=A.initialCursor)!==null&&L!==void 0?L:null,queryKey:P,queryFn:F?D:z=>{var H;const X=(0,Be.default)((0,Be.default)({},Y),{},{trpc:(0,Be.default)((0,Be.default)({},Y==null?void 0:Y.trpc),U?{signal:z.signal}:{})});return _.client.query(...ea(P,X,{pageParam:(H=z.pageParam)!==null&&H!==void 0?H:A.initialCursor,direction:z.direction}))}}))}function C(M,D,A){var B,R,L;const _=u(),P=dn(M,D,"infinite"),q=_.queryClient.getQueryDefaults(P),F=f(P,(0,Be.default)((0,Be.default)({},q),A)),Y=(B=A==null||(R=A.trpc)===null||R===void 0?void 0:R.abortOnUnmount)!==null&&B!==void 0?B:_.abortOnUnmount,U=TD((0,Be.default)((0,Be.default)({},A),{},{initialPageParam:(L=A.initialCursor)!==null&&L!==void 0?L:null,queryKey:P,queryFn:z=>{var H;const X=(0,Be.default)((0,Be.default)({},F),{},{trpc:(0,Be.default)((0,Be.default)({},F==null?void 0:F.trpc),Y?{signal:z.signal}:{})});return _.client.query(...ea(P,X,{pageParam:(H=z.pageParam)!==null&&H!==void 0?H:A.initialCursor,direction:z.direction}))}}),_.queryClient);return U.trpc=Nu({path:M}),[U.data,U]}return{Provider:o,createClient:s,useContext:u,useUtils:u,useQuery:d,usePrefetchQuery:h,useSuspenseQuery:p,useQueries:(M,D)=>{const{ssrState:A,queryClient:B,prefetchQuery:R,client:L}=u(),_=mw(L),P=M(_);if(typeof window>"u"&&A==="prepass")for(const F of P){var q;const Y=F;((q=Y.trpc)===null||q===void 0?void 0:q.ssr)!==!1&&!B.getQueryCache().find({queryKey:Y.queryKey})&&R(Y.queryKey,Y)}return eT({queries:P.map(F=>(0,Be.default)((0,Be.default)({},F),{},{queryKey:F.queryKey})),combine:D==null?void 0:D.combine},B)},useSuspenseQueries:M=>{const{queryClient:D,client:A}=u(),B=mw(A),R=M(B),L=CD({queries:R.map(_=>(0,Be.default)((0,Be.default)({},_),{},{queryFn:_.queryFn,queryKey:_.queryKey}))},D);return[L.map(_=>_.data),L]},useMutation:g,useSubscription:E,useInfiniteQuery:S,usePrefetchInfiniteQuery:T,useSuspenseInfiniteQuery:C}}function ZO(t){const e=qO(t);return x0(r=>r==="useContext"||r==="useUtils"?()=>{const a=t.useUtils();return I.useMemo(()=>GO(a),[a])}:t.hasOwnProperty(r)?t[r]:e[r])}function WO(t){const e=$O();return ZO(e)}const Mt=WO(),xw=["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"],bw=["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"],ww=["#3b82f6","#10b981","#f59e0b","#f43f5e","#8b5cf6","#06b6d4","#ec4899","#84cc16","#14b8a6","#f97316"];function S0(t){let e=0;for(let r=0;r<t.length;r++)e=e*31+t.charCodeAt(r)|0;return Math.abs(e)}function wT(t){return xw[S0(t)%xw.length]}function $t(t){return bw[S0(t)%bw.length]}function Sw(t){return ww[S0(t)%ww.length]}function to(t){if(!t)return"--";try{return new Date(t).toLocaleString()}catch{return String(t)}}function JO(t,e=80){const r=JSON.stringify(t);return r.length<=e?r:r.slice(0,e)+"..."}function Ja(t,e,r){const a=new Set(e.map(i=>i.viewName));if(!t)return"json";if(r){const i=t[r];if(i&&a.has(i))return i}return t.default&&a.has(t.default)?t.default:"json"}const Ew={edges:[],hasMore:!1,loading:!1},E0=I.createContext(null);function eM({children:t}){const[e,r]=I.useState(null),[a,i]=I.useState({out:Ew,in:Ew}),s=I.useRef(null),o=I.useCallback(p=>{s.current=p},[]),u=I.useCallback(p=>{var g;(g=s.current)==null||g.peek(p)},[]),f=I.useCallback(()=>{var p;(p=s.current)==null||p.clearPeek()},[]),d=I.useCallback((p,g)=>{i(y=>({...y,[p]:g}))},[]),h=I.useMemo(()=>({focused:e,setFocused:r,onPeekNearby:u,onClearPeek:f,registerCallbacks:o,edgeResults:a,setEdgeResults:d}),[e,r,u,f,o,a,d]);return m.jsx(E0.Provider,{value:h,children:t})}function tM(){const t=I.useContext(E0);if(!t)throw new Error("useFocus must be used within a FocusProvider");return t}function jo(){return I.useContext(E0)}function rM({schema:t}){const{focused:e,onPeekNearby:r,onClearPeek:a,edgeResults:i}=tM(),s=as(),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?m.jsxs("div",{className:"flex flex-col h-full overflow-auto",children:[m.jsx("div",{className:"px-3 py-2 border-b border-slate-800 shrink-0 cursor-pointer hover:bg-slate-800/50 transition-colors",onMouseEnter:()=>r(o),children:m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("span",{className:`px-1.5 py-0.5 rounded text-[9px] font-mono ${$t(e.nodeType)}`,children:e.nodeType}),m.jsx("span",{className:"text-[11px] font-mono text-slate-300 truncate",children:e.uid})]})}),m.jsx(Tw,{direction:"out",results:i.out,schema:t,onPeek:r,onClearPeek:a,navigate:s}),m.jsx(Tw,{direction:"in",results:i.in,schema:t,onPeek:r,onClearPeek:a,navigate:s})]}):m.jsxs("div",{className:"px-3 py-6 text-center",children:[m.jsx("svg",{className:"w-6 h-6 mx-auto mb-2 text-slate-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:m.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"})}),m.jsx("p",{className:"text-[11px] text-slate-500",children:"Navigate to a node to explore nearby relationships"})]})}function Tw({direction:t,results:e,schema:r,onPeek:a,onClearPeek:i,navigate:s}){const{edges:o,hasMore:u,loading:f}=e,d=I.useMemo(()=>{const g={};for(const y of r.edgeTypes)y.inverseLabel&&(g[y.axbType]=y.inverseLabel);return g},[r.edgeTypes]),h=I.useMemo(()=>{const g={};for(const y of o)g[y.axbType]||(g[y.axbType]=[]),g[y.axbType].push(y);return g},[o]),p=Object.entries(h);return f?m.jsxs("div",{className:"px-3 py-2",children:[m.jsx("h3",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold mb-1",children:t==="out"?"Outgoing":"Incoming"}),m.jsxs("div",{className:"flex items-center gap-1.5 py-1",children:[m.jsx("span",{className:"w-2.5 h-2.5 border border-slate-600 border-t-transparent rounded-full animate-spin"}),m.jsx("span",{className:"text-[10px] text-slate-600",children:"Loading..."})]})]}):m.jsxs("div",{className:"px-2 py-2",children:[m.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?m.jsx("p",{className:"text-[10px] text-slate-600 px-1",children:"None"}):p.map(([g,y])=>m.jsx(aM,{axbType:g,edges:y,direction:t,inverseLabel:t==="in"?d[g]:void 0,onPeek:a,onClearPeek:i,navigate:s},g)),u&&m.jsx("p",{className:"text-[10px] text-slate-600 px-1 mt-1",children:"and more..."})]})}function aM({axbType:t,edges:e,direction:r,inverseLabel:a,onPeek:i,onClearPeek:s,navigate:o}){const[u,f]=I.useState(!0);return m.jsxs("div",{className:"mb-1",children:[m.jsxs("button",{onClick:()=>f(!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:[m.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:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),a?m.jsx("span",{className:"text-amber-400/80 text-[11px] font-mono cursor-help",title:`Inverse of: ${t}`,children:a}):m.jsx("span",{className:"text-indigo-400/80 text-[11px] font-mono",children:t}),m.jsxs("span",{className:"text-slate-600 text-[10px]",children:["(",e.length,")"]})]}),u&&m.jsx("div",{className:"ml-3 space-y-px",children:e.map(d=>{const h=r==="out"?d.bUid:d.aUid,p=r==="out"?d.bType:d.aType;return m.jsx(nM,{targetUid:h,targetType:p,edgeType:d.axbType,direction:r,onPeek:i,onClearPeek:s,navigate:o},`${d.aUid}:${d.axbType}:${d.bUid}`)})})]})}function nM({targetUid:t,targetType:e,edgeType:r,direction:a,onPeek:i,onClearPeek:s,navigate:o}){const u=I.useRef(null),f=I.useMemo(()=>({uid:t,nodeType:e,edgeType:r,direction:a}),[t,e,r,a]),d=I.useCallback(()=>{u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{u.current=null,i(f)},150)},[f,i]),h=I.useCallback(()=>{u.current&&(clearTimeout(u.current),u.current=null)},[]),p=I.useCallback(()=>{u.current&&(clearTimeout(u.current),u.current=null),s(),o(`/node/${encodeURIComponent(t)}`)},[t,s,o]);return I.useEffect(()=>()=>{u.current&&clearTimeout(u.current)},[]),m.jsxs("button",{onClick:p,onMouseEnter:d,onMouseLeave:h,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:[m.jsx("span",{className:`px-1 py-px rounded text-[9px] font-mono shrink-0 ${$t(e)}`,children:e}),m.jsx("span",{className:"text-[11px] font-mono truncate",children:t})]})}function iM({schema:t,config:e,viewRegistry:r}){var E;const a=Ao(),i=as(),[s,o]=I.useState(""),[u,f]=I.useState("navigate"),d=jo(),h=Mt.useUtils(),p=Mt.reloadSchema.useMutation({onSuccess:()=>{h.getSchema.invalidate(),h.getViews.invalidate(),h.getWarnings.invalidate()}}),[g,y]=I.useState(null);I.useEffect(()=>{d!=null&&d.focused&&f("nearby")},[(E=d==null?void 0:d.focused)==null?void 0:E.uid]);const b=S=>{S.preventDefault(),s.trim()&&(i(`/node/${encodeURIComponent(s.trim())}`),o(""))};return m.jsxs("aside",{className:"w-64 bg-slate-900 border-r border-slate-800 flex flex-col h-full shrink-0",children:[m.jsxs("div",{className:"p-4 border-b border-slate-800",children:[m.jsxs(Ca,{to:"/",className:"flex items-center gap-2 group",children:[m.jsx("div",{className:"w-7 h-7 bg-indigo-600 rounded-lg flex items-center justify-center text-xs font-bold",children:"FG"}),m.jsx("span",{className:"font-semibold text-sm group-hover:text-indigo-400 transition-colors",children:"Firegraph Editor"})]}),m.jsx("div",{className:"mt-2 text-[10px] text-slate-500 font-mono truncate",title:e.projectId,children:e.projectId}),m.jsxs("div",{className:"text-[10px] text-slate-500 font-mono truncate",title:e.collection,children:["/",e.collection]}),m.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5",children:[m.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&&m.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&&m.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&&m.jsxs("div",{className:"mt-2",children:[m.jsxs("button",{onClick:()=>{y(null),p.mutate(void 0,{onSuccess:S=>{y(`Loaded ${S.nodeTypeCount} node, ${S.edgeTypeCount} edge types`),setTimeout(()=>y(null),3e3)},onError:S=>{y(`Error: ${S.message}`),setTimeout(()=>y(null),5e3)}})},disabled:p.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:[m.jsx("svg",{className:`w-3 h-3 ${p.isPending?"animate-spin":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:m.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"})}),p.isPending?"Refreshing...":"Refresh Schemas"]}),g&&m.jsx("p",{className:`mt-1 text-[9px] ${p.isError?"text-red-400":"text-emerald-400"}`,children:g})]})]}),m.jsxs("div",{className:"flex border-b border-slate-800 shrink-0",children:[m.jsx("button",{onClick:()=>f("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"}),m.jsx("button",{onClick:()=>f("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"?m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"p-3 border-b border-slate-800",children:m.jsx("form",{onSubmit:b,children:m.jsx("input",{type:"text",value:s,onChange:S=>o(S.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"})})}),m.jsxs("nav",{className:"flex-1 overflow-auto p-3",children:[m.jsxs("div",{className:"mb-4",children:[m.jsxs(Ca,{to:"/",className:`flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors ${a.pathname==="/"?"bg-indigo-600/20 text-indigo-400":"text-slate-400 hover:text-slate-200 hover:bg-slate-800"}`,children:[m.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:m.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"})}),"Dashboard"]}),m.jsxs(Ca,{to:"/traverse",className:`flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors ${a.pathname==="/traverse"?"bg-indigo-600/20 text-indigo-400":"text-slate-400 hover:text-slate-200 hover:bg-slate-800"}`,children:[m.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"Traverse"]}),(r==null?void 0:r.hasViews)&&m.jsxs(Ca,{to:"/views",className:`flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors ${a.pathname==="/views"?"bg-indigo-600/20 text-indigo-400":"text-slate-400 hover:text-slate-200 hover:bg-slate-800"}`,children:[m.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:m.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"]})]}),m.jsxs("div",{className:"mb-4",children:[m.jsx("h3",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold mb-2 px-3",children:"Node Types"}),t.nodeTypes.length===0?m.jsx("p",{className:"text-xs text-slate-600 px-3",children:"No nodes registered"}):t.nodeTypes.map(S=>m.jsxs(Ca,{to:`/browse/${encodeURIComponent(S.type)}`,className:`flex items-center justify-between px-3 py-1.5 rounded-lg text-xs transition-colors ${a.pathname===`/browse/${S.type}`?"bg-slate-800 text-slate-100":"text-slate-400 hover:text-slate-200 hover:bg-slate-800/50"}`,children:[m.jsxs("span",{className:"flex items-center gap-2",children:[m.jsx("span",{className:`w-2 h-2 rounded-full ${wT(S.type)}`}),S.type]}),S.isDynamic&&m.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"})]},S.type))]}),m.jsxs("div",{children:[m.jsx("h3",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold mb-2 px-3",children:"Edge Types"}),t.edgeTypes.length===0?m.jsx("p",{className:"text-xs text-slate-600 px-3",children:"No edges registered"}):t.edgeTypes.map(S=>m.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 text-[11px] text-slate-500",children:[m.jsxs("span",{children:[m.jsx("span",{className:"text-slate-400",children:S.aType}),m.jsx("span",{className:"text-indigo-400 mx-1",children:"→"}),m.jsx("span",{className:"text-indigo-400",children:S.axbType}),m.jsx("span",{className:"text-indigo-400 mx-1",children:"→"}),m.jsx("span",{className:"text-slate-400",children:S.bType})]}),S.isDynamic&&m.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"})]},`${S.aType}:${S.axbType}:${S.bType}`))]})]})]}):m.jsx("div",{className:"flex-1 overflow-auto",children:m.jsx(rM,{schema:t})}),m.jsx("div",{className:"p-3 border-t border-slate-800"})]})}function sM({warnings:t}){const[e,r]=I.useState(!1),[a,i]=I.useState(!1);return t.length===0||a?null:m.jsx("div",{className:"mx-6 mt-4",children:m.jsxs("div",{className:"bg-amber-500/10 border border-amber-500/30 rounded-lg px-4 py-3",children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsxs("button",{onClick:()=>r(!e),className:"flex items-center gap-2 text-left",children:[m.jsx("svg",{className:"w-4 h-4 text-amber-400 shrink-0",fill:"none",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",children:m.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"})}),m.jsxs("span",{className:"text-amber-400 text-sm font-medium",children:[t.length," schema/views warning",t.length!==1?"s":""]}),m.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:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})})]}),m.jsx("button",{onClick:()=>i(!0),className:"text-amber-400/40 hover:text-amber-400/70 transition-colors p-1",title:"Dismiss",children:m.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18 18 6M6 6l12 12"})})})]}),e&&m.jsx("ul",{className:"mt-3 space-y-1.5",children:t.map((s,o)=>m.jsxs("li",{className:"text-xs text-amber-300/80 flex items-start gap-2",children:[m.jsx("span",{className:"shrink-0 mt-1 w-1.5 h-1.5 rounded-full bg-amber-400"}),m.jsxs("span",{children:[m.jsxs("span",{className:"text-amber-400/50 font-mono mr-1",children:["[",s.code,"]"]}),s.message]})]},o))})]})})}class lM{constructor(e){Tp(this,"baseUrl");this.baseUrl=e??""}async request(e){const r=await fetch(`${this.baseUrl}/api/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.error??`HTTP ${r.status}`)}const{requestId:a}=await r.json();return new oM(this.baseUrl,a)}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 oM{constructor(e,r){this.baseUrl=e,this.requestId=r}async*stream(){const e=`${this.baseUrl}/api/chat/stream?requestId=${this.requestId}`,r=await fetch(e,{headers:{Accept:"text/event-stream"}});if(!r.ok||!r.body)throw new Error("Failed to open SSE stream");const a=r.body.getReader(),i=new TextDecoder;let s="",o=null;try{for(;;){const{value:u,done:f}=await a.read();if(f)break;s+=i.decode(u,{stream:!0});const d=s.split(`
|
|
77
|
+
|
|
78
|
+
`);s=d.pop()??"";for(const h of d){const p=h.split(`
|
|
79
|
+
`);let g="",y="";for(const b of p)b.startsWith("event: ")?g=b.slice(7):b.startsWith("data: ")&&(y=b.slice(6));if(g==="chunk"&&y)yield{kind:"text",text:JSON.parse(y).text};else if(g==="artifact"&&y)yield{kind:"artifact",artifact:JSON.parse(y)};else if(g==="tool_start"&&y)yield{kind:"tool_start",command:JSON.parse(y).command};else if(g==="session"&&y)o=JSON.parse(y).sessionId;else{if(g==="done")return{sessionId:o};if(g==="error"&&y)throw new Error(JSON.parse(y).message)}}}}finally{a.cancel()}return{sessionId:o}}}const ST=I.createContext(null),T0="fg-chat-history",_p="fg-chat-session";function Cw(){return Date.now().toString(36)+Math.random().toString(36).slice(2,8)}function uM(){try{const t=sessionStorage.getItem(T0);if(t)return JSON.parse(t).map(r=>({...r,streaming:!1,activeToolCall:null}))}catch{}return[]}function cM(t){try{sessionStorage.setItem(T0,JSON.stringify(t))}catch{}}function fM({chatEnabled:t,children:e}){const[r,a]=I.useState(uM),[i,s]=I.useState(t?"checking":"disconnected"),[o,u]=I.useState(!1),[f,d]=I.useState(()=>{try{return sessionStorage.getItem(_p)}catch{return null}}),h=I.useRef(null);I.useEffect(()=>{t?(h.current=new lM,s("checking")):(h.current=null,s("disconnected"))},[t]),I.useEffect(()=>{cM(r)},[r]),I.useEffect(()=>{try{f?sessionStorage.setItem(_p,f):sessionStorage.removeItem(_p)}catch{}},[f]),I.useEffect(()=>{if(!h.current)return;let y=!0;const b=h.current,E=async()=>{const T=await b.health();y&&s(T?"connected":"disconnected")};E();const S=setInterval(E,3e4);return()=>{y=!1,clearInterval(S)}},[t]);const p=I.useCallback(async(y,b)=>{var N;const E=h.current;if(!E||o)return;const S={id:Cw(),role:"user",content:y,timestamp:new Date().toISOString()},T=Cw(),C={id:T,role:"assistant",content:"",timestamp:new Date().toISOString(),streaming:!0};a(j=>[...j,S,C]),u(!0);try{const M=(await E.request({prompt:y,context:b,sessionId:f??void 0})).stream();let D=await M.next();for(;!D.done;){const A=D.value;A.kind==="text"?a(B=>B.map(R=>R.id===T?{...R,content:R.content+A.text}:R)):A.kind==="artifact"?a(B=>B.map(R=>R.id===T?{...R,artifacts:[...R.artifacts??[],A.artifact],activeToolCall:null}:R)):A.kind==="tool_start"&&a(B=>B.map(R=>R.id===T?{...R,activeToolCall:A.command}:R)),D=await M.next()}(N=D.value)!=null&&N.sessionId&&d(D.value.sessionId),a(A=>A.map(B=>B.id===T?{...B,streaming:!1,activeToolCall:null}:B))}catch(j){const M=j instanceof Error?j.message:"Unknown error";a(D=>D.map(A=>A.id===T?{...A,role:"error",content:M,streaming:!1}:A))}finally{u(!1)}},[o,f]),g=I.useCallback(()=>{a([]),sessionStorage.removeItem(T0),d(null)},[]);return m.jsx(ST.Provider,{value:{messages:r,status:i,isStreaming:o,sendMessage:p,clearHistory:g,chatEnabled:t},children:e})}function dM(){const t=I.useContext(ST);if(!t)throw new Error("useChat must be used within ChatProvider");return t}const ET=I.createContext(null);function hM({children:t}){const[e,r]=I.useState(null),a=I.useCallback(s=>{r(s)},[]),i=I.useCallback(()=>{r(null)},[]);return m.jsx(ET.Provider,{value:{activeArtifact:e,showArtifact:a,dismissArtifact:i},children:t})}function vM(){const t=I.useContext(ET);if(!t)throw new Error("useArtifact must be used within ArtifactProvider");return t}const TT=I.createContext(null);function pM({children:t}){const[e,r]=I.useState("collapsed"),a=I.useCallback(()=>r("expanded"),[]),i=I.useCallback(()=>r("collapsed"),[]);return m.jsx(TT.Provider,{value:{mode:e,expand:a,collapse:i},children:t})}function gM(){const t=I.useContext(TT);if(!t)throw new Error("useChatBar must be used within ChatBarProvider");return t}function mM(t,e){var a;const r={};if(t!=null&&t.focused){r.focusedNode={uid:t.focused.uid,nodeType:t.focused.nodeType};const i=(a=e.nodeSchemas)==null?void 0:a.find(s=>s.aType===t.focused.nodeType&&s.isNodeEntry);if(i&&(r.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++}r.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++}r.incomingEdges=Object.entries(s).map(([o,u])=>({axbType:o,sourceType:u.sourceType,count:u.count,hasMore:t.edgeResults.in.hasMore}))}}return r.graphTopology=e.edgeTypes.map(i=>({aType:i.aType,axbType:i.axbType,bType:i.bType,inverseLabel:i.inverseLabel})),r}function yM(t){const e=t.data;switch(t.kind){case"node-detail":{const r=e.node,a=Array.isArray(e.outEdges)?e.outEdges.length:0,i=Array.isArray(e.inEdges)?e.inEdges.length:0;return{icon:"●",label:r?`${r.type}:${r.uid}`:"Node not found",detail:`${a+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 r=Array.isArray(e.nodeTypes)?e.nodeTypes:[],a=Array.isArray(e.edgeTypes)?e.edgeTypes:[];return{icon:"⊞",label:`${r.length} node types`,detail:`${a.length} edge types`}}default:return{icon:"?",label:"Query result",detail:""}}}function Qa({data:t,defaultExpanded:e=!0,depth:r=0}){const[a,i]=I.useState(e&&r<2);if(t===null)return m.jsx("span",{className:"text-slate-500",children:"null"});if(t===void 0)return m.jsx("span",{className:"text-slate-500",children:"undefined"});if(typeof t=="string")return m.jsxs("span",{className:"text-emerald-400",children:['"',t,'"']});if(typeof t=="number")return m.jsx("span",{className:"text-amber-400",children:t});if(typeof t=="boolean")return m.jsx("span",{className:"text-violet-400",children:String(t)});if(Array.isArray(t))return t.length===0?m.jsx("span",{className:"text-slate-500",children:"[]"}):m.jsxs("span",{children:[m.jsx("button",{onClick:()=>i(!a),className:"text-slate-500 hover:text-slate-300 transition-colors",children:a?"[▾":`[▸ ${t.length} items]`}),a&&m.jsx("div",{className:"ml-4 border-l border-slate-800 pl-3",children:t.map((s,o)=>m.jsxs("div",{className:"py-0.5",children:[m.jsx("span",{className:"text-slate-600 text-xs mr-2",children:o}),m.jsx(Qa,{data:s,depth:r+1}),o<t.length-1&&m.jsx("span",{className:"text-slate-600",children:","})]},o))}),a&&m.jsx("span",{className:"text-slate-500",children:"]"})]});if(typeof t=="object"){const s=Object.entries(t);return s.length===0?m.jsx("span",{className:"text-slate-500",children:"{}"}):m.jsxs("span",{children:[m.jsx("button",{onClick:()=>i(!a),className:"text-slate-500 hover:text-slate-300 transition-colors",children:a?"{▾":`{▸ ${s.length} keys}`}),a&&m.jsx("div",{className:"ml-4 border-l border-slate-800 pl-3",children:s.map(([o,u],f)=>m.jsxs("div",{className:"py-0.5",children:[m.jsx("span",{className:"text-cyan-400",children:o}),m.jsx("span",{className:"text-slate-600",children:": "}),m.jsx(Qa,{data:u,depth:r+1}),f<s.length-1&&m.jsx("span",{className:"text-slate-600",children:","})]},o))}),a&&m.jsx("span",{className:"text-slate-500",children:"}"})]})}return m.jsx("span",{className:"text-slate-400",children:String(t)})}function xM({tagName:t,data:e,className:r,onError:a}){const i=I.useRef(null),s=I.useRef(null),o=I.useRef(a);return o.current=a,I.useEffect(()=>{var f,d;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,(f=o.current)==null||f.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,(d=o.current)==null||d.call(o)}},[t,e]),I.useEffect(()=>()=>{i.current&&(i.current.innerHTML=""),s.current=null},[]),m.jsx("div",{ref:i,className:r})}class bM extends I.Component{constructor(){super(...arguments);Tp(this,"state",{error:null})}static getDerivedStateFromError(r){return{error:r}}componentDidCatch(r){var a,i;console.error("[CustomView] Boundary caught error:",r),(i=(a=this.props).onError)==null||i.call(a)}render(){return this.state.error?null:this.props.children}}function Xi(t){return m.jsx(bM,{...t,children:m.jsx(xM,{...t})})}function Qu({views:t,activeView:e,onSwitch:r}){return t.length===0?null:m.jsxs("select",{value:e,onChange:a=>r(a.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:[m.jsx("option",{value:"json",children:"JSON"}),t.map(a=>m.jsx("option",{value:a.tagName,children:a.viewName},a.tagName))]})}let C0=0;function Ms(){return`lane-${++C0}`}function Dd(t){return{uid:t,nodeType:"",edgeType:"",direction:"out"}}function wM(t,e){switch(e.type){case"RESET":{C0=0;const r=Ms();return{lanes:[{id:r,frames:[Dd(e.rootUid)]}],activeLaneId:r,previewLaneId:void 0}}case"EXTEND_LANE":return{lanes:t.lanes.map(r=>r.id===e.laneId?{...r,frames:[...r.frames,e.frame]}:r),activeLaneId:e.laneId};case"EXTEND_PATH":return{lanes:t.lanes.map(r=>r.id===e.laneId?{...r,frames:[...r.frames,...e.frames]}:r),activeLaneId:e.laneId};case"FORK_AND_DRILL":{const r=t.lanes.find(i=>i.id===e.fromLaneId);if(!r)return t;const a={id:e.newLaneId,frames:[...r.frames.slice(0,e.fromIndex+1),e.frame]};return{lanes:[...t.lanes,a],activeLaneId:e.newLaneId}}case"FORK_AND_DRILL_PATH":{const r=t.lanes.find(i=>i.id===e.fromLaneId);if(!r)return t;const a={id:e.newLaneId,frames:[...r.frames.slice(0,e.fromIndex+1),...e.frames]};return{lanes:[...t.lanes,a],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(r=>r.id===e.laneId?{...r,frames:r.frames.slice(0,e.index+1)}:r),activeLaneId:e.laneId};case"CLOSE_LANE":{const r=t.lanes.filter(a=>a.id!==e.laneId);if(r.length===0){const a=Ms();return{lanes:[{id:a,frames:[Dd(e.rootUid)]}],activeLaneId:a}}return{lanes:r,activeLaneId:t.activeLaneId===e.laneId?r[0].id:t.activeLaneId}}case"SWITCH_LANE":return{...t,activeLaneId:e.laneId};case"SET_ROOT_TYPE":return{...t,lanes:t.lanes.map(r=>{var i;if(((i=r.frames[0])==null?void 0:i.nodeType)===e.nodeType)return r;const a=[...r.frames];return a[0]={...a[0],nodeType:e.nodeType},{...r,frames:a}})};case"PREVIEW_FRAME":{let r=t.lanes;t.previewLaneId&&(r=r.map(i=>i.id===t.previewLaneId?{...i,frames:i.frames.slice(0,-1)}:i));const a=r.find(i=>i.id===e.laneId);return a&&a.frames.some(i=>i.uid===e.frame.uid)?{...t,lanes:r,previewLaneId:void 0}:{...t,lanes:r.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(r=>r.id===t.previewLaneId?{...r,frames:r.frames.slice(0,-1)}:r),previewLaneId:void 0}:t;case"COMMIT_PREVIEW":return{...t,previewLaneId:void 0};default:return t}}const N0=I.createContext(null),A0=I.createContext(null);function SM({rootUid:t,initialPaths:e,children:r}){const[a,i]=I.useReducer(wM,{rootUid:t,initialPaths:e},D=>{if(C0=0,D.initialPaths&&D.initialPaths.length>0){const B=D.initialPaths.map(R=>({id:Ms(),frames:[Dd(D.rootUid),...R]}));return{lanes:B,activeLaneId:B[0].id}}const A=Ms();return{lanes:[{id:A,frames:[Dd(D.rootUid)]}],activeLaneId:A}}),s=I.useRef(t);I.useEffect(()=>{s.current!==t&&(s.current=t,i({type:"RESET",rootUid:t}))},[t]);const o=I.useMemo(()=>a.lanes.find(D=>D.id===a.activeLaneId)??a.lanes[0],[a.lanes,a.activeLaneId]),u=I.useCallback(D=>{i({type:"EXTEND_LANE",laneId:a.activeLaneId,frame:D})},[a.activeLaneId]),f=I.useCallback(D=>{D.length!==0&&i({type:"EXTEND_PATH",laneId:a.activeLaneId,frames:D})},[a.activeLaneId]),d=I.useCallback((D,A)=>{i({type:"EXTEND_LANE",laneId:D,frame:A})},[]),h=I.useCallback((D,A)=>{A.length!==0&&i({type:"EXTEND_PATH",laneId:D,frames:A})},[]),p=I.useCallback((D,A,B)=>{const R=Ms();i({type:"FORK_AND_DRILL",fromLaneId:D,fromIndex:A,frame:B,newLaneId:R})},[]),g=I.useCallback((D,A,B)=>{if(B.length===0)return;const R=Ms();i({type:"FORK_AND_DRILL_PATH",fromLaneId:D,fromIndex:A,frames:B,newLaneId:R})},[]),y=I.useCallback(D=>{if(D.length===0)return;const A=Ms();i({type:"CREATE_LANE",newLaneId:A,frames:D})},[]),b=I.useCallback((D,A)=>{i({type:"POP_TO",laneId:D,index:A})},[]),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:a.activeLaneId,frame:D})},[a.activeLaneId]),N=I.useCallback(()=>{i({type:"CLEAR_PREVIEW"})},[]),j=I.useCallback(()=>{i({type:"COMMIT_PREVIEW"})},[]),M=I.useMemo(()=>({lanes:a.lanes,activeLaneId:a.activeLaneId,activeLane:o,activeIndex:o.frames.length-1,previewLaneId:a.previewLaneId,drillIn:u,drillPath:f,extendLane:d,extendPath:h,forkAndDrill:p,forkAndDrillPath:g,createLane:y,popTo:b,closeLane:E,switchLane:S,setRootType:T,previewFrame:C,clearPreview:N,commitPreview:j}),[a.lanes,a.activeLaneId,a.previewLaneId,o,u,f,d,h,p,g,y,b,E,S,T,C,N,j]);return m.jsx(N0.Provider,{value:M,children:r})}function Zd(){const t=I.useContext(N0);if(!t)throw new Error("useDrill must be used within a DrillProvider");const e=I.useContext(A0);return e?{...t,...e}:t}function CT(){const t=I.useContext(N0),e=I.useContext(A0);return t?e?{...t,...e}:t:null}function Im(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,a=Array(e);r<e;r++)a[r]=t[r];return a}function EM(t){if(Array.isArray(t))return t}function TM(t){if(Array.isArray(t))return Im(t)}function is(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function CM(t,e){for(var r=0;r<e.length;r++){var a=e[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,AT(a.key),a)}}function ss(t,e,r){return e&&CM(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function pa(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=j0(t))||e){r&&(t=r);var a=0,i=function(){};return{s:i,n:function(){return a>=t.length?{done:!0}:{done:!1,value:t[a++]}},e:function(f){throw f},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(){r=r.call(t)},n:function(){var f=r.next();return o=f.done,f},e:function(f){u=!0,s=f},f:function(){try{o||r.return==null||r.return()}finally{if(u)throw s}}}}function NT(t,e,r){return(e=AT(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function NM(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function AM(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var a,i,s,o,u=[],f=!0,d=!1;try{if(s=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;f=!1}else for(;!(f=(a=s.call(r)).done)&&(u.push(a.value),u.length!==e);f=!0);}catch(h){d=!0,i=h}finally{try{if(!f&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw i}}return u}}function jM(){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 DM(){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 pr(t,e){return EM(t)||AM(t,e)||j0(t,e)||jM()}function Od(t){return TM(t)||NM(t)||j0(t)||DM()}function OM(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var a=r.call(t,e);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function AT(t){var e=OM(t,"string");return typeof e=="symbol"?e:e+""}function wr(t){"@babel/helpers - typeof";return wr=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},wr(t)}function j0(t,e){if(t){if(typeof t=="string")return Im(t,e);var r={}.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Im(t,e):void 0}}var xr=typeof window>"u"?null:window,Nw=xr?xr.navigator:null;xr&&xr.document;var MM=wr(""),jT=wr({}),RM=wr(function(){}),kM=typeof HTMLElement>"u"?"undefined":wr(HTMLElement),mc=function(e){return e&&e.instanceString&&Zt(e.instanceString)?e.instanceString():null},Xe=function(e){return e!=null&&wr(e)==MM},Zt=function(e){return e!=null&&wr(e)===RM},Pt=function(e){return!Aa(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},bt=function(e){return e!=null&&wr(e)===jT&&!Pt(e)&&e.constructor===Object},BM=function(e){return e!=null&&wr(e)===jT},Oe=function(e){return e!=null&&wr(e)===wr(1)&&!isNaN(e)},LM=function(e){return Oe(e)&&Math.floor(e)===e},Md=function(e){if(kM!=="undefined")return e!=null&&e instanceof HTMLElement},Aa=function(e){return yc(e)||DT(e)},yc=function(e){return mc(e)==="collection"&&e._private.single},DT=function(e){return mc(e)==="collection"&&!e._private.single},D0=function(e){return mc(e)==="core"},OT=function(e){return mc(e)==="stylesheet"},zM=function(e){return mc(e)==="event"},$i=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},_M=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},PM=function(e){return bt(e)&&Oe(e.x1)&&Oe(e.x2)&&Oe(e.y1)&&Oe(e.y2)},UM=function(e){return BM(e)&&Zt(e.then)},qM=function(){return Nw&&Nw.userAgent.match(/msie|trident|edge/i)},Eo=function(e,r){r||(r=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 a=function(){var s=this,o=arguments,u,f=r.apply(s,o),d=a.cache;return(u=d[f])||(u=d[f]=e.apply(s,o)),u};return a.cache={},a},O0=Eo(function(t){return t.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),Wd=Eo(function(t){return t.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),MT=Eo(function(t,e){return t+e[0].toUpperCase()+e.substring(1)},function(t,e){return t+"$"+e}),Aw=function(e){return $i(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},Ii=function(e,r){return e.slice(-1*r.length)===r},br="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",IM="rgb[a]?\\(("+br+"[%]?)\\s*,\\s*("+br+"[%]?)\\s*,\\s*("+br+"[%]?)(?:\\s*,\\s*("+br+"))?\\)",VM="rgb[a]?\\((?:"+br+"[%]?)\\s*,\\s*(?:"+br+"[%]?)\\s*,\\s*(?:"+br+"[%]?)(?:\\s*,\\s*(?:"+br+"))?\\)",FM="hsl[a]?\\(("+br+")\\s*,\\s*("+br+"[%])\\s*,\\s*("+br+"[%])(?:\\s*,\\s*("+br+"))?\\)",HM="hsl[a]?\\((?:"+br+")\\s*,\\s*(?:"+br+"[%])\\s*,\\s*(?:"+br+"[%])(?:\\s*,\\s*(?:"+br+"))?\\)",GM="\\#[0-9a-fA-F]{3}",QM="\\#[0-9a-fA-F]{6}",RT=function(e,r){return e<r?-1:e>r?1:0},YM=function(e,r){return-1*RT(e,r)},Ze=Object.assign!=null?Object.assign.bind(Object):function(t){for(var e=arguments,r=1;r<e.length;r++){var a=e[r];if(a!=null)for(var i=Object.keys(a),s=0;s<i.length;s++){var o=i[s];t[o]=a[o]}}return t},KM=function(e){if(!(!(e.length===4||e.length===7)||e[0]!=="#")){var r=e.length===4,a,i,s,o=16;return r?(a=parseInt(e[1]+e[1],o),i=parseInt(e[2]+e[2],o),s=parseInt(e[3]+e[3],o)):(a=parseInt(e[1]+e[2],o),i=parseInt(e[3]+e[4],o),s=parseInt(e[5]+e[6],o)),[a,i,s]}},XM=function(e){var r,a,i,s,o,u,f,d;function h(b,E,S){return S<0&&(S+=1),S>1&&(S-=1),S<1/6?b+(E-b)*6*S:S<1/2?E:S<2/3?b+(E-b)*(2/3-S)*6:b}var p=new RegExp("^"+FM+"$").exec(e);if(p){if(a=parseInt(p[1]),a<0?a=(360- -1*a%360)%360:a>360&&(a=a%360),a/=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=f=d=Math.round(s*255);else{var g=s<.5?s*(1+i):s+i-s*i,y=2*s-g;u=Math.round(255*h(y,g,a+1/3)),f=Math.round(255*h(y,g,a)),d=Math.round(255*h(y,g,a-1/3))}r=[u,f,d,o]}return r},$M=function(e){var r,a=new RegExp("^"+IM+"$").exec(e);if(a){r=[];for(var i=[],s=1;s<=3;s++){var o=a[s];if(o[o.length-1]==="%"&&(i[s]=!0),o=parseFloat(o),i[s]&&(o=o/100*255),o<0||o>255)return;r.push(Math.floor(o))}var u=i[1]||i[2]||i[3],f=i[1]&&i[2]&&i[3];if(u&&!f)return;var d=a[4];if(d!==void 0){if(d=parseFloat(d),d<0||d>1)return;r.push(d)}}return r},ZM=function(e){return WM[e.toLowerCase()]},kT=function(e){return(Pt(e)?e:null)||ZM(e)||KM(e)||$M(e)||XM(e)},WM={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]},BT=function(e){for(var r=e.map,a=e.keys,i=a.length,s=0;s<i;s++){var o=a[s];if(bt(o))throw Error("Tried to set map with object key");s<a.length-1?(r[o]==null&&(r[o]={}),r=r[o]):r[o]=e.value}},LT=function(e){for(var r=e.map,a=e.keys,i=a.length,s=0;s<i;s++){var o=a[s];if(bt(o))throw Error("Tried to get map with object key");if(r=r[o],r==null)return r}return r},Xf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Pp,jw;function bc(){if(jw)return Pp;jw=1;function t(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}return Pp=t,Pp}var Up,Dw;function JM(){if(Dw)return Up;Dw=1;var t=typeof Xf=="object"&&Xf&&Xf.Object===Object&&Xf;return Up=t,Up}var qp,Ow;function Jd(){if(Ow)return qp;Ow=1;var t=JM(),e=typeof self=="object"&&self&&self.Object===Object&&self,r=t||e||Function("return this")();return qp=r,qp}var Ip,Mw;function eR(){if(Mw)return Ip;Mw=1;var t=Jd(),e=function(){return t.Date.now()};return Ip=e,Ip}var Vp,Rw;function tR(){if(Rw)return Vp;Rw=1;var t=/\s/;function e(r){for(var a=r.length;a--&&t.test(r.charAt(a)););return a}return Vp=e,Vp}var Fp,kw;function rR(){if(kw)return Fp;kw=1;var t=tR(),e=/^\s+/;function r(a){return a&&a.slice(0,t(a)+1).replace(e,"")}return Fp=r,Fp}var Hp,Bw;function M0(){if(Bw)return Hp;Bw=1;var t=Jd(),e=t.Symbol;return Hp=e,Hp}var Gp,Lw;function aR(){if(Lw)return Gp;Lw=1;var t=M0(),e=Object.prototype,r=e.hasOwnProperty,a=e.toString,i=t?t.toStringTag:void 0;function s(o){var u=r.call(o,i),f=o[i];try{o[i]=void 0;var d=!0}catch{}var h=a.call(o);return d&&(u?o[i]=f:delete o[i]),h}return Gp=s,Gp}var Qp,zw;function nR(){if(zw)return Qp;zw=1;var t=Object.prototype,e=t.toString;function r(a){return e.call(a)}return Qp=r,Qp}var Yp,_w;function zT(){if(_w)return Yp;_w=1;var t=M0(),e=aR(),r=nR(),a="[object Null]",i="[object Undefined]",s=t?t.toStringTag:void 0;function o(u){return u==null?u===void 0?i:a:s&&s in Object(u)?e(u):r(u)}return Yp=o,Yp}var Kp,Pw;function iR(){if(Pw)return Kp;Pw=1;function t(e){return e!=null&&typeof e=="object"}return Kp=t,Kp}var Xp,Uw;function wc(){if(Uw)return Xp;Uw=1;var t=zT(),e=iR(),r="[object Symbol]";function a(i){return typeof i=="symbol"||e(i)&&t(i)==r}return Xp=a,Xp}var $p,qw;function sR(){if(qw)return $p;qw=1;var t=rR(),e=bc(),r=wc(),a=NaN,i=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,o=/^0o[0-7]+$/i,u=parseInt;function f(d){if(typeof d=="number")return d;if(r(d))return a;if(e(d)){var h=typeof d.valueOf=="function"?d.valueOf():d;d=e(h)?h+"":h}if(typeof d!="string")return d===0?d:+d;d=t(d);var p=s.test(d);return p||o.test(d)?u(d.slice(2),p?2:8):i.test(d)?a:+d}return $p=f,$p}var Zp,Iw;function lR(){if(Iw)return Zp;Iw=1;var t=bc(),e=eR(),r=sR(),a="Expected a function",i=Math.max,s=Math.min;function o(u,f,d){var h,p,g,y,b,E,S=0,T=!1,C=!1,N=!0;if(typeof u!="function")throw new TypeError(a);f=r(f)||0,t(d)&&(T=!!d.leading,C="maxWait"in d,g=C?i(r(d.maxWait)||0,f):g,N="trailing"in d?!!d.trailing:N);function j(q){var F=h,Y=p;return h=p=void 0,S=q,y=u.apply(Y,F),y}function M(q){return S=q,b=setTimeout(B,f),T?j(q):y}function D(q){var F=q-E,Y=q-S,U=f-F;return C?s(U,g-Y):U}function A(q){var F=q-E,Y=q-S;return E===void 0||F>=f||F<0||C&&Y>=g}function B(){var q=e();if(A(q))return R(q);b=setTimeout(B,D(q))}function R(q){return b=void 0,N&&h?j(q):(h=p=void 0,y)}function L(){b!==void 0&&clearTimeout(b),S=0,h=E=p=b=void 0}function _(){return b===void 0?y:R(e())}function P(){var q=e(),F=A(q);if(h=arguments,p=this,E=q,F){if(b===void 0)return M(E);if(C)return clearTimeout(b),b=setTimeout(B,f),j(E)}return b===void 0&&(b=setTimeout(B,f)),y}return P.cancel=L,P.flush=_,P}return Zp=o,Zp}var oR=lR(),Sc=xc(oR),Wp=xr?xr.performance:null,_T=Wp&&Wp.now?function(){return Wp.now()}:function(){return Date.now()},uR=(function(){if(xr){if(xr.requestAnimationFrame)return function(t){xr.requestAnimationFrame(t)};if(xr.mozRequestAnimationFrame)return function(t){xr.mozRequestAnimationFrame(t)};if(xr.webkitRequestAnimationFrame)return function(t){xr.webkitRequestAnimationFrame(t)};if(xr.msRequestAnimationFrame)return function(t){xr.msRequestAnimationFrame(t)}}return function(t){t&&setTimeout(function(){t(_T())},1e3/60)}})(),Rd=function(e){return uR(e)},Yn=_T,Rs=9261,PT=65599,$l=5381,UT=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Rs,a=r,i;i=e.next(),!i.done;)a=a*PT+i.value|0;return a},Yu=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Rs;return r*PT+e|0},Ku=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:$l;return(r<<5)+r+e|0},cR=function(e,r){return e*2097152+r},Ci=function(e){return e[0]*2097152+e[1]},$f=function(e,r){return[Yu(e[0],r[0]),Ku(e[1],r[1])]},Vw=function(e,r){var a={value:0,done:!1},i=0,s=e.length,o={next:function(){return i<s?a.value=e[i++]:a.done=!0,a}};return UT(o,r)},Ys=function(e,r){var a={value:0,done:!1},i=0,s=e.length,o={next:function(){return i<s?a.value=e.charCodeAt(i++):a.done=!0,a}};return UT(o,r)},qT=function(){return fR(arguments)},fR=function(e){for(var r,a=0;a<e.length;a++){var i=e[a];a===0?r=Ys(i):r=Ys(i,r)}return r};function dR(t,e,r,a,i){var s=i*Math.PI/180,o=Math.cos(s)*(t-r)-Math.sin(s)*(e-a)+r,u=Math.sin(s)*(t-r)+Math.cos(s)*(e-a)+a;return{x:o,y:u}}var hR=function(e,r,a,i,s,o){return{x:(e-a)*s+a,y:(r-i)*o+i}};function vR(t,e,r){if(r===0)return t;var a=(e.x1+e.x2)/2,i=(e.y1+e.y2)/2,s=e.w/e.h,o=1/s,u=dR(t.x,t.y,a,i,r),f=hR(u.x,u.y,a,i,s,o);return{x:f.x,y:f.y}}var Fw=!0,pR=console.warn!=null,gR=console.trace!=null,R0=Number.MAX_SAFE_INTEGER||9007199254740991,IT=function(){return!0},kd=function(){return!1},Hw=function(){return 0},k0=function(){},Qt=function(e){throw new Error(e)},VT=function(e){if(e!==void 0)Fw=!!e;else return Fw},At=function(e){VT()&&(pR?console.warn(e):(console.log(e),gR&&console.trace()))},mR=function(e){return Ze({},e)},gn=function(e){return e==null?e:Pt(e)?e.slice():bt(e)?mR(e):e},yR=function(e){return e.slice()},FT=function(e,r){for(r=e="";e++<36;r+=e*51&52?(e^15?8^Math.random()*(e^20?16:4):4).toString(16):"-");return r},xR={},HT=function(){return xR},Ir=function(e){var r=Object.keys(e);return function(a){for(var i={},s=0;s<r.length;s++){var o=r[s],u=a==null?void 0:a[o];i[o]=u===void 0?e[o]:u}return i}},Zi=function(e,r,a){for(var i=e.length-1;i>=0;i--)e[i]===r&&e.splice(i,1)},B0=function(e){e.splice(0,e.length)},bR=function(e,r){for(var a=0;a<r.length;a++){var i=r[a];e.push(i)}},ha=function(e,r,a){return a&&(r=MT(a,r)),e[r]},qn=function(e,r,a,i){a&&(r=MT(a,r)),e[r]=i},wR=(function(){function t(){is(this,t),this._obj={}}return ss(t,[{key:"set",value:function(r,a){return this._obj[r]=a,this}},{key:"delete",value:function(r){return this._obj[r]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(r){return this._obj[r]!==void 0}},{key:"get",value:function(r){return this._obj[r]}}])})(),Gn=typeof Map<"u"?Map:wR,SR="undefined",ER=(function(){function t(e){if(is(this,t),this._obj=Object.create(null),this.size=0,e!=null){var r;e.instanceString!=null&&e.instanceString()===this.instanceString()?r=e.toArray():r=e;for(var a=0;a<r.length;a++)this.add(r[a])}}return ss(t,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(r){var a=this._obj;a[r]!==1&&(a[r]=1,this.size++)}},{key:"delete",value:function(r){var a=this._obj;a[r]===1&&(a[r]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(r){return this._obj[r]===1}},{key:"toArray",value:function(){var r=this;return Object.keys(this._obj).filter(function(a){return r.has(a)})}},{key:"forEach",value:function(r,a){return this.toArray().forEach(r,a)}}])})(),Do=(typeof Set>"u"?"undefined":wr(Set))!==SR?Set:ER,eh=function(e,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||r===void 0||!D0(e)){Qt("An element must have a core reference and parameters set");return}var i=r.group;if(i==null&&(r.data&&r.data.source!=null&&r.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:r.data||{},position:r.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:!!r.selected,selectable:r.selectable===void 0?!0:!!r.selectable,locked:!!r.locked,grabbed:!1,grabbable:r.grabbable===void 0?!0:!!r.grabbable,pannable:r.pannable===void 0?i==="edges":!!r.pannable,active:!1,classes:new Do,animation:{current:[],queue:[]},rscratch:{},scratch:r.scratch||{},edges:[],children:[],parent:r.parent&&r.parent.isNode()?r.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),r.renderedPosition){var o=r.renderedPosition,u=e.pan(),f=e.zoom();s.position={x:(o.x-u.x)/f,y:(o.y-u.y)/f}}var d=[];Pt(r.classes)?d=r.classes:Xe(r.classes)&&(d=r.classes.split(/\s+/));for(var h=0,p=d.length;h<p;h++){var g=d[h];!g||g===""||s.classes.add(g)}this.createEmitter(),(a===void 0||a)&&this.restore();var y=r.style||r.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))},Gw=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(a,i,s){var o;bt(a)&&!Aa(a)&&(o=a,a=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,f=a=Xe(a)?this.filter(a):a,d=[],h=[],p={},g={},y={},b=0,E,S=this.byGroup(),T=S.nodes,C=S.edges,N=0;N<f.length;N++){var j=f[N],M=j.id();j.isNode()&&(d.unshift(j),e.bfs&&(y[M]=!0,h.push(j)),g[M]=0)}for(var D=function(){var q=e.bfs?d.shift():d.pop(),F=q.id();if(e.dfs){if(y[F])return 0;y[F]=!0,h.push(q)}var Y=g[F],U=p[F],z=U!=null?U.source():null,H=U!=null?U.target():null,X=U==null?void 0:q.same(z)?H[0]:z[0],K;if(K=i(q,U,X,b++,Y),K===!0)return E=q,1;if(K===!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 $=k[G],J=$.connectedNodes().filter(function(ee){return!ee.same(q)&&T.has(ee)}),ne=J.id();J.length!==0&&!y[ne]&&(J=J[0],d.push(J),e.bfs&&(y[ne]=!0,h.push(J)),p[ne]=$,g[ne]=g[F]+1)}},A;d.length!==0&&(A=D(),!(A!==0&&A===1)););for(var B=u.collection(),R=0;R<h.length;R++){var L=h[R],_=p[L.id()];_!=null&&B.push(_),B.push(L)}return{path:u.collection(B),found:u.collection(E)}}},Xu={breadthFirstSearch:Gw({bfs:!0}),depthFirstSearch:Gw({dfs:!0})};Xu.bfs=Xu.breadthFirstSearch;Xu.dfs=Xu.depthFirstSearch;var hd={exports:{}},TR=hd.exports,Qw;function CR(){return Qw||(Qw=1,(function(t,e){(function(){var r,a,i,s,o,u,f,d,h,p,g,y,b,E,S;i=Math.floor,p=Math.min,a=function(T,C){return T<C?-1:T>C?1:0},h=function(T,C,N,j,M){var D;if(N==null&&(N=0),M==null&&(M=a),N<0)throw new Error("lo must be non-negative");for(j==null&&(j=T.length);N<j;)D=i((N+j)/2),M(C,T[D])<0?j=D:N=D+1;return[].splice.apply(T,[N,N-N].concat(C)),C},u=function(T,C,N){return N==null&&(N=a),T.push(C),E(T,0,T.length-1,N)},o=function(T,C){var N,j;return C==null&&(C=a),N=T.pop(),T.length?(j=T[0],T[0]=N,S(T,0,C)):j=N,j},d=function(T,C,N){var j;return N==null&&(N=a),j=T[0],T[0]=C,S(T,0,N),j},f=function(T,C,N){var j;return N==null&&(N=a),T.length&&N(T[0],C)<0&&(j=[T[0],C],C=j[0],T[0]=j[1],S(T,0,N)),C},s=function(T,C){var N,j,M,D,A,B;for(C==null&&(C=a),D=(function(){B=[];for(var R=0,L=i(T.length/2);0<=L?R<L:R>L;0<=L?R++:R--)B.push(R);return B}).apply(this).reverse(),A=[],j=0,M=D.length;j<M;j++)N=D[j],A.push(S(T,N,C));return A},b=function(T,C,N){var j;if(N==null&&(N=a),j=T.indexOf(C),j!==-1)return E(T,0,j,N),S(T,j,N)},g=function(T,C,N){var j,M,D,A,B;if(N==null&&(N=a),M=T.slice(0,C),!M.length)return M;for(s(M,N),B=T.slice(C),D=0,A=B.length;D<A;D++)j=B[D],f(M,j,N);return M.sort(N).reverse()},y=function(T,C,N){var j,M,D,A,B,R,L,_,P;if(N==null&&(N=a),C*10<=T.length){if(D=T.slice(0,C).sort(N),!D.length)return D;for(M=D[D.length-1],L=T.slice(C),A=0,R=L.length;A<R;A++)j=L[A],N(j,M)<0&&(h(D,j,0,null,N),D.pop(),M=D[D.length-1]);return D}for(s(T,N),P=[],B=0,_=p(C,T.length);0<=_?B<_:B>_;0<=_?++B:--B)P.push(o(T,N));return P},E=function(T,C,N,j){var M,D,A;for(j==null&&(j=a),M=T[N];N>C;){if(A=N-1>>1,D=T[A],j(M,D)<0){T[N]=D,N=A;continue}break}return T[N]=M},S=function(T,C,N){var j,M,D,A,B;for(N==null&&(N=a),M=T.length,B=C,D=T[C],j=2*C+1;j<M;)A=j+1,A<M&&!(N(T[j],T[A])<0)&&(j=A),T[C]=T[j],C=j,j=2*C+1;return T[C]=D,E(T,B,C,N)},r=(function(){T.push=u,T.pop=o,T.replace=d,T.pushpop=f,T.heapify=s,T.updateItem=b,T.nlargest=g,T.nsmallest=y;function T(C){this.cmp=C??a,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 d(this.nodes,C,this.cmp)},T.prototype.pushpop=function(C){return f(this.nodes,C,this.cmp)},T.prototype.heapify=function(){return s(this.nodes,this.cmp)},T.prototype.updateItem=function(C){return b(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 r})}).call(TR)})(hd)),hd.exports}var Jp,Yw;function NR(){return Yw||(Yw=1,Jp=CR()),Jp}var AR=NR(),Ec=xc(AR),jR=Ir({root:null,weight:function(e){return 1},directed:!1}),DR={dijkstra:function(e){if(!bt(e)){var r=arguments;e={root:r[0],weight:r[1],directed:r[2]}}var a=jR(e),i=a.root,s=a.weight,o=a.directed,u=this,f=s,d=Xe(i)?this.filter(i)[0]:i[0],h={},p={},g={},y=this.byGroup(),b=y.nodes,E=y.edges;E.unmergeBy(function(Y){return Y.isLoop()});for(var S=function(U){return h[U.id()]},T=function(U,z){h[U.id()]=z,C.updateItem(U)},C=new Ec(function(Y,U){return S(Y)-S(U)}),N=0;N<b.length;N++){var j=b[N];h[j.id()]=j.same(d)?0:1/0,C.push(j)}for(var M=function(U,z){for(var H=(o?U.edgesTo(z):U.edgesWith(z)).intersect(E),X=1/0,K,k=0;k<H.length;k++){var G=H[k],$=f(G);($<X||!K)&&(X=$,K=G)}return{edge:K,dist:X}};C.size()>0;){var D=C.pop(),A=S(D),B=D.id();if(g[B]=A,A!==1/0)for(var R=D.neighborhood().intersect(b),L=0;L<R.length;L++){var _=R[L],P=_.id(),q=M(D,_),F=A+q.dist;F<S(_)&&(T(_,F),p[P]={node:D,edge:q.edge})}}return{distanceTo:function(U){var z=Xe(U)?b.filter(U)[0]:U[0];return g[z.id()]},pathTo:function(U){var z=Xe(U)?b.filter(U)[0]:U[0],H=[],X=z,K=X.id();if(z.length>0)for(H.unshift(z);p[K];){var k=p[K];H.unshift(k.edge),H.unshift(k.node),X=k.node,K=X.id()}return u.spawn(H)}}}},OR={kruskal:function(e){e=e||function(N){return 1};for(var r=this.byGroup(),a=r.nodes,i=r.edges,s=a.length,o=new Array(s),u=a,f=function(j){for(var M=0;M<o.length;M++){var D=o[M];if(D.has(j))return M}},d=0;d<s;d++)o[d]=this.spawn(a[d]);for(var h=i.sort(function(N,j){return e(N)-e(j)}),p=0;p<h.length;p++){var g=h[p],y=g.source()[0],b=g.target()[0],E=f(y),S=f(b),T=o[E],C=o[S];E!==S&&(u.merge(g),T.merge(C),o.splice(S,1))}return u}},MR=Ir({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),RR={aStar:function(e){var r=this.cy(),a=MR(e),i=a.root,s=a.goal,o=a.heuristic,u=a.directed,f=a.weight;i=r.collection(i)[0],s=r.collection(s)[0];var d=i.id(),h=s.id(),p={},g={},y={},b=new Ec(function(K,k){return g[K.id()]-g[k.id()]}),E=new Do,S={},T={},C=function(k,G){b.push(k),E.add(G)},N,j,M=function(){N=b.pop(),j=N.id(),E.delete(j)},D=function(k){return E.has(k)};C(i,d),p[d]=0,g[d]=o(i);for(var A=0;b.size()>0;){if(M(),A++,j===h){for(var B=[],R=s,L=h,_=T[L];B.unshift(R),_!=null&&B.unshift(_),R=S[L],R!=null;)L=R.id(),_=T[L];return{found:!0,distance:p[j],path:this.spawn(B),steps:A}}y[j]=!0;for(var P=N._private.edges,q=0;q<P.length;q++){var F=P[q];if(this.hasElementWithId(F.id())&&!(u&&F.data("source")!==j)){var Y=F.source(),U=F.target(),z=Y.id()!==j?Y:U,H=z.id();if(this.hasElementWithId(H)&&!y[H]){var X=p[j]+f(F);if(!D(H)){p[H]=X,g[H]=X+o(z),C(z,H),S[H]=N,T[H]=F;continue}X<p[H]&&(p[H]=X,g[H]=X+o(z),S[H]=N,T[H]=F)}}}}return{found:!1,distance:void 0,path:void 0,steps:A}}},kR=Ir({weight:function(e){return 1},directed:!1}),BR={floydWarshall:function(e){for(var r=this.cy(),a=kR(e),i=a.weight,s=a.directed,o=i,u=this.byGroup(),f=u.nodes,d=u.edges,h=f.length,p=h*h,g=function($){return f.indexOf($)},y=function($){return f[$]},b=new Array(p),E=0;E<p;E++){var S=E%h,T=(E-S)/h;T===S?b[E]=0:b[E]=1/0}for(var C=new Array(p),N=new Array(p),j=0;j<d.length;j++){var M=d[j],D=M.source()[0],A=M.target()[0];if(D!==A){var B=g(D),R=g(A),L=B*h+R,_=o(M);if(b[L]>_&&(b[L]=_,C[L]=R,N[L]=M),!s){var P=R*h+B;!s&&b[P]>_&&(b[P]=_,C[P]=B,N[P]=M)}}}for(var q=0;q<h;q++)for(var F=0;F<h;F++)for(var Y=F*h+q,U=0;U<h;U++){var z=F*h+U,H=q*h+U;b[Y]+b[H]<b[z]&&(b[z]=b[Y]+b[H],C[z]=C[Y])}var X=function($){return(Xe($)?r.filter($):$)[0]},K=function($){return g(X($))},k={distance:function($,J){var ne=K($),ee=K(J);return b[ne*h+ee]},path:function($,J){var ne=K($),ee=K(J),ae=y(ne);if(ne===ee)return ae.collection();if(C[ne*h+ee]==null)return r.collection();var de=r.collection(),le=ne,re;for(de.merge(ae);ne!==ee;)le=ne,ne=C[ne*h+ee],re=N[le*h+ne],de.merge(re),de.merge(y(ne));return de}};return k}},LR=Ir({weight:function(e){return 1},directed:!1,root:null}),zR={bellmanFord:function(e){var r=this,a=LR(e),i=a.weight,s=a.directed,o=a.root,u=i,f=this,d=this.cy(),h=this.byGroup(),p=h.edges,g=h.nodes,y=g.length,b=new Gn,E=!1,S=[];o=d.collection(o)[0],p.unmergeBy(function(Ce){return Ce.isLoop()});for(var T=p.length,C=function(ke){var Le=b.get(ke.id());return Le||(Le={},b.set(ke.id(),Le)),Le},N=function(ke){return(Xe(ke)?d.$(ke):ke)[0]},j=function(ke){return C(N(ke)).dist},M=function(ke){for(var Le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:o,De=N(ke),Ue=[],xe=De;;){if(xe==null)return r.spawn();var Ye=C(xe),Re=Ye.edge,ye=Ye.pred;if(Ue.unshift(xe[0]),xe.same(Le)&&Ue.length>0)break;Re!=null&&Ue.unshift(Re),xe=ye}return f.spawn(Ue)},D=0;D<y;D++){var A=g[D],B=C(A);A.same(o)?B.dist=0:B.dist=1/0,B.pred=null,B.edge=null}for(var R=!1,L=function(ke,Le,De,Ue,xe,Ye){var Re=Ue.dist+Ye;Re<xe.dist&&!De.same(Ue.edge)&&(xe.dist=Re,xe.pred=ke,xe.edge=De,R=!0)},_=1;_<y;_++){R=!1;for(var P=0;P<T;P++){var q=p[P],F=q.source(),Y=q.target(),U=u(q),z=C(F),H=C(Y);L(F,Y,q,z,H,U),s||L(Y,F,q,H,z,U)}if(!R)break}if(R)for(var X=[],K=0;K<T;K++){var k=p[K],G=k.source(),$=k.target(),J=u(k),ne=C(G).dist,ee=C($).dist;if(ne+J<ee||!s&&ee+J<ne)if(E||(At("Graph contains a negative weight cycle for Bellman-Ford"),E=!0),e.findNegativeWeightCycles!==!1){var ae=[];ne+J<ee&&ae.push(G),!s&&ee+J<ne&&ae.push($);for(var de=ae.length,le=0;le<de;le++){var re=ae[le],Z=[re];Z.push(C(re).edge);for(var oe=C(re).pred;Z.indexOf(oe)===-1;)Z.push(oe),Z.push(C(oe).edge),oe=C(oe).pred;Z=Z.slice(Z.indexOf(oe));for(var ve=Z[0].id(),Ne=0,Me=2;Me<Z.length;Me+=2)Z[Me].id()<ve&&(ve=Z[Me].id(),Ne=Me);Z=Z.slice(Ne).concat(Z.slice(0,Ne)),Z.push(Z[0]);var Je=Z.map(function(Ce){return Ce.id()}).join(",");X.indexOf(Je)===-1&&(S.push(f.spawn(Z)),X.push(Je))}}else break}return{distanceTo:j,pathTo:M,hasNegativeWeightCycle:E,negativeWeightCycles:S}}},_R=Math.sqrt(2),PR=function(e,r,a){a.length===0&&Qt("Karger-Stein must be run on a connected (sub)graph");for(var i=a[e],s=i[1],o=i[2],u=r[s],f=r[o],d=a,h=d.length-1;h>=0;h--){var p=d[h],g=p[1],y=p[2];(r[g]===u&&r[y]===f||r[g]===f&&r[y]===u)&&d.splice(h,1)}for(var b=0;b<d.length;b++){var E=d[b];E[1]===f?(d[b]=E.slice(),d[b][1]=u):E[2]===f&&(d[b]=E.slice(),d[b][2]=u)}for(var S=0;S<r.length;S++)r[S]===f&&(r[S]=u);return d},eg=function(e,r,a,i){for(;a>i;){var s=Math.floor(Math.random()*r.length);r=PR(s,e,r),a--}return r},UR={kargerStein:function(){var e=this,r=this.byGroup(),a=r.nodes,i=r.edges;i.unmergeBy(function(H){return H.isLoop()});var s=a.length,o=i.length,u=Math.ceil(Math.pow(Math.log(s)/Math.LN2,2)),f=Math.floor(s/_R);if(s<2){Qt("At least 2 nodes are required for Karger-Stein algorithm");return}for(var d=[],h=0;h<o;h++){var p=i[h];d.push([h,a.indexOf(p.source()),a.indexOf(p.target())])}for(var g=1/0,y=[],b=new Array(s),E=new Array(s),S=new Array(s),T=function(X,K){for(var k=0;k<s;k++)K[k]=X[k]},C=0;C<=u;C++){for(var N=0;N<s;N++)E[N]=N;var j=eg(E,d.slice(),s,f),M=j.slice();T(E,S);var D=eg(E,j,f,2),A=eg(S,M,f,2);D.length<=A.length&&D.length<g?(g=D.length,y=D,T(E,b)):A.length<=D.length&&A.length<g&&(g=A.length,y=A,T(S,b))}for(var B=this.spawn(y.map(function(H){return i[H[0]]})),R=this.spawn(),L=this.spawn(),_=b[0],P=0;P<b.length;P++){var q=b[P],F=a[P];q===_?R.merge(F):L.merge(F)}var Y=function(X){var K=e.spawn();return X.forEach(function(k){K.merge(k),k.connectedEdges().forEach(function(G){e.contains(G)&&!B.contains(G)&&K.merge(G)})}),K},U=[Y(R),Y(L)],z={cut:B,components:U,partition1:R,partition2:L};return z}},tg,qR=function(e){return{x:e.x,y:e.y}},th=function(e,r,a){return{x:e.x*r+a.x,y:e.y*r+a.y}},GT=function(e,r,a){return{x:(e.x-a.x)/r,y:(e.y-a.y)/r}},Zl=function(e){return{x:e[0],y:e[1]}},IR=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,i=1/0,s=r;s<a;s++){var o=e[s];isFinite(o)&&(i=Math.min(o,i))}return i},VR=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,i=-1/0,s=r;s<a;s++){var o=e[s];isFinite(o)&&(i=Math.max(o,i))}return i},FR=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,i=0,s=0,o=r;o<a;o++){var u=e[o];isFinite(u)&&(i+=u,s++)}return i/s},HR=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=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(r,a):(a<e.length&&e.splice(a,e.length-a),r>0&&e.splice(0,r));for(var u=0,f=e.length-1;f>=0;f--){var d=e[f];o?isFinite(d)||(e[f]=-1/0,u++):e.splice(f,1)}s&&e.sort(function(g,y){return g-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},GR=function(e){return Math.PI*e/180},Zf=function(e,r){return Math.atan2(r,e)-Math.PI/2},L0=Math.log2||function(t){return Math.log(t)/Math.log(2)},z0=function(e){return e>0?1:e<0?-1:0},Ks=function(e,r){return Math.sqrt(Ds(e,r))},Ds=function(e,r){var a=r.x-e.x,i=r.y-e.y;return a*a+i*i},QR=function(e){for(var r=e.length,a=0,i=0;i<r;i++)a+=e[i];for(var s=0;s<r;s++)e[s]=e[s]/a;return e},Or=function(e,r,a,i){return(1-i)*(1-i)*e+2*(1-i)*i*r+i*i*a},ro=function(e,r,a,i){return{x:Or(e.x,r.x,a.x,i),y:Or(e.y,r.y,a.y,i)}},YR=function(e,r,a,i){var s={x:r.x-e.x,y:r.y-e.y},o=Ks(e,r),u={x:s.x/o,y:s.y/o};return a=a??0,i=i??a*o,{x:e.x+u.x*i,y:e.y+u.y*i}},$u=function(e,r,a){return Math.max(e,Math.min(a,r))},ta=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}}},KR=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},XR=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},$R=function(e,r){e.x1=Math.min(e.x1,r.x1),e.x2=Math.max(e.x2,r.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,r.y1),e.y2=Math.max(e.y2,r.y2),e.h=e.y2-e.y1},QT=function(e,r,a){e.x1=Math.min(e.x1,r),e.x2=Math.max(e.x2,r),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,a),e.y2=Math.max(e.y2,a),e.h=e.y2-e.y1},vd=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.x1-=r,e.x2+=r,e.y1-=r,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},pd=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],a,i,s,o;if(r.length===1)a=i=s=o=r[0];else if(r.length===2)a=s=r[0],o=i=r[1];else if(r.length===4){var u=pr(r,4);a=u[0],i=u[1],s=u[2],o=u[3]}return e.x1-=o,e.x2+=i,e.y1-=a,e.y2+=s,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Kw=function(e,r){e.x1=r.x1,e.y1=r.y1,e.x2=r.x2,e.y2=r.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},_0=function(e,r){return!(e.x1>r.x2||r.x1>e.x2||e.x2<r.x1||r.x2<e.x1||e.y2<r.y1||r.y2<e.y1||e.y1>r.y2||r.y1>e.y2)},Vi=function(e,r,a){return e.x1<=r&&r<=e.x2&&e.y1<=a&&a<=e.y2},Xw=function(e,r){return Vi(e,r.x,r.y)},YT=function(e,r){return Vi(e,r.x1,r.y1)&&Vi(e,r.x2,r.y2)},ZR=(tg=Math.hypot)!==null&&tg!==void 0?tg:function(t,e){return Math.sqrt(t*t+e*e)};function WR(t,e){if(t.length<3)throw new Error("Need at least 3 vertices");var r=function(B,R){return{x:B.x+R.x,y:B.y+R.y}},a=function(B,R){return{x:B.x-R.x,y:B.y-R.y}},i=function(B,R){return{x:B.x*R,y:B.y*R}},s=function(B,R){return B.x*R.y-B.y*R.x},o=function(B){var R=ZR(B.x,B.y);return R===0?{x:0,y:0}:{x:B.x/R,y:B.y/R}},u=function(B){for(var R=0,L=0;L<B.length;L++){var _=B[L],P=B[(L+1)%B.length];R+=_.x*P.y-P.x*_.y}return R/2},f=function(B,R,L,_){var P=a(R,B),q=a(_,L),F=s(P,q);if(Math.abs(F)<1e-9)return r(B,i(P,.5));var Y=s(a(L,B),q)/F;return r(B,i(P,Y))},d=t.map(function(A){return{x:A.x,y:A.y}});u(d)<0&&d.reverse();for(var h=d.length,p=[],g=0;g<h;g++){var y=d[g],b=d[(g+1)%h],E=a(b,y),S=o({x:E.y,y:-E.x});p.push(S)}for(var T=p.map(function(A,B){var R=r(d[B],i(A,e)),L=r(d[(B+1)%h],i(A,e));return{p1:R,p2:L}}),C=[],N=0;N<h;N++){var j=T[(N-1+h)%h],M=T[N],D=f(j.p1,j.p2,M.p1,M.p2);C.push(D)}return C}function JR(t,e,r,a,i,s){var o=ok(t,e,r,a,i),u=WR(o,s),f=ta();return u.forEach(function(d){return QT(f,d.x,d.y)}),f}var KT=function(e,r,a,i,s,o,u){var f=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",d=f==="auto"?Wi(s,o):f,h=s/2,p=o/2;d=Math.min(d,h,p);var g=d!==h,y=d!==p,b;if(g){var E=a-h+d-u,S=i-p-u,T=a+h-d+u,C=S;if(b=Fi(e,r,a,i,E,S,T,C,!1),b.length>0)return b}if(y){var N=a+h+u,j=i-p+d-u,M=N,D=i+p-d+u;if(b=Fi(e,r,a,i,N,j,M,D,!1),b.length>0)return b}if(g){var A=a-h+d-u,B=i+p+u,R=a+h-d+u,L=B;if(b=Fi(e,r,a,i,A,B,R,L,!1),b.length>0)return b}if(y){var _=a-h-u,P=i-p+d-u,q=_,F=i+p-d+u;if(b=Fi(e,r,a,i,_,P,q,F,!1),b.length>0)return b}var Y;{var U=a-h+d,z=i-p+d;if(Y=Lu(e,r,a,i,U,z,d+u),Y.length>0&&Y[0]<=U&&Y[1]<=z)return[Y[0],Y[1]]}{var H=a+h-d,X=i-p+d;if(Y=Lu(e,r,a,i,H,X,d+u),Y.length>0&&Y[0]>=H&&Y[1]<=X)return[Y[0],Y[1]]}{var K=a+h-d,k=i+p-d;if(Y=Lu(e,r,a,i,K,k,d+u),Y.length>0&&Y[0]>=K&&Y[1]>=k)return[Y[0],Y[1]]}{var G=a-h+d,$=i+p-d;if(Y=Lu(e,r,a,i,G,$,d+u),Y.length>0&&Y[0]<=G&&Y[1]>=$)return[Y[0],Y[1]]}return[]},ek=function(e,r,a,i,s,o,u){var f=u,d=Math.min(a,s),h=Math.max(a,s),p=Math.min(i,o),g=Math.max(i,o);return d-f<=e&&e<=h+f&&p-f<=r&&r<=g+f},tk=function(e,r,a,i,s,o,u,f,d){var h={x1:Math.min(a,u,s)-d,x2:Math.max(a,u,s)+d,y1:Math.min(i,f,o)-d,y2:Math.max(i,f,o)+d};return!(e<h.x1||e>h.x2||r<h.y1||r>h.y2)},rk=function(e,r,a,i){a-=i;var s=r*r-4*e*a;if(s<0)return[];var o=Math.sqrt(s),u=2*e,f=(-r+o)/u,d=(-r-o)/u;return[f,d]},ak=function(e,r,a,i,s){var o=1e-5;e===0&&(e=o),r/=e,a/=e,i/=e;var u,f,d,h,p,g,y,b;if(f=(3*a-r*r)/9,d=-(27*i)+r*(9*a-2*(r*r)),d/=54,u=f*f*f+d*d,s[1]=0,y=r/3,u>0){p=d+Math.sqrt(u),p=p<0?-Math.pow(-p,1/3):Math.pow(p,1/3),g=d-Math.sqrt(u),g=g<0?-Math.pow(-g,1/3):Math.pow(g,1/3),s[0]=-y+p+g,y+=(p+g)/2,s[4]=s[2]=-y,y=Math.sqrt(3)*(-g+p)/2,s[3]=y,s[5]=-y;return}if(s[5]=s[3]=0,u===0){b=d<0?-Math.pow(-d,1/3):Math.pow(d,1/3),s[0]=-y+2*b,s[4]=s[2]=-(b+y);return}f=-f,h=f*f*f,h=Math.acos(d/Math.sqrt(h)),b=2*Math.sqrt(f),s[0]=-y+b*Math.cos(h/3),s[2]=-y+b*Math.cos((h+2*Math.PI)/3),s[4]=-y+b*Math.cos((h+4*Math.PI)/3)},nk=function(e,r,a,i,s,o,u,f){var d=1*a*a-4*a*s+2*a*u+4*s*s-4*s*u+u*u+i*i-4*i*o+2*i*f+4*o*o-4*o*f+f*f,h=9*a*s-3*a*a-3*a*u-6*s*s+3*s*u+9*i*o-3*i*i-3*i*f-6*o*o+3*o*f,p=3*a*a-6*a*s+a*u-a*e+2*s*s+2*s*e-u*e+3*i*i-6*i*o+i*f-i*r+2*o*o+2*o*r-f*r,g=1*a*s-a*a+a*e-s*e+i*o-i*i+i*r-o*r,y=[];ak(d,h,p,g,y);for(var b=1e-7,E=[],S=0;S<6;S+=2)Math.abs(y[S+1])<b&&y[S]>=0&&y[S]<=1&&E.push(y[S]);E.push(1),E.push(0);for(var T=-1,C,N,j,M=0;M<E.length;M++)C=Math.pow(1-E[M],2)*a+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]*f,j=Math.pow(C-e,2)+Math.pow(N-r,2),T>=0?j<T&&(T=j):T=j;return T},ik=function(e,r,a,i,s,o){var u=[e-a,r-i],f=[s-a,o-i],d=f[0]*f[0]+f[1]*f[1],h=u[0]*u[0]+u[1]*u[1],p=u[0]*f[0]+u[1]*f[1],g=p*p/d;return p<0?h:g>d?(e-s)*(e-s)+(r-o)*(r-o):h-g},va=function(e,r,a){for(var i,s,o,u,f,d=0,h=0;h<a.length/2;h++)if(i=a[h*2],s=a[h*2+1],h+1<a.length/2?(o=a[(h+1)*2],u=a[(h+1)*2+1]):(o=a[(h+1-a.length/2)*2],u=a[(h+1-a.length/2)*2+1]),!(i==e&&o==e))if(i>=e&&e>=o||i<=e&&e<=o)f=(e-i)/(o-i)*(u-s)+s,f>r&&d++;else continue;return d%2!==0},Kn=function(e,r,a,i,s,o,u,f,d){var h=new Array(a.length),p;f[0]!=null?(p=Math.atan(f[1]/f[0]),f[0]<0?p=p+Math.PI/2:p=-p-Math.PI/2):p=f;for(var g=Math.cos(-p),y=Math.sin(-p),b=0;b<h.length/2;b++)h[b*2]=o/2*(a[b*2]*g-a[b*2+1]*y),h[b*2+1]=u/2*(a[b*2+1]*g+a[b*2]*y),h[b*2]+=i,h[b*2+1]+=s;var E;if(d>0){var S=Ld(h,-d);E=Bd(S)}else E=h;return va(e,r,E)},sk=function(e,r,a,i,s,o,u,f){for(var d=new Array(a.length*2),h=0;h<f.length;h++){var p=f[h];d[h*4+0]=p.startX,d[h*4+1]=p.startY,d[h*4+2]=p.stopX,d[h*4+3]=p.stopY;var g=Math.pow(p.cx-e,2)+Math.pow(p.cy-r,2);if(g<=Math.pow(p.radius,2))return!0}return va(e,r,d)},Bd=function(e){for(var r=new Array(e.length/2),a,i,s,o,u,f,d,h,p=0;p<e.length/4;p++){a=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],f=e[(p+1)*4+1],d=e[(p+1)*4+2],h=e[(p+1)*4+3]):(u=e[0],f=e[1],d=e[2],h=e[3]);var g=Fi(a,i,s,o,u,f,d,h,!0);r[p*2]=g[0],r[p*2+1]=g[1]}return r},Ld=function(e,r){for(var a=new Array(e.length*2),i,s,o,u,f=0;f<e.length/2;f++){i=e[f*2],s=e[f*2+1],f<e.length/2-1?(o=e[(f+1)*2],u=e[(f+1)*2+1]):(o=e[0],u=e[1]);var d=u-s,h=-(o-i),p=Math.sqrt(d*d+h*h),g=d/p,y=h/p;a[f*4]=i+g*r,a[f*4+1]=s+y*r,a[f*4+2]=o+g*r,a[f*4+3]=u+y*r}return a},lk=function(e,r,a,i,s,o){var u=a-e,f=i-r;u/=s,f/=o;var d=Math.sqrt(u*u+f*f),h=d-1;if(h<0)return[];var p=h/d;return[(a-e)*p+e,(i-r)*p+r]},Ls=function(e,r,a,i,s,o,u){return e-=s,r-=o,e/=a/2+u,r/=i/2+u,e*e+r*r<=1},Lu=function(e,r,a,i,s,o,u){var f=[a-e,i-r],d=[e-s,r-o],h=f[0]*f[0]+f[1]*f[1],p=2*(d[0]*f[0]+d[1]*f[1]),g=d[0]*d[0]+d[1]*d[1]-u*u,y=p*p-4*h*g;if(y<0)return[];var b=(-p+Math.sqrt(y))/(2*h),E=(-p-Math.sqrt(y))/(2*h),S=Math.min(b,E),T=Math.max(b,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]*f[0]+e,j=C[0]*f[1]+r;if(C.length>1){if(C[0]==C[1])return[N,j];var M=C[1]*f[0]+e,D=C[1]*f[1]+r;return[N,j,M,D]}else return[N,j]},rg=function(e,r,a){return r<=e&&e<=a||a<=e&&e<=r?e:e<=r&&r<=a||a<=r&&r<=e?r:a},Fi=function(e,r,a,i,s,o,u,f,d){var h=e-s,p=a-e,g=u-s,y=r-o,b=i-r,E=f-o,S=g*y-E*h,T=p*y-b*h,C=E*p-g*b;if(C!==0){var N=S/C,j=T/C,M=.001,D=0-M,A=1+M;return D<=N&&N<=A&&D<=j&&j<=A?[e+N*p,r+N*b]:d?[e+N*p,r+N*b]:[]}else return S===0||T===0?rg(e,a,u)===u?[u,f]:rg(e,a,s)===s?[s,o]:rg(s,u,a)===a?[a,i]:[]:[]},ok=function(e,r,a,i,s){var o=[],u=i/2,f=s/2,d=r,h=a;o.push({x:d+u*e[0],y:h+f*e[1]});for(var p=1;p<e.length/2;p++)o.push({x:d+u*e[p*2],y:h+f*e[p*2+1]});return o},Zu=function(e,r,a,i,s,o,u,f){var d=[],h,p=new Array(a.length),g=!0;o==null&&(g=!1);var y;if(g){for(var b=0;b<p.length/2;b++)p[b*2]=a[b*2]*o+i,p[b*2+1]=a[b*2+1]*u+s;if(f>0){var E=Ld(p,-f);y=Bd(E)}else y=p}else y=a;for(var S,T,C,N,j=0;j<y.length/2;j++)S=y[j*2],T=y[j*2+1],j<y.length/2-1?(C=y[(j+1)*2],N=y[(j+1)*2+1]):(C=y[0],N=y[1]),h=Fi(e,r,i,s,S,T,C,N),h.length!==0&&d.push(h[0],h[1]);return d},uk=function(e,r,a,i,s,o,u,f,d){var h=[],p,g=new Array(a.length*2);d.forEach(function(C,N){N===0?(g[g.length-2]=C.startX,g[g.length-1]=C.startY):(g[N*4-2]=C.startX,g[N*4-1]=C.startY),g[N*4]=C.stopX,g[N*4+1]=C.stopY,p=Lu(e,r,i,s,C.cx,C.cy,C.radius),p.length!==0&&h.push(p[0],p[1])});for(var y=0;y<g.length/4;y++)p=Fi(e,r,i,s,g[y*4],g[y*4+1],g[y*4+2],g[y*4+3],!1),p.length!==0&&h.push(p[0],p[1]);if(h.length>2){for(var b=[h[0],h[1]],E=Math.pow(b[0]-e,2)+Math.pow(b[1]-r,2),S=1;S<h.length/2;S++){var T=Math.pow(h[S*2]-e,2)+Math.pow(h[S*2+1]-r,2);T<=E&&(b[0]=h[S*2],b[1]=h[S*2+1],E=T)}return b}return h},Wf=function(e,r,a){var i=[e[0]-r[0],e[1]-r[1]],s=Math.sqrt(i[0]*i[0]+i[1]*i[1]),o=(s-a)/s;return o<0&&(o=1e-5),[r[0]+o*i[0],r[1]+o*i[1]]},Jr=function(e,r){var a=Vm(e,r);return a=XT(a),a},XT=function(e){for(var r,a,i=e.length/2,s=1/0,o=1/0,u=-1/0,f=-1/0,d=0;d<i;d++)r=e[2*d],a=e[2*d+1],s=Math.min(s,r),u=Math.max(u,r),o=Math.min(o,a),f=Math.max(f,a);for(var h=2/(u-s),p=2/(f-o),g=0;g<i;g++)r=e[2*g]=e[2*g]*h,a=e[2*g+1]=e[2*g+1]*p,s=Math.min(s,r),u=Math.max(u,r),o=Math.min(o,a),f=Math.max(f,a);if(o<-1)for(var y=0;y<i;y++)a=e[2*y+1]=e[2*y+1]+(-1-o);return e},Vm=function(e,r){var a=1/e*2*Math.PI,i=e%2===0?Math.PI/2+a/2:Math.PI/2;i+=r;for(var s=new Array(e*2),o,u=0;u<e;u++)o=u*a+i,s[2*u]=Math.cos(o),s[2*u+1]=Math.sin(-o);return s},Wi=function(e,r){return Math.min(e/4,r/4,8)},$T=function(e,r){return Math.min(e/10,r/10,8)},P0=function(){return 8},ck=function(e,r,a){return[e-2*r+a,2*(r-e),e]},Fm=function(e,r){return{heightOffset:Math.min(15,.05*r),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}};function ag(t,e){function r(p){for(var g=[],y=0;y<p.length;y++){var b=p[y],E=p[(y+1)%p.length],S={x:E.x-b.x,y:E.y-b.y},T={x:-S.y,y:S.x},C=Math.sqrt(T.x*T.x+T.y*T.y);g.push({x:T.x/C,y:T.y/C})}return g}function a(p,g){var y=1/0,b=-1/0,E=pa(p),S;try{for(E.s();!(S=E.n()).done;){var T=S.value,C=T.x*g.x+T.y*g.y;y=Math.min(y,C),b=Math.max(b,C)}}catch(N){E.e(N)}finally{E.f()}return{min:y,max:b}}function i(p,g){return!(p.max<g.min||g.max<p.min)}var s=[].concat(Od(r(t)),Od(r(e))),o=pa(s),u;try{for(o.s();!(u=o.n()).done;){var f=u.value,d=a(t,f),h=a(e,f);if(!i(d,h))return!1}}catch(p){o.e(p)}finally{o.f()}return!0}var fk=Ir({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),dk={pageRank:function(e){for(var r=fk(e),a=r.dampingFactor,i=r.precision,s=r.iterations,o=r.weight,u=this._private.cy,f=this.byGroup(),d=f.nodes,h=f.edges,p=d.length,g=p*p,y=h.length,b=new Array(g),E=new Array(p),S=(1-a)/p,T=0;T<p;T++){for(var C=0;C<p;C++){var N=T*p+C;b[N]=0}E[T]=0}for(var j=0;j<y;j++){var M=h[j],D=M.data("source"),A=M.data("target");if(D!==A){var B=d.indexOfId(D),R=d.indexOfId(A),L=o(M),_=R*p+B;b[_]+=L,E[B]+=L}}for(var P=1/p+S,q=0;q<p;q++)if(E[q]===0)for(var F=0;F<p;F++){var Y=F*p+q;b[Y]=P}else for(var U=0;U<p;U++){var z=U*p+q;b[z]=b[z]/E[q]+S}for(var H=new Array(p),X=new Array(p),K,k=0;k<p;k++)H[k]=1;for(var G=0;G<s;G++){for(var $=0;$<p;$++)X[$]=0;for(var J=0;J<p;J++)for(var ne=0;ne<p;ne++){var ee=J*p+ne;X[J]+=b[ee]*H[ne]}QR(X),K=H,H=X,X=K;for(var ae=0,de=0;de<p;de++){var le=K[de]-H[de];ae+=le*le}if(ae<i)break}var re={rank:function(oe){return oe=u.collection(oe)[0],H[d.indexOf(oe)]}};return re}},$w=Ir({root:null,weight:function(e){return 1},directed:!1,alpha:0}),ao={degreeCentralityNormalized:function(e){e=$w(e);var r=this.cy(),a=this.nodes(),i=a.length;if(e.directed){for(var h={},p={},g=0,y=0,b=0;b<i;b++){var E=a[b],S=E.id();e.root=E;var T=this.degreeCentrality(e);g<T.indegree&&(g=T.indegree),y<T.outdegree&&(y=T.outdegree),h[S]=T.indegree,p[S]=T.outdegree}return{indegree:function(N){return g==0?0:(Xe(N)&&(N=r.filter(N)),h[N.id()]/g)},outdegree:function(N){return y===0?0:(Xe(N)&&(N=r.filter(N)),p[N.id()]/y)}}}else{for(var s={},o=0,u=0;u<i;u++){var f=a[u];e.root=f;var d=this.degreeCentrality(e);o<d.degree&&(o=d.degree),s[f.id()]=d.degree}return{degree:function(N){return o===0?0:(Xe(N)&&(N=r.filter(N)),s[N.id()]/o)}}}},degreeCentrality:function(e){e=$w(e);var r=this.cy(),a=this,i=e,s=i.root,o=i.weight,u=i.directed,f=i.alpha;if(s=r.collection(s)[0],u){for(var y=s.connectedEdges(),b=y.filter(function(D){return D.target().same(s)&&a.has(D)}),E=y.filter(function(D){return D.source().same(s)&&a.has(D)}),S=b.length,T=E.length,C=0,N=0,j=0;j<b.length;j++)C+=o(b[j]);for(var M=0;M<E.length;M++)N+=o(E[M]);return{indegree:Math.pow(S,1-f)*Math.pow(C,f),outdegree:Math.pow(T,1-f)*Math.pow(N,f)}}else{for(var d=s.connectedEdges().intersection(a),h=d.length,p=0,g=0;g<d.length;g++)p+=o(d[g]);return{degree:Math.pow(h,1-f)*Math.pow(p,f)}}}};ao.dc=ao.degreeCentrality;ao.dcn=ao.degreeCentralityNormalised=ao.degreeCentralityNormalized;var Zw=Ir({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),no={closenessCentralityNormalized:function(e){for(var r=Zw(e),a=r.harmonic,i=r.weight,s=r.directed,o=this.cy(),u={},f=0,d=this.nodes(),h=this.floydWarshall({weight:i,directed:s}),p=0;p<d.length;p++){for(var g=0,y=d[p],b=0;b<d.length;b++)if(p!==b){var E=h.distance(y,d[b]);a?g+=1/E:g+=E}a||(g=1/g),f<g&&(f=g),u[y.id()]=g}return{closeness:function(T){return f==0?0:(Xe(T)?T=o.filter(T)[0].id():T=T.id(),u[T]/f)}}},closenessCentrality:function(e){var r=Zw(e),a=r.root,i=r.weight,s=r.directed,o=r.harmonic;a=this.filter(a)[0];for(var u=this.dijkstra({root:a,weight:i,directed:s}),f=0,d=this.nodes(),h=0;h<d.length;h++){var p=d[h];if(!p.same(a)){var g=u.distanceTo(p);o?f+=1/g:f+=g}}return o?f:1/f}};no.cc=no.closenessCentrality;no.ccn=no.closenessCentralityNormalised=no.closenessCentralityNormalized;var hk=Ir({weight:null,directed:!1}),Hm={betweennessCentrality:function(e){for(var r=hk(e),a=r.directed,i=r.weight,s=i!=null,o=this.cy(),u=this.nodes(),f={},d={},h=0,p={set:function(N,j){d[N]=j,j>h&&(h=j)},get:function(N){return d[N]}},g=0;g<u.length;g++){var y=u[g],b=y.id();a?f[b]=y.outgoers().nodes():f[b]=y.openNeighborhood().nodes(),p.set(b,0)}for(var E=function(){for(var N=u[S].id(),j=[],M={},D={},A={},B=new Ec(function(J,ne){return A[J]-A[ne]}),R=0;R<u.length;R++){var L=u[R].id();M[L]=[],D[L]=0,A[L]=1/0}for(D[N]=1,A[N]=0,B.push(N);!B.empty();){var _=B.pop();if(j.push(_),s)for(var P=0;P<f[_].length;P++){var q=f[_][P],F=o.getElementById(_),Y=void 0;F.edgesTo(q).length>0?Y=F.edgesTo(q)[0]:Y=q.edgesTo(F)[0];var U=i(Y);q=q.id(),A[q]>A[_]+U&&(A[q]=A[_]+U,B.nodes.indexOf(q)<0?B.push(q):B.updateItem(q),D[q]=0,M[q]=[]),A[q]==A[_]+U&&(D[q]=D[q]+D[_],M[q].push(_))}else for(var z=0;z<f[_].length;z++){var H=f[_][z].id();A[H]==1/0&&(B.push(H),A[H]=A[_]+1),A[H]==A[_]+1&&(D[H]=D[H]+D[_],M[H].push(_))}}for(var X={},K=0;K<u.length;K++)X[u[K].id()]=0;for(;j.length>0;){for(var k=j.pop(),G=0;G<M[k].length;G++){var $=M[k][G];X[$]=X[$]+D[$]/D[k]*(1+X[k])}k!=u[S].id()&&p.set(k,p.get(k)+X[k])}},S=0;S<u.length;S++)E();var T={betweenness:function(N){var j=o.collection(N).id();return p.get(j)},betweennessNormalized:function(N){if(h==0)return 0;var j=o.collection(N).id();return p.get(j)/h}};return T.betweennessNormalised=T.betweennessNormalized,T}};Hm.bc=Hm.betweennessCentrality;var vk=Ir({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(t){return 1}]}),pk=function(e){return vk(e)},gk=function(e,r){for(var a=0,i=0;i<r.length;i++)a+=r[i](e);return a},mk=function(e,r,a){for(var i=0;i<r;i++)e[i*r+i]=a},ZT=function(e,r){for(var a,i=0;i<r;i++){a=0;for(var s=0;s<r;s++)a+=e[s*r+i];for(var o=0;o<r;o++)e[o*r+i]=e[o*r+i]/a}},yk=function(e,r,a){for(var i=new Array(a*a),s=0;s<a;s++){for(var o=0;o<a;o++)i[s*a+o]=0;for(var u=0;u<a;u++)for(var f=0;f<a;f++)i[s*a+f]+=e[s*a+u]*r[u*a+f]}return i},xk=function(e,r,a){for(var i=e.slice(0),s=1;s<a;s++)e=yk(e,i,r);return e},bk=function(e,r,a){for(var i=new Array(r*r),s=0;s<r*r;s++)i[s]=Math.pow(e[s],a);return ZT(i,r),i},wk=function(e,r,a,i){for(var s=0;s<a;s++){var o=Math.round(e[s]*Math.pow(10,i))/Math.pow(10,i),u=Math.round(r[s]*Math.pow(10,i))/Math.pow(10,i);if(o!==u)return!1}return!0},Sk=function(e,r,a,i){for(var s=[],o=0;o<r;o++){for(var u=[],f=0;f<r;f++)Math.round(e[o*r+f]*1e3)/1e3>0&&u.push(a[f]);u.length!==0&&s.push(i.collection(u))}return s},Ek=function(e,r){for(var a=0;a<e.length;a++)if(!r[a]||e[a].id()!==r[a].id())return!1;return!0},Tk=function(e){for(var r=0;r<e.length;r++)for(var a=0;a<e.length;a++)r!=a&&Ek(e[r],e[a])&&e.splice(a,1);return e},Ww=function(e){for(var r=this.nodes(),a=this.edges(),i=this.cy(),s=pk(e),o={},u=0;u<r.length;u++)o[r[u].id()]=u;for(var f=r.length,d=f*f,h=new Array(d),p,g=0;g<d;g++)h[g]=0;for(var y=0;y<a.length;y++){var b=a[y],E=o[b.source().id()],S=o[b.target().id()],T=gk(b,s.attributes);h[E*f+S]+=T,h[S*f+E]+=T}mk(h,f,s.multFactor),ZT(h,f);for(var C=!0,N=0;C&&N<s.maxIterations;)C=!1,p=xk(h,f,s.expandFactor),h=bk(p,f,s.inflateFactor),wk(h,p,d,4)||(C=!0),N++;var j=Sk(h,f,r,i);return j=Tk(j),j},Ck={markovClustering:Ww,mcl:Ww},Nk=function(e){return e},WT=function(e,r){return Math.abs(r-e)},Jw=function(e,r,a){return e+WT(r,a)},e2=function(e,r,a){return e+Math.pow(a-r,2)},Ak=function(e){return Math.sqrt(e)},jk=function(e,r,a){return Math.max(e,WT(r,a))},Au=function(e,r,a,i,s){for(var o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:Nk,u=i,f,d,h=0;h<e;h++)f=r(h),d=a(h),u=s(u,f,d);return o(u)},To={euclidean:function(e,r,a){return e>=2?Au(e,r,a,0,e2,Ak):Au(e,r,a,0,Jw)},squaredEuclidean:function(e,r,a){return Au(e,r,a,0,e2)},manhattan:function(e,r,a){return Au(e,r,a,0,Jw)},max:function(e,r,a){return Au(e,r,a,-1/0,jk)}};To["squared-euclidean"]=To.squaredEuclidean;To.squaredeuclidean=To.squaredEuclidean;function rh(t,e,r,a,i,s){var o;return Zt(t)?o=t:o=To[t]||To.euclidean,e===0&&Zt(t)?o(i,s):o(e,r,a,i,s)}var Dk=Ir({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),U0=function(e){return Dk(e)},zd=function(e,r,a,i,s){var o=s!=="kMedoids",u=o?function(p){return a[p]}:function(p){return i[p](a)},f=function(g){return i[g](r)},d=a,h=r;return rh(e,i.length,u,f,d,h)},ng=function(e,r,a){for(var i=a.length,s=new Array(i),o=new Array(i),u=new Array(r),f=null,d=0;d<i;d++)s[d]=e.min(a[d]).value,o[d]=e.max(a[d]).value;for(var h=0;h<r;h++){f=[];for(var p=0;p<i;p++)f[p]=Math.random()*(o[p]-s[p])+s[p];u[h]=f}return u},JT=function(e,r,a,i,s){for(var o=1/0,u=0,f=0;f<r.length;f++){var d=zd(a,e,r[f],i,s);d<o&&(o=d,u=f)}return u},eC=function(e,r,a){for(var i=[],s=null,o=0;o<r.length;o++)s=r[o],a[s.id()]===e&&i.push(s);return i},Ok=function(e,r,a){return Math.abs(r-e)<=a},Mk=function(e,r,a){for(var i=0;i<e.length;i++)for(var s=0;s<e[i].length;s++){var o=Math.abs(e[i][s]-r[i][s]);if(o>a)return!1}return!0},Rk=function(e,r,a){for(var i=0;i<a;i++)if(e===r[i])return!0;return!1},t2=function(e,r){var a=new Array(r);if(e.length<50)for(var i=0;i<r;i++){for(var s=e[Math.floor(Math.random()*e.length)];Rk(s,a,i);)s=e[Math.floor(Math.random()*e.length)];a[i]=s}else for(var o=0;o<r;o++)a[o]=e[Math.floor(Math.random()*e.length)];return a},r2=function(e,r,a){for(var i=0,s=0;s<r.length;s++)i+=zd("manhattan",r[s],e,a,"kMedoids");return i},kk=function(e){var r=this.cy(),a=this.nodes(),i=null,s=U0(e),o=new Array(s.k),u={},f;s.testMode?typeof s.testCentroids=="number"?(s.testCentroids,f=ng(a,s.k,s.attributes)):wr(s.testCentroids)==="object"?f=s.testCentroids:f=ng(a,s.k,s.attributes):f=ng(a,s.k,s.attributes);for(var d=!0,h=0;d&&h<s.maxIterations;){for(var p=0;p<a.length;p++)i=a[p],u[i.id()]=JT(i,f,s.distance,s.attributes,"kMeans");d=!1;for(var g=0;g<s.k;g++){var y=eC(g,a,u);if(y.length!==0){for(var b=s.attributes.length,E=f[g],S=new Array(b),T=new Array(b),C=0;C<b;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,Ok(S[C],E[C],s.sensitivityThreshold)||(d=!0)}f[g]=S,o[g]=r.collection(y)}}h++}return o},Bk=function(e){var r=this.cy(),a=this.nodes(),i=null,s=U0(e),o=new Array(s.k),u,f={},d,h=new Array(s.k);s.testMode?typeof s.testCentroids=="number"||(wr(s.testCentroids)==="object"?u=s.testCentroids:u=t2(a,s.k)):u=t2(a,s.k);for(var p=!0,g=0;p&&g<s.maxIterations;){for(var y=0;y<a.length;y++)i=a[y],f[i.id()]=JT(i,u,s.distance,s.attributes,"kMedoids");p=!1;for(var b=0;b<u.length;b++){var E=eC(b,a,f);if(E.length!==0){h[b]=r2(u[b],E,s.attributes);for(var S=0;S<E.length;S++)d=r2(E[S],E,s.attributes),d<h[b]&&(h[b]=d,u[b]=E[S],p=!0);o[b]=r.collection(E)}}g++}return o},Lk=function(e,r,a,i,s){for(var o,u,f=0;f<r.length;f++)for(var d=0;d<e.length;d++)i[f][d]=Math.pow(a[f][d],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 g=0;g<r.length;g++)o+=i[g][h]*s.attributes[p](r[g]),u+=i[g][h];e[h][p]=o/u}},zk=function(e,r,a,i,s){for(var o=0;o<e.length;o++)r[o]=e[o].slice();for(var u,f,d,h=2/(s.m-1),p=0;p<a.length;p++)for(var g=0;g<i.length;g++){u=0;for(var y=0;y<a.length;y++)f=zd(s.distance,i[g],a[p],s.attributes,"cmeans"),d=zd(s.distance,i[g],a[y],s.attributes,"cmeans"),u+=Math.pow(f/d,h);e[g][p]=1/u}},_k=function(e,r,a,i){for(var s=new Array(a.k),o=0;o<s.length;o++)s[o]=[];for(var u,f,d=0;d<r.length;d++){u=-1/0,f=-1;for(var h=0;h<r[0].length;h++)r[d][h]>u&&(u=r[d][h],f=h);s[f].push(e[d])}for(var p=0;p<s.length;p++)s[p]=i.collection(s[p]);return s},a2=function(e){var r=this.cy(),a=this.nodes(),i=U0(e),s,o,u,f,d;f=new Array(a.length);for(var h=0;h<a.length;h++)f[h]=new Array(i.k);u=new Array(a.length);for(var p=0;p<a.length;p++)u[p]=new Array(i.k);for(var g=0;g<a.length;g++){for(var y=0,b=0;b<i.k;b++)u[g][b]=Math.random(),y+=u[g][b];for(var E=0;E<i.k;E++)u[g][E]=u[g][E]/y}o=new Array(i.k);for(var S=0;S<i.k;S++)o[S]=new Array(i.attributes.length);d=new Array(a.length);for(var T=0;T<a.length;T++)d[T]=new Array(i.k);for(var C=!0,N=0;C&&N<i.maxIterations;)C=!1,Lk(o,a,u,d,i),zk(u,f,o,a,i),Mk(u,f,i.sensitivityThreshold)||(C=!0),N++;return s=_k(a,u,i,r),{clusters:s,degreeOfMembership:u}},Pk={kMeans:kk,kMedoids:Bk,fuzzyCMeans:a2,fcm:a2},Uk=Ir({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),qk={single:"min",complete:"max"},Ik=function(e){var r=Uk(e),a=qk[r.linkage];return a!=null&&(r.linkage=a),r},n2=function(e,r,a,i,s){for(var o=0,u=1/0,f,d=s.attributes,h=function(R,L){return rh(s.distance,d.length,function(_){return d[_](R)},function(_){return d[_](L)},R,L)},p=0;p<e.length;p++){var g=e[p].key,y=a[g][i[g]];y<u&&(o=g,u=y)}if(s.mode==="threshold"&&u>=s.threshold||s.mode==="dendrogram"&&e.length===1)return!1;var b=r[o],E=r[i[o]],S;s.mode==="dendrogram"?S={left:b,right:E,key:b.key}:S={value:b.value.concat(E.value),key:b.key},e[b.index]=S,e.splice(E.index,1),r[b.key]=S;for(var T=0;T<e.length;T++){var C=e[T];b.key===C.key?f=1/0:s.linkage==="min"?(f=a[b.key][C.key],a[b.key][C.key]>a[E.key][C.key]&&(f=a[E.key][C.key])):s.linkage==="max"?(f=a[b.key][C.key],a[b.key][C.key]<a[E.key][C.key]&&(f=a[E.key][C.key])):s.linkage==="mean"?f=(a[b.key][C.key]*b.size+a[E.key][C.key]*E.size)/(b.size+E.size):s.mode==="dendrogram"?f=h(C.value,b.value):f=h(C.value[0],b.value[0]),a[b.key][C.key]=a[C.key][b.key]=f}for(var N=0;N<e.length;N++){var j=e[N].key;if(i[j]===b.key||i[j]===E.key){for(var M=j,D=0;D<e.length;D++){var A=e[D].key;a[j][A]<a[j][M]&&(M=A)}i[j]=M}e[N].index=N}return b.key=E.key=b.index=E.index=null,!0},Wl=function(e,r,a){e&&(e.value?r.push(e.value):(e.left&&Wl(e.left,r),e.right&&Wl(e.right,r)))},Gm=function(e,r){if(!e)return"";if(e.left&&e.right){var a=Gm(e.left,r),i=Gm(e.right,r),s=r.add({group:"nodes",data:{id:a+","+i}});return r.add({group:"edges",data:{source:a,target:s.id()}}),r.add({group:"edges",data:{source:i,target:s.id()}}),s.id()}else if(e.value)return e.value.id()},Qm=function(e,r,a){if(!e)return[];var i=[],s=[],o=[];return r===0?(e.left&&Wl(e.left,i),e.right&&Wl(e.right,s),o=i.concat(s),[a.collection(o)]):r===1?e.value?[a.collection(e.value)]:(e.left&&Wl(e.left,i),e.right&&Wl(e.right,s),[a.collection(i),a.collection(s)]):e.value?[a.collection(e.value)]:(e.left&&(i=Qm(e.left,r-1,a)),e.right&&(s=Qm(e.right,r-1,a)),i.concat(s))},i2=function(e){for(var r=this.cy(),a=this.nodes(),i=Ik(e),s=i.attributes,o=function(N,j){return rh(i.distance,s.length,function(M){return s[M](N)},function(M){return s[M](j)},N,j)},u=[],f=[],d=[],h=[],p=0;p<a.length;p++){var g={value:i.mode==="dendrogram"?a[p]:[a[p]],key:p,index:p};u[p]=g,h[p]=g,f[p]=[],d[p]=0}for(var y=0;y<u.length;y++)for(var b=0;b<=y;b++){var E=void 0;i.mode==="dendrogram"?E=y===b?1/0:o(u[y].value,u[b].value):E=y===b?1/0:o(u[y].value[0],u[b].value[0]),f[y][b]=E,f[b][y]=E,E<f[y][d[y]]&&(d[y]=b)}for(var S=n2(u,h,f,d,i);S;)S=n2(u,h,f,d,i);var T;return i.mode==="dendrogram"?(T=Qm(u[0],i.dendrogramDepth,r),i.addDendrogram&&Gm(u[0],r)):(T=new Array(u.length),u.forEach(function(C,N){C.key=C.index=null,T[N]=r.collection(C.value)})),T},Vk={hierarchicalClustering:i2,hca:i2},Fk=Ir({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),Hk=function(e){var r=e.damping,a=e.preference;.5<=r&&r<1||Qt("Damping must range on [0.5, 1). Got: ".concat(r));var i=["median","mean","min","max"];return i.some(function(s){return s===a})||Oe(a)||Qt("Preference must be one of [".concat(i.map(function(s){return"'".concat(s,"'")}).join(", "),"] or a number. Got: ").concat(a)),Fk(e)},Gk=function(e,r,a,i){var s=function(u,f){return i[f](u)};return-rh(e,i.length,function(o){return s(r,o)},function(o){return s(a,o)},r,a)},Qk=function(e,r){var a=null;return r==="median"?a=HR(e):r==="mean"?a=FR(e):r==="min"?a=IR(e):r==="max"?a=VR(e):a=r,a},Yk=function(e,r,a){for(var i=[],s=0;s<e;s++)r[s*e+s]+a[s*e+s]>0&&i.push(s);return i},s2=function(e,r,a){for(var i=[],s=0;s<e;s++){for(var o=-1,u=-1/0,f=0;f<a.length;f++){var d=a[f];r[s*e+d]>u&&(o=d,u=r[s*e+d])}o>0&&i.push(o)}for(var h=0;h<a.length;h++)i[a[h]]=a[h];return i},Kk=function(e,r,a){for(var i=s2(e,r,a),s=0;s<a.length;s++){for(var o=[],u=0;u<i.length;u++)i[u]===a[s]&&o.push(u);for(var f=-1,d=-1/0,h=0;h<o.length;h++){for(var p=0,g=0;g<o.length;g++)p+=r[o[g]*e+o[h]];p>d&&(f=h,d=p)}a[s]=o[f]}return i=s2(e,r,a),i},l2=function(e){for(var r=this.cy(),a=this.nodes(),i=Hk(e),s={},o=0;o<a.length;o++)s[a[o].id()]=o;var u,f,d,h,p,g;u=a.length,f=u*u,d=new Array(f);for(var y=0;y<f;y++)d[y]=-1/0;for(var b=0;b<u;b++)for(var E=0;E<u;E++)b!==E&&(d[b*u+E]=Gk(i.distance,a[b],a[E],i.attributes));h=Qk(d,i.preference);for(var S=0;S<u;S++)d[S*u+S]=h;p=new Array(f);for(var T=0;T<f;T++)p[T]=0;g=new Array(f);for(var C=0;C<f;C++)g[C]=0;for(var N=new Array(u),j=new Array(u),M=new Array(u),D=0;D<u;D++)N[D]=0,j[D]=0,M[D]=0;for(var A=new Array(u*i.minIterations),B=0;B<A.length;B++)A[B]=0;var R;for(R=0;R<i.maxIterations;R++){for(var L=0;L<u;L++){for(var _=-1/0,P=-1/0,q=-1,F=0,Y=0;Y<u;Y++)N[Y]=p[L*u+Y],F=g[L*u+Y]+d[L*u+Y],F>=_?(P=_,_=F,q=Y):F>P&&(P=F);for(var U=0;U<u;U++)p[L*u+U]=(1-i.damping)*(d[L*u+U]-_)+i.damping*N[U];p[L*u+q]=(1-i.damping)*(d[L*u+q]-P)+i.damping*N[q]}for(var z=0;z<u;z++){for(var H=0,X=0;X<u;X++)N[X]=g[X*u+z],j[X]=Math.max(0,p[X*u+z]),H+=j[X];H-=j[z],j[z]=p[z*u+z],H+=j[z];for(var K=0;K<u;K++)g[K*u+z]=(1-i.damping)*Math.min(0,H-j[K])+i.damping*N[K];g[z*u+z]=(1-i.damping)*(H-j[z])+i.damping*N[z]}for(var k=0,G=0;G<u;G++){var $=g[G*u+G]+p[G*u+G]>0?1:0;A[R%i.minIterations*u+G]=$,k+=$}if(k>0&&(R>=i.minIterations-1||R==i.maxIterations-1)){for(var J=0,ne=0;ne<u;ne++){M[ne]=0;for(var ee=0;ee<i.minIterations;ee++)M[ne]+=A[ee*u+ne];(M[ne]===0||M[ne]===i.minIterations)&&J++}if(J===u)break}}for(var ae=Yk(u,p,g),de=Kk(u,d,ae),le={},re=0;re<ae.length;re++)le[ae[re]]=[];for(var Z=0;Z<a.length;Z++){var oe=s[a[Z].id()],ve=de[oe];ve!=null&&le[ve].push(a[Z])}for(var Ne=new Array(ae.length),Me=0;Me<ae.length;Me++)Ne[Me]=r.collection(le[ae[Me]]);return Ne},Xk={affinityPropagation:l2,ap:l2},$k=Ir({root:void 0,directed:!1}),Zk={hierholzer:function(e){if(!bt(e)){var r=arguments;e={root:r[0],directed:r[1]}}var a=$k(e),i=a.root,s=a.directed,o=this,u=!1,f,d,h;i&&(h=Xe(i)?this.filter(i)[0].id():i[0].id());var p={},g={};s?o.forEach(function(C){var N=C.id();if(C.isNode()){var j=C.indegree(!0),M=C.outdegree(!0),D=j-M,A=M-j;D==1?f?u=!0:f=N:A==1?d?u=!0:d=N:(A>1||D>1)&&(u=!0),p[N]=[],C.outgoers().forEach(function(B){B.isEdge()&&p[N].push(B.id())})}else g[N]=[void 0,C.target().id()]}):o.forEach(function(C){var N=C.id();if(C.isNode()){var j=C.degree(!0);j%2&&(f?d?u=!0:d=N:f=N),p[N]=[],C.connectedEdges().forEach(function(M){return p[N].push(M.id())})}else g[N]=[C.source().id(),C.target().id()]});var y={found:!1,trail:void 0};if(u)return y;if(d&&f)if(s){if(h&&d!=h)return y;h=d}else{if(h&&d!=h&&f!=h)return y;h||(h=d)}else h||(h=o[0].id());var b=function(N){for(var j=N,M=[N],D,A,B;p[j].length;)D=p[j].shift(),A=g[D][0],B=g[D][1],j!=B?(p[B]=p[B].filter(function(R){return R!=D}),j=B):!s&&j!=A&&(p[A]=p[A].filter(function(R){return R!=D}),j=A),M.unshift(D),M.unshift(j);return M},E=[],S=[];for(S=b(h);S.length!=1;)p[S[0]].length==0?(E.unshift(o.getElementById(S.shift())),E.unshift(o.getElementById(S.shift()))):S=b(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}},Jf=function(){var e=this,r={},a=0,i=0,s=[],o=[],u={},f=function(g,y){for(var b=o.length-1,E=[],S=e.spawn();o[b].x!=g||o[b].y!=y;)E.push(o.pop().edge),b--;E.push(o.pop().edge),E.forEach(function(T){var C=T.connectedNodes().intersection(e);S.merge(T),C.forEach(function(N){var j=N.id(),M=N.connectedEdges().intersection(e);S.merge(N),r[j].cutVertex?S.merge(M.filter(function(D){return D.isLoop()})):S.merge(M)})}),s.push(S)},d=function(g,y,b){g===b&&(i+=1),r[y]={id:a,low:a++,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(j){S=j.source().id(),T=j.target().id(),C=S===y?T:S,C!==b&&(N=j.id(),u[N]||(u[N]=!0,o.push({x:y,y:C,edge:j})),C in r?r[y].low=Math.min(r[y].low,r[C].id):(d(g,C,y),r[y].low=Math.min(r[y].low,r[C].low),r[y].id<=r[C].low&&(r[y].cutVertex=!0,f(y,C))))})}};e.forEach(function(p){if(p.isNode()){var g=p.id();g in r||(i=0,d(g,g),r[g].cutVertex=i>1)}});var h=Object.keys(r).filter(function(p){return r[p].cutVertex}).map(function(p){return e.getElementById(p)});return{cut:e.spawn(h),components:s}},Wk={hopcroftTarjanBiconnected:Jf,htbc:Jf,htb:Jf,hopcroftTarjanBiconnectedComponents:Jf},ed=function(){var e=this,r={},a=0,i=[],s=[],o=e.spawn(e),u=function(d){s.push(d),r[d]={index:a,low:a++,explored:!1};var h=e.getElementById(d).connectedEdges().intersection(e);if(h.forEach(function(E){var S=E.target().id();S!==d&&(S in r||u(S),r[S].explored||(r[d].low=Math.min(r[d].low,r[S].low)))}),r[d].index===r[d].low){for(var p=e.spawn();;){var g=s.pop();if(p.merge(e.getElementById(g)),r[g].low=r[d].index,r[g].explored=!0,g===d)break}var y=p.edgesWith(p),b=p.merge(y);i.push(b),o=o.difference(b)}};return e.forEach(function(f){if(f.isNode()){var d=f.id();d in r||u(d)}}),{cut:o,components:i}},Jk={tarjanStronglyConnected:ed,tsc:ed,tscc:ed,tarjanStronglyConnectedComponents:ed},tC={};[Xu,DR,OR,RR,BR,zR,UR,dk,ao,no,Hm,Ck,Pk,Vk,Xk,Zk,Wk,Jk].forEach(function(t){Ze(tC,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 rC=0,aC=1,nC=2,tn=function(e){if(!(this instanceof tn))return new tn(e);this.id="Thenable/1.0.7",this.state=rC,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))};tn.prototype={fulfill:function(e){return o2(this,aC,"fulfillValue",e)},reject:function(e){return o2(this,nC,"rejectReason",e)},then:function(e,r){var a=this,i=new tn;return a.onFulfilled.push(c2(e,i,"fulfill")),a.onRejected.push(c2(r,i,"reject")),iC(a),i.proxy}};var o2=function(e,r,a,i){return e.state===rC&&(e.state=r,e[a]=i,iC(e)),e},iC=function(e){e.state===aC?u2(e,"onFulfilled",e.fulfillValue):e.state===nC&&u2(e,"onRejected",e.rejectReason)},u2=function(e,r,a){if(e[r].length!==0){var i=e[r];e[r]=[];var s=function(){for(var u=0;u<i.length;u++)i[u](a)};typeof setImmediate=="function"?setImmediate(s):setTimeout(s,0)}},c2=function(e,r,a){return function(i){if(typeof e!="function")r[a].call(r,i);else{var s;try{s=e(i)}catch(o){r.reject(o);return}sC(r,s)}}},sC=function(e,r){if(e===r||e.proxy===r){e.reject(new TypeError("cannot resolve promise with itself"));return}var a;if(wr(r)==="object"&&r!==null||typeof r=="function")try{a=r.then}catch(s){e.reject(s);return}if(typeof a=="function"){var i=!1;try{a.call(r,function(s){i||(i=!0,s===r?e.reject(new TypeError("circular thenable chain")):sC(e,s))},function(s){i||(i=!0,e.reject(s))})}catch(s){i||e.reject(s)}return}e.fulfill(r)};tn.all=function(t){return new tn(function(e,r){for(var a=new Array(t.length),i=0,s=function(f,d){a[f]=d,i++,i===t.length&&e(a)},o=0;o<t.length;o++)(function(u){var f=t[u],d=f!=null&&f.then!=null;if(d)f.then(function(p){s(u,p)},function(p){r(p)});else{var h=f;s(u,h)}})(o)})};tn.resolve=function(t){return new tn(function(e,r){e(t)})};tn.reject=function(t){return new tn(function(e,r){r(t)})};var Oo=typeof Promise<"u"?Promise:tn,Ym=function(e,r,a){var i=D0(e),s=!i,o=this._private=Ze({duration:1e3},r,a);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 f=e.pan();o.startPan={x:f.x,y:f.y},o.startZoom=e.zoom()}this.length=1,this[0]=this},Xs=Ym.prototype;Ze(Xs,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var r,a=e.target._private.animation;e.queue?r=a.queue:r=a.current,r.push(this),Aa(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 r=this._private;return e===void 0?r.progress*r.duration:this.progress(e/r.duration)},progress:function(e){var r=this._private,a=r.playing;return e===void 0?r.progress:(a&&this.pause(),r.progress=e,r.started=!1,a&&this.play(),this)},completed:function(){return this._private.progress===1},reverse:function(){var e=this._private,r=e.playing;r&&this.pause(),e.progress=1-e.progress,e.started=!1;var a=function(d,h){var p=e[d];p!=null&&(e[d]=e[h],e[h]=p)};if(a("zoom","startZoom"),a("pan","startPan"),a("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 r&&this.play(),this},promise:function(e){var r=this._private,a;switch(e){case"frame":a=r.frames;break;default:case"complete":case"completed":a=r.completes}return new Oo(function(i,s){a.push(function(){i()})})}});Xs.complete=Xs.completed;Xs.run=Xs.play;Xs.running=Xs.playing;var e4={animated:function(){return function(){var r=this,a=r.length!==void 0,i=a?r:[r],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 r=this,a=r.length!==void 0,i=a?r:[r],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(r,a){var i=this._private.cy||this;return i.styleEnabled()?this.animate({delay:r,duration:r,complete:a}):this}},delayAnimation:function(){return function(r,a){var i=this._private.cy||this;return i.styleEnabled()?this.animation({delay:r,duration:r,complete:a}):this}},animation:function(){return function(r,a){var i=this,s=i.length!==void 0,o=s?i:[i],u=this._private.cy||this,f=!s,d=!f;if(!u.styleEnabled())return this;var h=u.style();r=Ze({},r,a);var p=Object.keys(r).length===0;if(p)return new Ym(o[0],r);switch(r.duration===void 0&&(r.duration=400),r.duration){case"slow":r.duration=600;break;case"fast":r.duration=200;break}if(d&&(r.style=h.getPropsList(r.style||r.css),r.css=void 0),d&&r.renderedPosition!=null){var g=r.renderedPosition,y=u.pan(),b=u.zoom();r.position=GT(g,b,y)}if(f&&r.panBy!=null){var E=r.panBy,S=u.pan();r.pan={x:S.x+E.x,y:S.y+E.y}}var T=r.center||r.centre;if(f&&T!=null){var C=u.getCenterPan(T.eles,r.zoom);C!=null&&(r.pan=C)}if(f&&r.fit!=null){var N=r.fit,j=u.getFitViewport(N.eles||N.boundingBox,N.padding);j!=null&&(r.pan=j.pan,r.zoom=j.zoom)}if(f&&bt(r.zoom)){var M=u.getZoomedViewport(r.zoom);M!=null?(M.zoomed&&(r.zoom=M.zoom),M.panned&&(r.pan=M.pan)):r.zoom=null}return new Ym(o[0],r)}},animate:function(){return function(r,a){var i=this,s=i.length!==void 0,o=s?i:[i],u=this._private.cy||this;if(!u.styleEnabled())return this;a&&(r=Ze({},r,a));for(var f=0;f<o.length;f++){var d=o[f],h=d.animated()&&(r.queue===void 0||r.queue),p=d.animation(r,h?{queue:!0}:void 0);p.play()}return this}},stop:function(){return function(r,a){var i=this,s=i.length!==void 0,o=s?i:[i],u=this._private.cy||this;if(!u.styleEnabled())return this;for(var f=0;f<o.length;f++){for(var d=o[f],h=d._private,p=h.animation.current,g=0;g<p.length;g++){var y=p[g],b=y._private;a&&(b.duration=0)}r&&(h.animation.queue=[]),a||(h.animation.current=[])}return u.notify("draw"),this}}},ig,f2;function ah(){if(f2)return ig;f2=1;var t=Array.isArray;return ig=t,ig}var sg,d2;function t4(){if(d2)return sg;d2=1;var t=ah(),e=wc(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\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:a.test(s)||!r.test(s)||o!=null&&s in Object(o)}return sg=i,sg}var lg,h2;function r4(){if(h2)return lg;h2=1;var t=zT(),e=bc(),r="[object AsyncFunction]",a="[object Function]",i="[object GeneratorFunction]",s="[object Proxy]";function o(u){if(!e(u))return!1;var f=t(u);return f==a||f==i||f==r||f==s}return lg=o,lg}var og,v2;function a4(){if(v2)return og;v2=1;var t=Jd(),e=t["__core-js_shared__"];return og=e,og}var ug,p2;function n4(){if(p2)return ug;p2=1;var t=a4(),e=(function(){var a=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||"");return a?"Symbol(src)_1."+a:""})();function r(a){return!!e&&e in a}return ug=r,ug}var cg,g2;function i4(){if(g2)return cg;g2=1;var t=Function.prototype,e=t.toString;function r(a){if(a!=null){try{return e.call(a)}catch{}try{return a+""}catch{}}return""}return cg=r,cg}var fg,m2;function s4(){if(m2)return fg;m2=1;var t=r4(),e=n4(),r=bc(),a=i4(),i=/[\\^$.*+?()[\]{}|]/g,s=/^\[object .+?Constructor\]$/,o=Function.prototype,u=Object.prototype,f=o.toString,d=u.hasOwnProperty,h=RegExp("^"+f.call(d).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function p(g){if(!r(g)||e(g))return!1;var y=t(g)?h:s;return y.test(a(g))}return fg=p,fg}var dg,y2;function l4(){if(y2)return dg;y2=1;function t(e,r){return e==null?void 0:e[r]}return dg=t,dg}var hg,x2;function q0(){if(x2)return hg;x2=1;var t=s4(),e=l4();function r(a,i){var s=e(a,i);return t(s)?s:void 0}return hg=r,hg}var vg,b2;function nh(){if(b2)return vg;b2=1;var t=q0(),e=t(Object,"create");return vg=e,vg}var pg,w2;function o4(){if(w2)return pg;w2=1;var t=nh();function e(){this.__data__=t?t(null):{},this.size=0}return pg=e,pg}var gg,S2;function u4(){if(S2)return gg;S2=1;function t(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}return gg=t,gg}var mg,E2;function c4(){if(E2)return mg;E2=1;var t=nh(),e="__lodash_hash_undefined__",r=Object.prototype,a=r.hasOwnProperty;function i(s){var o=this.__data__;if(t){var u=o[s];return u===e?void 0:u}return a.call(o,s)?o[s]:void 0}return mg=i,mg}var yg,T2;function f4(){if(T2)return yg;T2=1;var t=nh(),e=Object.prototype,r=e.hasOwnProperty;function a(i){var s=this.__data__;return t?s[i]!==void 0:r.call(s,i)}return yg=a,yg}var xg,C2;function d4(){if(C2)return xg;C2=1;var t=nh(),e="__lodash_hash_undefined__";function r(a,i){var s=this.__data__;return this.size+=this.has(a)?0:1,s[a]=t&&i===void 0?e:i,this}return xg=r,xg}var bg,N2;function h4(){if(N2)return bg;N2=1;var t=o4(),e=u4(),r=c4(),a=f4(),i=d4();function s(o){var u=-1,f=o==null?0:o.length;for(this.clear();++u<f;){var d=o[u];this.set(d[0],d[1])}}return s.prototype.clear=t,s.prototype.delete=e,s.prototype.get=r,s.prototype.has=a,s.prototype.set=i,bg=s,bg}var wg,A2;function v4(){if(A2)return wg;A2=1;function t(){this.__data__=[],this.size=0}return wg=t,wg}var Sg,j2;function lC(){if(j2)return Sg;j2=1;function t(e,r){return e===r||e!==e&&r!==r}return Sg=t,Sg}var Eg,D2;function ih(){if(D2)return Eg;D2=1;var t=lC();function e(r,a){for(var i=r.length;i--;)if(t(r[i][0],a))return i;return-1}return Eg=e,Eg}var Tg,O2;function p4(){if(O2)return Tg;O2=1;var t=ih(),e=Array.prototype,r=e.splice;function a(i){var s=this.__data__,o=t(s,i);if(o<0)return!1;var u=s.length-1;return o==u?s.pop():r.call(s,o,1),--this.size,!0}return Tg=a,Tg}var Cg,M2;function g4(){if(M2)return Cg;M2=1;var t=ih();function e(r){var a=this.__data__,i=t(a,r);return i<0?void 0:a[i][1]}return Cg=e,Cg}var Ng,R2;function m4(){if(R2)return Ng;R2=1;var t=ih();function e(r){return t(this.__data__,r)>-1}return Ng=e,Ng}var Ag,k2;function y4(){if(k2)return Ag;k2=1;var t=ih();function e(r,a){var i=this.__data__,s=t(i,r);return s<0?(++this.size,i.push([r,a])):i[s][1]=a,this}return Ag=e,Ag}var jg,B2;function x4(){if(B2)return jg;B2=1;var t=v4(),e=p4(),r=g4(),a=m4(),i=y4();function s(o){var u=-1,f=o==null?0:o.length;for(this.clear();++u<f;){var d=o[u];this.set(d[0],d[1])}}return s.prototype.clear=t,s.prototype.delete=e,s.prototype.get=r,s.prototype.has=a,s.prototype.set=i,jg=s,jg}var Dg,L2;function b4(){if(L2)return Dg;L2=1;var t=q0(),e=Jd(),r=t(e,"Map");return Dg=r,Dg}var Og,z2;function w4(){if(z2)return Og;z2=1;var t=h4(),e=x4(),r=b4();function a(){this.size=0,this.__data__={hash:new t,map:new(r||e),string:new t}}return Og=a,Og}var Mg,_2;function S4(){if(_2)return Mg;_2=1;function t(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}return Mg=t,Mg}var Rg,P2;function sh(){if(P2)return Rg;P2=1;var t=S4();function e(r,a){var i=r.__data__;return t(a)?i[typeof a=="string"?"string":"hash"]:i.map}return Rg=e,Rg}var kg,U2;function E4(){if(U2)return kg;U2=1;var t=sh();function e(r){var a=t(this,r).delete(r);return this.size-=a?1:0,a}return kg=e,kg}var Bg,q2;function T4(){if(q2)return Bg;q2=1;var t=sh();function e(r){return t(this,r).get(r)}return Bg=e,Bg}var Lg,I2;function C4(){if(I2)return Lg;I2=1;var t=sh();function e(r){return t(this,r).has(r)}return Lg=e,Lg}var zg,V2;function N4(){if(V2)return zg;V2=1;var t=sh();function e(r,a){var i=t(this,r),s=i.size;return i.set(r,a),this.size+=i.size==s?0:1,this}return zg=e,zg}var _g,F2;function A4(){if(F2)return _g;F2=1;var t=w4(),e=E4(),r=T4(),a=C4(),i=N4();function s(o){var u=-1,f=o==null?0:o.length;for(this.clear();++u<f;){var d=o[u];this.set(d[0],d[1])}}return s.prototype.clear=t,s.prototype.delete=e,s.prototype.get=r,s.prototype.has=a,s.prototype.set=i,_g=s,_g}var Pg,H2;function j4(){if(H2)return Pg;H2=1;var t=A4(),e="Expected a function";function r(a,i){if(typeof a!="function"||i!=null&&typeof i!="function")throw new TypeError(e);var s=function(){var o=arguments,u=i?i.apply(this,o):o[0],f=s.cache;if(f.has(u))return f.get(u);var d=a.apply(this,o);return s.cache=f.set(u,d)||f,d};return s.cache=new(r.Cache||t),s}return r.Cache=t,Pg=r,Pg}var Ug,G2;function D4(){if(G2)return Ug;G2=1;var t=j4(),e=500;function r(a){var i=t(a,function(o){return s.size===e&&s.clear(),o}),s=i.cache;return i}return Ug=r,Ug}var qg,Q2;function oC(){if(Q2)return qg;Q2=1;var t=D4(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,a=t(function(i){var s=[];return i.charCodeAt(0)===46&&s.push(""),i.replace(e,function(o,u,f,d){s.push(f?d.replace(r,"$1"):u||o)}),s});return qg=a,qg}var Ig,Y2;function uC(){if(Y2)return Ig;Y2=1;function t(e,r){for(var a=-1,i=e==null?0:e.length,s=Array(i);++a<i;)s[a]=r(e[a],a,e);return s}return Ig=t,Ig}var Vg,K2;function O4(){if(K2)return Vg;K2=1;var t=M0(),e=uC(),r=ah(),a=wc(),i=t?t.prototype:void 0,s=i?i.toString:void 0;function o(u){if(typeof u=="string")return u;if(r(u))return e(u,o)+"";if(a(u))return s?s.call(u):"";var f=u+"";return f=="0"&&1/u==-1/0?"-0":f}return Vg=o,Vg}var Fg,X2;function cC(){if(X2)return Fg;X2=1;var t=O4();function e(r){return r==null?"":t(r)}return Fg=e,Fg}var Hg,$2;function fC(){if($2)return Hg;$2=1;var t=ah(),e=t4(),r=oC(),a=cC();function i(s,o){return t(s)?s:e(s,o)?[s]:r(a(s))}return Hg=i,Hg}var Gg,Z2;function I0(){if(Z2)return Gg;Z2=1;var t=wc();function e(r){if(typeof r=="string"||t(r))return r;var a=r+"";return a=="0"&&1/r==-1/0?"-0":a}return Gg=e,Gg}var Qg,W2;function M4(){if(W2)return Qg;W2=1;var t=fC(),e=I0();function r(a,i){i=t(i,a);for(var s=0,o=i.length;a!=null&&s<o;)a=a[e(i[s++])];return s&&s==o?a:void 0}return Qg=r,Qg}var Yg,J2;function R4(){if(J2)return Yg;J2=1;var t=M4();function e(r,a,i){var s=r==null?void 0:t(r,a);return s===void 0?i:s}return Yg=e,Yg}var k4=R4(),B4=xc(k4),Kg,eS;function L4(){if(eS)return Kg;eS=1;var t=q0(),e=(function(){try{var r=t(Object,"defineProperty");return r({},"",{}),r}catch{}})();return Kg=e,Kg}var Xg,tS;function z4(){if(tS)return Xg;tS=1;var t=L4();function e(r,a,i){a=="__proto__"&&t?t(r,a,{configurable:!0,enumerable:!0,value:i,writable:!0}):r[a]=i}return Xg=e,Xg}var $g,rS;function _4(){if(rS)return $g;rS=1;var t=z4(),e=lC(),r=Object.prototype,a=r.hasOwnProperty;function i(s,o,u){var f=s[o];(!(a.call(s,o)&&e(f,u))||u===void 0&&!(o in s))&&t(s,o,u)}return $g=i,$g}var Zg,aS;function P4(){if(aS)return Zg;aS=1;var t=9007199254740991,e=/^(?:0|[1-9]\d*)$/;function r(a,i){var s=typeof a;return i=i??t,!!i&&(s=="number"||s!="symbol"&&e.test(a))&&a>-1&&a%1==0&&a<i}return Zg=r,Zg}var Wg,nS;function U4(){if(nS)return Wg;nS=1;var t=_4(),e=fC(),r=P4(),a=bc(),i=I0();function s(o,u,f,d){if(!a(o))return o;u=e(u,o);for(var h=-1,p=u.length,g=p-1,y=o;y!=null&&++h<p;){var b=i(u[h]),E=f;if(b==="__proto__"||b==="constructor"||b==="prototype")return o;if(h!=g){var S=y[b];E=d?d(S,b,y):void 0,E===void 0&&(E=a(S)?S:r(u[h+1])?[]:{})}t(y,b,E),y=y[b]}return o}return Wg=s,Wg}var Jg,iS;function q4(){if(iS)return Jg;iS=1;var t=U4();function e(r,a,i){return r==null?r:t(r,a,i)}return Jg=e,Jg}var I4=q4(),V4=xc(I4),em,sS;function F4(){if(sS)return em;sS=1;function t(e,r){var a=-1,i=e.length;for(r||(r=Array(i));++a<i;)r[a]=e[a];return r}return em=t,em}var tm,lS;function H4(){if(lS)return tm;lS=1;var t=uC(),e=F4(),r=ah(),a=wc(),i=oC(),s=I0(),o=cC();function u(f){return r(f)?t(f,s):a(f)?[f]:e(i(o(f)))}return tm=u,tm}var G4=H4(),Q4=xc(G4),Y4={data:function(e){var r={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=Ze({},r,e),function(i,s){var o=e,u=this,f=u.length!==void 0,d=f?u:[u],h=f?u[0]:u;if(Xe(i)){var p=i.indexOf(".")!==-1,g=p&&Q4(i);if(o.allowGetting&&s===void 0){var y;return h&&(o.beforeGet(h),g&&h._private[o.field][i]===void 0?y=B4(h._private[o.field],g):y=h._private[o.field][i]),y}else if(o.allowSetting&&s!==void 0){var b=!o.immutableKeys[i];if(b){var E=NT({},i,s);o.beforeSet(u,E);for(var S=0,T=d.length;S<T;S++){var C=d[S];o.canSet(C)&&(g&&h._private[o.field][i]===void 0?V4(C._private[o.field],g,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&&bt(i)){var N=i,j,M,D=Object.keys(N);o.beforeSet(u,N);for(var A=0;A<D.length;A++){j=D[A],M=N[j];var B=!o.immutableKeys[j];if(B)for(var R=0;R<d.length;R++){var L=d[R];o.canSet(L)&&(L._private[o.field][j]=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 P;return h&&(o.beforeGet(h),P=h._private[o.field]),P}return u}},removeData:function(e){var r={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return e=Ze({},r,e),function(i){var s=e,o=this,u=o.length!==void 0,f=u?o:[o];if(Xe(i)){for(var d=i.split(/\s+/),h=d.length,p=0;p<h;p++){var g=d[p];if(!$i(g)){var y=!s.immutableKeys[g];if(y)for(var b=0,E=f.length;b<E;b++)f[b]._private[s.field][g]=void 0}}s.triggerEvent&&o[s.triggerFnName](s.event)}else if(i===void 0){for(var S=0,T=f.length;S<T;S++)for(var C=f[S]._private[s.field],N=Object.keys(C),j=0;j<N.length;j++){var M=N[j],D=!s.immutableKeys[M];D&&(C[M]=void 0)}s.triggerEvent&&o[s.triggerFnName](s.event)}return o}}},K4={eventAliasesOn:function(e){var r=e;r.addListener=r.listen=r.bind=r.on,r.unlisten=r.unbind=r.off=r.removeListener,r.trigger=r.emit,r.pon=r.promiseOn=function(a,i){var s=this,o=Array.prototype.slice.call(arguments,0);return new Oo(function(u,f){var d=function(y){s.off.apply(s,p),u(y)},h=o.concat([d]),p=h.concat([]);s.on.apply(s,h)})}}},Nt={};[e4,Y4,K4].forEach(function(t){Ze(Nt,t)});var X4={animate:Nt.animate(),animation:Nt.animation(),animated:Nt.animated(),clearQueue:Nt.clearQueue(),delay:Nt.delay(),delayAnimation:Nt.delayAnimation(),stop:Nt.stop()},gd={classes:function(e){var r=this;if(e===void 0){var a=[];return r[0]._private.classes.forEach(function(b){return a.push(b)}),a}else Pt(e)||(e=(e||"").match(/\S+/g)||[]);for(var i=[],s=new Do(e),o=0;o<r.length;o++){for(var u=r[o],f=u._private,d=f.classes,h=!1,p=0;p<e.length;p++){var g=e[p],y=d.has(g);if(!y){h=!0;break}}h||(h=d.size!==e.length),h&&(f.classes=s,i.push(u))}return i.length>0&&this.spawn(i).updateStyle().emit("class"),r},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var r=this[0];return r!=null&&r._private.classes.has(e)},toggleClass:function(e,r){Pt(e)||(e=e.match(/\S+/g)||[]);for(var a=this,i=r===void 0,s=[],o=0,u=a.length;o<u;o++)for(var f=a[o],d=f._private.classes,h=!1,p=0;p<e.length;p++){var g=e[p],y=d.has(g),b=!1;r||i&&!y?(d.add(g),b=!0):(!r||i&&y)&&(d.delete(g),b=!0),!h&&b&&(s.push(f),h=!0)}return s.length>0&&this.spawn(s).updateStyle().emit("class"),a},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,r){var a=this;if(r==null)r=250;else if(r===0)return a;return a.addClass(e),setTimeout(function(){a.removeClass(e)},r),a}};gd.className=gd.classNames=gd.classes;var xt={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:br,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};xt.variable="(?:[\\w-.]|(?:\\\\"+xt.metaChar+"))+";xt.className="(?:[\\w-]|(?:\\\\"+xt.metaChar+"))+";xt.value=xt.string+"|"+xt.number;xt.id=xt.variable;(function(){var t,e,r;for(t=xt.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],xt.comparatorOp+="|@"+e;for(t=xt.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],!(e.indexOf("!")>=0)&&e!=="="&&(xt.comparatorOp+="|\\!"+e)})();var zt=function(){return{checks:[]}},Ie={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},Km=[{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 YM(t.selector,e.selector)}),$4=(function(){for(var t={},e,r=0;r<Km.length;r++)e=Km[r],t[e.selector]=e.matches;return t})(),Z4=function(e,r){return $4[e](r)},W4="("+Km.map(function(t){return t.selector}).join("|")+")",Il=function(e){return e.replace(new RegExp("\\\\("+xt.metaChar+")","g"),function(r,a){return a})},Ni=function(e,r,a){e[e.length-1]=a},Xm=[{name:"group",query:!0,regex:"("+xt.group+")",populate:function(e,r,a){var i=pr(a,1),s=i[0];r.checks.push({type:Ie.GROUP,value:s==="*"?s:s+"s"})}},{name:"state",query:!0,regex:W4,populate:function(e,r,a){var i=pr(a,1),s=i[0];r.checks.push({type:Ie.STATE,value:s})}},{name:"id",query:!0,regex:"\\#("+xt.id+")",populate:function(e,r,a){var i=pr(a,1),s=i[0];r.checks.push({type:Ie.ID,value:Il(s)})}},{name:"className",query:!0,regex:"\\.("+xt.className+")",populate:function(e,r,a){var i=pr(a,1),s=i[0];r.checks.push({type:Ie.CLASS,value:Il(s)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+xt.variable+")\\s*\\]",populate:function(e,r,a){var i=pr(a,1),s=i[0];r.checks.push({type:Ie.DATA_EXIST,field:Il(s)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+xt.variable+")\\s*("+xt.comparatorOp+")\\s*("+xt.value+")\\s*\\]",populate:function(e,r,a){var i=pr(a,3),s=i[0],o=i[1],u=i[2],f=new RegExp("^"+xt.string+"$").exec(u)!=null;f?u=u.substring(1,u.length-1):u=parseFloat(u),r.checks.push({type:Ie.DATA_COMPARE,field:Il(s),operator:o,value:u})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+xt.boolOp+")\\s*("+xt.variable+")\\s*\\]",populate:function(e,r,a){var i=pr(a,2),s=i[0],o=i[1];r.checks.push({type:Ie.DATA_BOOL,field:Il(o),operator:s})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+xt.meta+")\\s*("+xt.comparatorOp+")\\s*("+xt.number+")\\s*\\]\\]",populate:function(e,r,a){var i=pr(a,3),s=i[0],o=i[1],u=i[2];r.checks.push({type:Ie.META_COMPARE,field:Il(s),operator:o,value:parseFloat(u)})}},{name:"nextQuery",separator:!0,regex:xt.separator,populate:function(e,r){var a=e.currentSubject,i=e.edgeCount,s=e.compoundCount,o=e[e.length-1];a!=null&&(o.subject=a,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:xt.directedEdge,populate:function(e,r){if(e.currentSubject==null){var a=zt(),i=r,s=zt();return a.checks.push({type:Ie.DIRECTED_EDGE,source:i,target:s}),Ni(e,r,a),e.edgeCount++,s}else{var o=zt(),u=r,f=zt();return o.checks.push({type:Ie.NODE_SOURCE,source:u,target:f}),Ni(e,r,o),e.edgeCount++,f}}},{name:"undirectedEdge",separator:!0,regex:xt.undirectedEdge,populate:function(e,r){if(e.currentSubject==null){var a=zt(),i=r,s=zt();return a.checks.push({type:Ie.UNDIRECTED_EDGE,nodes:[i,s]}),Ni(e,r,a),e.edgeCount++,s}else{var o=zt(),u=r,f=zt();return o.checks.push({type:Ie.NODE_NEIGHBOR,node:u,neighbor:f}),Ni(e,r,o),f}}},{name:"child",separator:!0,regex:xt.child,populate:function(e,r){if(e.currentSubject==null){var a=zt(),i=zt(),s=e[e.length-1];return a.checks.push({type:Ie.CHILD,parent:s,child:i}),Ni(e,r,a),e.compoundCount++,i}else if(e.currentSubject===r){var o=zt(),u=e[e.length-1],f=zt(),d=zt(),h=zt(),p=zt();return o.checks.push({type:Ie.COMPOUND_SPLIT,left:u,right:f,subject:d}),d.checks=r.checks,r.checks=[{type:Ie.TRUE}],p.checks.push({type:Ie.TRUE}),f.checks.push({type:Ie.PARENT,parent:p,child:h}),Ni(e,u,o),e.currentSubject=d,e.compoundCount++,h}else{var g=zt(),y=zt(),b=[{type:Ie.PARENT,parent:g,child:y}];return g.checks=r.checks,r.checks=b,e.compoundCount++,y}}},{name:"descendant",separator:!0,regex:xt.descendant,populate:function(e,r){if(e.currentSubject==null){var a=zt(),i=zt(),s=e[e.length-1];return a.checks.push({type:Ie.DESCENDANT,ancestor:s,descendant:i}),Ni(e,r,a),e.compoundCount++,i}else if(e.currentSubject===r){var o=zt(),u=e[e.length-1],f=zt(),d=zt(),h=zt(),p=zt();return o.checks.push({type:Ie.COMPOUND_SPLIT,left:u,right:f,subject:d}),d.checks=r.checks,r.checks=[{type:Ie.TRUE}],p.checks.push({type:Ie.TRUE}),f.checks.push({type:Ie.ANCESTOR,ancestor:p,descendant:h}),Ni(e,u,o),e.currentSubject=d,e.compoundCount++,h}else{var g=zt(),y=zt(),b=[{type:Ie.ANCESTOR,ancestor:g,descendant:y}];return g.checks=r.checks,r.checks=b,e.compoundCount++,y}}},{name:"subject",modifier:!0,regex:xt.subject,populate:function(e,r){if(e.currentSubject!=null&&e.currentSubject!==r)return At("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=r;var a=e[e.length-1],i=a.checks[0],s=i==null?null:i.type;s===Ie.DIRECTED_EDGE?i.type=Ie.NODE_TARGET:s===Ie.UNDIRECTED_EDGE&&(i.type=Ie.NODE_NEIGHBOR,i.node=i.nodes[1],i.neighbor=i.nodes[0],i.nodes=null)}}];Xm.forEach(function(t){return t.regexObj=new RegExp("^"+t.regex)});var J4=function(e){for(var r,a,i,s=0;s<Xm.length;s++){var o=Xm[s],u=o.name,f=e.match(o.regexObj);if(f!=null){a=f,r=o,i=u;var d=f[0];e=e.substring(d.length);break}}return{expr:r,match:a,name:i,remaining:e}},e3=function(e){var r=e.match(/^\s+/);if(r){var a=r[0];e=e.substring(a.length)}return e},t3=function(e){var r=this,a=r.inputText=e,i=r[0]=zt();for(r.length=1,a=e3(a);;){var s=J4(a);if(s.expr==null)return At("The selector `"+e+"`is invalid"),!1;var o=s.match.slice(1),u=s.expr.populate(r,i,o);if(u===!1)return!1;if(u!=null&&(i=u),a=s.remaining,a.match(/^\s*$/))break}var f=r[r.length-1];r.currentSubject!=null&&(f.subject=r.currentSubject),f.edgeCount=r.edgeCount,f.compoundCount=r.compoundCount;for(var d=0;d<r.length;d++){var h=r[d];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},r3=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(h){return h??""},r=function(h){return Xe(h)?'"'+h+'"':e(h)},a=function(h){return" "+h+" "},i=function(h,p){var g=h.type,y=h.value;switch(g){case Ie.GROUP:{var b=e(y);return b.substring(0,b.length-1)}case Ie.DATA_COMPARE:{var E=h.field,S=h.operator;return"["+E+a(e(S))+r(y)+"]"}case Ie.DATA_BOOL:{var T=h.operator,C=h.field;return"["+e(T)+C+"]"}case Ie.DATA_EXIST:{var N=h.field;return"["+N+"]"}case Ie.META_COMPARE:{var j=h.operator,M=h.field;return"[["+M+a(e(j))+r(y)+"]]"}case Ie.STATE:return y;case Ie.ID:return"#"+y;case Ie.CLASS:return"."+y;case Ie.PARENT:case Ie.CHILD:return s(h.parent,p)+a(">")+s(h.child,p);case Ie.ANCESTOR:case Ie.DESCENDANT:return s(h.ancestor,p)+" "+s(h.descendant,p);case Ie.COMPOUND_SPLIT:{var D=s(h.left,p),A=s(h.subject,p),B=s(h.right,p);return D+(D.length>0?" ":"")+A+B}case Ie.TRUE:return""}},s=function(h,p){return h.checks.reduce(function(g,y,b){return g+(p===h&&b===0?"$":"")+i(y,p)},"")},o="",u=0;u<this.length;u++){var f=this[u];o+=s(f,f.subject),this.length>1&&u<this.length-1&&(o+=", ")}return this.toStringCache=o,o},a3={parse:t3,toString:r3},dC=function(e,r,a){var i,s=Xe(e),o=Oe(e),u=Xe(a),f,d,h=!1,p=!1,g=!1;switch(r.indexOf("!")>=0&&(r=r.replace("!",""),p=!0),r.indexOf("@")>=0&&(r=r.replace("@",""),h=!0),(s||u||h)&&(f=!s&&!o?"":""+e,d=""+a),h&&(e=f=f.toLowerCase(),a=d=d.toLowerCase()),r){case"*=":i=f.indexOf(d)>=0;break;case"$=":i=f.indexOf(d,f.length-d.length)>=0;break;case"^=":i=f.indexOf(d)===0;break;case"=":i=e===a;break;case">":g=!0,i=e>a;break;case">=":g=!0,i=e>=a;break;case"<":g=!0,i=e<a;break;case"<=":g=!0,i=e<=a;break;default:i=!1;break}return p&&(e!=null||!g)&&(i=!i),i},n3=function(e,r){switch(r){case"?":return!!e;case"!":return!e;case"^":return e===void 0}},i3=function(e){return e!==void 0},V0=function(e,r){return e.data(r)},s3=function(e,r){return e[r]()},ar=[],Ft=function(e,r){return e.checks.every(function(a){return ar[a.type](a,r)})};ar[Ie.GROUP]=function(t,e){var r=t.value;return r==="*"||r===e.group()};ar[Ie.STATE]=function(t,e){var r=t.value;return Z4(r,e)};ar[Ie.ID]=function(t,e){var r=t.value;return e.id()===r};ar[Ie.CLASS]=function(t,e){var r=t.value;return e.hasClass(r)};ar[Ie.META_COMPARE]=function(t,e){var r=t.field,a=t.operator,i=t.value;return dC(s3(e,r),a,i)};ar[Ie.DATA_COMPARE]=function(t,e){var r=t.field,a=t.operator,i=t.value;return dC(V0(e,r),a,i)};ar[Ie.DATA_BOOL]=function(t,e){var r=t.field,a=t.operator;return n3(V0(e,r),a)};ar[Ie.DATA_EXIST]=function(t,e){var r=t.field;return t.operator,i3(V0(e,r))};ar[Ie.UNDIRECTED_EDGE]=function(t,e){var r=t.nodes[0],a=t.nodes[1],i=e.source(),s=e.target();return Ft(r,i)&&Ft(a,s)||Ft(a,i)&&Ft(r,s)};ar[Ie.NODE_NEIGHBOR]=function(t,e){return Ft(t.node,e)&&e.neighborhood().some(function(r){return r.isNode()&&Ft(t.neighbor,r)})};ar[Ie.DIRECTED_EDGE]=function(t,e){return Ft(t.source,e.source())&&Ft(t.target,e.target())};ar[Ie.NODE_SOURCE]=function(t,e){return Ft(t.source,e)&&e.outgoers().some(function(r){return r.isNode()&&Ft(t.target,r)})};ar[Ie.NODE_TARGET]=function(t,e){return Ft(t.target,e)&&e.incomers().some(function(r){return r.isNode()&&Ft(t.source,r)})};ar[Ie.CHILD]=function(t,e){return Ft(t.child,e)&&Ft(t.parent,e.parent())};ar[Ie.PARENT]=function(t,e){return Ft(t.parent,e)&&e.children().some(function(r){return Ft(t.child,r)})};ar[Ie.DESCENDANT]=function(t,e){return Ft(t.descendant,e)&&e.ancestors().some(function(r){return Ft(t.ancestor,r)})};ar[Ie.ANCESTOR]=function(t,e){return Ft(t.ancestor,e)&&e.descendants().some(function(r){return Ft(t.descendant,r)})};ar[Ie.COMPOUND_SPLIT]=function(t,e){return Ft(t.subject,e)&&Ft(t.left,e)&&Ft(t.right,e)};ar[Ie.TRUE]=function(){return!0};ar[Ie.COLLECTION]=function(t,e){var r=t.value;return r.has(e)};ar[Ie.FILTER]=function(t,e){var r=t.value;return r(e)};var l3=function(e){var r=this;if(r.length===1&&r[0].checks.length===1&&r[0].checks[0].type===Ie.ID)return e.getElementById(r[0].checks[0].value).collection();var a=function(s){for(var o=0;o<r.length;o++){var u=r[o];if(Ft(u,s))return!0}return!1};return r.text()==null&&(a=function(){return!0}),e.filter(a)},o3=function(e){for(var r=this,a=0;a<r.length;a++){var i=r[a];if(Ft(i,e))return!0}return!1},u3={matches:o3,filter:l3},Ji=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||Xe(e)&&e.match(/^\s*$/)||(Aa(e)?this.addQuery({checks:[{type:Ie.COLLECTION,value:e.collection()}]}):Zt(e)?this.addQuery({checks:[{type:Ie.FILTER,value:e}]}):Xe(e)?this.parse(e)||(this.invalid=!0):Qt("A selector must be created from a string; found "))},es=Ji.prototype;[a3,u3].forEach(function(t){return Ze(es,t)});es.text=function(){return this.inputText};es.size=function(){return this.length};es.eq=function(t){return this[t]};es.sameText=function(t){return!this.invalid&&!t.invalid&&this.text()===t.text()};es.addQuery=function(t){this[this.length++]=t};es.selector=es.toString;var Qi={allAre:function(e){var r=new Ji(e);return this.every(function(a){return r.matches(a)})},is:function(e){var r=new Ji(e);return this.some(function(a){return r.matches(a)})},some:function(e,r){for(var a=0;a<this.length;a++){var i=r?e.apply(r,[this[a],a,this]):e(this[a],a,this);if(i)return!0}return!1},every:function(e,r){for(var a=0;a<this.length;a++){var i=r?e.apply(r,[this[a],a,this]):e(this[a],a,this);if(!i)return!1}return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var r=this.length,a=e.length;return r!==a?!1:r===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(r){return e.hasElementWithId(r.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var r=this.neighborhood();return e.every(function(a){return r.hasElementWithId(a.id())})},contains:function(e){e=this.cy().collection(e);var r=this;return e.every(function(a){return r.hasElementWithId(a.id())})}};Qi.allAreNeighbours=Qi.allAreNeighbors;Qi.has=Qi.contains;Qi.equal=Qi.equals=Qi.same;var Ga=function(e,r){return function(i,s,o,u){var f=i,d=this,h;if(f==null?h="":Aa(f)&&f.length===1&&(h=f.id()),d.length===1&&h){var p=d[0]._private,g=p.traversalCache=p.traversalCache||{},y=g[r]=g[r]||[],b=Ys(h),E=y[b];return E||(y[b]=e.call(d,i,s,o,u))}else return e.call(d,i,s,o,u)}},Co={parent:function(e){var r=[];if(this.length===1){var a=this[0]._private.parent;if(a)return a}for(var i=0;i<this.length;i++){var s=this[i],o=s._private.parent;o&&r.push(o)}return this.spawn(r,!0).filter(e)},parents:function(e){for(var r=[],a=this.parent();a.nonempty();){for(var i=0;i<a.length;i++){var s=a[i];r.push(s)}a=a.parent()}return this.spawn(r,!0).filter(e)},commonAncestors:function(e){for(var r,a=0;a<this.length;a++){var i=this[a],s=i.parents();r=r||s,r=r.intersect(s)}return r.filter(e)},orphans:function(e){return this.stdFilter(function(r){return r.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(r){return r.isChild()}).filter(e)},children:Ga(function(t){for(var e=[],r=0;r<this.length;r++)for(var a=this[r],i=a._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 r=[];function a(i){for(var s=0;s<i.length;s++){var o=i[s];r.push(o),o.children().nonempty()&&a(o.children())}}return a(this.children()),this.spawn(r,!0).filter(e)}};function F0(t,e,r,a){for(var i=[],s=new Do,o=t.cy(),u=o.hasCompoundNodes(),f=0;f<t.length;f++){var d=t[f];r?i.push(d):u&&a(i,s,d)}for(;i.length>0;){var h=i.shift();e(h),s.add(h.id()),u&&a(i,s,h)}return t}function hC(t,e,r){if(r.isParent())for(var a=r._private.children,i=0;i<a.length;i++){var s=a[i];e.has(s.id())||t.push(s)}}Co.forEachDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return F0(this,t,e,hC)};function vC(t,e,r){if(r.isChild()){var a=r._private.parent;e.has(a.id())||t.push(a)}}Co.forEachUp=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return F0(this,t,e,vC)};function c3(t,e,r){vC(t,e,r),hC(t,e,r)}Co.forEachUpAndDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return F0(this,t,e,c3)};Co.ancestors=Co.parents;var Wu,pC;Wu=pC={data:Nt.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:Nt.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Nt.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Nt.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Nt.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Nt.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}};Wu.attr=Wu.data;Wu.removeAttr=Wu.removeData;var f3=pC,lh={};function rm(t){return function(e){var r=this;if(e===void 0&&(e=!0),r.length!==0)if(r.isNode()&&!r.removed()){for(var a=0,i=r[0],s=i._private.edges,o=0;o<s.length;o++){var u=s[o];!e&&u.isLoop()||(a+=t(i,u))}return a}else return}}Ze(lh,{degree:rm(function(t,e){return e.source().same(e.target())?2:1}),indegree:rm(function(t,e){return e.target().same(t)?1:0}),outdegree:rm(function(t,e){return e.source().same(t)?1:0})});function Vl(t,e){return function(r){for(var a,i=this.nodes(),s=0;s<i.length;s++){var o=i[s],u=o[t](r);u!==void 0&&(a===void 0||e(u,a))&&(a=u)}return a}}Ze(lh,{minDegree:Vl("degree",function(t,e){return t<e}),maxDegree:Vl("degree",function(t,e){return t>e}),minIndegree:Vl("indegree",function(t,e){return t<e}),maxIndegree:Vl("indegree",function(t,e){return t>e}),minOutdegree:Vl("outdegree",function(t,e){return t<e}),maxOutdegree:Vl("outdegree",function(t,e){return t>e})});Ze(lh,{totalDegree:function(e){for(var r=0,a=this.nodes(),i=0;i<a.length;i++)r+=a[i].degree(e);return r}});var en,gC,mC=function(e,r,a){for(var i=0;i<e.length;i++){var s=e[i];if(!s.locked()){var o=s._private.position,u={x:r.x!=null?r.x-o.x:0,y:r.y!=null?r.y-o.y:0};s.isParent()&&!(u.x===0&&u.y===0)&&s.children().shift(u,a),s.dirtyBoundingBoxCache()}}},oS={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,r){mC(e,r,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};en=gC={position:Nt.data(oS),silentPosition:Nt.data(Ze({},oS,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,r){mC(e,r,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,r){if(bt(e))r?this.silentPosition(e):this.position(e);else if(Zt(e)){var a=e,i=this.cy();i.startBatch();for(var s=0;s<this.length;s++){var o=this[s],u=void 0;(u=a(o,s))&&(r?o.silentPosition(u):o.position(u))}i.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,r,a){var i;if(bt(e)?(i={x:Oe(e.x)?e.x:0,y:Oe(e.y)?e.y:0},a=r):Xe(e)&&Oe(r)&&(i={x:0,y:0},i[e]=r),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 f=u.position(),d={x:f.x+i.x,y:f.y+i.y};a?u.silentPosition(d):u.position(d)}}s.endBatch()}return this},silentShift:function(e,r){return bt(e)?this.shift(e,!0):Xe(e)&&Oe(r)&&this.shift(e,r,!0),this},renderedPosition:function(e,r){var a=this[0],i=this.cy(),s=i.zoom(),o=i.pan(),u=bt(e)?e:void 0,f=u!==void 0||r!==void 0&&Xe(e);if(a&&a.isNode())if(f)for(var d=0;d<this.length;d++){var h=this[d];r!==void 0?h.position(e,(r-o[e])/s):u!==void 0&&h.position(GT(u,s,o))}else{var p=a.position();return u=th(p,s,o),e===void 0?u:u[e]}else if(!f)return;return this},relativePosition:function(e,r){var a=this[0],i=this.cy(),s=bt(e)?e:void 0,o=s!==void 0||r!==void 0&&Xe(e),u=i.hasCompoundNodes();if(a&&a.isNode())if(o)for(var f=0;f<this.length;f++){var d=this[f],h=u?d.parent():null,p=h&&h.length>0,g=p;p&&(h=h[0]);var y=g?h.position():{x:0,y:0};r!==void 0?d.position(e,r+y[e]):s!==void 0&&d.position({x:s.x+y.x,y:s.y+y.y})}else{var b=a.position(),E=u?a.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:b.x-C.x,y:b.y-C.y},e===void 0?s:s[e]}else if(!o)return;return this}};en.modelPosition=en.point=en.position;en.modelPositions=en.points=en.positions;en.renderedPoint=en.renderedPosition;en.relativePoint=en.relativePosition;var d3=gC,io,ls;io=ls={};ls.renderedBoundingBox=function(t){var e=this.boundingBox(t),r=this.cy(),a=r.zoom(),i=r.pan(),s=e.x1*a+i.x,o=e.x2*a+i.x,u=e.y1*a+i.y,f=e.y2*a+i.y;return{x1:s,x2:o,y1:u,y2:f,w:o-s,h:f-u}};ls.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(r){if(r.isParent()){var a=r._private;a.compoundBoundsClean=!1,a.bbCache=null,t||r.emitAndNotify("bounds")}}),this)};ls.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 r(o){if(!o.isParent())return;var u=o._private,f=o.children(),d=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=f.boundingBox({includeLabels:d,includeOverlays:!1,useCache:!1}),g=u.position;(p.w===0||p.h===0)&&(p={w:o.pstyle("width").pfValue,h:o.pstyle("height").pfValue},p.x1=g.x-p.w/2,p.x2=g.x+p.w/2,p.y1=g.y-p.h/2,p.y2=g.y+p.h/2);function y(R,L,_){var P=0,q=0,F=L+_;return R>0&&F>0&&(P=L/F*R,q=_/F*R),{biasDiff:P,biasComplementDiff:q}}function b(R,L,_,P){if(_.units==="%")switch(P){case"width":return R>0?_.pfValue*R:0;case"height":return L>0?_.pfValue*L:0;case"average":return R>0&&L>0?_.pfValue*(R+L)/2:0;case"min":return R>0&&L>0?R>L?_.pfValue*L:_.pfValue*R:0;case"max":return R>0&&L>0?R>L?_.pfValue*R:_.pfValue*L: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),j=N.biasDiff,M=N.biasComplementDiff,D=y(h.height.val-p.h,T,C),A=D.biasDiff,B=D.biasComplementDiff;u.autoPadding=b(p.w,p.h,o.pstyle("padding"),o.pstyle("padding-relative-to").value),u.autoWidth=Math.max(p.w,h.width.val),g.x=(-j+p.x1+p.x2+M)/2,u.autoHeight=Math.max(p.h,h.height.val),g.y=(-A+p.y1+p.y2+B)/2}for(var a=0;a<this.length;a++){var i=this[a],s=i._private;(!s.compoundBoundsClean||t)&&(r(i),e.batching()||(s.compoundBoundsClean=!0))}return this};var Ha=function(e){return e===1/0||e===-1/0?0:e},Wa=function(e,r,a,i,s){i-r===0||s-a===0||r==null||a==null||i==null||s==null||(e.x1=r<e.x1?r:e.x1,e.x2=i>e.x2?i:e.x2,e.y1=a<e.y1?a:e.y1,e.y2=s>e.y2?s:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},Di=function(e,r){return r==null?e:Wa(e,r.x1,r.y1,r.x2,r.y2)},ju=function(e,r,a){return ha(e,r,a)},td=function(e,r,a){if(!r.cy().headless()){var i=r._private,s=i.rstyle,o=s.arrowWidth/2,u=r.pstyle(a+"-arrow-shape").value,f,d;if(u!=="none"){a==="source"?(f=s.srcX,d=s.srcY):a==="target"?(f=s.tgtX,d=s.tgtY):(f=s.midX,d=s.midY);var h=i.arrowBounds=i.arrowBounds||{},p=h[a]=h[a]||{};p.x1=f-o,p.y1=d-o,p.x2=f+o,p.y2=d+o,p.w=p.x2-p.x1,p.h=p.y2-p.y1,vd(p,1),Wa(e,p.x1,p.y1,p.x2,p.y2)}}},am=function(e,r,a){if(!r.cy().headless()){var i;a?i=a+"-":i="";var s=r._private,o=s.rstyle,u=r.pstyle(i+"label").strValue;if(u){var f=r.pstyle("text-halign"),d=r.pstyle("text-valign"),h=ju(o,"labelWidth",a),p=ju(o,"labelHeight",a),g=ju(o,"labelX",a),y=ju(o,"labelY",a),b=r.pstyle(i+"text-margin-x").pfValue,E=r.pstyle(i+"text-margin-y").pfValue,S=r.isEdge(),T=r.pstyle(i+"text-rotation"),C=r.pstyle("text-outline-width").pfValue,N=r.pstyle("text-border-width").pfValue,j=N/2,M=r.pstyle("text-background-padding").pfValue,D=2,A=p,B=h,R=B/2,L=A/2,_,P,q,F;if(S)_=g-R,P=g+R,q=y-L,F=y+L;else{switch(f.value){case"left":_=g-B,P=g;break;case"center":_=g-R,P=g+R;break;case"right":_=g,P=g+B;break}switch(d.value){case"top":q=y-A,F=y;break;case"center":q=y-L,F=y+L;break;case"bottom":q=y,F=y+A;break}}var Y=b-Math.max(C,j)-M-D,U=b+Math.max(C,j)+M+D,z=E-Math.max(C,j)-M-D,H=E+Math.max(C,j)+M+D;_+=Y,P+=U,q+=z,F+=H;var X=a||"main",K=s.labelBounds,k=K[X]=K[X]||{};k.x1=_,k.y1=q,k.x2=P,k.y2=F,k.w=P-_,k.h=F-q,k.leftPad=Y,k.rightPad=U,k.topPad=z,k.botPad=H;var G=S&&T.strValue==="autorotate",$=T.pfValue!=null&&T.pfValue!==0;if(G||$){var J=G?ju(s.rstyle,"labelAngle",a):T.pfValue,ne=Math.cos(J),ee=Math.sin(J),ae=(_+P)/2,de=(q+F)/2;if(!S){switch(f.value){case"left":ae=P;break;case"right":ae=_;break}switch(d.value){case"top":de=F;break;case"bottom":de=q;break}}var le=function(Ce,ke){return Ce=Ce-ae,ke=ke-de,{x:Ce*ne-ke*ee+ae,y:Ce*ee+ke*ne+de}},re=le(_,q),Z=le(_,F),oe=le(P,q),ve=le(P,F);_=Math.min(re.x,Z.x,oe.x,ve.x),P=Math.max(re.x,Z.x,oe.x,ve.x),q=Math.min(re.y,Z.y,oe.y,ve.y),F=Math.max(re.y,Z.y,oe.y,ve.y)}var Ne=X+"Rot",Me=K[Ne]=K[Ne]||{};Me.x1=_,Me.y1=q,Me.x2=P,Me.y2=F,Me.w=P-_,Me.h=F-q,Wa(e,_,q,P,F),Wa(s.labelBounds.all,_,q,P,F)}return e}},uS=function(e,r){if(!r.cy().headless()){var a=r.pstyle("outline-opacity").value,i=r.pstyle("outline-width").value,s=r.pstyle("outline-offset").value,o=i+s;yC(e,r,a,o,"outside",o/2)}},yC=function(e,r,a,i,s,o){if(!(a===0||i<=0||s==="inside")){var u=r.cy(),f=r.pstyle("shape").value,d=u.renderer().nodeShapes[f],h=r.position(),p=h.x,g=h.y,y=r.width(),b=r.height();if(d.hasMiterBounds){s==="center"&&(i/=2);var E=d.miterBounds(p,g,y,b,i);Di(e,E)}else o!=null&&o>0&&pd(e,[o,o,o,o])}},h3=function(e,r){if(!r.cy().headless()){var a=r.pstyle("border-opacity").value,i=r.pstyle("border-width").pfValue,s=r.pstyle("border-position").value;yC(e,r,a,i,s)}},v3=function(e,r){var a=e._private.cy,i=a.styleEnabled(),s=a.headless(),o=ta(),u=e._private,f=e.isNode(),d=e.isEdge(),h,p,g,y,b,E,S=u.rstyle,T=f&&i?e.pstyle("bounds-expansion").pfValue:[0],C=function(Je){return Je.pstyle("display").value!=="none"},N=!i||C(e)&&(!d||C(e.source())&&C(e.target()));if(N){var j=0,M=0;i&&r.includeOverlays&&(j=e.pstyle("overlay-opacity").value,j!==0&&(M=e.pstyle("overlay-padding").value));var D=0,A=0;i&&r.includeUnderlays&&(D=e.pstyle("underlay-opacity").value,D!==0&&(A=e.pstyle("underlay-padding").value));var B=Math.max(M,A),R=0,L=0;if(i&&(R=e.pstyle("width").pfValue,L=R/2),f&&r.includeNodes){var _=e.position();b=_.x,E=_.y;var P=e.outerWidth(),q=P/2,F=e.outerHeight(),Y=F/2;h=b-q,p=b+q,g=E-Y,y=E+Y,Wa(o,h,g,p,y),i&&uS(o,e),i&&r.includeOutlines&&!s&&uS(o,e),i&&h3(o,e)}else if(d&&r.includeEdges)if(i&&!s){var U=e.pstyle("curve-style").strValue;if(h=Math.min(S.srcX,S.midX,S.tgtX),p=Math.max(S.srcX,S.midX,S.tgtX),g=Math.min(S.srcY,S.midY,S.tgtY),y=Math.max(S.srcY,S.midY,S.tgtY),h-=L,p+=L,g-=L,y+=L,Wa(o,h,g,p,y),U==="haystack"){var z=S.haystackPts;if(z&&z.length===2){if(h=z[0].x,g=z[0].y,p=z[1].x,y=z[1].y,h>p){var H=h;h=p,p=H}if(g>y){var X=g;g=y,y=X}Wa(o,h-L,g-L,p+L,y+L)}}else if(U==="bezier"||U==="unbundled-bezier"||Ii(U,"segments")||Ii(U,"taxi")){var K;switch(U){case"bezier":case"unbundled-bezier":K=S.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":K=S.linePts;break}if(K!=null)for(var k=0;k<K.length;k++){var G=K[k];h=G.x-L,p=G.x+L,g=G.y-L,y=G.y+L,Wa(o,h,g,p,y)}}}else{var $=e.source(),J=$.position(),ne=e.target(),ee=ne.position();if(h=J.x,p=ee.x,g=J.y,y=ee.y,h>p){var ae=h;h=p,p=ae}if(g>y){var de=g;g=y,y=de}h-=L,p+=L,g-=L,y+=L,Wa(o,h,g,p,y)}if(i&&r.includeEdges&&d&&(td(o,e,"mid-source"),td(o,e,"mid-target"),td(o,e,"source"),td(o,e,"target")),i){var le=e.pstyle("ghost").value==="yes";if(le){var re=e.pstyle("ghost-offset-x").pfValue,Z=e.pstyle("ghost-offset-y").pfValue;Wa(o,o.x1+re,o.y1+Z,o.x2+re,o.y2+Z)}}var oe=u.bodyBounds=u.bodyBounds||{};Kw(oe,o),pd(oe,T),vd(oe,1),i&&(h=o.x1,p=o.x2,g=o.y1,y=o.y2,Wa(o,h-B,g-B,p+B,y+B));var ve=u.overlayBounds=u.overlayBounds||{};Kw(ve,o),pd(ve,T),vd(ve,1);var Ne=u.labelBounds=u.labelBounds||{};Ne.all!=null?XR(Ne.all):Ne.all=ta(),i&&r.includeLabels&&(r.includeMainLabels&&am(o,e,null),d&&(r.includeSourceLabels&&am(o,e,"source"),r.includeTargetLabels&&am(o,e,"target")))}return o.x1=Ha(o.x1),o.y1=Ha(o.y1),o.x2=Ha(o.x2),o.y2=Ha(o.y2),o.w=Ha(o.x2-o.x1),o.h=Ha(o.y2-o.y1),o.w>0&&o.h>0&&N&&(pd(o,T),vd(o,1)),o},xC=function(e){var r=0,a=function(o){return(o?1:0)<<r++},i=0;return i+=a(e.incudeNodes),i+=a(e.includeEdges),i+=a(e.includeLabels),i+=a(e.includeMainLabels),i+=a(e.includeSourceLabels),i+=a(e.includeTargetLabels),i+=a(e.includeOverlays),i+=a(e.includeOutlines),i},bC=function(e){var r=function(u){return Math.round(u)};if(e.isEdge()){var a=e.source().position(),i=e.target().position();return Vw([r(a.x),r(a.y),r(i.x),r(i.y)])}else{var s=e.position();return Vw([r(s.x),r(s.y)])}},cS=function(e,r){var a=e._private,i,s=e.isEdge(),o=r==null?fS:xC(r),u=o===fS;if(a.bbCache==null?(i=v3(e,Ju),a.bbCache=i,a.bbCachePosKey=bC(e)):i=a.bbCache,!u){var f=e.isNode();i=ta(),(r.includeNodes&&f||r.includeEdges&&!f)&&(r.includeOverlays?Di(i,a.overlayBounds):Di(i,a.bodyBounds)),r.includeLabels&&(r.includeMainLabels&&(!s||r.includeSourceLabels&&r.includeTargetLabels)?Di(i,a.labelBounds.all):(r.includeMainLabels&&Di(i,a.labelBounds.mainRot),r.includeSourceLabels&&Di(i,a.labelBounds.sourceRot),r.includeTargetLabels&&Di(i,a.labelBounds.targetRot))),i.w=i.x2-i.x1,i.h=i.y2-i.y1}return i},Ju={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},fS=xC(Ju),dS=Ir(Ju);ls.boundingBox=function(t){var e,r=t===void 0||t.useCache===void 0||t.useCache===!0,a=Eo(function(h){var p=h._private;return p.bbCache==null||p.styleDirty||p.bbCachePosKey!==bC(h)},function(h){return h.id()});if(r&&this.length===1&&!a(this[0]))t===void 0?t=Ju:t=dS(t),e=cS(this[0],t);else{e=ta(),t=t||Ju;var i=dS(t),s=this,o=s.cy(),u=o.styleEnabled();this.edges().forEach(a),this.nodes().forEach(a),u&&this.recalculateRenderedStyle(r),this.updateCompoundBounds(!r);for(var f=0;f<s.length;f++){var d=s[f];a(d)&&d.dirtyBoundingBoxCache(),Di(e,cS(d,i))}}return e.x1=Ha(e.x1),e.y1=Ha(e.y1),e.x2=Ha(e.x2),e.y2=Ha(e.y2),e.w=Ha(e.x2-e.x1),e.h=Ha(e.y2-e.y1),e};ls.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};ls.boundingBoxAt=function(t){var e=this.nodes(),r=this.cy(),a=r.hasCompoundNodes(),i=r.collection();if(a&&(i=e.filter(function(d){return d.isParent()}),e=e.not(i)),bt(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};r.startBatch(),e.forEach(o).silentPositions(t),a&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0));var f=KR(this.boundingBox({useCache:!1}));return e.silentPositions(u),a&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0)),r.endBatch(),f};io.boundingbox=io.bb=io.boundingBox;io.renderedBoundingbox=io.renderedBoundingBox;var p3=ls,zu,Tc;zu=Tc={};var wC=function(e){e.uppercaseName=Aw(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=Aw(e.outerName),zu[e.name]=function(){var a=this[0],i=a._private,s=i.cy,o=s._private.styleEnabled;if(a)if(o){if(a.isParent())return a.updateCompoundBounds(),i[e.autoName]||0;var u=a.pstyle(e.name);switch(u.strValue){case"label":return a.recalculateRenderedStyle(),i.rstyle[e.labelName]||0;default:return u.pfValue}}else return 1},zu["outer"+e.uppercaseName]=function(){var a=this[0],i=a._private,s=i.cy,o=s._private.styleEnabled;if(a)if(o){var u=a[e.name](),f=a.pstyle("border-position").value,d;f==="center"?d=a.pstyle("border-width").pfValue:f==="outside"?d=2*a.pstyle("border-width").pfValue:d=0;var h=2*a.padding();return u+d+h}else return 1},zu["rendered"+e.uppercaseName]=function(){var a=this[0];if(a){var i=a[e.name]();return i*this.cy().zoom()}},zu["rendered"+e.uppercaseOuterName]=function(){var a=this[0];if(a){var i=a[e.outerName]();return i*this.cy().zoom()}}};wC({name:"width"});wC({name:"height"});Tc.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};Tc.paddedHeight=function(){var t=this[0];return t.height()+2*t.padding()};Tc.paddedWidth=function(){var t=this[0];return t.width()+2*t.padding()};var g3=Tc,m3=function(e,r){if(e.isEdge()&&e.takesUpSpace())return r(e)},y3=function(e,r){if(e.isEdge()&&e.takesUpSpace()){var a=e.cy();return th(r(e),a.zoom(),a.pan())}},x3=function(e,r){if(e.isEdge()&&e.takesUpSpace()){var a=e.cy(),i=a.pan(),s=a.zoom();return r(e).map(function(o){return th(o,s,i)})}},b3=function(e){return e.renderer().getControlPoints(e)},w3=function(e){return e.renderer().getSegmentPoints(e)},S3=function(e){return e.renderer().getSourceEndpoint(e)},E3=function(e){return e.renderer().getTargetEndpoint(e)},T3=function(e){return e.renderer().getEdgeMidpoint(e)},hS={controlPoints:{get:b3,mult:!0},segmentPoints:{get:w3,mult:!0},sourceEndpoint:{get:S3},targetEndpoint:{get:E3},midpoint:{get:T3}},C3=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)},N3=Object.keys(hS).reduce(function(t,e){var r=hS[e],a=C3(e);return t[e]=function(){return m3(this,r.get)},r.mult?t[a]=function(){return x3(this,r.get)}:t[a]=function(){return y3(this,r.get)},t},{}),A3=Ze({},d3,p3,g3,N3);/*!
|
|
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 SC=function(e,r){this.recycle(e,r)};function Du(){return!1}function rd(){return!0}SC.prototype={instanceString:function(){return"event"},recycle:function(e,r){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=Du,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?rd:Du):e!=null&&e.type?r=e:this.type=e,r!=null&&(this.originalEvent=r.originalEvent,this.type=r.type!=null?r.type:this.type,this.cy=r.cy,this.target=r.target,this.position=r.position,this.renderedPosition=r.renderedPosition,this.namespace=r.namespace,this.layout=r.layout),this.cy!=null&&this.position!=null&&this.renderedPosition==null){var a=this.position,i=this.cy.zoom(),s=this.cy.pan();this.renderedPosition={x:a.x*i+s.x,y:a.y*i+s.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=rd;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=rd;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=rd,this.stopPropagation()},isDefaultPrevented:Du,isPropagationStopped:Du,isImmediatePropagationStopped:Du};var EC=/^([^.]+)(\.(?:[^.]+))?$/,j3=".*",TC={qualifierCompare:function(e,r){return e===r},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},vS=Object.keys(TC),D3={};function oh(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:D3,e=arguments.length>1?arguments[1]:void 0,r=0;r<vS.length;r++){var a=vS[r];this[a]=t[a]||TC[a]}this.context=e||this.context,this.listeners=[],this.emitting=0}var ts=oh.prototype,CC=function(e,r,a,i,s,o,u){Zt(i)&&(s=i,i=null),u&&(o==null?o=u:o=Ze({},o,u));for(var f=Pt(a)?a:a.split(/\s+/),d=0;d<f.length;d++){var h=f[d];if(!$i(h)){var p=h.match(EC);if(p){var g=p[1],y=p[2]?p[2]:null,b=r(e,h,g,y,i,s,o);if(b===!1)break}}}},pS=function(e,r){return e.addEventFields(e.context,r),new SC(r.type,r)},O3=function(e,r,a){if(zM(a)){r(e,a);return}else if(bt(a)){r(e,pS(e,a));return}for(var i=Pt(a)?a:a.split(/\s+/),s=0;s<i.length;s++){var o=i[s];if(!$i(o)){var u=o.match(EC);if(u){var f=u[1],d=u[2]?u[2]:null,h=pS(e,{type:f,namespace:d,target:e.context});r(e,h)}}}};ts.on=ts.addListener=function(t,e,r,a,i){return CC(this,function(s,o,u,f,d,h,p){Zt(h)&&s.listeners.push({event:o,callback:h,type:u,namespace:f,qualifier:d,conf:p})},t,e,r,a,i),this};ts.one=function(t,e,r,a){return this.on(t,e,r,a,{one:!0})};ts.removeListener=ts.off=function(t,e,r,a){var i=this;this.emitting!==0&&(this.listeners=yR(this.listeners));for(var s=this.listeners,o=function(d){var h=s[d];CC(i,function(p,g,y,b,E,S){if((h.type===y||t==="*")&&(!b&&h.namespace!==".*"||h.namespace===b)&&(!E||p.qualifierCompare(h.qualifier,E))&&(!S||h.callback===S))return s.splice(d,1),!1},t,e,r,a)},u=s.length-1;u>=0;u--)o(u);return this};ts.removeAllListeners=function(){return this.removeListener("*")};ts.emit=ts.trigger=function(t,e,r){var a=this.listeners,i=a.length;return this.emitting++,Pt(e)||(e=[e]),O3(this,function(s,o){r!=null&&(a=[{event:o.event,type:o.type,namespace:o.namespace,callback:r}],i=a.length);for(var u=function(){var h=a[f];if(h.type===o.type&&(!h.namespace||h.namespace===o.namespace||h.namespace===j3)&&s.eventMatches(s.context,h,o)){var p=[o];e!=null&&bR(p,e),s.beforeEmit(s.context,h,o),h.conf&&h.conf.one&&(s.listeners=s.listeners.filter(function(b){return b!==h}));var g=s.callbackContext(s.context,h,o),y=h.callback.apply(g,p);s.afterEmit(s.context,h,o),y===!1&&(o.stopPropagation(),o.preventDefault())}},f=0;f<i;f++)u();s.bubble(s.context)&&!o.isPropagationStopped()&&s.parent(s.context).emit(o,e)},t),this.emitting--,this};var M3={qualifierCompare:function(e,r){return e==null||r==null?e==null&&r==null:e.sameText(r)},eventMatches:function(e,r,a){var i=r.qualifier;return i!=null?e!==a.target&&yc(a.target)&&i.matches(a.target):!0},addEventFields:function(e,r){r.cy=e.cy(),r.target=e},callbackContext:function(e,r,a){return r.qualifier!=null?a.target:e},beforeEmit:function(e,r){r.conf&&r.conf.once&&r.conf.onceCollection.removeListener(r.event,r.qualifier,r.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},ad=function(e){return Xe(e)?new Ji(e):e},NC={createEmitter:function(){for(var e=0;e<this.length;e++){var r=this[e],a=r._private;a.emitter||(a.emitter=new oh(M3,r))}return this},emitter:function(){return this._private.emitter},on:function(e,r,a){for(var i=ad(r),s=0;s<this.length;s++){var o=this[s];o.emitter().on(e,i,a)}return this},removeListener:function(e,r,a){for(var i=ad(r),s=0;s<this.length;s++){var o=this[s];o.emitter().removeListener(e,i,a)}return this},removeAllListeners:function(){for(var e=0;e<this.length;e++){var r=this[e];r.emitter().removeAllListeners()}return this},one:function(e,r,a){for(var i=ad(r),s=0;s<this.length;s++){var o=this[s];o.emitter().one(e,i,a)}return this},once:function(e,r,a){for(var i=ad(r),s=0;s<this.length;s++){var o=this[s];o.emitter().on(e,i,a,{once:!0,onceCollection:this})}},emit:function(e,r){for(var a=0;a<this.length;a++){var i=this[a];i.emitter().emit(e,r)}return this},emitAndNotify:function(e,r){if(this.length!==0)return this.cy().notify(e,this),this.emit(e,r),this}};Nt.eventAliasesOn(NC);var AC={nodes:function(e){return this.filter(function(r){return r.isNode()}).filter(e)},edges:function(e){return this.filter(function(r){return r.isEdge()}).filter(e)},byGroup:function(){for(var e=this.spawn(),r=this.spawn(),a=0;a<this.length;a++){var i=this[a];i.isNode()?e.push(i):r.push(i)}return{nodes:e,edges:r}},filter:function(e,r){if(e===void 0)return this;if(Xe(e)||Aa(e))return new Ji(e).filter(this);if(Zt(e)){for(var a=this.spawn(),i=this,s=0;s<i.length;s++){var o=i[s],u=r?e.apply(r,[o,s,i]):e(o,s,i);u&&a.push(o)}return a}return this.spawn()},not:function(e){if(e){Xe(e)&&(e=this.filter(e));for(var r=this.spawn(),a=0;a<this.length;a++){var i=this[a],s=e.has(i);s||r.push(i)}return r}else return this},absoluteComplement:function(){var e=this.cy();return e.mutableElements().not(this)},intersect:function(e){if(Xe(e)){var r=e;return this.filter(r)}for(var a=this.spawn(),i=this,s=e,o=this.length<e.length,u=o?i:s,f=o?s:i,d=0;d<u.length;d++){var h=u[d];f.has(h)&&a.push(h)}return a},xor:function(e){var r=this._private.cy;Xe(e)&&(e=r.$(e));var a=this.spawn(),i=this,s=e,o=function(f,d){for(var h=0;h<f.length;h++){var p=f[h],g=p._private.data.id,y=d.hasElementWithId(g);y||a.push(p)}};return o(i,s),o(s,i),a},diff:function(e){var r=this._private.cy;Xe(e)&&(e=r.$(e));var a=this.spawn(),i=this.spawn(),s=this.spawn(),o=this,u=e,f=function(h,p,g){for(var y=0;y<h.length;y++){var b=h[y],E=b._private.data.id,S=p.hasElementWithId(E);S?s.merge(b):g.push(b)}};return f(o,u,a),f(u,o,i),{left:a,right:i,both:s}},add:function(e){var r=this._private.cy;if(!e)return this;if(Xe(e)){var a=e;e=r.mutableElements().filter(a)}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 r=this._private,a=r.cy;if(!e)return this;if(e&&Xe(e)){var i=e;e=a.mutableElements().filter(i)}for(var s=r.map,o=0;o<e.length;o++){var u=e[o],f=u._private.data.id,d=!s.has(f);if(d){var h=this.length++;this[h]=u,s.set(f,{ele:u,index:h})}}return this},unmergeAt:function(e){var r=this[e],a=r.id(),i=this._private,s=i.map;this[e]=void 0,s.delete(a);var o=e===this.length-1;if(this.length>1&&!o){var u=this.length-1,f=this[u],d=f._private.data.id;this[u]=void 0,this[e]=f,s.set(d,{ele:f,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var r=this._private,a=e._private.data.id,i=r.map,s=i.get(a);if(!s)return this;var o=s.index;return this.unmergeAt(o),this},unmerge:function(e){var r=this._private.cy;if(!e)return this;if(e&&Xe(e)){var a=e;e=r.mutableElements().filter(a)}for(var i=0;i<e.length;i++)this.unmergeOne(e[i]);return this},unmergeBy:function(e){for(var r=this.length-1;r>=0;r--){var a=this[r];e(a)&&this.unmergeAt(r)}return this},map:function(e,r){for(var a=[],i=this,s=0;s<i.length;s++){var o=i[s],u=r?e.apply(r,[o,s,i]):e(o,s,i);a.push(u)}return a},reduce:function(e,r){for(var a=r,i=this,s=0;s<i.length;s++)a=e(a,i[s],s,i);return a},max:function(e,r){for(var a=-1/0,i,s=this,o=0;o<s.length;o++){var u=s[o],f=r?e.apply(r,[u,o,s]):e(u,o,s);f>a&&(a=f,i=u)}return{value:a,ele:i}},min:function(e,r){for(var a=1/0,i,s=this,o=0;o<s.length;o++){var u=s[o],f=r?e.apply(r,[u,o,s]):e(u,o,s);f<a&&(a=f,i=u)}return{value:a,ele:i}}},Tt=AC;Tt.u=Tt["|"]=Tt["+"]=Tt.union=Tt.or=Tt.add;Tt["\\"]=Tt["!"]=Tt["-"]=Tt.difference=Tt.relativeComplement=Tt.subtract=Tt.not;Tt.n=Tt["&"]=Tt["."]=Tt.and=Tt.intersection=Tt.intersect;Tt["^"]=Tt["(+)"]=Tt["(-)"]=Tt.symmetricDifference=Tt.symdiff=Tt.xor;Tt.fnFilter=Tt.filterFn=Tt.stdFilter=Tt.filter;Tt.complement=Tt.abscomp=Tt.absoluteComplement;var R3={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}},jC=function(e,r){var a=e.cy(),i=a.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"?R0:0}var o=s(e)-s(r);if(o!==0)return o;function u(h){var p=h.pstyle("z-index-compare");return p.value==="auto"&&h.isNode()?1:0}var f=u(e)-u(r);if(f!==0)return f;var d=e.pstyle("z-index").value-r.pstyle("z-index").value;return d!==0?d:e.poolIndex()-r.poolIndex()},_d={forEach:function(e,r){if(Zt(e))for(var a=this.length,i=0;i<a;i++){var s=this[i],o=r?e.apply(r,[s,i,this]):e(s,i,this);if(o===!1)break}return this},toArray:function(){for(var e=[],r=0;r<this.length;r++)e.push(this[r]);return e},slice:function(e,r){var a=[],i=this.length;r==null&&(r=i),e==null&&(e=0),e<0&&(e=i+e),r<0&&(r=i+r);for(var s=e;s>=0&&s<r&&s<i;s++)a.push(this[s]);return this.spawn(a)},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 r=this.toArray().sort(e);return this.spawn(r)},sortByZIndex:function(){return this.sort(jC)},zDepth:function(){var e=this[0];if(e){var r=e._private,a=r.group;if(a==="nodes"){var i=r.data.parent?e.parents().size():0;return e.isParent()?i:R0-1}else{var s=r.source,o=r.target,u=s.zDepth(),f=o.zDepth();return Math.max(u,f,0)}}}};_d.each=_d.forEach;var k3=function(){var e="undefined",r=(typeof Symbol>"u"?"undefined":wr(Symbol))!=e&&wr(Symbol.iterator)!=e;r&&(_d[Symbol.iterator]=function(){var a=this,i={value:void 0,done:!1},s=0,o=this.length;return NT({next:function(){return s<o?i.value=a[s++]:(i.value=void 0,i.done=!0),i}},Symbol.iterator,function(){return this})})};k3();var B3=Ir({nodeDimensionsIncludeLabels:!1}),md={layoutDimensions:function(e){e=B3(e);var r;if(!this.takesUpSpace())r={w:0,h:0};else if(e.nodeDimensionsIncludeLabels){var a=this.boundingBox();r={w:a.w,h:a.h}}else r={w:this.outerWidth(),h:this.outerHeight()};return(r.w===0||r.h===0)&&(r.w=r.h=1),r},layoutPositions:function(e,r,a){var i=this.nodes().filter(function(M){return!M.isParent()}),s=this.cy(),o=r.eles,u=function(D){return D.id()},f=Eo(a,u);e.emit({type:"layoutstart",layout:e}),e.animations=[];var d=function(D,A,B){var R={x:A.x1+A.w/2,y:A.y1+A.h/2},L={x:(B.x-R.x)*D,y:(B.y-R.y)*D};return{x:R.x+L.x,y:R.y+L.y}},h=r.spacingFactor&&r.spacingFactor!==1,p=function(){if(!h)return null;for(var D=ta(),A=0;A<i.length;A++){var B=i[A],R=f(B,A);QT(D,R.x,R.y)}return D},g=p(),y=Eo(function(M,D){var A=f(M,D);if(h){var B=Math.abs(r.spacingFactor);A=d(B,g,A)}return r.transform!=null&&(A=r.transform(M,A)),A},u);if(r.animate){for(var b=0;b<i.length;b++){var E=i[b],S=y(E,b),T=r.animateFilter==null||r.animateFilter(E,b);if(T){var C=E.animation({position:S,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(C)}else E.position(S)}if(r.fit){var N=s.animation({fit:{boundingBox:o.boundingBoxAt(y),padding:r.padding},duration:r.animationDuration,easing:r.animationEasing});e.animations.push(N)}else if(r.zoom!==void 0&&r.pan!==void 0){var j=s.animation({zoom:r.zoom,pan:r.pan,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(j)}e.animations.forEach(function(M){return M.play()}),e.one("layoutready",r.ready),e.emit({type:"layoutready",layout:e}),Oo.all(e.animations.map(function(M){return M.promise()})).then(function(){e.one("layoutstop",r.stop),e.emit({type:"layoutstop",layout:e})})}else i.positions(y),r.fit&&s.fit(r.eles,r.padding),r.zoom!=null&&s.zoom(r.zoom),r.pan&&s.pan(r.pan),e.one("layoutready",r.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",r.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){var r=this.cy();return r.makeLayout(Ze({},e,{eles:this}))}};md.createLayout=md.makeLayout=md.layout;function DC(t,e,r){var a=r._private,i=a.styleCache=a.styleCache||[],s;return(s=i[t])!=null||(s=i[t]=e(r)),s}function uh(t,e){return t=Ys(t),function(a){return DC(t,e,a)}}function ch(t,e){t=Ys(t);var r=function(i){return e.call(i)};return function(){var i=this[0];if(i)return DC(t,r,i)}}var Pr={recalculateRenderedStyle:function(e){var r=this.cy(),a=r.renderer(),i=r.styleEnabled();return a&&i&&a.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e=this.cy(),r=function(s){return s._private.styleCache=null};if(e.hasCompoundNodes()){var a;a=this.spawnSelf().merge(this.descendants()).merge(this.parents()),a.merge(a.connectedEdges()),a.forEach(r)}else this.forEach(function(i){r(i),i.connectedEdges().forEach(r)});return this},updateStyle:function(e){var r=this._private.cy;if(!r.styleEnabled())return this;if(r.batching()){var a=r._private.batchStyleEles;return a.merge(this),this}var i=r.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 r=0;r<this.length;r++){var a=this[r];a._private.styleDirty&&(a._private.styleDirty=!1,e.style().apply(a))}},parsedStyle:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,a=this[0],i=a.cy();if(i.styleEnabled()&&a){a._private.styleDirty&&(a._private.styleDirty=!1,i.style().apply(a));var s=a._private.style[e];return s??(r?i.style().getDefaultProperty(e):null)}},numericStyle:function(e){var r=this[0];if(r.cy().styleEnabled()&&r){var a=r.pstyle(e);return a.pfValue!==void 0?a.pfValue:a.value}},numericStyleUnits:function(e){var r=this[0];if(r.cy().styleEnabled()&&r)return r.pstyle(e).units},renderedStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var a=this[0];if(a)return r.style().getRenderedStyle(a,e)},style:function(e,r){var a=this.cy();if(!a.styleEnabled())return this;var i=!1,s=a.style();if(bt(e)){var o=e;s.applyBypass(this,o,i),this.emitAndNotify("style")}else if(Xe(e))if(r===void 0){var u=this[0];return u?s.getStylePropertyValue(u,e):void 0}else s.applyBypass(this,e,r,i),this.emitAndNotify("style");else if(e===void 0){var f=this[0];return f?s.getRawStyle(f):void 0}return this},removeStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var a=!1,i=r.style(),s=this;if(e===void 0)for(var o=0;o<s.length;o++){var u=s[o];i.removeAllBypasses(u,a)}else{e=e.split(/\s+/);for(var f=0;f<s.length;f++){var d=s[f];i.removeBypasses(d,e,a)}}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 r=e.hasCompoundNodes(),a=this[0];if(a){var i=a._private,s=a.pstyle("opacity").value;if(!r)return s;var o=i.data.parent?a.parents():null;if(o)for(var u=0;u<o.length;u++){var f=o[u],d=f.pstyle("opacity").value;s=d*s}return s}},transparent:function(){var e=this.cy();if(!e.styleEnabled())return!1;var r=this[0],a=r.cy().hasCompoundNodes();if(r)return a?r.effectiveOpacity()===0:r.pstyle("opacity").value===0},backgrounding:function(){var e=this.cy();if(!e.styleEnabled())return!1;var r=this[0];return!!r._private.backgrounding}};function nm(t,e){var r=t._private,a=r.data.parent?t.parents():null;if(a)for(var i=0;i<a.length;i++){var s=a[i];if(!e(s))return!1}return!0}function H0(t){var e=t.ok,r=t.edgeOkViaNode||t.ok,a=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||nm(s,a);var f=u.source,d=u.target;return r(f)&&(!o||nm(f,r))&&(f===d||r(d)&&(!o||nm(d,r)))}}}var Mo=uh("eleTakesUpSpace",function(t){return t.pstyle("display").value==="element"&&t.width()!==0&&(t.isNode()?t.height()!==0:!0)});Pr.takesUpSpace=ch("takesUpSpace",H0({ok:Mo}));var L3=uh("eleInteractive",function(t){return t.pstyle("events").value==="yes"&&t.pstyle("visibility").value==="visible"&&Mo(t)}),z3=uh("parentInteractive",function(t){return t.pstyle("visibility").value==="visible"&&Mo(t)});Pr.interactive=ch("interactive",H0({ok:L3,parentOk:z3,edgeOkViaNode:Mo}));Pr.noninteractive=function(){var t=this[0];if(t)return!t.interactive()};var _3=uh("eleVisible",function(t){return t.pstyle("visibility").value==="visible"&&t.pstyle("opacity").pfValue!==0&&Mo(t)}),P3=Mo;Pr.visible=ch("visible",H0({ok:_3,edgeOkViaNode:P3}));Pr.hidden=function(){var t=this[0];if(t)return!t.visible()};Pr.isBundledBezier=ch("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1});Pr.bypass=Pr.css=Pr.style;Pr.renderedCss=Pr.renderedStyle;Pr.removeBypass=Pr.removeCss=Pr.removeStyle;Pr.pstyle=Pr.parsedStyle;var Yi={};function gS(t){return function(){var e=arguments,r=[];if(e.length===2){var a=e[0],i=e[1];this.on(t.event,a,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&&Pt(e[0])){for(var o=e.length===1?e[0]:null,u=0;u<this.length;u++){var f=this[u],d=!t.ableField||f._private[t.ableField],h=f._private[t.field]!=t.value;if(t.overrideAble){var p=t.overrideAble(f);if(p!==void 0&&(d=p,!p))return this}d&&(f._private[t.field]=t.value,h&&r.push(f))}var g=this.spawn(r);g.updateStyle(),g.emit(t.event),o&&g.emit(o)}return this}}function Ro(t){Yi[t.field]=function(){var e=this[0];if(e){if(t.overrideField){var r=t.overrideField(e);if(r!==void 0)return r}return e._private[t.field]}},Yi[t.on]=gS({event:t.on,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!0}),Yi[t.off]=gS({event:t.off,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!1})}Ro({field:"locked",overrideField:function(e){return e.cy().autolock()?!0:void 0},on:"lock",off:"unlock"});Ro({field:"grabbable",overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:"grabify",off:"ungrabify"});Ro({field:"selected",ableField:"selectable",overrideAble:function(e){return e.cy().autounselectify()?!1:void 0},on:"select",off:"unselect"});Ro({field:"selectable",overrideField:function(e){return e.cy().autounselectify()?!1:void 0},on:"selectify",off:"unselectify"});Yi.deselect=Yi.unselect;Yi.grabbed=function(){var t=this[0];if(t)return t._private.grabbed};Ro({field:"active",on:"activate",off:"unactivate"});Ro({field:"pannable",on:"panify",off:"unpanify"});Yi.inactive=function(){var t=this[0];if(t)return!t._private.active};var Kr={},mS=function(e){return function(a){for(var i=this,s=[],o=0;o<i.length;o++){var u=i[o];if(u.isNode()){for(var f=!1,d=u.connectedEdges(),h=0;h<d.length;h++){var p=d[h],g=p.source(),y=p.target();if(e.noIncomingEdges&&y===u&&g!==u||e.noOutgoingEdges&&g===u&&y!==u){f=!0;break}}f||s.push(u)}}return this.spawn(s,!0).filter(a)}},yS=function(e){return function(r){for(var a=this,i=[],s=0;s<a.length;s++){var o=a[s];if(o.isNode())for(var u=o.connectedEdges(),f=0;f<u.length;f++){var d=u[f],h=d.source(),p=d.target();e.outgoing&&h===o?(i.push(d),i.push(p)):e.incoming&&p===o&&(i.push(d),i.push(h))}}return this.spawn(i,!0).filter(r)}},xS=function(e){return function(r){for(var a=this,i=[],s={};;){var o=e.outgoing?a.outgoers():a.incomers();if(o.length===0)break;for(var u=!1,f=0;f<o.length;f++){var d=o[f],h=d.id();s[h]||(s[h]=!0,i.push(d),u=!0)}if(!u)break;a=o}return this.spawn(i,!0).filter(r)}};Kr.clearTraversalCache=function(){for(var t=0;t<this.length;t++)this[t]._private.traversalCache=null};Ze(Kr,{roots:mS({noIncomingEdges:!0}),leaves:mS({noOutgoingEdges:!0}),outgoers:Ga(yS({outgoing:!0}),"outgoers"),successors:xS({outgoing:!0}),incomers:Ga(yS({incoming:!0}),"incomers"),predecessors:xS({})});Ze(Kr,{neighborhood:Ga(function(t){for(var e=[],r=this.nodes(),a=0;a<r.length;a++)for(var i=r[a],s=i.connectedEdges(),o=0;o<s.length;o++){var u=s[o],f=u.source(),d=u.target(),h=i===f?d:f;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)}});Kr.neighbourhood=Kr.neighborhood;Kr.closedNeighbourhood=Kr.closedNeighborhood;Kr.openNeighbourhood=Kr.openNeighborhood;Ze(Kr,{source:Ga(function(e){var r=this[0],a;return r&&(a=r._private.source||r.cy().collection()),a&&e?a.filter(e):a},"source"),target:Ga(function(e){var r=this[0],a;return r&&(a=r._private.target||r.cy().collection()),a&&e?a.filter(e):a},"target"),sources:bS({attr:"source"}),targets:bS({attr:"target"})});function bS(t){return function(r){for(var a=[],i=0;i<this.length;i++){var s=this[i],o=s._private[t.attr];o&&a.push(o)}return this.spawn(a,!0).filter(r)}}Ze(Kr,{edgesWith:Ga(wS(),"edgesWith"),edgesTo:Ga(wS({thisIsSrc:!0}),"edgesTo")});function wS(t){return function(r){var a=[],i=this._private.cy,s=t||{};Xe(r)&&(r=i.$(r));for(var o=0;o<r.length;o++)for(var u=r[o]._private.edges,f=0;f<u.length;f++){var d=u[f],h=d._private.data,p=this.hasElementWithId(h.source)&&r.hasElementWithId(h.target),g=r.hasElementWithId(h.source)&&this.hasElementWithId(h.target),y=p||g;y&&((s.thisIsSrc||s.thisIsTgt)&&(s.thisIsSrc&&!p||s.thisIsTgt&&!g)||a.push(d))}return this.spawn(a,!0)}}Ze(Kr,{connectedEdges:Ga(function(t){for(var e=[],r=this,a=0;a<r.length;a++){var i=r[a];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:Ga(function(t){for(var e=[],r=this,a=0;a<r.length;a++){var i=r[a];i.isEdge()&&(e.push(i.source()[0]),e.push(i.target()[0]))}return this.spawn(e,!0).filter(t)},"connectedNodes"),parallelEdges:Ga(SS(),"parallelEdges"),codirectedEdges:Ga(SS({codirected:!0}),"codirectedEdges")});function SS(t){var e={codirected:!1};return t=Ze({},e,t),function(a){for(var i=[],s=this.edges(),o=t,u=0;u<s.length;u++)for(var f=s[u],d=f._private,h=d.source,p=h._private.data.id,g=d.data.target,y=h._private.edges,b=0;b<y.length;b++){var E=y[b],S=E._private.data,T=S.target,C=S.source,N=T===g&&C===p,j=p===T&&g===C;(o.codirected&&N||!o.codirected&&(N||j))&&i.push(E)}return this.spawn(i,!0).filter(a)}}Ze(Kr,{components:function(e){var r=this,a=r.cy(),i=a.collection(),s=e==null?r.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 r.spawn();var f=function(){var h=a.collection();o.push(h);var p=s[0];u(p,h),r.bfs({directed:!1,roots:p,visit:function(y){return u(y,h)}}),h.forEach(function(g){g.connectedEdges().forEach(function(y){r.has(y)&&h.has(y.source())&&h.has(y.target())&&h.merge(y)})})};do f();while(s.length>0);return o},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}});Kr.componentsOf=Kr.components;var Ur=function(e,r){var a=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 Gn,o=!1;if(!r)r=[];else if(r.length>0&&bt(r[0])&&!yc(r[0])){o=!0;for(var u=[],f=new Do,d=0,h=r.length;d<h;d++){var p=r[d];p.data==null&&(p.data={});var g=p.data;if(g.id==null)g.id=FT();else if(e.hasElementWithId(g.id)||f.has(g.id))continue;var y=new eh(e,p,!1);u.push(y),f.add(g.id)}r=u}this.length=0;for(var b=0,E=r.length;b<E;b++){var S=r[b][0];if(S!=null){var T=S._private.data.id;(!a||!s.has(T))&&(a&&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 Gn,j=this.eles,M=0;M<j.length;M++){var D=j[M];N.set(D.id(),{index:M,ele:D})}}},a&&(this._private.map=s),o&&!i&&this.restore()},qt=eh.prototype=Ur.prototype=Object.create(Array.prototype);qt.instanceString=function(){return"collection"};qt.spawn=function(t,e){return new Ur(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 DT(this)?this:new Ur(this._private.cy,[this])};qt.unique=function(){return new Ur(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,r=this._private.map.get(t);return r?r.ele:new Ur(e)};qt.$id=qt.getElementById;qt.poolIndex=function(){var t=this._private.cy,e=t._private.elements,r=this[0]._private.data.id;return e._private.map.get(r).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(),r=this.cy();if(e==null&&t)return this;if(e!=null){var a=e._private;if(bt(t)){if(r.startBatch(),t.data){e.data(t.data);var i=a.data;if(e.isEdge()){var s=!1,o={},u=t.data.source,f=t.data.target;u!=null&&u!=i.source&&(o.source=""+u,s=!0),f!=null&&f!=i.target&&(o.target=""+f,s=!0),s&&(e=e.move(o))}else{var d="parent"in t.data,h=t.data.parent;d&&(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!==a[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),r.endBatch(),this}else if(t===void 0){var g={data:gn(a.data),position:gn(a.position),group:a.group,removed:a.removed,selected:a.selected,selectable:a.selectable,locked:a.locked,grabbable:a.grabbable,pannable:a.pannable,classes:null};g.classes="";var y=0;return a.classes.forEach(function(b){return g.classes+=y++===0?b:" "+b}),g}}};qt.jsons=function(){for(var t=[],e=0;e<this.length;e++){var r=this[e],a=r.json();t.push(a)}return t};qt.clone=function(){for(var t=this.cy(),e=[],r=0;r<this.length;r++){var a=this[r],i=a.json(),s=new eh(t,i,!1);e.push(s)}return new Ur(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,r=this,a=r.cy(),i=a._private,s=[],o=[],u,f=0,d=r.length;f<d;f++){var h=r[f];e&&!h.removed()||(h.isNode()?s.push(h):o.push(h))}u=s.concat(o);var p,g=function(){u.splice(p,1),p--};for(p=0;p<u.length;p++){var y=u[p],b=y._private,E=b.data;if(y.clearTraversalCache(),!(!e&&!b.removed)){if(E.id===void 0)E.id=FT();else if(Oe(E.id))E.id=""+E.id;else if($i(E.id)||!Xe(E.id)){Qt("Can not create element with invalid string ID `"+E.id+"`"),g();continue}else if(a.hasElementWithId(E.id)){Qt("Can not create second element with ID `"+E.id+"`"),g();continue}}var S=E.id;if(y.isNode()){var T=b.position;T.x==null&&(T.x=0),T.y==null&&(T.y=0)}if(y.isEdge()){for(var C=y,N=["source","target"],j=N.length,M=!1,D=0;D<j;D++){var A=N[D],B=E[A];Oe(B)&&(B=E[A]=""+E[A]),B==null||B===""?(Qt("Can not create edge `"+S+"` with unspecified "+A),M=!0):a.hasElementWithId(B)||(Qt("Can not create edge `"+S+"` with nonexistant "+A+" `"+B+"`"),M=!0)}if(M){g();continue}var R=a.getElementById(E.source),L=a.getElementById(E.target);R.same(L)?R._private.edges.push(C):(R._private.edges.push(C),L._private.edges.push(C)),C._private.source=R,C._private.target=L}b.map=new Gn,b.map.set(S,{ele:y,index:0}),b.removed=!1,e&&a.addToPool(y)}for(var _=0;_<s.length;_++){var P=s[_],q=P._private.data;Oe(q.parent)&&(q.parent=""+q.parent);var F=q.parent,Y=F!=null;if(Y||P._private.parent){var U=P._private.parent?a.collection().merge(P._private.parent):a.getElementById(F);if(U.empty())q.parent=void 0;else if(U[0].removed())At("Node added with missing parent, reference to parent removed"),q.parent=void 0,P._private.parent=null;else{for(var z=!1,H=U;!H.empty();){if(P.same(H)){z=!0,q.parent=void 0;break}H=H.parent()}z||(U[0]._private.children.push(P),P._private.parent=U[0],i.hasCompoundNodes=!0)}}}if(u.length>0){for(var X=u.length===r.length?r:new Ur(a,u),K=0;K<X.length;K++){var k=X[K];k.isNode()||(k.parallelEdges().clearTraversalCache(),k.source().clearTraversalCache(),k.target().clearTraversalCache())}var G;i.hasCompoundNodes?G=a.collection().merge(X).merge(X.connectedNodes()).merge(X.parent()):G=X,G.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(t),t?X.emitAndNotify("add"):e&&X.emit("add")}return r};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,r=this,a=[],i={},s=r._private.cy;function o(F){for(var Y=F._private.edges,U=0;U<Y.length;U++)f(Y[U])}function u(F){for(var Y=F._private.children,U=0;U<Y.length;U++)f(Y[U])}function f(F){var Y=i[F.id()];e&&F.removed()||Y||(i[F.id()]=!0,F.isNode()?(a.push(F),o(F),u(F)):a.unshift(F))}for(var d=0,h=r.length;d<h;d++){var p=r[d];f(p)}function g(F,Y){var U=F._private.edges;Zi(U,Y),F.clearTraversalCache()}function y(F){F.clearTraversalCache()}var b=[];b.ids={};function E(F,Y){Y=Y[0],F=F[0];var U=F._private.children,z=F.id();Zi(U,Y),Y._private.parent=null,b.ids[z]||(b.ids[z]=!0,b.push(F))}r.dirtyCompoundBoundsCache(),e&&s.removeFromPool(a);for(var S=0;S<a.length;S++){var T=a[S];if(T.isEdge()){var C=T.source()[0],N=T.target()[0];g(C,T),g(N,T);for(var j=T.parallelEdges(),M=0;M<j.length;M++){var D=j[M];y(D),D.isBundledBezier()&&D.dirtyBoundingBoxCache()}}else{var A=T.parent();A.length!==0&&E(A,T)}e&&(T._private.removed=!0)}var B=s._private.elements;s._private.hasCompoundNodes=!1;for(var R=0;R<B.length;R++){var L=B[R];if(L.isParent()){s._private.hasCompoundNodes=!0;break}}var _=new Ur(this.cy(),a);_.size()>0&&(t?_.emitAndNotify("remove"):e&&_.emit("remove"));for(var P=0;P<b.length;P++){var q=b[P];(!e||!q.removed())&&q.updateStyle()}return _};qt.move=function(t){var e=this._private.cy,r=this,a=!1,i=!1,s=function(b){return b==null?b:""+b};if(t.source!==void 0||t.target!==void 0){var o=s(t.source),u=s(t.target),f=o!=null&&e.hasElementWithId(o),d=u!=null&&e.hasElementWithId(u);(f||d)&&(e.batch(function(){r.remove(a,i),r.emitAndNotify("moveout");for(var y=0;y<r.length;y++){var b=r[y],E=b._private.data;b.isEdge()&&(f&&(E.source=o),d&&(E.target=u))}r.restore(a,i)}),r.emitAndNotify("move"))}else if(t.parent!==void 0){var h=s(t.parent),p=h===null||e.hasElementWithId(h);if(p){var g=h===null?void 0:h;e.batch(function(){var y=r.remove(a,i);y.emitAndNotify("moveout");for(var b=0;b<r.length;b++){var E=r[b],S=E._private.data;E.isNode()&&(S.parent=g)}y.restore(a,i)}),r.emitAndNotify("move")}}return this};[tC,X4,gd,Qi,Co,f3,lh,A3,NC,AC,R3,_d,md,Pr,Yi,Kr].forEach(function(t){Ze(qt,t)});var U3={add:function(e){var r,a=this;if(Aa(e)){var i=e;if(i._private.cy===a)r=i.restore();else{for(var s=[],o=0;o<i.length;o++){var u=i[o];s.push(u.json())}r=new Ur(a,s)}}else if(Pt(e)){var f=e;r=new Ur(a,f)}else if(bt(e)&&(Pt(e.nodes)||Pt(e.edges))){for(var d=e,h=[],p=["nodes","edges"],g=0,y=p.length;g<y;g++){var b=p[g],E=d[b];if(Pt(E))for(var S=0,T=E.length;S<T;S++){var C=Ze({group:b},E[S]);h.push(C)}}r=new Ur(a,h)}else{var N=e;r=new eh(a,N).collection()}return r},remove:function(e){if(!Aa(e)){if(Xe(e)){var r=e;e=this.$(r)}}return e.remove()}};/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */function q3(t,e,r,a){var i=4,s=.001,o=1e-7,u=10,f=11,d=1/(f-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),r=Math.min(r,1),t=Math.max(t,0),r=Math.max(r,0);var g=h?new Float32Array(f):new Array(f);function y(L,_){return 1-3*_+3*L}function b(L,_){return 3*_-6*L}function E(L){return 3*L}function S(L,_,P){return((y(_,P)*L+b(_,P))*L+E(_))*L}function T(L,_,P){return 3*y(_,P)*L*L+2*b(_,P)*L+E(_)}function C(L,_){for(var P=0;P<i;++P){var q=T(_,t,r);if(q===0)return _;var F=S(_,t,r)-L;_-=F/q}return _}function N(){for(var L=0;L<f;++L)g[L]=S(L*d,t,r)}function j(L,_,P){var q,F,Y=0;do F=_+(P-_)/2,q=S(F,t,r)-L,q>0?P=F:_=F;while(Math.abs(q)>o&&++Y<u);return F}function M(L){for(var _=0,P=1,q=f-1;P!==q&&g[P]<=L;++P)_+=d;--P;var F=(L-g[P])/(g[P+1]-g[P]),Y=_+F*d,U=T(Y,t,r);return U>=s?C(L,Y):U===0?Y:j(L,_,_+d)}var D=!1;function A(){D=!0,(t!==e||r!==a)&&N()}var B=function(_){return D||A(),t===e&&r===a?_:_===0?0:_===1?1:S(M(_),e,a)};B.getControlPoints=function(){return[{x:t,y:e},{x:r,y:a}]};var R="generateBezier("+[t,e,r,a]+")";return B.toString=function(){return R},B}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var I3=(function(){function t(a){return-a.tension*a.x-a.friction*a.v}function e(a,i,s){var o={x:a.x+s.dx*i,v:a.v+s.dv*i,tension:a.tension,friction:a.friction};return{dx:o.v,dv:t(o)}}function r(a,i){var s={dx:a.v,dv:t(a)},o=e(a,i*.5,s),u=e(a,i*.5,o),f=e(a,i,u),d=1/6*(s.dx+2*(o.dx+u.dx)+f.dx),h=1/6*(s.dv+2*(o.dv+u.dv)+f.dv);return a.x=a.x+d*i,a.v=a.v+h*i,a}return function a(i,s,o){var u={x:-1,v:0,tension:null,friction:null},f=[0],d=0,h=1/1e4,p=16/1e3,g,y,b;for(i=parseFloat(i)||500,s=parseFloat(s)||20,o=o||null,u.tension=i,u.friction=s,g=o!==null,g?(d=a(i,s),y=d/o*p):y=p;b=r(b||u,y),f.push(1+b.x),d+=16,Math.abs(b.x)>h&&Math.abs(b.v)>h;);return g?function(E){return f[E*(f.length-1)|0]}:d}})(),Ut=function(e,r,a,i){var s=q3(e,r,a,i);return function(o,u,f){return o+(u-o)*s(f)}},yd={linear:function(e,r,a){return e+(r-e)*a},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,r,a){if(a===0)return yd.linear;var i=I3(e,r,a);return function(s,o,u){return s+(o-s)*i(u)}},"cubic-bezier":Ut};function ES(t,e,r,a,i){if(a===1||e===r)return r;var s=i(e,r,a);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 TS(t,e){return t.pfValue!=null||t.value!=null?t.pfValue!=null&&(e==null||e.type.units!=="%")?t.pfValue:t.value:t}function Fl(t,e,r,a,i){var s=i!=null?i.type:null;r<0?r=0:r>1&&(r=1);var o=TS(t,i),u=TS(e,i);if(Oe(o)&&Oe(u))return ES(s,o,u,r,a);if(Pt(o)&&Pt(u)){for(var f=[],d=0;d<u.length;d++){var h=o[d],p=u[d];if(h!=null&&p!=null){var g=ES(s,h,p,r,a);f.push(g)}else f.push(p)}return f}}function V3(t,e,r,a){var i=!a,s=t._private,o=e._private,u=o.easing,f=o.startTime,d=a?t:t.cy(),h=d.style();if(!o.easingImpl)if(u==null)o.easingImpl=yd.linear;else{var p;if(Xe(u)){var g=h.parse("transition-timing-function",u);p=g.value}else p=u;var y,b;Xe(p)?(y=p,b=[]):(y=p[1],b=p.slice(2).map(function(X){return+X})),b.length>0?(y==="spring"&&b.push(o.duration),o.easingImpl=yd[y].apply(null,b)):o.easingImpl=yd[y]}var E=o.easingImpl,S;if(o.duration===0?S=1:S=(r-f)/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={};Ou(T.x,C.x)&&(N.x=Fl(T.x,C.x,S,E)),Ou(T.y,C.y)&&(N.y=Fl(T.y,C.y,S,E)),t.position(N)}var j=o.startPan,M=o.pan,D=s.pan,A=M!=null&&a;A&&(Ou(j.x,M.x)&&(D.x=Fl(j.x,M.x,S,E)),Ou(j.y,M.y)&&(D.y=Fl(j.y,M.y,S,E)),t.emit("pan"));var B=o.startZoom,R=o.zoom,L=R!=null&&a;L&&(Ou(B,R)&&(s.zoom=$u(s.minZoom,Fl(B,R,S,E),s.maxZoom)),t.emit("zoom")),(A||L)&&t.emit("viewport");var _=o.style;if(_&&_.length>0&&i){for(var P=0;P<_.length;P++){var q=_[P],F=q.name,Y=q,U=o.startStyle[F],z=h.properties[U.name],H=Fl(U,Y,S,E,z);h.overrideBypass(t,F,H)}t.emit("style")}}return o.progress=S,S}function Ou(t,e){return t==null||e==null?!1:Oe(t)&&Oe(e)?!0:!!(t&&e)}function F3(t,e,r,a){var i=e._private;i.started=!0,i.startTime=r-i.progress*i.duration}function CS(t,e){var r=e._private.aniEles,a=[];function i(h,p){var g=h._private,y=g.animation.current,b=g.animation.queue,E=!1;if(y.length===0){var S=b.shift();S&&y.push(S)}for(var T=function(D){for(var A=D.length-1;A>=0;A--){var B=D[A];B()}D.splice(0,D.length)},C=y.length-1;C>=0;C--){var N=y[C],j=N._private;if(j.stopped){y.splice(C,1),j.hooked=!1,j.playing=!1,j.started=!1,T(j.frames);continue}!j.playing&&!j.applying||(j.playing&&j.applying&&(j.applying=!1),j.started||F3(h,N,t),V3(h,N,t,p),j.applying&&(j.applying=!1),T(j.frames),j.step!=null&&j.step(t),N.completed()&&(y.splice(C,1),j.hooked=!1,j.playing=!1,j.started=!1,T(j.completes)),E=!0)}return!p&&y.length===0&&b.length===0&&a.push(h),E}for(var s=!1,o=0;o<r.length;o++){var u=r[o],f=i(u);s=s||f}var d=i(e,!0);(s||d)&&(r.length>0?e.notify("draw",r):e.notify("draw")),r.unmerge(a),e.emit("step")}var H3={animate:Nt.animate(),animation:Nt.animation(),animated:Nt.animated(),clearQueue:Nt.clearQueue(),delay:Nt.delay(),delayAnimation:Nt.delayAnimation(),stop:Nt.stop(),addToAnimationPool:function(e){var r=this;r.styleEnabled()&&r._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function r(){e._private.animationsRunning&&Rd(function(s){CS(s,e),r()})}var a=e.renderer();a&&a.beforeRender?a.beforeRender(function(s,o){CS(o,e)},a.beforeRenderPriorities.animations):r()}},G3={qualifierCompare:function(e,r){return e==null||r==null?e==null&&r==null:e.sameText(r)},eventMatches:function(e,r,a){var i=r.qualifier;return i!=null?e!==a.target&&yc(a.target)&&i.matches(a.target):!0},addEventFields:function(e,r){r.cy=e,r.target=e},callbackContext:function(e,r,a){return r.qualifier!=null?a.target:e}},nd=function(e){return Xe(e)?new Ji(e):e},OC={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new oh(G3,this)),this},emitter:function(){return this._private.emitter},on:function(e,r,a){return this.emitter().on(e,nd(r),a),this},removeListener:function(e,r,a){return this.emitter().removeListener(e,nd(r),a),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,r,a){return this.emitter().one(e,nd(r),a),this},once:function(e,r,a){return this.emitter().one(e,nd(r),a),this},emit:function(e,r){return this.emitter().emit(e,r),this},emitAndNotify:function(e,r){return this.emit(e),this.notify(e,r),this}};Nt.eventAliasesOn(OC);var $m={png:function(e){var r=this._private.renderer;return e=e||{},r.png(e)},jpg:function(e){var r=this._private.renderer;return e=e||{},e.bg=e.bg||"#fff",r.jpg(e)}};$m.jpeg=$m.jpg;var xd={layout:function(e){var r=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 a=e.name,i=r.extension("layout",a);if(i==null){Qt("No such layout `"+a+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var s;Xe(e.eles)?s=r.$(e.eles):s=e.eles!=null?e.eles:r.$();var o=new i(Ze({},e,{cy:r,eles:s}));return o}};xd.createLayout=xd.makeLayout=xd.layout;var Q3={notify:function(e,r){var a=this._private;if(this.batching()){a.batchNotifications=a.batchNotifications||{};var i=a.batchNotifications[e]=a.batchNotifications[e]||this.collection();r!=null&&i.merge(r);return}if(a.notificationsEnabled){var s=this.renderer();this.destroyed()||!s||s.notify(e,r)}},notifications:function(e){var r=this._private;return e===void 0?r.notificationsEnabled:(r.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 r=this.renderer();Object.keys(e.batchNotifications).forEach(function(a){var i=e.batchNotifications[a];i.empty()?r.notify(a):r.notify(a,i)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var r=this;return this.batch(function(){for(var a=Object.keys(e),i=0;i<a.length;i++){var s=a[i],o=e[s],u=r.getElementById(s);u.data(o)}})}},Y3=Ir({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]}),Zm={renderTo:function(e,r,a,i){var s=this._private.renderer;return s.renderTo(e,r,a,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 r=this,a=r.extension("renderer",e.name);if(a==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=Y3(e);i.cy=r,r._private.renderer=new a(i),this.notify("init")},destroyRenderer:function(){var e=this;e.notify("destroy");var r=e.container();if(r)for(r._cyreg=null;r.childNodes.length>0;)r.removeChild(r.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(a){var i=a._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)}};Zm.invalidateDimensions=Zm.resize;var bd={collection:function(e,r){return Xe(e)?this.$(e):Aa(e)?e.collection():Pt(e)?(r||(r={}),new Ur(this,e,r.unique,r.removed)):new Ur(this)},nodes:function(e){var r=this.$(function(a){return a.isNode()});return e?r.filter(e):r},edges:function(e){var r=this.$(function(a){return a.isEdge()});return e?r.filter(e):r},$:function(e){var r=this._private.elements;return e?r.filter(e):r.spawnSelf()},mutableElements:function(){return this._private.elements}};bd.elements=bd.filter=bd.$;var Rr={},Uu="t",K3="f";Rr.apply=function(t){for(var e=this,r=e._private,a=r.cy,i=a.collection(),s=0;s<t.length;s++){var o=t[s],u=e.getContextMeta(o);if(!u.empty){var f=e.getContextStyle(u),d=e.applyContextStyle(u,f,o);o._private.appliedInitStyle?e.updateTransitions(o,d.diffProps):o._private.appliedInitStyle=!0;var h=e.updateStyleHints(o);h&&i.push(o)}}return i};Rr.getPropertiesDiff=function(t,e){var r=this,a=r._private.propDiffs=r._private.propDiffs||{},i=t+"-"+e,s=a[i];if(s)return s;for(var o=[],u={},f=0;f<r.length;f++){var d=r[f],h=t[f]===Uu,p=e[f]===Uu,g=h!==p,y=d.mappedProperties.length>0;if(g||p&&y){var b=void 0;g&&y||g?b=d.properties:y&&(b=d.mappedProperties);for(var E=0;E<b.length;E++){for(var S=b[E],T=S.name,C=!1,N=f+1;N<r.length;N++){var j=r[N],M=e[N]===Uu;if(M&&(C=j.properties[S.name]!=null,C))break}!u[T]&&!C&&(u[T]=!0,o.push(T))}}}return a[i]=o,o};Rr.getContextMeta=function(t){for(var e=this,r="",a,i=t._private.styleCxtKey||"",s=0;s<e.length;s++){var o=e[s],u=o.selector&&o.selector.matches(t);u?r+=Uu:r+=K3}return a=e.getPropertiesDiff(i,r),t._private.styleCxtKey=r,{key:r,diffPropNames:a,empty:a.length===0}};Rr.getContextStyle=function(t){var e=t.key,r=this,a=this._private.contextStyles=this._private.contextStyles||{};if(a[e])return a[e];for(var i={_private:{key:e}},s=0;s<r.length;s++){var o=r[s],u=e[s]===Uu;if(u)for(var f=0;f<o.properties.length;f++){var d=o.properties[f];i[d.name]=d}}return a[e]=i,i};Rr.applyContextStyle=function(t,e,r){for(var a=this,i=t.diffPropNames,s={},o=a.types,u=0;u<i.length;u++){var f=i[u],d=e[f],h=r.pstyle(f);if(!d)if(h)h.bypass?d={name:f,deleteBypassed:!0}:d={name:f,delete:!0};else continue;if(h!==d){if(d.mapped===o.fn&&h!=null&&h.mapping!=null&&h.mapping.value===d.value){var p=h.mapping,g=p.fnValue=d.value(r);if(g===p.prevFnValue)continue}var y=s[f]={prev:h};a.applyParsedProperty(r,d),y.next=r.pstyle(f),y.next&&y.next.bypass&&(y.next=y.next.bypassed)}}return{diffProps:s}};Rr.updateStyleHints=function(t){var e=t._private,r=this,a=r.propertyGroupNames,i=r.propertyGroupKeys,s=function(oe,ve,Ne){return r.getPropertiesHash(oe,ve,Ne)},o=e.styleKey;if(t.removed())return!1;var u=e.group==="nodes",f=t._private.style;a=Object.keys(f);for(var d=0;d<i.length;d++){var h=i[d];e.styleKeys[h]=[Rs,$l]}for(var p=function(oe,ve){return e.styleKeys[ve][0]=Yu(oe,e.styleKeys[ve][0])},g=function(oe,ve){return e.styleKeys[ve][1]=Ku(oe,e.styleKeys[ve][1])},y=function(oe,ve){p(oe,ve),g(oe,ve)},b=function(oe,ve){for(var Ne=0;Ne<oe.length;Ne++){var Me=oe.charCodeAt(Ne);p(Me,ve),g(Me,ve)}},E=2e9,S=function(oe){return-128<oe&&oe<128&&Math.floor(oe)!==oe?E-(oe*1024|0):oe},T=0;T<a.length;T++){var C=a[T],N=f[C];if(N!=null){var j=this.properties[C],M=j.type,D=j.groupKey,A=void 0;j.hashOverride!=null?A=j.hashOverride(t,N):N.pfValue!=null&&(A=N.pfValue);var B=j.enums==null?N.value:null,R=A!=null,L=B!=null,_=R||L,P=N.units;if(M.number&&_&&!M.multiple){var q=R?A:B;y(S(q),D),!R&&P!=null&&b(P,D)}else b(N.strValue,D)}}for(var F=[Rs,$l],Y=0;Y<i.length;Y++){var U=i[Y],z=e.styleKeys[U];F[0]=Yu(z[0],F[0]),F[1]=Ku(z[1],F[1])}e.styleKey=cR(F[0],F[1]);var H=e.styleKeys;e.labelDimsKey=Ci(H.labelDimensions);var X=s(t,["label"],H.labelDimensions);if(e.labelKey=Ci(X),e.labelStyleKey=Ci($f(H.commonLabel,X)),!u){var K=s(t,["source-label"],H.labelDimensions);e.sourceLabelKey=Ci(K),e.sourceLabelStyleKey=Ci($f(H.commonLabel,K));var k=s(t,["target-label"],H.labelDimensions);e.targetLabelKey=Ci(k),e.targetLabelStyleKey=Ci($f(H.commonLabel,k))}if(u){var G=e.styleKeys,$=G.nodeBody,J=G.nodeBorder,ne=G.nodeOutline,ee=G.backgroundImage,ae=G.compound,de=G.pie,le=G.stripe,re=[$,J,ne,ee,ae,de,le].filter(function(Z){return Z!=null}).reduce($f,[Rs,$l]);e.nodeKey=Ci(re),e.hasPie=de!=null&&de[0]!==Rs&&de[1]!==$l,e.hasStripe=le!=null&&le[0]!==Rs&&le[1]!==$l}return o!==e.styleKey};Rr.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};Rr.applyParsedProperty=function(t,e){var r=this,a=e,i=t._private.style,s,o=r.types,u=r.properties[a.name].type,f=a.bypass,d=i[a.name],h=d&&d.bypass,p=t._private,g="mapping",y=function($){return $==null?null:$.pfValue!=null?$.pfValue:$.value},b=function(){var $=y(d),J=y(a);r.checkTriggers(t,a.name,$,J)};if(e.name==="curve-style"&&t.isEdge()&&(e.value!=="bezier"&&t.isLoop()||e.value==="haystack"&&(t.source().isParent()||t.target().isParent()))&&(a=e=this.parse(e.name,"bezier",f)),a.delete)return i[a.name]=void 0,b(),!0;if(a.deleteBypassed)return d?d.bypass?(d.bypassed=void 0,b(),!0):!1:(b(),!0);if(a.deleteBypass)return d?d.bypass?(i[a.name]=d.bypassed,b(),!0):!1:(b(),!0);var E=function(){At("Do not assign mappings to elements without corresponding data (i.e. ele `"+t.id()+"` has no mapping for property `"+a.name+"` with data field `"+a.field+"`); try a `["+a.field+"]` selector to limit scope to elements with `"+a.field+"` defined")};switch(a.mapped){case o.mapData:{for(var S=a.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 j;if(Oe(T)){var M=a.fieldMax-a.fieldMin;M===0?j=0:j=(T-a.fieldMin)/M}else return At("Do not use continuous mappers without specifying numeric data (i.e. `"+a.field+": "+T+"` for `"+t.id()+"` is non-numeric)"),!1;if(j<0?j=0:j>1&&(j=1),u.color){var D=a.valueMin[0],A=a.valueMax[0],B=a.valueMin[1],R=a.valueMax[1],L=a.valueMin[2],_=a.valueMax[2],P=a.valueMin[3]==null?1:a.valueMin[3],q=a.valueMax[3]==null?1:a.valueMax[3],F=[Math.round(D+(A-D)*j),Math.round(B+(R-B)*j),Math.round(L+(_-L)*j),Math.round(P+(q-P)*j)];s={bypass:a.bypass,name:a.name,value:F,strValue:"rgb("+F[0]+", "+F[1]+", "+F[2]+")"}}else if(u.number){var Y=a.valueMin+(a.valueMax-a.valueMin)*j;s=this.parse(a.name,Y,a.bypass,g)}else return!1;if(!s)return E(),!1;s.mapping=a,a=s;break}case o.data:{for(var U=a.field.split("."),z=p.data,H=0;H<U.length&&z;H++){var X=U[H];z=z[X]}if(z!=null&&(s=this.parse(a.name,z,a.bypass,g)),!s)return E(),!1;s.mapping=a,a=s;break}case o.fn:{var K=a.value,k=a.fnValue!=null?a.fnValue:K(t);if(a.prevFnValue=k,k==null)return At("Custom function mappers may not return null (i.e. `"+a.name+"` for ele `"+t.id()+"` is null)"),!1;if(s=this.parse(a.name,k,a.bypass,g),!s)return At("Custom function mappers may not return invalid values for the property type (i.e. `"+a.name+"` for ele `"+t.id()+"` is invalid)"),!1;s.mapping=gn(a),a=s;break}case void 0:break;default:return!1}return f?(h?a.bypassed=d.bypassed:a.bypassed=d,i[a.name]=a):h?d.bypassed=a:i[a.name]=a,b(),!0};Rr.cleanElements=function(t,e){for(var r=0;r<t.length;r++){var a=t[r];if(this.clearStyleHints(a),a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),!e)a._private.style={};else for(var i=a._private.style,s=Object.keys(i),o=0;o<s.length;o++){var u=s[o],f=i[u];f!=null&&(f.bypass?f.bypassed=null:i[u]=null)}}};Rr.update=function(){var t=this._private.cy,e=t.mutableElements();e.updateStyle()};Rr.updateTransitions=function(t,e){var r=this,a=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={},f=!1,d=0;d<i.length;d++){var h=i[d],p=t.pstyle(h),g=e[h];if(g){var y=g.prev,b=y,E=g.next!=null?g.next:p,S=!1,T=void 0,C=1e-6;b&&(Oe(b.pfValue)&&Oe(E.pfValue)?(S=E.pfValue-b.pfValue,T=b.pfValue+C*S):Oe(b.value)&&Oe(E.value)?(S=E.value-b.value,T=b.value+C*S):Pt(b.value)&&Pt(E.value)&&(S=b.value[0]!==E.value[0]||b.value[1]!==E.value[1]||b.value[2]!==E.value[2],T=b.strValue),S&&(u[h]=E.strValue,this.applyBypass(t,h,T),f=!0))}}if(!f)return;a.transitioning=!0,new Oo(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(){r.removeBypasses(t,i),t.emitAndNotify("style"),a.transitioning=!1})}else a.transitioning&&(this.removeBypasses(t,i),t.emitAndNotify("style"),a.transitioning=!1)};Rr.checkTrigger=function(t,e,r,a,i,s){var o=this.properties[e],u=i(o);t.removed()||u!=null&&u(r,a,t)&&s(o)};Rr.checkZOrderTrigger=function(t,e,r,a){var i=this;this.checkTrigger(t,e,r,a,function(s){return s.triggersZOrder},function(){i._private.cy.notify("zorder",t)})};Rr.checkBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(i){return i.triggersBounds},function(i){t.dirtyCompoundBoundsCache(),t.dirtyBoundingBoxCache()})};Rr.checkConnectedEdgesBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(i){return i.triggersBoundsOfConnectedEdges},function(i){t.connectedEdges().forEach(function(s){s.dirtyBoundingBoxCache()})})};Rr.checkParallelEdgesBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(i){return i.triggersBoundsOfParallelEdges},function(i){t.parallelEdges().forEach(function(s){s.dirtyBoundingBoxCache()})})};Rr.checkTriggers=function(t,e,r,a){t.dirtyStyleCache(),this.checkZOrderTrigger(t,e,r,a),this.checkBoundsTrigger(t,e,r,a),this.checkConnectedEdgesBoundsTrigger(t,e,r,a),this.checkParallelEdgesBoundsTrigger(t,e,r,a)};var Cc={};Cc.applyBypass=function(t,e,r,a){var i=this,s=[],o=!0;if(e==="*"||e==="**"){if(r!==void 0)for(var u=0;u<i.properties.length;u++){var f=i.properties[u],d=f.name,h=this.parse(d,r,!0);h&&s.push(h)}}else if(Xe(e)){var p=this.parse(e,r,!0);p&&s.push(p)}else if(bt(e)){var g=e;a=r;for(var y=Object.keys(g),b=0;b<y.length;b++){var E=y[b],S=g[E];if(S===void 0&&(S=g[Wd(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 j=t[N],M={},D=void 0,A=0;A<s.length;A++){var B=s[A];if(a){var R=j.pstyle(B.name);D=M[B.name]={prev:R}}C=this.applyParsedProperty(j,gn(B))||C,a&&(D.next=j.pstyle(B.name))}C&&this.updateStyleHints(j),a&&this.updateTransitions(j,M,o)}return C};Cc.overrideBypass=function(t,e,r){e=O0(e);for(var a=0;a<t.length;a++){var i=t[a],s=i._private.style[e],o=this.properties[e].type,u=o.color,f=o.mutiple,d=s?s.pfValue!=null?s.pfValue:s.value:null;!s||!s.bypass?this.applyBypass(i,e,r):(s.value=r,s.pfValue!=null&&(s.pfValue=r),u?s.strValue="rgb("+r.join(",")+")":f?s.strValue=r.join(" "):s.strValue=""+r,this.updateStyleHints(i)),this.checkTriggers(i,e,d,r)}};Cc.removeAllBypasses=function(t,e){return this.removeBypasses(t,this.propertyNames,e)};Cc.removeBypasses=function(t,e,r){for(var a=!0,i=0;i<t.length;i++){for(var s=t[i],o={},u=0;u<e.length;u++){var f=e[u],d=this.properties[f],h=s.pstyle(d.name);if(!(!h||!h.bypass)){var p="",g=this.parse(f,p,!0),y=o[d.name]={prev:h};this.applyParsedProperty(s,g),y.next=s.pstyle(d.name)}}this.updateStyleHints(s),r&&this.updateTransitions(s,o,a)}};var G0={};G0.getEmSizeInPixels=function(){var t=this.containerCss("font-size");return t!=null?parseFloat(t):1};G0.containerCss=function(t){var e=this._private.cy,r=e.container(),a=e.window();if(a&&r&&a.getComputedStyle)return a.getComputedStyle(r).getPropertyValue(t)};var mn={};mn.getRenderedStyle=function(t,e){return e?this.getStylePropertyValue(t,e,!0):this.getRawStyle(t,!0)};mn.getRawStyle=function(t,e){var r=this;if(t=t[0],t){for(var a={},i=0;i<r.properties.length;i++){var s=r.properties[i],o=r.getStylePropertyValue(t,s.name,e);o!=null&&(a[s.name]=o,a[Wd(s.name)]=o)}return a}};mn.getIndexedStyle=function(t,e,r,a){var i=t.pstyle(e)[r][a];return i??t.cy().style().getDefaultProperty(e)[r][0]};mn.getStylePropertyValue=function(t,e,r){var a=this;if(t=t[0],t){var i=a.properties[e];i.alias&&(i=i.pointsTo);var s=i.type,o=t.pstyle(i.name);if(o){var u=o.value,f=o.units,d=o.strValue;if(r&&s.number&&u!=null&&Oe(u)){var h=t.cy().zoom(),p=function(S){return S*h},g=function(S,T){return p(S)+T},y=Pt(u),b=y?f.every(function(E){return E!=null}):f!=null;return b?y?u.map(function(E,S){return g(E,f[S])}).join(" "):g(u,f):y?u.map(function(E){return Xe(E)?E:""+p(E)}).join(" "):""+p(u)}else if(d!=null)return d}return null}};mn.getAnimationStartStyle=function(t,e){for(var r={},a=0;a<e.length;a++){var i=e[a],s=i.name,o=t.pstyle(s);o!==void 0&&(bt(o)?o=this.parse(s,o.strValue):o=this.parse(s,o)),o&&(r[s]=o)}return r};mn.getPropsList=function(t){var e=this,r=[],a=t,i=e.properties;if(a)for(var s=Object.keys(a),o=0;o<s.length;o++){var u=s[o],f=a[u],d=i[u]||i[O0(u)],h=this.parse(d.name,f);h&&r.push(h)}return r};mn.getNonDefaultPropertiesHash=function(t,e,r){var a=r.slice(),i,s,o,u,f,d;for(f=0;f<e.length;f++)if(i=e[f],s=t.pstyle(i,!1),s!=null)if(s.pfValue!=null)a[0]=Yu(u,a[0]),a[1]=Ku(u,a[1]);else for(o=s.strValue,d=0;d<o.length;d++)u=o.charCodeAt(d),a[0]=Yu(u,a[0]),a[1]=Ku(u,a[1]);return a};mn.getPropertiesHash=mn.getNonDefaultPropertiesHash;var fh={};fh.appendFromJson=function(t){for(var e=this,r=0;r<t.length;r++){var a=t[r],i=a.selector,s=a.style||a.css,o=Object.keys(s);e.selector(i);for(var u=0;u<o.length;u++){var f=o[u],d=s[f];e.css(f,d)}}return e};fh.fromJson=function(t){var e=this;return e.resetToDefault(),e.appendFromJson(t),e};fh.json=function(){for(var t=[],e=this.defaultLength;e<this.length;e++){for(var r=this[e],a=r.selector,i=r.properties,s={},o=0;o<i.length;o++){var u=i[o];s[u.name]=u.strValue}t.push({selector:a?a.toString():"core",style:s})}return t};var Q0={};Q0.appendFromString=function(t){var e=this,r=this,a=""+t,i,s,o;a=a.replace(/[/][*](\s|.)+?[*][/]/g,"");function u(){a.length>i.length?a=a.substr(i.length):a=""}function f(){s.length>o.length?s=s.substr(o.length):s=""}for(;;){var d=a.match(/^\s*$/);if(d)break;var h=a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!h){At("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+a);break}i=h[0];var p=h[1];if(p!=="core"){var g=new Ji(p);if(g.invalid){At("Skipping parsing of block: Invalid selector found in string stylesheet: "+p),u();continue}}var y=h[2],b=!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),b=!0;break}o=T[0];var C=T[1],N=T[2],j=e.properties[C];if(!j){At("Skipping property: Invalid property name in: "+o),f();continue}var M=r.parse(C,N);if(!M){At("Skipping property: Invalid property definition in: "+o),f();continue}E.push({name:C,val:N}),f()}if(b){u();break}r.selector(p);for(var D=0;D<E.length;D++){var A=E[D];r.css(A.name,A.val)}u()}return r};Q0.fromString=function(t){var e=this;return e.resetToDefault(),e.appendFromString(t),e};var vr={};(function(){var t=br,e=VM,r=HM,a=GM,i=QM,s=function(Z){return"^"+Z+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},o=function(Z){var oe=t+"|\\w+|"+e+"|"+r+"|"+a+"|"+i;return"^"+Z+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+t+")\\s*\\,\\s*("+t+")\\s*,\\s*("+oe+")\\s*\\,\\s*("+oe+")\\)$"},u=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];vr.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(Z,oe){switch(Z.length){case 2:return oe[0]!=="deg"&&oe[0]!=="rad"&&oe[1]!=="deg"&&oe[1]!=="rad";case 1:return Xe(Z[0])||oe[0]==="deg"||oe[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(Z){var oe=Z.length;return oe===1||oe===2||oe===4}}};var f={zeroNonZero:function(Z,oe){return(Z==null||oe==null)&&Z!==oe||Z==0&&oe!=0?!0:Z!=0&&oe==0},any:function(Z,oe){return Z!=oe},emptyNonEmpty:function(Z,oe){var ve=$i(Z),Ne=$i(oe);return ve&&!Ne||!ve&&Ne}},d=vr.types,h=[{name:"label",type:d.text,triggersBounds:f.any,triggersZOrder:f.emptyNonEmpty},{name:"text-rotation",type:d.textRotation,triggersBounds:f.any},{name:"text-margin-x",type:d.bidirectionalSize,triggersBounds:f.any},{name:"text-margin-y",type:d.bidirectionalSize,triggersBounds:f.any}],p=[{name:"source-label",type:d.text,triggersBounds:f.any},{name:"source-text-rotation",type:d.textRotation,triggersBounds:f.any},{name:"source-text-margin-x",type:d.bidirectionalSize,triggersBounds:f.any},{name:"source-text-margin-y",type:d.bidirectionalSize,triggersBounds:f.any},{name:"source-text-offset",type:d.size,triggersBounds:f.any}],g=[{name:"target-label",type:d.text,triggersBounds:f.any},{name:"target-text-rotation",type:d.textRotation,triggersBounds:f.any},{name:"target-text-margin-x",type:d.bidirectionalSize,triggersBounds:f.any},{name:"target-text-margin-y",type:d.bidirectionalSize,triggersBounds:f.any},{name:"target-text-offset",type:d.size,triggersBounds:f.any}],y=[{name:"font-family",type:d.fontFamily,triggersBounds:f.any},{name:"font-style",type:d.fontStyle,triggersBounds:f.any},{name:"font-weight",type:d.fontWeight,triggersBounds:f.any},{name:"font-size",type:d.size,triggersBounds:f.any},{name:"text-transform",type:d.textTransform,triggersBounds:f.any},{name:"text-wrap",type:d.textWrap,triggersBounds:f.any},{name:"text-overflow-wrap",type:d.textOverflowWrap,triggersBounds:f.any},{name:"text-max-width",type:d.size,triggersBounds:f.any},{name:"text-outline-width",type:d.size,triggersBounds:f.any},{name:"line-height",type:d.positiveNumber,triggersBounds:f.any}],b=[{name:"text-valign",type:d.valign,triggersBounds:f.any},{name:"text-halign",type:d.halign,triggersBounds:f.any},{name:"color",type:d.color},{name:"text-outline-color",type:d.color},{name:"text-outline-opacity",type:d.zeroOneNumber},{name:"text-background-color",type:d.color},{name:"text-background-opacity",type:d.zeroOneNumber},{name:"text-background-padding",type:d.size,triggersBounds:f.any},{name:"text-border-opacity",type:d.zeroOneNumber},{name:"text-border-color",type:d.color},{name:"text-border-width",type:d.size,triggersBounds:f.any},{name:"text-border-style",type:d.borderStyle,triggersBounds:f.any},{name:"text-background-shape",type:d.textBackgroundShape,triggersBounds:f.any},{name:"text-justification",type:d.justification},{name:"box-select-labels",type:d.bool,triggersBounds:f.any}],E=[{name:"events",type:d.bool,triggersZOrder:f.any},{name:"text-events",type:d.bool,triggersZOrder:f.any},{name:"box-selection",type:d.boxSelection,triggersZOrder:f.any}],S=[{name:"display",type:d.display,triggersZOrder:f.any,triggersBounds:f.any,triggersBoundsOfConnectedEdges:f.any,triggersBoundsOfParallelEdges:function(Z,oe,ve){return Z===oe?!1:ve.pstyle("curve-style").value==="bezier"}},{name:"visibility",type:d.visibility,triggersZOrder:f.any},{name:"opacity",type:d.zeroOneNumber,triggersZOrder:f.zeroNonZero},{name:"text-opacity",type:d.zeroOneNumber},{name:"min-zoomed-font-size",type:d.size},{name:"z-compound-depth",type:d.zCompoundDepth,triggersZOrder:f.any},{name:"z-index-compare",type:d.zIndexCompare,triggersZOrder:f.any},{name:"z-index",type:d.number,triggersZOrder:f.any}],T=[{name:"overlay-padding",type:d.size,triggersBounds:f.any},{name:"overlay-color",type:d.color},{name:"overlay-opacity",type:d.zeroOneNumber,triggersBounds:f.zeroNonZero},{name:"overlay-shape",type:d.overlayShape,triggersBounds:f.any},{name:"overlay-corner-radius",type:d.cornerRadius}],C=[{name:"underlay-padding",type:d.size,triggersBounds:f.any},{name:"underlay-color",type:d.color},{name:"underlay-opacity",type:d.zeroOneNumber,triggersBounds:f.zeroNonZero},{name:"underlay-shape",type:d.overlayShape,triggersBounds:f.any},{name:"underlay-corner-radius",type:d.cornerRadius}],N=[{name:"transition-property",type:d.propList},{name:"transition-duration",type:d.time},{name:"transition-delay",type:d.time},{name:"transition-timing-function",type:d.easing}],j=function(Z,oe){return oe.value==="label"?-Z.poolIndex():oe.pfValue},M=[{name:"height",type:d.nodeSize,triggersBounds:f.any,hashOverride:j},{name:"width",type:d.nodeSize,triggersBounds:f.any,hashOverride:j},{name:"shape",type:d.nodeShape,triggersBounds:f.any},{name:"shape-polygon-points",type:d.polygonPointList,triggersBounds:f.any},{name:"corner-radius",type:d.cornerRadius},{name:"background-color",type:d.color},{name:"background-fill",type:d.fill},{name:"background-opacity",type:d.zeroOneNumber},{name:"background-blacken",type:d.nOneOneNumber},{name:"background-gradient-stop-colors",type:d.colors},{name:"background-gradient-stop-positions",type:d.percentages},{name:"background-gradient-direction",type:d.gradientDirection},{name:"padding",type:d.sizeMaybePercent,triggersBounds:f.any},{name:"padding-relative-to",type:d.paddingRelativeTo,triggersBounds:f.any},{name:"bounds-expansion",type:d.boundsExpansion,triggersBounds:f.any}],D=[{name:"border-color",type:d.color},{name:"border-opacity",type:d.zeroOneNumber},{name:"border-width",type:d.size,triggersBounds:f.any},{name:"border-style",type:d.borderStyle},{name:"border-cap",type:d.lineCap},{name:"border-join",type:d.lineJoin},{name:"border-dash-pattern",type:d.numbers},{name:"border-dash-offset",type:d.number},{name:"border-position",type:d.linePosition}],A=[{name:"outline-color",type:d.color},{name:"outline-opacity",type:d.zeroOneNumber},{name:"outline-width",type:d.size,triggersBounds:f.any},{name:"outline-style",type:d.borderStyle},{name:"outline-offset",type:d.size,triggersBounds:f.any}],B=[{name:"background-image",type:d.urls},{name:"background-image-crossorigin",type:d.bgCrossOrigin},{name:"background-image-opacity",type:d.zeroOneNumbers},{name:"background-image-containment",type:d.bgContainment},{name:"background-image-smoothing",type:d.bools},{name:"background-position-x",type:d.bgPos},{name:"background-position-y",type:d.bgPos},{name:"background-width-relative-to",type:d.bgRelativeTo},{name:"background-height-relative-to",type:d.bgRelativeTo},{name:"background-repeat",type:d.bgRepeat},{name:"background-fit",type:d.bgFit},{name:"background-clip",type:d.bgClip},{name:"background-width",type:d.bgWH},{name:"background-height",type:d.bgWH},{name:"background-offset-x",type:d.bgPos},{name:"background-offset-y",type:d.bgPos}],R=[{name:"position",type:d.position,triggersBounds:f.any},{name:"compound-sizing-wrt-labels",type:d.compoundIncludeLabels,triggersBounds:f.any},{name:"min-width",type:d.size,triggersBounds:f.any},{name:"min-width-bias-left",type:d.sizeMaybePercent,triggersBounds:f.any},{name:"min-width-bias-right",type:d.sizeMaybePercent,triggersBounds:f.any},{name:"min-height",type:d.size,triggersBounds:f.any},{name:"min-height-bias-top",type:d.sizeMaybePercent,triggersBounds:f.any},{name:"min-height-bias-bottom",type:d.sizeMaybePercent,triggersBounds:f.any}],L=[{name:"line-style",type:d.lineStyle},{name:"line-color",type:d.color},{name:"line-fill",type:d.fill},{name:"line-cap",type:d.lineCap},{name:"line-opacity",type:d.zeroOneNumber},{name:"line-dash-pattern",type:d.numbers},{name:"line-dash-offset",type:d.number},{name:"line-outline-width",type:d.size},{name:"line-outline-color",type:d.color},{name:"line-gradient-stop-colors",type:d.colors},{name:"line-gradient-stop-positions",type:d.percentages},{name:"curve-style",type:d.curveStyle,triggersBounds:f.any,triggersBoundsOfParallelEdges:function(Z,oe){return Z===oe?!1:Z==="bezier"||oe==="bezier"}},{name:"haystack-radius",type:d.zeroOneNumber,triggersBounds:f.any},{name:"source-endpoint",type:d.edgeEndpoint,triggersBounds:f.any},{name:"target-endpoint",type:d.edgeEndpoint,triggersBounds:f.any},{name:"control-point-step-size",type:d.size,triggersBounds:f.any},{name:"control-point-distances",type:d.bidirectionalSizes,triggersBounds:f.any},{name:"control-point-weights",type:d.numbers,triggersBounds:f.any},{name:"segment-distances",type:d.bidirectionalSizes,triggersBounds:f.any},{name:"segment-weights",type:d.numbers,triggersBounds:f.any},{name:"segment-radii",type:d.numbers,triggersBounds:f.any},{name:"radius-type",type:d.radiusType,triggersBounds:f.any},{name:"taxi-turn",type:d.bidirectionalSizeMaybePercent,triggersBounds:f.any},{name:"taxi-turn-min-distance",type:d.size,triggersBounds:f.any},{name:"taxi-direction",type:d.axisDirection,triggersBounds:f.any},{name:"taxi-radius",type:d.number,triggersBounds:f.any},{name:"edge-distances",type:d.edgeDistances,triggersBounds:f.any},{name:"arrow-scale",type:d.positiveNumber,triggersBounds:f.any},{name:"loop-direction",type:d.angle,triggersBounds:f.any},{name:"loop-sweep",type:d.angle,triggersBounds:f.any},{name:"source-distance-from-node",type:d.size,triggersBounds:f.any},{name:"target-distance-from-node",type:d.size,triggersBounds:f.any}],_=[{name:"ghost",type:d.bool,triggersBounds:f.any},{name:"ghost-offset-x",type:d.bidirectionalSize,triggersBounds:f.any},{name:"ghost-offset-y",type:d.bidirectionalSize,triggersBounds:f.any},{name:"ghost-opacity",type:d.zeroOneNumber}],P=[{name:"selection-box-color",type:d.color},{name:"selection-box-opacity",type:d.zeroOneNumber},{name:"selection-box-border-color",type:d.color},{name:"selection-box-border-width",type:d.size},{name:"active-bg-color",type:d.color},{name:"active-bg-opacity",type:d.zeroOneNumber},{name:"active-bg-size",type:d.size},{name:"outside-texture-bg-color",type:d.color},{name:"outside-texture-bg-opacity",type:d.zeroOneNumber}],q=[];vr.pieBackgroundN=16,q.push({name:"pie-size",type:d.sizeMaybePercent}),q.push({name:"pie-hole",type:d.sizeMaybePercent}),q.push({name:"pie-start-angle",type:d.angle});for(var F=1;F<=vr.pieBackgroundN;F++)q.push({name:"pie-"+F+"-background-color",type:d.color}),q.push({name:"pie-"+F+"-background-size",type:d.percent}),q.push({name:"pie-"+F+"-background-opacity",type:d.zeroOneNumber});var Y=[];vr.stripeBackgroundN=16,Y.push({name:"stripe-size",type:d.sizeMaybePercent}),Y.push({name:"stripe-direction",type:d.axisDirectionPrimary});for(var U=1;U<=vr.stripeBackgroundN;U++)Y.push({name:"stripe-"+U+"-background-color",type:d.color}),Y.push({name:"stripe-"+U+"-background-size",type:d.percent}),Y.push({name:"stripe-"+U+"-background-opacity",type:d.zeroOneNumber});var z=[],H=vr.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:d.arrowShape,triggersBounds:f.any},{name:"arrow-color",type:d.color},{name:"arrow-fill",type:d.arrowFill},{name:"arrow-width",type:d.arrowWidth}].forEach(function(re){H.forEach(function(Z){var oe=Z+"-"+re.name,ve=re.type,Ne=re.triggersBounds;z.push({name:oe,type:ve,triggersBounds:Ne})})},{});var X=vr.properties=[].concat(E,N,S,T,C,_,b,y,h,p,g,M,D,A,B,q,Y,R,L,z,P),K=vr.propertyGroups={behavior:E,transition:N,visibility:S,overlay:T,underlay:C,ghost:_,commonLabel:b,labelDimensions:y,mainLabel:h,sourceLabel:p,targetLabel:g,nodeBody:M,nodeBorder:D,nodeOutline:A,backgroundImage:B,pie:q,stripe:Y,compound:R,edgeLine:L,edgeArrow:z,core:P},k=vr.propertyGroupNames={},G=vr.propertyGroupKeys=Object.keys(K);G.forEach(function(re){k[re]=K[re].map(function(Z){return Z.name}),K[re].forEach(function(Z){return Z.groupKey=re})});var $=vr.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"}];vr.propertyNames=X.map(function(re){return re.name});for(var J=0;J<X.length;J++){var ne=X[J];X[ne.name]=ne}for(var ee=0;ee<$.length;ee++){var ae=$[ee],de=X[ae.pointsTo],le={name:ae.name,alias:!0,pointsTo:de};X.push(le),X[ae.name]=le}})();vr.getDefaultProperty=function(t){return this.getDefaultProperties()[t]};vr.getDefaultProperties=function(){var t=this._private;if(t.defaultProperties!=null)return t.defaultProperties;for(var e=Ze({"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(f,d){for(var h=1;h<=vr.pieBackgroundN;h++){var p=d.name.replace("{{i}}",h),g=d.value;f[p]=g}return f},{}),{"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(f,d){for(var h=1;h<=vr.stripeBackgroundN;h++){var p=d.name.replace("{{i}}",h),g=d.value;f[p]=g}return f},{}),{"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(f,d){return vr.arrowPrefixes.forEach(function(h){var p=h+"-"+d.name,g=d.value;f[p]=g}),f},{})),r={},a=0;a<this.properties.length;a++){var i=this.properties[a];if(!i.pointsTo){var s=i.name,o=e[s],u=this.parse(s,o);r[s]=u}}return t.defaultProperties=r,t.defaultProperties};vr.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 dh={};dh.parse=function(t,e,r,a){var i=this;if(Zt(e))return i.parseImplWarn(t,e,r,a);var s=a==="mapping"||a===!0||a===!1||a==null?"dontcare":a,o=r?"t":"f",u=""+e,f=qT(t,u,o,s),d=i.propCache=i.propCache||[],h;return(h=d[f])||(h=d[f]=i.parseImplWarn(t,e,r,a)),(r||a==="mapping")&&(h=gn(h),h&&(h.value=gn(h.value))),h};dh.parseImplWarn=function(t,e,r,a){var i=this.parseImpl(t,e,r,a);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};dh.parseImpl=function(t,e,r,a){var i=this;t=O0(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 f=Xe(e);f&&(e=e.trim());var d=s.type;if(!d)return null;if(r&&(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:r};var h,p;if(!(!f||a||e.length<7||e[1]!=="a")){if(e.length>=7&&e[0]==="d"&&(h=new RegExp(u.data.regex).exec(e))){if(r)return!1;var g=u.data;return{name:t,value:h,strValue:""+e,mapped:g,field:h[1],bypass:r}}else if(e.length>=10&&e[0]==="m"&&(p=new RegExp(u.mapData.regex).exec(e))){if(r||d.multiple)return!1;var y=u.mapData;if(!(d.color||d.number))return!1;var b=this.parse(t,p[4]);if(!b||b.mapped)return!1;var E=this.parse(t,p[5]);if(!E||E.mapped)return!1;if(b.pfValue===E.pfValue||b.strValue===E.strValue)return At("`"+t+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+t+": "+b.strValue+"`"),this.parse(t,b.strValue);if(d.color){var S=b.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:b.value,valueMax:E.value,bypass:r}}}if(d.multiple&&a!=="multiple"){var N;if(f?N=e.split(/\s+/):Pt(e)?N=e:N=[e],d.evenMultiple&&N.length%2!==0)return null;for(var j=[],M=[],D=[],A="",B=!1,R=0;R<N.length;R++){var L=i.parse(t,N[R],r,"multiple");B=B||Xe(L.value),j.push(L.value),D.push(L.pfValue!=null?L.pfValue:L.value),M.push(L.units),A+=(R>0?" ":"")+L.strValue}return d.validate&&!d.validate(j,M)?null:d.singleEnum&&B?j.length===1&&Xe(j[0])?{name:t,value:j[0],strValue:j[0],bypass:r}:null:{name:t,value:j,pfValue:D,strValue:A,bypass:r,units:M}}var _=function(){for(var le=0;le<d.enums.length;le++){var re=d.enums[le];if(re===e)return{name:t,value:e,strValue:""+e,bypass:r}}return null};if(d.number){var P,q="px";if(d.units&&(P=d.units),d.implicitUnits&&(q=d.implicitUnits),!d.unitless)if(f){var F="px|em"+(d.allowPercent?"|\\%":"");P&&(F=P);var Y=e.match("^("+br+")("+F+")?$");Y&&(e=Y[1],P=Y[2]||q)}else(!P||d.implicitUnits)&&(P=q);if(e=parseFloat(e),isNaN(e)&&d.enums===void 0)return null;if(isNaN(e)&&d.enums!==void 0)return e=o,_();if(d.integer&&!LM(e)||d.min!==void 0&&(e<d.min||d.strictMin&&e===d.min)||d.max!==void 0&&(e>d.max||d.strictMax&&e===d.max))return null;var U={name:t,value:e,strValue:""+e+(P||""),units:P,bypass:r};return d.unitless||P!=="px"&&P!=="em"?U.pfValue=e:U.pfValue=P==="px"||!P?e:this.getEmSizeInPixels()*e,(P==="ms"||P==="s")&&(U.pfValue=P==="ms"?e:1e3*e),(P==="deg"||P==="rad")&&(U.pfValue=P==="rad"?e:GR(e)),P==="%"&&(U.pfValue=e/100),U}else if(d.propList){var z=[],H=""+e;if(H!=="none"){for(var X=H.split(/\s*,\s*|\s+/),K=0;K<X.length;K++){var k=X[K].trim();i.properties[k]?z.push(k):At("`"+k+"` is not a valid property name")}if(z.length===0)return null}return{name:t,value:z,strValue:z.length===0?"none":z.join(" "),bypass:r}}else if(d.color){var G=kT(e);return G?{name:t,value:G,pfValue:G,strValue:"rgb("+G[0]+","+G[1]+","+G[2]+")",bypass:r}:null}else if(d.regex||d.regexes){if(d.enums){var $=_();if($)return $}for(var J=d.regexes?d.regexes:[d.regex],ne=0;ne<J.length;ne++){var ee=new RegExp(J[ne]),ae=ee.exec(e);if(ae)return{name:t,value:d.singleRegexMatchValue?ae[1]:ae,strValue:""+e,bypass:r}}return null}else return d.string?{name:t,value:""+e,strValue:""+e,bypass:r}:d.enums?_():null};var Mr=function(e){if(!(this instanceof Mr))return new Mr(e);if(!D0(e)){Qt("A style must have a core reference");return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},Xr=Mr.prototype;Xr.instanceString=function(){return"style"};Xr.clear=function(){for(var t=this._private,e=t.cy,r=e.elements(),a=0;a<this.length;a++)this[a]=void 0;return this.length=0,t.contextStyles={},t.propDiffs={},this.cleanElements(r,!0),r.forEach(function(i){var s=i[0]._private;s.styleDirty=!0,s.appliedInitStyle=!1}),this};Xr.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this};Xr.core=function(t){return this._private.coreStyle[t]||this.getDefaultProperty(t)};Xr.selector=function(t){var e=t==="core"?null:new Ji(t),r=this.length++;return this[r]={selector:e,properties:[],mappedProperties:[],index:r},this};Xr.css=function(){var t=this,e=arguments;if(e.length===1)for(var r=e[0],a=0;a<t.properties.length;a++){var i=t.properties[a],s=r[i.name];s===void 0&&(s=r[Wd(i.name)]),s!==void 0&&this.cssRule(i.name,s)}else e.length===2&&this.cssRule(e[0],e[1]);return this};Xr.style=Xr.css;Xr.cssRule=function(t,e){var r=this.parse(t,e);if(r){var a=this.length-1;this[a].properties.push(r),this[a].properties[r.name]=r,r.name.match(/pie-(\d+)-background-size/)&&r.value&&(this._private.hasPie=!0),r.name.match(/stripe-(\d+)-background-size/)&&r.value&&(this._private.hasStripe=!0),r.mapped&&this[a].mappedProperties.push(r);var i=!this[a].selector;i&&(this._private.coreStyle[r.name]=r)}return this};Xr.append=function(t){return OT(t)?t.appendToStyle(this):Pt(t)?this.appendFromJson(t):Xe(t)&&this.appendFromString(t),this};Mr.fromJson=function(t,e){var r=new Mr(t);return r.fromJson(e),r};Mr.fromString=function(t,e){return new Mr(t).fromString(e)};[Rr,Cc,G0,mn,fh,Q0,vr,dh].forEach(function(t){Ze(Xr,t)});Mr.types=Xr.types;Mr.properties=Xr.properties;Mr.propertyGroups=Xr.propertyGroups;Mr.propertyGroupNames=Xr.propertyGroupNames;Mr.propertyGroupKeys=Xr.propertyGroupKeys;var X3={style:function(e){if(e){var r=this.setStyle(e);r.update()}return this._private.style},setStyle:function(e){var r=this._private;return OT(e)?r.style=e.generateStyle(this):Pt(e)?r.style=Mr.fromJson(this,e):Xe(e)?r.style=Mr.fromString(this,e):r.style=Mr(this),r.style},updateStyle:function(){this.mutableElements().updateStyle()}},$3="single",$s={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 r=this._private;if(r.selectionType==null&&(r.selectionType=$3),e!==void 0)(e==="additive"||e==="single")&&(r.selectionType=e);else return r.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,r=this._private.pan,a,i,s,o,u;switch(e.length){case 0:return r;case 1:if(Xe(e[0]))return a=e[0],r[a];if(bt(e[0])){if(!this._private.panningEnabled)return this;s=e[0],o=s.x,u=s.y,Oe(o)&&(r.x=o),Oe(u)&&(r.y=u),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;a=e[0],i=e[1],(a==="x"||a==="y")&&Oe(i)&&(r[a]=i),this.emit("pan viewport");break}return this.notify("viewport"),this},panBy:function(e,r){var a=arguments,i=this._private.pan,s,o,u,f,d;if(!this._private.panningEnabled)return this;switch(a.length){case 1:bt(e)&&(u=a[0],f=u.x,d=u.y,Oe(f)&&(i.x+=f),Oe(d)&&(i.y+=d),this.emit("pan viewport"));break;case 2:s=e,o=r,(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,r){var a=this.getFitViewport(e,r);if(a){var i=this._private;i.zoom=a.zoom,i.pan=a.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,r){if(Oe(e)&&r===void 0&&(r=e,e=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var a;if(Xe(e)){var i=e;e=this.$(i)}else if(PM(e)){var s=e;a={x1:s.x1,y1:s.y1,x2:s.x2,y2:s.y2},a.w=a.x2-a.x1,a.h=a.y2-a.y1}else Aa(e)||(e=this.mutableElements());if(!(Aa(e)&&e.empty())){a=a||e.boundingBox();var o=this.width(),u=this.height(),f;if(r=Oe(r)?r:0,!isNaN(o)&&!isNaN(u)&&o>0&&u>0&&!isNaN(a.w)&&!isNaN(a.h)&&a.w>0&&a.h>0){f=Math.min((o-2*r)/a.w,(u-2*r)/a.h),f=f>this._private.maxZoom?this._private.maxZoom:f,f=f<this._private.minZoom?this._private.minZoom:f;var d={x:(o-f*(a.x1+a.x2))/2,y:(u-f*(a.y1+a.y2))/2};return{zoom:f,pan:d}}}}},zoomRange:function(e,r){var a=this._private;if(r==null){var i=e;e=i.min,r=i.max}return Oe(e)&&Oe(r)&&e<=r?(a.minZoom=e,a.maxZoom=r):Oe(e)&&r===void 0&&e<=a.maxZoom?a.minZoom=e:Oe(r)&&e===void 0&&r>=a.minZoom&&(a.maxZoom=r),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 r=this._private,a=r.pan,i=r.zoom,s,o,u=!1;if(r.zoomingEnabled||(u=!0),Oe(e)?o=e:bt(e)&&(o=e.level,e.position!=null?s=th(e.position,i,a):e.renderedPosition!=null&&(s=e.renderedPosition),s!=null&&!r.panningEnabled&&(u=!0)),o=o>r.maxZoom?r.maxZoom:o,o=o<r.minZoom?r.minZoom:o,u||!Oe(o)||o===i||s!=null&&(!Oe(s.x)||!Oe(s.y)))return null;if(s!=null){var f=a,d=i,h=o,p={x:-h/d*(s.x-f.x)+s.x,y:-h/d*(s.y-f.y)+s.y};return{zoomed:!0,panned:!0,zoom:h,pan:p}}else return{zoomed:!0,panned:!1,zoom:o,pan:a}},zoom:function(e){if(e===void 0)return this._private.zoom;var r=this.getZoomedViewport(e),a=this._private;return r==null||!r.zoomed?this:(a.zoom=r.zoom,r.panned&&(a.pan.x=r.pan.x,a.pan.y=r.pan.y),this.emit("zoom"+(r.panned?" pan":"")+" viewport"),this.notify("viewport"),this)},viewport:function(e){var r=this._private,a=!0,i=!0,s=[],o=!1,u=!1;if(!e)return this;if(Oe(e.zoom)||(a=!1),bt(e.pan)||(i=!1),!a&&!i)return this;if(a){var f=e.zoom;f<r.minZoom||f>r.maxZoom||!r.zoomingEnabled?o=!0:(r.zoom=f,s.push("zoom"))}if(i&&(!o||!e.cancelOnFailedZoom)&&r.panningEnabled){var d=e.pan;Oe(d.x)&&(r.pan.x=d.x,u=!1),Oe(d.y)&&(r.pan.y=d.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 r=this.getCenterPan(e);return r&&(this._private.pan=r,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,r){if(this._private.panningEnabled){if(Xe(e)){var a=e;e=this.mutableElements().filter(a)}else Aa(e)||(e=this.mutableElements());if(e.length!==0){var i=e.boundingBox(),s=this.width(),o=this.height();r=r===void 0?this._private.zoom:r;var u={x:(s-r*(i.x1+i.x2))/2,y:(o-r*(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,r=e.container,a=this;return e.sizeCache=e.sizeCache||(r?(function(){var i=a.window().getComputedStyle(r),s=function(u){return parseFloat(i.getPropertyValue(u))};return{width:r.clientWidth-s("padding-left")-s("padding-right"),height:r.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,r=this._private.zoom,a=this.renderedExtent(),i={x1:(a.x1-e.x)/r,x2:(a.x2-e.x)/r,y1:(a.y1-e.y)/r,y2:(a.y2-e.y)/r};return i.w=i.x2-i.x1,i.h=i.y2-i.y1,i},renderedExtent:function(){var e=this.width(),r=this.height();return{x1:0,y1:0,x2:e,y2:r,w:e,h:r}},multiClickDebounceTime:function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};$s.centre=$s.center;$s.autolockNodes=$s.autolock;$s.autoungrabifyNodes=$s.autoungrabify;var ec={data:Nt.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Nt.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Nt.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Nt.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};ec.attr=ec.data;ec.removeAttr=ec.removeData;var tc=function(e){var r=this;e=Ze({},e);var a=e.container;a&&!Md(a)&&Md(a[0])&&(a=a[0]);var i=a?a._cyreg:null;i=i||{},i&&i.cy&&(i.cy.destroy(),i={});var s=i.readies=i.readies||[];a&&(a._cyreg=i),i.cy=r;var o=xr!==void 0&&a!==void 0&&!e.headless,u=e;u.layout=Ze({name:o?"grid":"null"},u.layout),u.renderer=Ze({name:o?"canvas":"null"},u.renderer);var f=function(b,E,S){return E!==void 0?E:S!==void 0?S:b},d=this._private={container:a,ready:!1,options:u,elements:new Ur(this),listeners:[],aniEles:new Ur(this),data:u.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:f(!0,u.zoomingEnabled),userZoomingEnabled:f(!0,u.userZoomingEnabled),panningEnabled:f(!0,u.panningEnabled),userPanningEnabled:f(!0,u.userPanningEnabled),boxSelectionEnabled:f(!0,u.boxSelectionEnabled),autolock:f(!1,u.autolock,u.autolockNodes),autoungrabify:f(!1,u.autoungrabify,u.autoungrabifyNodes),autounselectify:f(!1,u.autounselectify),styleEnabled:u.styleEnabled===void 0?o:u.styleEnabled,zoom:Oe(u.zoom)?u.zoom:1,pan:{x:bt(u.pan)&&Oe(u.pan.x)?u.pan.x:0,y:bt(u.pan)&&Oe(u.pan.y)?u.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:f(250,u.multiClickDebounceTime)};this.createEmitter(),this.selectionType(u.selectionType),this.zoomRange({min:u.minZoom,max:u.maxZoom});var h=function(b,E){var S=b.some(UM);if(S)return Oo.all(b).then(E);E(b)};d.styleEnabled&&r.setStyle([]);var p=Ze({},u,u.renderer);r.initRenderer(p);var g=function(b,E,S){r.notifications(!1);var T=r.mutableElements();T.length>0&&T.remove(),b!=null&&(bt(b)||Pt(b))&&r.add(b),r.one("layoutready",function(N){r.notifications(!0),r.emit(N),r.one("load",E),r.emitAndNotify("load")}).one("layoutstop",function(){r.one("done",S),r.emit("done")});var C=Ze({},r._private.options.layout);C.eles=r.elements(),r.layout(C).run()};h([u.style,u.elements],function(y){var b=y[0],E=y[1];d.styleEnabled&&r.style().append(b),g(E,function(){r.startAnimationLoop(),d.ready=!0,Zt(u.ready)&&r.on("ready",u.ready);for(var S=0;S<s.length;S++){var T=s[S];r.on("ready",T)}i&&(i.readies=[]),r.emit("ready")},u.done)})},Pd=tc.prototype;Ze(Pd,{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 xr;var r=this._private.container.ownerDocument;return r===void 0||r==null?xr:r.defaultView||xr},mount:function(e){if(e!=null){var r=this,a=r._private,i=a.options;return!Md(e)&&Md(e[0])&&(e=e[0]),r.stopAnimationLoop(),r.destroyRenderer(),a.container=e,a.styleEnabled=!0,r.invalidateSize(),r.initRenderer(Ze({},i,i.renderer,{name:i.renderer.name==="null"?"canvas":i.renderer.name})),r.startAnimationLoop(),r.style(i.style),r.emit("mount"),r}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:"null"}),e.emit("unmount"),e},options:function(){return gn(this._private.options)},json:function(e){var r=this,a=r._private,i=r.mutableElements(),s=function(j){return r.getElementById(j.id())};if(bt(e)){if(r.startBatch(),e.elements){var o={},u=function(j,M){for(var D=[],A=[],B=0;B<j.length;B++){var R=j[B];if(!R.data.id){At("cy.json() cannot handle elements without an ID attribute");continue}var L=""+R.data.id,_=r.getElementById(L);o[L]=!0,_.length!==0?A.push({ele:_,json:R}):(M&&(R.group=M),D.push(R))}r.add(D);for(var P=0;P<A.length;P++){var q=A[P],F=q.ele,Y=q.json;F.json(Y)}};if(Pt(e.elements))u(e.elements);else for(var f=["nodes","edges"],d=0;d<f.length;d++){var h=f[d],p=e.elements[h];Pt(p)&&u(p,h)}var g=r.collection();i.filter(function(N){return!o[N.id()]}).forEach(function(N){N.isParent()?g.merge(N):N.remove()}),g.forEach(function(N){return N.children().move({parent:null})}),g.forEach(function(N){return s(N).remove()})}e.style&&r.style(e.style),e.zoom!=null&&e.zoom!==a.zoom&&r.zoom(e.zoom),e.pan&&(e.pan.x!==a.pan.x||e.pan.y!==a.pan.y)&&r.pan(e.pan),e.data&&r.data(e.data);for(var y=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],b=0;b<y.length;b++){var E=y[b];e[E]!=null&&r[E](e[E])}return r.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 j=N.group();T.elements[j]||(T.elements[j]=[]),T.elements[j].push(N.json())})),this._private.styleEnabled&&(T.style=r.style().json()),T.data=gn(r.data());var C=a.options;return T.zoomingEnabled=a.zoomingEnabled,T.userZoomingEnabled=a.userZoomingEnabled,T.zoom=a.zoom,T.minZoom=a.minZoom,T.maxZoom=a.maxZoom,T.panningEnabled=a.panningEnabled,T.userPanningEnabled=a.userPanningEnabled,T.pan=gn(a.pan),T.boxSelectionEnabled=a.boxSelectionEnabled,T.renderer=gn(C.renderer),T.hideEdgesOnViewport=C.hideEdgesOnViewport,T.textureOnViewport=C.textureOnViewport,T.wheelSensitivity=C.wheelSensitivity,T.motionBlur=C.motionBlur,T.multiClickDebounceTime=C.multiClickDebounceTime,T}}});Pd.$id=Pd.getElementById;[U3,H3,OC,$m,xd,Q3,Zm,bd,X3,$s,ec].forEach(function(t){Ze(Pd,t)});var Z3={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,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}},W3={maximal:!1,acyclic:!1},Hl=function(e){return e.scratch("breadthfirst")},NS=function(e,r){return e.scratch("breadthfirst",r)};function MC(t){this.options=Ze({},Z3,W3,t)}MC.prototype.run=function(){var t=this.options,e=t.cy,r=t.eles,a=r.nodes().filter(function(Le){return Le.isChildless()}),i=r,s=t.directed,o=t.acyclic||t.maximal||t.maximalAdjustments>0,u=!!t.boundingBox,f=ta(u?t.boundingBox:structuredClone(e.extent())),d;if(Aa(t.roots))d=t.roots;else if(Pt(t.roots)){for(var h=[],p=0;p<t.roots.length;p++){var g=t.roots[p],y=e.getElementById(g);h.push(y)}d=e.collection(h)}else if(Xe(t.roots))d=e.$(t.roots);else if(s)d=a.roots();else{var b=r.components();d=e.collection();for(var E=function(){var De=b[S],Ue=De.maxDegree(!1),xe=De.filter(function(Ye){return Ye.degree(!1)===Ue});d=d.add(xe)},S=0;S<b.length;S++)E()}var T=[],C={},N=function(De,Ue){T[Ue]==null&&(T[Ue]=[]);var xe=T[Ue].length;T[Ue].push(De),NS(De,{index:xe,depth:Ue})},j=function(De,Ue){var xe=Hl(De),Ye=xe.depth,Re=xe.index;T[Ye][Re]=null,De.isChildless()&&N(De,Ue)};i.bfs({roots:d,directed:t.directed,visit:function(De,Ue,xe,Ye,Re){var ye=De[0],Ge=ye.id();ye.isChildless()&&N(ye,Re),C[Ge]=!0}});for(var M=[],D=0;D<a.length;D++){var A=a[D];C[A.id()]||M.push(A)}var B=function(De){for(var Ue=T[De],xe=0;xe<Ue.length;xe++){var Ye=Ue[xe];if(Ye==null){Ue.splice(xe,1),xe--;continue}NS(Ye,{depth:De,index:xe})}},R=function(De,Ue){for(var xe=Hl(De),Ye=De.incomers().filter(function(et){return et.isNode()&&r.has(et)}),Re=-1,ye=De.id(),Ge=0;Ge<Ye.length;Ge++){var rt=Ye[Ge],at=Hl(rt);Re=Math.max(Re,at.depth)}if(xe.depth<=Re){if(!t.acyclic&&Ue[ye])return null;var ct=Re+1;return j(De,ct),Ue[ye]=ct,!0}return!1};if(s&&o){var L=[],_={},P=function(De){return L.push(De)},q=function(){return L.shift()};for(a.forEach(function(Le){return L.push(Le)});L.length>0;){var F=q(),Y=R(F,_);if(Y)F.outgoers().filter(function(Le){return Le.isNode()&&r.has(Le)}).forEach(P);else if(Y===null){At("Detected double maximal shift for node `"+F.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var U=0;if(t.avoidOverlap)for(var z=0;z<a.length;z++){var H=a[z],X=H.layoutDimensions(t),K=X.w,k=X.h;U=Math.max(U,K,k)}var G={},$=function(De){if(G[De.id()])return G[De.id()];for(var Ue=Hl(De).depth,xe=De.neighborhood(),Ye=0,Re=0,ye=0;ye<xe.length;ye++){var Ge=xe[ye];if(!(Ge.isEdge()||Ge.isParent()||!a.has(Ge))){var rt=Hl(Ge);if(rt!=null){var at=rt.index,ct=rt.depth;if(!(at==null||ct==null)){var et=T[ct].length;ct<Ue&&(Ye+=at/et,Re++)}}}}return Re=Math.max(1,Re),Ye=Ye/Re,Re===0&&(Ye=0),G[De.id()]=Ye,Ye},J=function(De,Ue){var xe=$(De),Ye=$(Ue),Re=xe-Ye;return Re===0?RT(De.id(),Ue.id()):Re};t.depthSort!==void 0&&(J=t.depthSort);for(var ne=T.length,ee=0;ee<ne;ee++)T[ee].sort(J),B(ee);for(var ae=[],de=0;de<M.length;de++)ae.push(M[de]);var le=function(){for(var De=0;De<ne;De++)B(De)};ae.length&&(T.unshift(ae),ne=T.length,le());for(var re=0,Z=0;Z<ne;Z++)re=Math.max(T[Z].length,re);var oe={x:f.x1+f.w/2,y:f.y1+f.h/2},ve=a.reduce(function(Le,De){return(function(Ue){return{w:Le.w===-1?Ue.w:(Le.w+Ue.w)/2,h:Le.h===-1?Ue.h:(Le.h+Ue.h)/2}})(De.boundingBox({includeLabels:t.nodeDimensionsIncludeLabels}))},{w:-1,h:-1}),Ne=Math.max(ne===1?0:u?(f.h-t.padding*2-ve.h)/(ne-1):(f.h-t.padding*2-ve.h)/(ne+1),U),Me=T.reduce(function(Le,De){return Math.max(Le,De.length)},0),Je=function(De){var Ue=Hl(De),xe=Ue.depth,Ye=Ue.index;if(t.circle){var Re=Math.min(f.w/2/ne,f.h/2/ne);Re=Math.max(Re,U);var ye=Re*xe+Re-(ne>0&&T[0].length<=3?Re/2:0),Ge=2*Math.PI/T[xe].length*Ye;return xe===0&&T[0].length===1&&(ye=1),{x:oe.x+ye*Math.cos(Ge),y:oe.y+ye*Math.sin(Ge)}}else{var rt=T[xe].length,at=Math.max(rt===1?0:u?(f.w-t.padding*2-ve.w)/((t.grid?Me:rt)-1):(f.w-t.padding*2-ve.w)/((t.grid?Me:rt)+1),U),ct={x:oe.x+(Ye+1-(rt+1)/2)*at,y:oe.y+(xe+1-(ne+1)/2)*Ne};return ct}},Ce={downward:0,leftward:90,upward:180,rightward:-90};Object.keys(Ce).indexOf(t.direction)===-1&&Qt("Invalid direction '".concat(t.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(Ce).join(", ")));var ke=function(De){return vR(Je(De),f,Ce[t.direction])};return r.nodes().layoutPositions(this,t,ke),this};var J3={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,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function RC(t){this.options=Ze({},J3,t)}RC.prototype.run=function(){var t=this.options,e=t,r=t.cy,a=e.eles,i=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,s=a.nodes().not(":parent");e.sort&&(s=s.sort(e.sort));for(var o=ta(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},f=e.sweep===void 0?2*Math.PI-2*Math.PI/s.length:e.sweep,d=f/Math.max(1,s.length-1),h,p=0,g=0;g<s.length;g++){var y=s[g],b=y.layoutDimensions(e),E=b.w,S=b.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(d)-Math.cos(0),C=Math.sin(d)-Math.sin(0),N=Math.sqrt(p*p/(T*T+C*C));h=Math.max(N,h)}var j=function(D,A){var B=e.startAngle+A*d*(i?1:-1),R=h*Math.cos(B),L=h*Math.sin(B),_={x:u.x+R,y:u.y+L};return _};return a.nodes().layoutPositions(this,e,j),this};var eB={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,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function kC(t){this.options=Ze({},eB,t)}kC.prototype.run=function(){for(var t=this.options,e=t,r=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,a=t.cy,i=e.eles,s=i.nodes().not(":parent"),o=ta(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},f=[],d=0,h=0;h<s.length;h++){var p=s[h],g=void 0;g=e.concentric(p),f.push({value:g,node:p}),p._private.scratch.concentric=g}s.updateStyle();for(var y=0;y<s.length;y++){var b=s[y],E=b.layoutDimensions(e);d=Math.max(d,E.w,E.h)}f.sort(function(Ne,Me){return Me.value-Ne.value});for(var S=e.levelWidth(s),T=[[]],C=T[0],N=0;N<f.length;N++){var j=f[N];if(C.length>0){var M=Math.abs(C[0].value-j.value);M>=S&&(C=[],T.push(C))}C.push(j)}var D=d+e.minNodeSpacing;if(!e.avoidOverlap){var A=T.length>0&&T[0].length>1,B=Math.min(o.w,o.h)/2-D,R=B/(T.length+A?1:0);D=Math.min(D,R)}for(var L=0,_=0;_<T.length;_++){var P=T[_],q=e.sweep===void 0?2*Math.PI-2*Math.PI/P.length:e.sweep,F=P.dTheta=q/Math.max(1,P.length-1);if(P.length>1&&e.avoidOverlap){var Y=Math.cos(F)-Math.cos(0),U=Math.sin(F)-Math.sin(0),z=Math.sqrt(D*D/(Y*Y+U*U));L=Math.max(z,L)}P.r=L,L+=D}if(e.equidistant){for(var H=0,X=0,K=0;K<T.length;K++){var k=T[K],G=k.r-X;H=Math.max(H,G)}X=0;for(var $=0;$<T.length;$++){var J=T[$];$===0&&(X=J.r),J.r=X,X+=H}}for(var ne={},ee=0;ee<T.length;ee++)for(var ae=T[ee],de=ae.dTheta,le=ae.r,re=0;re<ae.length;re++){var Z=ae[re],oe=e.startAngle+(r?1:-1)*de*re,ve={x:u.x+le*Math.cos(oe),y:u.y+le*Math.sin(oe)};ne[Z.node.id()]=ve}return i.nodes().layoutPositions(this,e,function(Ne){var Me=Ne.id();return ne[Me]}),this};var im,tB={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,r){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 hh(t){this.options=Ze({},tB,t),this.options.layout=this;var e=this.options.eles.nodes(),r=this.options.eles.edges(),a=r.filter(function(i){var s=i.source().data("id"),o=i.target().data("id"),u=e.some(function(d){return d.data("id")===s}),f=e.some(function(d){return d.data("id")===o});return!u||!f});this.options.eles=this.options.eles.not(a)}hh.prototype.run=function(){var t=this.options,e=t.cy,r=this;r.stopped=!1,(t.animate===!0||t.animate===!1)&&r.emit({type:"layoutstart",layout:r}),t.debug===!0?im=!0:im=!1;var a=rB(e,r,t);im&&nB(a),t.randomize&&iB(a);var i=Yn(),s=function(){sB(a,e,t),t.fit===!0&&e.fit(t.padding)},o=function(g){return!(r.stopped||g>=t.numIter||(lB(a,t),a.temperature=a.temperature*t.coolingFactor,a.temperature<t.minTemp))},u=function(){if(t.animate===!0||t.animate===!1)s(),r.one("layoutstop",t.stop),r.emit({type:"layoutstop",layout:r});else{var g=t.eles.nodes(),y=LC(a,t,g);g.layoutPositions(r,t,y)}},f=0,d=!0;if(t.animate===!0){var h=function(){for(var g=0;d&&g<t.refresh;)d=o(f),f++,g++;if(!d)jS(a,t),u();else{var y=Yn();y-i>=t.animationThreshold&&s(),Rd(h)}};h()}else{for(;d;)d=o(f),f++;jS(a,t),u()}return this};hh.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};hh.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var rB=function(e,r,a){for(var i=a.eles.edges(),s=a.eles.nodes(),o=ta(a.boundingBox?a.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:a.initialTemp,clientWidth:o.w,clientHeight:o.h,boundingBox:o},f=a.eles.components(),d={},h=0;h<f.length;h++)for(var p=f[h],g=0;g<p.length;g++){var y=p[g];d[y.id()]=h}for(var h=0;h<u.nodeSize;h++){var b=s[h],E=b.layoutDimensions(a),S={};S.isLocked=b.locked(),S.id=b.data("id"),S.parentId=b.data("parent"),S.cmptId=d[b.id()],S.children=[],S.positionX=b.position("x"),S.positionY=b.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(b.style("padding")),S.padRight=parseFloat(b.style("padding")),S.padTop=parseFloat(b.style("padding")),S.padBottom=parseFloat(b.style("padding")),S.nodeRepulsion=Zt(a.nodeRepulsion)?a.nodeRepulsion(b):a.nodeRepulsion,u.layoutNodes.push(S),u.idToIndex[S.id]=h}for(var T=[],C=0,N=-1,j=[],h=0;h<u.nodeSize;h++){var b=u.layoutNodes[h],M=b.parentId;M!=null?u.layoutNodes[u.idToIndex[M]].children.push(b.id):(T[++N]=b.id,j.push(b.id))}for(u.graphSet.push(j);C<=N;){var D=T[C++],A=u.idToIndex[D],y=u.layoutNodes[A],B=y.children;if(B.length>0){u.graphSet.push(B);for(var h=0;h<B.length;h++)T[++N]=B[h]}}for(var h=0;h<u.graphSet.length;h++)for(var R=u.graphSet[h],g=0;g<R.length;g++){var L=u.idToIndex[R[g]];u.indexToGraph[L]=h}for(var h=0;h<u.edgeSize;h++){var _=i[h],P={};P.id=_.data("id"),P.sourceId=_.data("source"),P.targetId=_.data("target");var q=Zt(a.idealEdgeLength)?a.idealEdgeLength(_):a.idealEdgeLength,F=Zt(a.edgeElasticity)?a.edgeElasticity(_):a.edgeElasticity,Y=u.idToIndex[P.sourceId],U=u.idToIndex[P.targetId],z=u.indexToGraph[Y],H=u.indexToGraph[U];if(z!=H){for(var X=aB(P.sourceId,P.targetId,u),K=u.graphSet[X],k=0,S=u.layoutNodes[Y];K.indexOf(S.id)===-1;)S=u.layoutNodes[u.idToIndex[S.parentId]],k++;for(S=u.layoutNodes[U];K.indexOf(S.id)===-1;)S=u.layoutNodes[u.idToIndex[S.parentId]],k++;q*=k*a.nestingFactor}P.idealLength=q,P.elasticity=F,u.layoutEdges.push(P)}return u},aB=function(e,r,a){var i=BC(e,r,0,a);return 2>i.count?0:i.graph},BC=function(e,r,a,i){var s=i.graphSet[a];if(-1<s.indexOf(e)&&-1<s.indexOf(r))return{count:2,graph:a};for(var o=0,u=0;u<s.length;u++){var f=s[u],d=i.idToIndex[f],h=i.layoutNodes[d].children;if(h.length!==0){var p=i.indexToGraph[i.idToIndex[h[0]]],g=BC(e,r,p,i);if(g.count!==0)if(g.count===1){if(o++,o===2)break}else return g}}return{count:o,graph:a}},nB,iB=function(e,r){for(var a=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()*a,o.positionY=Math.random()*i)}},LC=function(e,r,a){var i=e.boundingBox,s={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return r.boundingBox&&(a.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 f=e.layoutNodes[e.idToIndex[o.data("id")]];if(r.boundingBox){var d=s.w===0?.5:(f.positionX-s.x1)/s.w,h=s.h===0?.5:(f.positionY-s.y1)/s.h;return{x:i.x1+d*i.w,y:i.y1+h*i.h}}else return{x:f.positionX,y:f.positionY}}},sB=function(e,r,a){var i=a.layout,s=a.eles.nodes(),o=LC(e,a,s);s.positions(o),e.ready!==!0&&(e.ready=!0,i.one("layoutready",a.ready),i.emit({type:"layoutready",layout:this}))},lB=function(e,r,a){oB(e,r),fB(e),dB(e,r),hB(e),vB(e)},oB=function(e,r){for(var a=0;a<e.graphSet.length;a++)for(var i=e.graphSet[a],s=i.length,o=0;o<s;o++)for(var u=e.layoutNodes[e.idToIndex[i[o]]],f=o+1;f<s;f++){var d=e.layoutNodes[e.idToIndex[i[f]]];uB(u,d,e,r)}},AS=function(e){return-1+2*e*Math.random()},uB=function(e,r,a,i){var s=e.cmptId,o=r.cmptId;if(!(s!==o&&!a.isCompound)){var u=r.positionX-e.positionX,f=r.positionY-e.positionY,d=1;u===0&&f===0&&(u=AS(d),f=AS(d));var h=cB(e,r,u,f);if(h>0)var p=i.nodeOverlap*h,g=Math.sqrt(u*u+f*f),y=p*u/g,b=p*f/g;else var E=Ud(e,u,f),S=Ud(r,-1*u,-1*f),T=S.x-E.x,C=S.y-E.y,N=T*T+C*C,g=Math.sqrt(N),p=(e.nodeRepulsion+r.nodeRepulsion)/N,y=p*T/g,b=p*C/g;e.isLocked||(e.offsetX-=y,e.offsetY-=b),r.isLocked||(r.offsetX+=y,r.offsetY+=b)}},cB=function(e,r,a,i){if(a>0)var s=e.maxX-r.minX;else var s=r.maxX-e.minX;if(i>0)var o=e.maxY-r.minY;else var o=r.maxY-e.minY;return s>=0&&o>=0?Math.sqrt(s*s+o*o):0},Ud=function(e,r,a){var i=e.positionX,s=e.positionY,o=e.height||1,u=e.width||1,f=a/r,d=o/u,h={};return r===0&&0<a||r===0&&0>a?(h.x=i,h.y=s+o/2,h):0<r&&-1*d<=f&&f<=d?(h.x=i+u/2,h.y=s+u*a/2/r,h):0>r&&-1*d<=f&&f<=d?(h.x=i-u/2,h.y=s-u*a/2/r,h):0<a&&(f<=-1*d||f>=d)?(h.x=i+o*r/2/a,h.y=s+o/2,h):(0>a&&(f<=-1*d||f>=d)&&(h.x=i-o*r/2/a,h.y=s-o/2),h)},fB=function(e,r){for(var a=0;a<e.edgeSize;a++){var i=e.layoutEdges[a],s=e.idToIndex[i.sourceId],o=e.layoutNodes[s],u=e.idToIndex[i.targetId],f=e.layoutNodes[u],d=f.positionX-o.positionX,h=f.positionY-o.positionY;if(!(d===0&&h===0)){var p=Ud(o,d,h),g=Ud(f,-1*d,-1*h),y=g.x-p.x,b=g.y-p.y,E=Math.sqrt(y*y+b*b),S=Math.pow(i.idealLength-E,2)/i.elasticity;if(E!==0)var T=S*y/E,C=S*b/E;else var T=0,C=0;o.isLocked||(o.offsetX+=T,o.offsetY+=C),f.isLocked||(f.offsetX-=T,f.offsetY-=C)}}},dB=function(e,r){if(r.gravity!==0)for(var a=1,i=0;i<e.graphSet.length;i++){var s=e.graphSet[i],o=s.length;if(i===0)var u=e.clientHeight/2,f=e.clientWidth/2;else var d=e.layoutNodes[e.idToIndex[s[0]]],h=e.layoutNodes[e.idToIndex[d.parentId]],u=h.positionX,f=h.positionY;for(var p=0;p<o;p++){var g=e.layoutNodes[e.idToIndex[s[p]]];if(!g.isLocked){var y=u-g.positionX,b=f-g.positionY,E=Math.sqrt(y*y+b*b);if(E>a){var S=r.gravity*y/E,T=r.gravity*b/E;g.offsetX+=S,g.offsetY+=T}}}}},hB=function(e,r){var a=[],i=0,s=-1;for(a.push.apply(a,e.graphSet[0]),s+=e.graphSet[0].length;i<=s;){var o=a[i++],u=e.idToIndex[o],f=e.layoutNodes[u],d=f.children;if(0<d.length&&!f.isLocked){for(var h=f.offsetX,p=f.offsetY,g=0;g<d.length;g++){var y=e.layoutNodes[e.idToIndex[d[g]]];y.offsetX+=h,y.offsetY+=p,a[++s]=d[g]}f.offsetX=0,f.offsetY=0}}},vB=function(e,r){for(var a=0;a<e.nodeSize;a++){var i=e.layoutNodes[a];0<i.children.length&&(i.maxX=void 0,i.minX=void 0,i.maxY=void 0,i.minY=void 0)}for(var a=0;a<e.nodeSize;a++){var i=e.layoutNodes[a];if(!(0<i.children.length||i.isLocked)){var s=pB(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,zC(i,e)}}for(var a=0;a<e.nodeSize;a++){var i=e.layoutNodes[a];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)}},pB=function(e,r,a){var i=Math.sqrt(e*e+r*r);if(i>a)var s={x:a*e/i,y:a*r/i};else var s={x:e,y:r};return s},zC=function(e,r){var a=e.parentId;if(a!=null){var i=r.layoutNodes[r.idToIndex[a]],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 zC(i,r)}},jS=function(e,r){for(var a=e.layoutNodes,i=[],s=0;s<a.length;s++){var o=a[s],u=o.cmptId,f=i[u]=i[u]||[];f.push(o)}for(var d=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 g=h[p];h.x1=Math.min(h.x1,g.positionX-g.width/2),h.x2=Math.max(h.x2,g.positionX+g.width/2),h.y1=Math.min(h.y1,g.positionY-g.height/2),h.y2=Math.max(h.y2,g.positionY+g.height/2)}h.w=h.x2-h.x1,h.h=h.y2-h.y1,d+=h.w*h.h}}i.sort(function(C,N){return N.w*N.h-C.w*C.h});for(var y=0,b=0,E=0,S=0,T=Math.sqrt(d)*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 g=h[p];g.isLocked||(g.positionX+=y-h.x1,g.positionY+=b-h.y1)}y+=h.w+r.componentSpacing,E+=h.w+r.componentSpacing,S=Math.max(S,h.h),E>T&&(b+=S+r.componentSpacing,y=0,E=0,S=0)}}},gB={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,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function _C(t){this.options=Ze({},gB,t)}_C.prototype.run=function(){var t=this.options,e=t,r=t.cy,a=e.eles,i=a.nodes().not(":parent");e.sort&&(i=i.sort(e.sort));var s=ta(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(s.h===0||s.w===0)a.nodes().layoutPositions(this,e,function($){return{x:s.x1,y:s.y1}});else{var o=i.size(),u=Math.sqrt(o*s.h/s.w),f=Math.round(u),d=Math.round(s.w/s.h*u),h=function(J){if(J==null)return Math.min(f,d);var ne=Math.min(f,d);ne==f?f=J:d=J},p=function(J){if(J==null)return Math.max(f,d);var ne=Math.max(f,d);ne==f?f=J:d=J},g=e.rows,y=e.cols!=null?e.cols:e.columns;if(g!=null&&y!=null)f=g,d=y;else if(g!=null&&y==null)f=g,d=Math.ceil(o/f);else if(g==null&&y!=null)d=y,f=Math.ceil(o/d);else if(d*f>o){var b=h(),E=p();(b-1)*E>=o?h(b-1):(E-1)*b>=o&&p(E-1)}else for(;d*f<o;){var S=h(),T=p();(T+1)*S>=o?p(T+1):h(S+1)}var C=s.w/d,N=s.h/f;if(e.condense&&(C=0,N=0),e.avoidOverlap)for(var j=0;j<i.length;j++){var M=i[j],D=M._private.position;(D.x==null||D.y==null)&&(D.x=0,D.y=0);var A=M.layoutDimensions(e),B=e.avoidOverlapPadding,R=A.w+B,L=A.h+B;C=Math.max(C,R),N=Math.max(N,L)}for(var _={},P=function(J,ne){return!!_["c-"+J+"-"+ne]},q=function(J,ne){_["c-"+J+"-"+ne]=!0},F=0,Y=0,U=function(){Y++,Y>=d&&(Y=0,F++)},z={},H=0;H<i.length;H++){var X=i[H],K=e.position(X);if(K&&(K.row!==void 0||K.col!==void 0)){var k={row:K.row,col:K.col};if(k.col===void 0)for(k.col=0;P(k.row,k.col);)k.col++;else if(k.row===void 0)for(k.row=0;P(k.row,k.col);)k.row++;z[X.id()]=k,q(k.row,k.col)}}var G=function(J,ne){var ee,ae;if(J.locked()||J.isParent())return!1;var de=z[J.id()];if(de)ee=de.col*C+C/2+s.x1,ae=de.row*N+N/2+s.y1;else{for(;P(F,Y);)U();ee=Y*C+C/2+s.x1,ae=F*N+N/2+s.y1,q(F,Y),U()}return{x:ee,y:ae}};i.layoutPositions(this,e,G)}return this};var mB={ready:function(){},stop:function(){}};function Y0(t){this.options=Ze({},mB,t)}Y0.prototype.run=function(){var t=this.options,e=t.eles,r=this;return t.cy,r.emit("layoutstart"),e.nodes().positions(function(){return{x:0,y:0}}),r.one("layoutready",t.ready),r.emit("layoutready"),r.one("layoutstop",t.stop),r.emit("layoutstop"),this};Y0.prototype.stop=function(){return this};var yB={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,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function PC(t){this.options=Ze({},yB,t)}PC.prototype.run=function(){var t=this.options,e=t.eles,r=e.nodes(),a=Zt(t.positions);function i(s){if(t.positions==null)return qR(s.position());if(a)return t.positions(s);var o=t.positions[s._private.data.id];return o??null}return r.layoutPositions(this,t,function(s,o){var u=i(s);return s.locked()||u==null?!1:u}),this};var xB={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function UC(t){this.options=Ze({},xB,t)}UC.prototype.run=function(){var t=this.options,e=t.cy,r=t.eles,a=ta(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),i=function(o,u){return{x:a.x1+Math.round(Math.random()*a.w),y:a.y1+Math.round(Math.random()*a.h)}};return r.nodes().layoutPositions(this,t,i),this};var bB=[{name:"breadthfirst",impl:MC},{name:"circle",impl:RC},{name:"concentric",impl:kC},{name:"cose",impl:hh},{name:"grid",impl:_C},{name:"null",impl:Y0},{name:"preset",impl:PC},{name:"random",impl:UC}];function qC(t){this.options=t,this.notifications=0}var DS=function(){},OS=function(){throw new Error("A headless instance can not render images")};qC.prototype={recalculateRenderedStyle:DS,notify:function(){this.notifications++},init:DS,isHeadless:function(){return!0},png:OS,jpg:OS};var K0={};K0.arrowShapeWidth=.3;K0.registerArrowShapes=function(){var t=this.arrowShapes={},e=this,r=function(d,h,p,g,y,b,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,j=S<=d&&d<=T&&C<=h&&h<=N;return j},a=function(d,h,p,g,y){var b=d*Math.cos(g)-h*Math.sin(g),E=d*Math.sin(g)+h*Math.cos(g),S=b*p,T=E*p,C=S+y.x,N=T+y.y;return{x:C,y:N}},i=function(d,h,p,g){for(var y=[],b=0;b<d.length;b+=2){var E=d[b],S=d[b+1];y.push(a(E,S,h,p,g))}return y},s=function(d){for(var h=[],p=0;p<d.length;p++){var g=d[p];h.push(g.x,g.y)}return h},o=function(d){return d.pstyle("width").pfValue*d.pstyle("arrow-scale").pfValue*2},u=function(d,h){Xe(h)&&(h=t[h]),t[d]=Ze({name:d,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(g,y,b,E,S,T){var C=s(i(this.points,b+2*T,E,S)),N=va(g,y,C);return N},roughCollide:r,draw:function(g,y,b,E){var S=i(this.points,y,b,E);e.arrowShapeImpl("polygon")(g,S)},spacing:function(g){return 0},gap:o},h)};u("none",{collide:kd,roughCollide:kd,draw:k0,spacing:Hw,gap:Hw}),u("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),u("arrow","triangle"),u("triangle-backcurve",{points:t.triangle.points,controlPoint:[0,-.15],roughCollide:r,draw:function(d,h,p,g,y){var b=i(this.points,h,p,g),E=this.controlPoint,S=a(E[0],E[1],h,p,g);e.arrowShapeImpl(this.name)(d,b,S)},gap:function(d){return o(d)*.8}}),u("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(d,h,p,g,y,b,E){var S=s(i(this.points,p+2*E,g,y)),T=s(i(this.pointsTee,p+2*E,g,y)),C=va(d,h,S)||va(d,h,T);return C},draw:function(d,h,p,g,y){var b=i(this.points,h,p,g),E=i(this.pointsTee,h,p,g);e.arrowShapeImpl(this.name)(d,b,E)}}),u("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(d,h,p,g,y,b,E){var S=y,T=Math.pow(S.x-d,2)+Math.pow(S.y-h,2)<=Math.pow((p+2*E)*this.radius,2),C=s(i(this.points,p+2*E,g,y));return va(d,h,C)||T},draw:function(d,h,p,g,y){var b=i(this.pointsTr,h,p,g);e.arrowShapeImpl(this.name)(d,b,g.x,g.y,this.radius*h)},spacing:function(d){return e.getArrowWidth(d.pstyle("width").pfValue,d.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(d,h){var p=this.baseCrossLinePts.slice(),g=h/d,y=3,b=5;return p[y]=p[y]-g,p[b]=p[b]-g,p},collide:function(d,h,p,g,y,b,E){var S=s(i(this.points,p+2*E,g,y)),T=s(i(this.crossLinePts(p,b),p+2*E,g,y)),C=va(d,h,S)||va(d,h,T);return C},draw:function(d,h,p,g,y){var b=i(this.points,h,p,g),E=i(this.crossLinePts(h,y),h,p,g);e.arrowShapeImpl(this.name)(d,b,E)}}),u("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(d){return o(d)*.525}}),u("circle",{radius:.15,collide:function(d,h,p,g,y,b,E){var S=y,T=Math.pow(S.x-d,2)+Math.pow(S.y-h,2)<=Math.pow((p+2*E)*this.radius,2);return T},draw:function(d,h,p,g,y){e.arrowShapeImpl(this.name)(d,g.x,g.y,this.radius*h)},spacing:function(d){return e.getArrowWidth(d.pstyle("width").pfValue,d.pstyle("arrow-scale").value)*this.radius}}),u("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(d){return 1},gap:function(d){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(d){return d.pstyle("width").pfValue*d.pstyle("arrow-scale").value}}),u("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(d){return .95*d.pstyle("width").pfValue*d.pstyle("arrow-scale").value}})};var al={};al.projectIntoViewport=function(t,e){var r=this.cy,a=this.findContainerClientCoords(),i=a[0],s=a[1],o=a[4],u=r.pan(),f=r.zoom(),d=((t-i)/o-u.x)/f,h=((e-s)/o-u.y)/f;return[d,h]};al.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var t=this.container,e=t.getBoundingClientRect(),r=this.cy.window().getComputedStyle(t),a=function(T){return parseFloat(r.getPropertyValue(T))},i={left:a("padding-left"),right:a("padding-right"),top:a("padding-top"),bottom:a("padding-bottom")},s={left:a("border-left-width"),right:a("border-right-width"),top:a("border-top-width"),bottom:a("border-bottom-width")},o=t.clientWidth,u=t.clientHeight,f=i.left+i.right,d=i.top+i.bottom,h=s.left+s.right,p=e.width/(o+h),g=o-f,y=u-d,b=e.left+i.left+s.left,E=e.top+i.top+s.top;return this.containerBB=[b,E,g,y,p]};al.invalidateContainerClientCoordsCache=function(){this.containerBB=null};al.findNearestElement=function(t,e,r,a){return this.findNearestElements(t,e,r,a)[0]};al.findNearestElements=function(t,e,r,a){var i=this,s=this,o=s.getCachedZSortedEles(),u=[],f=s.cy.zoom(),d=s.cy.hasCompoundNodes(),h=(a?24:8)/f,p=(a?8:2)/f,g=(a?8:2)/f,y=1/0,b,E;r&&(o=o.interactive);function S(A,B){if(A.isNode()){if(E)return;E=A,u.push(A)}if(A.isEdge()&&(B==null||B<y))if(b){if(b.pstyle("z-compound-depth").value===A.pstyle("z-compound-depth").value&&b.pstyle("z-compound-depth").value===A.pstyle("z-compound-depth").value){for(var R=0;R<u.length;R++)if(u[R].isEdge()){u[R]=A,b=A,y=B??y;break}}}else u.push(A),b=A,y=B??y}function T(A){var B=A.outerWidth()+2*p,R=A.outerHeight()+2*p,L=B/2,_=R/2,P=A.position(),q=A.pstyle("corner-radius").value==="auto"?"auto":A.pstyle("corner-radius").pfValue,F=A._private.rscratch;if(P.x-L<=t&&t<=P.x+L&&P.y-_<=e&&e<=P.y+_){var Y=s.nodeShapes[i.getNodeShape(A)];if(Y.checkPoint(t,e,0,B,R,P.x,P.y,q,F))return S(A,0),!0}}function C(A){var B=A._private,R=B.rscratch,L=A.pstyle("width").pfValue,_=A.pstyle("arrow-scale").value,P=L/2+h,q=P*P,F=P*2,H=B.source,X=B.target,Y;if(R.edgeType==="segments"||R.edgeType==="straight"||R.edgeType==="haystack"){for(var U=R.allpts,z=0;z+3<U.length;z+=2)if(ek(t,e,U[z],U[z+1],U[z+2],U[z+3],F)&&q>(Y=ik(t,e,U[z],U[z+1],U[z+2],U[z+3])))return S(A,Y),!0}else if(R.edgeType==="bezier"||R.edgeType==="multibezier"||R.edgeType==="self"||R.edgeType==="compound"){for(var U=R.allpts,z=0;z+5<R.allpts.length;z+=4)if(tk(t,e,U[z],U[z+1],U[z+2],U[z+3],U[z+4],U[z+5],F)&&q>(Y=nk(t,e,U[z],U[z+1],U[z+2],U[z+3],U[z+4],U[z+5])))return S(A,Y),!0}for(var H=H||B.source,X=X||B.target,K=i.getArrowWidth(L,_),k=[{name:"source",x:R.arrowStartX,y:R.arrowStartY,angle:R.srcArrowAngle},{name:"target",x:R.arrowEndX,y:R.arrowEndY,angle:R.tgtArrowAngle},{name:"mid-source",x:R.midX,y:R.midY,angle:R.midsrcArrowAngle},{name:"mid-target",x:R.midX,y:R.midY,angle:R.midtgtArrowAngle}],z=0;z<k.length;z++){var G=k[z],$=s.arrowShapes[A.pstyle(G.name+"-arrow-shape").value],J=A.pstyle("width").pfValue;if($.roughCollide(t,e,K,G.angle,{x:G.x,y:G.y},J,h)&&$.collide(t,e,K,G.angle,{x:G.x,y:G.y},J,h))return S(A),!0}d&&u.length>0&&(T(H),T(X))}function N(A,B,R){return ha(A,B,R)}function j(A,B){var R=A._private,L=g,_;B?_=B+"-":_="",A.boundingBox();var P=R.labelBounds[B||"main"],q=A.pstyle(_+"label").value,F=A.pstyle("text-events").strValue==="yes";if(!(!F||!q)){var Y=N(R.rscratch,"labelX",B),U=N(R.rscratch,"labelY",B),z=N(R.rscratch,"labelAngle",B),H=A.pstyle(_+"text-margin-x").pfValue,X=A.pstyle(_+"text-margin-y").pfValue,K=P.x1-L-H,k=P.x2+L-H,G=P.y1-L-X,$=P.y2+L-X;if(z){var J=Math.cos(z),ne=Math.sin(z),ee=function(ve,Ne){return ve=ve-Y,Ne=Ne-U,{x:ve*J-Ne*ne+Y,y:ve*ne+Ne*J+U}},ae=ee(K,G),de=ee(K,$),le=ee(k,G),re=ee(k,$),Z=[ae.x+H,ae.y+X,le.x+H,le.y+X,re.x+H,re.y+X,de.x+H,de.y+X];if(va(t,e,Z))return S(A),!0}else if(Vi(P,t,e))return S(A),!0}}for(var M=o.length-1;M>=0;M--){var D=o[M];D.isNode()?T(D)||j(D):C(D)||j(D)||j(D,"source")||j(D,"target")}return u};al.getAllInBox=function(t,e,r,a){var i=this.getCachedZSortedEles().interactive,s=this.cy.zoom(),o=2/s,u=[],f=Math.min(t,r),d=Math.max(t,r),h=Math.min(e,a),p=Math.max(e,a);t=f,r=d,e=h,a=p;var g=ta({x1:t,y1:e,x2:r,y2:a}),y=[{x:g.x1,y:g.y1},{x:g.x2,y:g.y1},{x:g.x2,y:g.y2},{x:g.x1,y:g.y2}],b=[[y[0],y[1]],[y[1],y[2]],[y[2],y[3]],[y[3],y[0]]];function E(ve,Ne,Me){return ha(ve,Ne,Me)}function S(ve,Ne){var Me=ve._private,Je=o,Ce="";ve.boundingBox();var ke=Me.labelBounds.main;if(!ke)return null;var Le=E(Me.rscratch,"labelX",Ne),De=E(Me.rscratch,"labelY",Ne),Ue=E(Me.rscratch,"labelAngle",Ne),xe=ve.pstyle(Ce+"text-margin-x").pfValue,Ye=ve.pstyle(Ce+"text-margin-y").pfValue,Re=ke.x1-Je-xe,ye=ke.x2+Je-xe,Ge=ke.y1-Je-Ye,rt=ke.y2+Je-Ye;if(Ue){var at=Math.cos(Ue),ct=Math.sin(Ue),et=function(we,Q){return we=we-Le,Q=Q-De,{x:we*at-Q*ct+Le,y:we*ct+Q*at+De}};return[et(Re,Ge),et(ye,Ge),et(ye,rt),et(Re,rt)]}else return[{x:Re,y:Ge},{x:ye,y:Ge},{x:ye,y:rt},{x:Re,y:rt}]}function T(ve,Ne,Me,Je){function Ce(ke,Le,De){return(De.y-ke.y)*(Le.x-ke.x)>(Le.y-ke.y)*(De.x-ke.x)}return Ce(ve,Me,Je)!==Ce(Ne,Me,Je)&&Ce(ve,Ne,Me)!==Ce(ve,Ne,Je)}for(var C=0;C<i.length;C++){var N=i[C];if(N.isNode()){var j=N,M=j.pstyle("text-events").strValue==="yes",D=j.pstyle("box-selection").strValue,A=j.pstyle("box-select-labels").strValue==="yes";if(D==="none")continue;var B=(D==="overlap"||A)&&M,R=j.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:B});if(D==="contain"){var L=!1;if(A&&M){var _=S(j);_&&ag(_,y)&&(u.push(j),L=!0)}!L&&YT(g,R)&&u.push(j)}else if(D==="overlap"&&_0(g,R)){var P=j.boundingBox({includeNodes:!0,includeEdges:!0,includeLabels:!1,includeMainLabels:!1,includeSourceLabels:!1,includeTargetLabels:!1}),q=[{x:P.x1,y:P.y1},{x:P.x2,y:P.y1},{x:P.x2,y:P.y2},{x:P.x1,y:P.y2}];if(ag(q,y))u.push(j);else{var F=S(j);F&&ag(F,y)&&u.push(j)}}}else{var Y=N,U=Y._private,z=U.rscratch,H=Y.pstyle("box-selection").strValue;if(H==="none")continue;if(H==="contain"){if(z.startX!=null&&z.startY!=null&&!Vi(g,z.startX,z.startY)||z.endX!=null&&z.endY!=null&&!Vi(g,z.endX,z.endY))continue;if(z.edgeType==="bezier"||z.edgeType==="multibezier"||z.edgeType==="self"||z.edgeType==="compound"||z.edgeType==="segments"||z.edgeType==="haystack"){for(var X=U.rstyle.bezierPts||U.rstyle.linePts||U.rstyle.haystackPts,K=!0,k=0;k<X.length;k++)if(!Xw(g,X[k])){K=!1;break}K&&u.push(Y)}else z.edgeType==="straight"&&u.push(Y)}else if(H==="overlap"){var G=!1;if(z.startX!=null&&z.startY!=null&&z.endX!=null&&z.endY!=null&&(Vi(g,z.startX,z.startY)||Vi(g,z.endX,z.endY)))u.push(Y),G=!0;else if(!G&&z.edgeType==="haystack"){for(var $=U.rstyle.haystackPts,J=0;J<$.length;J++)if(Xw(g,$[J])){u.push(Y),G=!0;break}}if(!G){var ne=U.rstyle.bezierPts||U.rstyle.linePts||U.rstyle.haystackPts;if((!ne||ne.length<2)&&z.edgeType==="straight"&&z.startX!=null&&z.startY!=null&&z.endX!=null&&z.endY!=null&&(ne=[{x:z.startX,y:z.startY},{x:z.endX,y:z.endY}]),!ne||ne.length<2)continue;for(var ee=0;ee<ne.length-1;ee++){for(var ae=ne[ee],de=ne[ee+1],le=0;le<b.length;le++){var re=pr(b[le],2),Z=re[0],oe=re[1];if(T(ae,de,Z,oe)){u.push(Y),G=!0;break}}if(G)break}}}}}return u};var qd={};qd.calculateArrowAngles=function(t){var e=t._private.rscratch,r=e.edgeType==="haystack",a=e.edgeType==="bezier",i=e.edgeType==="multibezier",s=e.edgeType==="segments",o=e.edgeType==="compound",u=e.edgeType==="self",f,d,h,p,g,y,T,C;if(r?(h=e.haystackPts[0],p=e.haystackPts[1],g=e.haystackPts[2],y=e.haystackPts[3]):(h=e.arrowStartX,p=e.arrowStartY,g=e.arrowEndX,y=e.arrowEndY),T=e.midX,C=e.midY,s)f=h-e.segpts[0],d=p-e.segpts[1];else if(i||o||u||a){var b=e.allpts,E=Or(b[0],b[2],b[4],.1),S=Or(b[1],b[3],b[5],.1);f=h-E,d=p-S}else f=h-T,d=p-C;e.srcArrowAngle=Zf(f,d);var T=e.midX,C=e.midY;if(r&&(T=(h+g)/2,C=(p+y)/2),f=g-h,d=y-p,s){var b=e.allpts;if(b.length/2%2===0){var N=b.length/2,j=N-2;f=b[N]-b[j],d=b[N+1]-b[j+1]}else if(e.isRound)f=e.midVector[1],d=-e.midVector[0];else{var N=b.length/2-1,j=N-2;f=b[N]-b[j],d=b[N+1]-b[j+1]}}else if(i||o||u){var b=e.allpts,M=e.ctrlpts,D,A,B,R;if(M.length/2%2===0){var L=b.length/2-1,_=L+2,P=_+2;D=Or(b[L],b[_],b[P],0),A=Or(b[L+1],b[_+1],b[P+1],0),B=Or(b[L],b[_],b[P],1e-4),R=Or(b[L+1],b[_+1],b[P+1],1e-4)}else{var _=b.length/2-1,L=_-2,P=_+2;D=Or(b[L],b[_],b[P],.4999),A=Or(b[L+1],b[_+1],b[P+1],.4999),B=Or(b[L],b[_],b[P],.5),R=Or(b[L+1],b[_+1],b[P+1],.5)}f=B-D,d=R-A}if(e.midtgtArrowAngle=Zf(f,d),e.midDispX=f,e.midDispY=d,f*=-1,d*=-1,s){var b=e.allpts;if(b.length/2%2!==0){if(!e.isRound){var N=b.length/2-1,q=N+2;f=-(b[q]-b[N]),d=-(b[q+1]-b[N+1])}}}if(e.midsrcArrowAngle=Zf(f,d),s)f=g-e.segpts[e.segpts.length-2],d=y-e.segpts[e.segpts.length-1];else if(i||o||u||a){var b=e.allpts,F=b.length,E=Or(b[F-6],b[F-4],b[F-2],.9),S=Or(b[F-5],b[F-3],b[F-1],.9);f=g-E,d=y-S}else f=g-T,d=y-C;e.tgtArrowAngle=Zf(f,d)};qd.getArrowWidth=qd.getArrowHeight=function(t,e){var r=this.arrowWidthCache=this.arrowWidthCache||{},a=r[t+", "+e];return a||(a=Math.max(Math.pow(t*13.37,.9),29)*e,r[t+", "+e]=a,a)};var Wm,Jm,fn={},qa={},MS,RS,ks,wd,Pn,As,Os,un,Gl,id,IC,VC,e0,t0,kS,BS=function(e,r,a){a.x=r.x-e.x,a.y=r.y-e.y,a.len=Math.sqrt(a.x*a.x+a.y*a.y),a.nx=a.x/a.len,a.ny=a.y/a.len,a.ang=Math.atan2(a.ny,a.nx)},wB=function(e,r){r.x=e.x*-1,r.y=e.y*-1,r.nx=e.nx*-1,r.ny=e.ny*-1,r.ang=e.ang>0?-(Math.PI-e.ang):Math.PI+e.ang},SB=function(e,r,a,i,s){if(e!==kS?BS(r,e,fn):wB(qa,fn),BS(r,a,qa),MS=fn.nx*qa.ny-fn.ny*qa.nx,RS=fn.nx*qa.nx-fn.ny*-qa.ny,Pn=Math.asin(Math.max(-1,Math.min(1,MS))),Math.abs(Pn)<1e-6){Wm=r.x,Jm=r.y,Os=Gl=0;return}ks=1,wd=!1,RS<0?Pn<0?Pn=Math.PI+Pn:(Pn=Math.PI-Pn,ks=-1,wd=!0):Pn>0&&(ks=-1,wd=!0),r.radius!==void 0?Gl=r.radius:Gl=i,As=Pn/2,id=Math.min(fn.len/2,qa.len/2),s?(un=Math.abs(Math.cos(As)*Gl/Math.sin(As)),un>id?(un=id,Os=Math.abs(un*Math.sin(As)/Math.cos(As))):Os=Gl):(un=Math.min(id,Gl),Os=Math.abs(un*Math.sin(As)/Math.cos(As))),e0=r.x+qa.nx*un,t0=r.y+qa.ny*un,Wm=e0-qa.ny*Os*ks,Jm=t0+qa.nx*Os*ks,IC=r.x+fn.nx*un,VC=r.y+fn.ny*un,kS=r};function FC(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 X0(t,e,r,a){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return a===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}:(SB(t,e,r,a,i),{cx:Wm,cy:Jm,radius:Os,startX:IC,startY:VC,stopX:e0,stopY:t0,startAngle:fn.ang+Math.PI/2*ks,endAngle:qa.ang-Math.PI/2*ks,counterClockwise:wd})}var rc=.01,EB=Math.sqrt(2*rc),$r={};$r.findMidptPtsEtc=function(t,e){var r=e.posPts,a=e.intersectionPts,i=e.vectorNormInverse,s,o=t.pstyle("source-endpoint"),u=t.pstyle("target-endpoint"),f=o.units!=null&&u.units!=null,d=function(M,D,A,B){var R=B-D,L=A-M,_=Math.sqrt(L*L+R*R);return{x:-R/_,y:L/_}},h=t.pstyle("edge-distances").value;switch(h){case"node-position":s=r;break;case"intersection":s=a;break;case"endpoints":{if(f){var p=this.manualEndptToPx(t.source()[0],o),g=pr(p,2),y=g[0],b=g[1],E=this.manualEndptToPx(t.target()[0],u),S=pr(E,2),T=S[0],C=S[1],N={x1:y,y1:b,x2:T,y2:C};i=d(y,b,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=a;break}}return{midptPts:s,vectorNormInverse:i}};$r.findHaystackPoints=function(t){for(var e=0;e<t.length;e++){var r=t[e],a=r._private,i=a.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=a.source,u=a.target,f=o.position(),d=u.position(),h=o.width(),p=u.width(),g=o.height(),y=u.height(),b=r.pstyle("haystack-radius").value,E=b/2;i.haystackPts=i.allpts=[i.source.x*h*E+f.x,i.source.y*g*E+f.y,i.target.x*p*E+d.x,i.target.y*y*E+d.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(r),this.calculateArrowAngles(r),this.recalculateEdgeLabelProjections(r),this.calculateLabelAngles(r)}};$r.findSegmentsPoints=function(t,e){var r=t._private.rscratch,a=t.pstyle("segment-weights"),i=t.pstyle("segment-distances"),s=t.pstyle("segment-radii"),o=t.pstyle("radius-type"),u=Math.min(a.pfValue.length,i.pfValue.length),f=s.pfValue[s.pfValue.length-1],d=o.pfValue[o.pfValue.length-1];r.edgeType="segments",r.segpts=[],r.radii=[],r.isArcRadius=[];for(var h=0;h<u;h++){var p=a.pfValue[h],g=i.pfValue[h],y=1-p,b=p,E=this.findMidptPtsEtc(t,e),S=E.midptPts,T=E.vectorNormInverse,C={x:S.x1*y+S.x2*b,y:S.y1*y+S.y2*b};r.segpts.push(C.x+T.x*g,C.y+T.y*g),r.radii.push(s.pfValue[h]!==void 0?s.pfValue[h]:f),r.isArcRadius.push((o.pfValue[h]!==void 0?o.pfValue[h]:d)==="arc-radius")}};$r.findLoopPoints=function(t,e,r,a){var i=t._private.rscratch,s=e.dirCounts,o=e.srcPos,u=t.pstyle("control-point-distances"),f=u?u.pfValue[0]:void 0,d=t.pstyle("loop-direction").pfValue,h=t.pstyle("loop-sweep").pfValue,p=t.pstyle("control-point-step-size").pfValue;i.edgeType="self";var g=r,y=p;a&&(g=0,y=f);var b=d-Math.PI/2,E=b-h/2,S=b+h/2,T=d+"_"+h;g=s[T]===void 0?s[T]=0:++s[T],i.ctrlpts=[o.x+Math.cos(E)*1.4*y*(g/3+1),o.y+Math.sin(E)*1.4*y*(g/3+1),o.x+Math.cos(S)*1.4*y*(g/3+1),o.y+Math.sin(S)*1.4*y*(g/3+1)]};$r.findCompoundLoopPoints=function(t,e,r,a){var i=t._private.rscratch;i.edgeType="compound";var s=e.srcPos,o=e.tgtPos,u=e.srcW,f=e.srcH,d=e.tgtW,h=e.tgtH,p=t.pstyle("control-point-step-size").pfValue,g=t.pstyle("control-point-distances"),y=g?g.pfValue[0]:void 0,b=r,E=p;a&&(b=0,E=y);var S=50,T={x:s.x-u/2,y:s.y-f/2},C={x:o.x-d/2,y:o.y-h/2},N={x:Math.min(T.x,C.x),y:Math.min(T.y,C.y)},j=.5,M=Math.max(j,Math.log(u*rc)),D=Math.max(j,Math.log(d*rc));i.ctrlpts=[N.x,N.y-(1+Math.pow(S,1.12)/100)*E*(b/3+1)*M,N.x-(1+Math.pow(S,1.12)/100)*E*(b/3+1)*D,N.y]};$r.findStraightEdgePoints=function(t){t._private.rscratch.edgeType="straight"};$r.findBezierPoints=function(t,e,r,a,i){var s=t._private.rscratch,o=t.pstyle("control-point-step-size").pfValue,u=t.pstyle("control-point-distances"),f=t.pstyle("control-point-weights"),d=u&&f?Math.min(u.value.length,f.value.length):1,h=u?u.pfValue[0]:void 0,p=f.value[0],g=a;s.edgeType=g?"multibezier":"bezier",s.ctrlpts=[];for(var y=0;y<d;y++){var b=(.5-e.eles.length/2+r)*o*(i?-1:1),E=void 0,S=z0(b);g&&(h=u?u.pfValue[y]:o,p=f.value[y]),a?E=h:E=h!==void 0?S*h:void 0;var T=E!==void 0?E:b,C=1-p,N=p,j=this.findMidptPtsEtc(t,e),M=j.midptPts,D=j.vectorNormInverse,A={x:M.x1*C+M.x2*N,y:M.y1*C+M.y2*N};s.ctrlpts.push(A.x+D.x*T,A.y+D.y*T)}};$r.findTaxiPoints=function(t,e){var r=t._private.rscratch;r.edgeType="segments";var a="vertical",i="horizontal",s="leftward",o="rightward",u="downward",f="upward",d="auto",h=e.posPts,p=e.srcW,g=e.srcH,y=e.tgtW,b=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"),j=N.units==="%",M=N.pfValue,D=M<0,A=t.pstyle("taxi-turn-min-distance").pfValue,B=S?(p+y)/2:0,R=S?(g+b)/2:0,L=h.x2-h.x1,_=h.y2-h.y1,P=function(Q,ue){return Q>0?Math.max(Q-ue,0):Math.min(Q+ue,0)},q=P(L,B),F=P(_,R),Y=!1;C===d?T=Math.abs(q)>Math.abs(F)?i:a:C===f||C===u?(T=a,Y=!0):(C===s||C===o)&&(T=i,Y=!0);var U=T===a,z=U?F:q,H=U?_:L,X=z0(H),K=!1;!(Y&&(j||D))&&(C===u&&H<0||C===f&&H>0||C===s&&H>0||C===o&&H<0)&&(X*=-1,z=X*Math.abs(z),K=!0);var k;if(j){var G=M<0?1+M:M;k=G*z}else{var $=M<0?z:0;k=$+M*X}var J=function(Q){return Math.abs(Q)<A||Math.abs(Q)>=Math.abs(z)},ne=J(k),ee=J(Math.abs(z)-Math.abs(k)),ae=ne||ee;if(ae&&!K)if(U){var de=Math.abs(H)<=g/2,le=Math.abs(L)<=y/2;if(de){var re=(h.x1+h.x2)/2,Z=h.y1,oe=h.y2;r.segpts=[re,Z,re,oe]}else if(le){var ve=(h.y1+h.y2)/2,Ne=h.x1,Me=h.x2;r.segpts=[Ne,ve,Me,ve]}else r.segpts=[h.x1,h.y2]}else{var Je=Math.abs(H)<=p/2,Ce=Math.abs(_)<=b/2;if(Je){var ke=(h.y1+h.y2)/2,Le=h.x1,De=h.x2;r.segpts=[Le,ke,De,ke]}else if(Ce){var Ue=(h.x1+h.x2)/2,xe=h.y1,Ye=h.y2;r.segpts=[Ue,xe,Ue,Ye]}else r.segpts=[h.x2,h.y1]}else if(U){var Re=h.y1+k+(S?g/2*X:0),ye=h.x1,Ge=h.x2;r.segpts=[ye,Re,Ge,Re]}else{var rt=h.x1+k+(S?p/2*X:0),at=h.y1,ct=h.y2;r.segpts=[rt,at,rt,ct]}if(r.isRound){var et=t.pstyle("taxi-radius").value,qe=t.pstyle("radius-type").value[0]==="arc-radius";r.radii=new Array(r.segpts.length/2).fill(et),r.isArcRadius=new Array(r.segpts.length/2).fill(qe)}};$r.tryToCorrectInvalidPoints=function(t,e){var r=t._private.rscratch;if(r.edgeType==="bezier"){var a=e.srcPos,i=e.tgtPos,s=e.srcW,o=e.srcH,u=e.tgtW,f=e.tgtH,d=e.srcShape,h=e.tgtShape,p=e.srcCornerRadius,g=e.tgtCornerRadius,y=e.srcRs,b=e.tgtRs,E=!Oe(r.startX)||!Oe(r.startY),S=!Oe(r.arrowStartX)||!Oe(r.arrowStartY),T=!Oe(r.endX)||!Oe(r.endY),C=!Oe(r.arrowEndX)||!Oe(r.arrowEndY),N=3,j=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth,M=N*j,D=Ks({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.startX,y:r.startY}),A=D<M,B=Ks({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.endX,y:r.endY}),R=B<M,L=!1;if(E||S||A){L=!0;var _={x:r.ctrlpts[0]-a.x,y:r.ctrlpts[1]-a.y},P=Math.sqrt(_.x*_.x+_.y*_.y),q={x:_.x/P,y:_.y/P},F=Math.max(s,o),Y={x:r.ctrlpts[0]+q.x*2*F,y:r.ctrlpts[1]+q.y*2*F},U=d.intersectLine(a.x,a.y,s,o,Y.x,Y.y,0,p,y);A?(r.ctrlpts[0]=r.ctrlpts[0]+q.x*(M-D),r.ctrlpts[1]=r.ctrlpts[1]+q.y*(M-D)):(r.ctrlpts[0]=U[0]+q.x*M,r.ctrlpts[1]=U[1]+q.y*M)}if(T||C||R){L=!0;var z={x:r.ctrlpts[0]-i.x,y:r.ctrlpts[1]-i.y},H=Math.sqrt(z.x*z.x+z.y*z.y),X={x:z.x/H,y:z.y/H},K=Math.max(s,o),k={x:r.ctrlpts[0]+X.x*2*K,y:r.ctrlpts[1]+X.y*2*K},G=h.intersectLine(i.x,i.y,u,f,k.x,k.y,0,g,b);R?(r.ctrlpts[0]=r.ctrlpts[0]+X.x*(M-B),r.ctrlpts[1]=r.ctrlpts[1]+X.y*(M-B)):(r.ctrlpts[0]=G[0]+X.x*M,r.ctrlpts[1]=G[1]+X.y*M)}L&&this.findEndpoints(t)}};$r.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 r=0;r+1<e.ctrlpts.length;r+=2)e.allpts.push(e.ctrlpts[r],e.ctrlpts[r+1]),r+3<e.ctrlpts.length&&e.allpts.push((e.ctrlpts[r]+e.ctrlpts[r+2])/2,(e.ctrlpts[r+1]+e.ctrlpts[r+3])/2);e.allpts.push(e.endX,e.endY);var a,i;e.ctrlpts.length/2%2===0?(a=e.allpts.length/2-1,e.midX=e.allpts[a],e.midY=e.allpts[a+1]):(a=e.allpts.length/2-3,i=.5,e.midX=Or(e.allpts[a],e.allpts[a+2],e.allpts[a+4],i),e.midY=Or(e.allpts[a+1],e.allpts[a+3],e.allpts[a+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(X0({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 f=e.segpts.length/2,d=f-2;e.midX=(e.segpts[d]+e.segpts[f])/2,e.midY=(e.segpts[d+1]+e.segpts[f+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]},g=e.roundCorners[h/2];if(g.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 b=[p.x-g.cx,p.y-g.cy],E=g.radius/Math.sqrt(Math.pow(b[0],2)+Math.pow(b[1],2));b=b.map(function(S){return S*E}),e.midX=g.cx+b[0],e.midY=g.cy+b[1],e.midVector=b}}}}};$r.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."))};$r.findEdgeControlPoints=function(t){var e=this;if(!(!t||t.length===0)){for(var r=this,a=r.cy,i=a.hasCompoundNodes(),s=new Gn,o=function(R,L){return[].concat(Od(R),[L?1:0]).join("-")},u=[],f=[],d=0;d<t.length;d++){var h=t[d],p=h._private,g=h.pstyle("curve-style").value;if(!(h.removed()||!h.takesUpSpace())){if(g==="haystack"){f.push(h);continue}var y=g==="unbundled-bezier"||Ii(g,"segments")||g==="straight"||g==="straight-triangle"||Ii(g,"taxi"),b=g==="unbundled-bezier"||g==="bezier",E=p.source,S=p.target,T=E.poolIndex(),C=S.poolIndex(),N=[T,C].sort(),j=o(N,y),M=s.get(j);M==null&&(M={eles:[]},u.push({pairId:N,edgeIsUnbundled:y}),s.set(j,M)),M.eles.push(h),y&&(M.hasUnbundled=!0),b&&(M.hasBezier=!0)}}for(var D=function(){var R=u[A],L=R.pairId,_=R.edgeIsUnbundled,P=o(L,_),q=s.get(P),F;if(!q.hasUnbundled){var Y=q.eles[0].parallelEdges().filter(function(qe){return qe.isBundledBezier()});B0(q.eles),Y.forEach(function(qe){return q.eles.push(qe)}),q.eles.sort(function(qe,we){return qe.poolIndex()-we.poolIndex()})}var U=q.eles[0],z=U.source(),H=U.target();if(z.poolIndex()>H.poolIndex()){var X=z;z=H,H=X}var K=q.srcPos=z.position(),k=q.tgtPos=H.position(),G=q.srcW=z.outerWidth(),$=q.srcH=z.outerHeight(),J=q.tgtW=H.outerWidth(),ne=q.tgtH=H.outerHeight(),ee=q.srcShape=r.nodeShapes[e.getNodeShape(z)],ae=q.tgtShape=r.nodeShapes[e.getNodeShape(H)],de=q.srcCornerRadius=z.pstyle("corner-radius").value==="auto"?"auto":z.pstyle("corner-radius").pfValue,le=q.tgtCornerRadius=H.pstyle("corner-radius").value==="auto"?"auto":H.pstyle("corner-radius").pfValue,re=q.tgtRs=H._private.rscratch,Z=q.srcRs=z._private.rscratch;q.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var oe=0;oe<q.eles.length;oe++){var ve=q.eles[oe],Ne=ve[0]._private.rscratch,Me=ve.pstyle("curve-style").value,Je=Me==="unbundled-bezier"||Ii(Me,"segments")||Ii(Me,"taxi"),Ce=!z.same(ve.source());if(!q.calculatedIntersection&&z!==H&&(q.hasBezier||q.hasUnbundled)){q.calculatedIntersection=!0;var ke=ee.intersectLine(K.x,K.y,G,$,k.x,k.y,0,de,Z),Le=q.srcIntn=ke,De=ae.intersectLine(k.x,k.y,J,ne,K.x,K.y,0,le,re),Ue=q.tgtIntn=De,xe=q.intersectionPts={x1:ke[0],x2:De[0],y1:ke[1],y2:De[1]},Ye=q.posPts={x1:K.x,x2:k.x,y1:K.y,y2:k.y},Re=De[1]-ke[1],ye=De[0]-ke[0],Ge=Math.sqrt(ye*ye+Re*Re);Oe(Ge)&&Ge>=EB||(Ge=Math.sqrt(Math.max(ye*ye,rc)+Math.max(Re*Re,rc)));var rt=q.vector={x:ye,y:Re},at=q.vectorNorm={x:rt.x/Ge,y:rt.y/Ge},ct={x:-at.y,y:at.x};q.nodesOverlap=!Oe(Ge)||ae.checkPoint(ke[0],ke[1],0,J,ne,k.x,k.y,le,re)||ee.checkPoint(De[0],De[1],0,G,$,K.x,K.y,de,Z),q.vectorNormInverse=ct,F={nodesOverlap:q.nodesOverlap,dirCounts:q.dirCounts,calculatedIntersection:!0,hasBezier:q.hasBezier,hasUnbundled:q.hasUnbundled,eles:q.eles,srcPos:k,srcRs:re,tgtPos:K,tgtRs:Z,srcW:J,srcH:ne,tgtW:G,tgtH:$,srcIntn:Ue,tgtIntn:Le,srcShape:ae,tgtShape:ee,posPts:{x1:Ye.x2,y1:Ye.y2,x2:Ye.x1,y2:Ye.y1},intersectionPts:{x1:xe.x2,y1:xe.y2,x2:xe.x1,y2:xe.y1},vector:{x:-rt.x,y:-rt.y},vectorNorm:{x:-at.x,y:-at.y},vectorNormInverse:{x:-ct.x,y:-ct.y}}}var et=Ce?F:q;Ne.nodesOverlap=et.nodesOverlap,Ne.srcIntn=et.srcIntn,Ne.tgtIntn=et.tgtIntn,Ne.isRound=Me.startsWith("round"),i&&(z.isParent()||z.isChild()||H.isParent()||H.isChild())&&(z.parents().anySame(H)||H.parents().anySame(z)||z.same(H)&&z.isParent())?e.findCompoundLoopPoints(ve,et,oe,Je):z===H?e.findLoopPoints(ve,et,oe,Je):Me.endsWith("segments")?e.findSegmentsPoints(ve,et):Me.endsWith("taxi")?e.findTaxiPoints(ve,et):Me==="straight"||!Je&&q.eles.length%2===1&&oe===Math.floor(q.eles.length/2)?e.findStraightEdgePoints(ve):e.findBezierPoints(ve,et,oe,Je,Ce),e.findEndpoints(ve),e.tryToCorrectInvalidPoints(ve,et),e.checkForInvalidEdgeWarning(ve),e.storeAllpts(ve),e.storeEdgeProjections(ve),e.calculateArrowAngles(ve),e.recalculateEdgeLabelProjections(ve),e.calculateLabelAngles(ve)}},A=0;A<u.length;A++)D();this.findHaystackPoints(f)}};function HC(t){var e=[];if(t!=null){for(var r=0;r<t.length;r+=2){var a=t[r],i=t[r+1];e.push({x:a,y:i})}return e}}$r.getSegmentPoints=function(t){var e=t[0]._private.rscratch;this.recalculateRenderedStyle(t);var r=e.edgeType;if(r==="segments")return HC(e.segpts)};$r.getControlPoints=function(t){var e=t[0]._private.rscratch;this.recalculateRenderedStyle(t);var r=e.edgeType;if(r==="bezier"||r==="multibezier"||r==="self"||r==="compound")return HC(e.ctrlpts)};$r.getEdgeMidpoint=function(t){var e=t[0]._private.rscratch;return this.recalculateRenderedStyle(t),{x:e.midX,y:e.midY}};var Nc={};Nc.manualEndptToPx=function(t,e){var r=this,a=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]+=a.x,u[1]+=a.y,u}else{var f=e.pfValue[0];f=-Math.PI/2+f;var d=2*Math.max(i,s),h=[a.x+Math.cos(f)*d,a.y+Math.sin(f)*d];return r.nodeShapes[this.getNodeShape(t)].intersectLine(a.x,a.y,i,s,h[0],h[1],0,t.pstyle("corner-radius").value==="auto"?"auto":t.pstyle("corner-radius").pfValue,o)}};Nc.findEndpoints=function(t){var e,r,a,i,s=this,o,u=t.source()[0],f=t.target()[0],d=u.position(),h=f.position(),p=t.pstyle("target-arrow-shape").value,g=t.pstyle("source-arrow-shape").value,y=t.pstyle("target-distance-from-node").pfValue,b=t.pstyle("source-distance-from-node").pfValue,E=u._private.rscratch,S=f._private.rscratch,T=t.pstyle("curve-style").value,C=t._private.rscratch,N=C.edgeType,j=Ii(T,"taxi"),M=N==="self"||N==="compound",D=N==="bezier"||N==="multibezier"||M,A=N!=="bezier",B=N==="straight"||N==="segments",R=N==="segments",L=D||A||B,_=M||j,P=t.pstyle("source-endpoint"),q=_?"outside-to-node":P.value,F=u.pstyle("corner-radius").value==="auto"?"auto":u.pstyle("corner-radius").pfValue,Y=t.pstyle("target-endpoint"),U=_?"outside-to-node":Y.value,z=f.pstyle("corner-radius").value==="auto"?"auto":f.pstyle("corner-radius").pfValue;C.srcManEndpt=P,C.tgtManEndpt=Y;var H,X,K,k,G=(e=(Y==null||(r=Y.pfValue)===null||r===void 0?void 0:r.length)===2?Y.pfValue:null)!==null&&e!==void 0?e:[0,0],$=(a=(P==null||(i=P.pfValue)===null||i===void 0?void 0:i.length)===2?P.pfValue:null)!==null&&a!==void 0?a:[0,0];if(D){var J=[C.ctrlpts[0],C.ctrlpts[1]],ne=A?[C.ctrlpts[C.ctrlpts.length-2],C.ctrlpts[C.ctrlpts.length-1]]:J;H=ne,X=J}else if(B){var ee=R?C.segpts.slice(0,2):[h.x+G[0],h.y+G[1]],ae=R?C.segpts.slice(C.segpts.length-2):[d.x+$[0],d.y+$[1]];H=ae,X=ee}if(U==="inside-to-node")o=[h.x,h.y];else if(Y.units)o=this.manualEndptToPx(f,Y);else if(U==="outside-to-line")o=C.tgtIntn;else if(U==="outside-to-node"||U==="outside-to-node-or-label"?K=H:(U==="outside-to-line"||U==="outside-to-line-or-label")&&(K=[d.x,d.y]),o=s.nodeShapes[this.getNodeShape(f)].intersectLine(h.x,h.y,f.outerWidth(),f.outerHeight(),K[0],K[1],0,z,S),U==="outside-to-node-or-label"||U==="outside-to-line-or-label"){var de=f._private.rscratch,le=de.labelWidth,re=de.labelHeight,Z=de.labelX,oe=de.labelY,ve=le/2,Ne=re/2,Me=f.pstyle("text-valign").value;Me==="top"?oe-=Ne:Me==="bottom"&&(oe+=Ne);var Je=f.pstyle("text-halign").value;Je==="left"?Z-=ve:Je==="right"&&(Z+=ve);var Ce=Zu(K[0],K[1],[Z-ve,oe-Ne,Z+ve,oe-Ne,Z+ve,oe+Ne,Z-ve,oe+Ne],h.x,h.y);if(Ce.length>0){var ke=d,Le=Ds(ke,Zl(o)),De=Ds(ke,Zl(Ce)),Ue=Le;if(De<Le&&(o=Ce,Ue=De),Ce.length>2){var xe=Ds(ke,{x:Ce[2],y:Ce[3]});xe<Ue&&(o=[Ce[2],Ce[3]])}}}var Ye=Wf(o,H,s.arrowShapes[p].spacing(t)+y),Re=Wf(o,H,s.arrowShapes[p].gap(t)+y);if(C.endX=Re[0],C.endY=Re[1],C.arrowEndX=Ye[0],C.arrowEndY=Ye[1],q==="inside-to-node")o=[d.x,d.y];else if(P.units)o=this.manualEndptToPx(u,P);else if(q==="outside-to-line")o=C.srcIntn;else if(q==="outside-to-node"||q==="outside-to-node-or-label"?k=X:(q==="outside-to-line"||q==="outside-to-line-or-label")&&(k=[h.x,h.y]),o=s.nodeShapes[this.getNodeShape(u)].intersectLine(d.x,d.y,u.outerWidth(),u.outerHeight(),k[0],k[1],0,F,E),q==="outside-to-node-or-label"||q==="outside-to-line-or-label"){var ye=u._private.rscratch,Ge=ye.labelWidth,rt=ye.labelHeight,at=ye.labelX,ct=ye.labelY,et=Ge/2,qe=rt/2,we=u.pstyle("text-valign").value;we==="top"?ct-=qe:we==="bottom"&&(ct+=qe);var Q=u.pstyle("text-halign").value;Q==="left"?at-=et:Q==="right"&&(at+=et);var ue=Zu(k[0],k[1],[at-et,ct-qe,at+et,ct-qe,at+et,ct+qe,at-et,ct+qe],d.x,d.y);if(ue.length>0){var ge=h,pe=Ds(ge,Zl(o)),Se=Ds(ge,Zl(ue)),_e=pe;if(Se<pe&&(o=[ue[0],ue[1]],_e=Se),ue.length>2){var Ae=Ds(ge,{x:ue[2],y:ue[3]});Ae<_e&&(o=[ue[2],ue[3]])}}}var He=Wf(o,X,s.arrowShapes[g].spacing(t)+b),ze=Wf(o,X,s.arrowShapes[g].gap(t)+b);C.startX=ze[0],C.startY=ze[1],C.arrowStartX=He[0],C.arrowStartY=He[1],L&&(!Oe(C.startX)||!Oe(C.startY)||!Oe(C.endX)||!Oe(C.endY)?C.badLine=!0:C.badLine=!1)};Nc.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}}};Nc.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 $0={};function TB(t,e,r){for(var a=function(d,h,p,g){return Or(d,h,p,g)},i=e._private,s=i.rstyle.bezierPts,o=0;o<t.bezierProjPcts.length;o++){var u=t.bezierProjPcts[o];s.push({x:a(r[0],r[2],r[4],u),y:a(r[1],r[3],r[5],u)})}}$0.storeEdgeProjections=function(t){var e=t._private,r=e.rscratch,a=r.edgeType;if(e.rstyle.bezierPts=null,e.rstyle.linePts=null,e.rstyle.haystackPts=null,a==="multibezier"||a==="bezier"||a==="self"||a==="compound"){e.rstyle.bezierPts=[];for(var i=0;i+5<r.allpts.length;i+=4)TB(this,t,r.allpts.slice(i,i+6))}else if(a==="segments")for(var s=e.rstyle.linePts=[],i=0;i+1<r.allpts.length;i+=2)s.push({x:r.allpts[i],y:r.allpts[i+1]});else if(a==="haystack"){var o=r.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};$0.recalculateEdgeProjections=function(t){this.findEdgeControlPoints(t)};var xn={};xn.recalculateNodeLabelProjection=function(t){var e=t.pstyle("label").strValue;if(!$i(e)){var r,a,i=t._private,s=t.width(),o=t.height(),u=t.padding(),f=t.position(),d=t.pstyle("text-halign").strValue,h=t.pstyle("text-valign").strValue,p=i.rscratch,g=i.rstyle;switch(d){case"left":r=f.x-s/2-u;break;case"right":r=f.x+s/2+u;break;default:r=f.x}switch(h){case"top":a=f.y-o/2-u;break;case"bottom":a=f.y+o/2+u;break;default:a=f.y}p.labelX=r,p.labelY=a,g.labelX=r,g.labelY=a,this.calculateLabelAngles(t),this.applyLabelDimensions(t)}};var GC=function(e,r){var a=Math.atan(r/e);return e===0&&a<0&&(a=a*-1),a},QC=function(e,r){var a=r.x-e.x,i=r.y-e.y;return GC(a,i)},CB=function(e,r,a,i){var s=$u(0,i-.001,1),o=$u(0,i+.001,1),u=ro(e,r,a,s),f=ro(e,r,a,o);return QC(u,f)};xn.recalculateEdgeLabelProjections=function(t){var e,r=t._private,a=r.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:a.midX,y:a.midY};var o=function(p,g,y){qn(r.rscratch,p,g,y),qn(r.rstyle,p,g,y)};o("labelX",null,e.x),o("labelY",null,e.y);var u=GC(a.midDispX,a.midDispY);o("labelAutoAngle",null,u);var f=function(){if(f.cache)return f.cache;for(var p=[],g=0;g+5<a.allpts.length;g+=4){var y={x:a.allpts[g],y:a.allpts[g+1]},b={x:a.allpts[g+2],y:a.allpts[g+3]},E={x:a.allpts[g+4],y:a.allpts[g+5]};p.push({p0:y,p1:b,p2:E,startDist:0,length:0,segments:[]})}var S=r.rstyle.bezierPts,T=i.bezierProjPcts.length;function C(A,B,R,L,_){var P=Ks(B,R),q=A.segments[A.segments.length-1],F={p0:B,p1:R,t0:L,t1:_,startDist:q?q.startDist+q.length:0,length:P};A.segments.push(F),A.length+=P}for(var N=0;N<p.length;N++){var j=p[N],M=p[N-1];M&&(j.startDist=M.startDist+M.length),C(j,j.p0,S[N*T],0,i.bezierProjPcts[0]);for(var D=0;D<T-1;D++)C(j,S[N*T+D],S[N*T+D+1],i.bezierProjPcts[D],i.bezierProjPcts[D+1]);C(j,S[N*T+T-1],j.p2,i.bezierProjPcts[T-1],1)}return f.cache=p},d=function(p){var g,y=p==="source";if(s[p]){var b=t.pstyle(p+"-text-offset").pfValue;switch(a.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var E=f(),S,T=0,C=0,N=0;N<E.length;N++){for(var j=E[y?N:E.length-1-N],M=0;M<j.segments.length;M++){var D=j.segments[y?M:j.segments.length-1-M],A=N===E.length-1&&M===j.segments.length-1;if(T=C,C+=D.length,C>=b||A){S={cp:j,segment:D};break}}if(S)break}var B=S.cp,R=S.segment,L=(b-T)/R.length,_=R.t1-R.t0,P=y?R.t0+_*L:R.t1-_*L;P=$u(0,P,1),e=ro(B.p0,B.p1,B.p2,P),g=CB(B.p0,B.p1,B.p2,P);break}case"straight":case"segments":case"haystack":{for(var q=0,F,Y,U,z,H=a.allpts.length,X=0;X+3<H&&(y?(U={x:a.allpts[X],y:a.allpts[X+1]},z={x:a.allpts[X+2],y:a.allpts[X+3]}):(U={x:a.allpts[H-2-X],y:a.allpts[H-1-X]},z={x:a.allpts[H-4-X],y:a.allpts[H-3-X]}),F=Ks(U,z),Y=q,q+=F,!(q>=b));X+=2);var K=b-Y,k=K/F;k=$u(0,k,1),e=YR(U,z,k),g=QC(U,z);break}}o("labelX",p,e.x),o("labelY",p,e.y),o("labelAutoAngle",p,g)}};d("source"),d("target"),this.applyLabelDimensions(t)}};xn.applyLabelDimensions=function(t){this.applyPrefixedLabelDimensions(t),t.isEdge()&&(this.applyPrefixedLabelDimensions(t,"source"),this.applyPrefixedLabelDimensions(t,"target"))};xn.applyPrefixedLabelDimensions=function(t,e){var r=t._private,a=this.getLabelText(t,e),i=Ys(a,t._private.labelDimsKey);if(ha(r.rscratch,"prefixedLabelDimsKey",e)!==i){qn(r.rscratch,"prefixedLabelDimsKey",e,i);var s=this.calculateLabelDimensions(t,a),o=t.pstyle("line-height").pfValue,u=t.pstyle("text-wrap").strValue,f=ha(r.rscratch,"labelWrapCachedLines",e)||[],d=u!=="wrap"?1:Math.max(f.length,1),h=s.height/d,p=h*o,g=s.width,y=s.height+(d-1)*(o-1)*h;qn(r.rstyle,"labelWidth",e,g),qn(r.rscratch,"labelWidth",e,g),qn(r.rstyle,"labelHeight",e,y),qn(r.rscratch,"labelHeight",e,y),qn(r.rscratch,"labelLineHeight",e,p)}};xn.getLabelText=function(t,e){var r=t._private,a=e?e+"-":"",i=t.pstyle(a+"label").strValue,s=t.pstyle("text-transform").value,o=function($,J){return J?(qn(r.rscratch,$,e,J),J):ha(r.rscratch,$,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 f=o("labelKey");if(f!=null&&o("labelWrapKey")===f)return o("labelWrapCachedText");for(var d="",h=i.split(`
|
|
93
|
+
`),p=t.pstyle("text-max-width").pfValue,g=t.pstyle("text-overflow-wrap").value,y=g==="anywhere",b=[],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 j=T.split("").join(d);T=j}if(N>p){var M=T.matchAll(E),D="",A=0,B=pa(M),R;try{for(B.s();!(R=B.n()).done;){var L=R.value,_=L[0],P=T.substring(A,L.index);A=L.index+_.length;var q=D.length===0?P:D+P+_,F=this.calculateLabelDimensions(t,q),Y=F.width;Y<=p?D+=P+_:(D&&b.push(D),D=P+_)}}catch(G){B.e(G)}finally{B.f()}D.match(/^[\s\u200b]+$/)||b.push(D)}else b.push(T)}o("labelWrapCachedLines",b),i=o("labelWrapCachedText",b.join(`
|
|
94
|
+
`)),o("labelWrapKey",f)}else if(u==="ellipsis"){var U=t.pstyle("text-max-width").pfValue,z="",H="…",X=!1;if(this.calculateLabelDimensions(t,i).width<U)return i;for(var K=0;K<i.length;K++){var k=this.calculateLabelDimensions(t,z+i[K]+H).width;if(k>U)break;z+=i[K],K===i.length-1&&(X=!0)}return X||(z+=H),z}return i};xn.getLabelJustification=function(t){var e=t.pstyle("text-justification").strValue,r=t.pstyle("text-halign").strValue;if(e==="auto")if(t.isNode())switch(r){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return e};xn.calculateLabelDimensions=function(t,e){var r=this,a=r.cy.window(),i=a.document,s=0,o=t.pstyle("font-style").strValue,u=t.pstyle("font-size").pfValue,f=t.pstyle("font-family").strValue,d=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 g=h.style;g.position="absolute",g.left="-9999px",g.top="-9999px",g.zIndex="-1",g.visibility="hidden",g.pointerEvents="none"}p.font="".concat(o," ").concat(d," ").concat(u,"px ").concat(f);for(var y=0,b=0,E=e.split(`
|
|
95
|
+
`),S=0;S<E.length;S++){var T=E[S],C=p.measureText(T),N=Math.ceil(C.width),j=u;y=Math.max(N,y),b+=j}return y+=s,b+=s,{width:y,height:b}};xn.calculateLabelAngle=function(t,e){var r=t._private,a=r.rscratch,i=t.isEdge(),s=e?e+"-":"",o=t.pstyle(s+"text-rotation"),u=o.strValue;return u==="none"?0:i&&u==="autorotate"?a.labelAutoAngle:u==="autorotate"?0:o.pfValue};xn.calculateLabelAngles=function(t){var e=this,r=t.isEdge(),a=t._private,i=a.rscratch;i.labelAngle=e.calculateLabelAngle(t),r&&(i.sourceLabelAngle=e.calculateLabelAngle(t,"source"),i.targetLabelAngle=e.calculateLabelAngle(t,"target"))};var YC={},LS=28,zS=!1;YC.getNodeShape=function(t){var e=this,r=t.pstyle("shape").value;if(r==="cutrectangle"&&(t.width()<LS||t.height()<LS))return zS||(At("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),zS=!0),"rectangle";if(t.isParent())return r==="rectangle"||r==="roundrectangle"||r==="round-rectangle"||r==="cutrectangle"||r==="cut-rectangle"||r==="barrel"?r:"rectangle";if(r==="polygon"){var a=t.pstyle("shape-polygon-points").value;return e.nodeShapes.makePolygon(a).name}return r};var vh={};vh.registerCalculationListeners=function(){var t=this.cy,e=t.collection(),r=this,a=function(o){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(o),u)for(var f=0;f<o.length;f++){var d=o[f],h=d._private,p=h.rstyle;p.clean=!1,p.cleanConnected=!1}};r.binder(t).on("bounds.* dirty.*",function(o){var u=o.target;a(u)}).on("style.* background.*",function(o){var u=o.target;a(u,!1)});var i=function(o){if(o){var u=r.onUpdateEleCalcsFns;e.cleanStyle();for(var f=0;f<e.length;f++){var d=e[f],h=d._private.rstyle;d.isNode()&&!h.cleanConnected&&(a(d.connectedEdges()),h.cleanConnected=!0)}if(u)for(var p=0;p<u.length;p++){var g=u[p];g(o,e)}r.recalculateRenderedStyle(e),e=t.collection()}};r.flushRenderedStyleQueue=function(){i(!0)},r.beforeRender(i,r.beforeRenderPriorities.eleCalcs)};vh.onUpdateEleCalcs=function(t){var e=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];e.push(t)};vh.recalculateRenderedStyle=function(t,e){var r=function(j){return j._private.rstyle.cleanConnected};if(t.length!==0){var a=[],i=[];if(!this.destroyed){e===void 0&&(e=!0);for(var s=0;s<t.length;s++){var o=t[s],u=o._private,f=u.rstyle;o.isEdge()&&(!r(o.source())||!r(o.target()))&&(f.clean=!1),o.isEdge()&&o.isBundledBezier()&&o.parallelEdges().some(function(N){return!N._private.rstyle.clean&&N.isBundledBezier()})&&(f.clean=!1),!(e&&f.clean||o.removed())&&o.pstyle("display").value!=="none"&&(u.group==="nodes"?i.push(o):a.push(o),f.clean=!0)}for(var d=0;d<i.length;d++){var h=i[d],p=h._private,g=p.rstyle,y=h.position();this.recalculateNodeLabelProjection(h),g.nodeX=y.x,g.nodeY=y.y,g.nodeW=h.pstyle("width").pfValue,g.nodeH=h.pstyle("height").pfValue}this.recalculateEdgeProjections(a);for(var b=0;b<a.length;b++){var E=a[b],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 ph={};ph.updateCachedGrabbedEles=function(){var t=this.cachedZSortedEles;if(t){t.drag=[],t.nondrag=[];for(var e=[],r=0;r<t.length;r++){var a=t[r],i=a._private.rscratch;a.grabbed()&&!a.isParent()?e.push(a):i.inDragLayer?t.drag.push(a):t.nondrag.push(a)}for(var r=0;r<e.length;r++){var a=e[r];t.drag.push(a)}}};ph.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null};ph.getCachedZSortedEles=function(t){if(t||!this.cachedZSortedEles){var e=this.cy.mutableElements().toArray();e.sort(jC),e.interactive=e.filter(function(r){return r.interactive()}),this.cachedZSortedEles=e,this.updateCachedGrabbedEles()}else e=this.cachedZSortedEles;return e};var KC={};[al,qd,$r,Nc,$0,xn,YC,vh,ph].forEach(function(t){Ze(KC,t)});var XC={};XC.getCachedImage=function(t,e,r){var a=this,i=a.imageCache=a.imageCache||{},s=i[t];if(s)return s.image.complete||s.image.addEventListener("load",r),s.image;s=i[t]=i[t]||{};var o=s.image=new Image;o.addEventListener("load",r),o.addEventListener("error",function(){o.error=!0});var u="data:",f=t.substring(0,u.length).toLowerCase()===u;return f||(e=e==="null"?null:e,o.crossOrigin=e),o.src=t,o};var ko={};ko.registerBinding=function(t,e,r,a){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 f=this.binder(u);s.push(f.on.apply(f,i))}}return s}var f=this.binder(t);return f.on.apply(f,i)};ko.binder=function(t){var e=this,r=e.cy.window(),a=t===r||t===r.document||t===r.document.body||_M(t);if(e.supportsPassiveEvents==null){var i=!1;try{var s=Object.defineProperty({},"passive",{get:function(){return i=!0,!0}});r.addEventListener("test",null,s)}catch{}e.supportsPassiveEvents=i}var o=function(f,d,h){var p=Array.prototype.slice.call(arguments);return a&&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}};ko.nodeIsDraggable=function(t){return t&&t.isNode()&&!t.locked()&&t.grabbable()};ko.nodeIsGrabbable=function(t){return this.nodeIsDraggable(t)&&t.interactive()};ko.load=function(){var t=this,e=t.cy.window(),r=function(Q){return Q.selected()},a=function(Q){var ue=Q.getRootNode();if(ue&&ue.nodeType===11&&ue.host!==void 0)return ue},i=function(Q,ue,ge,pe){Q==null&&(Q=t.cy);for(var Se=0;Se<ue.length;Se++){var _e=ue[Se];Q.emit({originalEvent:ge,type:_e,position:pe})}},s=function(Q){return Q.shiftKey||Q.metaKey||Q.ctrlKey},o=function(Q,ue){var ge=!0;if(t.cy.hasCompoundNodes()&&Q&&Q.pannable())for(var pe=0;ue&&pe<ue.length;pe++){var Q=ue[pe];if(Q.isNode()&&Q.isParent()&&!Q.pannable()){ge=!1;break}}else ge=!0;return ge},u=function(Q){Q[0]._private.grabbed=!0},f=function(Q){Q[0]._private.grabbed=!1},d=function(Q){Q[0]._private.rscratch.inDragLayer=!0},h=function(Q){Q[0]._private.rscratch.inDragLayer=!1},p=function(Q){Q[0]._private.rscratch.isGrabTarget=!0},g=function(Q){Q[0]._private.rscratch.isGrabTarget=!1},y=function(Q,ue){var ge=ue.addToList,pe=ge.has(Q);!pe&&Q.grabbable()&&!Q.locked()&&(ge.merge(Q),u(Q))},b=function(Q,ue){if(Q.cy().hasCompoundNodes()&&!(ue.inDragLayer==null&&ue.addToList==null)){var ge=Q.descendants();ue.inDragLayer&&(ge.forEach(d),ge.connectedEdges().forEach(d)),ue.addToList&&y(ge,ue)}},E=function(Q,ue){ue=ue||{};var ge=Q.cy().hasCompoundNodes();ue.inDragLayer&&(Q.forEach(d),Q.neighborhood().stdFilter(function(pe){return!ge||pe.isEdge()}).forEach(d)),ue.addToList&&Q.forEach(function(pe){y(pe,ue)}),b(Q,ue),C(Q,{inDragLayer:ue.inDragLayer}),t.updateCachedGrabbedEles()},S=E,T=function(Q){Q&&(t.getCachedZSortedEles().forEach(function(ue){f(ue),h(ue),g(ue)}),t.updateCachedGrabbedEles())},C=function(Q,ue){if(!(ue.inDragLayer==null&&ue.addToList==null)&&Q.cy().hasCompoundNodes()){var ge=Q.ancestors().orphans();if(!ge.same(Q)){var pe=ge.descendants().spawnSelf().merge(ge).unmerge(Q).unmerge(Q.descendants()),Se=pe.connectedEdges();ue.inDragLayer&&(Se.forEach(d),pe.forEach(d)),ue.addToList&&pe.forEach(function(_e){y(_e,ue)})}}},N=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},j=typeof MutationObserver<"u",M=typeof ResizeObserver<"u";j?(t.removeObserver=new MutationObserver(function(we){for(var Q=0;Q<we.length;Q++){var ue=we[Q],ge=ue.removedNodes;if(ge)for(var pe=0;pe<ge.length;pe++){var Se=ge[pe];if(Se===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=Sc(function(){t.cy.resize()},100);j&&(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 A=function(Q,ue){for(;Q!=null;)ue(Q),Q=Q.parentNode},B=function(){t.invalidateContainerClientCoordsCache()};A(t.container,function(we){t.registerBinding(we,"transitionend",B),t.registerBinding(we,"animationend",B),t.registerBinding(we,"scroll",B)}),t.registerBinding(t.container,"contextmenu",function(we){we.preventDefault()});var R=function(){return t.selection[4]!==0},L=function(Q){for(var ue=t.findContainerClientCoords(),ge=ue[0],pe=ue[1],Se=ue[2],_e=ue[3],Ae=Q.touches?Q.touches:[Q],He=!1,ze=0;ze<Ae.length;ze++){var Ke=Ae[ze];if(ge<=Ke.clientX&&Ke.clientX<=ge+Se&&pe<=Ke.clientY&&Ke.clientY<=pe+_e){He=!0;break}}if(!He)return!1;for(var nt=t.container,it=Q.target,Ve=it.parentNode,ft=!1;Ve;){if(Ve===nt){ft=!0;break}Ve=Ve.parentNode}return!!ft};t.registerBinding(t.container,"mousedown",function(Q){if(L(Q)&&!(t.hoverData.which===1&&Q.which!==1)){Q.preventDefault(),N(),t.hoverData.capture=!0,t.hoverData.which=Q.which;var ue=t.cy,ge=[Q.clientX,Q.clientY],pe=t.projectIntoViewport(ge[0],ge[1]),Se=t.selection,_e=t.findNearestElements(pe[0],pe[1],!0,!1),Ae=_e[0],He=t.dragData.possibleDragElements;t.hoverData.mdownPos=pe,t.hoverData.mdownGPos=ge;var ze=function(ot){return{originalEvent:Q,type:ot,position:{x:pe[0],y:pe[1]}}},Ke=function(){t.hoverData.tapholdCancelled=!1,clearTimeout(t.hoverData.tapholdTimeout),t.hoverData.tapholdTimeout=setTimeout(function(){if(!t.hoverData.tapholdCancelled){var ot=t.hoverData.down;ot?ot.emit(ze("taphold")):ue.emit(ze("taphold"))}},t.tapholdDuration)};if(Q.which==3){t.hoverData.cxtStarted=!0;var nt={originalEvent:Q,type:"cxttapstart",position:{x:pe[0],y:pe[1]}};Ae?(Ae.activate(),Ae.emit(nt),t.hoverData.down=Ae):ue.emit(nt),t.hoverData.downTime=new Date().getTime(),t.hoverData.cxtDragged=!1}else if(Q.which==1){Ae&&Ae.activate();{if(Ae!=null&&t.nodeIsGrabbable(Ae)){var it=function(ot){ot.emit(ze("grab"))};if(p(Ae),!Ae.selected())He=t.dragData.possibleDragElements=ue.collection(),S(Ae,{addToList:He}),Ae.emit(ze("grabon")).emit(ze("grab"));else{He=t.dragData.possibleDragElements=ue.collection();var Ve=ue.$(function(ft){return ft.isNode()&&ft.selected()&&t.nodeIsGrabbable(ft)});E(Ve,{addToList:He}),Ae.emit(ze("grabon")),Ve.forEach(it)}t.redrawHint("eles",!0),t.redrawHint("drag",!0)}t.hoverData.down=Ae,t.hoverData.downs=_e,t.hoverData.downTime=new Date().getTime()}i(Ae,["mousedown","tapstart","vmousedown"],Q,{x:pe[0],y:pe[1]}),Ae==null?(Se[4]=1,t.data.bgActivePosistion={x:pe[0],y:pe[1]},t.redrawHint("select",!0),t.redraw()):Ae.pannable()&&(Se[4]=1),Ke()}Se[0]=Se[2]=pe[0],Se[1]=Se[3]=pe[1]}},!1);var _=a(t.container);t.registerBinding([e,_],"mousemove",function(Q){var ue=t.hoverData.capture;if(!(!ue&&!L(Q))){var ge=!1,pe=t.cy,Se=pe.zoom(),_e=[Q.clientX,Q.clientY],Ae=t.projectIntoViewport(_e[0],_e[1]),He=t.hoverData.mdownPos,ze=t.hoverData.mdownGPos,Ke=t.selection,nt=null;!t.hoverData.draggingEles&&!t.hoverData.dragging&&!t.hoverData.selecting&&(nt=t.findNearestElement(Ae[0],Ae[1],!0,!1));var it=t.hoverData.last,Ve=t.hoverData.down,ft=[Ae[0]-Ke[2],Ae[1]-Ke[3]],ot=t.dragData.possibleDragElements,Yt;if(ze){var Rt=_e[0]-ze[0],kr=Rt*Rt,Kt=_e[1]-ze[1],nr=Kt*Kt,Wt=kr+nr;t.hoverData.isOverThresholdDrag=Yt=Wt>=t.desktopTapThreshold2}var ir=s(Q);Yt&&(t.hoverData.tapholdCancelled=!0);var ja=function(){var Nr=t.hoverData.dragDelta=t.hoverData.dragDelta||[];Nr.length===0?(Nr.push(ft[0]),Nr.push(ft[1])):(Nr[0]+=ft[0],Nr[1]+=ft[1])};ge=!0,i(nt,["mousemove","vmousemove","tapdrag"],Q,{x:Ae[0],y:Ae[1]});var Xt=function(Nr){return{originalEvent:Q,type:Nr,position:{x:Ae[0],y:Ae[1]}}},Da=function(){t.data.bgActivePosistion=void 0,t.hoverData.selecting||pe.emit(Xt("boxstart")),Ke[4]=1,t.hoverData.selecting=!0,t.redrawHint("select",!0),t.redraw()};if(t.hoverData.which===3){if(Yt){var Er=Xt("cxtdrag");Ve?Ve.emit(Er):pe.emit(Er),t.hoverData.cxtDragged=!0,(!t.hoverData.cxtOver||nt!==t.hoverData.cxtOver)&&(t.hoverData.cxtOver&&t.hoverData.cxtOver.emit(Xt("cxtdragout")),t.hoverData.cxtOver=nt,nt&&nt.emit(Xt("cxtdragover")))}}else if(t.hoverData.dragging){if(ge=!0,pe.panningEnabled()&&pe.userPanningEnabled()){var Ht;if(t.hoverData.justStartedPan){var mr=t.hoverData.mdownPos;Ht={x:(Ae[0]-mr[0])*Se,y:(Ae[1]-mr[1])*Se},t.hoverData.justStartedPan=!1}else Ht={x:ft[0]*Se,y:ft[1]*Se};pe.panBy(Ht),pe.emit(Xt("dragpan")),t.hoverData.dragged=!0}Ae=t.projectIntoViewport(Q.clientX,Q.clientY)}else if(Ke[4]==1&&(Ve==null||Ve.pannable())){if(Yt){if(!t.hoverData.dragging&&pe.boxSelectionEnabled()&&(ir||!pe.panningEnabled()||!pe.userPanningEnabled()))Da();else if(!t.hoverData.selecting&&pe.panningEnabled()&&pe.userPanningEnabled()){var aa=o(Ve,t.hoverData.downs);aa&&(t.hoverData.dragging=!0,t.hoverData.justStartedPan=!0,Ke[4]=0,t.data.bgActivePosistion=Zl(He),t.redrawHint("select",!0),t.redraw())}Ve&&Ve.pannable()&&Ve.active()&&Ve.unactivate()}}else{if(Ve&&Ve.pannable()&&Ve.active()&&Ve.unactivate(),(!Ve||!Ve.grabbed())&&nt!=it&&(it&&i(it,["mouseout","tapdragout"],Q,{x:Ae[0],y:Ae[1]}),nt&&i(nt,["mouseover","tapdragover"],Q,{x:Ae[0],y:Ae[1]}),t.hoverData.last=nt),Ve)if(Yt){if(pe.boxSelectionEnabled()&&ir)Ve&&Ve.grabbed()&&(T(ot),Ve.emit(Xt("freeon")),ot.emit(Xt("free")),t.dragData.didDrag&&(Ve.emit(Xt("dragfreeon")),ot.emit(Xt("dragfree")))),Da();else if(Ve&&Ve.grabbed()&&t.nodeIsDraggable(Ve)){var Tr=!t.dragData.didDrag;Tr&&t.redrawHint("eles",!0),t.dragData.didDrag=!0,t.hoverData.draggingEles||E(ot,{inDragLayer:!0});var Cr={x:0,y:0};if(Oe(ft[0])&&Oe(ft[1])&&(Cr.x+=ft[0],Cr.y+=ft[1],Tr)){var Fr=t.hoverData.dragDelta;Fr&&Oe(Fr[0])&&Oe(Fr[1])&&(Cr.x+=Fr[0],Cr.y+=Fr[1])}t.hoverData.draggingEles=!0,ot.silentShift(Cr).emit(Xt("position")).emit(Xt("drag")),t.redrawHint("drag",!0),t.redraw()}}else ja();ge=!0}if(Ke[2]=Ae[0],Ke[3]=Ae[1],ge)return Q.stopPropagation&&Q.stopPropagation(),Q.preventDefault&&Q.preventDefault(),!1}},!1);var P,q,F;t.registerBinding(e,"mouseup",function(Q){if(!(t.hoverData.which===1&&Q.which!==1&&t.hoverData.capture)){var ue=t.hoverData.capture;if(ue){t.hoverData.capture=!1;var ge=t.cy,pe=t.projectIntoViewport(Q.clientX,Q.clientY),Se=t.selection,_e=t.findNearestElement(pe[0],pe[1],!0,!1),Ae=t.dragData.possibleDragElements,He=t.hoverData.down,ze=s(Q);t.data.bgActivePosistion&&(t.redrawHint("select",!0),t.redraw()),t.hoverData.tapholdCancelled=!0,t.data.bgActivePosistion=void 0,He&&He.unactivate();var Ke=function(Rt){return{originalEvent:Q,type:Rt,position:{x:pe[0],y:pe[1]}}};if(t.hoverData.which===3){var nt=Ke("cxttapend");if(He?He.emit(nt):ge.emit(nt),!t.hoverData.cxtDragged){var it=Ke("cxttap");He?He.emit(it):ge.emit(it)}t.hoverData.cxtDragged=!1,t.hoverData.which=null}else if(t.hoverData.which===1){if(i(_e,["mouseup","tapend","vmouseup"],Q,{x:pe[0],y:pe[1]}),!t.dragData.didDrag&&!t.hoverData.dragged&&!t.hoverData.selecting&&!t.hoverData.isOverThresholdDrag&&(i(He,["click","tap","vclick"],Q,{x:pe[0],y:pe[1]}),q=!1,Q.timeStamp-F<=ge.multiClickDebounceTime()?(P&&clearTimeout(P),q=!0,F=null,i(He,["dblclick","dbltap","vdblclick"],Q,{x:pe[0],y:pe[1]})):(P=setTimeout(function(){q||i(He,["oneclick","onetap","voneclick"],Q,{x:pe[0],y:pe[1]})},ge.multiClickDebounceTime()),F=Q.timeStamp)),He==null&&!t.dragData.didDrag&&!t.hoverData.selecting&&!t.hoverData.dragged&&!s(Q)&&(ge.$(r).unselect(["tapunselect"]),Ae.length>0&&t.redrawHint("eles",!0),t.dragData.possibleDragElements=Ae=ge.collection()),_e==He&&!t.dragData.didDrag&&!t.hoverData.selecting&&_e!=null&&_e._private.selectable&&(t.hoverData.dragging||(ge.selectionType()==="additive"||ze?_e.selected()?_e.unselect(["tapunselect"]):_e.select(["tapselect"]):ze||(ge.$(r).unmerge(_e).unselect(["tapunselect"]),_e.select(["tapselect"]))),t.redrawHint("eles",!0)),t.hoverData.selecting){var Ve=ge.collection(t.getAllInBox(Se[0],Se[1],Se[2],Se[3]));t.redrawHint("select",!0),Ve.length>0&&t.redrawHint("eles",!0),ge.emit(Ke("boxend"));var ft=function(Rt){return Rt.selectable()&&!Rt.selected()};ge.selectionType()==="additive"||ze||ge.$(r).unmerge(Ve).unselect(),Ve.emit(Ke("box")).stdFilter(ft).select().emit(Ke("boxselect")),t.redraw()}if(t.hoverData.dragging&&(t.hoverData.dragging=!1,t.redrawHint("select",!0),t.redrawHint("eles",!0),t.redraw()),!Se[4]){t.redrawHint("drag",!0),t.redrawHint("eles",!0);var ot=He&&He.grabbed();T(Ae),ot&&(He.emit(Ke("freeon")),Ae.emit(Ke("free")),t.dragData.didDrag&&(He.emit(Ke("dragfreeon")),Ae.emit(Ke("dragfree"))))}}Se[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 Y=[],U=4,z,H=1e5,X=function(Q,ue){for(var ge=0;ge<Q.length;ge++)if(Q[ge]%ue!==0)return!1;return!0},K=function(Q){for(var ue=Math.abs(Q[0]),ge=1;ge<Q.length;ge++)if(Math.abs(Q[ge])!==ue)return!1;return!0},k=function(Q){var ue=!1,ge=Q.deltaY;if(ge==null&&(Q.wheelDeltaY!=null?ge=Q.wheelDeltaY/4:Q.wheelDelta!=null&&(ge=Q.wheelDelta/4)),ge!==0){if(z==null)if(Y.length>=U){var pe=Y;if(z=X(pe,5),!z){var Se=Math.abs(pe[0]);z=K(pe)&&Se>5}if(z)for(var _e=0;_e<pe.length;_e++)H=Math.min(Math.abs(pe[_e]),H)}else Y.push(ge),ue=!0;else z&&(H=Math.min(Math.abs(ge),H));if(!t.scrollingPage){var Ae=t.cy,He=Ae.zoom(),ze=Ae.pan(),Ke=t.projectIntoViewport(Q.clientX,Q.clientY),nt=[Ke[0]*He+ze.x,Ke[1]*He+ze.y];if(t.hoverData.draggingEles||t.hoverData.dragging||t.hoverData.cxtStarted||R()){Q.preventDefault();return}if(Ae.panningEnabled()&&Ae.userPanningEnabled()&&Ae.zoomingEnabled()&&Ae.userZoomingEnabled()){Q.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 it;ue&&Math.abs(ge)>5&&(ge=z0(ge)*5),it=ge/-250,z&&(it/=H,it*=3),it=it*t.wheelSensitivity;var Ve=Q.deltaMode===1;Ve&&(it*=33);var ft=Ae.zoom()*Math.pow(10,it);Q.type==="gesturechange"&&(ft=t.gestureStartZoom*Q.scale),Ae.zoom({level:ft,renderedPosition:{x:nt[0],y:nt[1]}}),Ae.emit({type:Q.type==="gesturechange"?"pinchzoom":"scrollzoom",originalEvent:Q,position:{x:Ke[0],y:Ke[1]}})}}}};t.registerBinding(t.container,"wheel",k,!0),t.registerBinding(e,"scroll",function(Q){t.scrollingPage=!0,clearTimeout(t.scrollingPageTimeout),t.scrollingPageTimeout=setTimeout(function(){t.scrollingPage=!1},250)},!0),t.registerBinding(t.container,"gesturestart",function(Q){t.gestureStartZoom=t.cy.zoom(),t.hasTouchStarted||Q.preventDefault()},!0),t.registerBinding(t.container,"gesturechange",function(we){t.hasTouchStarted||k(we)},!0),t.registerBinding(t.container,"mouseout",function(Q){var ue=t.projectIntoViewport(Q.clientX,Q.clientY);t.cy.emit({originalEvent:Q,type:"mouseout",position:{x:ue[0],y:ue[1]}})},!1),t.registerBinding(t.container,"mouseover",function(Q){var ue=t.projectIntoViewport(Q.clientX,Q.clientY);t.cy.emit({originalEvent:Q,type:"mouseover",position:{x:ue[0],y:ue[1]}})},!1);var G,$,J,ne,ee,ae,de,le,re,Z,oe,ve,Ne,Me=function(Q,ue,ge,pe){return Math.sqrt((ge-Q)*(ge-Q)+(pe-ue)*(pe-ue))},Je=function(Q,ue,ge,pe){return(ge-Q)*(ge-Q)+(pe-ue)*(pe-ue)},Ce;t.registerBinding(t.container,"touchstart",Ce=function(Q){if(t.hasTouchStarted=!0,!!L(Q)){N(),t.touchData.capture=!0,t.data.bgActivePosistion=void 0;var ue=t.cy,ge=t.touchData.now,pe=t.touchData.earlier;if(Q.touches[0]){var Se=t.projectIntoViewport(Q.touches[0].clientX,Q.touches[0].clientY);ge[0]=Se[0],ge[1]=Se[1]}if(Q.touches[1]){var Se=t.projectIntoViewport(Q.touches[1].clientX,Q.touches[1].clientY);ge[2]=Se[0],ge[3]=Se[1]}if(Q.touches[2]){var Se=t.projectIntoViewport(Q.touches[2].clientX,Q.touches[2].clientY);ge[4]=Se[0],ge[5]=Se[1]}var _e=function(ir){return{originalEvent:Q,type:ir,position:{x:ge[0],y:ge[1]}}};if(Q.touches[1]){t.touchData.singleTouchMoved=!0,T(t.dragData.touchDragEles);var Ae=t.findContainerClientCoords();re=Ae[0],Z=Ae[1],oe=Ae[2],ve=Ae[3],G=Q.touches[0].clientX-re,$=Q.touches[0].clientY-Z,J=Q.touches[1].clientX-re,ne=Q.touches[1].clientY-Z,Ne=0<=G&&G<=oe&&0<=J&&J<=oe&&0<=$&&$<=ve&&0<=ne&&ne<=ve;var He=ue.pan(),ze=ue.zoom();ee=Me(G,$,J,ne),ae=Je(G,$,J,ne),de=[(G+J)/2,($+ne)/2],le=[(de[0]-He.x)/ze,(de[1]-He.y)/ze];var Ke=200,nt=Ke*Ke;if(ae<nt&&!Q.touches[2]){var it=t.findNearestElement(ge[0],ge[1],!0,!0),Ve=t.findNearestElement(ge[2],ge[3],!0,!0);it&&it.isNode()?(it.activate().emit(_e("cxttapstart")),t.touchData.start=it):Ve&&Ve.isNode()?(Ve.activate().emit(_e("cxttapstart")),t.touchData.start=Ve):ue.emit(_e("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(Q.touches[2])ue.boxSelectionEnabled()&&Q.preventDefault();else if(!Q.touches[1]){if(Q.touches[0]){var ft=t.findNearestElements(ge[0],ge[1],!0,!0),ot=ft[0];if(ot!=null&&(ot.activate(),t.touchData.start=ot,t.touchData.starts=ft,t.nodeIsGrabbable(ot))){var Yt=t.dragData.touchDragEles=ue.collection(),Rt=null;t.redrawHint("eles",!0),t.redrawHint("drag",!0),ot.selected()?(Rt=ue.$(function(Wt){return Wt.selected()&&t.nodeIsGrabbable(Wt)}),E(Rt,{addToList:Yt})):S(ot,{addToList:Yt}),p(ot),ot.emit(_e("grabon")),Rt?Rt.forEach(function(Wt){Wt.emit(_e("grab"))}):ot.emit(_e("grab"))}i(ot,["touchstart","tapstart","vmousedown"],Q,{x:ge[0],y:ge[1]}),ot==null&&(t.data.bgActivePosistion={x:Se[0],y:Se[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"],Q,{x:ge[0],y:ge[1]})},t.tapholdDuration)}}if(Q.touches.length>=1){for(var kr=t.touchData.startPosition=[null,null,null,null,null,null],Kt=0;Kt<ge.length;Kt++)kr[Kt]=pe[Kt]=ge[Kt];var nr=Q.touches[0];t.touchData.startGPosition=[nr.clientX,nr.clientY]}}},!1);var ke;t.registerBinding(e,"touchmove",ke=function(Q){var ue=t.touchData.capture;if(!(!ue&&!L(Q))){var ge=t.selection,pe=t.cy,Se=t.touchData.now,_e=t.touchData.earlier,Ae=pe.zoom();if(Q.touches[0]){var He=t.projectIntoViewport(Q.touches[0].clientX,Q.touches[0].clientY);Se[0]=He[0],Se[1]=He[1]}if(Q.touches[1]){var He=t.projectIntoViewport(Q.touches[1].clientX,Q.touches[1].clientY);Se[2]=He[0],Se[3]=He[1]}if(Q.touches[2]){var He=t.projectIntoViewport(Q.touches[2].clientX,Q.touches[2].clientY);Se[4]=He[0],Se[5]=He[1]}var ze=function(Rc){return{originalEvent:Q,type:Rc,position:{x:Se[0],y:Se[1]}}},Ke=t.touchData.startGPosition,nt;if(ue&&Q.touches[0]&&Ke){for(var it=[],Ve=0;Ve<Se.length;Ve++)it[Ve]=Se[Ve]-_e[Ve];var ft=Q.touches[0].clientX-Ke[0],ot=ft*ft,Yt=Q.touches[0].clientY-Ke[1],Rt=Yt*Yt,kr=ot+Rt;nt=kr>=t.touchTapThreshold2}if(ue&&t.touchData.cxt){Q.preventDefault();var Kt=Q.touches[0].clientX-re,nr=Q.touches[0].clientY-Z,Wt=Q.touches[1].clientX-re,ir=Q.touches[1].clientY-Z,ja=Je(Kt,nr,Wt,ir),Xt=ja/ae,Da=150,Er=Da*Da,Ht=1.5,mr=Ht*Ht;if(Xt>=mr||ja>=Er){t.touchData.cxt=!1,t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var aa=ze("cxttapend");t.touchData.start?(t.touchData.start.unactivate().emit(aa),t.touchData.start=null):pe.emit(aa)}}if(ue&&t.touchData.cxt){var aa=ze("cxtdrag");t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.touchData.start?t.touchData.start.emit(aa):pe.emit(aa),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxtDragged=!0;var Tr=t.findNearestElement(Se[0],Se[1],!0,!0);(!t.touchData.cxtOver||Tr!==t.touchData.cxtOver)&&(t.touchData.cxtOver&&t.touchData.cxtOver.emit(ze("cxtdragout")),t.touchData.cxtOver=Tr,Tr&&Tr.emit(ze("cxtdragover")))}else if(ue&&Q.touches[2]&&pe.boxSelectionEnabled())Q.preventDefault(),t.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,t.touchData.selecting||pe.emit(ze("boxstart")),t.touchData.selecting=!0,t.touchData.didSelect=!0,ge[4]=1,!ge||ge.length===0||ge[0]===void 0?(ge[0]=(Se[0]+Se[2]+Se[4])/3,ge[1]=(Se[1]+Se[3]+Se[5])/3,ge[2]=(Se[0]+Se[2]+Se[4])/3+1,ge[3]=(Se[1]+Se[3]+Se[5])/3+1):(ge[2]=(Se[0]+Se[2]+Se[4])/3,ge[3]=(Se[1]+Se[3]+Se[5])/3),t.redrawHint("select",!0),t.redraw();else if(ue&&Q.touches[1]&&!t.touchData.didSelect&&pe.zoomingEnabled()&&pe.panningEnabled()&&pe.userZoomingEnabled()&&pe.userPanningEnabled()){Q.preventDefault(),t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var Cr=t.dragData.touchDragEles;if(Cr){t.redrawHint("drag",!0);for(var Fr=0;Fr<Cr.length;Fr++){var Zn=Cr[Fr]._private;Zn.grabbed=!1,Zn.rscratch.inDragLayer=!1}}var Nr=t.touchData.start,Kt=Q.touches[0].clientX-re,nr=Q.touches[0].clientY-Z,Wt=Q.touches[1].clientX-re,ir=Q.touches[1].clientY-Z,il=Me(Kt,nr,Wt,ir),Wn=il/ee;if(Ne){var Jn=Kt-G,cs=nr-$,ei=Wt-J,ur=ir-ne,Dc=(Jn+ei)/2,Oc=(cs+ur)/2,ga=pe.zoom(),an=ga*Wn,sl=pe.pan(),Lo=le[0]*ga+sl.x,zo=le[1]*ga+sl.y,gh={x:-an/ga*(Lo-sl.x-Dc)+Lo,y:-an/ga*(zo-sl.y-Oc)+zo};if(Nr&&Nr.active()){var Cr=t.dragData.touchDragEles;T(Cr),t.redrawHint("drag",!0),t.redrawHint("eles",!0),Nr.unactivate().emit(ze("freeon")),Cr.emit(ze("free")),t.dragData.didDrag&&(Nr.emit(ze("dragfreeon")),Cr.emit(ze("dragfree")))}pe.viewport({zoom:an,pan:gh,cancelOnFailedZoom:!0}),pe.emit(ze("pinchzoom")),ee=il,G=Kt,$=nr,J=Wt,ne=ir,t.pinching=!0}if(Q.touches[0]){var He=t.projectIntoViewport(Q.touches[0].clientX,Q.touches[0].clientY);Se[0]=He[0],Se[1]=He[1]}if(Q.touches[1]){var He=t.projectIntoViewport(Q.touches[1].clientX,Q.touches[1].clientY);Se[2]=He[0],Se[3]=He[1]}if(Q.touches[2]){var He=t.projectIntoViewport(Q.touches[2].clientX,Q.touches[2].clientY);Se[4]=He[0],Se[5]=He[1]}}else if(Q.touches[0]&&!t.touchData.didSelect){var Hr=t.touchData.start,ti=t.touchData.last,Tr;if(!t.hoverData.draggingEles&&!t.swipePanning&&(Tr=t.findNearestElement(Se[0],Se[1],!0,!0)),ue&&Hr!=null&&Q.preventDefault(),ue&&Hr!=null&&t.nodeIsDraggable(Hr))if(nt){var Cr=t.dragData.touchDragEles,Oa=!t.dragData.didDrag;Oa&&E(Cr,{inDragLayer:!0}),t.dragData.didDrag=!0;var Ar={x:0,y:0};if(Oe(it[0])&&Oe(it[1])&&(Ar.x+=it[0],Ar.y+=it[1],Oa)){t.redrawHint("eles",!0);var na=t.touchData.dragDelta;na&&Oe(na[0])&&Oe(na[1])&&(Ar.x+=na[0],Ar.y+=na[1])}t.hoverData.draggingEles=!0,Cr.silentShift(Ar).emit(ze("position")).emit(ze("drag")),t.redrawHint("drag",!0),t.touchData.startPosition[0]==_e[0]&&t.touchData.startPosition[1]==_e[1]&&t.redrawHint("eles",!0),t.redraw()}else{var na=t.touchData.dragDelta=t.touchData.dragDelta||[];na.length===0?(na.push(it[0]),na.push(it[1])):(na[0]+=it[0],na[1]+=it[1])}if(i(Hr||Tr,["touchmove","tapdrag","vmousemove"],Q,{x:Se[0],y:Se[1]}),(!Hr||!Hr.grabbed())&&Tr!=ti&&(ti&&ti.emit(ze("tapdragout")),Tr&&Tr.emit(ze("tapdragover"))),t.touchData.last=Tr,ue)for(var Fr=0;Fr<Se.length;Fr++)Se[Fr]&&t.touchData.startPosition[Fr]&&nt&&(t.touchData.singleTouchMoved=!0);if(ue&&(Hr==null||Hr.pannable())&&pe.panningEnabled()&&pe.userPanningEnabled()){var mh=o(Hr,t.touchData.starts);mh&&(Q.preventDefault(),t.data.bgActivePosistion||(t.data.bgActivePosistion=Zl(t.touchData.startPosition)),t.swipePanning?(pe.panBy({x:it[0]*Ae,y:it[1]*Ae}),pe.emit(ze("dragpan"))):nt&&(t.swipePanning=!0,pe.panBy({x:ft*Ae,y:Yt*Ae}),pe.emit(ze("dragpan")),Hr&&(Hr.unactivate(),t.redrawHint("select",!0),t.touchData.start=null)));var He=t.projectIntoViewport(Q.touches[0].clientX,Q.touches[0].clientY);Se[0]=He[0],Se[1]=He[1]}}for(var Ve=0;Ve<Se.length;Ve++)_e[Ve]=Se[Ve];ue&&Q.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 Le;t.registerBinding(e,"touchcancel",Le=function(Q){var ue=t.touchData.start;t.touchData.capture=!1,ue&&ue.unactivate()});var De,Ue,xe,Ye;if(t.registerBinding(e,"touchend",De=function(Q){var ue=t.touchData.start,ge=t.touchData.capture;if(ge)Q.touches.length===0&&(t.touchData.capture=!1),Q.preventDefault();else return;var pe=t.selection;t.swipePanning=!1,t.hoverData.draggingEles=!1;var Se=t.cy,_e=Se.zoom(),Ae=t.touchData.now,He=t.touchData.earlier;if(Q.touches[0]){var ze=t.projectIntoViewport(Q.touches[0].clientX,Q.touches[0].clientY);Ae[0]=ze[0],Ae[1]=ze[1]}if(Q.touches[1]){var ze=t.projectIntoViewport(Q.touches[1].clientX,Q.touches[1].clientY);Ae[2]=ze[0],Ae[3]=ze[1]}if(Q.touches[2]){var ze=t.projectIntoViewport(Q.touches[2].clientX,Q.touches[2].clientY);Ae[4]=ze[0],Ae[5]=ze[1]}var Ke=function(Er){return{originalEvent:Q,type:Er,position:{x:Ae[0],y:Ae[1]}}};ue&&ue.unactivate();var nt;if(t.touchData.cxt){if(nt=Ke("cxttapend"),ue?ue.emit(nt):Se.emit(nt),!t.touchData.cxtDragged){var it=Ke("cxttap");ue?ue.emit(it):Se.emit(it)}t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!1,t.touchData.start=null,t.redraw();return}if(!Q.touches[2]&&Se.boxSelectionEnabled()&&t.touchData.selecting){t.touchData.selecting=!1;var Ve=Se.collection(t.getAllInBox(pe[0],pe[1],pe[2],pe[3]));pe[0]=void 0,pe[1]=void 0,pe[2]=void 0,pe[3]=void 0,pe[4]=0,t.redrawHint("select",!0),Se.emit(Ke("boxend"));var ft=function(Er){return Er.selectable()&&!Er.selected()};Ve.emit(Ke("box")).stdFilter(ft).select().emit(Ke("boxselect")),Ve.nonempty()&&t.redrawHint("eles",!0),t.redraw()}if(ue!=null&&ue.unactivate(),Q.touches[2])t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);else if(!Q.touches[1]){if(!Q.touches[0]){if(!Q.touches[0]){t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var ot=t.dragData.touchDragEles;if(ue!=null){var Yt=ue._private.grabbed;T(ot),t.redrawHint("drag",!0),t.redrawHint("eles",!0),Yt&&(ue.emit(Ke("freeon")),ot.emit(Ke("free")),t.dragData.didDrag&&(ue.emit(Ke("dragfreeon")),ot.emit(Ke("dragfree")))),i(ue,["touchend","tapend","vmouseup","tapdragout"],Q,{x:Ae[0],y:Ae[1]}),ue.unactivate(),t.touchData.start=null}else{var Rt=t.findNearestElement(Ae[0],Ae[1],!0,!0);i(Rt,["touchend","tapend","vmouseup","tapdragout"],Q,{x:Ae[0],y:Ae[1]})}var kr=t.touchData.startPosition[0]-Ae[0],Kt=kr*kr,nr=t.touchData.startPosition[1]-Ae[1],Wt=nr*nr,ir=Kt+Wt,ja=ir*_e*_e;t.touchData.singleTouchMoved||(ue||Se.$(":selected").unselect(["tapunselect"]),i(ue,["tap","vclick"],Q,{x:Ae[0],y:Ae[1]}),Ue=!1,Q.timeStamp-Ye<=Se.multiClickDebounceTime()?(xe&&clearTimeout(xe),Ue=!0,Ye=null,i(ue,["dbltap","vdblclick"],Q,{x:Ae[0],y:Ae[1]})):(xe=setTimeout(function(){Ue||i(ue,["onetap","voneclick"],Q,{x:Ae[0],y:Ae[1]})},Se.multiClickDebounceTime()),Ye=Q.timeStamp)),ue!=null&&!t.dragData.didDrag&&ue._private.selectable&&ja<t.touchTapThreshold2&&!t.pinching&&(Se.selectionType()==="single"?(Se.$(r).unmerge(ue).unselect(["tapunselect"]),ue.select(["tapselect"])):ue.selected()?ue.unselect(["tapunselect"]):ue.select(["tapselect"]),t.redrawHint("eles",!0)),t.touchData.singleTouchMoved=!0}}}for(var Xt=0;Xt<Ae.length;Xt++)He[Xt]=Ae[Xt];t.dragData.didDrag=!1,Q.touches.length===0&&(t.touchData.dragDelta=[],t.touchData.startPosition=[null,null,null,null,null,null],t.touchData.startGPosition=null,t.touchData.didSelect=!1),Q.touches.length<2&&(Q.touches.length===1&&(t.touchData.startGPosition=[Q.touches[0].clientX,Q.touches[0].clientY]),t.pinching=!1,t.redrawHint("eles",!0),t.redraw())},!1),typeof TouchEvent>"u"){var Re=[],ye=function(Q){return{clientX:Q.clientX,clientY:Q.clientY,force:1,identifier:Q.pointerId,pageX:Q.pageX,pageY:Q.pageY,radiusX:Q.width/2,radiusY:Q.height/2,screenX:Q.screenX,screenY:Q.screenY,target:Q.target}},Ge=function(Q){return{event:Q,touch:ye(Q)}},rt=function(Q){Re.push(Ge(Q))},at=function(Q){for(var ue=0;ue<Re.length;ue++){var ge=Re[ue];if(ge.event.pointerId===Q.pointerId){Re.splice(ue,1);return}}},ct=function(Q){var ue=Re.filter(function(ge){return ge.event.pointerId===Q.pointerId})[0];ue.event=Q,ue.touch=ye(Q)},et=function(Q){Q.touches=Re.map(function(ue){return ue.touch})},qe=function(Q){return Q.pointerType==="mouse"||Q.pointerType===4};t.registerBinding(t.container,"pointerdown",function(we){qe(we)||(we.preventDefault(),rt(we),et(we),Ce(we))}),t.registerBinding(t.container,"pointerup",function(we){qe(we)||(at(we),et(we),De(we))}),t.registerBinding(t.container,"pointercancel",function(we){qe(we)||(at(we),et(we),Le(we))}),t.registerBinding(t.container,"pointermove",function(we){qe(we)||(we.preventDefault(),ct(we),et(we),ke(we))})}};var Xn={};Xn.generatePolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,draw:function(a,i,s,o,u,f){this.renderer.nodeShapeImpl("polygon",a,i,s,o,u,this.points)},intersectLine:function(a,i,s,o,u,f,d,h){return Zu(u,f,this.points,a,i,s/2,o/2,d)},checkPoint:function(a,i,s,o,u,f,d,h){return Kn(a,i,this.points,f,d,o,u,[0,-1],s)},hasMiterBounds:t!=="rectangle",miterBounds:function(a,i,s,o,u,f){return JR(this.points,a,i,s,o,u)}}};Xn.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,r,a,i,s,o){this.renderer.nodeShapeImpl(this.name,e,r,a,i,s)},intersectLine:function(e,r,a,i,s,o,u,f){return lk(s,o,e,r,a/2+u,i/2+u)},checkPoint:function(e,r,a,i,s,o,u,f){return Ls(e,r,i,s,o,u,a)}}};Xn.generateRoundPolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,getOrCreateCorners:function(a,i,s,o,u,f,d){if(f[d]!==void 0&&f[d+"-cx"]===a&&f[d+"-cy"]===i)return f[d];f[d]=new Array(e.length/2),f[d+"-cx"]=a,f[d+"-cy"]=i;var h=s/2,p=o/2;u=u==="auto"?$T(s,o):u;for(var g=new Array(e.length/2),y=0;y<e.length/2;y++)g[y]={x:a+h*e[y*2],y:i+p*e[y*2+1]};var b,E,S,T,C=g.length;for(E=g[C-1],b=0;b<C;b++)S=g[b%C],T=g[(b+1)%C],f[d][b]=X0(E,S,T,u),E=S,S=T;return f[d]},draw:function(a,i,s,o,u,f,d){this.renderer.nodeShapeImpl("round-polygon",a,i,s,o,u,this.points,this.getOrCreateCorners(i,s,o,u,f,d,"drawCorners"))},intersectLine:function(a,i,s,o,u,f,d,h,p){return uk(u,f,this.points,a,i,s,o,d,this.getOrCreateCorners(a,i,s,o,h,p,"corners"))},checkPoint:function(a,i,s,o,u,f,d,h,p){return sk(a,i,this.points,f,d,o,u,this.getOrCreateCorners(f,d,o,u,h,p,"corners"))}}};Xn.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:Jr(4,0),draw:function(e,r,a,i,s,o){this.renderer.nodeShapeImpl(this.name,e,r,a,i,s,this.points,o)},intersectLine:function(e,r,a,i,s,o,u,f){return KT(s,o,e,r,a,i,u,f)},checkPoint:function(e,r,a,i,s,o,u,f){var d=i/2,h=s/2;f=f==="auto"?Wi(i,s):f,f=Math.min(d,h,f);var p=f*2;return!!(Kn(e,r,this.points,o,u,i,s-p,[0,-1],a)||Kn(e,r,this.points,o,u,i-p,s,[0,-1],a)||Ls(e,r,p,p,o-d+f,u-h+f,a)||Ls(e,r,p,p,o+d-f,u-h+f,a)||Ls(e,r,p,p,o+d-f,u+h-f,a)||Ls(e,r,p,p,o-d+f,u+h-f,a))}}};Xn.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:P0(),points:Jr(4,0),draw:function(e,r,a,i,s,o){this.renderer.nodeShapeImpl(this.name,e,r,a,i,s,null,o)},generateCutTrianglePts:function(e,r,a,i,s){var o=s==="auto"?this.cornerLength:s,u=r/2,f=e/2,d=a-f,h=a+f,p=i-u,g=i+u;return{topLeft:[d,p+o,d+o,p,d+o,p+o],topRight:[h-o,p,h,p+o,h-o,p+o],bottomRight:[h,g-o,h-o,g,h-o,g-o],bottomLeft:[d+o,g,d,g-o,d+o,g-o]}},intersectLine:function(e,r,a,i,s,o,u,f){var d=this.generateCutTrianglePts(a+2*u,i+2*u,e,r,f),h=[].concat.apply([],[d.topLeft.splice(0,4),d.topRight.splice(0,4),d.bottomRight.splice(0,4),d.bottomLeft.splice(0,4)]);return Zu(s,o,h,e,r)},checkPoint:function(e,r,a,i,s,o,u,f){var d=f==="auto"?this.cornerLength:f;if(Kn(e,r,this.points,o,u,i,s-2*d,[0,-1],a)||Kn(e,r,this.points,o,u,i-2*d,s,[0,-1],a))return!0;var h=this.generateCutTrianglePts(i,s,o,u);return va(e,r,h.topLeft)||va(e,r,h.topRight)||va(e,r,h.bottomRight)||va(e,r,h.bottomLeft)}}};Xn.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:Jr(4,0),draw:function(e,r,a,i,s,o){this.renderer.nodeShapeImpl(this.name,e,r,a,i,s)},intersectLine:function(e,r,a,i,s,o,u,f){var d=.15,h=.5,p=.85,g=this.generateBarrelBezierPts(a+2*u,i+2*u,e,r),y=function(S){var T=ro({x:S[0],y:S[1]},{x:S[2],y:S[3]},{x:S[4],y:S[5]},d),C=ro({x:S[0],y:S[1]},{x:S[2],y:S[3]},{x:S[4],y:S[5]},h),N=ro({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]]},b=[].concat(y(g.topLeft),y(g.topRight),y(g.bottomRight),y(g.bottomLeft));return Zu(s,o,b,e,r)},generateBarrelBezierPts:function(e,r,a,i){var s=r/2,o=e/2,u=a-o,f=a+o,d=i-s,h=i+s,p=Fm(e,r),g=p.heightOffset,y=p.widthOffset,b=p.ctrlPtOffsetPct*e,E={topLeft:[u,d+g,u+b,d,u+y,d],topRight:[f-y,d,f-b,d,f,d+g],bottomRight:[f,h-g,f-b,h,f-y,h],bottomLeft:[u+y,h,u+b,h,u,h-g]};return E.topLeft.isTop=!0,E.topRight.isTop=!0,E.bottomLeft.isBottom=!0,E.bottomRight.isBottom=!0,E},checkPoint:function(e,r,a,i,s,o,u,f){var d=Fm(i,s),h=d.heightOffset,p=d.widthOffset;if(Kn(e,r,this.points,o,u,i,s-2*h,[0,-1],a)||Kn(e,r,this.points,o,u,i-2*p,s,[0,-1],a))return!0;for(var g=this.generateBarrelBezierPts(i,s,o,u),y=function(B,R,L){var _=L[4],P=L[2],q=L[0],F=L[5],Y=L[1],U=Math.min(_,q),z=Math.max(_,q),H=Math.min(F,Y),X=Math.max(F,Y);if(U<=B&&B<=z&&H<=R&&R<=X){var K=ck(_,P,q),k=rk(K[0],K[1],K[2],B),G=k.filter(function($){return 0<=$&&$<=1});if(G.length>0)return G[0]}return null},b=Object.keys(g),E=0;E<b.length;E++){var S=b[E],T=g[S],C=y(e,r,T);if(C!=null){var N=T[5],j=T[3],M=T[1],D=Or(N,j,M,C);if(T.isTop&&D<=r||T.isBottom&&r<=D)return!0}}return!1}}};Xn.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:Jr(4,0),draw:function(e,r,a,i,s,o){this.renderer.nodeShapeImpl(this.name,e,r,a,i,s,this.points,o)},intersectLine:function(e,r,a,i,s,o,u,f){var d=e-(a/2+u),h=r-(i/2+u),p=h,g=e+(a/2+u),y=Fi(s,o,e,r,d,h,g,p,!1);return y.length>0?y:KT(s,o,e,r,a,i,u,f)},checkPoint:function(e,r,a,i,s,o,u,f){f=f==="auto"?Wi(i,s):f;var d=2*f;if(Kn(e,r,this.points,o,u,i,s-d,[0,-1],a)||Kn(e,r,this.points,o,u,i-d,s,[0,-1],a))return!0;var h=i/2+2*a,p=s/2+2*a,g=[o-h,u-p,o-h,u,o+h,u,o+h,u-p];return!!(va(e,r,g)||Ls(e,r,d,d,o+i/2-f,u+s/2-f,a)||Ls(e,r,d,d,o-i/2+f,u+s/2-f,a))}}};Xn.registerNodeShapes=function(){var t=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",Jr(3,0)),this.generateRoundPolygon("round-triangle",Jr(3,0)),this.generatePolygon("rectangle",Jr(4,0)),t.square=t.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var r=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",r),this.generateRoundPolygon("round-diamond",r)}this.generatePolygon("pentagon",Jr(5,0)),this.generateRoundPolygon("round-pentagon",Jr(5,0)),this.generatePolygon("hexagon",Jr(6,0)),this.generateRoundPolygon("round-hexagon",Jr(6,0)),this.generatePolygon("heptagon",Jr(7,0)),this.generateRoundPolygon("round-heptagon",Jr(7,0)),this.generatePolygon("octagon",Jr(8,0)),this.generateRoundPolygon("round-octagon",Jr(8,0));var a=new Array(20);{var i=Vm(5,0),s=Vm(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++)a[u*4]=i[u*2],a[u*4+1]=i[u*2+1],a[u*4+2]=s[u*2],a[u*4+3]=s[u*2+1]}a=XT(a),this.generatePolygon("star",a),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 f=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",f),this.generateRoundPolygon("round-tag",f)}t.makePolygon=function(d){var h=d.join("$"),p="polygon-"+h,g;return(g=this[p])?g:e.generatePolygon(p,d)}};var Ac={};Ac.timeToRender=function(){return this.redrawTotalTime/this.redrawCount};Ac.redraw=function(t){t=t||HT();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};Ac.beforeRender=function(t,e){if(!this.destroyed){e==null&&Qt("Priority is not optional for beforeRender");var r=this.beforeRenderCallbacks;r.push({fn:t,priority:e}),r.sort(function(a,i){return i.priority-a.priority})}};var _S=function(e,r,a){for(var i=e.beforeRenderCallbacks,s=0;s<i.length;s++)i[s].fn(r,a)};Ac.startRenderLoop=function(){var t=this,e=t.cy;if(!t.renderLoopStarted){t.renderLoopStarted=!0;var r=function(i){if(!t.destroyed){if(!e.batching())if(t.requestedFrame&&!t.skipFrame){_S(t,!0,i);var s=Yn();t.render(t.renderOptions);var o=t.lastDrawTime=Yn();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 _S(t,!1,i);t.skipFrame=!1,Rd(r)}};Rd(r)}};var NB=function(e){this.init(e)},$C=NB,Bo=$C.prototype;Bo.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"];Bo.init=function(t){var e=this;e.options=t,e.cy=t.cy;var r=e.container=t.cy.container(),a=e.cy.window();if(a){var i=a.document,s=i.head,o="__________cytoscape_stylesheet",u="__________cytoscape_container",f=i.getElementById(o)!=null;if(r.className.indexOf(u)<0&&(r.className=(r.className||"")+" "+u),!f){var d=i.createElement("style");d.id=o,d.textContent="."+u+" { position: relative; }",s.insertBefore(d,s.children[0])}var h=a.getComputedStyle(r),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()};Bo.notify=function(t,e){var r=this,a=r.cy;if(!this.destroyed){if(t==="init"){r.load();return}if(t==="destroy"){r.destroy();return}(t==="add"||t==="remove"||t==="move"&&a.hasCompoundNodes()||t==="load"||t==="zorder"||t==="mount")&&r.invalidateCachedZSortedEles(),t==="viewport"&&r.redrawHint("select",!0),t==="gc"&&r.redrawHint("gc",!0),(t==="load"||t==="resize"||t==="mount")&&(r.invalidateContainerClientCoordsCache(),r.matchCanvasSize(r.container)),r.redrawHint("eles",!0),r.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}};Bo.destroy=function(){var t=this;t.destroyed=!0,t.cy.stopAnimationLoop();for(var e=0;e<t.bindings.length;e++){var r=t.bindings[e],a=r,i=a.target;(i.off||i.removeEventListener).apply(i,a.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{}};Bo.isHeadless=function(){return!1};[K0,KC,XC,ko,Xn,Ac].forEach(function(t){Ze(Bo,t)});var sm=1e3/60,ZC={setupDequeueing:function(e){return function(){var a=this,i=this.renderer;if(!a.dequeueingSetup){a.dequeueingSetup=!0;var s=Sc(function(){i.redrawHint("eles",!0),i.redrawHint("drag",!0),i.redraw()},e.deqRedrawThreshold),o=function(d,h){var p=Yn(),g=i.averageRedrawTime,y=i.lastRedrawTime,b=[],E=i.cy.extent(),S=i.getPixelRatio();for(d||i.flushRenderedStyleQueue();;){var T=Yn(),C=T-p,N=T-h;if(y<sm){var j=sm-(d?g:0);if(N>=e.deqFastCost*j)break}else if(d){if(C>=e.deqCost*y||C>=e.deqAvgCost*g)break}else if(N>=e.deqNoDrawCost*sm)break;var M=e.deq(a,S,E);if(M.length>0)for(var D=0;D<M.length;D++)b.push(M[D]);else break}b.length>0&&(e.onDeqd(a,b),!d&&e.shouldRedraw(a,b,S,E)&&s())},u=e.priority||k0;i.beforeRender(o,u(a))}}}},AB=(function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:kd;is(this,t),this.idsByKey=new Gn,this.keyForId=new Gn,this.cachesByLvl=new Gn,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=r}return ss(t,[{key:"getIdsFor",value:function(r){r==null&&Qt("Can not get id list for null key");var a=this.idsByKey,i=this.idsByKey.get(r);return i||(i=new Do,a.set(r,i)),i}},{key:"addIdForKey",value:function(r,a){r!=null&&this.getIdsFor(r).add(a)}},{key:"deleteIdForKey",value:function(r,a){r!=null&&this.getIdsFor(r).delete(a)}},{key:"getNumberOfIdsForKey",value:function(r){return r==null?0:this.getIdsFor(r).size}},{key:"updateKeyMappingFor",value:function(r){var a=r.id(),i=this.keyForId.get(a),s=this.getKey(r);this.deleteIdForKey(i,a),this.addIdForKey(s,a),this.keyForId.set(a,s)}},{key:"deleteKeyMappingFor",value:function(r){var a=r.id(),i=this.keyForId.get(a);this.deleteIdForKey(i,a),this.keyForId.delete(a)}},{key:"keyHasChangedFor",value:function(r){var a=r.id(),i=this.keyForId.get(a),s=this.getKey(r);return i!==s}},{key:"isInvalid",value:function(r){return this.keyHasChangedFor(r)||this.doesEleInvalidateKey(r)}},{key:"getCachesAt",value:function(r){var a=this.cachesByLvl,i=this.lvls,s=a.get(r);return s||(s=new Gn,a.set(r,s),i.push(r)),s}},{key:"getCache",value:function(r,a){return this.getCachesAt(a).get(r)}},{key:"get",value:function(r,a){var i=this.getKey(r),s=this.getCache(i,a);return s!=null&&this.updateKeyMappingFor(r),s}},{key:"getForCachedKey",value:function(r,a){var i=this.keyForId.get(r.id()),s=this.getCache(i,a);return s}},{key:"hasCache",value:function(r,a){return this.getCachesAt(a).has(r)}},{key:"has",value:function(r,a){var i=this.getKey(r);return this.hasCache(i,a)}},{key:"setCache",value:function(r,a,i){i.key=r,this.getCachesAt(a).set(r,i)}},{key:"set",value:function(r,a,i){var s=this.getKey(r);this.setCache(s,a,i),this.updateKeyMappingFor(r)}},{key:"deleteCache",value:function(r,a){this.getCachesAt(a).delete(r)}},{key:"delete",value:function(r,a){var i=this.getKey(r);this.deleteCache(i,a)}},{key:"invalidateKey",value:function(r){var a=this;this.lvls.forEach(function(i){return a.deleteCache(r,i)})}},{key:"invalidate",value:function(r){var a=r.id(),i=this.keyForId.get(a);this.deleteKeyMappingFor(r);var s=this.doesEleInvalidateKey(r);return s&&this.invalidateKey(i),s||this.getNumberOfIdsForKey(i)===0}}])})(),PS=25,sd=50,Sd=-4,r0=3,WC=7.99,jB=8,DB=1024,OB=1024,MB=1024,RB=.2,kB=.8,BB=10,LB=.15,zB=.1,_B=.9,PB=.9,UB=100,qB=1,Jl={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},IB=Ir({getKey:null,doesEleInvalidateKey:kd,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:IT,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),_u=function(e,r){var a=this;a.renderer=e,a.onDequeues=[];var i=IB(r);Ze(a,i),a.lookup=new AB(i.getKey,i.doesEleInvalidateKey),a.setupDequeueing()},Sr=_u.prototype;Sr.reasons=Jl;Sr.getTextureQueue=function(t){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[t]=e.eleImgCaches[t]||[]};Sr.getRetiredTextureQueue=function(t){var e=this,r=e.eleImgCaches.retired=e.eleImgCaches.retired||{},a=r[t]=r[t]||[];return a};Sr.getElementQueue=function(){var t=this,e=t.eleCacheQueue=t.eleCacheQueue||new Ec(function(r,a){return a.reqs-r.reqs});return e};Sr.getElementKeyToQueue=function(){var t=this,e=t.eleKeyToCacheQueue=t.eleKeyToCacheQueue||{};return e};Sr.getElement=function(t,e,r,a,i){var s=this,o=this.renderer,u=o.cy.zoom(),f=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(a==null&&(a=Math.ceil(L0(u*r))),a<Sd)a=Sd;else if(u>=WC||a>r0)return null;var d=Math.pow(2,a),h=e.h*d,p=e.w*d,g=o.eleTextBiggerThanMin(t,d);if(!this.isVisible(t,g))return null;var y=f.get(t,a);if(y&&y.invalidated&&(y.invalidated=!1,y.texture.invalidatedWidth-=y.width),y)return y;var b;if(h<=PS?b=PS:h<=sd?b=sd:b=Math.ceil(h/sd)*sd,h>MB||p>OB)return null;var E=s.getTextureQueue(b),S=E[E.length-2],T=function(){return s.recycleTexture(b,p)||s.addTexture(b,p)};S||(S=E[E.length-1]),S||(S=T()),S.width-S.usedWidth<p&&(S=T());for(var C=function(U){return U&&U.scaledLabelShown===g},N=i&&i===Jl.dequeue,j=i&&i===Jl.highQuality,M=i&&i===Jl.downscale,D,A=a+1;A<=r0;A++){var B=f.get(t,A);if(B){D=B;break}}var R=D&&D.level===a+1?D:null,L=function(){S.context.drawImage(R.texture.canvas,R.x,0,R.width,R.height,S.usedWidth,0,p,h)};if(S.context.setTransform(1,0,0,1,0,0),S.context.clearRect(S.usedWidth,0,p,b),C(R))L();else if(C(D))if(j){for(var _=D.level;_>a;_--)R=s.getElement(t,e,r,_,Jl.downscale);L()}else return s.queueElement(t,D.level-1),D;else{var P;if(!N&&!j&&!M)for(var q=a-1;q>=Sd;q--){var F=f.get(t,q);if(F){P=F;break}}if(C(P))return s.queueElement(t,a),P;S.context.translate(S.usedWidth,0),S.context.scale(d,d),this.drawElement(S.context,t,e,g,!1),S.context.scale(1/d,1/d),S.context.translate(-S.usedWidth,0)}return y={x:S.usedWidth,texture:S,level:a,scale:d,width:p,height:h,scaledLabelShown:g},S.usedWidth+=Math.ceil(p+jB),S.eleCaches.push(y),f.set(t,a,y),s.checkTextureFullness(S),y};Sr.invalidateElements=function(t){for(var e=0;e<t.length;e++)this.invalidateElement(t[e])};Sr.invalidateElement=function(t){var e=this,r=e.lookup,a=[],i=r.isInvalid(t);if(i){for(var s=Sd;s<=r0;s++){var o=r.getForCachedKey(t,s);o&&a.push(o)}var u=r.invalidate(t);if(u)for(var f=0;f<a.length;f++){var d=a[f],h=d.texture;h.invalidatedWidth+=d.width,d.invalidated=!0,e.checkTextureUtility(h)}e.removeFromQueue(t)}};Sr.checkTextureUtility=function(t){t.invalidatedWidth>=RB*t.width&&this.retireTexture(t)};Sr.checkTextureFullness=function(t){var e=this,r=e.getTextureQueue(t.height);t.usedWidth/t.width>kB&&t.fullnessChecks>=BB?Zi(r,t):t.fullnessChecks++};Sr.retireTexture=function(t){var e=this,r=t.height,a=e.getTextureQueue(r),i=this.lookup;Zi(a,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)}B0(s);var f=e.getRetiredTextureQueue(r);f.push(t)};Sr.addTexture=function(t,e){var r=this,a=r.getTextureQueue(t),i={};return a.push(i),i.eleCaches=[],i.height=t,i.width=Math.max(DB,e),i.usedWidth=0,i.invalidatedWidth=0,i.fullnessChecks=0,i.canvas=r.renderer.makeOffscreenCanvas(i.width,i.height),i.context=i.canvas.getContext("2d"),i};Sr.recycleTexture=function(t,e){for(var r=this,a=r.getTextureQueue(t),i=r.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,B0(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),Zi(i,o),a.push(o),o}};Sr.queueElement=function(t,e){var r=this,a=r.getElementQueue(),i=r.getElementKeyToQueue(),s=this.getKey(t),o=i[s];if(o)o.level=Math.max(o.level,e),o.eles.merge(t),o.reqs++,a.updateItem(o);else{var u={eles:t.spawn().merge(t),level:e,reqs:1,key:s};a.push(u),i[s]=u}};Sr.dequeue=function(t){for(var e=this,r=e.getElementQueue(),a=e.getElementKeyToQueue(),i=[],s=e.lookup,o=0;o<qB&&r.size()>0;o++){var u=r.pop(),f=u.key,d=u.eles[0],h=s.hasCache(d,u.level);if(a[f]=null,h)continue;i.push(u);var p=e.getBoundingBox(d);e.getElement(d,p,t,u.level,Jl.dequeue)}return i};Sr.removeFromQueue=function(t){var e=this,r=e.getElementQueue(),a=e.getElementKeyToQueue(),i=this.getKey(t),s=a[i];s!=null&&(s.eles.length===1?(s.reqs=R0,r.updateItem(s),r.pop(),a[i]=null):s.eles.unmerge(t))};Sr.onDequeue=function(t){this.onDequeues.push(t)};Sr.offDequeue=function(t){Zi(this.onDequeues,t)};Sr.setupDequeueing=ZC.setupDequeueing({deqRedrawThreshold:UB,deqCost:LB,deqAvgCost:zB,deqNoDrawCost:_B,deqFastCost:PB,deq:function(e,r,a){return e.dequeue(r,a)},onDeqd:function(e,r){for(var a=0;a<e.onDequeues.length;a++){var i=e.onDequeues[a];i(r)}},shouldRedraw:function(e,r,a,i){for(var s=0;s<r.length;s++)for(var o=r[s].eles,u=0;u<o.length;u++){var f=o[u].boundingBox();if(_0(f,i))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var VB=1,qu=-4,Id=2,FB=3.99,HB=50,GB=50,QB=.15,YB=.1,KB=.9,XB=.9,$B=1,US=250,ZB=4e3*4e3,qS=32767,WB=!0,JC=function(e){var r=this,a=r.renderer=e,i=a.cy;r.layersByLevel={},r.firstGet=!0,r.lastInvalidationTime=Yn()-2*US,r.skipping=!1,r.eleTxrDeqs=i.collection(),r.scheduleElementRefinement=Sc(function(){r.refineElementTextures(r.eleTxrDeqs),r.eleTxrDeqs.unmerge(r.eleTxrDeqs)},GB),a.beforeRender(function(o,u){u-r.lastInvalidationTime<=US?r.skipping=!0:r.skipping=!1},a.beforeRenderPriorities.lyrTxrSkip);var s=function(u,f){return f.reqs-u.reqs};r.layersQueue=new Ec(s),r.setupDequeueing()},Vr=JC.prototype,IS=0,JB=Math.pow(2,53)-1;Vr.makeLayer=function(t,e){var r=Math.pow(2,e),a=Math.ceil(t.w*r),i=Math.ceil(t.h*r),s=this.renderer.makeOffscreenCanvas(a,i),o={id:IS=++IS%JB,bb:t,level:e,width:a,height:i,canvas:s,context:s.getContext("2d"),eles:[],elesQueue:[],reqs:0},u=o.context,f=-o.bb.x1,d=-o.bb.y1;return u.scale(r,r),u.translate(f,d),o};Vr.getLayers=function(t,e,r){var a=this,i=a.renderer,s=i.cy,o=s.zoom(),u=a.firstGet;if(a.firstGet=!1,r==null){if(r=Math.ceil(L0(o*e)),r<qu)r=qu;else if(o>=FB||r>Id)return null}a.validateLayersElesOrdering(r,t);var f=a.layersByLevel,d=Math.pow(2,r),h=f[r]=f[r]||[],p,g=a.levelIsComplete(r,t),y,b=function(){var L=function(Y){if(a.validateLayersElesOrdering(Y,t),a.levelIsComplete(Y,t))return y=f[Y],!0},_=function(Y){if(!y)for(var U=r+Y;qu<=U&&U<=Id&&!L(U);U+=Y);};_(1),_(-1);for(var P=h.length-1;P>=0;P--){var q=h[P];q.invalid&&Zi(h,q)}};if(!g)b();else return h;var E=function(){if(!p){p=ta();for(var L=0;L<t.length;L++)$R(p,t[L].boundingBox())}return p},S=function(L){L=L||{};var _=L.after;E();var P=Math.ceil(p.w*d),q=Math.ceil(p.h*d);if(P>qS||q>qS)return null;var F=P*q;if(F>ZB)return null;var Y=a.makeLayer(p,r);if(_!=null){var U=h.indexOf(_)+1;h.splice(U,0,Y)}else(L.insert===void 0||L.insert)&&h.unshift(Y);return Y};if(a.skipping&&!u)return null;for(var T=null,C=t.length/VB,N=!u,j=0;j<t.length;j++){var M=t[j],D=M._private.rscratch,A=D.imgLayerCaches=D.imgLayerCaches||{},B=A[r];if(B){T=B;continue}if((!T||T.eles.length>=C||!YT(T.bb,M.boundingBox()))&&(T=S({insert:!0,after:T}),!T))return null;y||N?a.queueLayer(T,M):a.drawEleInLayer(T,M,r,e),T.eles.push(M),A[r]=T}return y||(N?null:h)};Vr.getEleLevelForLayerLevel=function(t,e){return t};Vr.drawEleInLayer=function(t,e,r,a){var i=this,s=this.renderer,o=t.context,u=e.boundingBox();u.w===0||u.h===0||!e.visible()||(r=i.getEleLevelForLayerLevel(r,a),s.setImgSmoothing(o,!1),s.drawCachedElement(o,e,null,null,r,WB),s.setImgSmoothing(o,!0))};Vr.levelIsComplete=function(t,e){var r=this,a=r.layersByLevel[t];if(!a||a.length===0)return!1;for(var i=0,s=0;s<a.length;s++){var o=a[s];if(o.reqs>0||o.invalid)return!1;i+=o.eles.length}return i===e.length};Vr.validateLayersElesOrdering=function(t,e){var r=this.layersByLevel[t];if(r)for(var a=0;a<r.length;a++){for(var i=r[a],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}}};Vr.updateElementsInLayers=function(t,e){for(var r=this,a=yc(t[0]),i=0;i<t.length;i++)for(var s=a?null:t[i],o=a?t[i]:t[i].ele,u=o._private.rscratch,f=u.imgLayerCaches=u.imgLayerCaches||{},d=qu;d<=Id;d++){var h=f[d];h&&(s&&r.getEleLevelForLayerLevel(h.level)!==s.level||e(h,o,s))}};Vr.haveLayers=function(){for(var t=this,e=!1,r=qu;r<=Id;r++){var a=t.layersByLevel[r];if(a&&a.length>0){e=!0;break}}return e};Vr.invalidateElements=function(t){var e=this;t.length!==0&&(e.lastInvalidationTime=Yn(),!(t.length===0||!e.haveLayers())&&e.updateElementsInLayers(t,function(a,i,s){e.invalidateLayer(a)}))};Vr.invalidateLayer=function(t){if(this.lastInvalidationTime=Yn(),!t.invalid){var e=t.level,r=t.eles,a=this.layersByLevel[e];Zi(a,t),t.elesQueue=[],t.invalid=!0,t.replacement&&(t.replacement.invalid=!0);for(var i=0;i<r.length;i++){var s=r[i]._private.rscratch.imgLayerCaches;s&&(s[e]=null)}}};Vr.refineElementTextures=function(t){var e=this;e.updateElementsInLayers(t,function(a,i,s){var o=a.replacement;if(o||(o=a.replacement=e.makeLayer(a.bb,a.level),o.replaces=a,o.eles=a.eles),!o.reqs)for(var u=0;u<o.eles.length;u++)e.queueLayer(o,o.eles[u])})};Vr.enqueueElementRefinement=function(t){this.eleTxrDeqs.merge(t),this.scheduleElementRefinement()};Vr.queueLayer=function(t,e){var r=this,a=r.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++,a.updateItem(t)):(t.reqs=1,a.push(t))}};Vr.dequeue=function(t){for(var e=this,r=e.layersQueue,a=[],i=0;i<$B&&r.size()!==0;){var s=r.peek();if(s.replacement){r.pop();continue}if(s.replaces&&s!==s.replaces.replacement){r.pop();continue}if(s.invalid){r.pop();continue}var o=s.elesQueue.shift();o&&(e.drawEleInLayer(s,o,s.level,t),i++),a.length===0&&a.push(!0),s.elesQueue.length===0&&(r.pop(),s.reqs=0,s.replaces&&e.applyLayerReplacement(s),e.requestRedraw())}return a};Vr.applyLayerReplacement=function(t){var e=this,r=e.layersByLevel[t.level],a=t.replaces,i=r.indexOf(a);if(!(i<0||a.invalid)){r[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()}};Vr.requestRedraw=Sc(function(){var t=this.renderer;t.redrawHint("eles",!0),t.redrawHint("drag",!0),t.redraw()},100);Vr.setupDequeueing=ZC.setupDequeueing({deqRedrawThreshold:HB,deqCost:QB,deqAvgCost:YB,deqNoDrawCost:KB,deqFastCost:XB,deq:function(e,r){return e.dequeue(r)},onDeqd:k0,shouldRedraw:IT,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var eN={},VS;function eL(t,e){for(var r=0;r<e.length;r++){var a=e[r];t.lineTo(a.x,a.y)}}function tL(t,e,r){for(var a,i=0;i<e.length;i++){var s=e[i];i===0&&(a=s),t.lineTo(s.x,s.y)}t.quadraticCurveTo(r.x,r.y,a.x,a.y)}function FS(t,e,r){t.beginPath&&t.beginPath();for(var a=e,i=0;i<a.length;i++){var s=a[i];t.lineTo(s.x,s.y)}var o=r,u=r[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 rL(t,e,r,a,i){t.beginPath&&t.beginPath(),t.arc(r,a,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 f=s[u];t.lineTo(f.x,f.y)}t.closePath&&t.closePath()}function aL(t,e,r,a){t.arc(e,r,a,0,Math.PI*2,!1)}eN.arrowShapeImpl=function(t){return(VS||(VS={polygon:eL,"triangle-backcurve":tL,"triangle-tee":FS,"circle-triangle":rL,"triangle-cross":FS,circle:aL}))[t]};var bn={};bn.drawElement=function(t,e,r,a,i,s){var o=this;e.isNode()?o.drawNode(t,e,r,a,i,s):o.drawEdge(t,e,r,a,i,s)};bn.drawElementOverlay=function(t,e){var r=this;e.isNode()?r.drawNodeOverlay(t,e):r.drawEdgeOverlay(t,e)};bn.drawElementUnderlay=function(t,e){var r=this;e.isNode()?r.drawNodeUnderlay(t,e):r.drawEdgeUnderlay(t,e)};bn.drawCachedElementPortion=function(t,e,r,a,i,s,o,u){var f=this,d=r.getBoundingBox(e);if(!(d.w===0||d.h===0)){var h=r.getElement(e,d,a,i,s);if(h!=null){var p=u(f,e);if(p===0)return;var g=o(f,e),y=d.x1,b=d.y1,E=d.w,S=d.h,T,C,N,j,M;if(g!==0){var D=r.getRotationPoint(e);N=D.x,j=D.y,t.translate(N,j),t.rotate(g),M=f.getImgSmoothing(t),M||f.setImgSmoothing(t,!0);var A=r.getRotationOffset(e);T=A.x,C=A.y}else T=y,C=b;var B;p!==1&&(B=t.globalAlpha,t.globalAlpha=B*p),t.drawImage(h.texture.canvas,h.x,0,h.width,h.height,T,C,E,S),p!==1&&(t.globalAlpha=B),g!==0&&(t.rotate(-g),t.translate(-N,-j),M||f.setImgSmoothing(t,!1))}else r.drawElement(t,e)}};var nL=function(){return 0},iL=function(e,r){return e.getTextAngle(r,null)},sL=function(e,r){return e.getTextAngle(r,"source")},lL=function(e,r){return e.getTextAngle(r,"target")},oL=function(e,r){return r.effectiveOpacity()},lm=function(e,r){return r.pstyle("text-opacity").pfValue*r.effectiveOpacity()};bn.drawCachedElement=function(t,e,r,a,i,s){var o=this,u=o.data,f=u.eleTxrCache,d=u.lblTxrCache,h=u.slbTxrCache,p=u.tlbTxrCache,g=e.boundingBox(),y=s===!0?f.reasons.highQuality:null;if(!(g.w===0||g.h===0||!e.visible())&&(!a||_0(g,a))){var b=e.isEdge(),E=e.element()._private.rscratch.badLine;o.drawElementUnderlay(t,e),o.drawCachedElementPortion(t,e,f,r,i,y,nL,oL),(!b||!E)&&o.drawCachedElementPortion(t,e,d,r,i,y,iL,lm),b&&!E&&(o.drawCachedElementPortion(t,e,h,r,i,y,sL,lm),o.drawCachedElementPortion(t,e,p,r,i,y,lL,lm)),o.drawElementOverlay(t,e)}};bn.drawElements=function(t,e){for(var r=this,a=0;a<e.length;a++){var i=e[a];r.drawElement(t,i)}};bn.drawCachedElements=function(t,e,r,a){for(var i=this,s=0;s<e.length;s++){var o=e[s];i.drawCachedElement(t,o,r,a)}};bn.drawCachedNodes=function(t,e,r,a){for(var i=this,s=0;s<e.length;s++){var o=e[s];o.isNode()&&i.drawCachedElement(t,o,r,a)}};bn.drawLayeredElements=function(t,e,r,a){var i=this,s=i.data.lyrTxrCache.getLayers(e,r);if(s)for(var o=0;o<s.length;o++){var u=s[o],f=u.bb;f.w===0||f.h===0||t.drawImage(u.canvas,f.x1,f.y1,f.w,f.h)}else i.drawCachedElements(t,e,r,a)};var $n={};$n.drawEdge=function(t,e,r){var a=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 f;r&&(f=r,t.translate(-f.x1,-f.y1));var d=s?e.pstyle("opacity").value:1,h=s?e.pstyle("line-opacity").value:1,p=e.pstyle("curve-style").value,g=e.pstyle("line-style").value,y=e.pstyle("width").pfValue,b=e.pstyle("line-cap").value,E=e.pstyle("line-outline-width").value,S=e.pstyle("line-outline-color").value,T=d*h,C=d*h,N=function(){var Y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:T;p==="straight-triangle"?(o.eleStrokeStyle(t,e,Y),o.drawEdgeTrianglePath(e,t,u.allpts)):(t.lineWidth=y,t.lineCap=b,o.eleStrokeStyle(t,e,Y),o.drawEdgePath(e,t,u.allpts,g),t.lineCap="butt")},j=function(){var Y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:T;if(t.lineWidth=y+E,t.lineCap=b,E>0)o.colorStrokeStyle(t,S[0],S[1],S[2],Y);else{t.lineCap="butt";return}p==="straight-triangle"?o.drawEdgeTrianglePath(e,t,u.allpts):(o.drawEdgePath(e,t,u.allpts,g),t.lineCap="butt")},M=function(){i&&o.drawEdgeOverlay(t,e)},D=function(){i&&o.drawEdgeUnderlay(t,e)},A=function(){var Y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:C;o.drawArrowheads(t,e,Y)},B=function(){o.drawElementText(t,e,null,a)};t.lineJoin="round";var R=e.pstyle("ghost").value==="yes";if(R){var L=e.pstyle("ghost-offset-x").pfValue,_=e.pstyle("ghost-offset-y").pfValue,P=e.pstyle("ghost-opacity").value,q=T*P;t.translate(L,_),N(q),A(q),t.translate(-L,-_)}else j();D(),N(),A(),M(),B(),r&&t.translate(f.x1,f.y1)}};var tN=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,a){if(a.visible()){var i=a.pstyle("".concat(e,"-opacity")).value;if(i!==0){var s=this,o=s.usePaths(),u=a._private.rscratch,f=a.pstyle("".concat(e,"-padding")).pfValue,d=2*f,h=a.pstyle("".concat(e,"-color")).value;r.lineWidth=d,u.edgeType==="self"&&!o?r.lineCap="butt":r.lineCap="round",s.colorStrokeStyle(r,h[0],h[1],h[2],i),s.drawEdgePath(a,r,u.allpts,"solid")}}}};$n.drawEdgeOverlay=tN("overlay");$n.drawEdgeUnderlay=tN("underlay");$n.drawEdgePath=function(t,e,r,a){var i=t._private.rscratch,s=e,o,u=!1,f=this.usePaths(),d=t.pstyle("line-dash-pattern").pfValue,h=t.pstyle("line-dash-offset").pfValue;if(f){var p=r.join("$"),g=i.pathCacheKey&&i.pathCacheKey===p;g?(o=e=i.pathCache,u=!0):(o=e=new Path2D,i.pathCacheKey=p,i.pathCache=o)}if(s.setLineDash)switch(a){case"dotted":s.setLineDash([1,1]);break;case"dashed":s.setLineDash(d),s.lineDashOffset=h;break;case"solid":s.setLineDash([]);break}if(!u&&!i.badLine)switch(e.beginPath&&e.beginPath(),e.moveTo(r[0],r[1]),i.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var y=2;y+3<r.length;y+=4)e.quadraticCurveTo(r[y],r[y+1],r[y+2],r[y+3]);break;case"straight":case"haystack":for(var b=2;b+1<r.length;b+=2)e.lineTo(r[b],r[b+1]);break;case"segments":if(i.isRound){var E=pa(i.roundCorners),S;try{for(E.s();!(S=E.n()).done;){var T=S.value;FC(e,T)}}catch(N){E.e(N)}finally{E.f()}e.lineTo(r[r.length-2],r[r.length-1])}else for(var C=2;C+1<r.length;C+=2)e.lineTo(r[C],r[C+1]);break}e=s,f?e.stroke(o):e.stroke(),e.setLineDash&&e.setLineDash([])};$n.drawEdgeTrianglePath=function(t,e,r){e.fillStyle=e.strokeStyle;for(var a=t.pstyle("width").pfValue,i=0;i+1<r.length;i+=2){var s=[r[i+2]-r[i],r[i+3]-r[i+1]],o=Math.sqrt(s[0]*s[0]+s[1]*s[1]),u=[s[1]/o,-s[0]/o],f=[u[0]*a/2,u[1]*a/2];e.beginPath(),e.moveTo(r[i]-f[0],r[i+1]-f[1]),e.lineTo(r[i]+f[0],r[i+1]+f[1]),e.lineTo(r[i+2],r[i+3]),e.closePath(),e.fill()}};$n.drawArrowheads=function(t,e,r){var a=e._private.rscratch,i=a.edgeType==="haystack";i||this.drawArrowhead(t,e,"source",a.arrowStartX,a.arrowStartY,a.srcArrowAngle,r),this.drawArrowhead(t,e,"mid-target",a.midX,a.midY,a.midtgtArrowAngle,r),this.drawArrowhead(t,e,"mid-source",a.midX,a.midY,a.midsrcArrowAngle,r),i||this.drawArrowhead(t,e,"target",a.arrowEndX,a.arrowEndY,a.tgtArrowAngle,r)};$n.drawArrowhead=function(t,e,r,a,i,s,o){if(!(isNaN(a)||a==null||isNaN(i)||i==null||isNaN(s)||s==null)){var u=this,f=e.pstyle(r+"-arrow-shape").value;if(f!=="none"){var d=e.pstyle(r+"-arrow-fill").value==="hollow"?"both":"filled",h=e.pstyle(r+"-arrow-fill").value,p=e.pstyle("width").pfValue,g=e.pstyle(r+"-arrow-width"),y=g.value==="match-line"?p:g.pfValue;g.units==="%"&&(y*=p);var b=e.pstyle("opacity").value;o===void 0&&(o=b);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,d,p,f,y,a,i,s),t.globalCompositeOperation=E);var S=e.pstyle(r+"-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,f,y,a,i,s)}}};$n.drawArrowShape=function(t,e,r,a,i,s,o,u,f){var d=this,h=this.usePaths()&&i!=="triangle-cross",p=!1,g,y=e,b={x:o,y:u},E=t.pstyle("arrow-scale").value,S=this.getArrowWidth(a,E),T=d.arrowShapes[i];if(h){var C=d.arrowPathCache=d.arrowPathCache||[],N=Ys(i),j=C[N];j!=null?(g=e=j,p=!0):(g=e=new Path2D,C[N]=g)}p||(e.beginPath&&e.beginPath(),h?T.draw(e,1,0,{x:0,y:0},1):T.draw(e,S,f,b,a),e.closePath&&e.closePath()),e=y,h&&(e.translate(o,u),e.rotate(f),e.scale(S,S)),(r==="filled"||r==="both")&&(h?e.fill(g):e.fill()),(r==="hollow"||r==="both")&&(e.lineWidth=s/(h?S:1),e.lineJoin="miter",h?e.stroke(g):e.stroke()),h&&(e.scale(1/S,1/S),e.rotate(-f),e.translate(-o,-u))};var Z0={};Z0.safeDrawImage=function(t,e,r,a,i,s,o,u,f,d){if(!(i<=0||s<=0||f<=0||d<=0))try{t.drawImage(e,r,a,i,s,o,u,f,d)}catch(h){At(h)}};Z0.drawInscribedImage=function(t,e,r,a,i){var s=this,o=r.position(),u=o.x,f=o.y,d=r.cy().style(),h=d.getIndexedStyle.bind(d),p=h(r,"background-fit","value",a),g=h(r,"background-repeat","value",a),y=r.width(),b=r.height(),E=r.padding()*2,S=y+(h(r,"background-width-relative-to","value",a)==="inner"?0:E),T=b+(h(r,"background-height-relative-to","value",a)==="inner"?0:E),C=r._private.rscratch,N=h(r,"background-clip","value",a),j=N==="node",M=h(r,"background-image-opacity","value",a)*i,D=h(r,"background-image-smoothing","value",a),A=r.pstyle("corner-radius").value;A!=="auto"&&(A=r.pstyle("corner-radius").pfValue);var B=e.width||e.cachedW,R=e.height||e.cachedH;(B==null||R==null)&&(document.body.appendChild(e),B=e.cachedW=e.width||e.offsetWidth,R=e.cachedH=e.height||e.offsetHeight,document.body.removeChild(e));var L=B,_=R;if(h(r,"background-width","value",a)!=="auto"&&(h(r,"background-width","units",a)==="%"?L=h(r,"background-width","pfValue",a)*S:L=h(r,"background-width","pfValue",a)),h(r,"background-height","value",a)!=="auto"&&(h(r,"background-height","units",a)==="%"?_=h(r,"background-height","pfValue",a)*T:_=h(r,"background-height","pfValue",a)),!(L===0||_===0)){if(p==="contain"){var P=Math.min(S/L,T/_);L*=P,_*=P}else if(p==="cover"){var P=Math.max(S/L,T/_);L*=P,_*=P}var q=u-S/2,F=h(r,"background-position-x","units",a),Y=h(r,"background-position-x","pfValue",a);F==="%"?q+=(S-L)*Y:q+=Y;var U=h(r,"background-offset-x","units",a),z=h(r,"background-offset-x","pfValue",a);U==="%"?q+=(S-L)*z:q+=z;var H=f-T/2,X=h(r,"background-position-y","units",a),K=h(r,"background-position-y","pfValue",a);X==="%"?H+=(T-_)*K:H+=K;var k=h(r,"background-offset-y","units",a),G=h(r,"background-offset-y","pfValue",a);k==="%"?H+=(T-_)*G:H+=G,C.pathCache&&(q-=u,H-=f,u=0,f=0);var $=t.globalAlpha;t.globalAlpha=M;var J=s.getImgSmoothing(t),ne=!1;if(D==="no"&&J?(s.setImgSmoothing(t,!1),ne=!0):D==="yes"&&!J&&(s.setImgSmoothing(t,!0),ne=!0),g==="no-repeat")j&&(t.save(),C.pathCache?t.clip(C.pathCache):(s.nodeShapes[s.getNodeShape(r)].draw(t,u,f,S,T,A,C),t.clip())),s.safeDrawImage(t,e,0,0,B,R,q,H,L,_),j&&t.restore();else{var ee=t.createPattern(e,g);t.fillStyle=ee,s.nodeShapes[s.getNodeShape(r)].draw(t,u,f,S,T,A,C),t.translate(q,H),t.fill(),t.translate(-q,-H)}t.globalAlpha=$,ne&&s.setImgSmoothing(t,J)}};var nl={};nl.eleTextBiggerThanMin=function(t,e){if(!e){var r=t.cy().zoom(),a=this.getPixelRatio(),i=Math.ceil(L0(r*a));e=Math.pow(2,i)}var s=t.pstyle("font-size").pfValue*e,o=t.pstyle("min-zoomed-font-size").pfValue;return!(s<o)};nl.drawElementText=function(t,e,r,a,i){var s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this;if(a==null){if(s&&!o.eleTextBiggerThanMin(e))return}else if(a===!1)return;if(e.isNode()){var u=e.pstyle("label");if(!u||!u.value)return;var f=o.getLabelJustification(e);t.textAlign=f,t.textBaseline="bottom"}else{var d=e.element()._private.rscratch.badLine,h=e.pstyle("label"),p=e.pstyle("source-label"),g=e.pstyle("target-label");if(d||(!h||!h.value)&&(!p||!p.value)&&(!g||!g.value))return;t.textAlign="center",t.textBaseline="bottom"}var y=!r,b;r&&(b=r,t.translate(-b.x1,-b.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),r&&t.translate(b.x1,b.y1)};nl.getFontCache=function(t){var e;this.fontCaches=this.fontCaches||[];for(var r=0;r<this.fontCaches.length;r++)if(e=this.fontCaches[r],e.context===t)return e;return e={context:t},this.fontCaches.push(e),e};nl.setupTextStyle=function(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=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=r?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,f=e.pstyle("text-outline-opacity").value*u,d=e.pstyle("color").value,h=e.pstyle("text-outline-color").value;t.font=a+" "+o+" "+i+" "+s,t.lineJoin="round",this.colorFillStyle(t,d[0],d[1],d[2],u),this.colorStrokeStyle(t,h[0],h[1],h[2],f)};function uL(t,e,r,a,i){var s=Math.min(a,i),o=s/2,u=e+a/2,f=r+i/2;t.beginPath(),t.arc(u,f,o,0,Math.PI*2),t.closePath()}function HS(t,e,r,a,i){var s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,o=Math.min(s,a/2,i/2);t.beginPath(),t.moveTo(e+o,r),t.lineTo(e+a-o,r),t.quadraticCurveTo(e+a,r,e+a,r+o),t.lineTo(e+a,r+i-o),t.quadraticCurveTo(e+a,r+i,e+a-o,r+i),t.lineTo(e+o,r+i),t.quadraticCurveTo(e,r+i,e,r+i-o),t.lineTo(e,r+o),t.quadraticCurveTo(e,r,e+o,r),t.closePath()}nl.getTextAngle=function(t,e){var r,a=t._private,i=a.rscratch,s=e?e+"-":"",o=t.pstyle(s+"text-rotation");if(o.strValue==="autorotate"){var u=ha(i,"labelAngle",e);r=t.isEdge()?u:0}else o.strValue==="none"?r=0:r=o.pfValue;return r};nl.drawText=function(t,e,r){var a=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))){r==="main"&&(r=null);var f=ha(o,"labelX",r),d=ha(o,"labelY",r),h,p,g=this.getLabelText(e,r);if(g!=null&&g!==""&&!isNaN(f)&&!isNaN(d)){this.setupTextStyle(t,e,i);var y=r?r+"-":"",b=ha(o,"labelWidth",r),E=ha(o,"labelHeight",r),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,j=e.pstyle("text-valign").value;C&&(N="center",j="center"),f+=S,d+=T;var M;switch(a?M=this.getTextAngle(e,r):M=0,M!==0&&(h=f,p=d,t.translate(h,p),t.rotate(M),f=0,d=0),j){case"top":break;case"center":d+=E/2;break;case"bottom":d+=E;break}var D=e.pstyle("text-background-opacity").value,A=e.pstyle("text-border-opacity").value,B=e.pstyle("text-border-width").pfValue,R=e.pstyle("text-background-padding").pfValue,L=e.pstyle("text-background-shape").strValue,_=L==="round-rectangle"||L==="roundrectangle",P=L==="circle",q=2;if(D>0||B>0&&A>0){var F=t.fillStyle,Y=t.strokeStyle,U=t.lineWidth,z=e.pstyle("text-background-color").value,H=e.pstyle("text-border-color").value,X=e.pstyle("text-border-style").value,K=D>0,k=B>0&&A>0,G=f-R;switch(N){case"left":G-=b;break;case"center":G-=b/2;break}var $=d-E-R,J=b+2*R,ne=E+2*R;if(K&&(t.fillStyle="rgba(".concat(z[0],",").concat(z[1],",").concat(z[2],",").concat(D*u,")")),k&&(t.strokeStyle="rgba(".concat(H[0],",").concat(H[1],",").concat(H[2],",").concat(A*u,")"),t.lineWidth=B,t.setLineDash))switch(X){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"double":t.lineWidth=B/4,t.setLineDash([]);break;case"solid":default:t.setLineDash([]);break}if(_?(t.beginPath(),HS(t,G,$,J,ne,q)):P?(t.beginPath(),uL(t,G,$,J,ne)):(t.beginPath(),t.rect(G,$,J,ne)),K&&t.fill(),k&&t.stroke(),k&&X==="double"){var ee=B/2;t.beginPath(),_?HS(t,G+ee,$+ee,J-2*ee,ne-2*ee,q):t.rect(G+ee,$+ee,J-2*ee,ne-2*ee),t.stroke()}t.fillStyle=F,t.strokeStyle=Y,t.lineWidth=U,t.setLineDash&&t.setLineDash([])}var ae=2*e.pstyle("text-outline-width").pfValue;if(ae>0&&(t.lineWidth=ae),e.pstyle("text-wrap").value==="wrap"){var de=ha(o,"labelWrapCachedLines",r),le=ha(o,"labelLineHeight",r),re=b/2,Z=this.getLabelJustification(e);switch(Z==="auto"||(N==="left"?Z==="left"?f+=-b:Z==="center"&&(f+=-re):N==="center"?Z==="left"?f+=-re:Z==="right"&&(f+=re):N==="right"&&(Z==="center"?f+=re:Z==="right"&&(f+=b))),j){case"top":d-=(de.length-1)*le;break;case"center":case"bottom":d-=(de.length-1)*le;break}for(var oe=0;oe<de.length;oe++)ae>0&&t.strokeText(de[oe],f,d),t.fillText(de[oe],f,d),d+=le}else ae>0&&t.strokeText(g,f,d),t.fillText(g,f,d);M!==0&&(t.rotate(-M),t.translate(-h,-p))}}};var os={};os.drawNode=function(t,e,r){var a=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,f,d=e._private,h=d.rscratch,p=e.position();if(!(!Oe(p.x)||!Oe(p.y))&&!(s&&!e.visible())){var g=s?e.effectiveOpacity():1,y=o.usePaths(),b,E=!1,S=e.padding();u=e.width()+2*S,f=e.height()+2*S;var T;r&&(T=r,t.translate(-T.x1,-T.y1));for(var C=e.pstyle("background-image"),N=C.value,j=new Array(N.length),M=new Array(N.length),D=0,A=0;A<N.length;A++){var B=N[A],R=j[A]=B!=null&&B!=="none";if(R){var L=e.cy().style().getIndexedStyle(e,"background-image-crossorigin","value",A);D++,M[A]=o.getCachedImage(B,L,function(){d.backgroundTimestamp=Date.now(),e.emitAndNotify("background")})}}var _=e.pstyle("background-blacken").value,P=e.pstyle("border-width").pfValue,q=e.pstyle("background-opacity").value*g,F=e.pstyle("border-color").value,Y=e.pstyle("border-style").value,U=e.pstyle("border-join").value,z=e.pstyle("border-cap").value,H=e.pstyle("border-position").value,X=e.pstyle("border-dash-pattern").pfValue,K=e.pstyle("border-dash-offset").pfValue,k=e.pstyle("border-opacity").value*g,G=e.pstyle("outline-width").pfValue,$=e.pstyle("outline-color").value,J=e.pstyle("outline-style").value,ne=e.pstyle("outline-opacity").value*g,ee=e.pstyle("outline-offset").value,ae=e.pstyle("corner-radius").value;ae!=="auto"&&(ae=e.pstyle("corner-radius").pfValue);var de=function(){var qe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:q;o.eleFillStyle(t,e,qe)},le=function(){var qe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:k;o.colorStrokeStyle(t,F[0],F[1],F[2],qe)},re=function(){var qe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ne;o.colorStrokeStyle(t,$[0],$[1],$[2],qe)},Z=function(qe,we,Q,ue){var ge=o.nodePathCache=o.nodePathCache||[],pe=qT(Q==="polygon"?Q+","+ue.join(","):Q,""+we,""+qe,""+ae),Se=ge[pe],_e,Ae=!1;return Se!=null?(_e=Se,Ae=!0,h.pathCache=_e):(_e=new Path2D,ge[pe]=h.pathCache=_e),{path:_e,cacheHit:Ae}},oe=e.pstyle("shape").strValue,ve=e.pstyle("shape-polygon-points").pfValue;if(y){t.translate(p.x,p.y);var Ne=Z(u,f,oe,ve);b=Ne.path,E=Ne.cacheHit}var Me=function(){if(!E){var qe=p;y&&(qe={x:0,y:0}),o.nodeShapes[o.getNodeShape(e)].draw(b||t,qe.x,qe.y,u,f,ae,h)}y?t.fill(b):t.fill()},Je=function(){for(var qe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:g,we=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,Q=d.backgrounding,ue=0,ge=0;ge<M.length;ge++){var pe=e.cy().style().getIndexedStyle(e,"background-image-containment","value",ge);if(we&&pe==="over"||!we&&pe==="inside"){ue++;continue}j[ge]&&M[ge].complete&&!M[ge].error&&(ue++,o.drawInscribedImage(t,M[ge],e,ge,qe))}d.backgrounding=ue!==D,Q!==d.backgrounding&&e.updateStyle(!1)},Ce=function(){var qe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,we=arguments.length>1&&arguments[1]!==void 0?arguments[1]:g;o.hasPie(e)&&(o.drawPie(t,e,we),qe&&(y||o.nodeShapes[o.getNodeShape(e)].draw(t,p.x,p.y,u,f,ae,h)))},ke=function(){var qe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,we=arguments.length>1&&arguments[1]!==void 0?arguments[1]:g;o.hasStripe(e)&&(t.save(),y?t.clip(h.pathCache):(o.nodeShapes[o.getNodeShape(e)].draw(t,p.x,p.y,u,f,ae,h),t.clip()),o.drawStripe(t,e,we),t.restore(),qe&&(y||o.nodeShapes[o.getNodeShape(e)].draw(t,p.x,p.y,u,f,ae,h)))},Le=function(){var qe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:g,we=(_>0?_:-_)*qe,Q=_>0?0:255;_!==0&&(o.colorFillStyle(t,Q,Q,Q,we),y?t.fill(b):t.fill())},De=function(){if(P>0){if(t.lineWidth=P,t.lineCap=z,t.lineJoin=U,t.setLineDash)switch(Y){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash(X),t.lineDashOffset=K;break;case"solid":case"double":t.setLineDash([]);break}if(H!=="center"){if(t.save(),t.lineWidth*=2,H==="inside")y?t.clip(b):t.clip();else{var qe=new Path2D;qe.rect(-u/2-P,-f/2-P,u+2*P,f+2*P),qe.addPath(b),t.clip(qe,"evenodd")}y?t.stroke(b):t.stroke(),t.restore()}else y?t.stroke(b):t.stroke();if(Y==="double"){t.lineWidth=P/3;var we=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",y?t.stroke(b):t.stroke(),t.globalCompositeOperation=we}t.setLineDash&&t.setLineDash([])}},Ue=function(){if(G>0){if(t.lineWidth=G,t.lineCap="butt",t.setLineDash)switch(J){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"solid":case"double":t.setLineDash([]);break}var qe=p;y&&(qe={x:0,y:0});var we=o.getNodeShape(e),Q=P;H==="inside"&&(Q=0),H==="outside"&&(Q*=2);var ue=(u+Q+(G+ee))/u,ge=(f+Q+(G+ee))/f,pe=u*ue,Se=f*ge,_e=o.nodeShapes[we].points,Ae;if(y){var He=Z(pe,Se,we,_e);Ae=He.path}if(we==="ellipse")o.drawEllipsePath(Ae||t,qe.x,qe.y,pe,Se);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(we)){var ze=0,Ke=0,nt=0;we==="round-diamond"?ze=(Q+ee+G)*1.4:we==="round-heptagon"?(ze=(Q+ee+G)*1.075,nt=-(Q/2+ee+G)/35):we==="round-hexagon"?ze=(Q+ee+G)*1.12:we==="round-pentagon"?(ze=(Q+ee+G)*1.13,nt=-(Q/2+ee+G)/15):we==="round-tag"?(ze=(Q+ee+G)*1.12,Ke=(Q/2+G+ee)*.07):we==="round-triangle"&&(ze=(Q+ee+G)*(Math.PI/2),nt=-(Q+ee/2+G)/Math.PI),ze!==0&&(ue=(u+ze)/u,pe=u*ue,["round-hexagon","round-tag"].includes(we)||(ge=(f+ze)/f,Se=f*ge)),ae=ae==="auto"?$T(pe,Se):ae;for(var it=pe/2,Ve=Se/2,ft=ae+(Q+G+ee)/2,ot=new Array(_e.length/2),Yt=new Array(_e.length/2),Rt=0;Rt<_e.length/2;Rt++)ot[Rt]={x:qe.x+Ke+it*_e[Rt*2],y:qe.y+nt+Ve*_e[Rt*2+1]};var kr,Kt,nr,Wt,ir=ot.length;for(Kt=ot[ir-1],kr=0;kr<ir;kr++)nr=ot[kr%ir],Wt=ot[(kr+1)%ir],Yt[kr]=X0(Kt,nr,Wt,ft),Kt=nr,nr=Wt;o.drawRoundPolygonPath(Ae||t,qe.x+Ke,qe.y+nt,u*ue,f*ge,_e,Yt)}else if(["roundrectangle","round-rectangle"].includes(we))ae=ae==="auto"?Wi(pe,Se):ae,o.drawRoundRectanglePath(Ae||t,qe.x,qe.y,pe,Se,ae+(Q+G+ee)/2);else if(["cutrectangle","cut-rectangle"].includes(we))ae=ae==="auto"?P0():ae,o.drawCutRectanglePath(Ae||t,qe.x,qe.y,pe,Se,null,ae+(Q+G+ee)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(we))ae=ae==="auto"?Wi(pe,Se):ae,o.drawBottomRoundRectanglePath(Ae||t,qe.x,qe.y,pe,Se,ae+(Q+G+ee)/2);else if(we==="barrel")o.drawBarrelPath(Ae||t,qe.x,qe.y,pe,Se);else if(we.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(we)){var ja=(Q+G+ee)/u;_e=Bd(Ld(_e,ja)),o.drawPolygonPath(Ae||t,qe.x,qe.y,u,f,_e)}else{var Xt=(Q+G+ee)/u;_e=Bd(Ld(_e,-Xt)),o.drawPolygonPath(Ae||t,qe.x,qe.y,u,f,_e)}if(y?t.stroke(Ae):t.stroke(),J==="double"){t.lineWidth=Q/3;var Da=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",y?t.stroke(Ae):t.stroke(),t.globalCompositeOperation=Da}t.setLineDash&&t.setLineDash([])}},xe=function(){i&&o.drawNodeOverlay(t,e,p,u,f)},Ye=function(){i&&o.drawNodeUnderlay(t,e,p,u,f)},Re=function(){o.drawElementText(t,e,null,a)},ye=e.pstyle("ghost").value==="yes";if(ye){var Ge=e.pstyle("ghost-offset-x").pfValue,rt=e.pstyle("ghost-offset-y").pfValue,at=e.pstyle("ghost-opacity").value,ct=at*g;t.translate(Ge,rt),re(),Ue(),de(at*q),Me(),Je(ct,!0),le(at*k),De(),Ce(_!==0||P!==0),ke(_!==0||P!==0),Je(ct,!1),Le(ct),t.translate(-Ge,-rt)}y&&t.translate(-p.x,-p.y),Ye(),y&&t.translate(p.x,p.y),re(),Ue(),de(),Me(),Je(g,!0),le(),De(),Ce(_!==0||P!==0),ke(_!==0||P!==0),Je(g,!1),Le(),y&&t.translate(-p.x,-p.y),Re(),xe(),r&&t.translate(T.x1,T.y1)}};var rN=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,a,i,s,o){var u=this;if(a.visible()){var f=a.pstyle("".concat(e,"-padding")).pfValue,d=a.pstyle("".concat(e,"-opacity")).value,h=a.pstyle("".concat(e,"-color")).value,p=a.pstyle("".concat(e,"-shape")).value,g=a.pstyle("".concat(e,"-corner-radius")).value;if(d>0){if(i=i||a.position(),s==null||o==null){var y=a.padding();s=a.width()+2*y,o=a.height()+2*y}u.colorFillStyle(r,h[0],h[1],h[2],d),u.nodeShapes[p].draw(r,i.x,i.y,s+f*2,o+f*2,g),r.fill()}}}};os.drawNodeOverlay=rN("overlay");os.drawNodeUnderlay=rN("underlay");os.hasPie=function(t){return t=t[0],t._private.hasPie};os.hasStripe=function(t){return t=t[0],t._private.hasStripe};os.drawPie=function(t,e,r,a){e=e[0],a=a||e.position();var i=e.cy().style(),s=e.pstyle("pie-size"),o=e.pstyle("pie-hole"),u=e.pstyle("pie-start-angle").pfValue,f=a.x,d=a.y,h=e.width(),p=e.height(),g=Math.min(h,p)/2,y,b=0,E=this.usePaths();if(E&&(f=0,d=0),s.units==="%"?g=g*s.pfValue:s.pfValue!==void 0&&(g=s.pfValue/2),o.units==="%"?y=g*o.pfValue:o.pfValue!==void 0&&(y=o.pfValue/2),!(y>=g))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*r,j=T/100;j+b>1&&(j=1-b);var M=1.5*Math.PI+2*Math.PI*b;M+=u;var D=2*Math.PI*j,A=M+D;T===0||b>=1||b+j>1||(y===0?(t.beginPath(),t.moveTo(f,d),t.arc(f,d,g,M,A),t.closePath()):(t.beginPath(),t.arc(f,d,g,M,A),t.arc(f,d,y,A,M,!0),t.closePath()),this.colorFillStyle(t,C[0],C[1],C[2],N),t.fill(),b+=j)}};os.drawStripe=function(t,e,r,a){e=e[0],a=a||e.position();var i=e.cy().style(),s=a.x,o=a.y,u=e.width(),f=e.height(),d=0,h=this.usePaths();t.save();var p=e.pstyle("stripe-direction").value,g=e.pstyle("stripe-size");switch(p){case"vertical":break;case"righward":t.rotate(-Math.PI/2);break}var y=u,b=f;g.units==="%"?(y=y*g.pfValue,b=b*g.pfValue):g.pfValue!==void 0&&(y=g.pfValue,b=g.pfValue),h&&(s=0,o=0),o-=y/2,s-=b/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*r,N=S/100;N+d>1&&(N=1-d),!(S===0||d>=1||d+N>1)&&(t.beginPath(),t.rect(s,o+b*d,y,b*N),t.closePath(),this.colorFillStyle(t,T[0],T[1],T[2],C),t.fill(),d+=N)}t.restore()};var ra={},cL=100;ra.getPixelRatio=function(){var t=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var e=this.cy.window(),r=t.backingStorePixelRatio||t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return(e.devicePixelRatio||1)/r};ra.paintCache=function(t){for(var e=this.paintCaches=this.paintCaches||[],r=!0,a,i=0;i<e.length;i++)if(a=e[i],a.context===t){r=!1;break}return r&&(a={context:t},e.push(a)),a};ra.createGradientStyleFor=function(t,e,r,a,i){var s,o=this.usePaths(),u=r.pstyle(e+"-gradient-stop-colors").value,f=r.pstyle(e+"-gradient-stop-positions").pfValue;if(a==="radial-gradient")if(r.isEdge()){var d=r.sourceEndpoint(),h=r.targetEndpoint(),p=r.midpoint(),g=Ks(d,p),y=Ks(h,p);s=t.createRadialGradient(p.x,p.y,0,p.x,p.y,Math.max(g,y))}else{var b=o?{x:0,y:0}:r.position(),E=r.paddedWidth(),S=r.paddedHeight();s=t.createRadialGradient(b.x,b.y,0,b.x,b.y,Math.max(E,S))}else if(r.isEdge()){var T=r.sourceEndpoint(),C=r.targetEndpoint();s=t.createLinearGradient(T.x,T.y,C.x,C.y)}else{var N=o?{x:0,y:0}:r.position(),j=r.paddedWidth(),M=r.paddedHeight(),D=j/2,A=M/2,B=r.pstyle("background-gradient-direction").value;switch(B){case"to-bottom":s=t.createLinearGradient(N.x,N.y-A,N.x,N.y+A);break;case"to-top":s=t.createLinearGradient(N.x,N.y+A,N.x,N.y-A);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-A,N.x+D,N.y+A);break;case"to-top-right":case"to-right-top":s=t.createLinearGradient(N.x-D,N.y+A,N.x+D,N.y-A);break;case"to-bottom-left":case"to-left-bottom":s=t.createLinearGradient(N.x+D,N.y-A,N.x-D,N.y+A);break;case"to-top-left":case"to-left-top":s=t.createLinearGradient(N.x+D,N.y+A,N.x-D,N.y-A);break}}if(!s)return null;for(var R=f.length===u.length,L=u.length,_=0;_<L;_++)s.addColorStop(R?f[_]:_/(L-1),"rgba("+u[_][0]+","+u[_][1]+","+u[_][2]+","+i+")");return s};ra.gradientFillStyle=function(t,e,r,a){var i=this.createGradientStyleFor(t,"background",e,r,a);if(!i)return null;t.fillStyle=i};ra.colorFillStyle=function(t,e,r,a,i){t.fillStyle="rgba("+e+","+r+","+a+","+i+")"};ra.eleFillStyle=function(t,e,r){var a=e.pstyle("background-fill").value;if(a==="linear-gradient"||a==="radial-gradient")this.gradientFillStyle(t,e,a,r);else{var i=e.pstyle("background-color").value;this.colorFillStyle(t,i[0],i[1],i[2],r)}};ra.gradientStrokeStyle=function(t,e,r,a){var i=this.createGradientStyleFor(t,"line",e,r,a);if(!i)return null;t.strokeStyle=i};ra.colorStrokeStyle=function(t,e,r,a,i){t.strokeStyle="rgba("+e+","+r+","+a+","+i+")"};ra.eleStrokeStyle=function(t,e,r){var a=e.pstyle("line-fill").value;if(a==="linear-gradient"||a==="radial-gradient")this.gradientStrokeStyle(t,e,a,r);else{var i=e.pstyle("line-color").value;this.colorStrokeStyle(t,i[0],i[1],i[2],r)}};ra.matchCanvasSize=function(t){var e=this,r=e.data,a=e.findContainerClientCoords(),i=a[2],s=a[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 f=i*o,d=s*o,h;if(!(f===e.canvasWidth&&d===e.canvasHeight)){e.fontCaches=null;var p=r.canvasContainer;p.style.width=i+"px",p.style.height=s+"px";for(var g=0;g<e.CANVAS_LAYERS;g++)h=r.canvases[g],h.width=f,h.height=d,h.style.width=i+"px",h.style.height=s+"px";for(var g=0;g<e.BUFFER_COUNT;g++)h=r.bufferCanvases[g],h.width=f,h.height=d,h.style.width=i+"px",h.style.height=s+"px";e.textureMult=1,o<=1&&(h=r.bufferCanvases[e.TEXTURE_BUFFER],e.textureMult=2,h.width=f*e.textureMult,h.height=d*e.textureMult),e.canvasWidth=f,e.canvasHeight=d,e.pixelRatio=o}};ra.renderTo=function(t,e,r,a){this.render({forcedContext:t,forcedZoom:e,forcedPan:r,drawAllLayers:!0,forcedPxRatio:a})};ra.clearCanvas=function(){var t=this,e=t.data;function r(a){a.clearRect(0,0,t.canvasWidth,t.canvasHeight)}r(e.contexts[t.NODE]),r(e.contexts[t.DRAG])};ra.render=function(t){var e=this;t=t||HT();var r=e.cy,a=t.forcedContext,i=t.drawAllLayers,s=t.drawOnlyNodeLayer,o=t.forcedZoom,u=t.forcedPan,f=t.forcedPxRatio===void 0?this.getPixelRatio():t.forcedPxRatio,d=e.data,h=d.canvasNeedsRedraw,p=e.textureOnViewport&&!a&&(e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming),g=t.motionBlur!==void 0?t.motionBlur:e.motionBlur,y=e.motionBlurPxRatio,b=r.hasCompoundNodes(),E=e.hoverData.draggingEles,S=!!(e.hoverData.selecting||e.touchData.selecting);g=g&&!a&&e.motionBlurEnabled&&!S;var T=g;a||(e.prevPxRatio!==f&&(e.invalidateContainerClientCoordsCache(),e.matchCanvasSize(e.container),e.redrawHint("eles",!0),e.redrawHint("drag",!0)),e.prevPxRatio=f),!a&&e.motionBlurTimeout&&clearTimeout(e.motionBlurTimeout),g&&(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=r.style(),N=r.zoom(),j=o!==void 0?o:N,M=r.pan(),D={x:M.x,y:M.y},A={zoom:N,pan:{x:M.x,y:M.y}},B=e.prevViewport,R=B===void 0||A.zoom!==B.zoom||A.pan.x!==B.pan.x||A.pan.y!==B.pan.y;!R&&!(E&&!b)&&(e.motionBlurPxRatio=1),u&&(D=u),j*=f,D.x*=f,D.y*=f;var L=e.getCachedZSortedEles();function _(le,re,Z,oe,ve){var Ne=le.globalCompositeOperation;le.globalCompositeOperation="destination-out",e.colorFillStyle(le,255,255,255,e.motionBlurTransparency),le.fillRect(re,Z,oe,ve),le.globalCompositeOperation=Ne}function P(le,re){var Z,oe,ve,Ne;!e.clearingMotionBlur&&(le===d.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]||le===d.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG])?(Z={x:M.x*y,y:M.y*y},oe=N*y,ve=e.canvasWidth*y,Ne=e.canvasHeight*y):(Z=D,oe=j,ve=e.canvasWidth,Ne=e.canvasHeight),le.setTransform(1,0,0,1,0,0),re==="motionBlur"?_(le,0,0,ve,Ne):!a&&(re===void 0||re)&&le.clearRect(0,0,ve,Ne),i||(le.translate(Z.x,Z.y),le.scale(oe,oe)),u&&le.translate(u.x,u.y),o&&le.scale(o,o)}if(p||(e.textureDrawLastFrame=!1),p){if(e.textureDrawLastFrame=!0,!e.textureCache){e.textureCache={},e.textureCache.bb=r.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:f*e.textureMult});var A=e.textureCache.viewport={zoom:r.zoom(),pan:r.pan(),width:e.canvasWidth,height:e.canvasHeight};A.mpan={x:(0-A.pan.x)/A.zoom,y:(0-A.pan.y)/A.zoom}}h[e.DRAG]=!1,h[e.NODE]=!1;var F=d.contexts[e.NODE],Y=e.textureCache.texture,A=e.textureCache.viewport;F.setTransform(1,0,0,1,0,0),g?_(F,0,0,A.width,A.height):F.clearRect(0,0,A.width,A.height);var U=C.core("outside-texture-bg-color").value,z=C.core("outside-texture-bg-opacity").value;e.colorFillStyle(F,U[0],U[1],U[2],z),F.fillRect(0,0,A.width,A.height);var N=r.zoom();P(F,!1),F.clearRect(A.mpan.x,A.mpan.y,A.width/A.zoom/f,A.height/A.zoom/f),F.drawImage(Y,A.mpan.x,A.mpan.y,A.width/A.zoom/f,A.height/A.zoom/f)}else e.textureOnViewport&&!a&&(e.textureCache=null);var H=r.extent(),X=e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming||e.hoverData.draggingEles||e.cy.animated(),K=e.hideEdgesOnViewport&&X,k=[];if(k[e.NODE]=!h[e.NODE]&&g&&!e.clearedForMotionBlur[e.NODE]||e.clearingMotionBlur,k[e.NODE]&&(e.clearedForMotionBlur[e.NODE]=!0),k[e.DRAG]=!h[e.DRAG]&&g&&!e.clearedForMotionBlur[e.DRAG]||e.clearingMotionBlur,k[e.DRAG]&&(e.clearedForMotionBlur[e.DRAG]=!0),h[e.NODE]||i||s||k[e.NODE]){var G=g&&!k[e.NODE]&&y!==1,F=a||(G?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]:d.contexts[e.NODE]),$=g&&!G?"motionBlur":void 0;P(F,$),K?e.drawCachedNodes(F,L.nondrag,f,H):e.drawLayeredElements(F,L.nondrag,f,H),e.debug&&e.drawDebugPoints(F,L.nondrag),!i&&!g&&(h[e.NODE]=!1)}if(!s&&(h[e.DRAG]||i||k[e.DRAG])){var G=g&&!k[e.DRAG]&&y!==1,F=a||(G?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG]:d.contexts[e.DRAG]);P(F,g&&!G?"motionBlur":void 0),K?e.drawCachedNodes(F,L.drag,f,H):e.drawCachedElements(F,L.drag,f,H),e.debug&&e.drawDebugPoints(F,L.drag),!i&&!g&&(h[e.DRAG]=!1)}if(this.drawSelectionRectangle(t,P),g&&y!==1){var J=d.contexts[e.NODE],ne=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE],ee=d.contexts[e.DRAG],ae=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG],de=function(re,Z,oe){re.setTransform(1,0,0,1,0,0),oe||!T?re.clearRect(0,0,e.canvasWidth,e.canvasHeight):_(re,0,0,e.canvasWidth,e.canvasHeight);var ve=y;re.drawImage(Z,0,0,e.canvasWidth*ve,e.canvasHeight*ve,0,0,e.canvasWidth,e.canvasHeight)};(h[e.NODE]||k[e.NODE])&&(de(J,ne,k[e.NODE]),h[e.NODE]=!1),(h[e.DRAG]||k[e.DRAG])&&(de(ee,ae,k[e.DRAG]),h[e.DRAG]=!1)}e.prevViewport=A,e.clearingMotionBlur&&(e.clearingMotionBlur=!1,e.motionBlurCleared=!0,e.motionBlur=!0),g&&(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()},cL)),a||r.emit("render")};var Mu;ra.drawSelectionRectangle=function(t,e){var r=this,a=r.cy,i=r.data,s=a.style(),o=t.drawOnlyNodeLayer,u=t.drawAllLayers,f=i.canvasNeedsRedraw,d=t.forcedContext;if(r.showFps||!o&&f[r.SELECT_BOX]&&!u){var h=d||i.contexts[r.SELECT_BOX];if(e(h),r.selection[4]==1&&(r.hoverData.selecting||r.touchData.selecting)){var p=r.cy.zoom(),g=s.core("selection-box-border-width").value/p;h.lineWidth=g,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(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]),g>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(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]))}if(i.bgActivePosistion&&!r.hoverData.selecting){var p=r.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 b=r.lastRedrawTime;if(r.showFps&&b){b=Math.round(b);var E=Math.round(1e3/b),S="1 frame = "+b+" 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",!Mu){var T=h.measureText(S);Mu=T.actualBoundingBoxAscent}h.fillText(S,0,Mu);var C=60;h.strokeRect(0,Mu+10,250,20),h.fillRect(0,Mu+10,250*Math.min(E/C,1),20)}u||(f[r.SELECT_BOX]=!1)}};function GS(t,e,r){var a=t.createShader(e);if(t.shaderSource(a,r),t.compileShader(a),!t.getShaderParameter(a,t.COMPILE_STATUS))throw new Error(t.getShaderInfoLog(a));return a}function fL(t,e,r){var a=GS(t,t.VERTEX_SHADER,e),i=GS(t,t.FRAGMENT_SHADER,r),s=t.createProgram();if(t.attachShader(s,a),t.attachShader(s,i),t.linkProgram(s),!t.getProgramParameter(s,t.LINK_STATUS))throw new Error("Could not initialize shaders");return s}function dL(t,e,r){r===void 0&&(r=e);var a=t.makeOffscreenCanvas(e,r),i=a.context=a.getContext("2d");return a.clear=function(){return i.clearRect(0,0,a.width,a.height)},a.clear(),a}function W0(t){var e=t.pixelRatio,r=t.cy.zoom(),a=t.cy.pan();return{zoom:r*e,pan:{x:a.x*e,y:a.y*e}}}function hL(t){var e=t.pixelRatio,r=t.cy.zoom();return r*e}function vL(t,e,r,a,i){var s=a*r+e.x,o=i*r+e.y;return o=Math.round(t.canvasHeight-o),[s,o]}function pL(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 gL(t,e){if(t.length!==e.length)return!1;for(var r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}function js(t,e,r){var a=t[0]/255,i=t[1]/255,s=t[2]/255,o=e,u=r||new Array(4);return u[0]=a*o,u[1]=i*o,u[2]=s*o,u[3]=o,u}function Ql(t,e){var r=e||new Array(4);return r[0]=(t>>0&255)/255,r[1]=(t>>8&255)/255,r[2]=(t>>16&255)/255,r[3]=(t>>24&255)/255,r}function mL(t){return t[0]+(t[1]<<8)+(t[2]<<16)+(t[3]<<24)}function yL(t,e){var r=t.createTexture();return r.buffer=function(a){t.bindTexture(t.TEXTURE_2D,r),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,a),t.generateMipmap(t.TEXTURE_2D),t.bindTexture(t.TEXTURE_2D,null)},r.deleteTexture=function(){t.deleteTexture(r)},r}function aN(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 nN(t,e,r){switch(e){case t.FLOAT:return new Float32Array(r);case t.INT:return new Int32Array(r)}}function xL(t,e,r,a,i,s){switch(e){case t.FLOAT:return new Float32Array(r.buffer,s*a,i);case t.INT:return new Int32Array(r.buffer,s*a,i)}}function bL(t,e,r,a){var i=aN(t,e),s=pr(i,2),o=s[0],u=s[1],f=nN(t,u,a),d=t.createBuffer();return t.bindBuffer(t.ARRAY_BUFFER,d),t.bufferData(t.ARRAY_BUFFER,f,t.STATIC_DRAW),u===t.FLOAT?t.vertexAttribPointer(r,o,u,!1,0,0):u===t.INT&&t.vertexAttribIPointer(r,o,u,0,0),t.enableVertexAttribArray(r),t.bindBuffer(t.ARRAY_BUFFER,null),d}function cn(t,e,r,a){var i=aN(t,r),s=pr(i,3),o=s[0],u=s[1],f=s[2],d=nN(t,u,e*o),h=o*f,p=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,p),t.bufferData(t.ARRAY_BUFFER,e*h,t.DYNAMIC_DRAW),t.enableVertexAttribArray(a),u===t.FLOAT?t.vertexAttribPointer(a,o,u,!1,h,0):u===t.INT&&t.vertexAttribIPointer(a,o,u,h,0),t.vertexAttribDivisor(a,1),t.bindBuffer(t.ARRAY_BUFFER,null);for(var g=new Array(e),y=0;y<e;y++)g[y]=xL(t,u,d,h,o,y);return p.dataArray=d,p.stride=h,p.size=o,p.getView=function(b){return g[b]},p.setPoint=function(b,E,S){var T=g[b];T[0]=E,T[1]=S},p.bufferSubData=function(b){t.bindBuffer(t.ARRAY_BUFFER,p),b?t.bufferSubData(t.ARRAY_BUFFER,0,d,0,b*o):t.bufferSubData(t.ARRAY_BUFFER,0,d)},p}function wL(t,e,r){for(var a=9,i=new Float32Array(e*a),s=new Array(e),o=0;o<e;o++){var u=o*a*4;s[o]=new Float32Array(i.buffer,u,a)}var f=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,f),t.bufferData(t.ARRAY_BUFFER,i.byteLength,t.DYNAMIC_DRAW);for(var d=0;d<3;d++){var h=r+d;t.enableVertexAttribArray(h),t.vertexAttribPointer(h,3,t.FLOAT,!1,36,d*12),t.vertexAttribDivisor(h,1)}return t.bindBuffer(t.ARRAY_BUFFER,null),f.getMatrixView=function(p){return s[p]},f.setData=function(p,g){s[g].set(p,0)},f.bufferSubData=function(){t.bindBuffer(t.ARRAY_BUFFER,f),t.bufferSubData(t.ARRAY_BUFFER,0,i)},f}function SL(t){var e=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,e);var r=t.createTexture();return t.bindTexture(t.TEXTURE_2D,r),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,r,0),t.bindFramebuffer(t.FRAMEBUFFER,null),e.setFramebufferAttachmentSizes=function(a,i){t.bindTexture(t.TEXTURE_2D,r),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,a,i,0,t.RGBA,t.UNSIGNED_BYTE,null)},e}var QS=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 om(){var t=new QS(9);return QS!=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 YS(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 EL(t,e,r){var a=e[0],i=e[1],s=e[2],o=e[3],u=e[4],f=e[5],d=e[6],h=e[7],p=e[8],g=r[0],y=r[1],b=r[2],E=r[3],S=r[4],T=r[5],C=r[6],N=r[7],j=r[8];return t[0]=g*a+y*o+b*d,t[1]=g*i+y*u+b*h,t[2]=g*s+y*f+b*p,t[3]=E*a+S*o+T*d,t[4]=E*i+S*u+T*h,t[5]=E*s+S*f+T*p,t[6]=C*a+N*o+j*d,t[7]=C*i+N*u+j*h,t[8]=C*s+N*f+j*p,t}function Ed(t,e,r){var a=e[0],i=e[1],s=e[2],o=e[3],u=e[4],f=e[5],d=e[6],h=e[7],p=e[8],g=r[0],y=r[1];return t[0]=a,t[1]=i,t[2]=s,t[3]=o,t[4]=u,t[5]=f,t[6]=g*a+y*o+d,t[7]=g*i+y*u+h,t[8]=g*s+y*f+p,t}function KS(t,e,r){var a=e[0],i=e[1],s=e[2],o=e[3],u=e[4],f=e[5],d=e[6],h=e[7],p=e[8],g=Math.sin(r),y=Math.cos(r);return t[0]=y*a+g*o,t[1]=y*i+g*u,t[2]=y*s+g*f,t[3]=y*o-g*a,t[4]=y*u-g*i,t[5]=y*f-g*s,t[6]=d,t[7]=h,t[8]=p,t}function a0(t,e,r){var a=r[0],i=r[1];return t[0]=a*e[0],t[1]=a*e[1],t[2]=a*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 TL(t,e,r){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/r,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t}var CL=(function(){function t(e,r,a,i){is(this,t),this.debugID=Math.floor(Math.random()*1e4),this.r=e,this.texSize=r,this.texRows=a,this.texHeight=Math.floor(r/a),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,r,r),this.scratch=i(e,r,this.texHeight,"scratch")}return ss(t,[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(r){var a=r.w,i=r.h,s=this.texHeight,o=this.texSize,u=s/i,f=a*u,d=i*u;return f>o&&(u=o/a,f=a*u,d=i*u),{scale:u,texW:f,texH:d}}},{key:"draw",value:function(r,a,i){var s=this;if(this.locked)throw new Error("can't draw, atlas is locked");var o=this.texSize,u=this.texRows,f=this.texHeight,d=this.getScale(a),h=d.scale,p=d.texW,g=d.texH,y=function(N,j){if(i&&j){var M=j.context,D=N.x,A=N.row,B=D,R=f*A;M.save(),M.translate(B,R),M.scale(h,h),i(M,a),M.restore()}},b=[null,null],E=function(){y(s.freePointer,s.canvas),b[0]={x:s.freePointer.x,y:s.freePointer.row*f,w:p,h:g},b[1]={x:s.freePointer.x+p,y:s.freePointer.row*f,w:0,h:g},s.freePointer.x+=p,s.freePointer.x==o&&(s.freePointer.x=0,s.freePointer.row++)},S=function(){var N=s.scratch,j=s.canvas;N.clear(),y({x:0,row:0},N);var M=o-s.freePointer.x,D=p-M,A=f;{var B=s.freePointer.x,R=s.freePointer.row*f,L=M;j.context.drawImage(N,0,0,L,A,B,R,L,A),b[0]={x:B,y:R,w:L,h:g}}{var _=M,P=(s.freePointer.row+1)*f,q=D;j&&j.context.drawImage(N,_,0,q,A,0,P,q,A),b[1]={x:0,y:P,w:q,h:g}}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(r,b),this.needsBuffer=!0,b}},{key:"getOffsets",value:function(r){return this.keyToLocation.get(r)}},{key:"isEmpty",value:function(){return this.freePointer.x===0&&this.freePointer.row===0}},{key:"canFit",value:function(r){if(this.locked)return!1;var a=this.texSize,i=this.texRows,s=this.getScale(r),o=s.texW;return this.freePointer.x+o>a?this.freePointer.row<i-1:!0}},{key:"bufferIfNeeded",value:function(r){this.texture||(this.texture=yL(r,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}}])})(),NL=(function(){function t(e,r,a,i){is(this,t),this.r=e,this.texSize=r,this.texRows=a,this.createTextureCanvas=i,this.atlases=[],this.styleKeyToAtlas=new Map,this.markedKeys=new Set}return ss(t,[{key:"getKeys",value:function(){return new Set(this.styleKeyToAtlas.keys())}},{key:"_createAtlas",value:function(){var r=this.r,a=this.texSize,i=this.texRows,s=this.createTextureCanvas;return new CL(r,a,i,s)}},{key:"_getScratchCanvas",value:function(){if(!this.scratch){var r=this.r,a=this.texSize,i=this.texRows,s=this.createTextureCanvas,o=Math.floor(a/i);this.scratch=s(r,a,o,"scratch")}return this.scratch}},{key:"draw",value:function(r,a,i){var s=this.styleKeyToAtlas.get(r);return s||(s=this.atlases[this.atlases.length-1],(!s||!s.canFit(a))&&(s&&s.lock(),s=this._createAtlas(),this.atlases.push(s)),s.draw(r,a,i),this.styleKeyToAtlas.set(r,s)),s}},{key:"getAtlas",value:function(r){return this.styleKeyToAtlas.get(r)}},{key:"hasAtlas",value:function(r){return this.styleKeyToAtlas.has(r)}},{key:"markKeyForGC",value:function(r){this.markedKeys.add(r)}},{key:"gc",value:function(){var r=this,a=this.markedKeys;if(a.size===0){console.log("nothing to garbage collect");return}var i=[],s=new Map,o=null,u=pa(this.atlases),f;try{var d=function(){var p=f.value,g=p.getKeys(),y=AL(a,g);if(y.size===0)return i.push(p),g.forEach(function(M){return s.set(M,p)}),1;o||(o=r._createAtlas(),i.push(o));var b=pa(g),E;try{for(b.s();!(E=b.n()).done;){var S=E.value;if(!y.has(S)){var T=p.getOffsets(S),C=pr(T,2),N=C[0],j=C[1];o.canFit({w:N.w+j.w,h:N.h})||(o.lock(),o=r._createAtlas(),i.push(o)),p.canvas&&(r._copyTextureToNewAtlas(S,p,o),s.set(S,o))}}}catch(M){b.e(M)}finally{b.f()}p.dispose()};for(u.s();!(f=u.n()).done;)d()}catch(h){u.e(h)}finally{u.f()}this.atlases=i,this.styleKeyToAtlas=s,this.markedKeys=new Set}},{key:"_copyTextureToNewAtlas",value:function(r,a,i){var s=a.getOffsets(r),o=pr(s,2),u=o[0],f=o[1];if(f.w===0)i.draw(r,u,function(g){g.drawImage(a.canvas,u.x,u.y,u.w,u.h,0,0,u.w,u.h)});else{var d=this._getScratchCanvas();d.clear(),d.context.drawImage(a.canvas,u.x,u.y,u.w,u.h,0,0,u.w,u.h),d.context.drawImage(a.canvas,f.x,f.y,f.w,f.h,u.w,0,f.w,f.h);var h=u.w+f.w,p=u.h;i.draw(r,{w:h,h:p},function(g){g.drawImage(d,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 AL(t,e){return t.intersection?t.intersection(e):new Set(Od(t).filter(function(r){return e.has(r)}))}var jL=(function(){function t(e,r){is(this,t),this.r=e,this.globalOptions=r,this.atlasSize=r.webglTexSize,this.maxAtlasesPerBatch=r.webglTexPerBatch,this.renderTypes=new Map,this.collections=new Map,this.typeAndIdToKey=new Map}return ss(t,[{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"addAtlasCollection",value:function(r,a){var i=this.globalOptions,s=i.webglTexSize,o=i.createTextureCanvas,u=a.texRows,f=this._cacheScratchCanvas(o),d=new NL(this.r,s,u,f);this.collections.set(r,d)}},{key:"addRenderType",value:function(r,a){var i=a.collection;if(!this.collections.has(i))throw new Error("invalid atlas collection name '".concat(i,"'"));var s=this.collections.get(i),o=Ze({type:r,atlasCollection:s},a);this.renderTypes.set(r,o)}},{key:"getRenderTypeOpts",value:function(r){return this.renderTypes.get(r)}},{key:"getAtlasCollection",value:function(r){return this.collections.get(r)}},{key:"_cacheScratchCanvas",value:function(r){var a=-1,i=-1,s=null;return function(o,u,f,d){return d?((!s||u!=a||f!=i)&&(a=u,i=f,s=r(o,u,f)),s):r(o,u,f)}}},{key:"_key",value:function(r,a){return"".concat(r,"-").concat(a)}},{key:"invalidate",value:function(r){var a=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=i.forceRedraw,o=s===void 0?!1:s,u=i.filterEle,f=u===void 0?function(){return!0}:u,d=i.filterType,h=d===void 0?function(){return!0}:d,p=!1,g=!1,y=pa(r),b;try{for(y.s();!(b=y.n()).done;){var E=b.value;if(f(E)){var S=pa(this.renderTypes.values()),T;try{var C=function(){var j=T.value,M=j.type;if(h(M)){var D=a.collections.get(j.collection),A=j.getKey(E),B=Array.isArray(A)?A:[A];if(o)B.forEach(function(P){return D.markKeyForGC(P)}),g=!0;else{var R=j.getID?j.getID(E):E.id(),L=a._key(M,R),_=a.typeAndIdToKey.get(L);_!==void 0&&!gL(B,_)&&(p=!0,a.typeAndIdToKey.delete(L),_.forEach(function(P){return D.markKeyForGC(P)}))}}};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 g&&(this.gc(),p=!1),p}},{key:"gc",value:function(){var r=pa(this.collections.values()),a;try{for(r.s();!(a=r.n()).done;){var i=a.value;i.gc()}}catch(s){r.e(s)}finally{r.f()}}},{key:"getOrCreateAtlas",value:function(r,a,i,s){var o=this.renderTypes.get(a),u=this.collections.get(o.collection),f=!1,d=u.draw(s,i,function(g){o.drawClipped?(g.save(),g.beginPath(),g.rect(0,0,i.w,i.h),g.clip(),o.drawElement(g,r,i,!0,!0),g.restore()):o.drawElement(g,r,i,!0,!0),f=!0});if(f){var h=o.getID?o.getID(r):r.id(),p=this._key(a,h);this.typeAndIdToKey.has(p)?this.typeAndIdToKey.get(p).push(s):this.typeAndIdToKey.set(p,[s])}return d}},{key:"getAtlasInfo",value:function(r,a){var i=this,s=this.renderTypes.get(a),o=s.getKey(r),u=Array.isArray(o)?o:[o];return u.map(function(f){var d=s.getBoundingBox(r,f),h=i.getOrCreateAtlas(r,a,d,f),p=h.getOffsets(f),g=pr(p,2),y=g[0],b=g[1];return{atlas:h,tex:y,tex1:y,tex2:b,bb:d}})}},{key:"getDebugInfo",value:function(){var r=[],a=pa(this.collections),i;try{for(a.s();!(i=a.n()).done;){var s=pr(i.value,2),o=s[0],u=s[1],f=u.getCounts(),d=f.keyCount,h=f.atlasCount;r.push({type:o,keyCount:d,atlasCount:h})}}catch(p){a.e(p)}finally{a.f()}return r}}])})(),DL=(function(){function t(e){is(this,t),this.globalOptions=e,this.atlasSize=e.webglTexSize,this.maxAtlasesPerBatch=e.webglTexPerBatch,this.batchAtlases=[]}return ss(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(r,a){return a})}},{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(r){return this.batchAtlases.length===this.maxAtlasesPerBatch?this.batchAtlases.includes(r):!0}},{key:"getAtlasIndexForBatch",value:function(r){var a=this.batchAtlases.indexOf(r);if(a<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw new Error("cannot add more atlases to batch");this.batchAtlases.push(r),a=this.batchAtlases.length-1}return a}}])})(),OL=`
|
|
96
|
+
float circleSD(vec2 p, float r) {
|
|
97
|
+
return distance(vec2(0), p) - r; // signed distance
|
|
98
|
+
}
|
|
99
|
+
`,ML=`
|
|
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
|
+
`,RL=`
|
|
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
|
+
`,kL=`
|
|
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
|
+
`,Iu={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},Vd={IGNORE:1,USE_BB:2},um=0,XS=1,$S=2,cm=3,Yl=4,ld=5,Ru=6,ku=7,BL=(function(){function t(e,r,a){is(this,t),this.r=e,this.gl=r,this.maxInstances=a.webglBatchSize,this.atlasSize=a.webglTexSize,this.bgColor=a.bgColor,this.debug=a.webglDebug,this.batchDebugInfo=[],a.enableWrapping=!0,a.createTextureCanvas=dL,this.atlasManager=new jL(e,a),this.batchManager=new DL(a),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(Iu.SCREEN),this.pickingProgram=this._createShaderProgram(Iu.PICKING),this.vao=this._createVAO()}return ss(t,[{key:"addAtlasCollection",value:function(r,a){this.atlasManager.addAtlasCollection(r,a)}},{key:"addTextureAtlasRenderType",value:function(r,a){this.atlasManager.addRenderType(r,a)}},{key:"addSimpleShapeRenderType",value:function(r,a){this.simpleShapeOptions.set(r,a)}},{key:"invalidate",value:function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=a.type,s=this.atlasManager;return i?s.invalidate(r,{filterType:function(u){return u===i},forceRedraw:!0}):s.invalidate(r)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(r){var a=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(um,`) {
|
|
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(Yl," || aVertType == ").concat(ku,`
|
|
197
|
+
|| aVertType == `).concat(ld," || aVertType == ").concat(Ru,`) { // 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(XS,`) {
|
|
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($S,`) {
|
|
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(cm,` && 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(d){return"uniform sampler2D uTexture".concat(d,";")}).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(OL,`
|
|
322
|
+
`).concat(ML,`
|
|
323
|
+
`).concat(RL,`
|
|
324
|
+
`).concat(kL,`
|
|
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(um,`) {
|
|
341
|
+
// look up the texel from the texture unit
|
|
342
|
+
`).concat(s.map(function(d){return"if(vAtlasId == ".concat(d,") outColor = texture(uTexture").concat(d,", vTexCoord);")}).join(`
|
|
343
|
+
else `),`
|
|
344
|
+
}
|
|
345
|
+
else if(vVertType == `).concat(cm,`) {
|
|
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(Yl,` && 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(Yl," || vVertType == ").concat(ku,`
|
|
354
|
+
|| vVertType == `).concat(ld," || vVertType == ").concat(Ru,`) { // 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(Yl,`) {
|
|
366
|
+
d = rectangleSD(p, b);
|
|
367
|
+
} else if(vVertType == `).concat(ku,` && w == h) {
|
|
368
|
+
d = circleSD(p, b.x); // faster than ellipse
|
|
369
|
+
} else if(vVertType == `).concat(ku,`) {
|
|
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(r.picking?`if(outColor.a == 0.0) discard;
|
|
407
|
+
else outColor = vIndex;`:"",`
|
|
408
|
+
}
|
|
409
|
+
`),u=fL(a,i,o);u.aPosition=a.getAttribLocation(u,"aPosition"),u.aIndex=a.getAttribLocation(u,"aIndex"),u.aVertType=a.getAttribLocation(u,"aVertType"),u.aTransform=a.getAttribLocation(u,"aTransform"),u.aAtlasId=a.getAttribLocation(u,"aAtlasId"),u.aTex=a.getAttribLocation(u,"aTex"),u.aPointAPointB=a.getAttribLocation(u,"aPointAPointB"),u.aPointCPointD=a.getAttribLocation(u,"aPointCPointD"),u.aLineWidth=a.getAttribLocation(u,"aLineWidth"),u.aColor=a.getAttribLocation(u,"aColor"),u.aCornerRadius=a.getAttribLocation(u,"aCornerRadius"),u.aBorderColor=a.getAttribLocation(u,"aBorderColor"),u.uPanZoomMatrix=a.getUniformLocation(u,"uPanZoomMatrix"),u.uAtlasSize=a.getUniformLocation(u,"uAtlasSize"),u.uBGColor=a.getUniformLocation(u,"uBGColor"),u.uZoom=a.getUniformLocation(u,"uZoom"),u.uTextures=[];for(var f=0;f<this.batchManager.getMaxAtlasesPerBatch();f++)u.uTextures.push(a.getUniformLocation(u,"uTexture".concat(f)));return u}},{key:"_createVAO",value:function(){var r=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=r.length/2;var a=this.maxInstances,i=this.gl,s=this.program,o=i.createVertexArray();return i.bindVertexArray(o),bL(i,"vec2",s.aPosition,r),this.transformBuffer=wL(i,a,s.aTransform),this.indexBuffer=cn(i,a,"vec4",s.aIndex),this.vertTypeBuffer=cn(i,a,"int",s.aVertType),this.atlasIdBuffer=cn(i,a,"int",s.aAtlasId),this.texBuffer=cn(i,a,"vec4",s.aTex),this.pointAPointBBuffer=cn(i,a,"vec4",s.aPointAPointB),this.pointCPointDBuffer=cn(i,a,"vec4",s.aPointCPointD),this.lineWidthBuffer=cn(i,a,"vec2",s.aLineWidth),this.colorBuffer=cn(i,a,"vec4",s.aColor),this.cornerRadiusBuffer=cn(i,a,"vec4",s.aCornerRadius),this.borderColorBuffer=cn(i,a,"vec4",s.aBorderColor),i.bindVertexArray(null),o}},{key:"buffers",get:function(){var r=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(a){return Ii(a,"Buffer")}).map(function(a){return r[a]})),this._buffers}},{key:"startFrame",value:function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Iu.SCREEN;this.panZoomMatrix=r,this.renderTarget=a,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(r,a){return r.visible()?a&&a.isVisible?a.isVisible(r):!0:!1}},{key:"drawTexture",value:function(r,a,i){var s=this.atlasManager,o=this.batchManager,u=s.getRenderTypeOpts(i);if(this._isVisible(r,u)&&!(r.isEdge()&&!this._isValidEdge(r))){if(this.renderTarget.picking&&u.getTexPickingMode){var f=u.getTexPickingMode(r);if(f===Vd.IGNORE)return;if(f==Vd.USE_BB){this.drawPickingRectangle(r,a,i);return}}var d=s.getAtlasInfo(r,i),h=pa(d),p;try{for(h.s();!(p=h.n()).done;){var g=p.value,y=g.atlas,b=g.tex1,E=g.tex2;o.canAddToCurrentBatch(y)||this.endBatch();for(var S=o.getAtlasIndexForBatch(y),T=0,C=[[b,!0],[E,!1]];T<C.length;T++){var N=pr(C[T],2),j=N[0],M=N[1];if(j.w!=0){var D=this.instanceCount;this.vertTypeBuffer.getView(D)[0]=um;var A=this.indexBuffer.getView(D);Ql(a,A);var B=this.atlasIdBuffer.getView(D);B[0]=S;var R=this.texBuffer.getView(D);R[0]=j.x,R[1]=j.y,R[2]=j.w,R[3]=j.h;var L=this.transformBuffer.getMatrixView(D);this.setTransformMatrix(r,L,u,g,M),this.instanceCount++,M||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(_){h.e(_)}finally{h.f()}}}},{key:"setTransformMatrix",value:function(r,a,i,s){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,u=0;if(i.shapeProps&&i.shapeProps.padding&&(u=r.pstyle(i.shapeProps.padding).pfValue),s){var f=s.bb,d=s.tex1,h=s.tex2,p=d.w/(d.w+h.w);o||(p=1-p);var g=this._getAdjustedBB(f,u,o,p);this._applyTransformMatrix(a,g,i,r)}else{var y=i.getBoundingBox(r),b=this._getAdjustedBB(y,u,!0,1);this._applyTransformMatrix(a,b,i,r)}}},{key:"_applyTransformMatrix",value:function(r,a,i,s){var o,u;YS(r);var f=i.getRotation?i.getRotation(s):0;if(f!==0){var d=i.getRotationPoint(s),h=d.x,p=d.y;Ed(r,r,[h,p]),KS(r,r,f);var g=i.getRotationOffset(s);o=g.x+(a.xOffset||0),u=g.y+(a.yOffset||0)}else o=a.x1,u=a.y1;Ed(r,r,[o,u]),a0(r,r,[a.w,a.h])}},{key:"_getAdjustedBB",value:function(r,a,i,s){var o=r.x1,u=r.y1,f=r.w,d=r.h,h=r.yOffset;a&&(o-=a,u-=a,f+=2*a,d+=2*a);var p=0,g=f*s;return i&&s<1?f=g:!i&&s<1&&(p=f-g,o+=p,f=g),{x1:o,y1:u,w:f,h:d,xOffset:p,yOffset:h}}},{key:"drawPickingRectangle",value:function(r,a,i){var s=this.atlasManager.getRenderTypeOpts(i),o=this.instanceCount;this.vertTypeBuffer.getView(o)[0]=Yl;var u=this.indexBuffer.getView(o);Ql(a,u);var f=this.colorBuffer.getView(o);js([0,0,0],1,f);var d=this.transformBuffer.getMatrixView(o);this.setTransformMatrix(r,d,s),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(r,a,i){var s=this.simpleShapeOptions.get(i);if(this._isVisible(r,s)){var o=s.shapeProps,u=this._getVertTypeForShape(r,o.shape);if(u===void 0||s.isSimple&&!s.isSimple(r)){this.drawTexture(r,a,i);return}var f=this.instanceCount;if(this.vertTypeBuffer.getView(f)[0]=u,u===ld||u===Ru){var d=s.getBoundingBox(r),h=this._getCornerRadius(r,o.radius,d),p=this.cornerRadiusBuffer.getView(f);p[0]=h,p[1]=h,p[2]=h,p[3]=h,u===Ru&&(p[0]=0,p[2]=0)}var g=this.indexBuffer.getView(f);Ql(a,g);var y=r.pstyle(o.color).value,b=r.pstyle(o.opacity).value,E=this.colorBuffer.getView(f);js(y,b,E);var S=this.lineWidthBuffer.getView(f);if(S[0]=0,S[1]=0,o.border){var T=r.pstyle("border-width").value;if(T>0){var C=r.pstyle("border-color").value,N=r.pstyle("border-opacity").value,j=this.borderColorBuffer.getView(f);js(C,N,j);var M=r.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 A=this.transformBuffer.getMatrixView(f);this.setTransformMatrix(r,A,s),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"_getVertTypeForShape",value:function(r,a){var i=r.pstyle(a).value;switch(i){case"rectangle":return Yl;case"ellipse":return ku;case"roundrectangle":case"round-rectangle":return ld;case"bottom-round-rectangle":return Ru;default:return}}},{key:"_getCornerRadius",value:function(r,a,i){var s=i.w,o=i.h;if(r.pstyle(a).value==="auto")return Wi(s,o);var u=r.pstyle(a).pfValue,f=s/2,d=o/2;return Math.min(u,d,f)}},{key:"drawEdgeArrow",value:function(r,a,i){if(r.visible()){var s=r._private.rscratch,o,u,f;if(i==="source"?(o=s.arrowStartX,u=s.arrowStartY,f=s.srcArrowAngle):(o=s.arrowEndX,u=s.arrowEndY,f=s.tgtArrowAngle),!(isNaN(o)||o==null||isNaN(u)||u==null||isNaN(f)||f==null)){var d=r.pstyle(i+"-arrow-shape").value;if(d!=="none"){var h=r.pstyle(i+"-arrow-color").value,p=r.pstyle("opacity").value,g=r.pstyle("line-opacity").value,y=p*g,b=r.pstyle("width").pfValue,E=r.pstyle("arrow-scale").value,S=this.r.getArrowWidth(b,E),T=this.instanceCount,C=this.transformBuffer.getMatrixView(T);YS(C),Ed(C,C,[o,u]),a0(C,C,[S,S]),KS(C,C,f),this.vertTypeBuffer.getView(T)[0]=cm;var N=this.indexBuffer.getView(T);Ql(a,N);var j=this.colorBuffer.getView(T);js(h,y,j),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"drawEdgeLine",value:function(r,a){if(r.visible()){var i=this._getEdgePoints(r);if(i){var s=r.pstyle("opacity").value,o=r.pstyle("line-opacity").value,u=r.pstyle("width").pfValue,f=r.pstyle("line-color").value,d=s*o;if(i.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),i.length==4){var h=this.instanceCount;this.vertTypeBuffer.getView(h)[0]=XS;var p=this.indexBuffer.getView(h);Ql(a,p);var g=this.colorBuffer.getView(h);js(f,d,g);var y=this.lineWidthBuffer.getView(h);y[0]=u;var b=this.pointAPointBBuffer.getView(h);b[0]=i[0],b[1]=i[1],b[2]=i[2],b[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]=$S;var T=this.indexBuffer.getView(S);Ql(a,T);var C=this.colorBuffer.getView(S);js(f,d,C);var N=this.lineWidthBuffer.getView(S);N[0]=u;var j=i[E-2],M=i[E-1],D=i[E],A=i[E+1],B=i[E+2],R=i[E+3],L=i[E+4],_=i[E+5];E==0&&(j=2*D-B+.001,M=2*A-R+.001),E==i.length-4&&(L=2*B-D+.001,_=2*R-A+.001);var P=this.pointAPointBBuffer.getView(S);P[0]=j,P[1]=M,P[2]=D,P[3]=A;var q=this.pointCPointDBuffer.getView(S);q[0]=B,q[1]=R,q[2]=L,q[3]=_,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"_isValidEdge",value:function(r){var a=r._private.rscratch;return!(a.badLine||a.allpts==null||isNaN(a.allpts[0]))}},{key:"_getEdgePoints",value:function(r){var a=r._private.rscratch;if(this._isValidEdge(r)){var i=a.allpts;if(i.length==4)return i;var s=this._getNumSegments(r);return this._getCurveSegmentPoints(i,s)}}},{key:"_getNumSegments",value:function(r){var a=15;return Math.min(Math.max(a,5),this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(r,a){if(r.length==4)return r;for(var i=Array((a+1)*2),s=0;s<=a;s++)if(s==0)i[0]=r[0],i[1]=r[1];else if(s==a)i[s*2]=r[r.length-2],i[s*2+1]=r[r.length-1];else{var o=s/a;this._setCurvePoint(r,o,i,s*2)}return i}},{key:"_setCurvePoint",value:function(r,a,i,s){if(r.length<=2)i[s]=r[0],i[s+1]=r[1];else{for(var o=Array(r.length-2),u=0;u<o.length;u+=2){var f=(1-a)*r[u]+a*r[u+2],d=(1-a)*r[u+1]+a*r[u+3];o[u]=f,o[u+1]=d}return this._setCurvePoint(o,a,i,s)}}},{key:"endBatch",value:function(){var r=this.gl,a=this.vao,i=this.vertexCount,s=this.instanceCount;if(s!==0){var o=this.renderTarget.picking?this.pickingProgram:this.program;r.useProgram(o),r.bindVertexArray(a);var u=pa(this.buffers),f;try{for(u.s();!(f=u.n()).done;){var d=f.value;d.bufferSubData(s)}}catch(b){u.e(b)}finally{u.f()}for(var h=this.batchManager.getAtlases(),p=0;p<h.length;p++)h[p].bufferIfNeeded(r);for(var g=0;g<h.length;g++)r.activeTexture(r.TEXTURE0+g),r.bindTexture(r.TEXTURE_2D,h[g].texture),r.uniform1i(o.uTextures[g],g);r.uniform1f(o.uZoom,hL(this.r)),r.uniformMatrix3fv(o.uPanZoomMatrix,!1,this.panZoomMatrix),r.uniform1i(o.uAtlasSize,this.batchManager.getAtlasSize());var y=js(this.bgColor,1);r.uniform4fv(o.uBGColor,y),r.drawArraysInstanced(r.TRIANGLES,0,i,s),r.bindVertexArray(null),r.bindTexture(r.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:s,atlasCount:h.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var r=this.atlasManager.getDebugInfo(),a=r.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:r,totalAtlases:a,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:i.length,batchInfo:i,totalInstances:s}}}])})(),iN={};iN.initWebgl=function(t,e){var r=this,a=r.data.contexts[r.WEBGL];t.bgColor=LL(r),t.webglTexSize=Math.min(t.webglTexSize,a.getParameter(a.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,a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS)),r.webglDebug=t.webglDebug,r.webglDebugShowAtlases=t.webglDebugShowAtlases,r.pickingFrameBuffer=SL(a),r.pickingFrameBuffer.needsDraw=!0,r.drawing=new BL(r,a,t);var i=function(p){return function(g){return r.getTextAngle(g,p)}},s=function(p){return function(g){var y=g.pstyle(p);return y&&y.value}},o=function(p){return function(g){return g.pstyle("".concat(p,"-opacity")).value>0}},u=function(p){var g=p.pstyle("text-events").strValue==="yes";return g?Vd.USE_BB:Vd.IGNORE},f=function(p){var g=p.position(),y=g.x,b=g.y,E=p.outerWidth(),S=p.outerHeight();return{w:E,h:S,x1:y-E/2,y1:b-S/2}};r.drawing.addAtlasCollection("node",{texRows:t.webglTexRowsNodes}),r.drawing.addAtlasCollection("label",{texRows:t.webglTexRows}),r.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:e.getStyleKey,getBoundingBox:e.getElementBox,drawElement:e.drawElement}),r.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:f,isSimple:pL,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),r.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:f,isVisible:o("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),r.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:f,isVisible:o("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),r.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:u,getKey:fm(e.getLabelKey,null),getBoundingBox:dm(e.getLabelBox,null),drawClipped:!0,drawElement:e.drawLabel,getRotation:i(null),getRotationPoint:e.getLabelRotationPoint,getRotationOffset:e.getLabelRotationOffset,isVisible:s("label")}),r.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:u,getKey:fm(e.getSourceLabelKey,"source"),getBoundingBox:dm(e.getSourceLabelBox,"source"),drawClipped:!0,drawElement:e.drawSourceLabel,getRotation:i("source"),getRotationPoint:e.getSourceLabelRotationPoint,getRotationOffset:e.getSourceLabelRotationOffset,isVisible:s("source-label")}),r.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:u,getKey:fm(e.getTargetLabelKey,"target"),getBoundingBox:dm(e.getTargetLabelBox,"target"),drawClipped:!0,drawElement:e.drawTargetLabel,getRotation:i("target"),getRotationPoint:e.getTargetLabelRotationPoint,getRotationOffset:e.getTargetLabelRotationOffset,isVisible:s("target-label")});var d=Sc(function(){console.log("garbage collect flag set"),r.data.gc=!0},1e4);r.onUpdateEleCalcs(function(h,p){var g=!1;p&&p.length>0&&(g|=r.drawing.invalidate(p)),g&&d()}),zL(r)};function LL(t){var e=t.cy.container(),r=e&&e.style&&e.style.backgroundColor||"white";return kT(r)}function sN(t,e){var r=t._private.rscratch;return ha(r,"labelWrapCachedLines",e)||[]}var fm=function(e,r){return function(a){var i=e(a),s=sN(a,r);return s.length>1?s.map(function(o,u){return"".concat(i,"_").concat(u)}):i}},dm=function(e,r){return function(a,i){var s=e(a);if(typeof i=="string"){var o=i.indexOf("_");if(o>0){var u=Number(i.substring(o+1)),f=sN(a,r),d=s.h/f.length,h=d*u,p=s.y1+h;return{x1:s.x1,w:s.w,y1:p,h:d,yOffset:h}}}return s}};function zL(t){{var e=t.render;t.render=function(s){s=s||{};var o=t.cy;t.webgl&&(o.zoom()>WC?(_L(t),e.call(t,s)):(PL(t),oN(t,s,Iu.SCREEN)))}}{var r=t.matchCanvasSize;t.matchCanvasSize=function(s){r.call(t,s),t.pickingFrameBuffer.setFramebufferAttachmentSizes(t.canvasWidth,t.canvasHeight),t.pickingFrameBuffer.needsDraw=!0}}t.findNearestElements=function(s,o,u,f){return HL(t,s,o)};{var a=t.invalidateCachedZSortedEles;t.invalidateCachedZSortedEles=function(){a.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 _L(t){var e=t.data.contexts[t.WEBGL];e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}function PL(t){var e=function(a){a.save(),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,t.canvasWidth,t.canvasHeight),a.restore()};e(t.data.contexts[t.NODE]),e(t.data.contexts[t.DRAG])}function UL(t){var e=t.canvasWidth,r=t.canvasHeight,a=W0(t),i=a.pan,s=a.zoom,o=om();Ed(o,o,[i.x,i.y]),a0(o,o,[s,s]);var u=om();TL(u,e,r);var f=om();return EL(f,u,o),f}function lN(t,e){var r=t.canvasWidth,a=t.canvasHeight,i=W0(t),s=i.pan,o=i.zoom;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,r,a),e.translate(s.x,s.y),e.scale(o,o)}function qL(t,e){t.drawSelectionRectangle(e,function(r){return lN(t,r)})}function IL(t){var e=t.data.contexts[t.NODE];e.save(),lN(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 VL(t){var e=function(i,s,o){for(var u=i.atlasManager.getAtlasCollection(s),f=t.data.contexts[t.NODE],d=u.atlases,h=0;h<d.length;h++){var p=d[h],g=p.canvas;if(g){var y=g.width,b=g.height,E=y*h,S=g.height*o,T=.4;f.save(),f.scale(T,T),f.drawImage(g,E,S),f.strokeStyle="black",f.rect(E,S,y,b),f.stroke(),f.restore()}}},r=0;e(t.drawing,"node",r++),e(t.drawing,"label",r++)}function FL(t,e,r,a,i){var s,o,u,f,d=W0(t),h=d.pan,p=d.zoom;{var g=vL(t,h,p,e,r),y=pr(g,2),b=y[0],E=y[1],S=6;s=b-S/2,o=E-S/2,u=S,f=S}if(u===0||f===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),oN(t,null,Iu.PICKING),t.pickingFrameBuffer.needsDraw=!1);var C=u*f,N=new Uint8Array(C*4);T.readPixels(s,o,u,f,T.RGBA,T.UNSIGNED_BYTE,N),T.bindFramebuffer(T.FRAMEBUFFER,null);for(var j=new Set,M=0;M<C;M++){var D=N.slice(M*4,M*4+4),A=mL(D)-1;A>=0&&j.add(A)}return j}function HL(t,e,r){var a=FL(t,e,r),i=t.getCachedZSortedEles(),s,o,u=pa(a),f;try{for(u.s();!(f=u.n()).done;){var d=f.value,h=i[d];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 hm(t,e,r){var a=t.drawing;e+=1,r.isNode()?(a.drawNode(r,e,"node-underlay"),a.drawNode(r,e,"node-body"),a.drawTexture(r,e,"label"),a.drawNode(r,e,"node-overlay")):(a.drawEdgeLine(r,e),a.drawEdgeArrow(r,e,"source"),a.drawEdgeArrow(r,e,"target"),a.drawTexture(r,e,"label"),a.drawTexture(r,e,"edge-source-label"),a.drawTexture(r,e,"edge-target-label"))}function oN(t,e,r){var a;t.webglDebug&&(a=performance.now());var i=t.drawing,s=0;if(r.screen&&t.data.canvasNeedsRedraw[t.SELECT_BOX]&&qL(t,e),t.data.canvasNeedsRedraw[t.NODE]||r.picking){var o=t.data.contexts[t.WEBGL];r.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=UL(t),f=t.getCachedZSortedEles();if(s=f.length,i.startFrame(u,r),r.screen){for(var d=0;d<f.nondrag.length;d++)hm(t,d,f.nondrag[d]);for(var h=0;h<f.drag.length;h++)hm(t,h,f.drag[h])}else if(r.picking)for(var p=0;p<f.length;p++)hm(t,p,f[p]);i.endFrame(),r.screen&&t.webglDebugShowAtlases&&(IL(t),VL(t)),t.data.canvasNeedsRedraw[t.NODE]=!1,t.data.canvasNeedsRedraw[t.DRAG]=!1}if(t.webglDebug){var g=performance.now(),y=!1,b=Math.ceil(g-a),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(r.name,") - time ").concat(b,"ms, ").concat(S));else{console.log("WebGL (".concat(r.name,") - frame time ").concat(b,"ms")),console.log("Totals:"),console.log(" ".concat(S)),console.log("Texture Atlases Used:");var T=E.atlasInfo,C=pa(T),N;try{for(C.s();!(N=C.n()).done;){var j=N.value;console.log(" ".concat(j.type,": ").concat(j.keyCount," keys, ").concat(j.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 us={};us.drawPolygonPath=function(t,e,r,a,i,s){var o=a/2,u=i/2;t.beginPath&&t.beginPath(),t.moveTo(e+o*s[0],r+u*s[1]);for(var f=1;f<s.length/2;f++)t.lineTo(e+o*s[f*2],r+u*s[f*2+1]);t.closePath()};us.drawRoundPolygonPath=function(t,e,r,a,i,s,o){o.forEach(function(u){return FC(t,u)}),t.closePath()};us.drawRoundRectanglePath=function(t,e,r,a,i,s){var o=a/2,u=i/2,f=s==="auto"?Wi(a,i):Math.min(s,u,o);t.beginPath&&t.beginPath(),t.moveTo(e,r-u),t.arcTo(e+o,r-u,e+o,r,f),t.arcTo(e+o,r+u,e,r+u,f),t.arcTo(e-o,r+u,e-o,r,f),t.arcTo(e-o,r-u,e,r-u,f),t.lineTo(e,r-u),t.closePath()};us.drawBottomRoundRectanglePath=function(t,e,r,a,i,s){var o=a/2,u=i/2,f=s==="auto"?Wi(a,i):s;t.beginPath&&t.beginPath(),t.moveTo(e,r-u),t.lineTo(e+o,r-u),t.lineTo(e+o,r),t.arcTo(e+o,r+u,e,r+u,f),t.arcTo(e-o,r+u,e-o,r,f),t.lineTo(e-o,r-u),t.lineTo(e,r-u),t.closePath()};us.drawCutRectanglePath=function(t,e,r,a,i,s,o){var u=a/2,f=i/2,d=o==="auto"?P0():o;t.beginPath&&t.beginPath(),t.moveTo(e-u+d,r-f),t.lineTo(e+u-d,r-f),t.lineTo(e+u,r-f+d),t.lineTo(e+u,r+f-d),t.lineTo(e+u-d,r+f),t.lineTo(e-u+d,r+f),t.lineTo(e-u,r+f-d),t.lineTo(e-u,r-f+d),t.closePath()};us.drawBarrelPath=function(t,e,r,a,i){var s=a/2,o=i/2,u=e-s,f=e+s,d=r-o,h=r+o,p=Fm(a,i),g=p.widthOffset,y=p.heightOffset,b=p.ctrlPtOffsetPct*g;t.beginPath&&t.beginPath(),t.moveTo(u,d+y),t.lineTo(u,h-y),t.quadraticCurveTo(u+b,h,u+g,h),t.lineTo(f-g,h),t.quadraticCurveTo(f-b,h,f,h-y),t.lineTo(f,d+y),t.quadraticCurveTo(f-b,d,f-g,d),t.lineTo(u+g,d),t.quadraticCurveTo(u+b,d,u,d+y),t.closePath()};var ZS=Math.sin(0),WS=Math.cos(0),n0={},i0={},uN=Math.PI/40;for(var Kl=0*Math.PI;Kl<2*Math.PI;Kl+=uN)n0[Kl]=Math.sin(Kl),i0[Kl]=Math.cos(Kl);us.drawEllipsePath=function(t,e,r,a,i){if(t.beginPath&&t.beginPath(),t.ellipse)t.ellipse(e,r,a/2,i/2,0,0,2*Math.PI);else for(var s,o,u=a/2,f=i/2,d=0*Math.PI;d<2*Math.PI;d+=uN)s=e-u*n0[d]*ZS+u*i0[d]*WS,o=r+f*i0[d]*ZS+f*n0[d]*WS,d===0?t.moveTo(s,o):t.lineTo(s,o);t.closePath()};var jc={};jc.createBuffer=function(t,e){var r=document.createElement("canvas");return r.width=t,r.height=e,[r,r.getContext("2d")]};jc.bufferCanvasImage=function(t){var e=this.cy,r=e.mutableElements(),a=r.boundingBox(),i=this.findContainerClientCoords(),s=t.full?Math.ceil(a.w):i[2],o=t.full?Math.ceil(a.h):i[3],u=Oe(t.maxWidth)||Oe(t.maxHeight),f=this.getPixelRatio(),d=1;if(t.scale!==void 0)s*=t.scale,o*=t.scale,d=t.scale;else if(u){var h=1/0,p=1/0;Oe(t.maxWidth)&&(h=d*t.maxWidth/s),Oe(t.maxHeight)&&(p=d*t.maxHeight/o),d=Math.min(h,p),s*=d,o*=d}u||(s*=f,o*=f,d*=f);var g=document.createElement("canvas");g.width=s,g.height=o,g.style.width=s+"px",g.style.height=o+"px";var y=g.getContext("2d");if(s>0&&o>0){y.clearRect(0,0,s,o),y.globalCompositeOperation="source-over";var b=this.getCachedZSortedEles();if(t.full)y.translate(-a.x1*d,-a.y1*d),y.scale(d,d),this.drawElements(y,b),y.scale(1/d,1/d),y.translate(a.x1*d,a.y1*d);else{var E=e.pan(),S={x:E.x*d,y:E.y*d};d*=e.zoom(),y.translate(S.x,S.y),y.scale(d,d),this.drawElements(y,b),y.scale(1/d,1/d),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 g};function GL(t,e){for(var r=atob(t),a=new ArrayBuffer(r.length),i=new Uint8Array(a),s=0;s<r.length;s++)i[s]=r.charCodeAt(s);return new Blob([a],{type:e})}function JS(t){var e=t.indexOf(",");return t.substr(e+1)}function cN(t,e,r){var a=function(){return e.toDataURL(r,t.quality)};switch(t.output){case"blob-promise":return new Oo(function(i,s){try{e.toBlob(function(o){o!=null?i(o):s(new Error("`canvas.toBlob()` sent a null value in its callback"))},r,t.quality)}catch(o){s(o)}});case"blob":return GL(JS(a()),r);case"base64":return JS(a());case"base64uri":default:return a()}}jc.png=function(t){return cN(t,this.bufferCanvasImage(t),"image/png")};jc.jpg=function(t){return cN(t,this.bufferCanvasImage(t),"image/jpeg")};var fN={};fN.nodeShapeImpl=function(t,e,r,a,i,s,o,u){switch(t){case"ellipse":return this.drawEllipsePath(e,r,a,i,s);case"polygon":return this.drawPolygonPath(e,r,a,i,s,o);case"round-polygon":return this.drawRoundPolygonPath(e,r,a,i,s,o,u);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(e,r,a,i,s,u);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(e,r,a,i,s,o,u);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(e,r,a,i,s,u);case"barrel":return this.drawBarrelPath(e,r,a,i,s)}};var QL=dN,dt=dN.prototype;dt.CANVAS_LAYERS=3;dt.SELECT_BOX=0;dt.DRAG=1;dt.NODE=2;dt.WEBGL=3;dt.CANVAS_TYPES=["2d","2d","2d","webgl2"];dt.BUFFER_COUNT=3;dt.TEXTURE_BUFFER=0;dt.MOTIONBLUR_BUFFER_NODE=1;dt.MOTIONBLUR_BUFFER_DRAG=2;function dN(t){var e=this,r=e.cy.window(),a=r.document;t.webgl&&(dt.CANVAS_LAYERS=e.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),e.data={canvases:new Array(dt.CANVAS_LAYERS),contexts:new Array(dt.CANVAS_LAYERS),canvasNeedsRedraw:new Array(dt.CANVAS_LAYERS),bufferCanvases:new Array(dt.BUFFER_COUNT),bufferContexts:new Array(dt.CANVAS_LAYERS)};var i="-webkit-tap-highlight-color",s="rgba(0,0,0,0)";e.data.canvasContainer=a.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 f={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};qM()&&(f["-ms-touch-action"]="none",f["touch-action"]="none");for(var d=0;d<dt.CANVAS_LAYERS;d++){var h=e.data.canvases[d]=a.createElement("canvas"),p=dt.CANVAS_TYPES[d];e.data.contexts[d]=h.getContext(p),e.data.contexts[d]||Qt("Could not create canvas of type "+p),Object.keys(f).forEach(function(le){h.style[le]=f[le]}),h.style.position="absolute",h.setAttribute("data-id","layer"+d),h.style.zIndex=String(dt.CANVAS_LAYERS-d),e.data.canvasContainer.appendChild(h),e.data.canvasNeedsRedraw[d]=!1}e.data.topCanvas=e.data.canvases[0],e.data.canvases[dt.NODE].setAttribute("data-id","layer"+dt.NODE+"-node"),e.data.canvases[dt.SELECT_BOX].setAttribute("data-id","layer"+dt.SELECT_BOX+"-selectbox"),e.data.canvases[dt.DRAG].setAttribute("data-id","layer"+dt.DRAG+"-drag"),e.data.canvases[dt.WEBGL]&&e.data.canvases[dt.WEBGL].setAttribute("data-id","layer"+dt.WEBGL+"-webgl");for(var d=0;d<dt.BUFFER_COUNT;d++)e.data.bufferCanvases[d]=a.createElement("canvas"),e.data.bufferContexts[d]=e.data.bufferCanvases[d].getContext("2d"),e.data.bufferCanvases[d].style.position="absolute",e.data.bufferCanvases[d].setAttribute("data-id","buffer"+d),e.data.bufferCanvases[d].style.zIndex=String(-d-1),e.data.bufferCanvases[d].style.visibility="hidden";e.pathsEnabled=!0;var g=ta(),y=function(re){return{x:(re.x1+re.x2)/2,y:(re.y1+re.y2)/2}},b=function(re){return{x:-re.w/2,y:-re.h/2}},E=function(re){var Z=re[0]._private,oe=Z.oldBackgroundTimestamp===Z.backgroundTimestamp;return!oe},S=function(re){return re[0]._private.nodeKey},T=function(re){return re[0]._private.labelStyleKey},C=function(re){return re[0]._private.sourceLabelStyleKey},N=function(re){return re[0]._private.targetLabelStyleKey},j=function(re,Z,oe,ve,Ne){return e.drawElement(re,Z,oe,!1,!1,Ne)},M=function(re,Z,oe,ve,Ne){return e.drawElementText(re,Z,oe,ve,"main",Ne)},D=function(re,Z,oe,ve,Ne){return e.drawElementText(re,Z,oe,ve,"source",Ne)},A=function(re,Z,oe,ve,Ne){return e.drawElementText(re,Z,oe,ve,"target",Ne)},B=function(re){return re.boundingBox(),re[0]._private.bodyBounds},R=function(re){return re.boundingBox(),re[0]._private.labelBounds.main||g},L=function(re){return re.boundingBox(),re[0]._private.labelBounds.source||g},_=function(re){return re.boundingBox(),re[0]._private.labelBounds.target||g},P=function(re,Z){return Z},q=function(re){return y(B(re))},F=function(re,Z,oe){var ve=re?re+"-":"";return{x:Z.x+oe.pstyle(ve+"text-margin-x").pfValue,y:Z.y+oe.pstyle(ve+"text-margin-y").pfValue}},Y=function(re,Z,oe){var ve=re[0]._private.rscratch;return{x:ve[Z],y:ve[oe]}},U=function(re){return F("",Y(re,"labelX","labelY"),re)},z=function(re){return F("source",Y(re,"sourceLabelX","sourceLabelY"),re)},H=function(re){return F("target",Y(re,"targetLabelX","targetLabelY"),re)},X=function(re){return b(B(re))},K=function(re){return b(L(re))},k=function(re){return b(_(re))},G=function(re){var Z=R(re),oe=b(R(re));if(re.isNode()){switch(re.pstyle("text-halign").value){case"left":oe.x=-Z.w-(Z.leftPad||0);break;case"right":oe.x=-(Z.rightPad||0);break}switch(re.pstyle("text-valign").value){case"top":oe.y=-Z.h-(Z.topPad||0);break;case"bottom":oe.y=-(Z.botPad||0);break}}return oe},$=e.data.eleTxrCache=new _u(e,{getKey:S,doesEleInvalidateKey:E,drawElement:j,getBoundingBox:B,getRotationPoint:q,getRotationOffset:X,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),J=e.data.lblTxrCache=new _u(e,{getKey:T,drawElement:M,getBoundingBox:R,getRotationPoint:U,getRotationOffset:G,isVisible:P}),ne=e.data.slbTxrCache=new _u(e,{getKey:C,drawElement:D,getBoundingBox:L,getRotationPoint:z,getRotationOffset:K,isVisible:P}),ee=e.data.tlbTxrCache=new _u(e,{getKey:N,drawElement:A,getBoundingBox:_,getRotationPoint:H,getRotationOffset:k,isVisible:P}),ae=e.data.lyrTxrCache=new JC(e);e.onUpdateEleCalcs(function(re,Z){$.invalidateElements(Z),J.invalidateElements(Z),ne.invalidateElements(Z),ee.invalidateElements(Z),ae.invalidateElements(Z);for(var oe=0;oe<Z.length;oe++){var ve=Z[oe]._private;ve.oldBackgroundTimestamp=ve.backgroundTimestamp}});var de=function(re){for(var Z=0;Z<re.length;Z++)ae.enqueueElementRefinement(re[Z].ele)};$.onDequeue(de),J.onDequeue(de),ne.onDequeue(de),ee.onDequeue(de),t.webgl&&e.initWebgl(t,{getStyleKey:S,getLabelKey:T,getSourceLabelKey:C,getTargetLabelKey:N,drawElement:j,drawLabel:M,drawSourceLabel:D,drawTargetLabel:A,getElementBox:B,getLabelBox:R,getSourceLabelBox:L,getTargetLabelBox:_,getElementRotationPoint:q,getElementRotationOffset:X,getLabelRotationPoint:U,getSourceLabelRotationPoint:z,getTargetLabelRotationPoint:H,getLabelRotationOffset:G,getSourceLabelRotationOffset:K,getTargetLabelRotationOffset:k})}dt.redrawHint=function(t,e){var r=this;switch(t){case"eles":r.data.canvasNeedsRedraw[dt.NODE]=e;break;case"drag":r.data.canvasNeedsRedraw[dt.DRAG]=e;break;case"select":r.data.canvasNeedsRedraw[dt.SELECT_BOX]=e;break;case"gc":r.data.gc=!0;break}};var YL=typeof Path2D<"u";dt.path2dEnabled=function(t){if(t===void 0)return this.pathsEnabled;this.pathsEnabled=!!t};dt.usePaths=function(){return YL&&this.pathsEnabled};dt.setImgSmoothing=function(t,e){t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled=e:(t.webkitImageSmoothingEnabled=e,t.mozImageSmoothingEnabled=e,t.msImageSmoothingEnabled=e)};dt.getImgSmoothing=function(t){return t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled:t.webkitImageSmoothingEnabled||t.mozImageSmoothingEnabled||t.msImageSmoothingEnabled};dt.makeOffscreenCanvas=function(t,e){var r;if((typeof OffscreenCanvas>"u"?"undefined":wr(OffscreenCanvas))!=="undefined")r=new OffscreenCanvas(t,e);else{var a=this.cy.window(),i=a.document;r=i.createElement("canvas"),r.width=t,r.height=e}return r};[eN,bn,$n,Z0,nl,os,ra,iN,us,jc,fN].forEach(function(t){Ze(dt,t)});var KL=[{name:"null",impl:qC},{name:"base",impl:$C},{name:"canvas",impl:QL}],XL=[{type:"layout",extensions:bB},{type:"renderer",extensions:KL}],hN={},vN={};function pN(t,e,r){var a=r,i=function(B){At("Can not register `"+e+"` for `"+t+"` since `"+B+"` already exists in the prototype and can not be overridden")};if(t==="core"){if(tc.prototype[e])return i(e);tc.prototype[e]=r}else if(t==="collection"){if(Ur.prototype[e])return i(e);Ur.prototype[e]=r}else if(t==="layout"){for(var s=function(B){this.options=B,r.call(this,B),bt(this._private)||(this._private={}),this._private.cy=B.cy,this._private.listeners=[],this.createEmitter()},o=s.prototype=Object.create(r.prototype),u=[],f=0;f<u.length;f++){var d=u[f];o[d]=o[d]||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=r.prototype.stop;o.stop=function(){var A=this.options;if(A&&A.animate){var B=this.animations;if(B)for(var R=0;R<B.length;R++)B[R].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(B){return B._private.cy},g={addEventFields:function(B,R){R.layout=B,R.cy=p(B),R.target=B},bubble:function(){return!0},parent:function(B){return p(B)}};Ze(o,{createEmitter:function(){return this._private.emitter=new oh(g,this),this},emitter:function(){return this._private.emitter},on:function(B,R){return this.emitter().on(B,R),this},one:function(B,R){return this.emitter().one(B,R),this},once:function(B,R){return this.emitter().one(B,R),this},removeListener:function(B,R){return this.emitter().removeListener(B,R),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(B,R){return this.emitter().emit(B,R),this}}),Nt.eventAliasesOn(o),a=s}else if(t==="renderer"&&e!=="null"&&e!=="base"){var y=gN("renderer","base"),b=y.prototype,E=r,S=r.prototype,T=function(){y.apply(this,arguments),E.apply(this,arguments)},C=T.prototype;for(var N in b){var j=b[N],M=S[N]!=null;if(M)return i(N);C[N]=j}for(var D in S)C[D]=S[D];b.clientFunctions.forEach(function(A){C[A]=C[A]||function(){Qt("Renderer does not implement `renderer."+A+"()` on its prototype")}}),a=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 BT({map:hN,keys:[t,e],value:a})}function gN(t,e){return LT({map:hN,keys:[t,e]})}function $L(t,e,r,a,i){return BT({map:vN,keys:[t,e,r,a],value:i})}function ZL(t,e,r,a){return LT({map:vN,keys:[t,e,r,a]})}var s0=function(){if(arguments.length===2)return gN.apply(null,arguments);if(arguments.length===3)return pN.apply(null,arguments);if(arguments.length===4)return ZL.apply(null,arguments);if(arguments.length===5)return $L.apply(null,arguments);Qt("Invalid extension access syntax")};tc.prototype.extension=s0;XL.forEach(function(t){t.extensions.forEach(function(e){pN(t.type,e.name,e.impl)})});var Fd=function(){if(!(this instanceof Fd))return new Fd;this.length=0},Zs=Fd.prototype;Zs.instanceString=function(){return"stylesheet"};Zs.selector=function(t){var e=this.length++;return this[e]={selector:t,properties:[]},this};Zs.css=function(t,e){var r=this.length-1;if(Xe(t))this[r].properties.push({name:t,value:e});else if(bt(t))for(var a=t,i=Object.keys(a),s=0;s<i.length;s++){var o=i[s],u=a[o];if(u!=null){var f=Mr.properties[o]||Mr.properties[Wd(o)];if(f!=null){var d=f.name,h=u;this[r].properties.push({name:d,value:h})}}}return this};Zs.style=Zs.css;Zs.generateStyle=function(t){var e=new Mr(t);return this.appendToStyle(e)};Zs.appendToStyle=function(t){for(var e=0;e<this.length;e++){var r=this[e],a=r.selector,i=r.properties;t.selector(a);for(var s=0;s<i.length;s++){var o=i[s];t.css(o.name,o.value)}}return t};var WL="3.33.1",Ws=function(e){if(e===void 0&&(e={}),bt(e))return new tc(e);if(Xe(e))return s0.apply(s0,arguments)};Ws.use=function(t){var e=Array.prototype.slice.call(arguments,1);return e.unshift(Ws),t.apply(null,e),this};Ws.warnings=function(t){return VT(t)};Ws.version=WL;Ws.stylesheet=Ws.Stylesheet=Fd;const JL={projectId:"",collection:"",readonly:!0},ez=["title","name","label","displayName","summary","description","text","subject"];function tz(t){const e={};if(!t)return e;for(const r of t.nodeSchemas??[])(r.titleField||r.subtitleField)&&(e[r.aType]={titleField:r.titleField,subtitleField:r.subtitleField});for(const r of t.edgeSchemas??[])(r.titleField||r.subtitleField)&&(e[r.axbType]={titleField:r.titleField,subtitleField:r.subtitleField});return e}function rz(t,e,r){const a=i=>i.length>24?i.slice(0,22)+"…":i;if(r){const i=t[r];if(typeof i=="string"&&i.length>0)return a(i);if(typeof i=="number"||typeof i=="boolean")return a(String(i))}for(const i of ez){const s=t[i];if(typeof s=="string"&&s.length>0)return a(s)}for(const i of Object.values(t))if(typeof i=="string"&&i.length>0&&i.length<=80)return a(i);return e.slice(0,8)}function so(t,e,r,a){var i;return rz(t,e,(i=a[r])==null?void 0:i.titleField)}function az(t,e,r,a,i){const s=[],o=[],u=new Set,f=new Set;u.add(t.aUid),s.push({data:{id:t.aUid,label:so(t.data,t.aUid,t.aType,i),nodeType:t.aType,isFocus:!0}});for(const d of e){if(!u.has(d.bUid)){u.add(d.bUid);const p=a[d.bUid];s.push({data:{id:d.bUid,label:p?so(p.data,d.bUid,d.bType,i):d.bUid.slice(0,8),nodeType:d.bType}})}const h=`${d.aUid}:${d.axbType}:${d.bUid}`;f.has(h)||(f.add(h),o.push({data:{id:h,source:d.aUid,target:d.bUid,label:d.axbType,edgeType:d.axbType}}))}for(const d of r){if(!u.has(d.aUid)){u.add(d.aUid);const p=a[d.aUid];s.push({data:{id:d.aUid,label:p?so(p.data,d.aUid,d.aType,i):d.aUid.slice(0,8),nodeType:d.aType}})}const h=`${d.aUid}:${d.axbType}:${d.bUid}`;f.has(h)||(f.add(h),o.push({data:{id:h,source:d.aUid,target:d.bUid,label:d.axbType,edgeType:d.axbType}}))}return[...s,...o]}function nz(t,e,r,a){const i=[],s=[],o=new Set,u=new Set;if(!o.has(t)){o.add(t);const f=r[t];i.push({data:{id:t,label:f?so(f.data,t,f.aType,a):t.slice(0,8),nodeType:(f==null?void 0:f.aType)??"",isFocus:!0}})}for(const f of e){if(!o.has(f.aUid)){o.add(f.aUid);const h=r[f.aUid];i.push({data:{id:f.aUid,label:h?so(h.data,f.aUid,f.aType,a):f.aUid.slice(0,8),nodeType:f.aType}})}if(!o.has(f.bUid)){o.add(f.bUid);const h=r[f.bUid];i.push({data:{id:f.bUid,label:h?so(h.data,f.bUid,f.bType,a):f.bUid.slice(0,8),nodeType:f.bType}})}const d=`${f.aUid}:${f.axbType}:${f.bUid}`;u.has(d)||(u.add(d),s.push({data:{id:d,source:f.aUid,target:f.bUid,label:f.axbType,edgeType:f.axbType}}))}return[...i,...s]}const iz=[{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 sz(t,e){switch(t){case"concentric":return{name:"concentric",concentric:r=>r.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 mN({node:t,focusUid:e,edges:r,schema:a,viewRegistry:i,config:s,onClose:o,onNodeClick:u}){const f=I.useRef(null),d=I.useRef(null),[h,p]=I.useState("breadthfirst"),[g,y]=I.useState(null),b=s??JL,E=(t==null?void 0:t.aUid)??e??"",S=jo(),T=!!r,C=r??[],N=T?[]:(S==null?void 0:S.edgeResults.out.edges)??[],j=T?[]:(S==null?void 0:S.edgeResults.in.edges)??[],M=I.useMemo(()=>{const z=new Set;if(T){for(const H of C)z.add(H.aUid),z.add(H.bUid);z.add(E)}else{for(const H of N)z.add(H.bUid);for(const H of j)z.add(H.aUid)}return t&&z.delete(t.aUid),[...z]},[T,C,N,j,t,E]),{data:D}=Mt.getNodesBatch.useQuery({uids:M},{enabled:M.length>0}),A=I.useMemo(()=>{const z=(D==null?void 0:D.nodes)??{};return t&&(z[t.aUid]=t),z},[D,t]),B=T?C:[...N,...j],R=I.useMemo(()=>{const z={};for(const H of B){const X=`${H.aUid}:${H.axbType}:${H.bUid}`;z[X]||(z[X]={edgeType:H.axbType,data:H.data,aType:H.aType,bType:H.bType})}return z},[B]),L=I.useMemo(()=>tz(a),[a]),_=I.useMemo(()=>T?nz(E,C,A,L):az(t,N,j,A,L),[T,E,C,t,N,j,A,L]),P=_.filter(z=>!z.data.source).length,q=_.filter(z=>z.data.source).length;for(const z of _)!z.data.source&&z.data.nodeType&&(z.data.color=Sw(z.data.nodeType));I.useEffect(()=>{const z=H=>{H.key==="Escape"&&o()};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[o]),I.useEffect(()=>{if(!f.current)return;d.current&&(d.current.destroy(),d.current=null);const z=Ws({container:f.current,elements:_,style:iz,layout:sz(h,E),minZoom:.2,maxZoom:4,wheelSensitivity:.3});return z.on("tap","node",H=>{const X=H.target,K=X.id(),k=X.data("nodeType");K!==E&&u(K,k)}),z.on("mouseover","node",H=>{const X=H.target,K=H.originalEvent;y({kind:"node",uid:X.id(),nodeType:X.data("nodeType"),x:K.clientX,y:K.clientY})}),z.on("mouseover","edge",H=>{const X=H.target,K=H.originalEvent;y({kind:"edge",edgeId:X.id(),edgeType:X.data("edgeType"),x:K.clientX,y:K.clientY})}),z.on("mouseout","node, edge",()=>{y(null)}),z.on("viewport",()=>y(null)),d.current=z,()=>{z.destroy(),d.current=null}},[h,E,_.length]);const F=I.useCallback(()=>{var z;(z=d.current)==null||z.fit(void 0,40)},[]),Y=[...new Set(_.filter(z=>!z.data.source).map(z=>z.data.nodeType))],U=I.useMemo(()=>{var J,ne,ee,ae,de,le,re,Z,oe;if(!g)return null;if(g.kind==="node"){const{uid:ve,nodeType:Ne}=g,Me=t&&ve===t.aUid?t.data:((J=A[ve])==null?void 0:J.data)??null;if(!Me)return{title:`${Ne} ${ve}`,tagName:null,data:null};const Je=((ne=i==null?void 0:i.nodes[Ne])==null?void 0:ne.views)??[],Ce=(ae=(ee=b.viewDefaults)==null?void 0:ee.nodes)==null?void 0:ae[Ne],ke=Ja(Ce,Je),Le=ke!=="json"?((de=Je.find(De=>De.viewName===ke))==null?void 0:de.tagName)??null:null;return{title:`${Ne} ${ve}`,tagName:Le,data:Me}}const{edgeId:z,edgeType:H}=g,X=R[z];if(!X)return null;const K=((le=i==null?void 0:i.edges[H])==null?void 0:le.views)??[],k=(Z=(re=b.viewDefaults)==null?void 0:re.edges)==null?void 0:Z[H],G=Ja(k,K),$=G!=="json"?((oe=K.find(ve=>ve.viewName===G))==null?void 0:oe.tagName)??null:null;return{title:`${X.aType} —[${H}]→ ${X.bType}`,tagName:$,data:X.data}},[g,t,A,i,b,R]);return Td.createPortal(m.jsxs("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50",onClick:o,children:[m.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:z=>z.stopPropagation(),children:[m.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:[m.jsx("span",{className:"text-sm font-medium text-slate-200",children:"Graph"}),m.jsxs("span",{className:"text-xs text-slate-500",children:[P," nodes, ",q," edges"]}),m.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[m.jsxs("select",{value:h,onChange:z=>p(z.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:[m.jsx("option",{value:"breadthfirst",children:"Tree"}),m.jsx("option",{value:"concentric",children:"Concentric"}),m.jsx("option",{value:"cose",children:"Force-directed"})]}),m.jsx("button",{onClick:F,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"}),m.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:"×"})]})]}),m.jsx("div",{ref:f,className:"flex-1 bg-slate-950"}),m.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:[Y.map(z=>m.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-slate-400 whitespace-nowrap",children:[m.jsx("span",{className:"inline-block w-2.5 h-2.5 rounded-full shrink-0",style:{backgroundColor:Sw(z)}}),z]},z)),m.jsx("span",{className:"text-xs text-slate-600 ml-auto whitespace-nowrap",children:"Click a node to drill in"})]})]}),g&&U&&U.data&&m.jsx(lz,{x:g.x,y:g.y,title:U.title,tagName:U.tagName,data:U.data})]}),document.body)}function lz({x:t,y:e,title:r,tagName:a,data:i}){const s=I.useRef(null),[o,u]=I.useState({left:t+12,top:e+12}),[f,d]=I.useState(!1);return I.useEffect(()=>{const h=s.current;if(!h)return;const p=h.getBoundingClientRect(),g=12;let y=t+g,b=e+g;y+p.width>window.innerWidth-g&&(y=t-p.width-g),b+p.height>window.innerHeight-g&&(b=e-p.height-g),u({left:y,top:b})},[t,e]),m.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:[m.jsx("div",{className:"px-3 py-1.5 border-b border-slate-700/60 text-xs text-slate-400 font-mono truncate",children:r}),m.jsx("div",{className:"p-2 max-h-64 overflow-auto",children:a&&!f?m.jsx(Xi,{tagName:a,data:i,onError:()=>d(!0)}):m.jsx("div",{className:"text-xs font-mono",children:m.jsx(Qa,{data:i,defaultExpanded:!0,depth:0})})})]})}function od(t,e,r){if(!e)return t.edgeTypes;const a=t.edgeTypes.filter(i=>r==="forward"?i.aType===e:i.bType===e);return a.length>0?a:t.edgeTypes}function ud(t){return[...new Set(t.map(e=>e.axbType))]}function eE(t,e,r){const a=[];let i=e;for(const s of r){const o=t.edgeTypes.filter(f=>f.axbType===s.axbType);let u;if(i&&o.length>0)if(s.direction==="forward"){const f=o.find(d=>d.aType===i);u=f==null?void 0:f.bType}else{const f=o.find(d=>d.bType===i);u=f==null?void 0:f.aType}else o.length===1&&(u=s.direction==="forward"?o[0].bType:o[0].aType);a.push({sourceType:i,targetType:u}),i=u}return a}function oz(t,e){var a;const r=(a=t.edgeSchemas)==null?void 0:a.find(i=>i.axbType===e&&!i.isNodeEntry);return(r==null?void 0:r.fields)??[]}function uz({schema:t}){const[e,r]=I.useState(""),[a,i]=I.useState("");return m.jsxs("div",{className:"p-6 max-w-6xl mx-auto",children:[m.jsxs("div",{className:"mb-6",children:[m.jsx("h1",{className:"text-xl font-bold mb-1",children:"Graph Traversal"}),m.jsx("p",{className:"text-sm text-slate-400",children:"Build multi-hop traversals to explore graph relationships"})]}),m.jsxs("div",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[m.jsxs("div",{className:"mb-5 flex gap-4 items-end",children:[m.jsxs("div",{className:"flex-1 max-w-sm",children:[m.jsx("label",{className:"block text-xs text-slate-400 mb-1.5",children:"Start Node UID"}),m.jsx("input",{type:"text",value:e,onChange:s=>r(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"})]}),m.jsxs("div",{children:[m.jsx("label",{className:"block text-xs text-slate-400 mb-1.5",children:"Node Type"}),m.jsxs("select",{value:a,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:[m.jsx("option",{value:"",children:"Any type"}),t.nodeTypes.map(s=>m.jsx("option",{value:s.type,children:s.type},s.type))]})]})]}),m.jsx(yN,{schema:t,startUid:e,startNodeType:a||void 0})]})]})}function yN({schema:t,startUid:e,startNodeType:r,viewRegistry:a,config:i}){const s=I.useMemo(()=>{var L,_;if(r){const P=od(t,r,"forward");return ud(P)[0]||((L=t.edgeTypes[0])==null?void 0:L.axbType)||""}return((_=t.edgeTypes[0])==null?void 0:_.axbType)||""},[t,r]),[o,u]=I.useState([{axbType:s,direction:"forward",limit:10}]),[f,d]=I.useState(100),[h,p]=I.useState(5),[g,y]=I.useState(null),[b,E]=I.useState(null),[S,T]=I.useState(new Set),C=Mt.traverse.useMutation({onSuccess:L=>y(L),onError:L=>E(L.message)}),N=C.isPending,j=I.useMemo(()=>eE(t,r,o),[t,r,o]),M=()=>{var q;const L=(q=j[j.length-1])==null?void 0:q.targetType,_=od(t,L,"forward"),P=ud(_);u([...o,{axbType:P[0]||"",direction:"forward",limit:10}])},D=L=>{o.length<=1||(u(o.filter((_,P)=>P!==L)),T(_=>{const P=new Set;for(const q of _)q<L?P.add(q):q>L&&P.add(q-1);return P}))},A=(L,_)=>{u(P=>{var F;const q=[...P];if(q[L]={...q[L],..._},"direction"in _){const U=(F=eE(t,r,q)[L])==null?void 0:F.sourceType,z=ud(od(t,U,q[L].direction));z.length>0&&!z.includes(q[L].axbType)&&(q[L]={...q[L],axbType:z[0]})}return q})},B=L=>{T(_=>{const P=new Set(_);return P.has(L)?P.delete(L):P.add(L),P})},R=()=>{e.trim()&&(E(null),y(null),C.mutate({startUid:e.trim(),hops:o,maxReads:f,concurrency:h}))};return m.jsxs(m.Fragment,{children:[r&&m.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[m.jsx("span",{className:"text-xs text-slate-500",children:"Starting from"}),m.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono font-medium ${$t(r)}`,children:r}),m.jsx("span",{className:"text-xs text-slate-400 font-mono",children:e})]}),m.jsxs("div",{className:"mb-5",children:[m.jsx("label",{className:"block text-xs text-slate-400 mb-2",children:"Hops"}),m.jsx("div",{className:"space-y-2",children:o.map((L,_)=>{const P=j[_],q=P==null?void 0:P.sourceType,F=P==null?void 0:P.targetType,Y=od(t,q,L.direction),U=ud(Y),z=S.has(_),H=oz(t,L.axbType);return m.jsxs("div",{className:"bg-slate-800/50 rounded-lg",children:[m.jsxs("div",{className:"flex items-center gap-2 p-3",children:[m.jsxs("span",{className:"text-xs text-slate-500 w-6 shrink-0",children:["#",_+1]}),q?m.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono shrink-0 ${$t(q)}`,children:q}):m.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono bg-slate-700 text-slate-500 shrink-0",children:"?"}),m.jsxs("select",{value:L.direction,onChange:X=>A(_,{direction:X.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:[m.jsx("option",{value:"forward",children:"Forward"}),m.jsx("option",{value:"reverse",children:"Reverse"})]}),m.jsx("select",{value:L.axbType,onChange:X=>A(_,{axbType:X.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:U.map(X=>m.jsx("option",{value:X,children:X},X))}),m.jsx("span",{className:"text-slate-600 text-xs",children:"→"}),F?m.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono shrink-0 ${$t(F)}`,children:F}):m.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono bg-slate-700 text-slate-500 shrink-0",children:"?"}),m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("span",{className:"text-xs text-slate-500",children:"limit:"}),m.jsx("input",{type:"number",value:L.limit,onChange:X=>A(_,{limit:parseInt(X.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})]}),m.jsx("button",{onClick:()=>B(_),className:`p-1 transition-colors ${z?"text-indigo-400":"text-slate-600 hover:text-slate-400"}`,title:"Advanced options",children:m.jsxs("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[m.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"}),m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}),o.length>1&&m.jsx("button",{onClick:()=>D(_),className:"text-slate-600 hover:text-red-400 transition-colors p-1",title:"Remove hop",children:m.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),z&&m.jsx(cz,{hop:L,index:_,fields:H,updateHop:A})]},_)})}),m.jsxs("button",{onClick:M,className:"mt-2 text-xs text-indigo-400 hover:text-indigo-300 transition-colors flex items-center gap-1",children:[m.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"Add Hop"]})]}),m.jsxs("div",{className:"mb-5 flex gap-5 items-end",children:[m.jsxs("div",{children:[m.jsx("label",{className:"block text-xs text-slate-400 mb-1.5",children:"Read Budget"}),m.jsx("input",{type:"number",value:f,onChange:L=>d(parseInt(L.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})]}),m.jsxs("div",{children:[m.jsx("label",{className:"block text-xs text-slate-400 mb-1.5",children:"Concurrency"}),m.jsx("input",{type:"number",value:h,onChange:L=>p(parseInt(L.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})]})]}),m.jsxs("div",{className:"mb-5 bg-slate-950 rounded-lg p-3",children:[m.jsx("p",{className:"text-xs text-slate-500 mb-1",children:"Query Preview"}),m.jsxs("div",{className:"flex items-center gap-1.5 text-sm font-mono flex-wrap",children:[m.jsx("span",{className:"text-indigo-400",children:e||"?"}),r&&m.jsxs("span",{className:"text-slate-500 text-xs",children:["(",r,")"]}),o.map((L,_)=>{var q;const P=(q=j[_])==null?void 0:q.targetType;return m.jsxs("span",{className:"flex items-center gap-1.5",children:[m.jsx("span",{className:"text-slate-600",children:L.direction==="forward"?"→":"←"}),m.jsx("span",{className:"text-emerald-400",children:L.axbType||"?"}),P&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"text-slate-600",children:"→"}),m.jsx("span",{className:"text-cyan-400 text-xs",children:P})]})]},_)})]})]}),m.jsx("button",{onClick:R,disabled:N||!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:N?m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"w-3.5 h-3.5 border-2 border-white border-t-transparent rounded-full animate-spin"}),"Running..."]}):m.jsxs(m.Fragment,{children:[m.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"Run Traversal"]})}),b&&m.jsx("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-3 mt-4 text-sm text-red-400",children:b}),g&&m.jsx("div",{className:"mt-5",children:m.jsx(hz,{result:g,startUid:e,schema:t,viewRegistry:a,config:i})})]})}function cz({hop:t,index:e,fields:r,updateHop:a}){var u,f;const i=()=>{var h;const d=t.where??[];a(e,{where:[...d,{field:((h=r[0])==null?void 0:h.name)||"",op:"==",value:""}]})},s=(d,h)=>{const p=[...t.where??[]];p[d]={...p[d],...h},a(e,{where:p})},o=d=>{const h=(t.where??[]).filter((p,g)=>g!==d);a(e,{where:h.length>0?h:void 0})};return m.jsxs("div",{className:"border-t border-slate-700/50 px-3 pb-3 pt-2 space-y-3",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"text-[10px] text-slate-500 w-16 shrink-0",children:"Order By"}),r.length>0?m.jsxs("select",{value:((u=t.orderBy)==null?void 0:u.field)||"",onChange:d=>{var h;return a(e,{orderBy:d.target.value?{field:d.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:[m.jsx("option",{value:"",children:"None"}),r.map(d=>m.jsx("option",{value:d.name,children:d.name},d.name))]}):m.jsx("input",{type:"text",value:((f=t.orderBy)==null?void 0:f.field)||"",onChange:d=>{var h;return a(e,{orderBy:d.target.value?{field:d.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&&m.jsxs("select",{value:t.orderBy.direction,onChange:d=>a(e,{orderBy:{...t.orderBy,direction:d.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:[m.jsx("option",{value:"asc",children:"asc"}),m.jsx("option",{value:"desc",children:"desc"})]})]}),m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[m.jsx("span",{className:"text-[10px] text-slate-500 w-16 shrink-0",children:"Where"}),m.jsx("button",{onClick:i,className:"text-[10px] text-indigo-400 hover:text-indigo-300 transition-colors",children:"+ Add filter"})]}),(t.where??[]).map((d,h)=>m.jsxs("div",{className:"flex items-center gap-1.5 ml-[4.5rem] mb-1",children:[r.length>0?m.jsx("select",{value:d.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:r.map(p=>m.jsx("option",{value:p.name,children:p.name},p.name))}):m.jsx("input",{type:"text",value:d.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"}),m.jsxs("select",{value:d.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:[m.jsx("option",{value:"==",children:"=="}),m.jsx("option",{value:"!=",children:"!="}),m.jsx("option",{value:"<",children:"<"}),m.jsx("option",{value:"<=",children:"<="}),m.jsx("option",{value:">",children:">"}),m.jsx("option",{value:">=",children:">="})]}),m.jsx("input",{type:"text",value:String(d.value),onChange:p=>{const g=Number(p.target.value),y=p.target.value==="true"?!0:p.target.value==="false"?!1:!isNaN(g)&&p.target.value!==""?g: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"}),m.jsx("button",{onClick:()=>o(h),className:"text-slate-600 hover:text-red-400 transition-colors p-0.5",children:m.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},h))]})]})}function xN(t,e,r){const a=[],i=t[e].direction;let s=i==="forward"?r.aUid:r.bUid;for(let u=e-1;u>=0;u--){const f=t[u],d=f.edges.find(h=>f.direction==="forward"?h.bUid===s:h.aUid===s);if(!d)break;a.unshift({edge:d,direction:f.direction}),s=f.direction==="forward"?d.aUid:d.bUid}const o=a.map(({edge:u,direction:f})=>({uid:f==="forward"?u.bUid:u.aUid,nodeType:f==="forward"?u.bType:u.aType,edgeType:u.axbType,direction:f==="forward"?"out":"in"}));return o.push({uid:i==="forward"?r.bUid:r.aUid,nodeType:i==="forward"?r.bType:r.aType,edgeType:r.axbType,direction:i==="forward"?"out":"in"}),o}const fz=20;function dz(t){return{uid:t,nodeType:"",edgeType:"",direction:"out"}}function hz({result:t,startUid:e,schema:r,viewRegistry:a,config:i}){const s=CT(),o=as(),[u,f]=I.useState(!1),d=I.useMemo(()=>t.hops.flatMap(p=>p.edges),[t.hops]),h=p=>{const b=t.hops[p].edges.slice(0,fz).map(E=>xN(t.hops,p,E));if(s)for(const E of b)s.createLane([dz(e),...E]);else o(`/node/${encodeURIComponent(e)}`,{state:{initialPaths:b}})};return m.jsxs("div",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[m.jsxs("div",{className:"flex items-center gap-6 mb-5",children:[m.jsxs("div",{children:[m.jsx("div",{className:"text-lg font-bold",children:t.nodes.length}),m.jsx("div",{className:"text-[10px] text-slate-500",children:"Result Nodes"})]}),m.jsxs("div",{children:[m.jsx("div",{className:"text-lg font-bold",children:t.hops.length}),m.jsx("div",{className:"text-[10px] text-slate-500",children:"Hops"})]}),m.jsxs("div",{children:[m.jsx("div",{className:"text-lg font-bold",children:t.totalReads}),m.jsx("div",{className:"text-[10px] text-slate-500",children:"Firestore Reads"})]}),t.truncated&&m.jsx("div",{className:"px-2 py-1 bg-amber-500/10 text-amber-400 rounded text-xs",children:"Truncated (budget exceeded)"}),m.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"})]}),m.jsx("div",{className:"space-y-4",children:t.hops.map((p,g)=>m.jsxs("div",{className:"border-l-2 border-indigo-500/30 pl-4",children:[m.jsxs("h3",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[m.jsxs("span",{className:"text-slate-500",children:["Hop ",g+1,":"]}),m.jsx("span",{className:"text-indigo-400 font-mono",children:p.axbType}),m.jsxs("span",{className:"text-slate-600 text-xs",children:["(",p.direction,", ",p.edges.length," edges from ",p.sourceCount," sources)"]}),p.truncated&&m.jsx("span",{className:"text-amber-400 text-[10px]",children:"truncated"}),p.edges.length>0&&m.jsx("button",{onClick:()=>h(g),className:"text-[10px] text-indigo-400 hover:text-indigo-300 transition-colors ml-auto",children:"show paths"})]}),m.jsxs("div",{className:"space-y-1.5",children:[p.edges.slice(0,20).map((y,b)=>{var E,S;return m.jsx(vz,{edge:y,direction:p.direction,allHops:t.hops,hopIndex:g,edgeViews:((E=a==null?void 0:a.edges[y.axbType])==null?void 0:E.views)??[],nodeViews:((S=a==null?void 0:a.nodes[p.direction==="forward"?y.bType:y.aType])==null?void 0:S.views)??[],config:i},b)}),p.edges.length>20&&m.jsxs("p",{className:"text-xs text-slate-500 pl-2",children:["... and ",p.edges.length-20," more"]}),p.edges.length===0&&m.jsx("p",{className:"text-xs text-slate-500",children:"No edges found"})]})]},g))}),u&&d.length>0&&m.jsx(mN,{focusUid:e,edges:d,schema:r,viewRegistry:a,config:i,onClose:()=>f(!1),onNodeClick:(p,g)=>{f(!1),s?s.drillIn({uid:p,nodeType:g,edgeType:"",direction:"out"}):o(`/node/${encodeURIComponent(p)}`)}})]})}function vz({edge:t,direction:e,allHops:r,hopIndex:a,edgeViews:i=[],nodeViews:s=[],config:o}){const u=CT(),f=Mt.useUtils(),[d,h]=I.useState(!1),[p,g]=I.useState(!1),[y,b]=I.useState(void 0),[E,S]=I.useState(!1),{aType:T,aUid:C,bType:N,bUid:j,data:M}=t,D=M&&Object.keys(M).length>0,A=e==="forward"?j:C,B=e==="forward"?N:T,R=e==="forward"?C:j,L=e==="forward"?T:N,_=y!==void 0,P=()=>{var k,G;const K=(G=(k=o==null?void 0:o.viewDefaults)==null?void 0:k.edges)==null?void 0:G[t.axbType];if(K&&i.length>0){const $=Ja(K,i,"inline");if($!=="json"){const J=i.find(ne=>ne.viewName===$);if(J)return J.tagName}}return"json"},[q,F]=I.useState(P),Y=()=>{var k,G;const K=(G=(k=o==null?void 0:o.viewDefaults)==null?void 0:k.nodes)==null?void 0:G[B];if(K&&s.length>0){const $=Ja(K,s,"inline");if($!=="json"){const J=s.find(ne=>ne.viewName===$);if(J)return J.tagName}}return"json"},[U,z]=I.useState(Y),H=()=>{if(!u)return;const K=xN(r,a,t);u.drillPath(K)},X=async()=>{var K,k;S(!0);try{const $=(await f.getNodesBatch.fetch({uids:[A]})).nodes[A]??null;if(b($),g(!0),$){const J=(k=(K=o==null?void 0:o.viewDefaults)==null?void 0:K.nodes)==null?void 0:k[B];if(J&&s.length>0){const ne=Ja(J,s,"inline");if(ne!=="json"){const ee=s.find(ae=>ae.viewName===ne);ee&&z(ee.tagName)}}}}catch{}finally{S(!1)}};return m.jsxs("div",{className:"bg-slate-800/50 rounded-lg",children:[m.jsxs("div",{className:"px-3 pt-2 pb-1 flex items-center gap-2 text-xs text-slate-500",children:[m.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono ${$t(L)}`,children:L}),m.jsx("span",{className:"font-mono text-slate-400",children:R}),m.jsx("span",{className:"text-slate-600",children:e==="forward"?"→":"←"}),m.jsx("span",{className:"text-slate-600 font-mono text-[10px]",children:t.axbType})]}),m.jsxs("div",{className:"px-3 pb-2 flex items-center gap-3",children:[m.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono ${$t(B)}`,children:B}),u?m.jsx("button",{onClick:H,className:"text-sm font-mono text-indigo-400 hover:text-indigo-300 transition-colors",title:"Dive into this node",children:A}):m.jsx(Ca,{to:`/node/${encodeURIComponent(A)}`,className:"text-sm font-mono text-indigo-400 hover:text-indigo-300 transition-colors",children:A}),m.jsx(Ca,{to:`/node/${encodeURIComponent(A)}`,className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",title:"Navigate to this node's page",children:"go to"}),D&&m.jsx("button",{onClick:()=>h(!d),className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",children:d?"hide edge":"show edge"}),!_&&!E&&m.jsx("button",{onClick:X,className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",children:"resolve"}),E&&m.jsx("span",{className:"w-2.5 h-2.5 border border-slate-400 border-t-transparent rounded-full animate-spin"}),_&&m.jsx("button",{onClick:()=>g(!p),className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",children:p?"hide node":"show node"})]}),d&&D&&m.jsxs("div",{className:"px-3 pb-2",children:[i.length>0&&m.jsx("div",{className:"mb-2",children:m.jsx(Qu,{views:i,activeView:q,onSwitch:F})}),q==="json"?m.jsx("div",{className:"font-mono text-[11px] leading-relaxed bg-slate-950 rounded p-2 overflow-auto max-h-40",children:m.jsx(Qa,{data:M,defaultExpanded:!0})}):m.jsx(Xi,{tagName:q,data:M,onError:()=>F("json")})]}),p&&_&&m.jsx("div",{className:"px-3 pb-2",children:y===null?m.jsx("p",{className:"text-[11px] text-slate-500 italic",children:"Node not found"}):m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[m.jsx("span",{className:"text-[10px] text-slate-500 uppercase tracking-wider font-semibold",children:"Node Data"}),s.length>0&&m.jsx(Qu,{views:s,activeView:U,onSwitch:z})]}),U==="json"?m.jsx("div",{className:"font-mono text-[11px] leading-relaxed bg-slate-950 rounded p-2 overflow-auto max-h-40",children:m.jsx(Qa,{data:y.data,defaultExpanded:!0})}):m.jsx(Xi,{tagName:U,data:y.data,onError:()=>z("json")})]})})]})}function Hd({fields:t,values:e,onChange:r,errors:a}){return m.jsx("div",{className:"space-y-4",children:t.map(i=>m.jsx(bN,{field:i,value:e[i.name],error:a==null?void 0:a[i.name],onChange:s=>r({...e,[i.name]:s})},i.name))})}function bN({field:t,value:e,error:r,onChange:a}){const i=`${t.name}${t.required?"":" (optional)"}`;return t.type==="string"?m.jsxs("div",{children:[m.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:i}),m.jsx("input",{type:"text",value:e??"",onChange:s=>a(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&&m.jsxs("p",{className:"text-[10px] text-slate-600 mt-0.5",children:["Min length: ",t.minLength]}),r&&m.jsx("p",{className:"text-xs text-red-400 mt-1",children:r})]}):t.type==="number"?m.jsxs("div",{children:[m.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:i}),m.jsx("input",{type:"number",value:e!=null?String(e):"",onChange:s=>{const o=s.target.value;if(o==="")return a(void 0);a(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"}),r&&m.jsx("p",{className:"text-xs text-red-400 mt-1",children:r})]}):t.type==="boolean"?m.jsxs("div",{children:[m.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[m.jsx("input",{type:"checkbox",checked:!!e,onChange:s=>a(s.target.checked),className:"w-4 h-4 bg-slate-800 border-slate-700 rounded text-indigo-600 focus:ring-indigo-500"}),m.jsx("span",{className:"text-xs text-slate-400",children:i})]}),r&&m.jsx("p",{className:"text-xs text-red-400 mt-1",children:r})]}):t.type==="enum"&&t.enumValues?m.jsxs("div",{children:[m.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:i}),m.jsxs("select",{value:e??"",onChange:s=>a(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:[m.jsx("option",{value:"",children:"Select..."}),t.enumValues.map(s=>m.jsx("option",{value:s,children:s},s))]}),r&&m.jsx("p",{className:"text-xs text-red-400 mt-1",children:r})]}):t.type==="array"&&t.itemMeta?m.jsx(pz,{field:t,value:e,onChange:a,error:r}):t.type==="object"&&t.fields?m.jsxs("div",{children:[m.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:i}),m.jsx("div",{className:"pl-4 border-l-2 border-slate-700",children:m.jsx(Hd,{fields:t.fields,values:e??{},onChange:s=>a(s)})}),r&&m.jsx("p",{className:"text-xs text-red-400 mt-1",children:r})]}):m.jsxs("div",{children:[m.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:i}),m.jsx("textarea",{value:e!==void 0?JSON.stringify(e,null,2):"",onChange:s=>{try{a(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"}),r&&m.jsx("p",{className:"text-xs text-red-400 mt-1",children:r})]})}function pz({field:t,value:e,onChange:r,error:a}){const i=Array.isArray(e)?e:[],[s,o]=I.useState(!1),u=()=>{var g,y,b;const p=((g=t.itemMeta)==null?void 0:g.type)==="object"?{}:((y=t.itemMeta)==null?void 0:y.type)==="string"?"":((b=t.itemMeta)==null?void 0:b.type)==="number"?0:null;r([...i,p])},f=p=>{r(i.filter((g,y)=>y!==p))},d=(p,g)=>{r(i.map((y,b)=>b===p?g:y))},h=`${t.name}${t.required?"":" (optional)"}`;return m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[m.jsx("label",{className:"text-xs text-slate-400",children:h}),m.jsxs("button",{type:"button",onClick:()=>o(!s),className:"text-[10px] text-slate-600 hover:text-slate-400",children:["[",i.length," items] ",s?"+":"-"]})]}),!s&&m.jsxs("div",{className:"pl-4 border-l-2 border-slate-700 space-y-2",children:[i.map((p,g)=>m.jsxs("div",{className:"flex items-start gap-2",children:[m.jsx("span",{className:"text-[10px] text-slate-600 mt-2 w-4 shrink-0",children:g}),m.jsx("div",{className:"flex-1",children:t.itemMeta&&m.jsx(bN,{field:{...t.itemMeta,name:`${t.name}[${g}]`},value:p,onChange:y=>d(g,y)})}),m.jsx("button",{type:"button",onClick:()=>f(g),className:"text-slate-600 hover:text-red-400 transition-colors mt-2",children:m.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},g)),m.jsxs("button",{type:"button",onClick:u,className:"text-xs text-indigo-400 hover:text-indigo-300 transition-colors flex items-center gap-1",children:[m.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"Add item"]})]}),a&&m.jsx("p",{className:"text-xs text-red-400 mt-1",children:a})]})}function wN({schema:t,existingNode:e,defaultType:r,onSaved:a,onCancel:i}){var M;const s=!!e,o=t.nodeSchemas??[],[u,f]=I.useState((e==null?void 0:e.aType)??r??((M=o[0])==null?void 0:M.aType)??""),[d,h]=I.useState((e==null?void 0:e.aUid)??""),[p,g]=I.useState((e==null?void 0:e.data)??{}),[y,b]=I.useState(null),E=Mt.createNode.useMutation({onSuccess:D=>a(D.uid),onError:D=>b(D.message)}),S=Mt.updateNode.useMutation({onSuccess:()=>a(e.aUid),onError:D=>b(D.message)}),T=E.isPending||S.isPending,C=I.useMemo(()=>o.find(D=>D.aType===u),[o,u]),N=D=>{f(D),s||g({})},j=()=>{b(null),s?S.mutate({uid:e.aUid,data:p}):E.mutate({aType:u,uid:d||void 0,data:p})};return m.jsxs("div",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[m.jsx("h2",{className:"text-sm font-semibold mb-4",children:s?`Edit Node: ${e.aUid}`:"Create Node"}),!s&&m.jsxs("div",{className:"mb-4",children:[m.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:"Node Type"}),m.jsx("select",{value:u,onChange:D=>N(D.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:o.map(D=>m.jsxs("option",{value:D.aType,children:[D.aType,D.description?` — ${D.description}`:""]},D.aType))})]}),!s&&m.jsxs("div",{className:"mb-4",children:[m.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:"UID (optional, auto-generated if empty)"}),m.jsx("input",{type:"text",value:d,onChange:D=>h(D.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"})]}),C&&C.fields.length>0?m.jsxs("div",{className:"mb-5",children:[m.jsx("label",{className:"block text-xs text-slate-500 mb-2 uppercase tracking-wider font-semibold",children:"Data Fields"}),m.jsx(Hd,{fields:C.fields,values:p,onChange:g})]}):m.jsxs("div",{className:"mb-5",children:[m.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:"Data (JSON)"}),m.jsx("textarea",{value:JSON.stringify(p,null,2),onChange:D=>{try{g(JSON.parse(D.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"})]}),y&&m.jsx("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-3 mb-4 text-sm text-red-400",children:y}),m.jsxs("div",{className:"flex gap-3",children:[m.jsxs("button",{onClick:j,disabled:T||!u,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:[T&&m.jsx("div",{className:"w-3.5 h-3.5 border-2 border-white border-t-transparent rounded-full animate-spin"}),s?"Save Changes":"Create Node"]}),m.jsx("button",{onClick:i,disabled:T,className:"px-4 py-2 text-sm text-slate-400 hover:text-slate-200 transition-colors disabled:opacity-50",children:"Cancel"})]})]})}const gz=[10,25,50,100],mz=[{value:"aUid",label:"UID"},{value:"createdAt",label:"Created"},{value:"updatedAt",label:"Updated"}],yz=["==","!=","<","<=",">",">="];function xz(t){if(t==="true")return!0;if(t==="false")return!1;const e=Number(t);return!isNaN(e)&&t!==""?e:t}function SN({type:t,schema:e,viewRegistry:r,config:a,onPick:i,compact:s=!1}){var ae,de,le,re;const o=s?10:25,[u,f]=I.useState(o),[d,h]=I.useState("aUid"),[p,g]=I.useState("asc"),[y,b]=I.useState([]),[E,S]=I.useState(!1),[T,C]=I.useState(1),[N,j]=I.useState([]),[M,D]=I.useState(void 0),A=y.filter(Z=>Z.field&&Z.value!==""),B={type:t,limit:u,sortBy:d,sortDir:p,startAfter:M,...A.length>0?{where:A}:{}},{data:R,isLoading:L,error:_,refetch:P}=Mt.getNodes.useQuery(B,{placeholderData:Z=>Z}),q=(R==null?void 0:R.nodes)??[],F=(R==null?void 0:R.hasMore)??!1,Y=(R==null?void 0:R.nextCursor)??null,U=(_==null?void 0:_.message)??null;I.useEffect(()=>{C(1),j([]),D(void 0)},[t,u,d,p,y]),I.useEffect(()=>{b([]),h("aUid"),g("asc"),S(!1)},[t]);const z=()=>{Y&&(j(Z=>[...Z,Y]),C(Z=>Z+1),D(Y))},H=()=>{if(T<=1)return;const Z=[...N];Z.pop();const oe=Z.length>0?Z[Z.length-1]:void 0;j(Z),C(ve=>ve-1),D(oe)},X=()=>{C(1),j([]),D(void 0),P()},K=(ae=e.nodeSchemas)==null?void 0:ae.find(Z=>Z.aType===t&&Z.isNodeEntry),k=(K==null?void 0:K.fields)??[],G=k.map(Z=>Z.name),$=[...mz,...k.filter(Z=>Z.type==="string"||Z.type==="number"||Z.type==="boolean"||Z.type==="enum").map(Z=>({value:Z.name,label:`data.${Z.name}`}))],J=((de=r==null?void 0:r.nodes[t])==null?void 0:de.views)??[],ne=(re=(le=a==null?void 0:a.viewDefaults)==null?void 0:le.nodes)==null?void 0:re[t],ee=s?[10,25,50]:gz;return m.jsxs("div",{children:[m.jsxs("div",{className:`bg-slate-900 rounded-xl border border-slate-800 ${s?"p-2":"p-3"} mb-4 space-y-3`,children:[m.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("label",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold",children:"Show"}),m.jsx("select",{value:u,onChange:Z=>f(Number(Z.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:ee.map(Z=>m.jsx("option",{value:Z,children:Z},Z))})]}),m.jsx("div",{className:"w-px h-5 bg-slate-700"}),m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("label",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold",children:"Sort"}),m.jsx("select",{value:d,onChange:Z=>h(Z.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(Z=>m.jsx("option",{value:Z.value,children:Z.label},Z.value))}),m.jsx("button",{onClick:()=>g(Z=>Z==="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:p==="asc"?"Ascending":"Descending",children:p==="asc"?"↑ Asc":"↓ Desc"})]}),m.jsx("div",{className:"w-px h-5 bg-slate-700"}),m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("button",{onClick:H,disabled:T<=1||L,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"}),m.jsxs("span",{className:"text-xs text-slate-400 px-1",children:["Page ",T]}),m.jsx("button",{onClick:z,disabled:!F||L,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"})]}),m.jsx("div",{className:"w-px h-5 bg-slate-700"}),m.jsxs("button",{onClick:()=>S(!E),className:`px-2 py-1 rounded text-xs flex items-center gap-1.5 transition-colors ${E||y.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:[m.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:m.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",y.length>0&&m.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:y.length})]}),m.jsx("button",{onClick:X,disabled:L,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:m.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:m.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"})})})]}),y.length>0&&!E&&m.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[m.jsx("span",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold",children:"Active"}),y.map((Z,oe)=>m.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:[m.jsx("span",{className:"text-slate-400",children:"data."}),Z.field," ",Z.op," ",m.jsx("span",{className:"text-indigo-200",children:String(Z.value)}),m.jsx("button",{onClick:()=>b(ve=>ve.filter((Ne,Me)=>Me!==oe)),className:"ml-0.5 text-indigo-400 hover:text-indigo-200",children:"×"})]},oe)),m.jsx("button",{onClick:()=>b([]),className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",children:"Clear all"})]}),E&&m.jsx(bz,{filters:y,onFiltersChange:b,fieldMetas:k,fieldNames:G})]}),U&&m.jsx("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-3 mb-4 text-sm text-red-400",children:U}),L?m.jsxs("div",{className:`flex items-center gap-2 text-slate-400 ${s?"py-6":"py-12"} justify-center`,children:[m.jsx("div",{className:"w-4 h-4 border-2 border-indigo-500 border-t-transparent rounded-full animate-spin"}),m.jsx("span",{className:"text-sm",children:"Loading nodes..."})]}):q.length===0?m.jsx("div",{className:`text-center ${s?"py-6":"py-12"} text-slate-500`,children:m.jsxs("p",{children:["No nodes found",y.length>0?" matching filters":` of type "${t}"`]})}):m.jsxs(m.Fragment,{children:[m.jsx("div",{className:`bg-slate-900 rounded-xl border border-slate-800 overflow-hidden ${s?"max-h-64 overflow-y-auto":""}`,children:m.jsxs("table",{className:"w-full",children:[m.jsx("thead",{children:m.jsxs("tr",{className:"border-b border-slate-800",children:[m.jsx("th",{className:"text-left text-[10px] uppercase tracking-wider text-slate-500 font-semibold px-4 py-3",children:"UID"}),m.jsx("th",{className:"text-left text-[10px] uppercase tracking-wider text-slate-500 font-semibold px-4 py-3",children:"Data"}),!s&&m.jsx("th",{className:"text-left text-[10px] uppercase tracking-wider text-slate-500 font-semibold px-4 py-3 w-44",children:"Created"})]})}),m.jsx("tbody",{children:q.map(Z=>m.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(Z.aUid):void 0,children:[m.jsx("td",{className:"px-4 py-3",children:i?m.jsx("span",{className:"text-sm font-mono text-indigo-400",children:Z.aUid}):m.jsx(Ca,{to:`/node/${encodeURIComponent(Z.aUid)}`,className:"text-sm font-mono text-indigo-400 hover:text-indigo-300 transition-colors",children:Z.aUid})}),m.jsx("td",{className:"px-4 py-3",children:m.jsx(Sz,{node:Z,views:J,resolverConfig:ne})}),!s&&m.jsx("td",{className:"px-4 py-3 text-xs text-slate-500",children:to(Z.createdAt)})]},Z.aUid))})]})}),!s&&m.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[m.jsxs("span",{className:"text-xs text-slate-500",children:[q.length," result",q.length!==1?"s":""," on this page"]}),m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("button",{onClick:H,disabled:T<=1||L,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"}),m.jsxs("span",{className:"text-xs text-slate-400 px-2",children:["Page ",T]}),m.jsx("button",{onClick:z,disabled:!F||L,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 bz({filters:t,onFiltersChange:e,fieldMetas:r,fieldNames:a}){const i=()=>{var p;const f=a[0]??"",d=r.find(g=>g.name===f);let h="";(d==null?void 0:d.type)==="boolean"?h=!0:(d==null?void 0:d.type)==="enum"&&((p=d.enumValues)!=null&&p.length)&&(h=d.enumValues[0]),e([...t,{field:f,op:"==",value:h}])},s=f=>{e(t.filter((d,h)=>h!==f))},o=(f,d)=>{const h=[...t];h[f]={...h[f],...d},e(h)},u=f=>r.find(d=>d.name===f);return m.jsxs("div",{className:"border-t border-slate-700/50 pt-3 space-y-2",children:[m.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[m.jsx("span",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold",children:"Where"}),m.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&&m.jsx("button",{onClick:()=>e([]),className:"text-[10px] text-red-400/60 hover:text-red-400 transition-colors ml-auto",children:"Clear all"})]}),t.map((f,d)=>m.jsx(wz,{index:d,clause:f,fieldNames:a,fieldMeta:u(f.field),allFieldMetas:r,totalFilters:t.length,onUpdate:h=>o(d,h),onRemove:()=>s(d)},d)),m.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:[m.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"Add filter"]})]})}function wz({index:t,clause:e,fieldNames:r,fieldMeta:a,allFieldMetas:i,totalFilters:s,onUpdate:o,onRemove:u}){var S;const[f,d]=I.useState(String(e.value)),h=I.useRef(null);I.useEffect(()=>{d(String(e.value))},[e.value]);const p=()=>{const T=xz(f.trim());T!==e.value&&o({value:T})},g=T=>{var j;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"&&((j=C.enumValues)!=null&&j.length)&&(N=C.enumValues[0]),o({field:T,value:N}),d(String(N))},y=(a==null?void 0:a.type)==="enum"&&((S=a.enumValues)==null?void 0:S.length),b=(a==null?void 0:a.type)==="boolean",E=y||b;return m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("span",{className:"text-[10px] text-slate-600 w-8 shrink-0 text-right",children:t===0?"":"AND"}),r.length>0?m.jsx("select",{value:e.field,onChange:T=>g(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.map(T=>m.jsx("option",{value:T,children:T},T))}):m.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"}),m.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:yz.map(T=>m.jsx("option",{value:T,children:T},T))}),y?m.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:a.enumValues.map(T=>m.jsx("option",{value:T,children:T},T))}):b?m.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:[m.jsx("option",{value:"true",children:"true"}),m.jsx("option",{value:"false",children:"false"})]}):m.jsx("input",{ref:h,type:"text",value:f,onChange:T=>d(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"}),a&&m.jsx("span",{className:"text-[9px] text-slate-600 shrink-0",children:a.type}),!E&&f!==String(e.value)&&f.trim()!==""&&m.jsx("span",{className:"text-[9px] text-amber-500 shrink-0",title:"Press Enter to apply",children:"pending"}),m.jsx("button",{onClick:u,className:"text-slate-600 hover:text-red-400 transition-colors p-0.5 shrink-0",title:"Remove filter",children:m.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})}function Sz({node:t,views:e,resolverConfig:r}){const[a,i]=I.useState(!1);if(!a&&e.length>0){const s=Ja(r,e,"listing");if(s!=="json"){const o=e.find(u=>u.viewName===s);if(o)return m.jsx("div",{children:m.jsx(Xi,{tagName:o.tagName,data:t.data,onError:()=>i(!0)})})}}return m.jsx("span",{className:"text-xs text-slate-400 font-mono",children:JO(t.data,100)})}function tE({schema:t,viewRegistry:e,config:r,defaultUid:a,defaultType:i,direction:s="out",onSaved:o,onCancel:u}){var ve,Ne,Me,Je;const f=t.edgeSchemas??[],d=t.nodeSchemas??[],h=I.useMemo(()=>i?s==="out"?f.filter(Ce=>Ce.aType===i):f.filter(Ce=>Ce.bType===i):f,[f,i,s]),[p,g]=I.useState(()=>{const Ce=h[0];return Ce?`${Ce.aType}:${Ce.axbType}:${Ce.bType}`:""}),[y,b]=I.useState(""),[E,S]=I.useState("create"),[T,C]=I.useState({}),[N,j]=I.useState({}),[M,D]=I.useState(""),[A,B]=I.useState(null),[R,L]=I.useState(""),_=I.useMemo(()=>f.find(Ce=>`${Ce.aType}:${Ce.axbType}:${Ce.bType}`===p),[f,p]),P=s==="out"?_==null?void 0:_.bType:_==null?void 0:_.aType,q=I.useMemo(()=>d.find(Ce=>Ce.aType===P&&Ce.isNodeEntry),[d,P]),F=Mt.checkNode.useQuery({uid:R},{enabled:!!R&&(E==="existing"||E==="manual")}),Y=a&&R?s==="out"?a:R:"",U=a&&R?s==="out"?R:a:"",z=(_==null?void 0:_.axbType)??"",H=Mt.checkEdge.useQuery({aUid:Y,axbType:z,bUid:U},{enabled:!!Y&&!!U&&!!z&&(E==="existing"||E==="manual")}),X=Ce=>{b(Ce),L(Ce)},K=I.useRef(null),k=()=>{const Ce=y.trim();Ce&&Ce!==R&&L(Ce)};I.useEffect(()=>{L("")},[E,p]);const G=Mt.createEdge.useMutation({onSuccess:()=>o(),onError:Ce=>B(Ce.message)}),$=Mt.createEdgeWithNode.useMutation({onSuccess:()=>o(),onError:Ce=>B(Ce.message)}),J=G.isPending||$.isPending,ne=Ce=>{g(Ce),C({}),j({}),b(""),D(""),L("")},ee=()=>{if(!_||!a)return;B(null);const Ce=_.aType,ke=_.axbType,Le=_.bType,De=s==="out"?"b":"a";if(E==="create")$.mutate({aType:Ce,axbType:ke,bType:Le,newNodeSide:De,existingUid:a,newNodeUid:M||void 0,edgeData:T,nodeData:N});else{if(!y)return;G.mutate({aType:Ce,aUid:s==="out"?a:y,axbType:ke,bType:Le,bUid:s==="out"?y:a,data:T})}},ae=R&&((ve=F.data)==null?void 0:ve.exists)===!0,de=R&&((Ne=F.data)==null?void 0:Ne.exists)===!1,le=R&&F.isLoading,re=R&&((Me=H.data)==null?void 0:Me.exists)===!0,Z=!_||J?!1:E==="create"?!0:!(!y||de),oe=P??"target";return m.jsxs("div",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[m.jsxs("h2",{className:"text-sm font-semibold mb-4",children:["Create ",s==="out"?"Outgoing":"Incoming"," Edge"]}),h.length>1&&m.jsxs("div",{className:"mb-4",children:[m.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:"Edge Type"}),m.jsx("select",{value:p,onChange:Ce=>ne(Ce.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:h.map(Ce=>{const ke=`${Ce.aType}:${Ce.axbType}:${Ce.bType}`;return m.jsxs("option",{value:ke,children:[Ce.aType," —[",Ce.axbType,"]→ ",Ce.bType,Ce.description?` — ${Ce.description}`:""]},ke)})})]}),_&&m.jsxs("div",{className:"mb-4 flex items-center gap-2 text-xs font-mono text-slate-400",children:[m.jsx("span",{className:`px-1.5 py-0.5 rounded ${$t(_.aType)}`,children:_.aType}),m.jsxs("span",{className:"text-slate-600",children:["—[",_.axbType,"]→"]}),m.jsx("span",{className:`px-1.5 py-0.5 rounded ${$t(_.bType)}`,children:_.bType})]}),m.jsxs("div",{className:"mb-4",children:[m.jsxs("label",{className:"block text-xs text-slate-400 mb-3",children:[s==="out"?"Target":"Source"," Node (",oe,")"]}),m.jsx("div",{className:"flex gap-4 border-b border-slate-700/50 mb-3 pt-1",children:["create","existing","manual"].map(Ce=>m.jsxs("button",{onClick:()=>S(Ce),className:`pb-2 text-xs transition-colors relative ${E===Ce?"text-slate-200":"text-slate-500 hover:text-slate-300"}`,children:[Ce==="create"?"Create new":Ce==="existing"?"Select existing":"Enter UID",E===Ce&&m.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-px bg-indigo-500"})]},Ce))}),E==="create"&&P&&m.jsxs("div",{children:[m.jsxs("div",{className:"mb-3",children:[m.jsx("label",{className:"block text-[11px] text-slate-500 mb-1",children:"UID (optional, auto-generated if empty)"}),m.jsx("input",{type:"text",value:M,onChange:Ce=>D(Ce.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"}),M&&m.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."})]}),q&&q.fields.length>0?m.jsxs("div",{children:[m.jsxs("label",{className:"block text-[11px] text-slate-500 mb-2 uppercase tracking-wider font-semibold",children:[P," Data"]}),m.jsx(Hd,{fields:q.fields,values:N,onChange:j})]}):m.jsxs("div",{children:[m.jsx("label",{className:"block text-[11px] text-slate-500 mb-1",children:"Data (JSON)"}),m.jsx("textarea",{value:JSON.stringify(N,null,2),onChange:Ce=>{try{j(JSON.parse(Ce.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"})]})]}),E==="existing"&&P&&m.jsxs("div",{children:[y&&m.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[m.jsx("span",{className:"text-[11px] text-slate-500",children:"Selected:"}),m.jsx("span",{className:"font-mono text-sm text-indigo-400",children:y}),m.jsx(rE,{checking:!!le,valid:!!ae,invalid:!!de}),m.jsx("button",{onClick:()=>{b(""),L("")},className:"text-[11px] text-slate-500 hover:text-slate-300 transition-colors",children:"clear"})]}),y&&re&&m.jsx(aE,{}),!y&&m.jsx(SN,{type:P,schema:t,viewRegistry:e,config:r,onPick:X,compact:!0})]}),E==="manual"&&m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("input",{ref:K,type:"text",value:y,onChange:Ce=>b(Ce.target.value),onBlur:k,onKeyDown:Ce=>{var ke;Ce.key==="Enter"&&(k(),(ke=K.current)==null||ke.blur())},placeholder:`e.g., ${oe}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"}),m.jsx(rE,{checking:!!le,valid:!!ae,invalid:!!de})]}),de&&m.jsxs("p",{className:"mt-1.5 text-xs text-red-400",children:['No node found with UID "',R,'"']}),ae&&((Je=F.data)==null?void 0:Je.node)&&F.data.node.aType!==P&&m.jsxs("p",{className:"mt-1.5 text-xs text-amber-400",children:['Node exists but is type "',F.data.node.aType,'" (expected "',P,'")']}),re&&m.jsx(aE,{})]})]}),_&&_.fields.length>0&&m.jsxs("div",{className:"mb-5",children:[m.jsx("label",{className:"block text-xs text-slate-500 mb-2 uppercase tracking-wider font-semibold",children:"Edge Data"}),m.jsx(Hd,{fields:_.fields,values:T,onChange:C})]}),A&&m.jsx("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-3 mb-4 text-sm text-red-400",children:A}),m.jsxs("div",{className:"flex gap-3",children:[m.jsxs("button",{onClick:ee,disabled:!Z,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:[J&&m.jsx("div",{className:"w-3.5 h-3.5 border-2 border-white border-t-transparent rounded-full animate-spin"}),E==="create"?`Create ${oe} + Edge`:re?"Update Edge":"Create Edge"]}),m.jsx("button",{onClick:u,disabled:J,className:"px-4 py-2 text-sm text-slate-400 hover:text-slate-200 transition-colors disabled:opacity-50",children:"Cancel"})]})]})}function rE({checking:t,valid:e,invalid:r}){return t?m.jsx("div",{className:"w-3.5 h-3.5 border-2 border-slate-500 border-t-transparent rounded-full animate-spin shrink-0"}):e?m.jsx("svg",{className:"w-4 h-4 text-emerald-400 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):r?m.jsx("svg",{className:"w-4 h-4 text-red-400 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}):null}function aE(){return m.jsxs("div",{className:"flex items-center gap-1.5 mt-1.5 mb-2 text-xs text-amber-400",children:[m.jsx("svg",{className:"w-3.5 h-3.5 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:m.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 nE({title:t,message:e,confirmLabel:r="Delete",onConfirm:a,onCancel:i,loading:s,requireConfirmText:o}){const[u,f]=I.useState(""),d=!o||u===o;return Td.createPortal(m.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",onClick:i,children:m.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:[m.jsx("h3",{className:"text-lg font-semibold mb-2",children:t}),m.jsx("p",{className:"text-sm text-slate-400 mb-4",children:e}),o&&m.jsxs("div",{className:"mb-4",children:[m.jsxs("p",{className:"text-xs text-slate-500 mb-2",children:["Type ",m.jsx("span",{className:"font-mono text-slate-300",children:o})," to confirm:"]}),m.jsx("input",{type:"text",value:u,onChange:h=>f(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"&&d&&!s&&a()}})]}),m.jsxs("div",{className:"flex justify-end gap-3",children:[m.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"}),m.jsxs("button",{onClick:a,disabled:s||!d,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&&m.jsx("div",{className:"w-3.5 h-3.5 border-2 border-white border-t-transparent rounded-full animate-spin"}),r]})]})]})}),document.body)}function Ez(t){if(t.length===0||t[0].frames.length===0)return null;function e(r,a){const i=new Map;for(const s of r){if(a>=s.frames.length)continue;const o=s.frames[a].uid;i.has(o)||i.set(o,[]),i.get(o).push(s)}return Array.from(i.values()).map(s=>({frame:s[0].frames[a],depth:a,laneIds:s.map(o=>o.id),children:e(s,a+1)}))}return{frame:t[0].frames[0],depth:0,laneIds:t.map(r=>r.id),children:e(t,1)}}function Tz({peek:t,onPeek:e,schema:r}){const a=as(),{lanes:i,activeLaneId:s,activeIndex:o,previewLaneId:u,popTo:f,closeLane:d,switchLane:h}=Zd(),p=I.useMemo(()=>{const D={};for(const A of r.edgeTypes)A.inverseLabel&&(D[A.axbType]=A.inverseLabel);return D},[r.edgeTypes]),g=I.useMemo(()=>u?i.map(D=>D.id===u?{...D,frames:D.frames.slice(0,-1)}:D):i,[i,u]),y=I.useMemo(()=>Ez(g),[g]);if(!(g.length>1||g.length===1&&g[0].frames.length>1)||!y)return null;const E=g.length>1,S=(t==null?void 0:t.laneId)??s,T=(t==null?void 0:t.frameIndex)??o;function C(D){return D.laneIds.includes(s)?s:D.laneIds[0]}function N(D){return m.jsx("span",{className:"text-slate-600 font-mono mx-0.5 shrink-0",children:D.direction==="out"?m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"text-indigo-500/60",children:D.edgeType}),m.jsx("span",{className:"ml-0.5",children:"→"})]}):p[D.edgeType]?m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"text-amber-500/60 cursor-help",title:`Inverse of: ${D.edgeType}`,children:p[D.edgeType]}),m.jsx("span",{className:"ml-0.5",children:"→"})]}):m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"mr-0.5",children:"←"}),m.jsx("span",{className:"text-indigo-500/60",children:D.edgeType})]})})}function j(D){const A=C(D),B=D.laneIds.includes(s)&&D.depth===o,R=D.laneIds.includes(S)&&D.depth===T;return m.jsxs("button",{onClick:()=>{B?a(`/node/${encodeURIComponent(D.frame.uid)}`):(h(A),f(A,D.depth))},onMouseEnter:()=>e(A,D.depth),className:`flex items-center gap-1 px-1.5 py-0.5 rounded transition-colors shrink-0 ${R?"bg-slate-800 text-slate-200":"text-slate-400 hover:text-slate-200 hover:bg-slate-800/60"}`,children:[D.frame.nodeType&&m.jsx("span",{className:`px-1 py-px rounded text-[9px] font-mono ${$t(D.frame.nodeType)}`,children:D.frame.nodeType}),m.jsx("span",{className:"font-mono truncate max-w-[120px]",children:D.frame.uid})]})}function M(D,A){const B=[D];let R=D;for(;R.children.length===1;)R=R.children[0],B.push(R);return m.jsxs(m.Fragment,{children:[B.map((L,_)=>m.jsxs(I.Fragment,{children:[(_>0||!A)&&N(L.frame),j(L)]},L.depth)),R.children.length>1&&m.jsx("div",{className:"flex flex-col border-l border-slate-700/50 ml-1.5 my-0.5",children:R.children.map((L,_)=>{const P=L.laneIds.includes(s);return m.jsxs("div",{className:`flex items-center transition-opacity ${!P&&E?"opacity-50 hover:opacity-80":""}`,children:[m.jsx("span",{className:"w-2 h-px bg-slate-700/50 shrink-0"}),M(L,!1)]},_)})}),R.children.length===0&&E&&m.jsx("button",{onClick:L=>{L.stopPropagation(),d(R.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 m.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:M(y,!0)})}function iE(t,e){const r=Math.min(t.length,e.length);for(let a=0;a<r;a++)if(t[a].uid!==e[a].uid)return a;return r}function Cz({schema:t,viewRegistry:e,config:r,onDataChanged:a}){var ne;const{lanes:i,activeLaneId:s,activeLane:o,activeIndex:u,previewLaneId:f,previewFrame:d,clearPreview:h,extendLane:p,extendPath:g,forkAndDrill:y,createLane:b,switchLane:E,popTo:S}=Zd(),T=jo(),[C,N]=I.useState(null),j=I.useRef(null),M=I.useRef(new Set),[,D]=I.useState(0),A=I.useRef(new Map);I.useEffect(()=>{N(null)},[s]);const B=I.useRef(i);B.current=i;const R=I.useRef(s);R.current=s;const L=I.useRef(d);L.current=d;const _=I.useRef(h);_.current=h,I.useEffect(()=>{if(T)return T.registerCallbacks({peek:ee=>{for(const ae of B.current){const de=ae.frames.findIndex(le=>le.uid===ee.uid);if(de>=0){_.current(),N({laneId:ae.id,frameIndex:de});return}}N(null),L.current(ee)},clearPeek:()=>{N(null),_.current()}}),()=>{T.registerCallbacks(null)}},[T]);const P=(C==null?void 0:C.laneId)??s,q=(C==null?void 0:C.frameIndex)??u,F=I.useMemo(()=>i.find(ee=>ee.id===P)??i[0],[i,P]),Y=(ne=F==null?void 0:F.frames[q])==null?void 0:ne.uid,U=I.useMemo(()=>{const ee=new Set,ae=[];for(const de of i)for(const le of de.frames)ee.has(le.uid)||(ee.add(le.uid),ae.push(le.uid));return ae},[i]);I.useEffect(()=>{if(!Y)return;const ee=A.current.get(Y);ee&&(ee.scrollTop=0)},[Y]),I.useEffect(()=>{const ee=ae=>{ae.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 z=I.useMemo(()=>{var ae;if(!f)return;const ee=i.find(de=>de.id===f);return(ae=ee==null?void 0:ee.frames[ee.frames.length-1])==null?void 0:ae.uid},[f,i]);I.useEffect(()=>{const ee=new Set(U);for(const ae of ee)if(!M.current.has(ae)){ae!==z&&(j.current=ae,requestAnimationFrame(()=>{requestAnimationFrame(()=>{j.current=null,D(de=>de+1)})}));break}M.current=ee},[U,z]);const H=I.useCallback(ee=>{var de;if(j.current===ee)return"drill-frame drill-frame--entering";if(ee===Y)return"drill-frame drill-frame--active";if(z&&ee===z)return"drill-frame drill-frame--behind";const ae=(de=F==null?void 0:F.frames[q+1])==null?void 0:de.uid;return ee===ae?"drill-frame drill-frame--behind":"drill-frame drill-frame--hidden"},[Y,z,F,q]),X=I.useMemo(()=>{const ee=new Map;for(const ae of i)for(let de=0;de<ae.frames.length;de++){const le=ae.frames[de].uid;ee.has(le)||ee.set(le,{laneId:ae.id,index:de,isDrilled:de>0})}if(F)for(let ae=0;ae<F.frames.length;ae++){const de=F.frames[ae].uid;ee.set(de,{laneId:F.id,index:ae,isDrilled:ae>0})}return ee},[i,F]),K=I.useCallback(ee=>{if(!F)return;const ae=F.frames.findIndex(de=>de.uid===ee.uid);if(ae>=0){N({laneId:F.id,frameIndex:ae});return}q<F.frames.length-1?y(P,q,ee):(P!==s&&E(P),p(P,ee)),N(null)},[F,P,q,s,p,y,E]),k=I.useCallback(ee=>{if(ee.length===0||!F)return;const ae=[...F.frames.slice(0,q+1),...ee];for(const re of i)if(iE(re.frames,ae)>=ae.length){E(re.id),re.frames.length>ae.length&&S(re.id,ae.length-1),N(null);return}let de=null,le=0;for(const re of i){const Z=iE(re.frames,ae);Z===re.frames.length&&Z>le&&(de=re,le=Z)}if(de){const re=ae.slice(le);g(de.id,re)}else b(ae);N(null)},[F,P,q,i,s,g,b,E,S]),G=I.useCallback((ee,ae)=>{S(ee,ae),N(null)},[S]),$=I.useMemo(()=>({drillIn:K,drillPath:k,popTo:G}),[K,k,G]),J=I.useCallback((ee,ae)=>{N({laneId:ee,frameIndex:ae})},[]);return m.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[m.jsx(Tz,{peek:C,onPeek:J,schema:t}),m.jsx(A0.Provider,{value:$,children:m.jsx("div",{className:"drill-perspective flex-1",children:U.map(ee=>{const ae=X.get(ee);return m.jsx("div",{ref:de=>{de?A.current.set(ee,de):A.current.delete(ee)},className:H(ee),children:m.jsx(jz,{uid:ee,schema:t,viewRegistry:e,config:r,onDataChanged:a,isDrilled:ae.isDrilled,drillIndex:ae.index,laneId:ae.laneId})},ee)})})})]})}function EN({nodeType:t,data:e,viewRegistry:r,config:a}){var d;const i=((d=r==null?void 0:r.nodes[t])==null?void 0:d.views)??[],[s,o]=I.useState("json"),[u,f]=I.useState(!1);return I.useEffect(()=>{var p,g;if(u)return;const h=(g=(p=a.viewDefaults)==null?void 0:p.nodes)==null?void 0:g[t];if(h&&i.length>0){const y=Ja(h,i,"detail");if(y!=="json"){const b=i.find(E=>E.viewName===y);b&&o(b.tagName)}}f(!0)},[u,i,a,t]),m.jsxs("section",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[m.jsxs("div",{className:"flex items-center justify-between mb-3",children:[m.jsx("h2",{className:"text-sm font-semibold",children:"Data"}),m.jsx(Qu,{views:i,activeView:s,onSwitch:o})]}),s==="json"?m.jsx("div",{className:"font-mono text-xs leading-relaxed bg-slate-950 rounded-lg p-4 overflow-auto max-h-96",children:m.jsx(Qa,{data:e,defaultExpanded:!0})}):m.jsx(Xi,{tagName:s,data:e,onError:()=>o("json")})]})}const Nz=[10,25,50,100];function eo(t,e){return e?`${e} (${t})`:t}function Az({schema:t,viewRegistry:e,config:r,onDataChanged:a}){var u;const{uid:i}=ME(),s=Ao();if(!i)return null;const o=(u=s.state)==null?void 0:u.initialPaths;return m.jsx(SM,{rootUid:i,initialPaths:o,children:m.jsx(Cz,{schema:t,viewRegistry:e,config:r,onDataChanged:a})})}function jz({uid:t,schema:e,viewRegistry:r,config:a,onDataChanged:i,isDrilled:s=!1,drillIndex:o=0,laneId:u}){var De,Ue;const f=as(),{drillIn:d,popTo:h,setRootType:p}=Zd(),g=jo(),y=Mt.useUtils(),[b,E]=I.useState(!1),[S,T]=I.useState(!1),[C,N]=I.useState(null),[j,M]=I.useState(""),[D,A]=I.useState(!1),[B,R]=I.useState(!1),[L,_]=I.useState(null),[P,q]=I.useState(null),[F,Y]=I.useState(null),U=!e.readonly,{data:z,isLoading:H,error:X,refetch:K}=Mt.getNodeDetail.useQuery({uid:t},{enabled:!!t}),k=(z==null?void 0:z.node)??null,G=(((De=z==null?void 0:z.outEdges)==null?void 0:De.length)??0)+(((Ue=z==null?void 0:z.inEdges)==null?void 0:Ue.length)??0),$=(X==null?void 0:X.message)??F??null,[J,ne]=I.useState(0),ee=()=>ne(xe=>xe+1),ae=()=>{y.getNodeDetail.invalidate({uid:t}),y.getEdges.invalidate()};I.useEffect(()=>{E(!1),A(!1),R(!1),Y(null)},[t]),I.useEffect(()=>{k&&o===0&&p(k.aType)},[k,o,p]),I.useEffect(()=>{if(!(!g||!k||o!==0))return g.setFocused({uid:k.aUid,nodeType:k.aType}),()=>{g.setFocused(null)}},[k==null?void 0:k.aUid,k==null?void 0:k.aType,o,g]);const de=Mt.deleteNode.useMutation({onSuccess:()=>{ae(),i==null||i(),s&&u?h(u,o-1):f("/")},onError:xe=>Y(xe.message),onSettled:()=>{N(null),M("")}}),le=Mt.deleteNodeCascade.useMutation({onSuccess:xe=>{ae(),Y(xe.errors.length>0?`Cascade partially failed: ${xe.errors.map(Ye=>Ye.message).join(", ")}`:null),i==null||i(),xe.success&&(s&&u?h(u,o-1):f("/"))},onError:xe=>Y(xe.message),onSettled:()=>{N(null),M("")}}),re=Mt.deleteEdge.useMutation({onSuccess:()=>{_(null),ae(),ee(),i==null||i()},onError:xe=>Y(xe.message)}),Z=Mt.bulkDeleteEdges.useMutation({onSuccess:xe=>{q(null),ae(),ee(),i==null||i(),xe.errors.length>0&&Y(`Bulk delete partially failed: deleted ${xe.deleted}, ${xe.errors.length} batch(es) failed`)},onError:xe=>{Y(xe.message),q(null)}}),oe=Mt.deleteEdgesBatch.useMutation({onSuccess:()=>{q(null),ae(),ee(),i==null||i()},onError:xe=>{Y(xe.message),q(null)}}),ve=()=>{t&&de.mutate({uid:t})},Ne=()=>{t&&le.mutate({uid:t})},Me=()=>{L&&re.mutate({aUid:L.aUid,axbType:L.axbType,bUid:L.bUid})},Je=()=>{if(!P)return;const xe=P;if(xe.mode==="visible")oe.mutate({edges:xe.edges});else if(xe.mode==="filtered"){const Ye={axbType:xe.axbType,...xe.direction==="out"?{aUid:xe.uid}:{bUid:xe.uid}};xe.where.length>0&&(Ye.where=xe.where),Z.mutate(Ye)}else Z.mutate(xe.direction==="out"?{aUid:xe.uid,axbType:xe.axbType}:{bUid:xe.uid,axbType:xe.axbType})};if(H)return m.jsx("div",{className:"flex items-center justify-center py-20",children:m.jsx("div",{className:"w-5 h-5 border-2 border-indigo-500 border-t-transparent rounded-full animate-spin"})});if($)return m.jsx("div",{className:"p-6",children:m.jsx("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-4 text-sm text-red-400",children:$})});if(!k)return m.jsx("div",{className:"p-6",children:m.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-8 text-center",children:[m.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Node Not Found"}),m.jsxs("p",{className:"text-sm text-slate-400",children:["No node with UID ",m.jsx("code",{className:"text-indigo-400 font-mono",children:t})," was found."]})]})});if(b)return m.jsx("div",{className:"p-6 max-w-6xl mx-auto",children:m.jsx(wN,{schema:e,existingNode:k,onSaved:()=>{E(!1),K(),i==null||i()},onCancel:()=>E(!1)})});const Ce=e.edgeTypes.filter(xe=>xe.aType===k.aType).map(xe=>xe.axbType),ke=e.edgeTypes.filter(xe=>xe.bType===k.aType).map(xe=>xe.axbType),Le={};for(const xe of e.edgeTypes)xe.inverseLabel&&(Le[xe.axbType]=xe.inverseLabel);return m.jsxs("div",{className:"p-6 max-w-6xl mx-auto",children:[m.jsxs("div",{className:"mb-6",children:[m.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[m.jsx(Ca,{to:`/browse/${encodeURIComponent(k.aType)}`,className:`px-2 py-0.5 rounded text-xs font-mono hover:opacity-80 transition-opacity ${$t(k.aType)}`,children:k.aType}),m.jsx("h1",{className:"text-xl font-bold font-mono",children:k.aUid}),m.jsxs("div",{className:"ml-auto flex gap-2",children:[m.jsx("button",{onClick:()=>T(!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"}),U&&m.jsxs(m.Fragment,{children:[m.jsx("button",{onClick:()=>E(!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"}),m.jsx("button",{onClick:()=>N("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"})]})]})]}),m.jsxs("div",{className:"flex gap-4 text-xs text-slate-500 mt-2",children:[m.jsxs("span",{children:["Created: ",to(k.createdAt)]}),m.jsxs("span",{children:["Updated: ",to(k.updatedAt)]})]})]}),m.jsx("div",{className:"mb-6",children:m.jsx(EN,{nodeType:k.aType,data:k.data,viewRegistry:r,config:a},t)}),m.jsxs("section",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5 mb-6",children:[m.jsxs("div",{className:"flex items-center justify-between mb-3",children:[m.jsx("h2",{className:"text-sm font-semibold",children:"Outgoing Edges"}),U&&!D&&m.jsxs("button",{onClick:()=>A(!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:[m.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"Add Edge"]})]}),D&&m.jsx("div",{className:"mb-4",children:m.jsx(tE,{schema:e,viewRegistry:r,config:a,defaultUid:k.aUid,defaultType:k.aType,direction:"out",onSaved:()=>{A(!1),ee(),i==null||i()},onCancel:()=>A(!1)})}),!D&&m.jsx(sE,{uid:k.aUid,direction:"out",axbTypes:Ce,canWrite:U,onDeleteEdge:xe=>_({aUid:xe.aUid,axbType:xe.axbType,bUid:xe.bUid}),onBulkDelete:xe=>q(xe),nodeUid:k.aUid,reloadKey:J,viewRegistry:r,config:a,schema:e,publishToNearby:o===0})]}),m.jsxs("section",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5 mb-6",children:[m.jsxs("div",{className:"flex items-center justify-between mb-3",children:[m.jsx("h2",{className:"text-sm font-semibold",children:"Incoming Edges"}),U&&!B&&ke.length>0&&m.jsxs("button",{onClick:()=>R(!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:[m.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"Add Edge"]})]}),B&&m.jsx("div",{className:"mb-4",children:m.jsx(tE,{schema:e,viewRegistry:r,config:a,defaultUid:k.aUid,defaultType:k.aType,direction:"in",onSaved:()=>{R(!1),ee(),i==null||i()},onCancel:()=>R(!1)})}),!B&&m.jsx(sE,{uid:k.aUid,direction:"in",axbTypes:ke,inverseLabelMap:Le,canWrite:U,onDeleteEdge:xe=>_({aUid:xe.aUid,axbType:xe.axbType,bUid:xe.bUid,inverseLabel:Le[xe.axbType]}),onBulkDelete:xe=>q(xe),nodeUid:k.aUid,reloadKey:J,viewRegistry:r,config:a,schema:e,publishToNearby:o===0})]}),e.edgeTypes.length>0&&m.jsxs("section",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[m.jsxs("h2",{className:"text-sm font-semibold mb-4 flex items-center gap-2",children:[m.jsx("svg",{className:"w-4 h-4 text-indigo-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"Traverse from this node"]}),m.jsx(yN,{schema:e,startUid:k.aUid,startNodeType:k.aType,viewRegistry:r,config:a})]}),C==="choose"&&Td.createPortal(m.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",onClick:()=>N(null),children:m.jsxs("div",{className:"bg-slate-900 border border-slate-700 rounded-xl p-6 max-w-md w-full mx-4 shadow-2xl",onClick:xe=>xe.stopPropagation(),children:[m.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Delete Node"}),m.jsxs("p",{className:"text-sm text-slate-400 mb-2",children:["How do you want to delete ",m.jsxs("span",{className:"font-mono text-slate-300",children:['"',k.aUid,'"']})," (",k.aType,")?"]}),G>0&&m.jsxs("p",{className:"text-xs text-amber-400/80 mb-4",children:["This node has ",G,"+ connected edge",G!==1?"s":"","."]}),m.jsxs("div",{className:"flex flex-col gap-2 mt-4",children:[m.jsxs("button",{onClick:()=>{M(""),N("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 + ",m.jsx("span",{className:"font-bold uppercase",children:"ALL"})," edges"]}),m.jsx("button",{onClick:()=>{M(""),N("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"}),m.jsx("button",{onClick:()=>N(null),className:"w-full px-4 py-2 text-sm text-slate-500 hover:text-slate-300 transition-colors",children:"Cancel"})]})]})}),document.body),(C==="confirm-cascade"||C==="confirm-node-only")&&Td.createPortal(m.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",onClick:()=>{N(null),M("")},children:m.jsxs("div",{className:"bg-slate-900 border border-slate-700 rounded-xl p-6 max-w-md w-full mx-4 shadow-2xl",onClick:xe=>xe.stopPropagation(),children:[m.jsx("h3",{className:"text-lg font-semibold mb-2",children:C==="confirm-cascade"?m.jsxs(m.Fragment,{children:["Confirm: Delete node + ",m.jsx("span",{className:"text-red-400 uppercase",children:"ALL"})," edges"]}):"Confirm: Delete node only"}),m.jsx("p",{className:"text-sm text-slate-400 mb-4",children:C==="confirm-cascade"?m.jsxs(m.Fragment,{children:["This will permanently delete the node and ",m.jsx("span",{className:"text-red-400 font-semibold uppercase",children:"ALL"})," connected edges."]}):"This will delete only the node record. Connected edges will remain."}),m.jsxs("div",{className:"mb-4",children:[m.jsxs("p",{className:"text-xs text-slate-500 mb-2",children:["Type ",m.jsx("span",{className:"font-mono text-slate-300",children:k.aUid})," to confirm:"]}),m.jsx("input",{type:"text",value:j,onChange:xe=>M(xe.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:k.aUid,autoFocus:!0,onKeyDown:xe=>{xe.key==="Enter"&&j===k.aUid&&(C==="confirm-cascade"?Ne():ve())}})]}),m.jsxs("div",{className:"flex justify-end gap-3",children:[m.jsx("button",{onClick:()=>{N("choose"),M("")},disabled:de.isPending||le.isPending,className:"px-4 py-2 text-sm text-slate-400 hover:text-slate-200 transition-colors disabled:opacity-50",children:"Back"}),m.jsxs("button",{onClick:C==="confirm-cascade"?Ne:ve,disabled:j!==k.aUid||de.isPending||le.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:[(de.isPending||le.isPending)&&m.jsx("div",{className:"w-3.5 h-3.5 border-2 border-white border-t-transparent rounded-full animate-spin"}),C==="confirm-cascade"?"Delete":"Delete node only"]})]})]})}),document.body),L&&m.jsx(nE,{title:"Delete Edge",message:`Delete edge ${L.aUid} —[${eo(L.axbType,L.inverseLabel)}]→ ${L.bUid}?`,requireConfirmText:L.axbType,onConfirm:Me,onCancel:()=>_(null),loading:re.isPending}),P&&m.jsx(nE,{title:P.mode==="visible"?`Delete ${P.edges.length} Edge${P.edges.length!==1?"s":""}`:P.mode==="filtered"?"Delete Filtered Edges":m.jsxs(m.Fragment,{children:["Delete ",m.jsx("span",{className:"text-red-400 uppercase font-bold",children:"ALL"})," Edges"]}),message:P.mode==="visible"?`Delete the ${P.edges.length} "${eo(P.axbType,P.inverseLabel)}" edge${P.edges.length!==1?"s":""} currently visible on this page?`:P.mode==="filtered"?`Delete all "${eo(P.axbType,P.inverseLabel)}" edges ${P.direction==="out"?"from":"to"} this node that match the current filters? This may include edges on other pages.`:m.jsxs(m.Fragment,{children:["Delete ",m.jsx("span",{className:"text-red-400 font-semibold uppercase",children:"ALL"}),' "',eo(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:Je,onCancel:()=>q(null),loading:Z.isPending||oe.isPending}),S&&k&&m.jsx(mN,{node:k,schema:e,viewRegistry:r,config:a,onClose:()=>T(!1),onNodeClick:(xe,Ye)=>{T(!1),d({uid:xe,nodeType:Ye,edgeType:"",direction:"out"})}})]})}function sE({uid:t,direction:e,axbTypes:r,inverseLabelMap:a={},canWrite:i,onDeleteEdge:s,onBulkDelete:o,nodeUid:u,reloadKey:f,viewRegistry:d,config:h,schema:p,publishToNearby:g=!1}){const[y,b]=I.useState(25),[E,S]=I.useState(""),[T,C]=I.useState(""),[N,j]=I.useState("asc"),[M,D]=I.useState(""),[A,B]=I.useState("=="),[R,L]=I.useState(""),[_,P]=I.useState([]),[q,F]=I.useState(!1),[Y,U]=I.useState(1),[z,H]=I.useState([]),[X,K]=I.useState(void 0),[k,G]=I.useState(!1),[$,J]=I.useState(!1),[ne,ee]=I.useState({}),ae=["axbType","aType","aUid","bType","bUid","createdAt","updatedAt"],de=I.useMemo(()=>{const ye=p.edgeSchemas??[],Ge=E?ye.filter(at=>at.axbType===E):ye.filter(at=>r.includes(at.axbType)),rt=new Set;for(const at of Ge)for(const ct of at.fields)rt.add(ct.name);return[...rt].sort()},[p.edgeSchemas,E,r]),le={...e==="out"?{aUid:t}:{bUid:t},...E?{axbType:E}:{},limit:y,startAfter:X,...T?{sortBy:T,sortDir:N}:{},..._.length>0?{where:_}:{}},{data:re,isLoading:Z,error:oe,refetch:ve}=Mt.getEdges.useQuery(le,{placeholderData:ye=>ye}),Ne=(re==null?void 0:re.edges)??[],Me=(re==null?void 0:re.hasMore)??!1,Je=(re==null?void 0:re.nextCursor)??null,Ce=(oe==null?void 0:oe.message)??null,ke=jo();I.useEffect(()=>{!g||!ke||ke.setEdgeResults(e,{edges:Ne,hasMore:Me,loading:Z})},[g,ke,e,Ne,Me,Z]);const Le=$&&Ne.length>0?[...new Set(Ne.map(ye=>e==="out"?ye.bUid:ye.aUid))].filter(ye=>!(ye in ne)):[],{data:De,isFetching:Ue}=Mt.getNodesBatch.useQuery({uids:Le},{enabled:Le.length>0});I.useEffect(()=>{if(!De)return;const ye={};for(const[Ge,rt]of Object.entries(De.nodes))ye[Ge]=rt;ee(Ge=>({...Ge,...ye}))},[De]),I.useEffect(()=>{U(1),H([]),K(void 0),ee({})},[t,e,y,E,T,N,_,f]);const xe=()=>{Je&&(H(ye=>[...ye,Je]),U(ye=>ye+1),K(Je))},Ye=()=>{if(Y<=1)return;const ye=[...z];ye.pop();const Ge=ye.length>0?ye[ye.length-1]:void 0;H(ye),U(rt=>rt-1),K(Ge)},Re={};for(const ye of Ne){const Ge=ye.axbType;Re[Ge]||(Re[Ge]=[]),Re[Ge].push(ye)}return m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-3",children:[m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("label",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold",children:"Show"}),m.jsx("select",{value:y,onChange:ye=>b(Number(ye.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:Nz.map(ye=>m.jsx("option",{value:ye,children:ye},ye))})]}),r.length>0&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"w-px h-4 bg-slate-700"}),m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("label",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold",children:"Type"}),m.jsxs("select",{value:E,onChange:ye=>S(ye.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:[m.jsx("option",{value:"",children:"All"}),r.map(ye=>m.jsx("option",{value:ye,children:ye},ye))]})]})]}),m.jsx("div",{className:"w-px h-4 bg-slate-700"}),m.jsxs("button",{onClick:()=>F(ye=>!ye),className:`px-2 py-1 border rounded text-xs transition-colors flex items-center gap-1 ${q||T||_.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:[m.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:m.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"})}),_.length>0?`Filter (${_.length})`:T?"Sort":"Sort / Filter"]}),m.jsx("div",{className:"w-px h-4 bg-slate-700"}),m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("button",{onClick:Ye,disabled:Y<=1||Z,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"}),m.jsxs("span",{className:"text-xs text-slate-400 px-1",children:["Page ",Y]}),m.jsx("button",{onClick:xe,disabled:!Me||Z,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"})]}),m.jsx("button",{onClick:()=>{U(1),H([]),K(void 0),ve()},disabled:Z,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:m.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:m.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"})})}),m.jsx("div",{className:"w-px h-4 bg-slate-700"}),m.jsx("button",{onClick:()=>G(ye=>!ye),className:`px-2 py-1 border rounded text-xs transition-colors ${k?"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:k?"Collapse all edge details":"Expand all edge details",children:k?"Collapse all":"Expand all"}),m.jsx("button",{onClick:()=>J(ye=>!ye),className:`px-2 py-1 border rounded text-xs transition-colors ${$?"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:$?"Stop resolving target nodes":"Resolve all target nodes inline",children:Ue?m.jsxs("span",{className:"flex items-center gap-1",children:[m.jsx("span",{className:"w-2.5 h-2.5 border border-indigo-400 border-t-transparent rounded-full animate-spin"}),"Resolving..."]}):$?"Resolved":"Resolve all"})]}),q&&m.jsxs("div",{className:"bg-slate-800/50 border border-slate-700 rounded-lg p-3 mb-3 space-y-3",children:[m.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[m.jsx("label",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold w-10",children:"Sort"}),m.jsxs("select",{value:T,onChange:ye=>C(ye.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:[m.jsx("option",{value:"",children:"Default (axbType)"}),ae.map(ye=>m.jsx("option",{value:ye,children:ye},ye)),de.length>0&&m.jsx("optgroup",{label:"Data fields",children:de.map(ye=>m.jsx("option",{value:ye,children:ye},ye))})]}),m.jsxs("select",{value:N,onChange:ye=>j(ye.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:[m.jsx("option",{value:"asc",children:"asc"}),m.jsx("option",{value:"desc",children:"desc"})]})]}),_.length>0&&m.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[_.map((ye,Ge)=>m.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:[m.jsx("span",{className:"font-mono",children:ye.field}),m.jsx("span",{className:"text-indigo-400",children:ye.op}),m.jsx("span",{className:"font-mono",children:String(ye.value)}),m.jsx("button",{onClick:()=>P(rt=>rt.filter((at,ct)=>ct!==Ge)),className:"ml-0.5 text-indigo-400 hover:text-red-400 transition-colors",children:"×"})]},Ge)),m.jsx("button",{onClick:()=>P([]),className:"text-[10px] text-slate-500 hover:text-red-400 transition-colors",children:"Clear all"})]}),m.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[m.jsx("label",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold w-10",children:"Where"}),m.jsxs("select",{value:M,onChange:ye=>D(ye.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:[m.jsx("option",{value:"",children:"Field..."}),ae.map(ye=>m.jsx("option",{value:ye,children:ye},ye)),de.length>0&&m.jsx("optgroup",{label:"Data fields",children:de.map(ye=>m.jsx("option",{value:ye,children:ye},ye))})]}),m.jsx("select",{value:A,onChange:ye=>B(ye.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(ye=>m.jsx("option",{value:ye,children:ye},ye))}),m.jsx("input",{type:"text",value:R,onChange:ye=>L(ye.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:ye=>{if(ye.key==="Enter"&&M&&R){let Ge=R;R==="true"?Ge=!0:R==="false"?Ge=!1:!isNaN(Number(R))&&R.trim()!==""&&(Ge=Number(R)),P(rt=>[...rt,{field:M,op:A,value:Ge}]),L("")}}}),m.jsx("button",{onClick:()=>{if(!M||!R)return;let ye=R;R==="true"?ye=!0:R==="false"?ye=!1:!isNaN(Number(R))&&R.trim()!==""&&(ye=Number(R)),P(Ge=>[...Ge,{field:M,op:A,value:ye}]),L("")},disabled:!M||!R,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"})]})]}),Ce&&m.jsx("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-2 mb-3 text-xs text-red-400",children:Ce}),Z?m.jsxs("div",{className:"flex items-center gap-2 text-slate-400 py-6 justify-center",children:[m.jsx("div",{className:"w-3.5 h-3.5 border-2 border-indigo-500 border-t-transparent rounded-full animate-spin"}),m.jsx("span",{className:"text-xs",children:"Loading edges..."})]}):Ne.length===0?m.jsxs("p",{className:"text-sm text-slate-500",children:["No ",e==="out"?"outgoing":"incoming"," edges",E?` of type "${E}"`:""]}):m.jsx("div",{className:"space-y-4",children:Object.entries(Re).map(([ye,Ge])=>m.jsx(Dz,{axbType:ye,edges:Ge,direction:e,inverseLabel:e==="in"?a[ye]:void 0,canWrite:i,onDeleteEdge:s,onBulkDelete:o&&u?rt=>{const at=e==="in"?a[ye]:void 0;o(rt==="visible"?{mode:"visible",axbType:ye,inverseLabel:at,edges:Ge.map(ct=>({aUid:ct.aUid,axbType:ct.axbType,bUid:ct.bUid}))}:rt==="filtered"?{mode:"filtered",axbType:ye,inverseLabel:at,direction:e,uid:u,where:_}:{mode:"all",axbType:ye,inverseLabel:at,direction:e,uid:u})}:void 0,hasActiveFilters:_.length>0,expandAll:k,resolveAll:$,resolvedNodes:ne,viewRegistry:d,config:h},ye))}),Ne.length>0&&(Me||Y>1)&&m.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[m.jsxs("span",{className:"text-[10px] text-slate-500",children:[Ne.length," edge",Ne.length!==1?"s":""," on this page"]}),m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("button",{onClick:Ye,disabled:Y<=1||Z,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"}),m.jsxs("span",{className:"text-[10px] text-slate-400 px-1",children:["Page ",Y]}),m.jsx("button",{onClick:xe,disabled:!Me||Z,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 Dz({axbType:t,edges:e,direction:r,inverseLabel:a,canWrite:i,onDeleteEdge:s,onBulkDelete:o,hasActiveFilters:u=!1,expandAll:f,resolveAll:d,resolvedNodes:h,viewRegistry:p,config:g}){var X;const[y,b]=I.useState(!1),[E,S]=I.useState(""),[T,C]=I.useState(""),[N,j]=I.useState(!1),[M,D]=I.useState(!1),[A,B]=I.useState({}),R=f||N,L=d||M,[_,P]=I.useState(!0),q=((X=p==null?void 0:p.edges[t])==null?void 0:X.views)??[],F=I.useMemo(()=>{var k;const K=new Map;if(!p)return[];for(const G of e){const $=r==="out"?G.bType:G.aType;for(const J of((k=p.nodes[$])==null?void 0:k.views)??[])K.has(J.viewName)||K.set(J.viewName,J)}return[...K.values()]},[p,e,r]),Y={...h,...A},U=M&&!d&&e.length>0?[...new Set(e.map(K=>r==="out"?K.bUid:K.aUid))].filter(K=>!(K in Y)):[],{data:z,isFetching:H}=Mt.getNodesBatch.useQuery({uids:U},{enabled:U.length>0});return I.useEffect(()=>{if(!z)return;const K={};for(const[k,G]of Object.entries(z.nodes))K[k]=G;B(k=>({...k,...K}))},[z]),m.jsxs("div",{children:[m.jsxs("div",{className:"text-xs font-mono mb-2 flex items-center gap-2",children:[r==="out"?m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"text-slate-500",children:"—"}),m.jsx("span",{className:"text-indigo-400",children:t}),m.jsx("span",{className:"text-slate-500",children:"→"})]}):a?m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"text-slate-500",children:"—"}),m.jsx("span",{className:"text-amber-400 cursor-help",title:`Inverse of: ${t}`,children:a}),m.jsx("span",{className:"text-slate-500",children:"→"})]}):m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"text-slate-500",children:"←"}),m.jsx("span",{className:"text-indigo-400",children:t}),m.jsx("span",{className:"text-slate-500",children:"—"})]}),m.jsxs("span",{className:"text-slate-600 text-[10px]",children:["(",e.length,")"]}),m.jsxs("div",{className:"ml-auto flex items-center gap-1.5",children:[m.jsx("button",{onClick:()=>j(K=>!K),className:`p-1 border rounded transition-colors ${R?"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:R?"Collapse edges":"Expand edges",children:m.jsx("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:R?m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 14h6v6M20 10h-6V4M14 10l7-7M3 21l7-7"}):m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"})})}),m.jsx("button",{onClick:()=>{L?P(K=>!K):(D(!0),P(!0))},className:`p-1 border rounded transition-colors ${L?_?"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:L?_?"Hide node data":"Show node data":"Resolve target nodes","aria-label":L?_?"Hide node data":"Show node data":"Resolve target nodes",children:H?m.jsx("span",{className:"w-3 h-3 border-[1.5px] border-indigo-400 border-t-transparent rounded-full animate-spin block"}):L&&_?m.jsx("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:m.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"})}):m.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),m.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"})]})}),q.length>0&&m.jsxs("span",{className:"relative inline-flex items-center",children:[m.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:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 5l7 7-7 7M5 12h14"})}),m.jsxs("select",{value:E,onChange:K=>S(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:[m.jsx("option",{value:"",dir:"ltr",children:"default"}),m.jsx("option",{value:"json",dir:"ltr",children:"JSON"}),q.map(K=>m.jsx("option",{value:K.viewName,dir:"ltr",children:K.viewName},K.viewName))]})]}),F.length>0&&m.jsxs("span",{className:"relative inline-flex items-center",children:[m.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:m.jsx("circle",{cx:"12",cy:"12",r:"8"})}),m.jsxs("select",{value:T,onChange:K=>C(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:[m.jsx("option",{value:"",dir:"ltr",children:"default"}),m.jsx("option",{value:"json",dir:"ltr",children:"JSON"}),F.map(K=>m.jsx("option",{value:K.viewName,dir:"ltr",children:K.viewName},K.viewName))]})]}),i&&o&&m.jsxs("div",{className:"relative",children:[m.jsx("button",{onClick:()=>b(K=>!K),className:`p-1 border rounded transition-colors ${y?"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 ${eo(t,a)} edges`,children:m.jsx("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:m.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"})})}),y&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"fixed inset-0 z-30",onClick:()=>b(!1)}),m.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:[m.jsxs("button",{onClick:()=>{b(!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&&m.jsx("button",{onClick:()=>{b(!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"}),m.jsxs("button",{onClick:()=>{b(!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 ",m.jsx("span",{className:"font-bold uppercase",children:"ALL"})," ",eo(t,a)," edges"]})]})]})]})]})]}),m.jsx("div",{className:"space-y-1",children:e.map((K,k)=>{var J,ne;const G=r==="out"?K.bUid:K.aUid,$=r==="out"?K.bType:K.aType;return m.jsx(Oz,{edge:K,targetUid:G,targetType:$,direction:r,canWrite:i,onDelete:()=>s(K),expandAllActive:R,resolvedNode:Y[G],resolveAllActive:L,edgeViews:((J=p==null?void 0:p.edges[K.axbType])==null?void 0:J.views)??[],nodeViews:((ne=p==null?void 0:p.nodes[$])==null?void 0:ne.views)??[],config:g,groupEdgeView:E,groupNodeView:T,groupNodeVisible:_},k)})})]})}function Oz({edge:t,targetUid:e,targetType:r,direction:a,canWrite:i,onDelete:s,expandAllActive:o,resolvedNode:u,resolveAllActive:f,edgeViews:d=[],nodeViews:h=[],config:p,groupEdgeView:g="",groupNodeView:y="",groupNodeVisible:b=!0}){const{drillIn:E}=Zd(),S=Mt.useUtils(),[T,C]=I.useState(!1),N=T||!!o,[j,M]=I.useState(!1),D=()=>{var ae,de;const ee=(de=(ae=p.viewDefaults)==null?void 0:ae.edges)==null?void 0:de[t.axbType];if(ee&&d.length>0){const le=Ja(ee,d,"inline");if(le!=="json"){const re=d.find(Z=>Z.viewName===le);if(re)return re.tagName}}return"json"},[A,B]=I.useState(D),R=()=>{var ae,de;const ee=(de=(ae=p.viewDefaults)==null?void 0:ae.nodes)==null?void 0:de[r];if(ee&&h.length>0){const le=Ja(ee,h,"inline");if(le!=="json"){const re=h.find(Z=>Z.viewName===le);if(re)return re.tagName}}return"json"},[L,_]=I.useState(R),P=(ee,ae,de)=>{if(!ee)return de;if(ee==="json")return"json";const le=ae.find(re=>re.viewName===ee);return le?le.tagName:de},q=P(g,d,A),F=B,Y=P(y,h,L),U=_,[z,H]=I.useState(void 0),[X,K]=I.useState(!1),k=Object.keys(t.data).length>0,G=z!==void 0?z:u,$=G!==void 0;I.useEffect(()=>{var ee,ae;if(f&&u!==void 0&&(M(!0),u)){const de=(ae=(ee=p.viewDefaults)==null?void 0:ee.nodes)==null?void 0:ae[r];if(de&&h.length>0){const le=Ja(de,h,"inline");if(le!=="json"){const re=h.find(Z=>Z.viewName===le);re&&U(re.tagName)}}}},[f,u]);const J=async()=>{var ee,ae;K(!0);try{const le=(await S.getNodesBatch.fetch({uids:[e]})).nodes[e]??null;if(H(le),M(!0),le){const re=(ae=(ee=p.viewDefaults)==null?void 0:ee.nodes)==null?void 0:ae[r];if(re&&h.length>0){const Z=Ja(re,h,"inline");if(Z!=="json"){const oe=h.find(ve=>ve.viewName===Z);oe&&U(oe.tagName)}}}}catch{}finally{K(!1)}},ne=()=>{E({uid:e,nodeType:r,edgeType:t.axbType,direction:a})};return m.jsxs("div",{className:"bg-slate-800/50 rounded-lg",children:[m.jsxs("div",{className:"flex items-center gap-3 px-3 py-2",children:[m.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono ${$t(r)}`,children:r}),m.jsx("button",{onClick:ne,className:"text-sm font-mono text-indigo-400 hover:text-indigo-300 transition-colors",title:"Dive into this node",children:e}),m.jsx(Ca,{to:`/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"}),m.jsx("button",{onClick:()=>C(!T),className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",children:N?"hide edge":"show edge"}),!$&&!X&&m.jsx("button",{onClick:J,className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",children:"resolve"}),X&&m.jsx("span",{className:"w-2.5 h-2.5 border border-slate-400 border-t-transparent rounded-full animate-spin"}),$&&m.jsx("button",{onClick:()=>M(!j),className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",children:j?"hide node":"show node"}),i&&m.jsx("button",{onClick:s,className:"ml-auto text-[10px] text-slate-600 hover:text-red-400 transition-colors",children:"delete"})]}),N&&m.jsxs("div",{className:"px-3 pb-2 space-y-2",children:[m.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:[m.jsx("span",{className:"text-slate-500",children:"aType"}),m.jsx("span",{className:"text-slate-300",children:t.aType}),m.jsx("span",{className:"text-slate-500",children:"aUid"}),m.jsx("span",{className:"text-slate-300",children:t.aUid}),m.jsx("span",{className:"text-slate-500",children:"axbType"}),m.jsx("span",{className:"text-slate-300",children:t.axbType}),m.jsx("span",{className:"text-slate-500",children:"bType"}),m.jsx("span",{className:"text-slate-300",children:t.bType}),m.jsx("span",{className:"text-slate-500",children:"bUid"}),m.jsx("span",{className:"text-slate-300",children:t.bUid}),m.jsx("span",{className:"text-slate-500",children:"createdAt"}),m.jsx("span",{className:"text-slate-300",children:to(t.createdAt)}),m.jsx("span",{className:"text-slate-500",children:"updatedAt"}),m.jsx("span",{className:"text-slate-300",children:to(t.updatedAt)})]}),k&&m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[m.jsx("span",{className:"text-[10px] text-slate-500 uppercase tracking-wider font-semibold",children:"Data"}),d.length>0&&m.jsx(Qu,{views:d,activeView:q,onSwitch:F})]}),q==="json"?m.jsx("div",{className:"font-mono text-[11px] leading-relaxed bg-slate-950 rounded p-2 overflow-auto max-h-40",children:m.jsx(Qa,{data:t.data,defaultExpanded:!0})}):m.jsx(Xi,{tagName:q,data:t.data,onError:()=>F("json")})]})]}),j&&$&&b&&m.jsx("div",{className:"px-3 pb-2",children:G===null?m.jsx("p",{className:"text-[11px] text-slate-500 italic",children:"Node not found"}):m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[m.jsx("span",{className:"text-[10px] text-slate-500 uppercase tracking-wider font-semibold",children:"Node Data"}),m.jsx("span",{className:"text-[10px] text-slate-600",children:to(G.updatedAt)}),h.length>0&&m.jsx(Qu,{views:h,activeView:Y,onSwitch:U})]}),Y==="json"?m.jsx("div",{className:"font-mono text-[11px] leading-relaxed bg-slate-950 rounded p-2 overflow-auto max-h-40",children:m.jsx(Qa,{data:G.data,defaultExpanded:!0})}):m.jsx(Xi,{tagName:Y,data:G.data,onError:()=>U("json")})]})})]})}function Mz(t){const e=t.data;switch(t.kind){case"node-detail":{const r=e.node;return r?`${r.type}:${r.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 Rz({artifact:t,viewRegistry:e,config:r,onNavigate:a}){switch(t.kind){case"node-detail":return m.jsx(kz,{data:t.data,viewRegistry:e,config:r,onNavigate:a});case"nodes-list":return m.jsx(Bz,{data:t.data,onNavigate:a});case"edges-list":return m.jsx(Lz,{data:t.data,onNavigate:a});case"traverse":return m.jsx(zz,{data:t.data,onNavigate:a});case"search":return m.jsx(_z,{data:t.data,onNavigate:a});case"schema":return m.jsx(Pz,{data:t.data});default:return m.jsx(Qa,{data:t.data??{},defaultExpanded:!0})}}function kz({data:t,viewRegistry:e,config:r,onNavigate:a}){const i=t.node;return i?m.jsxs("div",{className:"space-y-4",children:[m.jsxs("div",{className:"flex items-center gap-3",children:[m.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-mono ${$t(i.type)}`,children:i.type}),m.jsx("h1",{className:"text-xl font-bold font-mono",children:i.uid}),m.jsx("button",{onClick:()=>a(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"})]}),m.jsx(EN,{nodeType:i.type,data:i.data??{},viewRegistry:e,config:r})]}):m.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-8 text-center",children:[m.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Node Not Found"}),m.jsx("p",{className:"text-sm text-slate-400",children:"The queried node was not found."})]})}function Bz({data:t,onNavigate:e}){const r=t.nodes??[],a=t.hasMore;return m.jsxs("div",{className:"space-y-2",children:[r.map((i,s)=>m.jsxs("div",{className:"bg-slate-900 rounded-lg border border-slate-800 px-4 py-3",children:[m.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[m.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono ${$t(i.type)}`,children:i.type}),m.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&&m.jsx("div",{className:"mt-1",children:m.jsx(Qa,{data:i.data,defaultExpanded:!1})})]},s)),a&&m.jsx("p",{className:"text-[10px] text-slate-500 text-center py-1",children:"Results truncated — use a higher limit to see more"})]})}function Lz({data:t,onNavigate:e}){const r=t.edges??[],a=t.hasMore;return m.jsxs("div",{className:"space-y-1",children:[m.jsx(TN,{edges:r,onNavigate:e}),a&&m.jsx("p",{className:"text-[10px] text-slate-500 text-center py-1",children:"Results truncated — use a higher limit to see more"})]})}function zz({data:t,onNavigate:e}){const r=t.hops??[],a=t.totalReads;return m.jsxs("div",{className:"space-y-4",children:[r.map((i,s)=>m.jsxs(l0,{title:`Hop ${i.depth}: ${i.relation} (${i.direction})`,badge:`${i.edgeCount} edges`,children:[m.jsx(TN,{edges:i.edges,onNavigate:e}),i.truncated&&m.jsx("p",{className:"text-[10px] text-amber-500 mt-1",children:"Truncated — increase limit to see more"})]},s)),a!=null&&m.jsxs("p",{className:"text-[10px] text-slate-500 text-right",children:[a," total reads"]})]})}function _z({data:t,onNavigate:e}){const r=t.results??[];return r.length===0?m.jsx("p",{className:"text-slate-400 text-sm",children:"No results found"}):m.jsx("div",{className:"space-y-2",children:r.map((a,i)=>m.jsxs("div",{className:"bg-slate-900 rounded-lg border border-slate-800 px-4 py-3",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono ${$t(a.type)}`,children:a.type}),m.jsx("button",{onClick:()=>e(a.uid),className:"font-mono text-xs text-indigo-400 hover:text-indigo-300 transition-colors",children:a.uid}),a.matchType&&m.jsx("span",{className:"text-[9px] text-slate-500 ml-auto",children:a.matchType})]}),a.data&&Object.keys(a.data).length>0&&m.jsx("div",{className:"mt-1",children:m.jsx(Qa,{data:a.data,defaultExpanded:!1})})]},i))})}function Pz({data:t}){const e=t.nodeTypes??[],r=t.edgeTypes??[];return m.jsxs("div",{className:"space-y-4",children:[m.jsx(l0,{title:`Node Types (${e.length})`,children:m.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.map(a=>m.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-mono ${$t(a)}`,children:a},a))})}),m.jsx(l0,{title:`Edge Types (${r.length})`,children:m.jsx("div",{className:"space-y-1",children:r.map((a,i)=>m.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-mono",children:[m.jsx("span",{className:`px-1 py-0.5 rounded text-[10px] ${$t(a.from)}`,children:a.from}),m.jsx("span",{className:"text-slate-500",children:"--["}),m.jsx("span",{className:"text-indigo-400",children:a.relation}),m.jsx("span",{className:"text-slate-500",children:"]-->"}),m.jsx("span",{className:`px-1 py-0.5 rounded text-[10px] ${$t(a.to)}`,children:a.to}),a.inverseLabel&&m.jsxs("span",{className:"text-[10px] text-slate-600 ml-1",children:["(",a.inverseLabel,")"]})]},i))})})]})}function l0({title:t,badge:e,trailing:r,children:a}){return m.jsxs("section",{className:"bg-slate-900 rounded-xl border border-slate-800 p-4",children:[m.jsxs("div",{className:"flex items-center justify-between mb-3",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("h3",{className:"text-sm font-semibold text-slate-200",children:t}),e&&m.jsx("span",{className:"text-[10px] text-slate-500",children:e})]}),r]}),a]})}function TN({edges:t,onNavigate:e}){const[r,a]=I.useState(new Set);return m.jsx("div",{className:"space-y-0.5",children:t.map((i,s)=>m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-1.5 py-1.5 text-xs",children:[m.jsx("span",{className:`px-1 py-0.5 rounded text-[10px] font-mono ${$t(i.fromType)}`,children:i.fromType}),m.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}),m.jsx("span",{className:"text-slate-500 shrink-0",children:"--["}),m.jsx("span",{className:"text-indigo-400 shrink-0",children:i.relation}),m.jsx("span",{className:"text-slate-500 shrink-0",children:"]-->"}),m.jsx("span",{className:`px-1 py-0.5 rounded text-[10px] font-mono ${$t(i.toType)}`,children:i.toType}),m.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&&m.jsx("button",{onClick:()=>{a(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:r.has(s)?"hide":"data"})]}),r.has(s)&&i.data&&m.jsx("div",{className:"ml-4 mb-1",children:m.jsx(Qa,{data:i.data,defaultExpanded:!0})})]},s))})}function Uz({schema:t,viewRegistry:e,config:r}){const{messages:a,status:i,isStreaming:s,sendMessage:o,clearHistory:u,chatEnabled:f}=dM(),{mode:d,expand:h,collapse:p}=gM(),{activeArtifact:g,showArtifact:y,dismissArtifact:b}=vM(),E=jo(),S=as(),[T,C]=I.useState(""),N=I.useRef(null),j=I.useRef(null),M=I.useRef(null),D=I.useRef(null),A=I.useRef(typeof window<"u"&&("ontouchstart"in window||navigator.maxTouchPoints>0)),B=g!==null;I.useEffect(()=>{var z;(z=N.current)==null||z.scrollIntoView({behavior:"smooth"})},[a]),I.useEffect(()=>{const z=j.current;z&&(z.style.height="auto",z.style.height=Math.min(z.scrollHeight,120)+"px")},[T]),I.useEffect(()=>{d==="expanded"&&setTimeout(()=>{var z;return(z=j.current)==null?void 0:z.focus()},100)},[d]),I.useEffect(()=>{if(!f)return;const z=H=>{const X=H.target.tagName,K=H.target===j.current;if((H.metaKey||H.ctrlKey)&&H.key==="k"){H.preventDefault(),d==="collapsed"?h():p();return}H.key==="Escape"&&d==="expanded"&&(K||X!=="INPUT"&&X!=="TEXTAREA"&&X!=="SELECT")&&(B?b():p())};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[f,d,h,p,B,b]);const R=I.useCallback(()=>{A.current||d!=="collapsed"||(M.current=window.setTimeout(()=>{h()},200))},[d,h]),L=I.useCallback(()=>{M.current!==null&&(clearTimeout(M.current),M.current=null)},[]),_=I.useCallback(()=>{s||A.current||(D.current=window.setTimeout(()=>{p()},300))},[s,p]),P=I.useCallback(()=>{D.current!==null&&(clearTimeout(D.current),D.current=null)},[]),q=I.useCallback(()=>{const z=T.trim();if(!z||s||i!=="connected")return;const H=mM(E,t);o(z,H),C("")},[T,s,i,E,t,o]),F=z=>{z.key==="Enter"&&!z.shiftKey&&(z.preventDefault(),q())},Y=I.useCallback(z=>{y(z)},[y]),U=I.useCallback(z=>{b(),p(),S(`/node/${encodeURIComponent(z)}`)},[b,p,S]);return f?d==="collapsed"?m.jsx("div",{className:"fixed bottom-0 left-0 right-0 z-50 flex justify-center pointer-events-none",style:{height:40},children:m.jsx("div",{className:"pointer-events-auto cursor-pointer flex items-end pb-3",style:{width:160},onMouseEnter:R,onMouseLeave:L,onClick:()=>{L(),h()},children:m.jsx("div",{className:"chat-breathe-line w-full h-[2px] bg-emerald-400 rounded-full",style:{animation:"chat-breathe 3s ease-in-out infinite"}})})}):m.jsxs("div",{className:"fixed inset-0 z-50 flex",style:{animation:"chat-overlay-in 0.2s ease-out"},onMouseEnter:P,onMouseLeave:_,children:[m.jsx("div",{className:"absolute inset-0 bg-slate-950/90 backdrop-blur-md",onClick:()=>{B?b():p()}}),m.jsxs("div",{className:"relative flex w-full h-full",children:[m.jsxs("div",{className:`flex flex-col h-full transition-all duration-300 ease-out ${B?"w-[420px] shrink-0 border-r border-slate-800":"w-full max-w-[700px] mx-auto"}`,children:[m.jsxs("div",{className:"shrink-0 border-b border-slate-800 px-5 py-3 flex items-center justify-between",children:[m.jsxs("div",{className:"flex items-center gap-3",children:[m.jsx("span",{className:`w-2 h-2 rounded-full ${i==="connected"?"bg-emerald-500":i==="checking"?"bg-amber-500 animate-pulse":"bg-slate-600"}`}),m.jsx("span",{className:"text-xs text-slate-400 font-medium",children:i==="connected"?"Connected":i==="checking"?"Checking...":"Offline"})]}),m.jsxs("div",{className:"flex items-center gap-2",children:[a.length>0&&m.jsx("button",{onClick:u,className:"text-[11px] text-slate-600 hover:text-slate-400 transition-colors px-2 py-1",children:"Clear"}),m.jsx("button",{onClick:p,className:"p-1.5 text-slate-500 hover:text-slate-200 transition-colors",title:"Close (Esc)",children:m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:m.jsx("path",{d:"M1 1l12 12M13 1L1 13"})})})]})]}),m.jsxs("div",{className:"flex-1 overflow-auto px-5 py-6 space-y-4",children:[a.length===0&&m.jsx("div",{className:"text-center text-slate-600 text-sm mt-12",children:i==="connected"?m.jsx("p",{children:"Ask a question about your graph data."}):m.jsx("p",{children:"Waiting for chat service to connect..."})}),a.map(z=>m.jsx(qz,{message:z,activeArtifactId:(g==null?void 0:g.id)??null,onArtifactClick:Y},z.id)),m.jsx("div",{ref:N})]}),m.jsx("div",{className:"px-5 py-1 shrink-0",children:m.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"})}),m.jsx("div",{className:"px-5 pb-5 shrink-0",children:m.jsxs("div",{className:"flex gap-3 items-end",children:[m.jsx("textarea",{ref:j,value:T,onChange:z=>C(z.target.value),onKeyDown:F,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"}),m.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?m.jsx("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin inline-block"}):m.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:m.jsx("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})})})]})})]}),B&&m.jsxs("div",{className:"flex-1 flex flex-col h-full overflow-hidden animate-[slide-in-right_0.2s_ease-out]",children:[m.jsxs("div",{className:"shrink-0 border-b border-slate-800 px-5 py-3 flex items-center justify-between",children:[m.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[m.jsx("span",{className:"text-sm font-semibold text-slate-200 shrink-0",children:Mz(g)}),m.jsx("span",{className:"text-[10px] text-slate-500 font-mono truncate",children:g.command.replace(/^npx\s+firegraph\s+/,"")})]}),m.jsx("button",{onClick:b,className:"p-1.5 text-slate-400 hover:text-slate-200 transition-colors shrink-0 ml-3",title:"Close artifact",children:m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:m.jsx("path",{d:"M1 1l12 12M13 1L1 13"})})})]}),m.jsx("div",{className:"flex-1 overflow-auto p-5",children:m.jsx(Rz,{artifact:g,viewRegistry:e,config:r,onNavigate:U},g.id)})]})]})]}):null}function qz({message:t,activeArtifactId:e,onArtifactClick:r}){var a;return t.role==="user"?m.jsx("div",{className:"flex justify-end",children:m.jsx("div",{className:"bg-indigo-600/20 border border-indigo-500/20 rounded-xl px-4 py-3 max-w-[80%]",children:m.jsx("p",{className:"text-sm text-slate-200 whitespace-pre-wrap break-words",children:t.content})})}):t.role==="error"?m.jsx("div",{className:"flex justify-start",children:m.jsx("div",{className:"bg-red-500/10 border border-red-500/20 rounded-xl px-4 py-3 max-w-[80%]",children:m.jsx("p",{className:"text-sm text-red-400 whitespace-pre-wrap break-words",children:t.content})})}):m.jsxs("div",{className:"flex flex-col gap-2 items-start",children:[(t.content||t.streaming)&&m.jsx("div",{className:"bg-slate-800/40 border border-slate-700/40 rounded-xl px-4 py-3 max-w-[85%]",children:m.jsxs("pre",{className:"text-sm text-slate-300 whitespace-pre-wrap break-words font-sans leading-relaxed",children:[t.content,t.streaming&&!t.activeToolCall&&m.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&&m.jsx("div",{className:"bg-slate-800/40 border border-amber-500/20 rounded-xl px-4 py-3 max-w-[85%]",children:m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"w-3 h-3 border-2 border-amber-400 border-t-transparent rounded-full animate-spin shrink-0"}),m.jsx("span",{className:"text-xs text-amber-400 font-mono truncate",children:t.activeToolCall.replace(/^npx\s+firegraph\s+/,"")})]})}),(a=t.artifacts)==null?void 0:a.map(i=>{const{icon:s,label:o,detail:u}=yM(i),f=e===i.id;return m.jsx("button",{onClick:()=>r(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
|
+
${f?"border-indigo-500/60 ring-1 ring-indigo-500/30":"border-slate-700/50"}`,children:m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"text-indigo-400 text-sm shrink-0",children:s}),m.jsx("span",{className:"text-sm font-medium text-slate-200 truncate",children:o}),m.jsx("span",{className:"text-xs text-slate-500 ml-auto shrink-0",children:u})]})},i.id)})]})}function Iz({schema:t,config:e,viewRegistry:r,warnings:a=[],children:i}){const s=r??{nodes:{},edges:{},hasViews:!1};return m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"flex h-screen overflow-hidden",children:[m.jsx(iM,{schema:t,config:e,viewRegistry:r}),m.jsxs("main",{className:"flex-1 overflow-auto relative",children:[m.jsx(sM,{warnings:a}),i]})]}),m.jsx(Uz,{schema:t,viewRegistry:s,config:e})]})}function Vz({schema:t,config:e}){return m.jsxs("div",{className:"p-6 max-w-6xl mx-auto",children:[m.jsxs("div",{className:"mb-8",children:[m.jsx("h1",{className:"text-2xl font-bold mb-1",children:"Graph Overview"}),m.jsxs("p",{className:"text-sm text-slate-400",children:[m.jsx("span",{className:"font-mono",children:e.projectId})," / ",m.jsx("span",{className:"font-mono",children:e.collection})]})]}),m.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[m.jsxs("div",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[m.jsx("h2",{className:"text-sm font-semibold mb-4",children:"Node Types"}),m.jsxs("div",{className:"space-y-2",children:[t.nodeTypes.map(r=>m.jsxs(Ca,{to:`/browse/${encodeURIComponent(r.type)}`,className:"flex items-center gap-3 p-3 bg-slate-800/50 rounded-lg hover:bg-slate-800 transition-colors group",children:[m.jsx("div",{className:`w-3 h-3 rounded-full ${wT(r.type)}`}),m.jsxs("div",{children:[m.jsx("span",{className:"text-sm font-medium group-hover:text-indigo-400 transition-colors",children:r.type}),r.description&&m.jsx("p",{className:"text-[10px] text-slate-500 mt-0.5",children:r.description})]})]},r.type)),t.nodeTypes.length===0&&m.jsx("p",{className:"text-sm text-slate-500 text-center py-4",children:"No node types registered"})]})]}),m.jsxs("div",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[m.jsx("h2",{className:"text-sm font-semibold mb-4",children:"Relationships"}),m.jsxs("div",{className:"space-y-2",children:[t.edgeTypes.map(r=>{const a=`${r.aType}:${r.axbType}:${r.bType}`;return m.jsxs("div",{className:"p-3 bg-slate-800/50 rounded-lg",children:[m.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[m.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-mono ${$t(r.aType)}`,children:r.aType}),m.jsxs("span",{className:"text-indigo-400 text-xs",children:["—",r.axbType,"→"]}),m.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-mono ${$t(r.bType)}`,children:r.bType})]}),r.description&&m.jsx("p",{className:"text-[10px] text-slate-500 mt-1.5 ml-1",children:r.description})]},a)}),t.edgeTypes.length===0&&m.jsx("p",{className:"text-sm text-slate-500 text-center py-4",children:"No edge types registered"})]})]})]}),m.jsxs("div",{className:"mt-6 bg-slate-900 rounded-xl border border-slate-800 p-5",children:[m.jsx("div",{className:"flex items-center justify-between mb-3",children:m.jsx("h2",{className:"text-sm font-semibold",children:"Quick Actions"})}),m.jsxs("div",{className:"flex gap-3",children:[m.jsxs(Ca,{to:"/traverse",className:"flex items-center gap-2 px-4 py-2 bg-indigo-600/20 text-indigo-400 rounded-lg text-sm hover:bg-indigo-600/30 transition-colors",children:[m.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"Build Traversal"]}),t.nodeTypes.length>0&&m.jsxs(Ca,{to:`/browse/${encodeURIComponent(t.nodeTypes[0].type)}`,className:"flex items-center gap-2 px-4 py-2 bg-slate-800 text-slate-300 rounded-lg text-sm hover:bg-slate-700 transition-colors",children:["Browse ",t.nodeTypes[0].type," nodes"]})]})]})]})}function Fz({schema:t,viewRegistry:e,config:r,onDataChanged:a}){const{type:i}=ME(),s=as(),[o,u]=I.useState(!1),f=!t.readonly;return m.jsxs("div",{className:"p-6 max-w-6xl mx-auto",children:[m.jsxs("div",{className:"mb-4",children:[m.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[m.jsx("h1",{className:"text-xl font-bold",children:i}),m.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-mono ${$t(i)}`,children:"node"}),f&&!o&&m.jsxs("button",{onClick:()=>u(!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:[m.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"Create ",i]})]}),m.jsxs("p",{className:"text-sm text-slate-400",children:["Browse all ",m.jsx("strong",{children:i})," nodes"]})]}),o&&m.jsx("div",{className:"mb-6",children:m.jsx(wN,{schema:t,defaultType:i,onSaved:d=>{u(!1),a==null||a(),s(`/node/${encodeURIComponent(d)}`)},onCancel:()=>u(!1)})}),i&&m.jsx(SN,{type:i,schema:t,viewRegistry:e,config:r})]})}function Hz({viewRegistry:t,schema:e}){if(!t||!t.hasViews)return m.jsxs("div",{className:"p-6 max-w-6xl mx-auto",children:[m.jsx("h1",{className:"text-xl font-bold mb-2",children:"Views"}),m.jsxs("p",{className:"text-sm text-slate-400",children:["No views configured. Use ",m.jsx("code",{className:"text-slate-300",children:"--views <path>"})," to load a views file."]})]});const r=Object.entries(t.nodes).filter(([,i])=>i.views.length>0),a=Object.entries(t.edges).filter(([,i])=>i.views.length>0);return m.jsxs("div",{className:"p-6 max-w-6xl mx-auto",children:[m.jsxs("div",{className:"mb-6",children:[m.jsx("h1",{className:"text-xl font-bold mb-1",children:"View Gallery"}),m.jsx("p",{className:"text-sm text-slate-400",children:"Preview all registered views with sample data"})]}),r.length>0&&m.jsxs("section",{className:"mb-8",children:[m.jsx("h2",{className:"text-sm font-semibold mb-4 uppercase tracking-wider text-slate-500",children:"Node Views"}),m.jsx("div",{className:"space-y-6",children:r.map(([i,s])=>m.jsx(lE,{entityType:i,meta:s,kind:"node"},i))})]}),a.length>0&&m.jsxs("section",{children:[m.jsx("h2",{className:"text-sm font-semibold mb-4 uppercase tracking-wider text-slate-500",children:"Edge Views"}),m.jsx("div",{className:"space-y-6",children:a.map(([i,s])=>m.jsx(lE,{entityType:i,meta:s,kind:"edge"},i))})]})]})}function lE({entityType:t,meta:e,kind:r}){const a=e.sampleData??{},[i,s]=I.useState(JSON.stringify(a,null,2)),[o,u]=I.useState(a),[f,d]=I.useState(null),[h,p]=I.useState(!1),g=y=>{s(y);try{const b=JSON.parse(y);u(b),d(null)}catch{d("Invalid JSON")}};return m.jsxs("div",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[m.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[m.jsx("span",{className:"px-2 py-0.5 rounded text-xs font-mono bg-indigo-500/15 text-indigo-400",children:r}),m.jsx("h3",{className:"text-sm font-semibold",children:t}),m.jsxs("span",{className:"text-slate-500 text-xs",children:["(",e.views.length," view",e.views.length!==1?"s":"",")"]}),m.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&&m.jsxs("div",{className:"mb-4",children:[m.jsx("label",{className:"block text-xs text-slate-500 mb-1",children:"Sample Data (JSON)"}),m.jsx("textarea",{value:i,onChange:y=>g(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"}),f&&m.jsx("p",{className:"text-xs text-red-400 mt-1",children:f})]}),m.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=>m.jsxs("div",{className:"bg-slate-950 rounded-lg p-4",children:[m.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[m.jsx("span",{className:"text-xs font-semibold text-slate-300",children:y.viewName}),y.description&&m.jsx("span",{className:"text-[10px] text-slate-500",children:y.description}),m.jsxs("span",{className:"ml-auto text-[10px] text-slate-600 font-mono",children:["<",y.tagName,">"]})]}),m.jsx(Xi,{tagName:y.tagName,data:o})]},y.tagName))})]})}function Gz(){const{data:t,error:e,isLoading:r}=Mt.getSchema.useQuery(),{data:a,error:i,isLoading:s}=Mt.getConfig.useQuery(),{data:o,error:u,isLoading:f}=Mt.getViews.useQuery(),{data:d}=Mt.getWarnings.useQuery(),h=r||s||f,p=e||i||u,g=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(),g.current++;const S=document.createElement("script");return S.type="module",S.src=`/api/views/dynamic-bundle?v=${g.current}`,S.setAttribute("data-dynamic-views","true"),document.head.appendChild(S),()=>{S.remove()}},[t,o]),h)return m.jsx("div",{className:"flex items-center justify-center h-screen",children:m.jsxs("div",{className:"text-center",children:[m.jsx("div",{className:"w-8 h-8 border-2 border-indigo-500 border-t-transparent rounded-full animate-spin mx-auto mb-4"}),m.jsx("p",{className:"text-slate-400",children:"Connecting to Firestore..."})]})});if(p)return m.jsx("div",{className:"flex items-center justify-center h-screen",children:m.jsxs("div",{className:"bg-slate-900 border border-red-500/30 rounded-xl p-8 max-w-lg",children:[m.jsx("h2",{className:"text-red-400 text-lg font-semibold mb-2",children:"Connection Error"}),m.jsx("p",{className:"text-slate-300 text-sm mb-4",children:p.message}),m.jsxs("p",{className:"text-slate-500 text-xs mb-4",children:["Make sure you have ADC configured (run ",m.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."]}),m.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 b=o??{nodes:{},edges:{},hasViews:!1};return m.jsx(eM,{children:m.jsx(fM,{chatEnabled:(a==null?void 0:a.chatEnabled)??!1,children:m.jsx(hM,{children:m.jsx(pM,{children:m.jsx(Iz,{schema:t,config:a,viewRegistry:b,warnings:(d==null?void 0:d.warnings)??[],children:m.jsxs(Lj,{children:[m.jsx(Xl,{path:"/",element:m.jsx(Vz,{schema:t,config:a})}),m.jsx(Xl,{path:"/browse/:type",element:m.jsx(Fz,{schema:t,viewRegistry:b,config:a})}),m.jsx(Xl,{path:"/node/:uid",element:m.jsx(Az,{schema:t,viewRegistry:b,config:a})}),m.jsx(Xl,{path:"/traverse",element:m.jsx(uz,{schema:t})}),m.jsx(Xl,{path:"/views",element:m.jsx(Hz,{viewRegistry:b,schema:t})})]})})})})})})}function Qz(){const[t]=I.useState(()=>new mD({defaultOptions:{queries:{staleTime:3e4,refetchOnWindowFocus:!1}}})),[e]=I.useState(()=>Mt.createClient({links:[vO({url:"/api/trpc"})]}));return m.jsx(Mt.Provider,{client:e,queryClient:t,children:m.jsx(yD,{client:t,children:m.jsx(Vj,{children:m.jsx(Gz,{})})})})}FA.createRoot(document.getElementById("root")).render(m.jsx(wE.StrictMode,{children:m.jsx(Qz,{})}));
|