modscape 1.3.0 → 2.0.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.
@@ -0,0 +1,432 @@
1
+ (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const s of a.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&n(s)}).observe(document,{childList:!0,subtree:!0});function r(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function n(i){if(i.ep)return;i.ep=!0;const a=r(i);fetch(i.href,a)}})();var Kd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ST(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var cy={exports:{}},Xc={};var YR;function EU(){if(YR)return Xc;YR=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function r(n,i,a){var s=null;if(a!==void 0&&(s=""+a),i.key!==void 0&&(s=""+i.key),"key"in i){a={};for(var l in i)l!=="key"&&(a[l]=i[l])}else a=i;return i=a.ref,{$$typeof:t,type:n,key:s,ref:i!==void 0?i:null,props:a}}return Xc.Fragment=e,Xc.jsx=r,Xc.jsxs=r,Xc}var XR;function AU(){return XR||(XR=1,cy.exports=EU()),cy.exports}var A=AU(),fy={exports:{}},mt={};var WR;function OU(){if(WR)return mt;WR=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),s=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),o=Symbol.for("react.suspense"),c=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),d=Symbol.for("react.activity"),g=Symbol.iterator;function m(I){return I===null||typeof I!="object"?null:(I=g&&I[g]||I["@@iterator"],typeof I=="function"?I:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,x={};function w(I,G,re){this.props=I,this.context=G,this.refs=x,this.updater=re||y}w.prototype.isReactComponent={},w.prototype.setState=function(I,G){if(typeof I!="object"&&typeof I!="function"&&I!=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,I,G,"setState")},w.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function S(){}S.prototype=w.prototype;function k(I,G,re){this.props=I,this.context=G,this.refs=x,this.updater=re||y}var E=k.prototype=new S;E.constructor=k,b(E,w.prototype),E.isPureReactComponent=!0;var M=Array.isArray;function R(){}var O={H:null,A:null,T:null,S:null},N=Object.prototype.hasOwnProperty;function B(I,G,re){var Y=re.ref;return{$$typeof:t,type:I,key:G,ref:Y!==void 0?Y:null,props:re}}function D(I,G){return B(I.type,G,I.props)}function _(I){return typeof I=="object"&&I!==null&&I.$$typeof===t}function P(I){var G={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(re){return G[re]})}var z=/\/+/g;function H(I,G){return typeof I=="object"&&I!==null&&I.key!=null?P(""+I.key):G.toString(36)}function $(I){switch(I.status){case"fulfilled":return I.value;case"rejected":throw I.reason;default:switch(typeof I.status=="string"?I.then(R,R):(I.status="pending",I.then(function(G){I.status==="pending"&&(I.status="fulfilled",I.value=G)},function(G){I.status==="pending"&&(I.status="rejected",I.reason=G)})),I.status){case"fulfilled":return I.value;case"rejected":throw I.reason}}throw I}function q(I,G,re,Y,W){var Z=typeof I;(Z==="undefined"||Z==="boolean")&&(I=null);var ie=!1;if(I===null)ie=!0;else switch(Z){case"bigint":case"string":case"number":ie=!0;break;case"object":switch(I.$$typeof){case t:case e:ie=!0;break;case h:return ie=I._init,q(ie(I._payload),G,re,Y,W)}}if(ie)return W=W(I),ie=Y===""?"."+H(I,0):Y,M(W)?(re="",ie!=null&&(re=ie.replace(z,"$&/")+"/"),q(W,G,re,"",function(se){return se})):W!=null&&(_(W)&&(W=D(W,re+(W.key==null||I&&I.key===W.key?"":(""+W.key).replace(z,"$&/")+"/")+ie)),G.push(W)),1;ie=0;var we=Y===""?".":Y+":";if(M(I))for(var de=0;de<I.length;de++)Y=I[de],Z=we+H(Y,de),ie+=q(Y,G,re,Z,W);else if(de=m(I),typeof de=="function")for(I=de.call(I),de=0;!(Y=I.next()).done;)Y=Y.value,Z=we+H(Y,de++),ie+=q(Y,G,re,Z,W);else if(Z==="object"){if(typeof I.then=="function")return q($(I),G,re,Y,W);throw G=String(I),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(I).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.")}return ie}function V(I,G,re){if(I==null)return I;var Y=[],W=0;return q(I,Y,"","",function(Z){return G.call(re,Z,W++)}),Y}function X(I){if(I._status===-1){var G=I._result;G=G(),G.then(function(re){(I._status===0||I._status===-1)&&(I._status=1,I._result=re)},function(re){(I._status===0||I._status===-1)&&(I._status=2,I._result=re)}),I._status===-1&&(I._status=0,I._result=G)}if(I._status===1)return I._result.default;throw I._result}var ee=typeof reportError=="function"?reportError:function(I){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var G=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof I=="object"&&I!==null&&typeof I.message=="string"?String(I.message):String(I),error:I});if(!window.dispatchEvent(G))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",I);return}console.error(I)},te={map:V,forEach:function(I,G,re){V(I,function(){G.apply(this,arguments)},re)},count:function(I){var G=0;return V(I,function(){G++}),G},toArray:function(I){return V(I,function(G){return G})||[]},only:function(I){if(!_(I))throw Error("React.Children.only expected to receive a single React element child.");return I}};return mt.Activity=d,mt.Children=te,mt.Component=w,mt.Fragment=r,mt.Profiler=i,mt.PureComponent=k,mt.StrictMode=n,mt.Suspense=o,mt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,mt.__COMPILER_RUNTIME={__proto__:null,c:function(I){return O.H.useMemoCache(I)}},mt.cache=function(I){return function(){return I.apply(null,arguments)}},mt.cacheSignal=function(){return null},mt.cloneElement=function(I,G,re){if(I==null)throw Error("The argument must be a React element, but you passed "+I+".");var Y=b({},I.props),W=I.key;if(G!=null)for(Z in G.key!==void 0&&(W=""+G.key),G)!N.call(G,Z)||Z==="key"||Z==="__self"||Z==="__source"||Z==="ref"&&G.ref===void 0||(Y[Z]=G[Z]);var Z=arguments.length-2;if(Z===1)Y.children=re;else if(1<Z){for(var ie=Array(Z),we=0;we<Z;we++)ie[we]=arguments[we+2];Y.children=ie}return B(I.type,W,Y)},mt.createContext=function(I){return I={$$typeof:s,_currentValue:I,_currentValue2:I,_threadCount:0,Provider:null,Consumer:null},I.Provider=I,I.Consumer={$$typeof:a,_context:I},I},mt.createElement=function(I,G,re){var Y,W={},Z=null;if(G!=null)for(Y in G.key!==void 0&&(Z=""+G.key),G)N.call(G,Y)&&Y!=="key"&&Y!=="__self"&&Y!=="__source"&&(W[Y]=G[Y]);var ie=arguments.length-2;if(ie===1)W.children=re;else if(1<ie){for(var we=Array(ie),de=0;de<ie;de++)we[de]=arguments[de+2];W.children=we}if(I&&I.defaultProps)for(Y in ie=I.defaultProps,ie)W[Y]===void 0&&(W[Y]=ie[Y]);return B(I,Z,W)},mt.createRef=function(){return{current:null}},mt.forwardRef=function(I){return{$$typeof:l,render:I}},mt.isValidElement=_,mt.lazy=function(I){return{$$typeof:h,_payload:{_status:-1,_result:I},_init:X}},mt.memo=function(I,G){return{$$typeof:c,type:I,compare:G===void 0?null:G}},mt.startTransition=function(I){var G=O.T,re={};O.T=re;try{var Y=I(),W=O.S;W!==null&&W(re,Y),typeof Y=="object"&&Y!==null&&typeof Y.then=="function"&&Y.then(R,ee)}catch(Z){ee(Z)}finally{G!==null&&re.types!==null&&(G.types=re.types),O.T=G}},mt.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},mt.use=function(I){return O.H.use(I)},mt.useActionState=function(I,G,re){return O.H.useActionState(I,G,re)},mt.useCallback=function(I,G){return O.H.useCallback(I,G)},mt.useContext=function(I){return O.H.useContext(I)},mt.useDebugValue=function(){},mt.useDeferredValue=function(I,G){return O.H.useDeferredValue(I,G)},mt.useEffect=function(I,G){return O.H.useEffect(I,G)},mt.useEffectEvent=function(I){return O.H.useEffectEvent(I)},mt.useId=function(){return O.H.useId()},mt.useImperativeHandle=function(I,G,re){return O.H.useImperativeHandle(I,G,re)},mt.useInsertionEffect=function(I,G){return O.H.useInsertionEffect(I,G)},mt.useLayoutEffect=function(I,G){return O.H.useLayoutEffect(I,G)},mt.useMemo=function(I,G){return O.H.useMemo(I,G)},mt.useOptimistic=function(I,G){return O.H.useOptimistic(I,G)},mt.useReducer=function(I,G,re){return O.H.useReducer(I,G,re)},mt.useRef=function(I){return O.H.useRef(I)},mt.useState=function(I){return O.H.useState(I)},mt.useSyncExternalStore=function(I,G,re){return O.H.useSyncExternalStore(I,G,re)},mt.useTransition=function(){return O.H.useTransition()},mt.version="19.2.4",mt}var QR;function CT(){return QR||(QR=1,fy.exports=OU()),fy.exports}var ve=CT();const uf=ST(ve);var hy={exports:{}},Wc={},dy={exports:{}},py={};var KR;function MU(){return KR||(KR=1,(function(t){function e(q,V){var X=q.length;q.push(V);e:for(;0<X;){var ee=X-1>>>1,te=q[ee];if(0<i(te,V))q[ee]=V,q[X]=te,X=ee;else break e}}function r(q){return q.length===0?null:q[0]}function n(q){if(q.length===0)return null;var V=q[0],X=q.pop();if(X!==V){q[0]=X;e:for(var ee=0,te=q.length,I=te>>>1;ee<I;){var G=2*(ee+1)-1,re=q[G],Y=G+1,W=q[Y];if(0>i(re,X))Y<te&&0>i(W,re)?(q[ee]=W,q[Y]=X,ee=Y):(q[ee]=re,q[G]=X,ee=G);else if(Y<te&&0>i(W,X))q[ee]=W,q[Y]=X,ee=Y;else break e}}return V}function i(q,V){var X=q.sortIndex-V.sortIndex;return X!==0?X:q.id-V.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;t.unstable_now=function(){return a.now()}}else{var s=Date,l=s.now();t.unstable_now=function(){return s.now()-l}}var o=[],c=[],h=1,d=null,g=3,m=!1,y=!1,b=!1,x=!1,w=typeof setTimeout=="function"?setTimeout:null,S=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function E(q){for(var V=r(c);V!==null;){if(V.callback===null)n(c);else if(V.startTime<=q)n(c),V.sortIndex=V.expirationTime,e(o,V);else break;V=r(c)}}function M(q){if(b=!1,E(q),!y)if(r(o)!==null)y=!0,R||(R=!0,P());else{var V=r(c);V!==null&&$(M,V.startTime-q)}}var R=!1,O=-1,N=5,B=-1;function D(){return x?!0:!(t.unstable_now()-B<N)}function _(){if(x=!1,R){var q=t.unstable_now();B=q;var V=!0;try{e:{y=!1,b&&(b=!1,S(O),O=-1),m=!0;var X=g;try{t:{for(E(q),d=r(o);d!==null&&!(d.expirationTime>q&&D());){var ee=d.callback;if(typeof ee=="function"){d.callback=null,g=d.priorityLevel;var te=ee(d.expirationTime<=q);if(q=t.unstable_now(),typeof te=="function"){d.callback=te,E(q),V=!0;break t}d===r(o)&&n(o),E(q)}else n(o);d=r(o)}if(d!==null)V=!0;else{var I=r(c);I!==null&&$(M,I.startTime-q),V=!1}}break e}finally{d=null,g=X,m=!1}V=void 0}}finally{V?P():R=!1}}}var P;if(typeof k=="function")P=function(){k(_)};else if(typeof MessageChannel<"u"){var z=new MessageChannel,H=z.port2;z.port1.onmessage=_,P=function(){H.postMessage(null)}}else P=function(){w(_,0)};function $(q,V){O=w(function(){q(t.unstable_now())},V)}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(q){q.callback=null},t.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):N=0<q?Math.floor(1e3/q):5},t.unstable_getCurrentPriorityLevel=function(){return g},t.unstable_next=function(q){switch(g){case 1:case 2:case 3:var V=3;break;default:V=g}var X=g;g=V;try{return q()}finally{g=X}},t.unstable_requestPaint=function(){x=!0},t.unstable_runWithPriority=function(q,V){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var X=g;g=q;try{return V()}finally{g=X}},t.unstable_scheduleCallback=function(q,V,X){var ee=t.unstable_now();switch(typeof X=="object"&&X!==null?(X=X.delay,X=typeof X=="number"&&0<X?ee+X:ee):X=ee,q){case 1:var te=-1;break;case 2:te=250;break;case 5:te=1073741823;break;case 4:te=1e4;break;default:te=5e3}return te=X+te,q={id:h++,callback:V,priorityLevel:q,startTime:X,expirationTime:te,sortIndex:-1},X>ee?(q.sortIndex=X,e(c,q),r(o)===null&&q===r(c)&&(b?(S(O),O=-1):b=!0,$(M,X-ee))):(q.sortIndex=te,e(o,q),y||m||(y=!0,R||(R=!0,P()))),q},t.unstable_shouldYield=D,t.unstable_wrapCallback=function(q){var V=g;return function(){var X=g;g=V;try{return q.apply(this,arguments)}finally{g=X}}}})(py)),py}var ZR;function RU(){return ZR||(ZR=1,dy.exports=MU()),dy.exports}var gy={exports:{}},gn={};var JR;function DU(){if(JR)return gn;JR=1;var t=CT();function e(o){var c="https://react.dev/errors/"+o;if(1<arguments.length){c+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)c+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+o+"; visit "+c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var n={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 a(o,c,h){var d=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:d==null?null:""+d,children:o,containerInfo:c,implementation:h}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(o,c){if(o==="font")return"";if(typeof c=="string")return c==="use-credentials"?c:""}return gn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,gn.createPortal=function(o,c){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!c||c.nodeType!==1&&c.nodeType!==9&&c.nodeType!==11)throw Error(e(299));return a(o,c,null,h)},gn.flushSync=function(o){var c=s.T,h=n.p;try{if(s.T=null,n.p=2,o)return o()}finally{s.T=c,n.p=h,n.d.f()}},gn.preconnect=function(o,c){typeof o=="string"&&(c?(c=c.crossOrigin,c=typeof c=="string"?c==="use-credentials"?c:"":void 0):c=null,n.d.C(o,c))},gn.prefetchDNS=function(o){typeof o=="string"&&n.d.D(o)},gn.preinit=function(o,c){if(typeof o=="string"&&c&&typeof c.as=="string"){var h=c.as,d=l(h,c.crossOrigin),g=typeof c.integrity=="string"?c.integrity:void 0,m=typeof c.fetchPriority=="string"?c.fetchPriority:void 0;h==="style"?n.d.S(o,typeof c.precedence=="string"?c.precedence:void 0,{crossOrigin:d,integrity:g,fetchPriority:m}):h==="script"&&n.d.X(o,{crossOrigin:d,integrity:g,fetchPriority:m,nonce:typeof c.nonce=="string"?c.nonce:void 0})}},gn.preinitModule=function(o,c){if(typeof o=="string")if(typeof c=="object"&&c!==null){if(c.as==null||c.as==="script"){var h=l(c.as,c.crossOrigin);n.d.M(o,{crossOrigin:h,integrity:typeof c.integrity=="string"?c.integrity:void 0,nonce:typeof c.nonce=="string"?c.nonce:void 0})}}else c==null&&n.d.M(o)},gn.preload=function(o,c){if(typeof o=="string"&&typeof c=="object"&&c!==null&&typeof c.as=="string"){var h=c.as,d=l(h,c.crossOrigin);n.d.L(o,h,{crossOrigin:d,integrity:typeof c.integrity=="string"?c.integrity:void 0,nonce:typeof c.nonce=="string"?c.nonce:void 0,type:typeof c.type=="string"?c.type:void 0,fetchPriority:typeof c.fetchPriority=="string"?c.fetchPriority:void 0,referrerPolicy:typeof c.referrerPolicy=="string"?c.referrerPolicy:void 0,imageSrcSet:typeof c.imageSrcSet=="string"?c.imageSrcSet:void 0,imageSizes:typeof c.imageSizes=="string"?c.imageSizes:void 0,media:typeof c.media=="string"?c.media:void 0})}},gn.preloadModule=function(o,c){if(typeof o=="string")if(c){var h=l(c.as,c.crossOrigin);n.d.m(o,{as:typeof c.as=="string"&&c.as!=="script"?c.as:void 0,crossOrigin:h,integrity:typeof c.integrity=="string"?c.integrity:void 0})}else n.d.m(o)},gn.requestFormReset=function(o){n.d.r(o)},gn.unstable_batchedUpdates=function(o,c){return o(c)},gn.useFormState=function(o,c,h){return s.H.useFormState(o,c,h)},gn.useFormStatus=function(){return s.H.useHostTransitionStatus()},gn.version="19.2.4",gn}var eD;function _U(){if(eD)return gy.exports;eD=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(),gy.exports=DU(),gy.exports}var tD;function NU(){if(tD)return Wc;tD=1;var t=RU(),e=CT(),r=_U();function n(u){var f="https://react.dev/errors/"+u;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)f+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+u+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(u){return!(!u||u.nodeType!==1&&u.nodeType!==9&&u.nodeType!==11)}function a(u){var f=u,p=u;if(u.alternate)for(;f.return;)f=f.return;else{u=f;do f=u,(f.flags&4098)!==0&&(p=f.return),u=f.return;while(u)}return f.tag===3?p:null}function s(u){if(u.tag===13){var f=u.memoizedState;if(f===null&&(u=u.alternate,u!==null&&(f=u.memoizedState)),f!==null)return f.dehydrated}return null}function l(u){if(u.tag===31){var f=u.memoizedState;if(f===null&&(u=u.alternate,u!==null&&(f=u.memoizedState)),f!==null)return f.dehydrated}return null}function o(u){if(a(u)!==u)throw Error(n(188))}function c(u){var f=u.alternate;if(!f){if(f=a(u),f===null)throw Error(n(188));return f!==u?null:u}for(var p=u,v=f;;){var C=p.return;if(C===null)break;var T=C.alternate;if(T===null){if(v=C.return,v!==null){p=v;continue}break}if(C.child===T.child){for(T=C.child;T;){if(T===p)return o(C),u;if(T===v)return o(C),f;T=T.sibling}throw Error(n(188))}if(p.return!==v.return)p=C,v=T;else{for(var L=!1,U=C.child;U;){if(U===p){L=!0,p=C,v=T;break}if(U===v){L=!0,v=C,p=T;break}U=U.sibling}if(!L){for(U=T.child;U;){if(U===p){L=!0,p=T,v=C;break}if(U===v){L=!0,v=T,p=C;break}U=U.sibling}if(!L)throw Error(n(189))}}if(p.alternate!==v)throw Error(n(190))}if(p.tag!==3)throw Error(n(188));return p.stateNode.current===p?u:f}function h(u){var f=u.tag;if(f===5||f===26||f===27||f===6)return u;for(u=u.child;u!==null;){if(f=h(u),f!==null)return f;u=u.sibling}return null}var d=Object.assign,g=Symbol.for("react.element"),m=Symbol.for("react.transitional.element"),y=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),S=Symbol.for("react.consumer"),k=Symbol.for("react.context"),E=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),N=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),D=Symbol.for("react.memo_cache_sentinel"),_=Symbol.iterator;function P(u){return u===null||typeof u!="object"?null:(u=_&&u[_]||u["@@iterator"],typeof u=="function"?u:null)}var z=Symbol.for("react.client.reference");function H(u){if(u==null)return null;if(typeof u=="function")return u.$$typeof===z?null:u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case b:return"Fragment";case w:return"Profiler";case x:return"StrictMode";case M:return"Suspense";case R:return"SuspenseList";case B:return"Activity"}if(typeof u=="object")switch(u.$$typeof){case y:return"Portal";case k:return u.displayName||"Context";case S:return(u._context.displayName||"Context")+".Consumer";case E:var f=u.render;return u=u.displayName,u||(u=f.displayName||f.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case O:return f=u.displayName||null,f!==null?f:H(u.type)||"Memo";case N:f=u._payload,u=u._init;try{return H(u(f))}catch{}}return null}var $=Array.isArray,q=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X={pending:!1,data:null,method:null,action:null},ee=[],te=-1;function I(u){return{current:u}}function G(u){0>te||(u.current=ee[te],ee[te]=null,te--)}function re(u,f){te++,ee[te]=u.current,u.current=f}var Y=I(null),W=I(null),Z=I(null),ie=I(null);function we(u,f){switch(re(Z,f),re(W,u),re(Y,null),f.nodeType){case 9:case 11:u=(u=f.documentElement)&&(u=u.namespaceURI)?vR(u):0;break;default:if(u=f.tagName,f=f.namespaceURI)f=vR(f),u=mR(f,u);else switch(u){case"svg":u=1;break;case"math":u=2;break;default:u=0}}G(Y),re(Y,u)}function de(){G(Y),G(W),G(Z)}function se(u){u.memoizedState!==null&&re(ie,u);var f=Y.current,p=mR(f,u.type);f!==p&&(re(W,u),re(Y,p))}function j(u){W.current===u&&(G(Y),G(W)),ie.current===u&&(G(ie),Uc._currentValue=X)}var Q,K;function ue(u){if(Q===void 0)try{throw Error()}catch(p){var f=p.stack.trim().match(/\n( *(at )?)/);Q=f&&f[1]||"",K=-1<p.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<p.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+Q+u+K}var Se=!1;function at(u,f){if(!u||Se)return"";Se=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var v={DetermineComponentFrameRoot:function(){try{if(f){var Ee=function(){throw Error()};if(Object.defineProperty(Ee.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ee,[])}catch(ye){var me=ye}Reflect.construct(u,[],Ee)}else{try{Ee.call()}catch(ye){me=ye}u.call(Ee.prototype)}}else{try{throw Error()}catch(ye){me=ye}(Ee=u())&&typeof Ee.catch=="function"&&Ee.catch(function(){})}}catch(ye){if(ye&&me&&typeof ye.stack=="string")return[ye.stack,me.stack]}return[null,null]}};v.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var C=Object.getOwnPropertyDescriptor(v.DetermineComponentFrameRoot,"name");C&&C.configurable&&Object.defineProperty(v.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var T=v.DetermineComponentFrameRoot(),L=T[0],U=T[1];if(L&&U){var ne=L.split(`
4
+ `),ge=U.split(`
5
+ `);for(C=v=0;v<ne.length&&!ne[v].includes("DetermineComponentFrameRoot");)v++;for(;C<ge.length&&!ge[C].includes("DetermineComponentFrameRoot");)C++;if(v===ne.length||C===ge.length)for(v=ne.length-1,C=ge.length-1;1<=v&&0<=C&&ne[v]!==ge[C];)C--;for(;1<=v&&0<=C;v--,C--)if(ne[v]!==ge[C]){if(v!==1||C!==1)do if(v--,C--,0>C||ne[v]!==ge[C]){var Ce=`
6
+ `+ne[v].replace(" at new "," at ");return u.displayName&&Ce.includes("<anonymous>")&&(Ce=Ce.replace("<anonymous>",u.displayName)),Ce}while(1<=v&&0<=C);break}}}finally{Se=!1,Error.prepareStackTrace=p}return(p=u?u.displayName||u.name:"")?ue(p):""}function Me(u,f){switch(u.tag){case 26:case 27:case 5:return ue(u.type);case 16:return ue("Lazy");case 13:return u.child!==f&&f!==null?ue("Suspense Fallback"):ue("Suspense");case 19:return ue("SuspenseList");case 0:case 15:return at(u.type,!1);case 11:return at(u.type.render,!1);case 1:return at(u.type,!0);case 31:return ue("Activity");default:return""}}function He(u){try{var f="",p=null;do f+=Me(u,p),p=u,u=u.return;while(u);return f}catch(v){return`
7
+ Error generating stack: `+v.message+`
8
+ `+v.stack}}var $e=Object.prototype.hasOwnProperty,Ne=t.unstable_scheduleCallback,Ge=t.unstable_cancelCallback,Ve=t.unstable_shouldYield,Qe=t.unstable_requestPaint,je=t.unstable_now,dt=t.unstable_getCurrentPriorityLevel,ke=t.unstable_ImmediatePriority,De=t.unstable_UserBlockingPriority,Be=t.unstable_NormalPriority,Ke=t.unstable_LowPriority,Oe=t.unstable_IdlePriority,Re=t.log,ce=t.unstable_setDisableYieldValue,F=null,J=null;function oe(u){if(typeof Re=="function"&&ce(u),J&&typeof J.setStrictMode=="function")try{J.setStrictMode(F,u)}catch{}}var le=Math.clz32?Math.clz32:be,he=Math.log,_e=Math.LN2;function be(u){return u>>>=0,u===0?32:31-(he(u)/_e|0)|0}var ze=256,Le=262144,Pe=4194304;function Ye(u){var f=u&42;if(f!==0)return f;switch(u&-u){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 u&261888;case 262144:case 524288:case 1048576:case 2097152:return u&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return u&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return u}}function et(u,f,p){var v=u.pendingLanes;if(v===0)return 0;var C=0,T=u.suspendedLanes,L=u.pingedLanes;u=u.warmLanes;var U=v&134217727;return U!==0?(v=U&~T,v!==0?C=Ye(v):(L&=U,L!==0?C=Ye(L):p||(p=U&~u,p!==0&&(C=Ye(p))))):(U=v&~T,U!==0?C=Ye(U):L!==0?C=Ye(L):p||(p=v&~u,p!==0&&(C=Ye(p)))),C===0?0:f!==0&&f!==C&&(f&T)===0&&(T=C&-C,p=f&-f,T>=p||T===32&&(p&4194048)!==0)?f:C}function Ie(u,f){return(u.pendingLanes&~(u.suspendedLanes&~u.pingedLanes)&f)===0}function nt(u,f){switch(u){case 1:case 2:case 4:case 8:case 64:return f+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 f+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 rt(){var u=Pe;return Pe<<=1,(Pe&62914560)===0&&(Pe=4194304),u}function ct(u){for(var f=[],p=0;31>p;p++)f.push(u);return f}function Ze(u,f){u.pendingLanes|=f,f!==268435456&&(u.suspendedLanes=0,u.pingedLanes=0,u.warmLanes=0)}function vt(u,f,p,v,C,T){var L=u.pendingLanes;u.pendingLanes=p,u.suspendedLanes=0,u.pingedLanes=0,u.warmLanes=0,u.expiredLanes&=p,u.entangledLanes&=p,u.errorRecoveryDisabledLanes&=p,u.shellSuspendCounter=0;var U=u.entanglements,ne=u.expirationTimes,ge=u.hiddenUpdates;for(p=L&~p;0<p;){var Ce=31-le(p),Ee=1<<Ce;U[Ce]=0,ne[Ce]=-1;var me=ge[Ce];if(me!==null)for(ge[Ce]=null,Ce=0;Ce<me.length;Ce++){var ye=me[Ce];ye!==null&&(ye.lane&=-536870913)}p&=~Ee}v!==0&&wt(u,v,0),T!==0&&C===0&&u.tag!==0&&(u.suspendedLanes|=T&~(L&~f))}function wt(u,f,p){u.pendingLanes|=f,u.suspendedLanes&=~f;var v=31-le(f);u.entangledLanes|=f,u.entanglements[v]=u.entanglements[v]|1073741824|p&261930}function Mt(u,f){var p=u.entangledLanes|=f;for(u=u.entanglements;p;){var v=31-le(p),C=1<<v;C&f|u[v]&f&&(u[v]|=f),p&=~C}}function Ft(u,f){var p=f&-f;return p=(p&42)!==0?1:Ut(p),(p&(u.suspendedLanes|f))!==0?0:p}function Ut(u){switch(u){case 2:u=1;break;case 8:u=4;break;case 32:u=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:u=128;break;case 268435456:u=134217728;break;default:u=0}return u}function Zr(u){return u&=-u,2<u?8<u?(u&134217727)!==0?32:268435456:8:2}function nr(){var u=V.p;return u!==0?u:(u=window.event,u===void 0?32:jR(u.type))}function hn(u,f){var p=V.p;try{return V.p=u,f()}finally{V.p=p}}var Fr=Math.random().toString(36).slice(2),lr="__reactFiber$"+Fr,Nr="__reactProps$"+Fr,_n="__reactContainer$"+Fr,Hr="__reactEvents$"+Fr,Vr="__reactListeners$"+Fr,dn="__reactHandles$"+Fr,ns="__reactResources$"+Fr,Ur="__reactMarker$"+Fr;function go(u){delete u[lr],delete u[Nr],delete u[Hr],delete u[Vr],delete u[dn]}function is(u){var f=u[lr];if(f)return f;for(var p=u.parentNode;p;){if(f=p[_n]||p[lr]){if(p=f.alternate,f.child!==null||p!==null&&p.child!==null)for(u=kR(u);u!==null;){if(p=u[lr])return p;u=kR(u)}return f}u=p,p=u.parentNode}return null}function as(u){if(u=u[lr]||u[_n]){var f=u.tag;if(f===5||f===6||f===13||f===31||f===26||f===27||f===3)return u}return null}function dl(u){var f=u.tag;if(f===5||f===26||f===27||f===6)return u.stateNode;throw Error(n(33))}function ss(u){var f=u[ns];return f||(f=u[ns]={hoistableStyles:new Map,hoistableScripts:new Map}),f}function kr(u){u[Ur]=!0}var zh=new Set,Ih={};function Jn(u,f){Gi(u,f),Gi(u+"Capture",f)}function Gi(u,f){for(Ih[u]=f,u=0;u<f.length;u++)zh.add(f[u])}var vo=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]*$"),ac={},sc={};function rm(u){return $e.call(sc,u)?!0:$e.call(ac,u)?!1:vo.test(u)?sc[u]=!0:(ac[u]=!0,!1)}function pn(u,f,p){if(rm(f))if(p===null)u.removeAttribute(f);else{switch(typeof p){case"undefined":case"function":case"symbol":u.removeAttribute(f);return;case"boolean":var v=f.toLowerCase().slice(0,5);if(v!=="data-"&&v!=="aria-"){u.removeAttribute(f);return}}u.setAttribute(f,""+p)}}function ls(u,f,p){if(p===null)u.removeAttribute(f);else{switch(typeof p){case"undefined":case"function":case"symbol":case"boolean":u.removeAttribute(f);return}u.setAttribute(f,""+p)}}function hi(u,f,p,v){if(v===null)u.removeAttribute(p);else{switch(typeof v){case"undefined":case"function":case"symbol":case"boolean":u.removeAttribute(p);return}u.setAttributeNS(f,p,""+v)}}function $r(u){switch(typeof u){case"bigint":case"boolean":case"number":case"string":case"undefined":return u;case"object":return u;default:return""}}function Nn(u){var f=u.type;return(u=u.nodeName)&&u.toLowerCase()==="input"&&(f==="checkbox"||f==="radio")}function nm(u,f,p){var v=Object.getOwnPropertyDescriptor(u.constructor.prototype,f);if(!u.hasOwnProperty(f)&&typeof v<"u"&&typeof v.get=="function"&&typeof v.set=="function"){var C=v.get,T=v.set;return Object.defineProperty(u,f,{configurable:!0,get:function(){return C.call(this)},set:function(L){p=""+L,T.call(this,L)}}),Object.defineProperty(u,f,{enumerable:v.enumerable}),{getValue:function(){return p},setValue:function(L){p=""+L},stopTracking:function(){u._valueTracker=null,delete u[f]}}}}function qh(u){if(!u._valueTracker){var f=Nn(u)?"checked":"value";u._valueTracker=nm(u,f,""+u[f])}}function jh(u){if(!u)return!1;var f=u._valueTracker;if(!f)return!0;var p=f.getValue(),v="";return u&&(v=Nn(u)?u.checked?"true":"false":u.value),u=v,u!==p?(f.setValue(u),!0):!1}function Fh(u){if(u=u||(typeof document<"u"?document:void 0),typeof u>"u")return null;try{return u.activeElement||u.body}catch{return u.body}}var xH=/[\n"\\]/g;function di(u){return u.replace(xH,function(f){return"\\"+f.charCodeAt(0).toString(16)+" "})}function im(u,f,p,v,C,T,L,U){u.name="",L!=null&&typeof L!="function"&&typeof L!="symbol"&&typeof L!="boolean"?u.type=L:u.removeAttribute("type"),f!=null?L==="number"?(f===0&&u.value===""||u.value!=f)&&(u.value=""+$r(f)):u.value!==""+$r(f)&&(u.value=""+$r(f)):L!=="submit"&&L!=="reset"||u.removeAttribute("value"),f!=null?am(u,L,$r(f)):p!=null?am(u,L,$r(p)):v!=null&&u.removeAttribute("value"),C==null&&T!=null&&(u.defaultChecked=!!T),C!=null&&(u.checked=C&&typeof C!="function"&&typeof C!="symbol"),U!=null&&typeof U!="function"&&typeof U!="symbol"&&typeof U!="boolean"?u.name=""+$r(U):u.removeAttribute("name")}function cA(u,f,p,v,C,T,L,U){if(T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"&&(u.type=T),f!=null||p!=null){if(!(T!=="submit"&&T!=="reset"||f!=null)){qh(u);return}p=p!=null?""+$r(p):"",f=f!=null?""+$r(f):p,U||f===u.value||(u.value=f),u.defaultValue=f}v=v??C,v=typeof v!="function"&&typeof v!="symbol"&&!!v,u.checked=U?u.checked:!!v,u.defaultChecked=!!v,L!=null&&typeof L!="function"&&typeof L!="symbol"&&typeof L!="boolean"&&(u.name=L),qh(u)}function am(u,f,p){f==="number"&&Fh(u.ownerDocument)===u||u.defaultValue===""+p||(u.defaultValue=""+p)}function mo(u,f,p,v){if(u=u.options,f){f={};for(var C=0;C<p.length;C++)f["$"+p[C]]=!0;for(p=0;p<u.length;p++)C=f.hasOwnProperty("$"+u[p].value),u[p].selected!==C&&(u[p].selected=C),C&&v&&(u[p].defaultSelected=!0)}else{for(p=""+$r(p),f=null,C=0;C<u.length;C++){if(u[C].value===p){u[C].selected=!0,v&&(u[C].defaultSelected=!0);return}f!==null||u[C].disabled||(f=u[C])}f!==null&&(f.selected=!0)}}function fA(u,f,p){if(f!=null&&(f=""+$r(f),f!==u.value&&(u.value=f),p==null)){u.defaultValue!==f&&(u.defaultValue=f);return}u.defaultValue=p!=null?""+$r(p):""}function hA(u,f,p,v){if(f==null){if(v!=null){if(p!=null)throw Error(n(92));if($(v)){if(1<v.length)throw Error(n(93));v=v[0]}p=v}p==null&&(p=""),f=p}p=$r(f),u.defaultValue=p,v=u.textContent,v===p&&v!==""&&v!==null&&(u.value=v),qh(u)}function yo(u,f){if(f){var p=u.firstChild;if(p&&p===u.lastChild&&p.nodeType===3){p.nodeValue=f;return}}u.textContent=f}var wH=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 dA(u,f,p){var v=f.indexOf("--")===0;p==null||typeof p=="boolean"||p===""?v?u.setProperty(f,""):f==="float"?u.cssFloat="":u[f]="":v?u.setProperty(f,p):typeof p!="number"||p===0||wH.has(f)?f==="float"?u.cssFloat=p:u[f]=(""+p).trim():u[f]=p+"px"}function pA(u,f,p){if(f!=null&&typeof f!="object")throw Error(n(62));if(u=u.style,p!=null){for(var v in p)!p.hasOwnProperty(v)||f!=null&&f.hasOwnProperty(v)||(v.indexOf("--")===0?u.setProperty(v,""):v==="float"?u.cssFloat="":u[v]="");for(var C in f)v=f[C],f.hasOwnProperty(C)&&p[C]!==v&&dA(u,C,v)}else for(var T in f)f.hasOwnProperty(T)&&dA(u,T,f[T])}function sm(u){if(u.indexOf("-")===-1)return!1;switch(u){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 SH=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"]]),CH=/^[\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 Hh(u){return CH.test(""+u)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":u}function xa(){}var lm=null;function om(u){return u=u.target||u.srcElement||window,u.correspondingUseElement&&(u=u.correspondingUseElement),u.nodeType===3?u.parentNode:u}var bo=null,xo=null;function gA(u){var f=as(u);if(f&&(u=f.stateNode)){var p=u[Nr]||null;e:switch(u=f.stateNode,f.type){case"input":if(im(u,p.value,p.defaultValue,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name),f=p.name,p.type==="radio"&&f!=null){for(p=u;p.parentNode;)p=p.parentNode;for(p=p.querySelectorAll('input[name="'+di(""+f)+'"][type="radio"]'),f=0;f<p.length;f++){var v=p[f];if(v!==u&&v.form===u.form){var C=v[Nr]||null;if(!C)throw Error(n(90));im(v,C.value,C.defaultValue,C.defaultValue,C.checked,C.defaultChecked,C.type,C.name)}}for(f=0;f<p.length;f++)v=p[f],v.form===u.form&&jh(v)}break e;case"textarea":fA(u,p.value,p.defaultValue);break e;case"select":f=p.value,f!=null&&mo(u,!!p.multiple,f,!1)}}}var um=!1;function vA(u,f,p){if(um)return u(f,p);um=!0;try{var v=u(f);return v}finally{if(um=!1,(bo!==null||xo!==null)&&(Md(),bo&&(f=bo,u=xo,xo=bo=null,gA(f),u)))for(f=0;f<u.length;f++)gA(u[f])}}function lc(u,f){var p=u.stateNode;if(p===null)return null;var v=p[Nr]||null;if(v===null)return null;p=v[f];e:switch(f){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)||(u=u.type,v=!(u==="button"||u==="input"||u==="select"||u==="textarea")),u=!v;break e;default:u=!1}if(u)return null;if(p&&typeof p!="function")throw Error(n(231,f,typeof p));return p}var wa=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),cm=!1;if(wa)try{var oc={};Object.defineProperty(oc,"passive",{get:function(){cm=!0}}),window.addEventListener("test",oc,oc),window.removeEventListener("test",oc,oc)}catch{cm=!1}var os=null,fm=null,Vh=null;function mA(){if(Vh)return Vh;var u,f=fm,p=f.length,v,C="value"in os?os.value:os.textContent,T=C.length;for(u=0;u<p&&f[u]===C[u];u++);var L=p-u;for(v=1;v<=L&&f[p-v]===C[T-v];v++);return Vh=C.slice(u,1<v?1-v:void 0)}function Uh(u){var f=u.keyCode;return"charCode"in u?(u=u.charCode,u===0&&f===13&&(u=13)):u=f,u===10&&(u=13),32<=u||u===13?u:0}function $h(){return!0}function yA(){return!1}function Bn(u){function f(p,v,C,T,L){this._reactName=p,this._targetInst=C,this.type=v,this.nativeEvent=T,this.target=L,this.currentTarget=null;for(var U in u)u.hasOwnProperty(U)&&(p=u[U],this[U]=p?p(T):T[U]);return this.isDefaultPrevented=(T.defaultPrevented!=null?T.defaultPrevented:T.returnValue===!1)?$h:yA,this.isPropagationStopped=yA,this}return d(f.prototype,{preventDefault:function(){this.defaultPrevented=!0;var p=this.nativeEvent;p&&(p.preventDefault?p.preventDefault():typeof p.returnValue!="unknown"&&(p.returnValue=!1),this.isDefaultPrevented=$h)},stopPropagation:function(){var p=this.nativeEvent;p&&(p.stopPropagation?p.stopPropagation():typeof p.cancelBubble!="unknown"&&(p.cancelBubble=!0),this.isPropagationStopped=$h)},persist:function(){},isPersistent:$h}),f}var pl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(u){return u.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Gh=Bn(pl),uc=d({},pl,{view:0,detail:0}),kH=Bn(uc),hm,dm,cc,Yh=d({},uc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:gm,button:0,buttons:0,relatedTarget:function(u){return u.relatedTarget===void 0?u.fromElement===u.srcElement?u.toElement:u.fromElement:u.relatedTarget},movementX:function(u){return"movementX"in u?u.movementX:(u!==cc&&(cc&&u.type==="mousemove"?(hm=u.screenX-cc.screenX,dm=u.screenY-cc.screenY):dm=hm=0,cc=u),hm)},movementY:function(u){return"movementY"in u?u.movementY:dm}}),bA=Bn(Yh),TH=d({},Yh,{dataTransfer:0}),EH=Bn(TH),AH=d({},uc,{relatedTarget:0}),pm=Bn(AH),OH=d({},pl,{animationName:0,elapsedTime:0,pseudoElement:0}),MH=Bn(OH),RH=d({},pl,{clipboardData:function(u){return"clipboardData"in u?u.clipboardData:window.clipboardData}}),DH=Bn(RH),_H=d({},pl,{data:0}),xA=Bn(_H),NH={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},BH={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"},LH={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function PH(u){var f=this.nativeEvent;return f.getModifierState?f.getModifierState(u):(u=LH[u])?!!f[u]:!1}function gm(){return PH}var zH=d({},uc,{key:function(u){if(u.key){var f=NH[u.key]||u.key;if(f!=="Unidentified")return f}return u.type==="keypress"?(u=Uh(u),u===13?"Enter":String.fromCharCode(u)):u.type==="keydown"||u.type==="keyup"?BH[u.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:gm,charCode:function(u){return u.type==="keypress"?Uh(u):0},keyCode:function(u){return u.type==="keydown"||u.type==="keyup"?u.keyCode:0},which:function(u){return u.type==="keypress"?Uh(u):u.type==="keydown"||u.type==="keyup"?u.keyCode:0}}),IH=Bn(zH),qH=d({},Yh,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),wA=Bn(qH),jH=d({},uc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:gm}),FH=Bn(jH),HH=d({},pl,{propertyName:0,elapsedTime:0,pseudoElement:0}),VH=Bn(HH),UH=d({},Yh,{deltaX:function(u){return"deltaX"in u?u.deltaX:"wheelDeltaX"in u?-u.wheelDeltaX:0},deltaY:function(u){return"deltaY"in u?u.deltaY:"wheelDeltaY"in u?-u.wheelDeltaY:"wheelDelta"in u?-u.wheelDelta:0},deltaZ:0,deltaMode:0}),$H=Bn(UH),GH=d({},pl,{newState:0,oldState:0}),YH=Bn(GH),XH=[9,13,27,32],vm=wa&&"CompositionEvent"in window,fc=null;wa&&"documentMode"in document&&(fc=document.documentMode);var WH=wa&&"TextEvent"in window&&!fc,SA=wa&&(!vm||fc&&8<fc&&11>=fc),CA=" ",kA=!1;function TA(u,f){switch(u){case"keyup":return XH.indexOf(f.keyCode)!==-1;case"keydown":return f.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function EA(u){return u=u.detail,typeof u=="object"&&"data"in u?u.data:null}var wo=!1;function QH(u,f){switch(u){case"compositionend":return EA(f);case"keypress":return f.which!==32?null:(kA=!0,CA);case"textInput":return u=f.data,u===CA&&kA?null:u;default:return null}}function KH(u,f){if(wo)return u==="compositionend"||!vm&&TA(u,f)?(u=mA(),Vh=fm=os=null,wo=!1,u):null;switch(u){case"paste":return null;case"keypress":if(!(f.ctrlKey||f.altKey||f.metaKey)||f.ctrlKey&&f.altKey){if(f.char&&1<f.char.length)return f.char;if(f.which)return String.fromCharCode(f.which)}return null;case"compositionend":return SA&&f.locale!=="ko"?null:f.data;default:return null}}var ZH={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 AA(u){var f=u&&u.nodeName&&u.nodeName.toLowerCase();return f==="input"?!!ZH[u.type]:f==="textarea"}function OA(u,f,p,v){bo?xo?xo.push(v):xo=[v]:bo=v,f=Pd(f,"onChange"),0<f.length&&(p=new Gh("onChange","change",null,p,v),u.push({event:p,listeners:f}))}var hc=null,dc=null;function JH(u){cR(u,0)}function Xh(u){var f=dl(u);if(jh(f))return u}function MA(u,f){if(u==="change")return f}var RA=!1;if(wa){var mm;if(wa){var ym="oninput"in document;if(!ym){var DA=document.createElement("div");DA.setAttribute("oninput","return;"),ym=typeof DA.oninput=="function"}mm=ym}else mm=!1;RA=mm&&(!document.documentMode||9<document.documentMode)}function _A(){hc&&(hc.detachEvent("onpropertychange",NA),dc=hc=null)}function NA(u){if(u.propertyName==="value"&&Xh(dc)){var f=[];OA(f,dc,u,om(u)),vA(JH,f)}}function eV(u,f,p){u==="focusin"?(_A(),hc=f,dc=p,hc.attachEvent("onpropertychange",NA)):u==="focusout"&&_A()}function tV(u){if(u==="selectionchange"||u==="keyup"||u==="keydown")return Xh(dc)}function rV(u,f){if(u==="click")return Xh(f)}function nV(u,f){if(u==="input"||u==="change")return Xh(f)}function iV(u,f){return u===f&&(u!==0||1/u===1/f)||u!==u&&f!==f}var ei=typeof Object.is=="function"?Object.is:iV;function pc(u,f){if(ei(u,f))return!0;if(typeof u!="object"||u===null||typeof f!="object"||f===null)return!1;var p=Object.keys(u),v=Object.keys(f);if(p.length!==v.length)return!1;for(v=0;v<p.length;v++){var C=p[v];if(!$e.call(f,C)||!ei(u[C],f[C]))return!1}return!0}function BA(u){for(;u&&u.firstChild;)u=u.firstChild;return u}function LA(u,f){var p=BA(u);u=0;for(var v;p;){if(p.nodeType===3){if(v=u+p.textContent.length,u<=f&&v>=f)return{node:p,offset:f-u};u=v}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=BA(p)}}function PA(u,f){return u&&f?u===f?!0:u&&u.nodeType===3?!1:f&&f.nodeType===3?PA(u,f.parentNode):"contains"in u?u.contains(f):u.compareDocumentPosition?!!(u.compareDocumentPosition(f)&16):!1:!1}function zA(u){u=u!=null&&u.ownerDocument!=null&&u.ownerDocument.defaultView!=null?u.ownerDocument.defaultView:window;for(var f=Fh(u.document);f instanceof u.HTMLIFrameElement;){try{var p=typeof f.contentWindow.location.href=="string"}catch{p=!1}if(p)u=f.contentWindow;else break;f=Fh(u.document)}return f}function bm(u){var f=u&&u.nodeName&&u.nodeName.toLowerCase();return f&&(f==="input"&&(u.type==="text"||u.type==="search"||u.type==="tel"||u.type==="url"||u.type==="password")||f==="textarea"||u.contentEditable==="true")}var aV=wa&&"documentMode"in document&&11>=document.documentMode,So=null,xm=null,gc=null,wm=!1;function IA(u,f,p){var v=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;wm||So==null||So!==Fh(v)||(v=So,"selectionStart"in v&&bm(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}),gc&&pc(gc,v)||(gc=v,v=Pd(xm,"onSelect"),0<v.length&&(f=new Gh("onSelect","select",null,f,p),u.push({event:f,listeners:v}),f.target=So)))}function gl(u,f){var p={};return p[u.toLowerCase()]=f.toLowerCase(),p["Webkit"+u]="webkit"+f,p["Moz"+u]="moz"+f,p}var Co={animationend:gl("Animation","AnimationEnd"),animationiteration:gl("Animation","AnimationIteration"),animationstart:gl("Animation","AnimationStart"),transitionrun:gl("Transition","TransitionRun"),transitionstart:gl("Transition","TransitionStart"),transitioncancel:gl("Transition","TransitionCancel"),transitionend:gl("Transition","TransitionEnd")},Sm={},qA={};wa&&(qA=document.createElement("div").style,"AnimationEvent"in window||(delete Co.animationend.animation,delete Co.animationiteration.animation,delete Co.animationstart.animation),"TransitionEvent"in window||delete Co.transitionend.transition);function vl(u){if(Sm[u])return Sm[u];if(!Co[u])return u;var f=Co[u],p;for(p in f)if(f.hasOwnProperty(p)&&p in qA)return Sm[u]=f[p];return u}var jA=vl("animationend"),FA=vl("animationiteration"),HA=vl("animationstart"),sV=vl("transitionrun"),lV=vl("transitionstart"),oV=vl("transitioncancel"),VA=vl("transitionend"),UA=new Map,Cm="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(" ");Cm.push("scrollEnd");function _i(u,f){UA.set(u,f),Jn(f,[u])}var Wh=typeof reportError=="function"?reportError:function(u){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var f=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof u=="object"&&u!==null&&typeof u.message=="string"?String(u.message):String(u),error:u});if(!window.dispatchEvent(f))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",u);return}console.error(u)},pi=[],ko=0,km=0;function Qh(){for(var u=ko,f=km=ko=0;f<u;){var p=pi[f];pi[f++]=null;var v=pi[f];pi[f++]=null;var C=pi[f];pi[f++]=null;var T=pi[f];if(pi[f++]=null,v!==null&&C!==null){var L=v.pending;L===null?C.next=C:(C.next=L.next,L.next=C),v.pending=C}T!==0&&$A(p,C,T)}}function Kh(u,f,p,v){pi[ko++]=u,pi[ko++]=f,pi[ko++]=p,pi[ko++]=v,km|=v,u.lanes|=v,u=u.alternate,u!==null&&(u.lanes|=v)}function Tm(u,f,p,v){return Kh(u,f,p,v),Zh(u)}function ml(u,f){return Kh(u,null,null,f),Zh(u)}function $A(u,f,p){u.lanes|=p;var v=u.alternate;v!==null&&(v.lanes|=p);for(var C=!1,T=u.return;T!==null;)T.childLanes|=p,v=T.alternate,v!==null&&(v.childLanes|=p),T.tag===22&&(u=T.stateNode,u===null||u._visibility&1||(C=!0)),u=T,T=T.return;return u.tag===3?(T=u.stateNode,C&&f!==null&&(C=31-le(p),u=T.hiddenUpdates,v=u[C],v===null?u[C]=[f]:v.push(f),f.lane=p|536870912),T):null}function Zh(u){if(50<zc)throw zc=0,B0=null,Error(n(185));for(var f=u.return;f!==null;)u=f,f=u.return;return u.tag===3?u.stateNode:null}var To={};function uV(u,f,p,v){this.tag=u,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=f,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 ti(u,f,p,v){return new uV(u,f,p,v)}function Em(u){return u=u.prototype,!(!u||!u.isReactComponent)}function Sa(u,f){var p=u.alternate;return p===null?(p=ti(u.tag,f,u.key,u.mode),p.elementType=u.elementType,p.type=u.type,p.stateNode=u.stateNode,p.alternate=u,u.alternate=p):(p.pendingProps=f,p.type=u.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=u.flags&65011712,p.childLanes=u.childLanes,p.lanes=u.lanes,p.child=u.child,p.memoizedProps=u.memoizedProps,p.memoizedState=u.memoizedState,p.updateQueue=u.updateQueue,f=u.dependencies,p.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext},p.sibling=u.sibling,p.index=u.index,p.ref=u.ref,p.refCleanup=u.refCleanup,p}function GA(u,f){u.flags&=65011714;var p=u.alternate;return p===null?(u.childLanes=0,u.lanes=f,u.child=null,u.subtreeFlags=0,u.memoizedProps=null,u.memoizedState=null,u.updateQueue=null,u.dependencies=null,u.stateNode=null):(u.childLanes=p.childLanes,u.lanes=p.lanes,u.child=p.child,u.subtreeFlags=0,u.deletions=null,u.memoizedProps=p.memoizedProps,u.memoizedState=p.memoizedState,u.updateQueue=p.updateQueue,u.type=p.type,f=p.dependencies,u.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext}),u}function Jh(u,f,p,v,C,T){var L=0;if(v=u,typeof u=="function")Em(u)&&(L=1);else if(typeof u=="string")L=pU(u,p,Y.current)?26:u==="html"||u==="head"||u==="body"?27:5;else e:switch(u){case B:return u=ti(31,p,f,C),u.elementType=B,u.lanes=T,u;case b:return yl(p.children,C,T,f);case x:L=8,C|=24;break;case w:return u=ti(12,p,f,C|2),u.elementType=w,u.lanes=T,u;case M:return u=ti(13,p,f,C),u.elementType=M,u.lanes=T,u;case R:return u=ti(19,p,f,C),u.elementType=R,u.lanes=T,u;default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case k:L=10;break e;case S:L=9;break e;case E:L=11;break e;case O:L=14;break e;case N:L=16,v=null;break e}L=29,p=Error(n(130,u===null?"null":typeof u,"")),v=null}return f=ti(L,p,f,C),f.elementType=u,f.type=v,f.lanes=T,f}function yl(u,f,p,v){return u=ti(7,u,v,f),u.lanes=p,u}function Am(u,f,p){return u=ti(6,u,null,f),u.lanes=p,u}function YA(u){var f=ti(18,null,null,0);return f.stateNode=u,f}function Om(u,f,p){return f=ti(4,u.children!==null?u.children:[],u.key,f),f.lanes=p,f.stateNode={containerInfo:u.containerInfo,pendingChildren:null,implementation:u.implementation},f}var XA=new WeakMap;function gi(u,f){if(typeof u=="object"&&u!==null){var p=XA.get(u);return p!==void 0?p:(f={value:u,source:f,stack:He(f)},XA.set(u,f),f)}return{value:u,source:f,stack:He(f)}}var Eo=[],Ao=0,ed=null,vc=0,vi=[],mi=0,us=null,Yi=1,Xi="";function Ca(u,f){Eo[Ao++]=vc,Eo[Ao++]=ed,ed=u,vc=f}function WA(u,f,p){vi[mi++]=Yi,vi[mi++]=Xi,vi[mi++]=us,us=u;var v=Yi;u=Xi;var C=32-le(v)-1;v&=~(1<<C),p+=1;var T=32-le(f)+C;if(30<T){var L=C-C%5;T=(v&(1<<L)-1).toString(32),v>>=L,C-=L,Yi=1<<32-le(f)+C|p<<C|v,Xi=T+u}else Yi=1<<T|p<<C|v,Xi=u}function Mm(u){u.return!==null&&(Ca(u,1),WA(u,1,0))}function Rm(u){for(;u===ed;)ed=Eo[--Ao],Eo[Ao]=null,vc=Eo[--Ao],Eo[Ao]=null;for(;u===us;)us=vi[--mi],vi[mi]=null,Xi=vi[--mi],vi[mi]=null,Yi=vi[--mi],vi[mi]=null}function QA(u,f){vi[mi++]=Yi,vi[mi++]=Xi,vi[mi++]=us,Yi=f.id,Xi=f.overflow,us=u}var Jr=null,ir=null,Rt=!1,cs=null,yi=!1,Dm=Error(n(519));function fs(u){var f=Error(n(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw mc(gi(f,u)),Dm}function KA(u){var f=u.stateNode,p=u.type,v=u.memoizedProps;switch(f[lr]=u,f[Nr]=v,p){case"dialog":Tt("cancel",f),Tt("close",f);break;case"iframe":case"object":case"embed":Tt("load",f);break;case"video":case"audio":for(p=0;p<qc.length;p++)Tt(qc[p],f);break;case"source":Tt("error",f);break;case"img":case"image":case"link":Tt("error",f),Tt("load",f);break;case"details":Tt("toggle",f);break;case"input":Tt("invalid",f),cA(f,v.value,v.defaultValue,v.checked,v.defaultChecked,v.type,v.name,!0);break;case"select":Tt("invalid",f);break;case"textarea":Tt("invalid",f),hA(f,v.value,v.defaultValue,v.children)}p=v.children,typeof p!="string"&&typeof p!="number"&&typeof p!="bigint"||f.textContent===""+p||v.suppressHydrationWarning===!0||pR(f.textContent,p)?(v.popover!=null&&(Tt("beforetoggle",f),Tt("toggle",f)),v.onScroll!=null&&Tt("scroll",f),v.onScrollEnd!=null&&Tt("scrollend",f),v.onClick!=null&&(f.onclick=xa),f=!0):f=!1,f||fs(u,!0)}function ZA(u){for(Jr=u.return;Jr;)switch(Jr.tag){case 5:case 31:case 13:yi=!1;return;case 27:case 3:yi=!0;return;default:Jr=Jr.return}}function Oo(u){if(u!==Jr)return!1;if(!Rt)return ZA(u),Rt=!0,!1;var f=u.tag,p;if((p=f!==3&&f!==27)&&((p=f===5)&&(p=u.type,p=!(p!=="form"&&p!=="button")||W0(u.type,u.memoizedProps)),p=!p),p&&ir&&fs(u),ZA(u),f===13){if(u=u.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(n(317));ir=CR(u)}else if(f===31){if(u=u.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(n(317));ir=CR(u)}else f===27?(f=ir,Ts(u.type)?(u=ey,ey=null,ir=u):ir=f):ir=Jr?xi(u.stateNode.nextSibling):null;return!0}function bl(){ir=Jr=null,Rt=!1}function _m(){var u=cs;return u!==null&&(In===null?In=u:In.push.apply(In,u),cs=null),u}function mc(u){cs===null?cs=[u]:cs.push(u)}var Nm=I(null),xl=null,ka=null;function hs(u,f,p){re(Nm,f._currentValue),f._currentValue=p}function Ta(u){u._currentValue=Nm.current,G(Nm)}function Bm(u,f,p){for(;u!==null;){var v=u.alternate;if((u.childLanes&f)!==f?(u.childLanes|=f,v!==null&&(v.childLanes|=f)):v!==null&&(v.childLanes&f)!==f&&(v.childLanes|=f),u===p)break;u=u.return}}function Lm(u,f,p,v){var C=u.child;for(C!==null&&(C.return=u);C!==null;){var T=C.dependencies;if(T!==null){var L=C.child;T=T.firstContext;e:for(;T!==null;){var U=T;T=C;for(var ne=0;ne<f.length;ne++)if(U.context===f[ne]){T.lanes|=p,U=T.alternate,U!==null&&(U.lanes|=p),Bm(T.return,p,u),v||(L=null);break e}T=U.next}}else if(C.tag===18){if(L=C.return,L===null)throw Error(n(341));L.lanes|=p,T=L.alternate,T!==null&&(T.lanes|=p),Bm(L,p,u),L=null}else L=C.child;if(L!==null)L.return=C;else for(L=C;L!==null;){if(L===u){L=null;break}if(C=L.sibling,C!==null){C.return=L.return,L=C;break}L=L.return}C=L}}function Mo(u,f,p,v){u=null;for(var C=f,T=!1;C!==null;){if(!T){if((C.flags&524288)!==0)T=!0;else if((C.flags&262144)!==0)break}if(C.tag===10){var L=C.alternate;if(L===null)throw Error(n(387));if(L=L.memoizedProps,L!==null){var U=C.type;ei(C.pendingProps.value,L.value)||(u!==null?u.push(U):u=[U])}}else if(C===ie.current){if(L=C.alternate,L===null)throw Error(n(387));L.memoizedState.memoizedState!==C.memoizedState.memoizedState&&(u!==null?u.push(Uc):u=[Uc])}C=C.return}u!==null&&Lm(f,u,p,v),f.flags|=262144}function td(u){for(u=u.firstContext;u!==null;){if(!ei(u.context._currentValue,u.memoizedValue))return!0;u=u.next}return!1}function wl(u){xl=u,ka=null,u=u.dependencies,u!==null&&(u.firstContext=null)}function en(u){return JA(xl,u)}function rd(u,f){return xl===null&&wl(u),JA(u,f)}function JA(u,f){var p=f._currentValue;if(f={context:f,memoizedValue:p,next:null},ka===null){if(u===null)throw Error(n(308));ka=f,u.dependencies={lanes:0,firstContext:f},u.flags|=524288}else ka=ka.next=f;return p}var cV=typeof AbortController<"u"?AbortController:function(){var u=[],f=this.signal={aborted:!1,addEventListener:function(p,v){u.push(v)}};this.abort=function(){f.aborted=!0,u.forEach(function(p){return p()})}},fV=t.unstable_scheduleCallback,hV=t.unstable_NormalPriority,Tr={$$typeof:k,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Pm(){return{controller:new cV,data:new Map,refCount:0}}function yc(u){u.refCount--,u.refCount===0&&fV(hV,function(){u.controller.abort()})}var bc=null,zm=0,Ro=0,Do=null;function dV(u,f){if(bc===null){var p=bc=[];zm=0,Ro=j0(),Do={status:"pending",value:void 0,then:function(v){p.push(v)}}}return zm++,f.then(eO,eO),f}function eO(){if(--zm===0&&bc!==null){Do!==null&&(Do.status="fulfilled");var u=bc;bc=null,Ro=0,Do=null;for(var f=0;f<u.length;f++)(0,u[f])()}}function pV(u,f){var p=[],v={status:"pending",value:null,reason:null,then:function(C){p.push(C)}};return u.then(function(){v.status="fulfilled",v.value=f;for(var C=0;C<p.length;C++)(0,p[C])(f)},function(C){for(v.status="rejected",v.reason=C,C=0;C<p.length;C++)(0,p[C])(void 0)}),v}var tO=q.S;q.S=function(u,f){IM=je(),typeof f=="object"&&f!==null&&typeof f.then=="function"&&dV(u,f),tO!==null&&tO(u,f)};var Sl=I(null);function Im(){var u=Sl.current;return u!==null?u:Qt.pooledCache}function nd(u,f){f===null?re(Sl,Sl.current):re(Sl,f.pool)}function rO(){var u=Im();return u===null?null:{parent:Tr._currentValue,pool:u}}var _o=Error(n(460)),qm=Error(n(474)),id=Error(n(542)),ad={then:function(){}};function nO(u){return u=u.status,u==="fulfilled"||u==="rejected"}function iO(u,f,p){switch(p=u[p],p===void 0?u.push(f):p!==f&&(f.then(xa,xa),f=p),f.status){case"fulfilled":return f.value;case"rejected":throw u=f.reason,sO(u),u;default:if(typeof f.status=="string")f.then(xa,xa);else{if(u=Qt,u!==null&&100<u.shellSuspendCounter)throw Error(n(482));u=f,u.status="pending",u.then(function(v){if(f.status==="pending"){var C=f;C.status="fulfilled",C.value=v}},function(v){if(f.status==="pending"){var C=f;C.status="rejected",C.reason=v}})}switch(f.status){case"fulfilled":return f.value;case"rejected":throw u=f.reason,sO(u),u}throw kl=f,_o}}function Cl(u){try{var f=u._init;return f(u._payload)}catch(p){throw p!==null&&typeof p=="object"&&typeof p.then=="function"?(kl=p,_o):p}}var kl=null;function aO(){if(kl===null)throw Error(n(459));var u=kl;return kl=null,u}function sO(u){if(u===_o||u===id)throw Error(n(483))}var No=null,xc=0;function sd(u){var f=xc;return xc+=1,No===null&&(No=[]),iO(No,u,f)}function wc(u,f){f=f.props.ref,u.ref=f!==void 0?f:null}function ld(u,f){throw f.$$typeof===g?Error(n(525)):(u=Object.prototype.toString.call(f),Error(n(31,u==="[object Object]"?"object with keys {"+Object.keys(f).join(", ")+"}":u)))}function lO(u){function f(fe,ae){if(u){var pe=fe.deletions;pe===null?(fe.deletions=[ae],fe.flags|=16):pe.push(ae)}}function p(fe,ae){if(!u)return null;for(;ae!==null;)f(fe,ae),ae=ae.sibling;return null}function v(fe){for(var ae=new Map;fe!==null;)fe.key!==null?ae.set(fe.key,fe):ae.set(fe.index,fe),fe=fe.sibling;return ae}function C(fe,ae){return fe=Sa(fe,ae),fe.index=0,fe.sibling=null,fe}function T(fe,ae,pe){return fe.index=pe,u?(pe=fe.alternate,pe!==null?(pe=pe.index,pe<ae?(fe.flags|=67108866,ae):pe):(fe.flags|=67108866,ae)):(fe.flags|=1048576,ae)}function L(fe){return u&&fe.alternate===null&&(fe.flags|=67108866),fe}function U(fe,ae,pe,Te){return ae===null||ae.tag!==6?(ae=Am(pe,fe.mode,Te),ae.return=fe,ae):(ae=C(ae,pe),ae.return=fe,ae)}function ne(fe,ae,pe,Te){var ot=pe.type;return ot===b?Ce(fe,ae,pe.props.children,Te,pe.key):ae!==null&&(ae.elementType===ot||typeof ot=="object"&&ot!==null&&ot.$$typeof===N&&Cl(ot)===ae.type)?(ae=C(ae,pe.props),wc(ae,pe),ae.return=fe,ae):(ae=Jh(pe.type,pe.key,pe.props,null,fe.mode,Te),wc(ae,pe),ae.return=fe,ae)}function ge(fe,ae,pe,Te){return ae===null||ae.tag!==4||ae.stateNode.containerInfo!==pe.containerInfo||ae.stateNode.implementation!==pe.implementation?(ae=Om(pe,fe.mode,Te),ae.return=fe,ae):(ae=C(ae,pe.children||[]),ae.return=fe,ae)}function Ce(fe,ae,pe,Te,ot){return ae===null||ae.tag!==7?(ae=yl(pe,fe.mode,Te,ot),ae.return=fe,ae):(ae=C(ae,pe),ae.return=fe,ae)}function Ee(fe,ae,pe){if(typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint")return ae=Am(""+ae,fe.mode,pe),ae.return=fe,ae;if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case m:return pe=Jh(ae.type,ae.key,ae.props,null,fe.mode,pe),wc(pe,ae),pe.return=fe,pe;case y:return ae=Om(ae,fe.mode,pe),ae.return=fe,ae;case N:return ae=Cl(ae),Ee(fe,ae,pe)}if($(ae)||P(ae))return ae=yl(ae,fe.mode,pe,null),ae.return=fe,ae;if(typeof ae.then=="function")return Ee(fe,sd(ae),pe);if(ae.$$typeof===k)return Ee(fe,rd(fe,ae),pe);ld(fe,ae)}return null}function me(fe,ae,pe,Te){var ot=ae!==null?ae.key:null;if(typeof pe=="string"&&pe!==""||typeof pe=="number"||typeof pe=="bigint")return ot!==null?null:U(fe,ae,""+pe,Te);if(typeof pe=="object"&&pe!==null){switch(pe.$$typeof){case m:return pe.key===ot?ne(fe,ae,pe,Te):null;case y:return pe.key===ot?ge(fe,ae,pe,Te):null;case N:return pe=Cl(pe),me(fe,ae,pe,Te)}if($(pe)||P(pe))return ot!==null?null:Ce(fe,ae,pe,Te,null);if(typeof pe.then=="function")return me(fe,ae,sd(pe),Te);if(pe.$$typeof===k)return me(fe,ae,rd(fe,pe),Te);ld(fe,pe)}return null}function ye(fe,ae,pe,Te,ot){if(typeof Te=="string"&&Te!==""||typeof Te=="number"||typeof Te=="bigint")return fe=fe.get(pe)||null,U(ae,fe,""+Te,ot);if(typeof Te=="object"&&Te!==null){switch(Te.$$typeof){case m:return fe=fe.get(Te.key===null?pe:Te.key)||null,ne(ae,fe,Te,ot);case y:return fe=fe.get(Te.key===null?pe:Te.key)||null,ge(ae,fe,Te,ot);case N:return Te=Cl(Te),ye(fe,ae,pe,Te,ot)}if($(Te)||P(Te))return fe=fe.get(pe)||null,Ce(ae,fe,Te,ot,null);if(typeof Te.then=="function")return ye(fe,ae,pe,sd(Te),ot);if(Te.$$typeof===k)return ye(fe,ae,pe,rd(ae,Te),ot);ld(ae,Te)}return null}function tt(fe,ae,pe,Te){for(var ot=null,Lt=null,it=ae,xt=ae=0,Ot=null;it!==null&&xt<pe.length;xt++){it.index>xt?(Ot=it,it=null):Ot=it.sibling;var Pt=me(fe,it,pe[xt],Te);if(Pt===null){it===null&&(it=Ot);break}u&&it&&Pt.alternate===null&&f(fe,it),ae=T(Pt,ae,xt),Lt===null?ot=Pt:Lt.sibling=Pt,Lt=Pt,it=Ot}if(xt===pe.length)return p(fe,it),Rt&&Ca(fe,xt),ot;if(it===null){for(;xt<pe.length;xt++)it=Ee(fe,pe[xt],Te),it!==null&&(ae=T(it,ae,xt),Lt===null?ot=it:Lt.sibling=it,Lt=it);return Rt&&Ca(fe,xt),ot}for(it=v(it);xt<pe.length;xt++)Ot=ye(it,fe,xt,pe[xt],Te),Ot!==null&&(u&&Ot.alternate!==null&&it.delete(Ot.key===null?xt:Ot.key),ae=T(Ot,ae,xt),Lt===null?ot=Ot:Lt.sibling=Ot,Lt=Ot);return u&&it.forEach(function(Rs){return f(fe,Rs)}),Rt&&Ca(fe,xt),ot}function ht(fe,ae,pe,Te){if(pe==null)throw Error(n(151));for(var ot=null,Lt=null,it=ae,xt=ae=0,Ot=null,Pt=pe.next();it!==null&&!Pt.done;xt++,Pt=pe.next()){it.index>xt?(Ot=it,it=null):Ot=it.sibling;var Rs=me(fe,it,Pt.value,Te);if(Rs===null){it===null&&(it=Ot);break}u&&it&&Rs.alternate===null&&f(fe,it),ae=T(Rs,ae,xt),Lt===null?ot=Rs:Lt.sibling=Rs,Lt=Rs,it=Ot}if(Pt.done)return p(fe,it),Rt&&Ca(fe,xt),ot;if(it===null){for(;!Pt.done;xt++,Pt=pe.next())Pt=Ee(fe,Pt.value,Te),Pt!==null&&(ae=T(Pt,ae,xt),Lt===null?ot=Pt:Lt.sibling=Pt,Lt=Pt);return Rt&&Ca(fe,xt),ot}for(it=v(it);!Pt.done;xt++,Pt=pe.next())Pt=ye(it,fe,xt,Pt.value,Te),Pt!==null&&(u&&Pt.alternate!==null&&it.delete(Pt.key===null?xt:Pt.key),ae=T(Pt,ae,xt),Lt===null?ot=Pt:Lt.sibling=Pt,Lt=Pt);return u&&it.forEach(function(TU){return f(fe,TU)}),Rt&&Ca(fe,xt),ot}function Yt(fe,ae,pe,Te){if(typeof pe=="object"&&pe!==null&&pe.type===b&&pe.key===null&&(pe=pe.props.children),typeof pe=="object"&&pe!==null){switch(pe.$$typeof){case m:e:{for(var ot=pe.key;ae!==null;){if(ae.key===ot){if(ot=pe.type,ot===b){if(ae.tag===7){p(fe,ae.sibling),Te=C(ae,pe.props.children),Te.return=fe,fe=Te;break e}}else if(ae.elementType===ot||typeof ot=="object"&&ot!==null&&ot.$$typeof===N&&Cl(ot)===ae.type){p(fe,ae.sibling),Te=C(ae,pe.props),wc(Te,pe),Te.return=fe,fe=Te;break e}p(fe,ae);break}else f(fe,ae);ae=ae.sibling}pe.type===b?(Te=yl(pe.props.children,fe.mode,Te,pe.key),Te.return=fe,fe=Te):(Te=Jh(pe.type,pe.key,pe.props,null,fe.mode,Te),wc(Te,pe),Te.return=fe,fe=Te)}return L(fe);case y:e:{for(ot=pe.key;ae!==null;){if(ae.key===ot)if(ae.tag===4&&ae.stateNode.containerInfo===pe.containerInfo&&ae.stateNode.implementation===pe.implementation){p(fe,ae.sibling),Te=C(ae,pe.children||[]),Te.return=fe,fe=Te;break e}else{p(fe,ae);break}else f(fe,ae);ae=ae.sibling}Te=Om(pe,fe.mode,Te),Te.return=fe,fe=Te}return L(fe);case N:return pe=Cl(pe),Yt(fe,ae,pe,Te)}if($(pe))return tt(fe,ae,pe,Te);if(P(pe)){if(ot=P(pe),typeof ot!="function")throw Error(n(150));return pe=ot.call(pe),ht(fe,ae,pe,Te)}if(typeof pe.then=="function")return Yt(fe,ae,sd(pe),Te);if(pe.$$typeof===k)return Yt(fe,ae,rd(fe,pe),Te);ld(fe,pe)}return typeof pe=="string"&&pe!==""||typeof pe=="number"||typeof pe=="bigint"?(pe=""+pe,ae!==null&&ae.tag===6?(p(fe,ae.sibling),Te=C(ae,pe),Te.return=fe,fe=Te):(p(fe,ae),Te=Am(pe,fe.mode,Te),Te.return=fe,fe=Te),L(fe)):p(fe,ae)}return function(fe,ae,pe,Te){try{xc=0;var ot=Yt(fe,ae,pe,Te);return No=null,ot}catch(it){if(it===_o||it===id)throw it;var Lt=ti(29,it,null,fe.mode);return Lt.lanes=Te,Lt.return=fe,Lt}}}var Tl=lO(!0),oO=lO(!1),ds=!1;function jm(u){u.updateQueue={baseState:u.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Fm(u,f){u=u.updateQueue,f.updateQueue===u&&(f.updateQueue={baseState:u.baseState,firstBaseUpdate:u.firstBaseUpdate,lastBaseUpdate:u.lastBaseUpdate,shared:u.shared,callbacks:null})}function ps(u){return{lane:u,tag:0,payload:null,callback:null,next:null}}function gs(u,f,p){var v=u.updateQueue;if(v===null)return null;if(v=v.shared,(It&2)!==0){var C=v.pending;return C===null?f.next=f:(f.next=C.next,C.next=f),v.pending=f,f=Zh(u),$A(u,null,p),f}return Kh(u,v,f,p),Zh(u)}function Sc(u,f,p){if(f=f.updateQueue,f!==null&&(f=f.shared,(p&4194048)!==0)){var v=f.lanes;v&=u.pendingLanes,p|=v,f.lanes=p,Mt(u,p)}}function Hm(u,f){var p=u.updateQueue,v=u.alternate;if(v!==null&&(v=v.updateQueue,p===v)){var C=null,T=null;if(p=p.firstBaseUpdate,p!==null){do{var L={lane:p.lane,tag:p.tag,payload:p.payload,callback:null,next:null};T===null?C=T=L:T=T.next=L,p=p.next}while(p!==null);T===null?C=T=f:T=T.next=f}else C=T=f;p={baseState:v.baseState,firstBaseUpdate:C,lastBaseUpdate:T,shared:v.shared,callbacks:v.callbacks},u.updateQueue=p;return}u=p.lastBaseUpdate,u===null?p.firstBaseUpdate=f:u.next=f,p.lastBaseUpdate=f}var Vm=!1;function Cc(){if(Vm){var u=Do;if(u!==null)throw u}}function kc(u,f,p,v){Vm=!1;var C=u.updateQueue;ds=!1;var T=C.firstBaseUpdate,L=C.lastBaseUpdate,U=C.shared.pending;if(U!==null){C.shared.pending=null;var ne=U,ge=ne.next;ne.next=null,L===null?T=ge:L.next=ge,L=ne;var Ce=u.alternate;Ce!==null&&(Ce=Ce.updateQueue,U=Ce.lastBaseUpdate,U!==L&&(U===null?Ce.firstBaseUpdate=ge:U.next=ge,Ce.lastBaseUpdate=ne))}if(T!==null){var Ee=C.baseState;L=0,Ce=ge=ne=null,U=T;do{var me=U.lane&-536870913,ye=me!==U.lane;if(ye?(At&me)===me:(v&me)===me){me!==0&&me===Ro&&(Vm=!0),Ce!==null&&(Ce=Ce.next={lane:0,tag:U.tag,payload:U.payload,callback:null,next:null});e:{var tt=u,ht=U;me=f;var Yt=p;switch(ht.tag){case 1:if(tt=ht.payload,typeof tt=="function"){Ee=tt.call(Yt,Ee,me);break e}Ee=tt;break e;case 3:tt.flags=tt.flags&-65537|128;case 0:if(tt=ht.payload,me=typeof tt=="function"?tt.call(Yt,Ee,me):tt,me==null)break e;Ee=d({},Ee,me);break e;case 2:ds=!0}}me=U.callback,me!==null&&(u.flags|=64,ye&&(u.flags|=8192),ye=C.callbacks,ye===null?C.callbacks=[me]:ye.push(me))}else ye={lane:me,tag:U.tag,payload:U.payload,callback:U.callback,next:null},Ce===null?(ge=Ce=ye,ne=Ee):Ce=Ce.next=ye,L|=me;if(U=U.next,U===null){if(U=C.shared.pending,U===null)break;ye=U,U=ye.next,ye.next=null,C.lastBaseUpdate=ye,C.shared.pending=null}}while(!0);Ce===null&&(ne=Ee),C.baseState=ne,C.firstBaseUpdate=ge,C.lastBaseUpdate=Ce,T===null&&(C.shared.lanes=0),xs|=L,u.lanes=L,u.memoizedState=Ee}}function uO(u,f){if(typeof u!="function")throw Error(n(191,u));u.call(f)}function cO(u,f){var p=u.callbacks;if(p!==null)for(u.callbacks=null,u=0;u<p.length;u++)uO(p[u],f)}var Bo=I(null),od=I(0);function fO(u,f){u=Ba,re(od,u),re(Bo,f),Ba=u|f.baseLanes}function Um(){re(od,Ba),re(Bo,Bo.current)}function $m(){Ba=od.current,G(Bo),G(od)}var ri=I(null),bi=null;function vs(u){var f=u.alternate;re(br,br.current&1),re(ri,u),bi===null&&(f===null||Bo.current!==null||f.memoizedState!==null)&&(bi=u)}function Gm(u){re(br,br.current),re(ri,u),bi===null&&(bi=u)}function hO(u){u.tag===22?(re(br,br.current),re(ri,u),bi===null&&(bi=u)):ms()}function ms(){re(br,br.current),re(ri,ri.current)}function ni(u){G(ri),bi===u&&(bi=null),G(br)}var br=I(0);function ud(u){for(var f=u;f!==null;){if(f.tag===13){var p=f.memoizedState;if(p!==null&&(p=p.dehydrated,p===null||Z0(p)||J0(p)))return f}else if(f.tag===19&&(f.memoizedProps.revealOrder==="forwards"||f.memoizedProps.revealOrder==="backwards"||f.memoizedProps.revealOrder==="unstable_legacy-backwards"||f.memoizedProps.revealOrder==="together")){if((f.flags&128)!==0)return f}else if(f.child!==null){f.child.return=f,f=f.child;continue}if(f===u)break;for(;f.sibling===null;){if(f.return===null||f.return===u)return null;f=f.return}f.sibling.return=f.return,f=f.sibling}return null}var Ea=0,bt=null,$t=null,Er=null,cd=!1,Lo=!1,El=!1,fd=0,Tc=0,Po=null,gV=0;function dr(){throw Error(n(321))}function Ym(u,f){if(f===null)return!1;for(var p=0;p<f.length&&p<u.length;p++)if(!ei(u[p],f[p]))return!1;return!0}function Xm(u,f,p,v,C,T){return Ea=T,bt=f,f.memoizedState=null,f.updateQueue=null,f.lanes=0,q.H=u===null||u.memoizedState===null?WO:u0,El=!1,T=p(v,C),El=!1,Lo&&(T=pO(f,p,v,C)),dO(u),T}function dO(u){q.H=Oc;var f=$t!==null&&$t.next!==null;if(Ea=0,Er=$t=bt=null,cd=!1,Tc=0,Po=null,f)throw Error(n(300));u===null||Ar||(u=u.dependencies,u!==null&&td(u)&&(Ar=!0))}function pO(u,f,p,v){bt=u;var C=0;do{if(Lo&&(Po=null),Tc=0,Lo=!1,25<=C)throw Error(n(301));if(C+=1,Er=$t=null,u.updateQueue!=null){var T=u.updateQueue;T.lastEffect=null,T.events=null,T.stores=null,T.memoCache!=null&&(T.memoCache.index=0)}q.H=QO,T=f(p,v)}while(Lo);return T}function vV(){var u=q.H,f=u.useState()[0];return f=typeof f.then=="function"?Ec(f):f,u=u.useState()[0],($t!==null?$t.memoizedState:null)!==u&&(bt.flags|=1024),f}function Wm(){var u=fd!==0;return fd=0,u}function Qm(u,f,p){f.updateQueue=u.updateQueue,f.flags&=-2053,u.lanes&=~p}function Km(u){if(cd){for(u=u.memoizedState;u!==null;){var f=u.queue;f!==null&&(f.pending=null),u=u.next}cd=!1}Ea=0,Er=$t=bt=null,Lo=!1,Tc=fd=0,Po=null}function kn(){var u={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Er===null?bt.memoizedState=Er=u:Er=Er.next=u,Er}function xr(){if($t===null){var u=bt.alternate;u=u!==null?u.memoizedState:null}else u=$t.next;var f=Er===null?bt.memoizedState:Er.next;if(f!==null)Er=f,$t=u;else{if(u===null)throw bt.alternate===null?Error(n(467)):Error(n(310));$t=u,u={memoizedState:$t.memoizedState,baseState:$t.baseState,baseQueue:$t.baseQueue,queue:$t.queue,next:null},Er===null?bt.memoizedState=Er=u:Er=Er.next=u}return Er}function hd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ec(u){var f=Tc;return Tc+=1,Po===null&&(Po=[]),u=iO(Po,u,f),f=bt,(Er===null?f.memoizedState:Er.next)===null&&(f=f.alternate,q.H=f===null||f.memoizedState===null?WO:u0),u}function dd(u){if(u!==null&&typeof u=="object"){if(typeof u.then=="function")return Ec(u);if(u.$$typeof===k)return en(u)}throw Error(n(438,String(u)))}function Zm(u){var f=null,p=bt.updateQueue;if(p!==null&&(f=p.memoCache),f==null){var v=bt.alternate;v!==null&&(v=v.updateQueue,v!==null&&(v=v.memoCache,v!=null&&(f={data:v.data.map(function(C){return C.slice()}),index:0})))}if(f==null&&(f={data:[],index:0}),p===null&&(p=hd(),bt.updateQueue=p),p.memoCache=f,p=f.data[f.index],p===void 0)for(p=f.data[f.index]=Array(u),v=0;v<u;v++)p[v]=D;return f.index++,p}function Aa(u,f){return typeof f=="function"?f(u):f}function pd(u){var f=xr();return Jm(f,$t,u)}function Jm(u,f,p){var v=u.queue;if(v===null)throw Error(n(311));v.lastRenderedReducer=p;var C=u.baseQueue,T=v.pending;if(T!==null){if(C!==null){var L=C.next;C.next=T.next,T.next=L}f.baseQueue=C=T,v.pending=null}if(T=u.baseState,C===null)u.memoizedState=T;else{f=C.next;var U=L=null,ne=null,ge=f,Ce=!1;do{var Ee=ge.lane&-536870913;if(Ee!==ge.lane?(At&Ee)===Ee:(Ea&Ee)===Ee){var me=ge.revertLane;if(me===0)ne!==null&&(ne=ne.next={lane:0,revertLane:0,gesture:null,action:ge.action,hasEagerState:ge.hasEagerState,eagerState:ge.eagerState,next:null}),Ee===Ro&&(Ce=!0);else if((Ea&me)===me){ge=ge.next,me===Ro&&(Ce=!0);continue}else Ee={lane:0,revertLane:ge.revertLane,gesture:null,action:ge.action,hasEagerState:ge.hasEagerState,eagerState:ge.eagerState,next:null},ne===null?(U=ne=Ee,L=T):ne=ne.next=Ee,bt.lanes|=me,xs|=me;Ee=ge.action,El&&p(T,Ee),T=ge.hasEagerState?ge.eagerState:p(T,Ee)}else me={lane:Ee,revertLane:ge.revertLane,gesture:ge.gesture,action:ge.action,hasEagerState:ge.hasEagerState,eagerState:ge.eagerState,next:null},ne===null?(U=ne=me,L=T):ne=ne.next=me,bt.lanes|=Ee,xs|=Ee;ge=ge.next}while(ge!==null&&ge!==f);if(ne===null?L=T:ne.next=U,!ei(T,u.memoizedState)&&(Ar=!0,Ce&&(p=Do,p!==null)))throw p;u.memoizedState=T,u.baseState=L,u.baseQueue=ne,v.lastRenderedState=T}return C===null&&(v.lanes=0),[u.memoizedState,v.dispatch]}function e0(u){var f=xr(),p=f.queue;if(p===null)throw Error(n(311));p.lastRenderedReducer=u;var v=p.dispatch,C=p.pending,T=f.memoizedState;if(C!==null){p.pending=null;var L=C=C.next;do T=u(T,L.action),L=L.next;while(L!==C);ei(T,f.memoizedState)||(Ar=!0),f.memoizedState=T,f.baseQueue===null&&(f.baseState=T),p.lastRenderedState=T}return[T,v]}function gO(u,f,p){var v=bt,C=xr(),T=Rt;if(T){if(p===void 0)throw Error(n(407));p=p()}else p=f();var L=!ei(($t||C).memoizedState,p);if(L&&(C.memoizedState=p,Ar=!0),C=C.queue,n0(yO.bind(null,v,C,u),[u]),C.getSnapshot!==f||L||Er!==null&&Er.memoizedState.tag&1){if(v.flags|=2048,zo(9,{destroy:void 0},mO.bind(null,v,C,p,f),null),Qt===null)throw Error(n(349));T||(Ea&127)!==0||vO(v,f,p)}return p}function vO(u,f,p){u.flags|=16384,u={getSnapshot:f,value:p},f=bt.updateQueue,f===null?(f=hd(),bt.updateQueue=f,f.stores=[u]):(p=f.stores,p===null?f.stores=[u]:p.push(u))}function mO(u,f,p,v){f.value=p,f.getSnapshot=v,bO(f)&&xO(u)}function yO(u,f,p){return p(function(){bO(f)&&xO(u)})}function bO(u){var f=u.getSnapshot;u=u.value;try{var p=f();return!ei(u,p)}catch{return!0}}function xO(u){var f=ml(u,2);f!==null&&qn(f,u,2)}function t0(u){var f=kn();if(typeof u=="function"){var p=u;if(u=p(),El){oe(!0);try{p()}finally{oe(!1)}}}return f.memoizedState=f.baseState=u,f.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Aa,lastRenderedState:u},f}function wO(u,f,p,v){return u.baseState=p,Jm(u,$t,typeof v=="function"?v:Aa)}function mV(u,f,p,v,C){if(md(u))throw Error(n(485));if(u=f.action,u!==null){var T={payload:C,action:u,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(L){T.listeners.push(L)}};q.T!==null?p(!0):T.isTransition=!1,v(T),p=f.pending,p===null?(T.next=f.pending=T,SO(f,T)):(T.next=p.next,f.pending=p.next=T)}}function SO(u,f){var p=f.action,v=f.payload,C=u.state;if(f.isTransition){var T=q.T,L={};q.T=L;try{var U=p(C,v),ne=q.S;ne!==null&&ne(L,U),CO(u,f,U)}catch(ge){r0(u,f,ge)}finally{T!==null&&L.types!==null&&(T.types=L.types),q.T=T}}else try{T=p(C,v),CO(u,f,T)}catch(ge){r0(u,f,ge)}}function CO(u,f,p){p!==null&&typeof p=="object"&&typeof p.then=="function"?p.then(function(v){kO(u,f,v)},function(v){return r0(u,f,v)}):kO(u,f,p)}function kO(u,f,p){f.status="fulfilled",f.value=p,TO(f),u.state=p,f=u.pending,f!==null&&(p=f.next,p===f?u.pending=null:(p=p.next,f.next=p,SO(u,p)))}function r0(u,f,p){var v=u.pending;if(u.pending=null,v!==null){v=v.next;do f.status="rejected",f.reason=p,TO(f),f=f.next;while(f!==v)}u.action=null}function TO(u){u=u.listeners;for(var f=0;f<u.length;f++)(0,u[f])()}function EO(u,f){return f}function AO(u,f){if(Rt){var p=Qt.formState;if(p!==null){e:{var v=bt;if(Rt){if(ir){t:{for(var C=ir,T=yi;C.nodeType!==8;){if(!T){C=null;break t}if(C=xi(C.nextSibling),C===null){C=null;break t}}T=C.data,C=T==="F!"||T==="F"?C:null}if(C){ir=xi(C.nextSibling),v=C.data==="F!";break e}}fs(v)}v=!1}v&&(f=p[0])}}return p=kn(),p.memoizedState=p.baseState=f,v={pending:null,lanes:0,dispatch:null,lastRenderedReducer:EO,lastRenderedState:f},p.queue=v,p=GO.bind(null,bt,v),v.dispatch=p,v=t0(!1),T=o0.bind(null,bt,!1,v.queue),v=kn(),C={state:f,dispatch:null,action:u,pending:null},v.queue=C,p=mV.bind(null,bt,C,T,p),C.dispatch=p,v.memoizedState=u,[f,p,!1]}function OO(u){var f=xr();return MO(f,$t,u)}function MO(u,f,p){if(f=Jm(u,f,EO)[0],u=pd(Aa)[0],typeof f=="object"&&f!==null&&typeof f.then=="function")try{var v=Ec(f)}catch(L){throw L===_o?id:L}else v=f;f=xr();var C=f.queue,T=C.dispatch;return p!==f.memoizedState&&(bt.flags|=2048,zo(9,{destroy:void 0},yV.bind(null,C,p),null)),[v,T,u]}function yV(u,f){u.action=f}function RO(u){var f=xr(),p=$t;if(p!==null)return MO(f,p,u);xr(),f=f.memoizedState,p=xr();var v=p.queue.dispatch;return p.memoizedState=u,[f,v,!1]}function zo(u,f,p,v){return u={tag:u,create:p,deps:v,inst:f,next:null},f=bt.updateQueue,f===null&&(f=hd(),bt.updateQueue=f),p=f.lastEffect,p===null?f.lastEffect=u.next=u:(v=p.next,p.next=u,u.next=v,f.lastEffect=u),u}function DO(){return xr().memoizedState}function gd(u,f,p,v){var C=kn();bt.flags|=u,C.memoizedState=zo(1|f,{destroy:void 0},p,v===void 0?null:v)}function vd(u,f,p,v){var C=xr();v=v===void 0?null:v;var T=C.memoizedState.inst;$t!==null&&v!==null&&Ym(v,$t.memoizedState.deps)?C.memoizedState=zo(f,T,p,v):(bt.flags|=u,C.memoizedState=zo(1|f,T,p,v))}function _O(u,f){gd(8390656,8,u,f)}function n0(u,f){vd(2048,8,u,f)}function bV(u){bt.flags|=4;var f=bt.updateQueue;if(f===null)f=hd(),bt.updateQueue=f,f.events=[u];else{var p=f.events;p===null?f.events=[u]:p.push(u)}}function NO(u){var f=xr().memoizedState;return bV({ref:f,nextImpl:u}),function(){if((It&2)!==0)throw Error(n(440));return f.impl.apply(void 0,arguments)}}function BO(u,f){return vd(4,2,u,f)}function LO(u,f){return vd(4,4,u,f)}function PO(u,f){if(typeof f=="function"){u=u();var p=f(u);return function(){typeof p=="function"?p():f(null)}}if(f!=null)return u=u(),f.current=u,function(){f.current=null}}function zO(u,f,p){p=p!=null?p.concat([u]):null,vd(4,4,PO.bind(null,f,u),p)}function i0(){}function IO(u,f){var p=xr();f=f===void 0?null:f;var v=p.memoizedState;return f!==null&&Ym(f,v[1])?v[0]:(p.memoizedState=[u,f],u)}function qO(u,f){var p=xr();f=f===void 0?null:f;var v=p.memoizedState;if(f!==null&&Ym(f,v[1]))return v[0];if(v=u(),El){oe(!0);try{u()}finally{oe(!1)}}return p.memoizedState=[v,f],v}function a0(u,f,p){return p===void 0||(Ea&1073741824)!==0&&(At&261930)===0?u.memoizedState=f:(u.memoizedState=p,u=jM(),bt.lanes|=u,xs|=u,p)}function jO(u,f,p,v){return ei(p,f)?p:Bo.current!==null?(u=a0(u,p,v),ei(u,f)||(Ar=!0),u):(Ea&42)===0||(Ea&1073741824)!==0&&(At&261930)===0?(Ar=!0,u.memoizedState=p):(u=jM(),bt.lanes|=u,xs|=u,f)}function FO(u,f,p,v,C){var T=V.p;V.p=T!==0&&8>T?T:8;var L=q.T,U={};q.T=U,o0(u,!1,f,p);try{var ne=C(),ge=q.S;if(ge!==null&&ge(U,ne),ne!==null&&typeof ne=="object"&&typeof ne.then=="function"){var Ce=pV(ne,v);Ac(u,f,Ce,si(u))}else Ac(u,f,v,si(u))}catch(Ee){Ac(u,f,{then:function(){},status:"rejected",reason:Ee},si())}finally{V.p=T,L!==null&&U.types!==null&&(L.types=U.types),q.T=L}}function xV(){}function s0(u,f,p,v){if(u.tag!==5)throw Error(n(476));var C=HO(u).queue;FO(u,C,f,X,p===null?xV:function(){return VO(u),p(v)})}function HO(u){var f=u.memoizedState;if(f!==null)return f;f={memoizedState:X,baseState:X,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Aa,lastRenderedState:X},next:null};var p={};return f.next={memoizedState:p,baseState:p,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Aa,lastRenderedState:p},next:null},u.memoizedState=f,u=u.alternate,u!==null&&(u.memoizedState=f),f}function VO(u){var f=HO(u);f.next===null&&(f=u.alternate.memoizedState),Ac(u,f.next.queue,{},si())}function l0(){return en(Uc)}function UO(){return xr().memoizedState}function $O(){return xr().memoizedState}function wV(u){for(var f=u.return;f!==null;){switch(f.tag){case 24:case 3:var p=si();u=ps(p);var v=gs(f,u,p);v!==null&&(qn(v,f,p),Sc(v,f,p)),f={cache:Pm()},u.payload=f;return}f=f.return}}function SV(u,f,p){var v=si();p={lane:v,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},md(u)?YO(f,p):(p=Tm(u,f,p,v),p!==null&&(qn(p,u,v),XO(p,f,v)))}function GO(u,f,p){var v=si();Ac(u,f,p,v)}function Ac(u,f,p,v){var C={lane:v,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null};if(md(u))YO(f,C);else{var T=u.alternate;if(u.lanes===0&&(T===null||T.lanes===0)&&(T=f.lastRenderedReducer,T!==null))try{var L=f.lastRenderedState,U=T(L,p);if(C.hasEagerState=!0,C.eagerState=U,ei(U,L))return Kh(u,f,C,0),Qt===null&&Qh(),!1}catch{}if(p=Tm(u,f,C,v),p!==null)return qn(p,u,v),XO(p,f,v),!0}return!1}function o0(u,f,p,v){if(v={lane:2,revertLane:j0(),gesture:null,action:v,hasEagerState:!1,eagerState:null,next:null},md(u)){if(f)throw Error(n(479))}else f=Tm(u,p,v,2),f!==null&&qn(f,u,2)}function md(u){var f=u.alternate;return u===bt||f!==null&&f===bt}function YO(u,f){Lo=cd=!0;var p=u.pending;p===null?f.next=f:(f.next=p.next,p.next=f),u.pending=f}function XO(u,f,p){if((p&4194048)!==0){var v=f.lanes;v&=u.pendingLanes,p|=v,f.lanes=p,Mt(u,p)}}var Oc={readContext:en,use:dd,useCallback:dr,useContext:dr,useEffect:dr,useImperativeHandle:dr,useLayoutEffect:dr,useInsertionEffect:dr,useMemo:dr,useReducer:dr,useRef:dr,useState:dr,useDebugValue:dr,useDeferredValue:dr,useTransition:dr,useSyncExternalStore:dr,useId:dr,useHostTransitionStatus:dr,useFormState:dr,useActionState:dr,useOptimistic:dr,useMemoCache:dr,useCacheRefresh:dr};Oc.useEffectEvent=dr;var WO={readContext:en,use:dd,useCallback:function(u,f){return kn().memoizedState=[u,f===void 0?null:f],u},useContext:en,useEffect:_O,useImperativeHandle:function(u,f,p){p=p!=null?p.concat([u]):null,gd(4194308,4,PO.bind(null,f,u),p)},useLayoutEffect:function(u,f){return gd(4194308,4,u,f)},useInsertionEffect:function(u,f){gd(4,2,u,f)},useMemo:function(u,f){var p=kn();f=f===void 0?null:f;var v=u();if(El){oe(!0);try{u()}finally{oe(!1)}}return p.memoizedState=[v,f],v},useReducer:function(u,f,p){var v=kn();if(p!==void 0){var C=p(f);if(El){oe(!0);try{p(f)}finally{oe(!1)}}}else C=f;return v.memoizedState=v.baseState=C,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:C},v.queue=u,u=u.dispatch=SV.bind(null,bt,u),[v.memoizedState,u]},useRef:function(u){var f=kn();return u={current:u},f.memoizedState=u},useState:function(u){u=t0(u);var f=u.queue,p=GO.bind(null,bt,f);return f.dispatch=p,[u.memoizedState,p]},useDebugValue:i0,useDeferredValue:function(u,f){var p=kn();return a0(p,u,f)},useTransition:function(){var u=t0(!1);return u=FO.bind(null,bt,u.queue,!0,!1),kn().memoizedState=u,[!1,u]},useSyncExternalStore:function(u,f,p){var v=bt,C=kn();if(Rt){if(p===void 0)throw Error(n(407));p=p()}else{if(p=f(),Qt===null)throw Error(n(349));(At&127)!==0||vO(v,f,p)}C.memoizedState=p;var T={value:p,getSnapshot:f};return C.queue=T,_O(yO.bind(null,v,T,u),[u]),v.flags|=2048,zo(9,{destroy:void 0},mO.bind(null,v,T,p,f),null),p},useId:function(){var u=kn(),f=Qt.identifierPrefix;if(Rt){var p=Xi,v=Yi;p=(v&~(1<<32-le(v)-1)).toString(32)+p,f="_"+f+"R_"+p,p=fd++,0<p&&(f+="H"+p.toString(32)),f+="_"}else p=gV++,f="_"+f+"r_"+p.toString(32)+"_";return u.memoizedState=f},useHostTransitionStatus:l0,useFormState:AO,useActionState:AO,useOptimistic:function(u){var f=kn();f.memoizedState=f.baseState=u;var p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return f.queue=p,f=o0.bind(null,bt,!0,p),p.dispatch=f,[u,f]},useMemoCache:Zm,useCacheRefresh:function(){return kn().memoizedState=wV.bind(null,bt)},useEffectEvent:function(u){var f=kn(),p={impl:u};return f.memoizedState=p,function(){if((It&2)!==0)throw Error(n(440));return p.impl.apply(void 0,arguments)}}},u0={readContext:en,use:dd,useCallback:IO,useContext:en,useEffect:n0,useImperativeHandle:zO,useInsertionEffect:BO,useLayoutEffect:LO,useMemo:qO,useReducer:pd,useRef:DO,useState:function(){return pd(Aa)},useDebugValue:i0,useDeferredValue:function(u,f){var p=xr();return jO(p,$t.memoizedState,u,f)},useTransition:function(){var u=pd(Aa)[0],f=xr().memoizedState;return[typeof u=="boolean"?u:Ec(u),f]},useSyncExternalStore:gO,useId:UO,useHostTransitionStatus:l0,useFormState:OO,useActionState:OO,useOptimistic:function(u,f){var p=xr();return wO(p,$t,u,f)},useMemoCache:Zm,useCacheRefresh:$O};u0.useEffectEvent=NO;var QO={readContext:en,use:dd,useCallback:IO,useContext:en,useEffect:n0,useImperativeHandle:zO,useInsertionEffect:BO,useLayoutEffect:LO,useMemo:qO,useReducer:e0,useRef:DO,useState:function(){return e0(Aa)},useDebugValue:i0,useDeferredValue:function(u,f){var p=xr();return $t===null?a0(p,u,f):jO(p,$t.memoizedState,u,f)},useTransition:function(){var u=e0(Aa)[0],f=xr().memoizedState;return[typeof u=="boolean"?u:Ec(u),f]},useSyncExternalStore:gO,useId:UO,useHostTransitionStatus:l0,useFormState:RO,useActionState:RO,useOptimistic:function(u,f){var p=xr();return $t!==null?wO(p,$t,u,f):(p.baseState=u,[u,p.queue.dispatch])},useMemoCache:Zm,useCacheRefresh:$O};QO.useEffectEvent=NO;function c0(u,f,p,v){f=u.memoizedState,p=p(v,f),p=p==null?f:d({},f,p),u.memoizedState=p,u.lanes===0&&(u.updateQueue.baseState=p)}var f0={enqueueSetState:function(u,f,p){u=u._reactInternals;var v=si(),C=ps(v);C.payload=f,p!=null&&(C.callback=p),f=gs(u,C,v),f!==null&&(qn(f,u,v),Sc(f,u,v))},enqueueReplaceState:function(u,f,p){u=u._reactInternals;var v=si(),C=ps(v);C.tag=1,C.payload=f,p!=null&&(C.callback=p),f=gs(u,C,v),f!==null&&(qn(f,u,v),Sc(f,u,v))},enqueueForceUpdate:function(u,f){u=u._reactInternals;var p=si(),v=ps(p);v.tag=2,f!=null&&(v.callback=f),f=gs(u,v,p),f!==null&&(qn(f,u,p),Sc(f,u,p))}};function KO(u,f,p,v,C,T,L){return u=u.stateNode,typeof u.shouldComponentUpdate=="function"?u.shouldComponentUpdate(v,T,L):f.prototype&&f.prototype.isPureReactComponent?!pc(p,v)||!pc(C,T):!0}function ZO(u,f,p,v){u=f.state,typeof f.componentWillReceiveProps=="function"&&f.componentWillReceiveProps(p,v),typeof f.UNSAFE_componentWillReceiveProps=="function"&&f.UNSAFE_componentWillReceiveProps(p,v),f.state!==u&&f0.enqueueReplaceState(f,f.state,null)}function Al(u,f){var p=f;if("ref"in f){p={};for(var v in f)v!=="ref"&&(p[v]=f[v])}if(u=u.defaultProps){p===f&&(p=d({},p));for(var C in u)p[C]===void 0&&(p[C]=u[C])}return p}function JO(u){Wh(u)}function eM(u){console.error(u)}function tM(u){Wh(u)}function yd(u,f){try{var p=u.onUncaughtError;p(f.value,{componentStack:f.stack})}catch(v){setTimeout(function(){throw v})}}function rM(u,f,p){try{var v=u.onCaughtError;v(p.value,{componentStack:p.stack,errorBoundary:f.tag===1?f.stateNode:null})}catch(C){setTimeout(function(){throw C})}}function h0(u,f,p){return p=ps(p),p.tag=3,p.payload={element:null},p.callback=function(){yd(u,f)},p}function nM(u){return u=ps(u),u.tag=3,u}function iM(u,f,p,v){var C=p.type.getDerivedStateFromError;if(typeof C=="function"){var T=v.value;u.payload=function(){return C(T)},u.callback=function(){rM(f,p,v)}}var L=p.stateNode;L!==null&&typeof L.componentDidCatch=="function"&&(u.callback=function(){rM(f,p,v),typeof C!="function"&&(ws===null?ws=new Set([this]):ws.add(this));var U=v.stack;this.componentDidCatch(v.value,{componentStack:U!==null?U:""})})}function CV(u,f,p,v,C){if(p.flags|=32768,v!==null&&typeof v=="object"&&typeof v.then=="function"){if(f=p.alternate,f!==null&&Mo(f,p,C,!0),p=ri.current,p!==null){switch(p.tag){case 31:case 13:return bi===null?Rd():p.alternate===null&&pr===0&&(pr=3),p.flags&=-257,p.flags|=65536,p.lanes=C,v===ad?p.flags|=16384:(f=p.updateQueue,f===null?p.updateQueue=new Set([v]):f.add(v),z0(u,v,C)),!1;case 22:return p.flags|=65536,v===ad?p.flags|=16384:(f=p.updateQueue,f===null?(f={transitions:null,markerInstances:null,retryQueue:new Set([v])},p.updateQueue=f):(p=f.retryQueue,p===null?f.retryQueue=new Set([v]):p.add(v)),z0(u,v,C)),!1}throw Error(n(435,p.tag))}return z0(u,v,C),Rd(),!1}if(Rt)return f=ri.current,f!==null?((f.flags&65536)===0&&(f.flags|=256),f.flags|=65536,f.lanes=C,v!==Dm&&(u=Error(n(422),{cause:v}),mc(gi(u,p)))):(v!==Dm&&(f=Error(n(423),{cause:v}),mc(gi(f,p))),u=u.current.alternate,u.flags|=65536,C&=-C,u.lanes|=C,v=gi(v,p),C=h0(u.stateNode,v,C),Hm(u,C),pr!==4&&(pr=2)),!1;var T=Error(n(520),{cause:v});if(T=gi(T,p),Pc===null?Pc=[T]:Pc.push(T),pr!==4&&(pr=2),f===null)return!0;v=gi(v,p),p=f;do{switch(p.tag){case 3:return p.flags|=65536,u=C&-C,p.lanes|=u,u=h0(p.stateNode,v,u),Hm(p,u),!1;case 1:if(f=p.type,T=p.stateNode,(p.flags&128)===0&&(typeof f.getDerivedStateFromError=="function"||T!==null&&typeof T.componentDidCatch=="function"&&(ws===null||!ws.has(T))))return p.flags|=65536,C&=-C,p.lanes|=C,C=nM(C),iM(C,u,p,v),Hm(p,C),!1}p=p.return}while(p!==null);return!1}var d0=Error(n(461)),Ar=!1;function tn(u,f,p,v){f.child=u===null?oO(f,null,p,v):Tl(f,u.child,p,v)}function aM(u,f,p,v,C){p=p.render;var T=f.ref;if("ref"in v){var L={};for(var U in v)U!=="ref"&&(L[U]=v[U])}else L=v;return wl(f),v=Xm(u,f,p,L,T,C),U=Wm(),u!==null&&!Ar?(Qm(u,f,C),Oa(u,f,C)):(Rt&&U&&Mm(f),f.flags|=1,tn(u,f,v,C),f.child)}function sM(u,f,p,v,C){if(u===null){var T=p.type;return typeof T=="function"&&!Em(T)&&T.defaultProps===void 0&&p.compare===null?(f.tag=15,f.type=T,lM(u,f,T,v,C)):(u=Jh(p.type,null,v,f,f.mode,C),u.ref=f.ref,u.return=f,f.child=u)}if(T=u.child,!w0(u,C)){var L=T.memoizedProps;if(p=p.compare,p=p!==null?p:pc,p(L,v)&&u.ref===f.ref)return Oa(u,f,C)}return f.flags|=1,u=Sa(T,v),u.ref=f.ref,u.return=f,f.child=u}function lM(u,f,p,v,C){if(u!==null){var T=u.memoizedProps;if(pc(T,v)&&u.ref===f.ref)if(Ar=!1,f.pendingProps=v=T,w0(u,C))(u.flags&131072)!==0&&(Ar=!0);else return f.lanes=u.lanes,Oa(u,f,C)}return p0(u,f,p,v,C)}function oM(u,f,p,v){var C=v.children,T=u!==null?u.memoizedState:null;if(u===null&&f.stateNode===null&&(f.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),v.mode==="hidden"){if((f.flags&128)!==0){if(T=T!==null?T.baseLanes|p:p,u!==null){for(v=f.child=u.child,C=0;v!==null;)C=C|v.lanes|v.childLanes,v=v.sibling;v=C&~T}else v=0,f.child=null;return uM(u,f,T,p,v)}if((p&536870912)!==0)f.memoizedState={baseLanes:0,cachePool:null},u!==null&&nd(f,T!==null?T.cachePool:null),T!==null?fO(f,T):Um(),hO(f);else return v=f.lanes=536870912,uM(u,f,T!==null?T.baseLanes|p:p,p,v)}else T!==null?(nd(f,T.cachePool),fO(f,T),ms(),f.memoizedState=null):(u!==null&&nd(f,null),Um(),ms());return tn(u,f,C,p),f.child}function Mc(u,f){return u!==null&&u.tag===22||f.stateNode!==null||(f.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.sibling}function uM(u,f,p,v,C){var T=Im();return T=T===null?null:{parent:Tr._currentValue,pool:T},f.memoizedState={baseLanes:p,cachePool:T},u!==null&&nd(f,null),Um(),hO(f),u!==null&&Mo(u,f,v,!0),f.childLanes=C,null}function bd(u,f){return f=wd({mode:f.mode,children:f.children},u.mode),f.ref=u.ref,u.child=f,f.return=u,f}function cM(u,f,p){return Tl(f,u.child,null,p),u=bd(f,f.pendingProps),u.flags|=2,ni(f),f.memoizedState=null,u}function kV(u,f,p){var v=f.pendingProps,C=(f.flags&128)!==0;if(f.flags&=-129,u===null){if(Rt){if(v.mode==="hidden")return u=bd(f,v),f.lanes=536870912,Mc(null,u);if(Gm(f),(u=ir)?(u=SR(u,yi),u=u!==null&&u.data==="&"?u:null,u!==null&&(f.memoizedState={dehydrated:u,treeContext:us!==null?{id:Yi,overflow:Xi}:null,retryLane:536870912,hydrationErrors:null},p=YA(u),p.return=f,f.child=p,Jr=f,ir=null)):u=null,u===null)throw fs(f);return f.lanes=536870912,null}return bd(f,v)}var T=u.memoizedState;if(T!==null){var L=T.dehydrated;if(Gm(f),C)if(f.flags&256)f.flags&=-257,f=cM(u,f,p);else if(f.memoizedState!==null)f.child=u.child,f.flags|=128,f=null;else throw Error(n(558));else if(Ar||Mo(u,f,p,!1),C=(p&u.childLanes)!==0,Ar||C){if(v=Qt,v!==null&&(L=Ft(v,p),L!==0&&L!==T.retryLane))throw T.retryLane=L,ml(u,L),qn(v,u,L),d0;Rd(),f=cM(u,f,p)}else u=T.treeContext,ir=xi(L.nextSibling),Jr=f,Rt=!0,cs=null,yi=!1,u!==null&&QA(f,u),f=bd(f,v),f.flags|=4096;return f}return u=Sa(u.child,{mode:v.mode,children:v.children}),u.ref=f.ref,f.child=u,u.return=f,u}function xd(u,f){var p=f.ref;if(p===null)u!==null&&u.ref!==null&&(f.flags|=4194816);else{if(typeof p!="function"&&typeof p!="object")throw Error(n(284));(u===null||u.ref!==p)&&(f.flags|=4194816)}}function p0(u,f,p,v,C){return wl(f),p=Xm(u,f,p,v,void 0,C),v=Wm(),u!==null&&!Ar?(Qm(u,f,C),Oa(u,f,C)):(Rt&&v&&Mm(f),f.flags|=1,tn(u,f,p,C),f.child)}function fM(u,f,p,v,C,T){return wl(f),f.updateQueue=null,p=pO(f,v,p,C),dO(u),v=Wm(),u!==null&&!Ar?(Qm(u,f,T),Oa(u,f,T)):(Rt&&v&&Mm(f),f.flags|=1,tn(u,f,p,T),f.child)}function hM(u,f,p,v,C){if(wl(f),f.stateNode===null){var T=To,L=p.contextType;typeof L=="object"&&L!==null&&(T=en(L)),T=new p(v,T),f.memoizedState=T.state!==null&&T.state!==void 0?T.state:null,T.updater=f0,f.stateNode=T,T._reactInternals=f,T=f.stateNode,T.props=v,T.state=f.memoizedState,T.refs={},jm(f),L=p.contextType,T.context=typeof L=="object"&&L!==null?en(L):To,T.state=f.memoizedState,L=p.getDerivedStateFromProps,typeof L=="function"&&(c0(f,p,L,v),T.state=f.memoizedState),typeof p.getDerivedStateFromProps=="function"||typeof T.getSnapshotBeforeUpdate=="function"||typeof T.UNSAFE_componentWillMount!="function"&&typeof T.componentWillMount!="function"||(L=T.state,typeof T.componentWillMount=="function"&&T.componentWillMount(),typeof T.UNSAFE_componentWillMount=="function"&&T.UNSAFE_componentWillMount(),L!==T.state&&f0.enqueueReplaceState(T,T.state,null),kc(f,v,T,C),Cc(),T.state=f.memoizedState),typeof T.componentDidMount=="function"&&(f.flags|=4194308),v=!0}else if(u===null){T=f.stateNode;var U=f.memoizedProps,ne=Al(p,U);T.props=ne;var ge=T.context,Ce=p.contextType;L=To,typeof Ce=="object"&&Ce!==null&&(L=en(Ce));var Ee=p.getDerivedStateFromProps;Ce=typeof Ee=="function"||typeof T.getSnapshotBeforeUpdate=="function",U=f.pendingProps!==U,Ce||typeof T.UNSAFE_componentWillReceiveProps!="function"&&typeof T.componentWillReceiveProps!="function"||(U||ge!==L)&&ZO(f,T,v,L),ds=!1;var me=f.memoizedState;T.state=me,kc(f,v,T,C),Cc(),ge=f.memoizedState,U||me!==ge||ds?(typeof Ee=="function"&&(c0(f,p,Ee,v),ge=f.memoizedState),(ne=ds||KO(f,p,ne,v,me,ge,L))?(Ce||typeof T.UNSAFE_componentWillMount!="function"&&typeof T.componentWillMount!="function"||(typeof T.componentWillMount=="function"&&T.componentWillMount(),typeof T.UNSAFE_componentWillMount=="function"&&T.UNSAFE_componentWillMount()),typeof T.componentDidMount=="function"&&(f.flags|=4194308)):(typeof T.componentDidMount=="function"&&(f.flags|=4194308),f.memoizedProps=v,f.memoizedState=ge),T.props=v,T.state=ge,T.context=L,v=ne):(typeof T.componentDidMount=="function"&&(f.flags|=4194308),v=!1)}else{T=f.stateNode,Fm(u,f),L=f.memoizedProps,Ce=Al(p,L),T.props=Ce,Ee=f.pendingProps,me=T.context,ge=p.contextType,ne=To,typeof ge=="object"&&ge!==null&&(ne=en(ge)),U=p.getDerivedStateFromProps,(ge=typeof U=="function"||typeof T.getSnapshotBeforeUpdate=="function")||typeof T.UNSAFE_componentWillReceiveProps!="function"&&typeof T.componentWillReceiveProps!="function"||(L!==Ee||me!==ne)&&ZO(f,T,v,ne),ds=!1,me=f.memoizedState,T.state=me,kc(f,v,T,C),Cc();var ye=f.memoizedState;L!==Ee||me!==ye||ds||u!==null&&u.dependencies!==null&&td(u.dependencies)?(typeof U=="function"&&(c0(f,p,U,v),ye=f.memoizedState),(Ce=ds||KO(f,p,Ce,v,me,ye,ne)||u!==null&&u.dependencies!==null&&td(u.dependencies))?(ge||typeof T.UNSAFE_componentWillUpdate!="function"&&typeof T.componentWillUpdate!="function"||(typeof T.componentWillUpdate=="function"&&T.componentWillUpdate(v,ye,ne),typeof T.UNSAFE_componentWillUpdate=="function"&&T.UNSAFE_componentWillUpdate(v,ye,ne)),typeof T.componentDidUpdate=="function"&&(f.flags|=4),typeof T.getSnapshotBeforeUpdate=="function"&&(f.flags|=1024)):(typeof T.componentDidUpdate!="function"||L===u.memoizedProps&&me===u.memoizedState||(f.flags|=4),typeof T.getSnapshotBeforeUpdate!="function"||L===u.memoizedProps&&me===u.memoizedState||(f.flags|=1024),f.memoizedProps=v,f.memoizedState=ye),T.props=v,T.state=ye,T.context=ne,v=Ce):(typeof T.componentDidUpdate!="function"||L===u.memoizedProps&&me===u.memoizedState||(f.flags|=4),typeof T.getSnapshotBeforeUpdate!="function"||L===u.memoizedProps&&me===u.memoizedState||(f.flags|=1024),v=!1)}return T=v,xd(u,f),v=(f.flags&128)!==0,T||v?(T=f.stateNode,p=v&&typeof p.getDerivedStateFromError!="function"?null:T.render(),f.flags|=1,u!==null&&v?(f.child=Tl(f,u.child,null,C),f.child=Tl(f,null,p,C)):tn(u,f,p,C),f.memoizedState=T.state,u=f.child):u=Oa(u,f,C),u}function dM(u,f,p,v){return bl(),f.flags|=256,tn(u,f,p,v),f.child}var g0={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function v0(u){return{baseLanes:u,cachePool:rO()}}function m0(u,f,p){return u=u!==null?u.childLanes&~p:0,f&&(u|=ai),u}function pM(u,f,p){var v=f.pendingProps,C=!1,T=(f.flags&128)!==0,L;if((L=T)||(L=u!==null&&u.memoizedState===null?!1:(br.current&2)!==0),L&&(C=!0,f.flags&=-129),L=(f.flags&32)!==0,f.flags&=-33,u===null){if(Rt){if(C?vs(f):ms(),(u=ir)?(u=SR(u,yi),u=u!==null&&u.data!=="&"?u:null,u!==null&&(f.memoizedState={dehydrated:u,treeContext:us!==null?{id:Yi,overflow:Xi}:null,retryLane:536870912,hydrationErrors:null},p=YA(u),p.return=f,f.child=p,Jr=f,ir=null)):u=null,u===null)throw fs(f);return J0(u)?f.lanes=32:f.lanes=536870912,null}var U=v.children;return v=v.fallback,C?(ms(),C=f.mode,U=wd({mode:"hidden",children:U},C),v=yl(v,C,p,null),U.return=f,v.return=f,U.sibling=v,f.child=U,v=f.child,v.memoizedState=v0(p),v.childLanes=m0(u,L,p),f.memoizedState=g0,Mc(null,v)):(vs(f),y0(f,U))}var ne=u.memoizedState;if(ne!==null&&(U=ne.dehydrated,U!==null)){if(T)f.flags&256?(vs(f),f.flags&=-257,f=b0(u,f,p)):f.memoizedState!==null?(ms(),f.child=u.child,f.flags|=128,f=null):(ms(),U=v.fallback,C=f.mode,v=wd({mode:"visible",children:v.children},C),U=yl(U,C,p,null),U.flags|=2,v.return=f,U.return=f,v.sibling=U,f.child=v,Tl(f,u.child,null,p),v=f.child,v.memoizedState=v0(p),v.childLanes=m0(u,L,p),f.memoizedState=g0,f=Mc(null,v));else if(vs(f),J0(U)){if(L=U.nextSibling&&U.nextSibling.dataset,L)var ge=L.dgst;L=ge,v=Error(n(419)),v.stack="",v.digest=L,mc({value:v,source:null,stack:null}),f=b0(u,f,p)}else if(Ar||Mo(u,f,p,!1),L=(p&u.childLanes)!==0,Ar||L){if(L=Qt,L!==null&&(v=Ft(L,p),v!==0&&v!==ne.retryLane))throw ne.retryLane=v,ml(u,v),qn(L,u,v),d0;Z0(U)||Rd(),f=b0(u,f,p)}else Z0(U)?(f.flags|=192,f.child=u.child,f=null):(u=ne.treeContext,ir=xi(U.nextSibling),Jr=f,Rt=!0,cs=null,yi=!1,u!==null&&QA(f,u),f=y0(f,v.children),f.flags|=4096);return f}return C?(ms(),U=v.fallback,C=f.mode,ne=u.child,ge=ne.sibling,v=Sa(ne,{mode:"hidden",children:v.children}),v.subtreeFlags=ne.subtreeFlags&65011712,ge!==null?U=Sa(ge,U):(U=yl(U,C,p,null),U.flags|=2),U.return=f,v.return=f,v.sibling=U,f.child=v,Mc(null,v),v=f.child,U=u.child.memoizedState,U===null?U=v0(p):(C=U.cachePool,C!==null?(ne=Tr._currentValue,C=C.parent!==ne?{parent:ne,pool:ne}:C):C=rO(),U={baseLanes:U.baseLanes|p,cachePool:C}),v.memoizedState=U,v.childLanes=m0(u,L,p),f.memoizedState=g0,Mc(u.child,v)):(vs(f),p=u.child,u=p.sibling,p=Sa(p,{mode:"visible",children:v.children}),p.return=f,p.sibling=null,u!==null&&(L=f.deletions,L===null?(f.deletions=[u],f.flags|=16):L.push(u)),f.child=p,f.memoizedState=null,p)}function y0(u,f){return f=wd({mode:"visible",children:f},u.mode),f.return=u,u.child=f}function wd(u,f){return u=ti(22,u,null,f),u.lanes=0,u}function b0(u,f,p){return Tl(f,u.child,null,p),u=y0(f,f.pendingProps.children),u.flags|=2,f.memoizedState=null,u}function gM(u,f,p){u.lanes|=f;var v=u.alternate;v!==null&&(v.lanes|=f),Bm(u.return,f,p)}function x0(u,f,p,v,C,T){var L=u.memoizedState;L===null?u.memoizedState={isBackwards:f,rendering:null,renderingStartTime:0,last:v,tail:p,tailMode:C,treeForkCount:T}:(L.isBackwards=f,L.rendering=null,L.renderingStartTime=0,L.last=v,L.tail=p,L.tailMode=C,L.treeForkCount=T)}function vM(u,f,p){var v=f.pendingProps,C=v.revealOrder,T=v.tail;v=v.children;var L=br.current,U=(L&2)!==0;if(U?(L=L&1|2,f.flags|=128):L&=1,re(br,L),tn(u,f,v,p),v=Rt?vc:0,!U&&u!==null&&(u.flags&128)!==0)e:for(u=f.child;u!==null;){if(u.tag===13)u.memoizedState!==null&&gM(u,p,f);else if(u.tag===19)gM(u,p,f);else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===f)break e;for(;u.sibling===null;){if(u.return===null||u.return===f)break e;u=u.return}u.sibling.return=u.return,u=u.sibling}switch(C){case"forwards":for(p=f.child,C=null;p!==null;)u=p.alternate,u!==null&&ud(u)===null&&(C=p),p=p.sibling;p=C,p===null?(C=f.child,f.child=null):(C=p.sibling,p.sibling=null),x0(f,!1,C,p,T,v);break;case"backwards":case"unstable_legacy-backwards":for(p=null,C=f.child,f.child=null;C!==null;){if(u=C.alternate,u!==null&&ud(u)===null){f.child=C;break}u=C.sibling,C.sibling=p,p=C,C=u}x0(f,!0,p,null,T,v);break;case"together":x0(f,!1,null,null,void 0,v);break;default:f.memoizedState=null}return f.child}function Oa(u,f,p){if(u!==null&&(f.dependencies=u.dependencies),xs|=f.lanes,(p&f.childLanes)===0)if(u!==null){if(Mo(u,f,p,!1),(p&f.childLanes)===0)return null}else return null;if(u!==null&&f.child!==u.child)throw Error(n(153));if(f.child!==null){for(u=f.child,p=Sa(u,u.pendingProps),f.child=p,p.return=f;u.sibling!==null;)u=u.sibling,p=p.sibling=Sa(u,u.pendingProps),p.return=f;p.sibling=null}return f.child}function w0(u,f){return(u.lanes&f)!==0?!0:(u=u.dependencies,!!(u!==null&&td(u)))}function TV(u,f,p){switch(f.tag){case 3:we(f,f.stateNode.containerInfo),hs(f,Tr,u.memoizedState.cache),bl();break;case 27:case 5:se(f);break;case 4:we(f,f.stateNode.containerInfo);break;case 10:hs(f,f.type,f.memoizedProps.value);break;case 31:if(f.memoizedState!==null)return f.flags|=128,Gm(f),null;break;case 13:var v=f.memoizedState;if(v!==null)return v.dehydrated!==null?(vs(f),f.flags|=128,null):(p&f.child.childLanes)!==0?pM(u,f,p):(vs(f),u=Oa(u,f,p),u!==null?u.sibling:null);vs(f);break;case 19:var C=(u.flags&128)!==0;if(v=(p&f.childLanes)!==0,v||(Mo(u,f,p,!1),v=(p&f.childLanes)!==0),C){if(v)return vM(u,f,p);f.flags|=128}if(C=f.memoizedState,C!==null&&(C.rendering=null,C.tail=null,C.lastEffect=null),re(br,br.current),v)break;return null;case 22:return f.lanes=0,oM(u,f,p,f.pendingProps);case 24:hs(f,Tr,u.memoizedState.cache)}return Oa(u,f,p)}function mM(u,f,p){if(u!==null)if(u.memoizedProps!==f.pendingProps)Ar=!0;else{if(!w0(u,p)&&(f.flags&128)===0)return Ar=!1,TV(u,f,p);Ar=(u.flags&131072)!==0}else Ar=!1,Rt&&(f.flags&1048576)!==0&&WA(f,vc,f.index);switch(f.lanes=0,f.tag){case 16:e:{var v=f.pendingProps;if(u=Cl(f.elementType),f.type=u,typeof u=="function")Em(u)?(v=Al(u,v),f.tag=1,f=hM(null,f,u,v,p)):(f.tag=0,f=p0(null,f,u,v,p));else{if(u!=null){var C=u.$$typeof;if(C===E){f.tag=11,f=aM(null,f,u,v,p);break e}else if(C===O){f.tag=14,f=sM(null,f,u,v,p);break e}}throw f=H(u)||u,Error(n(306,f,""))}}return f;case 0:return p0(u,f,f.type,f.pendingProps,p);case 1:return v=f.type,C=Al(v,f.pendingProps),hM(u,f,v,C,p);case 3:e:{if(we(f,f.stateNode.containerInfo),u===null)throw Error(n(387));v=f.pendingProps;var T=f.memoizedState;C=T.element,Fm(u,f),kc(f,v,null,p);var L=f.memoizedState;if(v=L.cache,hs(f,Tr,v),v!==T.cache&&Lm(f,[Tr],p,!0),Cc(),v=L.element,T.isDehydrated)if(T={element:v,isDehydrated:!1,cache:L.cache},f.updateQueue.baseState=T,f.memoizedState=T,f.flags&256){f=dM(u,f,v,p);break e}else if(v!==C){C=gi(Error(n(424)),f),mc(C),f=dM(u,f,v,p);break e}else for(u=f.stateNode.containerInfo,u.nodeType===9?u=u.body:u=u.nodeName==="HTML"?u.ownerDocument.body:u,ir=xi(u.firstChild),Jr=f,Rt=!0,cs=null,yi=!0,p=oO(f,null,v,p),f.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(bl(),v===C){f=Oa(u,f,p);break e}tn(u,f,v,p)}f=f.child}return f;case 26:return xd(u,f),u===null?(p=OR(f.type,null,f.pendingProps,null))?f.memoizedState=p:Rt||(p=f.type,u=f.pendingProps,v=zd(Z.current).createElement(p),v[lr]=f,v[Nr]=u,rn(v,p,u),kr(v),f.stateNode=v):f.memoizedState=OR(f.type,u.memoizedProps,f.pendingProps,u.memoizedState),null;case 27:return se(f),u===null&&Rt&&(v=f.stateNode=TR(f.type,f.pendingProps,Z.current),Jr=f,yi=!0,C=ir,Ts(f.type)?(ey=C,ir=xi(v.firstChild)):ir=C),tn(u,f,f.pendingProps.children,p),xd(u,f),u===null&&(f.flags|=4194304),f.child;case 5:return u===null&&Rt&&((C=v=ir)&&(v=tU(v,f.type,f.pendingProps,yi),v!==null?(f.stateNode=v,Jr=f,ir=xi(v.firstChild),yi=!1,C=!0):C=!1),C||fs(f)),se(f),C=f.type,T=f.pendingProps,L=u!==null?u.memoizedProps:null,v=T.children,W0(C,T)?v=null:L!==null&&W0(C,L)&&(f.flags|=32),f.memoizedState!==null&&(C=Xm(u,f,vV,null,null,p),Uc._currentValue=C),xd(u,f),tn(u,f,v,p),f.child;case 6:return u===null&&Rt&&((u=p=ir)&&(p=rU(p,f.pendingProps,yi),p!==null?(f.stateNode=p,Jr=f,ir=null,u=!0):u=!1),u||fs(f)),null;case 13:return pM(u,f,p);case 4:return we(f,f.stateNode.containerInfo),v=f.pendingProps,u===null?f.child=Tl(f,null,v,p):tn(u,f,v,p),f.child;case 11:return aM(u,f,f.type,f.pendingProps,p);case 7:return tn(u,f,f.pendingProps,p),f.child;case 8:return tn(u,f,f.pendingProps.children,p),f.child;case 12:return tn(u,f,f.pendingProps.children,p),f.child;case 10:return v=f.pendingProps,hs(f,f.type,v.value),tn(u,f,v.children,p),f.child;case 9:return C=f.type._context,v=f.pendingProps.children,wl(f),C=en(C),v=v(C),f.flags|=1,tn(u,f,v,p),f.child;case 14:return sM(u,f,f.type,f.pendingProps,p);case 15:return lM(u,f,f.type,f.pendingProps,p);case 19:return vM(u,f,p);case 31:return kV(u,f,p);case 22:return oM(u,f,p,f.pendingProps);case 24:return wl(f),v=en(Tr),u===null?(C=Im(),C===null&&(C=Qt,T=Pm(),C.pooledCache=T,T.refCount++,T!==null&&(C.pooledCacheLanes|=p),C=T),f.memoizedState={parent:v,cache:C},jm(f),hs(f,Tr,C)):((u.lanes&p)!==0&&(Fm(u,f),kc(f,null,null,p),Cc()),C=u.memoizedState,T=f.memoizedState,C.parent!==v?(C={parent:v,cache:v},f.memoizedState=C,f.lanes===0&&(f.memoizedState=f.updateQueue.baseState=C),hs(f,Tr,v)):(v=T.cache,hs(f,Tr,v),v!==C.cache&&Lm(f,[Tr],p,!0))),tn(u,f,f.pendingProps.children,p),f.child;case 29:throw f.pendingProps}throw Error(n(156,f.tag))}function Ma(u){u.flags|=4}function S0(u,f,p,v,C){if((f=(u.mode&32)!==0)&&(f=!1),f){if(u.flags|=16777216,(C&335544128)===C)if(u.stateNode.complete)u.flags|=8192;else if(UM())u.flags|=8192;else throw kl=ad,qm}else u.flags&=-16777217}function yM(u,f){if(f.type!=="stylesheet"||(f.state.loading&4)!==0)u.flags&=-16777217;else if(u.flags|=16777216,!NR(f))if(UM())u.flags|=8192;else throw kl=ad,qm}function Sd(u,f){f!==null&&(u.flags|=4),u.flags&16384&&(f=u.tag!==22?rt():536870912,u.lanes|=f,Fo|=f)}function Rc(u,f){if(!Rt)switch(u.tailMode){case"hidden":f=u.tail;for(var p=null;f!==null;)f.alternate!==null&&(p=f),f=f.sibling;p===null?u.tail=null:p.sibling=null;break;case"collapsed":p=u.tail;for(var v=null;p!==null;)p.alternate!==null&&(v=p),p=p.sibling;v===null?f||u.tail===null?u.tail=null:u.tail.sibling=null:v.sibling=null}}function ar(u){var f=u.alternate!==null&&u.alternate.child===u.child,p=0,v=0;if(f)for(var C=u.child;C!==null;)p|=C.lanes|C.childLanes,v|=C.subtreeFlags&65011712,v|=C.flags&65011712,C.return=u,C=C.sibling;else for(C=u.child;C!==null;)p|=C.lanes|C.childLanes,v|=C.subtreeFlags,v|=C.flags,C.return=u,C=C.sibling;return u.subtreeFlags|=v,u.childLanes=p,f}function EV(u,f,p){var v=f.pendingProps;switch(Rm(f),f.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ar(f),null;case 1:return ar(f),null;case 3:return p=f.stateNode,v=null,u!==null&&(v=u.memoizedState.cache),f.memoizedState.cache!==v&&(f.flags|=2048),Ta(Tr),de(),p.pendingContext&&(p.context=p.pendingContext,p.pendingContext=null),(u===null||u.child===null)&&(Oo(f)?Ma(f):u===null||u.memoizedState.isDehydrated&&(f.flags&256)===0||(f.flags|=1024,_m())),ar(f),null;case 26:var C=f.type,T=f.memoizedState;return u===null?(Ma(f),T!==null?(ar(f),yM(f,T)):(ar(f),S0(f,C,null,v,p))):T?T!==u.memoizedState?(Ma(f),ar(f),yM(f,T)):(ar(f),f.flags&=-16777217):(u=u.memoizedProps,u!==v&&Ma(f),ar(f),S0(f,C,u,v,p)),null;case 27:if(j(f),p=Z.current,C=f.type,u!==null&&f.stateNode!=null)u.memoizedProps!==v&&Ma(f);else{if(!v){if(f.stateNode===null)throw Error(n(166));return ar(f),null}u=Y.current,Oo(f)?KA(f):(u=TR(C,v,p),f.stateNode=u,Ma(f))}return ar(f),null;case 5:if(j(f),C=f.type,u!==null&&f.stateNode!=null)u.memoizedProps!==v&&Ma(f);else{if(!v){if(f.stateNode===null)throw Error(n(166));return ar(f),null}if(T=Y.current,Oo(f))KA(f);else{var L=zd(Z.current);switch(T){case 1:T=L.createElementNS("http://www.w3.org/2000/svg",C);break;case 2:T=L.createElementNS("http://www.w3.org/1998/Math/MathML",C);break;default:switch(C){case"svg":T=L.createElementNS("http://www.w3.org/2000/svg",C);break;case"math":T=L.createElementNS("http://www.w3.org/1998/Math/MathML",C);break;case"script":T=L.createElement("div"),T.innerHTML="<script><\/script>",T=T.removeChild(T.firstChild);break;case"select":T=typeof v.is=="string"?L.createElement("select",{is:v.is}):L.createElement("select"),v.multiple?T.multiple=!0:v.size&&(T.size=v.size);break;default:T=typeof v.is=="string"?L.createElement(C,{is:v.is}):L.createElement(C)}}T[lr]=f,T[Nr]=v;e:for(L=f.child;L!==null;){if(L.tag===5||L.tag===6)T.appendChild(L.stateNode);else if(L.tag!==4&&L.tag!==27&&L.child!==null){L.child.return=L,L=L.child;continue}if(L===f)break e;for(;L.sibling===null;){if(L.return===null||L.return===f)break e;L=L.return}L.sibling.return=L.return,L=L.sibling}f.stateNode=T;e:switch(rn(T,C,v),C){case"button":case"input":case"select":case"textarea":v=!!v.autoFocus;break e;case"img":v=!0;break e;default:v=!1}v&&Ma(f)}}return ar(f),S0(f,f.type,u===null?null:u.memoizedProps,f.pendingProps,p),null;case 6:if(u&&f.stateNode!=null)u.memoizedProps!==v&&Ma(f);else{if(typeof v!="string"&&f.stateNode===null)throw Error(n(166));if(u=Z.current,Oo(f)){if(u=f.stateNode,p=f.memoizedProps,v=null,C=Jr,C!==null)switch(C.tag){case 27:case 5:v=C.memoizedProps}u[lr]=f,u=!!(u.nodeValue===p||v!==null&&v.suppressHydrationWarning===!0||pR(u.nodeValue,p)),u||fs(f,!0)}else u=zd(u).createTextNode(v),u[lr]=f,f.stateNode=u}return ar(f),null;case 31:if(p=f.memoizedState,u===null||u.memoizedState!==null){if(v=Oo(f),p!==null){if(u===null){if(!v)throw Error(n(318));if(u=f.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(n(557));u[lr]=f}else bl(),(f.flags&128)===0&&(f.memoizedState=null),f.flags|=4;ar(f),u=!1}else p=_m(),u!==null&&u.memoizedState!==null&&(u.memoizedState.hydrationErrors=p),u=!0;if(!u)return f.flags&256?(ni(f),f):(ni(f),null);if((f.flags&128)!==0)throw Error(n(558))}return ar(f),null;case 13:if(v=f.memoizedState,u===null||u.memoizedState!==null&&u.memoizedState.dehydrated!==null){if(C=Oo(f),v!==null&&v.dehydrated!==null){if(u===null){if(!C)throw Error(n(318));if(C=f.memoizedState,C=C!==null?C.dehydrated:null,!C)throw Error(n(317));C[lr]=f}else bl(),(f.flags&128)===0&&(f.memoizedState=null),f.flags|=4;ar(f),C=!1}else C=_m(),u!==null&&u.memoizedState!==null&&(u.memoizedState.hydrationErrors=C),C=!0;if(!C)return f.flags&256?(ni(f),f):(ni(f),null)}return ni(f),(f.flags&128)!==0?(f.lanes=p,f):(p=v!==null,u=u!==null&&u.memoizedState!==null,p&&(v=f.child,C=null,v.alternate!==null&&v.alternate.memoizedState!==null&&v.alternate.memoizedState.cachePool!==null&&(C=v.alternate.memoizedState.cachePool.pool),T=null,v.memoizedState!==null&&v.memoizedState.cachePool!==null&&(T=v.memoizedState.cachePool.pool),T!==C&&(v.flags|=2048)),p!==u&&p&&(f.child.flags|=8192),Sd(f,f.updateQueue),ar(f),null);case 4:return de(),u===null&&U0(f.stateNode.containerInfo),ar(f),null;case 10:return Ta(f.type),ar(f),null;case 19:if(G(br),v=f.memoizedState,v===null)return ar(f),null;if(C=(f.flags&128)!==0,T=v.rendering,T===null)if(C)Rc(v,!1);else{if(pr!==0||u!==null&&(u.flags&128)!==0)for(u=f.child;u!==null;){if(T=ud(u),T!==null){for(f.flags|=128,Rc(v,!1),u=T.updateQueue,f.updateQueue=u,Sd(f,u),f.subtreeFlags=0,u=p,p=f.child;p!==null;)GA(p,u),p=p.sibling;return re(br,br.current&1|2),Rt&&Ca(f,v.treeForkCount),f.child}u=u.sibling}v.tail!==null&&je()>Ad&&(f.flags|=128,C=!0,Rc(v,!1),f.lanes=4194304)}else{if(!C)if(u=ud(T),u!==null){if(f.flags|=128,C=!0,u=u.updateQueue,f.updateQueue=u,Sd(f,u),Rc(v,!0),v.tail===null&&v.tailMode==="hidden"&&!T.alternate&&!Rt)return ar(f),null}else 2*je()-v.renderingStartTime>Ad&&p!==536870912&&(f.flags|=128,C=!0,Rc(v,!1),f.lanes=4194304);v.isBackwards?(T.sibling=f.child,f.child=T):(u=v.last,u!==null?u.sibling=T:f.child=T,v.last=T)}return v.tail!==null?(u=v.tail,v.rendering=u,v.tail=u.sibling,v.renderingStartTime=je(),u.sibling=null,p=br.current,re(br,C?p&1|2:p&1),Rt&&Ca(f,v.treeForkCount),u):(ar(f),null);case 22:case 23:return ni(f),$m(),v=f.memoizedState!==null,u!==null?u.memoizedState!==null!==v&&(f.flags|=8192):v&&(f.flags|=8192),v?(p&536870912)!==0&&(f.flags&128)===0&&(ar(f),f.subtreeFlags&6&&(f.flags|=8192)):ar(f),p=f.updateQueue,p!==null&&Sd(f,p.retryQueue),p=null,u!==null&&u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(p=u.memoizedState.cachePool.pool),v=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(v=f.memoizedState.cachePool.pool),v!==p&&(f.flags|=2048),u!==null&&G(Sl),null;case 24:return p=null,u!==null&&(p=u.memoizedState.cache),f.memoizedState.cache!==p&&(f.flags|=2048),Ta(Tr),ar(f),null;case 25:return null;case 30:return null}throw Error(n(156,f.tag))}function AV(u,f){switch(Rm(f),f.tag){case 1:return u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 3:return Ta(Tr),de(),u=f.flags,(u&65536)!==0&&(u&128)===0?(f.flags=u&-65537|128,f):null;case 26:case 27:case 5:return j(f),null;case 31:if(f.memoizedState!==null){if(ni(f),f.alternate===null)throw Error(n(340));bl()}return u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 13:if(ni(f),u=f.memoizedState,u!==null&&u.dehydrated!==null){if(f.alternate===null)throw Error(n(340));bl()}return u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 19:return G(br),null;case 4:return de(),null;case 10:return Ta(f.type),null;case 22:case 23:return ni(f),$m(),u!==null&&G(Sl),u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 24:return Ta(Tr),null;case 25:return null;default:return null}}function bM(u,f){switch(Rm(f),f.tag){case 3:Ta(Tr),de();break;case 26:case 27:case 5:j(f);break;case 4:de();break;case 31:f.memoizedState!==null&&ni(f);break;case 13:ni(f);break;case 19:G(br);break;case 10:Ta(f.type);break;case 22:case 23:ni(f),$m(),u!==null&&G(Sl);break;case 24:Ta(Tr)}}function Dc(u,f){try{var p=f.updateQueue,v=p!==null?p.lastEffect:null;if(v!==null){var C=v.next;p=C;do{if((p.tag&u)===u){v=void 0;var T=p.create,L=p.inst;v=T(),L.destroy=v}p=p.next}while(p!==C)}}catch(U){Vt(f,f.return,U)}}function ys(u,f,p){try{var v=f.updateQueue,C=v!==null?v.lastEffect:null;if(C!==null){var T=C.next;v=T;do{if((v.tag&u)===u){var L=v.inst,U=L.destroy;if(U!==void 0){L.destroy=void 0,C=f;var ne=p,ge=U;try{ge()}catch(Ce){Vt(C,ne,Ce)}}}v=v.next}while(v!==T)}}catch(Ce){Vt(f,f.return,Ce)}}function xM(u){var f=u.updateQueue;if(f!==null){var p=u.stateNode;try{cO(f,p)}catch(v){Vt(u,u.return,v)}}}function wM(u,f,p){p.props=Al(u.type,u.memoizedProps),p.state=u.memoizedState;try{p.componentWillUnmount()}catch(v){Vt(u,f,v)}}function _c(u,f){try{var p=u.ref;if(p!==null){switch(u.tag){case 26:case 27:case 5:var v=u.stateNode;break;case 30:v=u.stateNode;break;default:v=u.stateNode}typeof p=="function"?u.refCleanup=p(v):p.current=v}}catch(C){Vt(u,f,C)}}function Wi(u,f){var p=u.ref,v=u.refCleanup;if(p!==null)if(typeof v=="function")try{v()}catch(C){Vt(u,f,C)}finally{u.refCleanup=null,u=u.alternate,u!=null&&(u.refCleanup=null)}else if(typeof p=="function")try{p(null)}catch(C){Vt(u,f,C)}else p.current=null}function SM(u){var f=u.type,p=u.memoizedProps,v=u.stateNode;try{e:switch(f){case"button":case"input":case"select":case"textarea":p.autoFocus&&v.focus();break e;case"img":p.src?v.src=p.src:p.srcSet&&(v.srcset=p.srcSet)}}catch(C){Vt(u,u.return,C)}}function C0(u,f,p){try{var v=u.stateNode;WV(v,u.type,p,f),v[Nr]=f}catch(C){Vt(u,u.return,C)}}function CM(u){return u.tag===5||u.tag===3||u.tag===26||u.tag===27&&Ts(u.type)||u.tag===4}function k0(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||CM(u.return))return null;u=u.return}for(u.sibling.return=u.return,u=u.sibling;u.tag!==5&&u.tag!==6&&u.tag!==18;){if(u.tag===27&&Ts(u.type)||u.flags&2||u.child===null||u.tag===4)continue e;u.child.return=u,u=u.child}if(!(u.flags&2))return u.stateNode}}function T0(u,f,p){var v=u.tag;if(v===5||v===6)u=u.stateNode,f?(p.nodeType===9?p.body:p.nodeName==="HTML"?p.ownerDocument.body:p).insertBefore(u,f):(f=p.nodeType===9?p.body:p.nodeName==="HTML"?p.ownerDocument.body:p,f.appendChild(u),p=p._reactRootContainer,p!=null||f.onclick!==null||(f.onclick=xa));else if(v!==4&&(v===27&&Ts(u.type)&&(p=u.stateNode,f=null),u=u.child,u!==null))for(T0(u,f,p),u=u.sibling;u!==null;)T0(u,f,p),u=u.sibling}function Cd(u,f,p){var v=u.tag;if(v===5||v===6)u=u.stateNode,f?p.insertBefore(u,f):p.appendChild(u);else if(v!==4&&(v===27&&Ts(u.type)&&(p=u.stateNode),u=u.child,u!==null))for(Cd(u,f,p),u=u.sibling;u!==null;)Cd(u,f,p),u=u.sibling}function kM(u){var f=u.stateNode,p=u.memoizedProps;try{for(var v=u.type,C=f.attributes;C.length;)f.removeAttributeNode(C[0]);rn(f,v,p),f[lr]=u,f[Nr]=p}catch(T){Vt(u,u.return,T)}}var Ra=!1,Or=!1,E0=!1,TM=typeof WeakSet=="function"?WeakSet:Set,Gr=null;function OV(u,f){if(u=u.containerInfo,Y0=Ud,u=zA(u),bm(u)){if("selectionStart"in u)var p={start:u.selectionStart,end:u.selectionEnd};else e:{p=(p=u.ownerDocument)&&p.defaultView||window;var v=p.getSelection&&p.getSelection();if(v&&v.rangeCount!==0){p=v.anchorNode;var C=v.anchorOffset,T=v.focusNode;v=v.focusOffset;try{p.nodeType,T.nodeType}catch{p=null;break e}var L=0,U=-1,ne=-1,ge=0,Ce=0,Ee=u,me=null;t:for(;;){for(var ye;Ee!==p||C!==0&&Ee.nodeType!==3||(U=L+C),Ee!==T||v!==0&&Ee.nodeType!==3||(ne=L+v),Ee.nodeType===3&&(L+=Ee.nodeValue.length),(ye=Ee.firstChild)!==null;)me=Ee,Ee=ye;for(;;){if(Ee===u)break t;if(me===p&&++ge===C&&(U=L),me===T&&++Ce===v&&(ne=L),(ye=Ee.nextSibling)!==null)break;Ee=me,me=Ee.parentNode}Ee=ye}p=U===-1||ne===-1?null:{start:U,end:ne}}else p=null}p=p||{start:0,end:0}}else p=null;for(X0={focusedElem:u,selectionRange:p},Ud=!1,Gr=f;Gr!==null;)if(f=Gr,u=f.child,(f.subtreeFlags&1028)!==0&&u!==null)u.return=f,Gr=u;else for(;Gr!==null;){switch(f=Gr,T=f.alternate,u=f.flags,f.tag){case 0:if((u&4)!==0&&(u=f.updateQueue,u=u!==null?u.events:null,u!==null))for(p=0;p<u.length;p++)C=u[p],C.ref.impl=C.nextImpl;break;case 11:case 15:break;case 1:if((u&1024)!==0&&T!==null){u=void 0,p=f,C=T.memoizedProps,T=T.memoizedState,v=p.stateNode;try{var tt=Al(p.type,C);u=v.getSnapshotBeforeUpdate(tt,T),v.__reactInternalSnapshotBeforeUpdate=u}catch(ht){Vt(p,p.return,ht)}}break;case 3:if((u&1024)!==0){if(u=f.stateNode.containerInfo,p=u.nodeType,p===9)K0(u);else if(p===1)switch(u.nodeName){case"HEAD":case"HTML":case"BODY":K0(u);break;default:u.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((u&1024)!==0)throw Error(n(163))}if(u=f.sibling,u!==null){u.return=f.return,Gr=u;break}Gr=f.return}}function EM(u,f,p){var v=p.flags;switch(p.tag){case 0:case 11:case 15:_a(u,p),v&4&&Dc(5,p);break;case 1:if(_a(u,p),v&4)if(u=p.stateNode,f===null)try{u.componentDidMount()}catch(L){Vt(p,p.return,L)}else{var C=Al(p.type,f.memoizedProps);f=f.memoizedState;try{u.componentDidUpdate(C,f,u.__reactInternalSnapshotBeforeUpdate)}catch(L){Vt(p,p.return,L)}}v&64&&xM(p),v&512&&_c(p,p.return);break;case 3:if(_a(u,p),v&64&&(u=p.updateQueue,u!==null)){if(f=null,p.child!==null)switch(p.child.tag){case 27:case 5:f=p.child.stateNode;break;case 1:f=p.child.stateNode}try{cO(u,f)}catch(L){Vt(p,p.return,L)}}break;case 27:f===null&&v&4&&kM(p);case 26:case 5:_a(u,p),f===null&&v&4&&SM(p),v&512&&_c(p,p.return);break;case 12:_a(u,p);break;case 31:_a(u,p),v&4&&MM(u,p);break;case 13:_a(u,p),v&4&&RM(u,p),v&64&&(u=p.memoizedState,u!==null&&(u=u.dehydrated,u!==null&&(p=zV.bind(null,p),nU(u,p))));break;case 22:if(v=p.memoizedState!==null||Ra,!v){f=f!==null&&f.memoizedState!==null||Or,C=Ra;var T=Or;Ra=v,(Or=f)&&!T?Na(u,p,(p.subtreeFlags&8772)!==0):_a(u,p),Ra=C,Or=T}break;case 30:break;default:_a(u,p)}}function AM(u){var f=u.alternate;f!==null&&(u.alternate=null,AM(f)),u.child=null,u.deletions=null,u.sibling=null,u.tag===5&&(f=u.stateNode,f!==null&&go(f)),u.stateNode=null,u.return=null,u.dependencies=null,u.memoizedProps=null,u.memoizedState=null,u.pendingProps=null,u.stateNode=null,u.updateQueue=null}var or=null,Ln=!1;function Da(u,f,p){for(p=p.child;p!==null;)OM(u,f,p),p=p.sibling}function OM(u,f,p){if(J&&typeof J.onCommitFiberUnmount=="function")try{J.onCommitFiberUnmount(F,p)}catch{}switch(p.tag){case 26:Or||Wi(p,f),Da(u,f,p),p.memoizedState?p.memoizedState.count--:p.stateNode&&(p=p.stateNode,p.parentNode.removeChild(p));break;case 27:Or||Wi(p,f);var v=or,C=Ln;Ts(p.type)&&(or=p.stateNode,Ln=!1),Da(u,f,p),Fc(p.stateNode),or=v,Ln=C;break;case 5:Or||Wi(p,f);case 6:if(v=or,C=Ln,or=null,Da(u,f,p),or=v,Ln=C,or!==null)if(Ln)try{(or.nodeType===9?or.body:or.nodeName==="HTML"?or.ownerDocument.body:or).removeChild(p.stateNode)}catch(T){Vt(p,f,T)}else try{or.removeChild(p.stateNode)}catch(T){Vt(p,f,T)}break;case 18:or!==null&&(Ln?(u=or,xR(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,p.stateNode),Wo(u)):xR(or,p.stateNode));break;case 4:v=or,C=Ln,or=p.stateNode.containerInfo,Ln=!0,Da(u,f,p),or=v,Ln=C;break;case 0:case 11:case 14:case 15:ys(2,p,f),Or||ys(4,p,f),Da(u,f,p);break;case 1:Or||(Wi(p,f),v=p.stateNode,typeof v.componentWillUnmount=="function"&&wM(p,f,v)),Da(u,f,p);break;case 21:Da(u,f,p);break;case 22:Or=(v=Or)||p.memoizedState!==null,Da(u,f,p),Or=v;break;default:Da(u,f,p)}}function MM(u,f){if(f.memoizedState===null&&(u=f.alternate,u!==null&&(u=u.memoizedState,u!==null))){u=u.dehydrated;try{Wo(u)}catch(p){Vt(f,f.return,p)}}}function RM(u,f){if(f.memoizedState===null&&(u=f.alternate,u!==null&&(u=u.memoizedState,u!==null&&(u=u.dehydrated,u!==null))))try{Wo(u)}catch(p){Vt(f,f.return,p)}}function MV(u){switch(u.tag){case 31:case 13:case 19:var f=u.stateNode;return f===null&&(f=u.stateNode=new TM),f;case 22:return u=u.stateNode,f=u._retryCache,f===null&&(f=u._retryCache=new TM),f;default:throw Error(n(435,u.tag))}}function kd(u,f){var p=MV(u);f.forEach(function(v){if(!p.has(v)){p.add(v);var C=IV.bind(null,u,v);v.then(C,C)}})}function Pn(u,f){var p=f.deletions;if(p!==null)for(var v=0;v<p.length;v++){var C=p[v],T=u,L=f,U=L;e:for(;U!==null;){switch(U.tag){case 27:if(Ts(U.type)){or=U.stateNode,Ln=!1;break e}break;case 5:or=U.stateNode,Ln=!1;break e;case 3:case 4:or=U.stateNode.containerInfo,Ln=!0;break e}U=U.return}if(or===null)throw Error(n(160));OM(T,L,C),or=null,Ln=!1,T=C.alternate,T!==null&&(T.return=null),C.return=null}if(f.subtreeFlags&13886)for(f=f.child;f!==null;)DM(f,u),f=f.sibling}var Ni=null;function DM(u,f){var p=u.alternate,v=u.flags;switch(u.tag){case 0:case 11:case 14:case 15:Pn(f,u),zn(u),v&4&&(ys(3,u,u.return),Dc(3,u),ys(5,u,u.return));break;case 1:Pn(f,u),zn(u),v&512&&(Or||p===null||Wi(p,p.return)),v&64&&Ra&&(u=u.updateQueue,u!==null&&(v=u.callbacks,v!==null&&(p=u.shared.hiddenCallbacks,u.shared.hiddenCallbacks=p===null?v:p.concat(v))));break;case 26:var C=Ni;if(Pn(f,u),zn(u),v&512&&(Or||p===null||Wi(p,p.return)),v&4){var T=p!==null?p.memoizedState:null;if(v=u.memoizedState,p===null)if(v===null)if(u.stateNode===null){e:{v=u.type,p=u.memoizedProps,C=C.ownerDocument||C;t:switch(v){case"title":T=C.getElementsByTagName("title")[0],(!T||T[Ur]||T[lr]||T.namespaceURI==="http://www.w3.org/2000/svg"||T.hasAttribute("itemprop"))&&(T=C.createElement(v),C.head.insertBefore(T,C.querySelector("head > title"))),rn(T,v,p),T[lr]=u,kr(T),v=T;break e;case"link":var L=DR("link","href",C).get(v+(p.href||""));if(L){for(var U=0;U<L.length;U++)if(T=L[U],T.getAttribute("href")===(p.href==null||p.href===""?null:p.href)&&T.getAttribute("rel")===(p.rel==null?null:p.rel)&&T.getAttribute("title")===(p.title==null?null:p.title)&&T.getAttribute("crossorigin")===(p.crossOrigin==null?null:p.crossOrigin)){L.splice(U,1);break t}}T=C.createElement(v),rn(T,v,p),C.head.appendChild(T);break;case"meta":if(L=DR("meta","content",C).get(v+(p.content||""))){for(U=0;U<L.length;U++)if(T=L[U],T.getAttribute("content")===(p.content==null?null:""+p.content)&&T.getAttribute("name")===(p.name==null?null:p.name)&&T.getAttribute("property")===(p.property==null?null:p.property)&&T.getAttribute("http-equiv")===(p.httpEquiv==null?null:p.httpEquiv)&&T.getAttribute("charset")===(p.charSet==null?null:p.charSet)){L.splice(U,1);break t}}T=C.createElement(v),rn(T,v,p),C.head.appendChild(T);break;default:throw Error(n(468,v))}T[lr]=u,kr(T),v=T}u.stateNode=v}else _R(C,u.type,u.stateNode);else u.stateNode=RR(C,v,u.memoizedProps);else T!==v?(T===null?p.stateNode!==null&&(p=p.stateNode,p.parentNode.removeChild(p)):T.count--,v===null?_R(C,u.type,u.stateNode):RR(C,v,u.memoizedProps)):v===null&&u.stateNode!==null&&C0(u,u.memoizedProps,p.memoizedProps)}break;case 27:Pn(f,u),zn(u),v&512&&(Or||p===null||Wi(p,p.return)),p!==null&&v&4&&C0(u,u.memoizedProps,p.memoizedProps);break;case 5:if(Pn(f,u),zn(u),v&512&&(Or||p===null||Wi(p,p.return)),u.flags&32){C=u.stateNode;try{yo(C,"")}catch(tt){Vt(u,u.return,tt)}}v&4&&u.stateNode!=null&&(C=u.memoizedProps,C0(u,C,p!==null?p.memoizedProps:C)),v&1024&&(E0=!0);break;case 6:if(Pn(f,u),zn(u),v&4){if(u.stateNode===null)throw Error(n(162));v=u.memoizedProps,p=u.stateNode;try{p.nodeValue=v}catch(tt){Vt(u,u.return,tt)}}break;case 3:if(jd=null,C=Ni,Ni=Id(f.containerInfo),Pn(f,u),Ni=C,zn(u),v&4&&p!==null&&p.memoizedState.isDehydrated)try{Wo(f.containerInfo)}catch(tt){Vt(u,u.return,tt)}E0&&(E0=!1,_M(u));break;case 4:v=Ni,Ni=Id(u.stateNode.containerInfo),Pn(f,u),zn(u),Ni=v;break;case 12:Pn(f,u),zn(u);break;case 31:Pn(f,u),zn(u),v&4&&(v=u.updateQueue,v!==null&&(u.updateQueue=null,kd(u,v)));break;case 13:Pn(f,u),zn(u),u.child.flags&8192&&u.memoizedState!==null!=(p!==null&&p.memoizedState!==null)&&(Ed=je()),v&4&&(v=u.updateQueue,v!==null&&(u.updateQueue=null,kd(u,v)));break;case 22:C=u.memoizedState!==null;var ne=p!==null&&p.memoizedState!==null,ge=Ra,Ce=Or;if(Ra=ge||C,Or=Ce||ne,Pn(f,u),Or=Ce,Ra=ge,zn(u),v&8192)e:for(f=u.stateNode,f._visibility=C?f._visibility&-2:f._visibility|1,C&&(p===null||ne||Ra||Or||Ol(u)),p=null,f=u;;){if(f.tag===5||f.tag===26){if(p===null){ne=p=f;try{if(T=ne.stateNode,C)L=T.style,typeof L.setProperty=="function"?L.setProperty("display","none","important"):L.display="none";else{U=ne.stateNode;var Ee=ne.memoizedProps.style,me=Ee!=null&&Ee.hasOwnProperty("display")?Ee.display:null;U.style.display=me==null||typeof me=="boolean"?"":(""+me).trim()}}catch(tt){Vt(ne,ne.return,tt)}}}else if(f.tag===6){if(p===null){ne=f;try{ne.stateNode.nodeValue=C?"":ne.memoizedProps}catch(tt){Vt(ne,ne.return,tt)}}}else if(f.tag===18){if(p===null){ne=f;try{var ye=ne.stateNode;C?wR(ye,!0):wR(ne.stateNode,!1)}catch(tt){Vt(ne,ne.return,tt)}}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===u)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===u)break e;for(;f.sibling===null;){if(f.return===null||f.return===u)break e;p===f&&(p=null),f=f.return}p===f&&(p=null),f.sibling.return=f.return,f=f.sibling}v&4&&(v=u.updateQueue,v!==null&&(p=v.retryQueue,p!==null&&(v.retryQueue=null,kd(u,p))));break;case 19:Pn(f,u),zn(u),v&4&&(v=u.updateQueue,v!==null&&(u.updateQueue=null,kd(u,v)));break;case 30:break;case 21:break;default:Pn(f,u),zn(u)}}function zn(u){var f=u.flags;if(f&2){try{for(var p,v=u.return;v!==null;){if(CM(v)){p=v;break}v=v.return}if(p==null)throw Error(n(160));switch(p.tag){case 27:var C=p.stateNode,T=k0(u);Cd(u,T,C);break;case 5:var L=p.stateNode;p.flags&32&&(yo(L,""),p.flags&=-33);var U=k0(u);Cd(u,U,L);break;case 3:case 4:var ne=p.stateNode.containerInfo,ge=k0(u);T0(u,ge,ne);break;default:throw Error(n(161))}}catch(Ce){Vt(u,u.return,Ce)}u.flags&=-3}f&4096&&(u.flags&=-4097)}function _M(u){if(u.subtreeFlags&1024)for(u=u.child;u!==null;){var f=u;_M(f),f.tag===5&&f.flags&1024&&f.stateNode.reset(),u=u.sibling}}function _a(u,f){if(f.subtreeFlags&8772)for(f=f.child;f!==null;)EM(u,f.alternate,f),f=f.sibling}function Ol(u){for(u=u.child;u!==null;){var f=u;switch(f.tag){case 0:case 11:case 14:case 15:ys(4,f,f.return),Ol(f);break;case 1:Wi(f,f.return);var p=f.stateNode;typeof p.componentWillUnmount=="function"&&wM(f,f.return,p),Ol(f);break;case 27:Fc(f.stateNode);case 26:case 5:Wi(f,f.return),Ol(f);break;case 22:f.memoizedState===null&&Ol(f);break;case 30:Ol(f);break;default:Ol(f)}u=u.sibling}}function Na(u,f,p){for(p=p&&(f.subtreeFlags&8772)!==0,f=f.child;f!==null;){var v=f.alternate,C=u,T=f,L=T.flags;switch(T.tag){case 0:case 11:case 15:Na(C,T,p),Dc(4,T);break;case 1:if(Na(C,T,p),v=T,C=v.stateNode,typeof C.componentDidMount=="function")try{C.componentDidMount()}catch(ge){Vt(v,v.return,ge)}if(v=T,C=v.updateQueue,C!==null){var U=v.stateNode;try{var ne=C.shared.hiddenCallbacks;if(ne!==null)for(C.shared.hiddenCallbacks=null,C=0;C<ne.length;C++)uO(ne[C],U)}catch(ge){Vt(v,v.return,ge)}}p&&L&64&&xM(T),_c(T,T.return);break;case 27:kM(T);case 26:case 5:Na(C,T,p),p&&v===null&&L&4&&SM(T),_c(T,T.return);break;case 12:Na(C,T,p);break;case 31:Na(C,T,p),p&&L&4&&MM(C,T);break;case 13:Na(C,T,p),p&&L&4&&RM(C,T);break;case 22:T.memoizedState===null&&Na(C,T,p),_c(T,T.return);break;case 30:break;default:Na(C,T,p)}f=f.sibling}}function A0(u,f){var p=null;u!==null&&u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(p=u.memoizedState.cachePool.pool),u=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(u=f.memoizedState.cachePool.pool),u!==p&&(u!=null&&u.refCount++,p!=null&&yc(p))}function O0(u,f){u=null,f.alternate!==null&&(u=f.alternate.memoizedState.cache),f=f.memoizedState.cache,f!==u&&(f.refCount++,u!=null&&yc(u))}function Bi(u,f,p,v){if(f.subtreeFlags&10256)for(f=f.child;f!==null;)NM(u,f,p,v),f=f.sibling}function NM(u,f,p,v){var C=f.flags;switch(f.tag){case 0:case 11:case 15:Bi(u,f,p,v),C&2048&&Dc(9,f);break;case 1:Bi(u,f,p,v);break;case 3:Bi(u,f,p,v),C&2048&&(u=null,f.alternate!==null&&(u=f.alternate.memoizedState.cache),f=f.memoizedState.cache,f!==u&&(f.refCount++,u!=null&&yc(u)));break;case 12:if(C&2048){Bi(u,f,p,v),u=f.stateNode;try{var T=f.memoizedProps,L=T.id,U=T.onPostCommit;typeof U=="function"&&U(L,f.alternate===null?"mount":"update",u.passiveEffectDuration,-0)}catch(ne){Vt(f,f.return,ne)}}else Bi(u,f,p,v);break;case 31:Bi(u,f,p,v);break;case 13:Bi(u,f,p,v);break;case 23:break;case 22:T=f.stateNode,L=f.alternate,f.memoizedState!==null?T._visibility&2?Bi(u,f,p,v):Nc(u,f):T._visibility&2?Bi(u,f,p,v):(T._visibility|=2,Io(u,f,p,v,(f.subtreeFlags&10256)!==0||!1)),C&2048&&A0(L,f);break;case 24:Bi(u,f,p,v),C&2048&&O0(f.alternate,f);break;default:Bi(u,f,p,v)}}function Io(u,f,p,v,C){for(C=C&&((f.subtreeFlags&10256)!==0||!1),f=f.child;f!==null;){var T=u,L=f,U=p,ne=v,ge=L.flags;switch(L.tag){case 0:case 11:case 15:Io(T,L,U,ne,C),Dc(8,L);break;case 23:break;case 22:var Ce=L.stateNode;L.memoizedState!==null?Ce._visibility&2?Io(T,L,U,ne,C):Nc(T,L):(Ce._visibility|=2,Io(T,L,U,ne,C)),C&&ge&2048&&A0(L.alternate,L);break;case 24:Io(T,L,U,ne,C),C&&ge&2048&&O0(L.alternate,L);break;default:Io(T,L,U,ne,C)}f=f.sibling}}function Nc(u,f){if(f.subtreeFlags&10256)for(f=f.child;f!==null;){var p=u,v=f,C=v.flags;switch(v.tag){case 22:Nc(p,v),C&2048&&A0(v.alternate,v);break;case 24:Nc(p,v),C&2048&&O0(v.alternate,v);break;default:Nc(p,v)}f=f.sibling}}var Bc=8192;function qo(u,f,p){if(u.subtreeFlags&Bc)for(u=u.child;u!==null;)BM(u,f,p),u=u.sibling}function BM(u,f,p){switch(u.tag){case 26:qo(u,f,p),u.flags&Bc&&u.memoizedState!==null&&gU(p,Ni,u.memoizedState,u.memoizedProps);break;case 5:qo(u,f,p);break;case 3:case 4:var v=Ni;Ni=Id(u.stateNode.containerInfo),qo(u,f,p),Ni=v;break;case 22:u.memoizedState===null&&(v=u.alternate,v!==null&&v.memoizedState!==null?(v=Bc,Bc=16777216,qo(u,f,p),Bc=v):qo(u,f,p));break;default:qo(u,f,p)}}function LM(u){var f=u.alternate;if(f!==null&&(u=f.child,u!==null)){f.child=null;do f=u.sibling,u.sibling=null,u=f;while(u!==null)}}function Lc(u){var f=u.deletions;if((u.flags&16)!==0){if(f!==null)for(var p=0;p<f.length;p++){var v=f[p];Gr=v,zM(v,u)}LM(u)}if(u.subtreeFlags&10256)for(u=u.child;u!==null;)PM(u),u=u.sibling}function PM(u){switch(u.tag){case 0:case 11:case 15:Lc(u),u.flags&2048&&ys(9,u,u.return);break;case 3:Lc(u);break;case 12:Lc(u);break;case 22:var f=u.stateNode;u.memoizedState!==null&&f._visibility&2&&(u.return===null||u.return.tag!==13)?(f._visibility&=-3,Td(u)):Lc(u);break;default:Lc(u)}}function Td(u){var f=u.deletions;if((u.flags&16)!==0){if(f!==null)for(var p=0;p<f.length;p++){var v=f[p];Gr=v,zM(v,u)}LM(u)}for(u=u.child;u!==null;){switch(f=u,f.tag){case 0:case 11:case 15:ys(8,f,f.return),Td(f);break;case 22:p=f.stateNode,p._visibility&2&&(p._visibility&=-3,Td(f));break;default:Td(f)}u=u.sibling}}function zM(u,f){for(;Gr!==null;){var p=Gr;switch(p.tag){case 0:case 11:case 15:ys(8,p,f);break;case 23:case 22:if(p.memoizedState!==null&&p.memoizedState.cachePool!==null){var v=p.memoizedState.cachePool.pool;v!=null&&v.refCount++}break;case 24:yc(p.memoizedState.cache)}if(v=p.child,v!==null)v.return=p,Gr=v;else e:for(p=u;Gr!==null;){v=Gr;var C=v.sibling,T=v.return;if(AM(v),v===p){Gr=null;break e}if(C!==null){C.return=T,Gr=C;break e}Gr=T}}}var RV={getCacheForType:function(u){var f=en(Tr),p=f.data.get(u);return p===void 0&&(p=u(),f.data.set(u,p)),p},cacheSignal:function(){return en(Tr).controller.signal}},DV=typeof WeakMap=="function"?WeakMap:Map,It=0,Qt=null,kt=null,At=0,Ht=0,ii=null,bs=!1,jo=!1,M0=!1,Ba=0,pr=0,xs=0,Ml=0,R0=0,ai=0,Fo=0,Pc=null,In=null,D0=!1,Ed=0,IM=0,Ad=1/0,Od=null,ws=null,Br=0,Ss=null,Ho=null,La=0,_0=0,N0=null,qM=null,zc=0,B0=null;function si(){return(It&2)!==0&&At!==0?At&-At:q.T!==null?j0():nr()}function jM(){if(ai===0)if((At&536870912)===0||Rt){var u=Le;Le<<=1,(Le&3932160)===0&&(Le=262144),ai=u}else ai=536870912;return u=ri.current,u!==null&&(u.flags|=32),ai}function qn(u,f,p){(u===Qt&&(Ht===2||Ht===9)||u.cancelPendingCommit!==null)&&(Vo(u,0),Cs(u,At,ai,!1)),Ze(u,p),((It&2)===0||u!==Qt)&&(u===Qt&&((It&2)===0&&(Ml|=p),pr===4&&Cs(u,At,ai,!1)),Qi(u))}function FM(u,f,p){if((It&6)!==0)throw Error(n(327));var v=!p&&(f&127)===0&&(f&u.expiredLanes)===0||Ie(u,f),C=v?BV(u,f):P0(u,f,!0),T=v;do{if(C===0){jo&&!v&&Cs(u,f,0,!1);break}else{if(p=u.current.alternate,T&&!_V(p)){C=P0(u,f,!1),T=!1;continue}if(C===2){if(T=f,u.errorRecoveryDisabledLanes&T)var L=0;else L=u.pendingLanes&-536870913,L=L!==0?L:L&536870912?536870912:0;if(L!==0){f=L;e:{var U=u;C=Pc;var ne=U.current.memoizedState.isDehydrated;if(ne&&(Vo(U,L).flags|=256),L=P0(U,L,!1),L!==2){if(M0&&!ne){U.errorRecoveryDisabledLanes|=T,Ml|=T,C=4;break e}T=In,In=C,T!==null&&(In===null?In=T:In.push.apply(In,T))}C=L}if(T=!1,C!==2)continue}}if(C===1){Vo(u,0),Cs(u,f,0,!0);break}e:{switch(v=u,T=C,T){case 0:case 1:throw Error(n(345));case 4:if((f&4194048)!==f)break;case 6:Cs(v,f,ai,!bs);break e;case 2:In=null;break;case 3:case 5:break;default:throw Error(n(329))}if((f&62914560)===f&&(C=Ed+300-je(),10<C)){if(Cs(v,f,ai,!bs),et(v,0,!0)!==0)break e;La=f,v.timeoutHandle=yR(HM.bind(null,v,p,In,Od,D0,f,ai,Ml,Fo,bs,T,"Throttled",-0,0),C);break e}HM(v,p,In,Od,D0,f,ai,Ml,Fo,bs,T,null,-0,0)}}break}while(!0);Qi(u)}function HM(u,f,p,v,C,T,L,U,ne,ge,Ce,Ee,me,ye){if(u.timeoutHandle=-1,Ee=f.subtreeFlags,Ee&8192||(Ee&16785408)===16785408){Ee={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:xa},BM(f,T,Ee);var tt=(T&62914560)===T?Ed-je():(T&4194048)===T?IM-je():0;if(tt=vU(Ee,tt),tt!==null){La=T,u.cancelPendingCommit=tt(QM.bind(null,u,f,T,p,v,C,L,U,ne,Ce,Ee,null,me,ye)),Cs(u,T,L,!ge);return}}QM(u,f,T,p,v,C,L,U,ne)}function _V(u){for(var f=u;;){var p=f.tag;if((p===0||p===11||p===15)&&f.flags&16384&&(p=f.updateQueue,p!==null&&(p=p.stores,p!==null)))for(var v=0;v<p.length;v++){var C=p[v],T=C.getSnapshot;C=C.value;try{if(!ei(T(),C))return!1}catch{return!1}}if(p=f.child,f.subtreeFlags&16384&&p!==null)p.return=f,f=p;else{if(f===u)break;for(;f.sibling===null;){if(f.return===null||f.return===u)return!0;f=f.return}f.sibling.return=f.return,f=f.sibling}}return!0}function Cs(u,f,p,v){f&=~R0,f&=~Ml,u.suspendedLanes|=f,u.pingedLanes&=~f,v&&(u.warmLanes|=f),v=u.expirationTimes;for(var C=f;0<C;){var T=31-le(C),L=1<<T;v[T]=-1,C&=~L}p!==0&&wt(u,p,f)}function Md(){return(It&6)===0?(Ic(0),!1):!0}function L0(){if(kt!==null){if(Ht===0)var u=kt.return;else u=kt,ka=xl=null,Km(u),No=null,xc=0,u=kt;for(;u!==null;)bM(u.alternate,u),u=u.return;kt=null}}function Vo(u,f){var p=u.timeoutHandle;p!==-1&&(u.timeoutHandle=-1,ZV(p)),p=u.cancelPendingCommit,p!==null&&(u.cancelPendingCommit=null,p()),La=0,L0(),Qt=u,kt=p=Sa(u.current,null),At=f,Ht=0,ii=null,bs=!1,jo=Ie(u,f),M0=!1,Fo=ai=R0=Ml=xs=pr=0,In=Pc=null,D0=!1,(f&8)!==0&&(f|=f&32);var v=u.entangledLanes;if(v!==0)for(u=u.entanglements,v&=f;0<v;){var C=31-le(v),T=1<<C;f|=u[C],v&=~T}return Ba=f,Qh(),p}function VM(u,f){bt=null,q.H=Oc,f===_o||f===id?(f=aO(),Ht=3):f===qm?(f=aO(),Ht=4):Ht=f===d0?8:f!==null&&typeof f=="object"&&typeof f.then=="function"?6:1,ii=f,kt===null&&(pr=1,yd(u,gi(f,u.current)))}function UM(){var u=ri.current;return u===null?!0:(At&4194048)===At?bi===null:(At&62914560)===At||(At&536870912)!==0?u===bi:!1}function $M(){var u=q.H;return q.H=Oc,u===null?Oc:u}function GM(){var u=q.A;return q.A=RV,u}function Rd(){pr=4,bs||(At&4194048)!==At&&ri.current!==null||(jo=!0),(xs&134217727)===0&&(Ml&134217727)===0||Qt===null||Cs(Qt,At,ai,!1)}function P0(u,f,p){var v=It;It|=2;var C=$M(),T=GM();(Qt!==u||At!==f)&&(Od=null,Vo(u,f)),f=!1;var L=pr;e:do try{if(Ht!==0&&kt!==null){var U=kt,ne=ii;switch(Ht){case 8:L0(),L=6;break e;case 3:case 2:case 9:case 6:ri.current===null&&(f=!0);var ge=Ht;if(Ht=0,ii=null,Uo(u,U,ne,ge),p&&jo){L=0;break e}break;default:ge=Ht,Ht=0,ii=null,Uo(u,U,ne,ge)}}NV(),L=pr;break}catch(Ce){VM(u,Ce)}while(!0);return f&&u.shellSuspendCounter++,ka=xl=null,It=v,q.H=C,q.A=T,kt===null&&(Qt=null,At=0,Qh()),L}function NV(){for(;kt!==null;)YM(kt)}function BV(u,f){var p=It;It|=2;var v=$M(),C=GM();Qt!==u||At!==f?(Od=null,Ad=je()+500,Vo(u,f)):jo=Ie(u,f);e:do try{if(Ht!==0&&kt!==null){f=kt;var T=ii;t:switch(Ht){case 1:Ht=0,ii=null,Uo(u,f,T,1);break;case 2:case 9:if(nO(T)){Ht=0,ii=null,XM(f);break}f=function(){Ht!==2&&Ht!==9||Qt!==u||(Ht=7),Qi(u)},T.then(f,f);break e;case 3:Ht=7;break e;case 4:Ht=5;break e;case 7:nO(T)?(Ht=0,ii=null,XM(f)):(Ht=0,ii=null,Uo(u,f,T,7));break;case 5:var L=null;switch(kt.tag){case 26:L=kt.memoizedState;case 5:case 27:var U=kt;if(L?NR(L):U.stateNode.complete){Ht=0,ii=null;var ne=U.sibling;if(ne!==null)kt=ne;else{var ge=U.return;ge!==null?(kt=ge,Dd(ge)):kt=null}break t}}Ht=0,ii=null,Uo(u,f,T,5);break;case 6:Ht=0,ii=null,Uo(u,f,T,6);break;case 8:L0(),pr=6;break e;default:throw Error(n(462))}}LV();break}catch(Ce){VM(u,Ce)}while(!0);return ka=xl=null,q.H=v,q.A=C,It=p,kt!==null?0:(Qt=null,At=0,Qh(),pr)}function LV(){for(;kt!==null&&!Ve();)YM(kt)}function YM(u){var f=mM(u.alternate,u,Ba);u.memoizedProps=u.pendingProps,f===null?Dd(u):kt=f}function XM(u){var f=u,p=f.alternate;switch(f.tag){case 15:case 0:f=fM(p,f,f.pendingProps,f.type,void 0,At);break;case 11:f=fM(p,f,f.pendingProps,f.type.render,f.ref,At);break;case 5:Km(f);default:bM(p,f),f=kt=GA(f,Ba),f=mM(p,f,Ba)}u.memoizedProps=u.pendingProps,f===null?Dd(u):kt=f}function Uo(u,f,p,v){ka=xl=null,Km(f),No=null,xc=0;var C=f.return;try{if(CV(u,C,f,p,At)){pr=1,yd(u,gi(p,u.current)),kt=null;return}}catch(T){if(C!==null)throw kt=C,T;pr=1,yd(u,gi(p,u.current)),kt=null;return}f.flags&32768?(Rt||v===1?u=!0:jo||(At&536870912)!==0?u=!1:(bs=u=!0,(v===2||v===9||v===3||v===6)&&(v=ri.current,v!==null&&v.tag===13&&(v.flags|=16384))),WM(f,u)):Dd(f)}function Dd(u){var f=u;do{if((f.flags&32768)!==0){WM(f,bs);return}u=f.return;var p=EV(f.alternate,f,Ba);if(p!==null){kt=p;return}if(f=f.sibling,f!==null){kt=f;return}kt=f=u}while(f!==null);pr===0&&(pr=5)}function WM(u,f){do{var p=AV(u.alternate,u);if(p!==null){p.flags&=32767,kt=p;return}if(p=u.return,p!==null&&(p.flags|=32768,p.subtreeFlags=0,p.deletions=null),!f&&(u=u.sibling,u!==null)){kt=u;return}kt=u=p}while(u!==null);pr=6,kt=null}function QM(u,f,p,v,C,T,L,U,ne){u.cancelPendingCommit=null;do _d();while(Br!==0);if((It&6)!==0)throw Error(n(327));if(f!==null){if(f===u.current)throw Error(n(177));if(T=f.lanes|f.childLanes,T|=km,vt(u,p,T,L,U,ne),u===Qt&&(kt=Qt=null,At=0),Ho=f,Ss=u,La=p,_0=T,N0=C,qM=v,(f.subtreeFlags&10256)!==0||(f.flags&10256)!==0?(u.callbackNode=null,u.callbackPriority=0,qV(Be,function(){return tR(),null})):(u.callbackNode=null,u.callbackPriority=0),v=(f.flags&13878)!==0,(f.subtreeFlags&13878)!==0||v){v=q.T,q.T=null,C=V.p,V.p=2,L=It,It|=4;try{OV(u,f,p)}finally{It=L,V.p=C,q.T=v}}Br=1,KM(),ZM(),JM()}}function KM(){if(Br===1){Br=0;var u=Ss,f=Ho,p=(f.flags&13878)!==0;if((f.subtreeFlags&13878)!==0||p){p=q.T,q.T=null;var v=V.p;V.p=2;var C=It;It|=4;try{DM(f,u);var T=X0,L=zA(u.containerInfo),U=T.focusedElem,ne=T.selectionRange;if(L!==U&&U&&U.ownerDocument&&PA(U.ownerDocument.documentElement,U)){if(ne!==null&&bm(U)){var ge=ne.start,Ce=ne.end;if(Ce===void 0&&(Ce=ge),"selectionStart"in U)U.selectionStart=ge,U.selectionEnd=Math.min(Ce,U.value.length);else{var Ee=U.ownerDocument||document,me=Ee&&Ee.defaultView||window;if(me.getSelection){var ye=me.getSelection(),tt=U.textContent.length,ht=Math.min(ne.start,tt),Yt=ne.end===void 0?ht:Math.min(ne.end,tt);!ye.extend&&ht>Yt&&(L=Yt,Yt=ht,ht=L);var fe=LA(U,ht),ae=LA(U,Yt);if(fe&&ae&&(ye.rangeCount!==1||ye.anchorNode!==fe.node||ye.anchorOffset!==fe.offset||ye.focusNode!==ae.node||ye.focusOffset!==ae.offset)){var pe=Ee.createRange();pe.setStart(fe.node,fe.offset),ye.removeAllRanges(),ht>Yt?(ye.addRange(pe),ye.extend(ae.node,ae.offset)):(pe.setEnd(ae.node,ae.offset),ye.addRange(pe))}}}}for(Ee=[],ye=U;ye=ye.parentNode;)ye.nodeType===1&&Ee.push({element:ye,left:ye.scrollLeft,top:ye.scrollTop});for(typeof U.focus=="function"&&U.focus(),U=0;U<Ee.length;U++){var Te=Ee[U];Te.element.scrollLeft=Te.left,Te.element.scrollTop=Te.top}}Ud=!!Y0,X0=Y0=null}finally{It=C,V.p=v,q.T=p}}u.current=f,Br=2}}function ZM(){if(Br===2){Br=0;var u=Ss,f=Ho,p=(f.flags&8772)!==0;if((f.subtreeFlags&8772)!==0||p){p=q.T,q.T=null;var v=V.p;V.p=2;var C=It;It|=4;try{EM(u,f.alternate,f)}finally{It=C,V.p=v,q.T=p}}Br=3}}function JM(){if(Br===4||Br===3){Br=0,Qe();var u=Ss,f=Ho,p=La,v=qM;(f.subtreeFlags&10256)!==0||(f.flags&10256)!==0?Br=5:(Br=0,Ho=Ss=null,eR(u,u.pendingLanes));var C=u.pendingLanes;if(C===0&&(ws=null),Zr(p),f=f.stateNode,J&&typeof J.onCommitFiberRoot=="function")try{J.onCommitFiberRoot(F,f,void 0,(f.current.flags&128)===128)}catch{}if(v!==null){f=q.T,C=V.p,V.p=2,q.T=null;try{for(var T=u.onRecoverableError,L=0;L<v.length;L++){var U=v[L];T(U.value,{componentStack:U.stack})}}finally{q.T=f,V.p=C}}(La&3)!==0&&_d(),Qi(u),C=u.pendingLanes,(p&261930)!==0&&(C&42)!==0?u===B0?zc++:(zc=0,B0=u):zc=0,Ic(0)}}function eR(u,f){(u.pooledCacheLanes&=f)===0&&(f=u.pooledCache,f!=null&&(u.pooledCache=null,yc(f)))}function _d(){return KM(),ZM(),JM(),tR()}function tR(){if(Br!==5)return!1;var u=Ss,f=_0;_0=0;var p=Zr(La),v=q.T,C=V.p;try{V.p=32>p?32:p,q.T=null,p=N0,N0=null;var T=Ss,L=La;if(Br=0,Ho=Ss=null,La=0,(It&6)!==0)throw Error(n(331));var U=It;if(It|=4,PM(T.current),NM(T,T.current,L,p),It=U,Ic(0,!1),J&&typeof J.onPostCommitFiberRoot=="function")try{J.onPostCommitFiberRoot(F,T)}catch{}return!0}finally{V.p=C,q.T=v,eR(u,f)}}function rR(u,f,p){f=gi(p,f),f=h0(u.stateNode,f,2),u=gs(u,f,2),u!==null&&(Ze(u,2),Qi(u))}function Vt(u,f,p){if(u.tag===3)rR(u,u,p);else for(;f!==null;){if(f.tag===3){rR(f,u,p);break}else if(f.tag===1){var v=f.stateNode;if(typeof f.type.getDerivedStateFromError=="function"||typeof v.componentDidCatch=="function"&&(ws===null||!ws.has(v))){u=gi(p,u),p=nM(2),v=gs(f,p,2),v!==null&&(iM(p,v,f,u),Ze(v,2),Qi(v));break}}f=f.return}}function z0(u,f,p){var v=u.pingCache;if(v===null){v=u.pingCache=new DV;var C=new Set;v.set(f,C)}else C=v.get(f),C===void 0&&(C=new Set,v.set(f,C));C.has(p)||(M0=!0,C.add(p),u=PV.bind(null,u,f,p),f.then(u,u))}function PV(u,f,p){var v=u.pingCache;v!==null&&v.delete(f),u.pingedLanes|=u.suspendedLanes&p,u.warmLanes&=~p,Qt===u&&(At&p)===p&&(pr===4||pr===3&&(At&62914560)===At&&300>je()-Ed?(It&2)===0&&Vo(u,0):R0|=p,Fo===At&&(Fo=0)),Qi(u)}function nR(u,f){f===0&&(f=rt()),u=ml(u,f),u!==null&&(Ze(u,f),Qi(u))}function zV(u){var f=u.memoizedState,p=0;f!==null&&(p=f.retryLane),nR(u,p)}function IV(u,f){var p=0;switch(u.tag){case 31:case 13:var v=u.stateNode,C=u.memoizedState;C!==null&&(p=C.retryLane);break;case 19:v=u.stateNode;break;case 22:v=u.stateNode._retryCache;break;default:throw Error(n(314))}v!==null&&v.delete(f),nR(u,p)}function qV(u,f){return Ne(u,f)}var Nd=null,$o=null,I0=!1,Bd=!1,q0=!1,ks=0;function Qi(u){u!==$o&&u.next===null&&($o===null?Nd=$o=u:$o=$o.next=u),Bd=!0,I0||(I0=!0,FV())}function Ic(u,f){if(!q0&&Bd){q0=!0;do for(var p=!1,v=Nd;v!==null;){if(u!==0){var C=v.pendingLanes;if(C===0)var T=0;else{var L=v.suspendedLanes,U=v.pingedLanes;T=(1<<31-le(42|u)+1)-1,T&=C&~(L&~U),T=T&201326741?T&201326741|1:T?T|2:0}T!==0&&(p=!0,lR(v,T))}else T=At,T=et(v,v===Qt?T:0,v.cancelPendingCommit!==null||v.timeoutHandle!==-1),(T&3)===0||Ie(v,T)||(p=!0,lR(v,T));v=v.next}while(p);q0=!1}}function jV(){iR()}function iR(){Bd=I0=!1;var u=0;ks!==0&&KV()&&(u=ks);for(var f=je(),p=null,v=Nd;v!==null;){var C=v.next,T=aR(v,f);T===0?(v.next=null,p===null?Nd=C:p.next=C,C===null&&($o=p)):(p=v,(u!==0||(T&3)!==0)&&(Bd=!0)),v=C}Br!==0&&Br!==5||Ic(u),ks!==0&&(ks=0)}function aR(u,f){for(var p=u.suspendedLanes,v=u.pingedLanes,C=u.expirationTimes,T=u.pendingLanes&-62914561;0<T;){var L=31-le(T),U=1<<L,ne=C[L];ne===-1?((U&p)===0||(U&v)!==0)&&(C[L]=nt(U,f)):ne<=f&&(u.expiredLanes|=U),T&=~U}if(f=Qt,p=At,p=et(u,u===f?p:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),v=u.callbackNode,p===0||u===f&&(Ht===2||Ht===9)||u.cancelPendingCommit!==null)return v!==null&&v!==null&&Ge(v),u.callbackNode=null,u.callbackPriority=0;if((p&3)===0||Ie(u,p)){if(f=p&-p,f===u.callbackPriority)return f;switch(v!==null&&Ge(v),Zr(p)){case 2:case 8:p=De;break;case 32:p=Be;break;case 268435456:p=Oe;break;default:p=Be}return v=sR.bind(null,u),p=Ne(p,v),u.callbackPriority=f,u.callbackNode=p,f}return v!==null&&v!==null&&Ge(v),u.callbackPriority=2,u.callbackNode=null,2}function sR(u,f){if(Br!==0&&Br!==5)return u.callbackNode=null,u.callbackPriority=0,null;var p=u.callbackNode;if(_d()&&u.callbackNode!==p)return null;var v=At;return v=et(u,u===Qt?v:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),v===0?null:(FM(u,v,f),aR(u,je()),u.callbackNode!=null&&u.callbackNode===p?sR.bind(null,u):null)}function lR(u,f){if(_d())return null;FM(u,f,!0)}function FV(){JV(function(){(It&6)!==0?Ne(ke,jV):iR()})}function j0(){if(ks===0){var u=Ro;u===0&&(u=ze,ze<<=1,(ze&261888)===0&&(ze=256)),ks=u}return ks}function oR(u){return u==null||typeof u=="symbol"||typeof u=="boolean"?null:typeof u=="function"?u:Hh(""+u)}function uR(u,f){var p=f.ownerDocument.createElement("input");return p.name=f.name,p.value=f.value,u.id&&p.setAttribute("form",u.id),f.parentNode.insertBefore(p,f),u=new FormData(u),p.parentNode.removeChild(p),u}function HV(u,f,p,v,C){if(f==="submit"&&p&&p.stateNode===C){var T=oR((C[Nr]||null).action),L=v.submitter;L&&(f=(f=L[Nr]||null)?oR(f.formAction):L.getAttribute("formAction"),f!==null&&(T=f,L=null));var U=new Gh("action","action",null,v,C);u.push({event:U,listeners:[{instance:null,listener:function(){if(v.defaultPrevented){if(ks!==0){var ne=L?uR(C,L):new FormData(C);s0(p,{pending:!0,data:ne,method:C.method,action:T},null,ne)}}else typeof T=="function"&&(U.preventDefault(),ne=L?uR(C,L):new FormData(C),s0(p,{pending:!0,data:ne,method:C.method,action:T},T,ne))},currentTarget:C}]})}}for(var F0=0;F0<Cm.length;F0++){var H0=Cm[F0],VV=H0.toLowerCase(),UV=H0[0].toUpperCase()+H0.slice(1);_i(VV,"on"+UV)}_i(jA,"onAnimationEnd"),_i(FA,"onAnimationIteration"),_i(HA,"onAnimationStart"),_i("dblclick","onDoubleClick"),_i("focusin","onFocus"),_i("focusout","onBlur"),_i(sV,"onTransitionRun"),_i(lV,"onTransitionStart"),_i(oV,"onTransitionCancel"),_i(VA,"onTransitionEnd"),Gi("onMouseEnter",["mouseout","mouseover"]),Gi("onMouseLeave",["mouseout","mouseover"]),Gi("onPointerEnter",["pointerout","pointerover"]),Gi("onPointerLeave",["pointerout","pointerover"]),Jn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Jn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Jn("onBeforeInput",["compositionend","keypress","textInput","paste"]),Jn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Jn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Jn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var qc="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(" "),$V=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(qc));function cR(u,f){f=(f&4)!==0;for(var p=0;p<u.length;p++){var v=u[p],C=v.event;v=v.listeners;e:{var T=void 0;if(f)for(var L=v.length-1;0<=L;L--){var U=v[L],ne=U.instance,ge=U.currentTarget;if(U=U.listener,ne!==T&&C.isPropagationStopped())break e;T=U,C.currentTarget=ge;try{T(C)}catch(Ce){Wh(Ce)}C.currentTarget=null,T=ne}else for(L=0;L<v.length;L++){if(U=v[L],ne=U.instance,ge=U.currentTarget,U=U.listener,ne!==T&&C.isPropagationStopped())break e;T=U,C.currentTarget=ge;try{T(C)}catch(Ce){Wh(Ce)}C.currentTarget=null,T=ne}}}}function Tt(u,f){var p=f[Hr];p===void 0&&(p=f[Hr]=new Set);var v=u+"__bubble";p.has(v)||(fR(f,u,2,!1),p.add(v))}function V0(u,f,p){var v=0;f&&(v|=4),fR(p,u,v,f)}var Ld="_reactListening"+Math.random().toString(36).slice(2);function U0(u){if(!u[Ld]){u[Ld]=!0,zh.forEach(function(p){p!=="selectionchange"&&($V.has(p)||V0(p,!1,u),V0(p,!0,u))});var f=u.nodeType===9?u:u.ownerDocument;f===null||f[Ld]||(f[Ld]=!0,V0("selectionchange",!1,f))}}function fR(u,f,p,v){switch(jR(f)){case 2:var C=bU;break;case 8:C=xU;break;default:C=ay}p=C.bind(null,f,p,u),C=void 0,!cm||f!=="touchstart"&&f!=="touchmove"&&f!=="wheel"||(C=!0),v?C!==void 0?u.addEventListener(f,p,{capture:!0,passive:C}):u.addEventListener(f,p,!0):C!==void 0?u.addEventListener(f,p,{passive:C}):u.addEventListener(f,p,!1)}function $0(u,f,p,v,C){var T=v;if((f&1)===0&&(f&2)===0&&v!==null)e:for(;;){if(v===null)return;var L=v.tag;if(L===3||L===4){var U=v.stateNode.containerInfo;if(U===C)break;if(L===4)for(L=v.return;L!==null;){var ne=L.tag;if((ne===3||ne===4)&&L.stateNode.containerInfo===C)return;L=L.return}for(;U!==null;){if(L=is(U),L===null)return;if(ne=L.tag,ne===5||ne===6||ne===26||ne===27){v=T=L;continue e}U=U.parentNode}}v=v.return}vA(function(){var ge=T,Ce=om(p),Ee=[];e:{var me=UA.get(u);if(me!==void 0){var ye=Gh,tt=u;switch(u){case"keypress":if(Uh(p)===0)break e;case"keydown":case"keyup":ye=IH;break;case"focusin":tt="focus",ye=pm;break;case"focusout":tt="blur",ye=pm;break;case"beforeblur":case"afterblur":ye=pm;break;case"click":if(p.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ye=bA;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ye=EH;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ye=FH;break;case jA:case FA:case HA:ye=MH;break;case VA:ye=VH;break;case"scroll":case"scrollend":ye=kH;break;case"wheel":ye=$H;break;case"copy":case"cut":case"paste":ye=DH;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ye=wA;break;case"toggle":case"beforetoggle":ye=YH}var ht=(f&4)!==0,Yt=!ht&&(u==="scroll"||u==="scrollend"),fe=ht?me!==null?me+"Capture":null:me;ht=[];for(var ae=ge,pe;ae!==null;){var Te=ae;if(pe=Te.stateNode,Te=Te.tag,Te!==5&&Te!==26&&Te!==27||pe===null||fe===null||(Te=lc(ae,fe),Te!=null&&ht.push(jc(ae,Te,pe))),Yt)break;ae=ae.return}0<ht.length&&(me=new ye(me,tt,null,p,Ce),Ee.push({event:me,listeners:ht}))}}if((f&7)===0){e:{if(me=u==="mouseover"||u==="pointerover",ye=u==="mouseout"||u==="pointerout",me&&p!==lm&&(tt=p.relatedTarget||p.fromElement)&&(is(tt)||tt[_n]))break e;if((ye||me)&&(me=Ce.window===Ce?Ce:(me=Ce.ownerDocument)?me.defaultView||me.parentWindow:window,ye?(tt=p.relatedTarget||p.toElement,ye=ge,tt=tt?is(tt):null,tt!==null&&(Yt=a(tt),ht=tt.tag,tt!==Yt||ht!==5&&ht!==27&&ht!==6)&&(tt=null)):(ye=null,tt=ge),ye!==tt)){if(ht=bA,Te="onMouseLeave",fe="onMouseEnter",ae="mouse",(u==="pointerout"||u==="pointerover")&&(ht=wA,Te="onPointerLeave",fe="onPointerEnter",ae="pointer"),Yt=ye==null?me:dl(ye),pe=tt==null?me:dl(tt),me=new ht(Te,ae+"leave",ye,p,Ce),me.target=Yt,me.relatedTarget=pe,Te=null,is(Ce)===ge&&(ht=new ht(fe,ae+"enter",tt,p,Ce),ht.target=pe,ht.relatedTarget=Yt,Te=ht),Yt=Te,ye&&tt)t:{for(ht=GV,fe=ye,ae=tt,pe=0,Te=fe;Te;Te=ht(Te))pe++;Te=0;for(var ot=ae;ot;ot=ht(ot))Te++;for(;0<pe-Te;)fe=ht(fe),pe--;for(;0<Te-pe;)ae=ht(ae),Te--;for(;pe--;){if(fe===ae||ae!==null&&fe===ae.alternate){ht=fe;break t}fe=ht(fe),ae=ht(ae)}ht=null}else ht=null;ye!==null&&hR(Ee,me,ye,ht,!1),tt!==null&&Yt!==null&&hR(Ee,Yt,tt,ht,!0)}}e:{if(me=ge?dl(ge):window,ye=me.nodeName&&me.nodeName.toLowerCase(),ye==="select"||ye==="input"&&me.type==="file")var Lt=MA;else if(AA(me))if(RA)Lt=nV;else{Lt=tV;var it=eV}else ye=me.nodeName,!ye||ye.toLowerCase()!=="input"||me.type!=="checkbox"&&me.type!=="radio"?ge&&sm(ge.elementType)&&(Lt=MA):Lt=rV;if(Lt&&(Lt=Lt(u,ge))){OA(Ee,Lt,p,Ce);break e}it&&it(u,me,ge),u==="focusout"&&ge&&me.type==="number"&&ge.memoizedProps.value!=null&&am(me,"number",me.value)}switch(it=ge?dl(ge):window,u){case"focusin":(AA(it)||it.contentEditable==="true")&&(So=it,xm=ge,gc=null);break;case"focusout":gc=xm=So=null;break;case"mousedown":wm=!0;break;case"contextmenu":case"mouseup":case"dragend":wm=!1,IA(Ee,p,Ce);break;case"selectionchange":if(aV)break;case"keydown":case"keyup":IA(Ee,p,Ce)}var xt;if(vm)e:{switch(u){case"compositionstart":var Ot="onCompositionStart";break e;case"compositionend":Ot="onCompositionEnd";break e;case"compositionupdate":Ot="onCompositionUpdate";break e}Ot=void 0}else wo?TA(u,p)&&(Ot="onCompositionEnd"):u==="keydown"&&p.keyCode===229&&(Ot="onCompositionStart");Ot&&(SA&&p.locale!=="ko"&&(wo||Ot!=="onCompositionStart"?Ot==="onCompositionEnd"&&wo&&(xt=mA()):(os=Ce,fm="value"in os?os.value:os.textContent,wo=!0)),it=Pd(ge,Ot),0<it.length&&(Ot=new xA(Ot,u,null,p,Ce),Ee.push({event:Ot,listeners:it}),xt?Ot.data=xt:(xt=EA(p),xt!==null&&(Ot.data=xt)))),(xt=WH?QH(u,p):KH(u,p))&&(Ot=Pd(ge,"onBeforeInput"),0<Ot.length&&(it=new xA("onBeforeInput","beforeinput",null,p,Ce),Ee.push({event:it,listeners:Ot}),it.data=xt)),HV(Ee,u,ge,p,Ce)}cR(Ee,f)})}function jc(u,f,p){return{instance:u,listener:f,currentTarget:p}}function Pd(u,f){for(var p=f+"Capture",v=[];u!==null;){var C=u,T=C.stateNode;if(C=C.tag,C!==5&&C!==26&&C!==27||T===null||(C=lc(u,p),C!=null&&v.unshift(jc(u,C,T)),C=lc(u,f),C!=null&&v.push(jc(u,C,T))),u.tag===3)return v;u=u.return}return[]}function GV(u){if(u===null)return null;do u=u.return;while(u&&u.tag!==5&&u.tag!==27);return u||null}function hR(u,f,p,v,C){for(var T=f._reactName,L=[];p!==null&&p!==v;){var U=p,ne=U.alternate,ge=U.stateNode;if(U=U.tag,ne!==null&&ne===v)break;U!==5&&U!==26&&U!==27||ge===null||(ne=ge,C?(ge=lc(p,T),ge!=null&&L.unshift(jc(p,ge,ne))):C||(ge=lc(p,T),ge!=null&&L.push(jc(p,ge,ne)))),p=p.return}L.length!==0&&u.push({event:f,listeners:L})}var YV=/\r\n?/g,XV=/\u0000|\uFFFD/g;function dR(u){return(typeof u=="string"?u:""+u).replace(YV,`
9
+ `).replace(XV,"")}function pR(u,f){return f=dR(f),dR(u)===f}function Gt(u,f,p,v,C,T){switch(p){case"children":typeof v=="string"?f==="body"||f==="textarea"&&v===""||yo(u,v):(typeof v=="number"||typeof v=="bigint")&&f!=="body"&&yo(u,""+v);break;case"className":ls(u,"class",v);break;case"tabIndex":ls(u,"tabindex",v);break;case"dir":case"role":case"viewBox":case"width":case"height":ls(u,p,v);break;case"style":pA(u,v,T);break;case"data":if(f!=="object"){ls(u,"data",v);break}case"src":case"href":if(v===""&&(f!=="a"||p!=="href")){u.removeAttribute(p);break}if(v==null||typeof v=="function"||typeof v=="symbol"||typeof v=="boolean"){u.removeAttribute(p);break}v=Hh(""+v),u.setAttribute(p,v);break;case"action":case"formAction":if(typeof v=="function"){u.setAttribute(p,"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 T=="function"&&(p==="formAction"?(f!=="input"&&Gt(u,f,"name",C.name,C,null),Gt(u,f,"formEncType",C.formEncType,C,null),Gt(u,f,"formMethod",C.formMethod,C,null),Gt(u,f,"formTarget",C.formTarget,C,null)):(Gt(u,f,"encType",C.encType,C,null),Gt(u,f,"method",C.method,C,null),Gt(u,f,"target",C.target,C,null)));if(v==null||typeof v=="symbol"||typeof v=="boolean"){u.removeAttribute(p);break}v=Hh(""+v),u.setAttribute(p,v);break;case"onClick":v!=null&&(u.onclick=xa);break;case"onScroll":v!=null&&Tt("scroll",u);break;case"onScrollEnd":v!=null&&Tt("scrollend",u);break;case"dangerouslySetInnerHTML":if(v!=null){if(typeof v!="object"||!("__html"in v))throw Error(n(61));if(p=v.__html,p!=null){if(C.children!=null)throw Error(n(60));u.innerHTML=p}}break;case"multiple":u.multiple=v&&typeof v!="function"&&typeof v!="symbol";break;case"muted":u.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"){u.removeAttribute("xlink:href");break}p=Hh(""+v),u.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",p);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"?u.setAttribute(p,""+v):u.removeAttribute(p);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"?u.setAttribute(p,""):u.removeAttribute(p);break;case"capture":case"download":v===!0?u.setAttribute(p,""):v!==!1&&v!=null&&typeof v!="function"&&typeof v!="symbol"?u.setAttribute(p,v):u.removeAttribute(p);break;case"cols":case"rows":case"size":case"span":v!=null&&typeof v!="function"&&typeof v!="symbol"&&!isNaN(v)&&1<=v?u.setAttribute(p,v):u.removeAttribute(p);break;case"rowSpan":case"start":v==null||typeof v=="function"||typeof v=="symbol"||isNaN(v)?u.removeAttribute(p):u.setAttribute(p,v);break;case"popover":Tt("beforetoggle",u),Tt("toggle",u),pn(u,"popover",v);break;case"xlinkActuate":hi(u,"http://www.w3.org/1999/xlink","xlink:actuate",v);break;case"xlinkArcrole":hi(u,"http://www.w3.org/1999/xlink","xlink:arcrole",v);break;case"xlinkRole":hi(u,"http://www.w3.org/1999/xlink","xlink:role",v);break;case"xlinkShow":hi(u,"http://www.w3.org/1999/xlink","xlink:show",v);break;case"xlinkTitle":hi(u,"http://www.w3.org/1999/xlink","xlink:title",v);break;case"xlinkType":hi(u,"http://www.w3.org/1999/xlink","xlink:type",v);break;case"xmlBase":hi(u,"http://www.w3.org/XML/1998/namespace","xml:base",v);break;case"xmlLang":hi(u,"http://www.w3.org/XML/1998/namespace","xml:lang",v);break;case"xmlSpace":hi(u,"http://www.w3.org/XML/1998/namespace","xml:space",v);break;case"is":pn(u,"is",v);break;case"innerText":case"textContent":break;default:(!(2<p.length)||p[0]!=="o"&&p[0]!=="O"||p[1]!=="n"&&p[1]!=="N")&&(p=SH.get(p)||p,pn(u,p,v))}}function G0(u,f,p,v,C,T){switch(p){case"style":pA(u,v,T);break;case"dangerouslySetInnerHTML":if(v!=null){if(typeof v!="object"||!("__html"in v))throw Error(n(61));if(p=v.__html,p!=null){if(C.children!=null)throw Error(n(60));u.innerHTML=p}}break;case"children":typeof v=="string"?yo(u,v):(typeof v=="number"||typeof v=="bigint")&&yo(u,""+v);break;case"onScroll":v!=null&&Tt("scroll",u);break;case"onScrollEnd":v!=null&&Tt("scrollend",u);break;case"onClick":v!=null&&(u.onclick=xa);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ih.hasOwnProperty(p))e:{if(p[0]==="o"&&p[1]==="n"&&(C=p.endsWith("Capture"),f=p.slice(2,C?p.length-7:void 0),T=u[Nr]||null,T=T!=null?T[p]:null,typeof T=="function"&&u.removeEventListener(f,T,C),typeof v=="function")){typeof T!="function"&&T!==null&&(p in u?u[p]=null:u.hasAttribute(p)&&u.removeAttribute(p)),u.addEventListener(f,v,C);break e}p in u?u[p]=v:v===!0?u.setAttribute(p,""):pn(u,p,v)}}}function rn(u,f,p){switch(f){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Tt("error",u),Tt("load",u);var v=!1,C=!1,T;for(T in p)if(p.hasOwnProperty(T)){var L=p[T];if(L!=null)switch(T){case"src":v=!0;break;case"srcSet":C=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(n(137,f));default:Gt(u,f,T,L,p,null)}}C&&Gt(u,f,"srcSet",p.srcSet,p,null),v&&Gt(u,f,"src",p.src,p,null);return;case"input":Tt("invalid",u);var U=T=L=C=null,ne=null,ge=null;for(v in p)if(p.hasOwnProperty(v)){var Ce=p[v];if(Ce!=null)switch(v){case"name":C=Ce;break;case"type":L=Ce;break;case"checked":ne=Ce;break;case"defaultChecked":ge=Ce;break;case"value":T=Ce;break;case"defaultValue":U=Ce;break;case"children":case"dangerouslySetInnerHTML":if(Ce!=null)throw Error(n(137,f));break;default:Gt(u,f,v,Ce,p,null)}}cA(u,T,U,ne,ge,L,C,!1);return;case"select":Tt("invalid",u),v=L=T=null;for(C in p)if(p.hasOwnProperty(C)&&(U=p[C],U!=null))switch(C){case"value":T=U;break;case"defaultValue":L=U;break;case"multiple":v=U;default:Gt(u,f,C,U,p,null)}f=T,p=L,u.multiple=!!v,f!=null?mo(u,!!v,f,!1):p!=null&&mo(u,!!v,p,!0);return;case"textarea":Tt("invalid",u),T=C=v=null;for(L in p)if(p.hasOwnProperty(L)&&(U=p[L],U!=null))switch(L){case"value":v=U;break;case"defaultValue":C=U;break;case"children":T=U;break;case"dangerouslySetInnerHTML":if(U!=null)throw Error(n(91));break;default:Gt(u,f,L,U,p,null)}hA(u,v,C,T);return;case"option":for(ne in p)p.hasOwnProperty(ne)&&(v=p[ne],v!=null)&&(ne==="selected"?u.selected=v&&typeof v!="function"&&typeof v!="symbol":Gt(u,f,ne,v,p,null));return;case"dialog":Tt("beforetoggle",u),Tt("toggle",u),Tt("cancel",u),Tt("close",u);break;case"iframe":case"object":Tt("load",u);break;case"video":case"audio":for(v=0;v<qc.length;v++)Tt(qc[v],u);break;case"image":Tt("error",u),Tt("load",u);break;case"details":Tt("toggle",u);break;case"embed":case"source":case"link":Tt("error",u),Tt("load",u);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ge in p)if(p.hasOwnProperty(ge)&&(v=p[ge],v!=null))switch(ge){case"children":case"dangerouslySetInnerHTML":throw Error(n(137,f));default:Gt(u,f,ge,v,p,null)}return;default:if(sm(f)){for(Ce in p)p.hasOwnProperty(Ce)&&(v=p[Ce],v!==void 0&&G0(u,f,Ce,v,p,void 0));return}}for(U in p)p.hasOwnProperty(U)&&(v=p[U],v!=null&&Gt(u,f,U,v,p,null))}function WV(u,f,p,v){switch(f){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var C=null,T=null,L=null,U=null,ne=null,ge=null,Ce=null;for(ye in p){var Ee=p[ye];if(p.hasOwnProperty(ye)&&Ee!=null)switch(ye){case"checked":break;case"value":break;case"defaultValue":ne=Ee;default:v.hasOwnProperty(ye)||Gt(u,f,ye,null,v,Ee)}}for(var me in v){var ye=v[me];if(Ee=p[me],v.hasOwnProperty(me)&&(ye!=null||Ee!=null))switch(me){case"type":T=ye;break;case"name":C=ye;break;case"checked":ge=ye;break;case"defaultChecked":Ce=ye;break;case"value":L=ye;break;case"defaultValue":U=ye;break;case"children":case"dangerouslySetInnerHTML":if(ye!=null)throw Error(n(137,f));break;default:ye!==Ee&&Gt(u,f,me,ye,v,Ee)}}im(u,L,U,ne,ge,Ce,T,C);return;case"select":ye=L=U=me=null;for(T in p)if(ne=p[T],p.hasOwnProperty(T)&&ne!=null)switch(T){case"value":break;case"multiple":ye=ne;default:v.hasOwnProperty(T)||Gt(u,f,T,null,v,ne)}for(C in v)if(T=v[C],ne=p[C],v.hasOwnProperty(C)&&(T!=null||ne!=null))switch(C){case"value":me=T;break;case"defaultValue":U=T;break;case"multiple":L=T;default:T!==ne&&Gt(u,f,C,T,v,ne)}f=U,p=L,v=ye,me!=null?mo(u,!!p,me,!1):!!v!=!!p&&(f!=null?mo(u,!!p,f,!0):mo(u,!!p,p?[]:"",!1));return;case"textarea":ye=me=null;for(U in p)if(C=p[U],p.hasOwnProperty(U)&&C!=null&&!v.hasOwnProperty(U))switch(U){case"value":break;case"children":break;default:Gt(u,f,U,null,v,C)}for(L in v)if(C=v[L],T=p[L],v.hasOwnProperty(L)&&(C!=null||T!=null))switch(L){case"value":me=C;break;case"defaultValue":ye=C;break;case"children":break;case"dangerouslySetInnerHTML":if(C!=null)throw Error(n(91));break;default:C!==T&&Gt(u,f,L,C,v,T)}fA(u,me,ye);return;case"option":for(var tt in p)me=p[tt],p.hasOwnProperty(tt)&&me!=null&&!v.hasOwnProperty(tt)&&(tt==="selected"?u.selected=!1:Gt(u,f,tt,null,v,me));for(ne in v)me=v[ne],ye=p[ne],v.hasOwnProperty(ne)&&me!==ye&&(me!=null||ye!=null)&&(ne==="selected"?u.selected=me&&typeof me!="function"&&typeof me!="symbol":Gt(u,f,ne,me,v,ye));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ht in p)me=p[ht],p.hasOwnProperty(ht)&&me!=null&&!v.hasOwnProperty(ht)&&Gt(u,f,ht,null,v,me);for(ge in v)if(me=v[ge],ye=p[ge],v.hasOwnProperty(ge)&&me!==ye&&(me!=null||ye!=null))switch(ge){case"children":case"dangerouslySetInnerHTML":if(me!=null)throw Error(n(137,f));break;default:Gt(u,f,ge,me,v,ye)}return;default:if(sm(f)){for(var Yt in p)me=p[Yt],p.hasOwnProperty(Yt)&&me!==void 0&&!v.hasOwnProperty(Yt)&&G0(u,f,Yt,void 0,v,me);for(Ce in v)me=v[Ce],ye=p[Ce],!v.hasOwnProperty(Ce)||me===ye||me===void 0&&ye===void 0||G0(u,f,Ce,me,v,ye);return}}for(var fe in p)me=p[fe],p.hasOwnProperty(fe)&&me!=null&&!v.hasOwnProperty(fe)&&Gt(u,f,fe,null,v,me);for(Ee in v)me=v[Ee],ye=p[Ee],!v.hasOwnProperty(Ee)||me===ye||me==null&&ye==null||Gt(u,f,Ee,me,v,ye)}function gR(u){switch(u){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function QV(){if(typeof performance.getEntriesByType=="function"){for(var u=0,f=0,p=performance.getEntriesByType("resource"),v=0;v<p.length;v++){var C=p[v],T=C.transferSize,L=C.initiatorType,U=C.duration;if(T&&U&&gR(L)){for(L=0,U=C.responseEnd,v+=1;v<p.length;v++){var ne=p[v],ge=ne.startTime;if(ge>U)break;var Ce=ne.transferSize,Ee=ne.initiatorType;Ce&&gR(Ee)&&(ne=ne.responseEnd,L+=Ce*(ne<U?1:(U-ge)/(ne-ge)))}if(--v,f+=8*(T+L)/(C.duration/1e3),u++,10<u)break}}if(0<u)return f/u/1e6}return navigator.connection&&(u=navigator.connection.downlink,typeof u=="number")?u:5}var Y0=null,X0=null;function zd(u){return u.nodeType===9?u:u.ownerDocument}function vR(u){switch(u){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function mR(u,f){if(u===0)switch(f){case"svg":return 1;case"math":return 2;default:return 0}return u===1&&f==="foreignObject"?0:u}function W0(u,f){return u==="textarea"||u==="noscript"||typeof f.children=="string"||typeof f.children=="number"||typeof f.children=="bigint"||typeof f.dangerouslySetInnerHTML=="object"&&f.dangerouslySetInnerHTML!==null&&f.dangerouslySetInnerHTML.__html!=null}var Q0=null;function KV(){var u=window.event;return u&&u.type==="popstate"?u===Q0?!1:(Q0=u,!0):(Q0=null,!1)}var yR=typeof setTimeout=="function"?setTimeout:void 0,ZV=typeof clearTimeout=="function"?clearTimeout:void 0,bR=typeof Promise=="function"?Promise:void 0,JV=typeof queueMicrotask=="function"?queueMicrotask:typeof bR<"u"?function(u){return bR.resolve(null).then(u).catch(eU)}:yR;function eU(u){setTimeout(function(){throw u})}function Ts(u){return u==="head"}function xR(u,f){var p=f,v=0;do{var C=p.nextSibling;if(u.removeChild(p),C&&C.nodeType===8)if(p=C.data,p==="/$"||p==="/&"){if(v===0){u.removeChild(C),Wo(f);return}v--}else if(p==="$"||p==="$?"||p==="$~"||p==="$!"||p==="&")v++;else if(p==="html")Fc(u.ownerDocument.documentElement);else if(p==="head"){p=u.ownerDocument.head,Fc(p);for(var T=p.firstChild;T;){var L=T.nextSibling,U=T.nodeName;T[Ur]||U==="SCRIPT"||U==="STYLE"||U==="LINK"&&T.rel.toLowerCase()==="stylesheet"||p.removeChild(T),T=L}}else p==="body"&&Fc(u.ownerDocument.body);p=C}while(p);Wo(f)}function wR(u,f){var p=u;u=0;do{var v=p.nextSibling;if(p.nodeType===1?f?(p._stashedDisplay=p.style.display,p.style.display="none"):(p.style.display=p._stashedDisplay||"",p.getAttribute("style")===""&&p.removeAttribute("style")):p.nodeType===3&&(f?(p._stashedText=p.nodeValue,p.nodeValue=""):p.nodeValue=p._stashedText||""),v&&v.nodeType===8)if(p=v.data,p==="/$"){if(u===0)break;u--}else p!=="$"&&p!=="$?"&&p!=="$~"&&p!=="$!"||u++;p=v}while(p)}function K0(u){var f=u.firstChild;for(f&&f.nodeType===10&&(f=f.nextSibling);f;){var p=f;switch(f=f.nextSibling,p.nodeName){case"HTML":case"HEAD":case"BODY":K0(p),go(p);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(p.rel.toLowerCase()==="stylesheet")continue}u.removeChild(p)}}function tU(u,f,p,v){for(;u.nodeType===1;){var C=p;if(u.nodeName.toLowerCase()!==f.toLowerCase()){if(!v&&(u.nodeName!=="INPUT"||u.type!=="hidden"))break}else if(v){if(!u[Ur])switch(f){case"meta":if(!u.hasAttribute("itemprop"))break;return u;case"link":if(T=u.getAttribute("rel"),T==="stylesheet"&&u.hasAttribute("data-precedence"))break;if(T!==C.rel||u.getAttribute("href")!==(C.href==null||C.href===""?null:C.href)||u.getAttribute("crossorigin")!==(C.crossOrigin==null?null:C.crossOrigin)||u.getAttribute("title")!==(C.title==null?null:C.title))break;return u;case"style":if(u.hasAttribute("data-precedence"))break;return u;case"script":if(T=u.getAttribute("src"),(T!==(C.src==null?null:C.src)||u.getAttribute("type")!==(C.type==null?null:C.type)||u.getAttribute("crossorigin")!==(C.crossOrigin==null?null:C.crossOrigin))&&T&&u.hasAttribute("async")&&!u.hasAttribute("itemprop"))break;return u;default:return u}}else if(f==="input"&&u.type==="hidden"){var T=C.name==null?null:""+C.name;if(C.type==="hidden"&&u.getAttribute("name")===T)return u}else return u;if(u=xi(u.nextSibling),u===null)break}return null}function rU(u,f,p){if(f==="")return null;for(;u.nodeType!==3;)if((u.nodeType!==1||u.nodeName!=="INPUT"||u.type!=="hidden")&&!p||(u=xi(u.nextSibling),u===null))return null;return u}function SR(u,f){for(;u.nodeType!==8;)if((u.nodeType!==1||u.nodeName!=="INPUT"||u.type!=="hidden")&&!f||(u=xi(u.nextSibling),u===null))return null;return u}function Z0(u){return u.data==="$?"||u.data==="$~"}function J0(u){return u.data==="$!"||u.data==="$?"&&u.ownerDocument.readyState!=="loading"}function nU(u,f){var p=u.ownerDocument;if(u.data==="$~")u._reactRetry=f;else if(u.data!=="$?"||p.readyState!=="loading")f();else{var v=function(){f(),p.removeEventListener("DOMContentLoaded",v)};p.addEventListener("DOMContentLoaded",v),u._reactRetry=v}}function xi(u){for(;u!=null;u=u.nextSibling){var f=u.nodeType;if(f===1||f===3)break;if(f===8){if(f=u.data,f==="$"||f==="$!"||f==="$?"||f==="$~"||f==="&"||f==="F!"||f==="F")break;if(f==="/$"||f==="/&")return null}}return u}var ey=null;function CR(u){u=u.nextSibling;for(var f=0;u;){if(u.nodeType===8){var p=u.data;if(p==="/$"||p==="/&"){if(f===0)return xi(u.nextSibling);f--}else p!=="$"&&p!=="$!"&&p!=="$?"&&p!=="$~"&&p!=="&"||f++}u=u.nextSibling}return null}function kR(u){u=u.previousSibling;for(var f=0;u;){if(u.nodeType===8){var p=u.data;if(p==="$"||p==="$!"||p==="$?"||p==="$~"||p==="&"){if(f===0)return u;f--}else p!=="/$"&&p!=="/&"||f++}u=u.previousSibling}return null}function TR(u,f,p){switch(f=zd(p),u){case"html":if(u=f.documentElement,!u)throw Error(n(452));return u;case"head":if(u=f.head,!u)throw Error(n(453));return u;case"body":if(u=f.body,!u)throw Error(n(454));return u;default:throw Error(n(451))}}function Fc(u){for(var f=u.attributes;f.length;)u.removeAttributeNode(f[0]);go(u)}var wi=new Map,ER=new Set;function Id(u){return typeof u.getRootNode=="function"?u.getRootNode():u.nodeType===9?u:u.ownerDocument}var Pa=V.d;V.d={f:iU,r:aU,D:sU,C:lU,L:oU,m:uU,X:fU,S:cU,M:hU};function iU(){var u=Pa.f(),f=Md();return u||f}function aU(u){var f=as(u);f!==null&&f.tag===5&&f.type==="form"?VO(f):Pa.r(u)}var Go=typeof document>"u"?null:document;function AR(u,f,p){var v=Go;if(v&&typeof f=="string"&&f){var C=di(f);C='link[rel="'+u+'"][href="'+C+'"]',typeof p=="string"&&(C+='[crossorigin="'+p+'"]'),ER.has(C)||(ER.add(C),u={rel:u,crossOrigin:p,href:f},v.querySelector(C)===null&&(f=v.createElement("link"),rn(f,"link",u),kr(f),v.head.appendChild(f)))}}function sU(u){Pa.D(u),AR("dns-prefetch",u,null)}function lU(u,f){Pa.C(u,f),AR("preconnect",u,f)}function oU(u,f,p){Pa.L(u,f,p);var v=Go;if(v&&u&&f){var C='link[rel="preload"][as="'+di(f)+'"]';f==="image"&&p&&p.imageSrcSet?(C+='[imagesrcset="'+di(p.imageSrcSet)+'"]',typeof p.imageSizes=="string"&&(C+='[imagesizes="'+di(p.imageSizes)+'"]')):C+='[href="'+di(u)+'"]';var T=C;switch(f){case"style":T=Yo(u);break;case"script":T=Xo(u)}wi.has(T)||(u=d({rel:"preload",href:f==="image"&&p&&p.imageSrcSet?void 0:u,as:f},p),wi.set(T,u),v.querySelector(C)!==null||f==="style"&&v.querySelector(Hc(T))||f==="script"&&v.querySelector(Vc(T))||(f=v.createElement("link"),rn(f,"link",u),kr(f),v.head.appendChild(f)))}}function uU(u,f){Pa.m(u,f);var p=Go;if(p&&u){var v=f&&typeof f.as=="string"?f.as:"script",C='link[rel="modulepreload"][as="'+di(v)+'"][href="'+di(u)+'"]',T=C;switch(v){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":T=Xo(u)}if(!wi.has(T)&&(u=d({rel:"modulepreload",href:u},f),wi.set(T,u),p.querySelector(C)===null)){switch(v){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(p.querySelector(Vc(T)))return}v=p.createElement("link"),rn(v,"link",u),kr(v),p.head.appendChild(v)}}}function cU(u,f,p){Pa.S(u,f,p);var v=Go;if(v&&u){var C=ss(v).hoistableStyles,T=Yo(u);f=f||"default";var L=C.get(T);if(!L){var U={loading:0,preload:null};if(L=v.querySelector(Hc(T)))U.loading=5;else{u=d({rel:"stylesheet",href:u,"data-precedence":f},p),(p=wi.get(T))&&ty(u,p);var ne=L=v.createElement("link");kr(ne),rn(ne,"link",u),ne._p=new Promise(function(ge,Ce){ne.onload=ge,ne.onerror=Ce}),ne.addEventListener("load",function(){U.loading|=1}),ne.addEventListener("error",function(){U.loading|=2}),U.loading|=4,qd(L,f,v)}L={type:"stylesheet",instance:L,count:1,state:U},C.set(T,L)}}}function fU(u,f){Pa.X(u,f);var p=Go;if(p&&u){var v=ss(p).hoistableScripts,C=Xo(u),T=v.get(C);T||(T=p.querySelector(Vc(C)),T||(u=d({src:u,async:!0},f),(f=wi.get(C))&&ry(u,f),T=p.createElement("script"),kr(T),rn(T,"link",u),p.head.appendChild(T)),T={type:"script",instance:T,count:1,state:null},v.set(C,T))}}function hU(u,f){Pa.M(u,f);var p=Go;if(p&&u){var v=ss(p).hoistableScripts,C=Xo(u),T=v.get(C);T||(T=p.querySelector(Vc(C)),T||(u=d({src:u,async:!0,type:"module"},f),(f=wi.get(C))&&ry(u,f),T=p.createElement("script"),kr(T),rn(T,"link",u),p.head.appendChild(T)),T={type:"script",instance:T,count:1,state:null},v.set(C,T))}}function OR(u,f,p,v){var C=(C=Z.current)?Id(C):null;if(!C)throw Error(n(446));switch(u){case"meta":case"title":return null;case"style":return typeof p.precedence=="string"&&typeof p.href=="string"?(f=Yo(p.href),p=ss(C).hoistableStyles,v=p.get(f),v||(v={type:"style",instance:null,count:0,state:null},p.set(f,v)),v):{type:"void",instance:null,count:0,state:null};case"link":if(p.rel==="stylesheet"&&typeof p.href=="string"&&typeof p.precedence=="string"){u=Yo(p.href);var T=ss(C).hoistableStyles,L=T.get(u);if(L||(C=C.ownerDocument||C,L={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},T.set(u,L),(T=C.querySelector(Hc(u)))&&!T._p&&(L.instance=T,L.state.loading=5),wi.has(u)||(p={rel:"preload",as:"style",href:p.href,crossOrigin:p.crossOrigin,integrity:p.integrity,media:p.media,hrefLang:p.hrefLang,referrerPolicy:p.referrerPolicy},wi.set(u,p),T||dU(C,u,p,L.state))),f&&v===null)throw Error(n(528,""));return L}if(f&&v!==null)throw Error(n(529,""));return null;case"script":return f=p.async,p=p.src,typeof p=="string"&&f&&typeof f!="function"&&typeof f!="symbol"?(f=Xo(p),p=ss(C).hoistableScripts,v=p.get(f),v||(v={type:"script",instance:null,count:0,state:null},p.set(f,v)),v):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,u))}}function Yo(u){return'href="'+di(u)+'"'}function Hc(u){return'link[rel="stylesheet"]['+u+"]"}function MR(u){return d({},u,{"data-precedence":u.precedence,precedence:null})}function dU(u,f,p,v){u.querySelector('link[rel="preload"][as="style"]['+f+"]")?v.loading=1:(f=u.createElement("link"),v.preload=f,f.addEventListener("load",function(){return v.loading|=1}),f.addEventListener("error",function(){return v.loading|=2}),rn(f,"link",p),kr(f),u.head.appendChild(f))}function Xo(u){return'[src="'+di(u)+'"]'}function Vc(u){return"script[async]"+u}function RR(u,f,p){if(f.count++,f.instance===null)switch(f.type){case"style":var v=u.querySelector('style[data-href~="'+di(p.href)+'"]');if(v)return f.instance=v,kr(v),v;var C=d({},p,{"data-href":p.href,"data-precedence":p.precedence,href:null,precedence:null});return v=(u.ownerDocument||u).createElement("style"),kr(v),rn(v,"style",C),qd(v,p.precedence,u),f.instance=v;case"stylesheet":C=Yo(p.href);var T=u.querySelector(Hc(C));if(T)return f.state.loading|=4,f.instance=T,kr(T),T;v=MR(p),(C=wi.get(C))&&ty(v,C),T=(u.ownerDocument||u).createElement("link"),kr(T);var L=T;return L._p=new Promise(function(U,ne){L.onload=U,L.onerror=ne}),rn(T,"link",v),f.state.loading|=4,qd(T,p.precedence,u),f.instance=T;case"script":return T=Xo(p.src),(C=u.querySelector(Vc(T)))?(f.instance=C,kr(C),C):(v=p,(C=wi.get(T))&&(v=d({},p),ry(v,C)),u=u.ownerDocument||u,C=u.createElement("script"),kr(C),rn(C,"link",v),u.head.appendChild(C),f.instance=C);case"void":return null;default:throw Error(n(443,f.type))}else f.type==="stylesheet"&&(f.state.loading&4)===0&&(v=f.instance,f.state.loading|=4,qd(v,p.precedence,u));return f.instance}function qd(u,f,p){for(var v=p.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),C=v.length?v[v.length-1]:null,T=C,L=0;L<v.length;L++){var U=v[L];if(U.dataset.precedence===f)T=U;else if(T!==C)break}T?T.parentNode.insertBefore(u,T.nextSibling):(f=p.nodeType===9?p.head:p,f.insertBefore(u,f.firstChild))}function ty(u,f){u.crossOrigin==null&&(u.crossOrigin=f.crossOrigin),u.referrerPolicy==null&&(u.referrerPolicy=f.referrerPolicy),u.title==null&&(u.title=f.title)}function ry(u,f){u.crossOrigin==null&&(u.crossOrigin=f.crossOrigin),u.referrerPolicy==null&&(u.referrerPolicy=f.referrerPolicy),u.integrity==null&&(u.integrity=f.integrity)}var jd=null;function DR(u,f,p){if(jd===null){var v=new Map,C=jd=new Map;C.set(p,v)}else C=jd,v=C.get(p),v||(v=new Map,C.set(p,v));if(v.has(u))return v;for(v.set(u,null),p=p.getElementsByTagName(u),C=0;C<p.length;C++){var T=p[C];if(!(T[Ur]||T[lr]||u==="link"&&T.getAttribute("rel")==="stylesheet")&&T.namespaceURI!=="http://www.w3.org/2000/svg"){var L=T.getAttribute(f)||"";L=u+L;var U=v.get(L);U?U.push(T):v.set(L,[T])}}return v}function _R(u,f,p){u=u.ownerDocument||u,u.head.insertBefore(p,f==="title"?u.querySelector("head > title"):null)}function pU(u,f,p){if(p===1||f.itemProp!=null)return!1;switch(u){case"meta":case"title":return!0;case"style":if(typeof f.precedence!="string"||typeof f.href!="string"||f.href==="")break;return!0;case"link":if(typeof f.rel!="string"||typeof f.href!="string"||f.href===""||f.onLoad||f.onError)break;return f.rel==="stylesheet"?(u=f.disabled,typeof f.precedence=="string"&&u==null):!0;case"script":if(f.async&&typeof f.async!="function"&&typeof f.async!="symbol"&&!f.onLoad&&!f.onError&&f.src&&typeof f.src=="string")return!0}return!1}function NR(u){return!(u.type==="stylesheet"&&(u.state.loading&3)===0)}function gU(u,f,p,v){if(p.type==="stylesheet"&&(typeof v.media!="string"||matchMedia(v.media).matches!==!1)&&(p.state.loading&4)===0){if(p.instance===null){var C=Yo(v.href),T=f.querySelector(Hc(C));if(T){f=T._p,f!==null&&typeof f=="object"&&typeof f.then=="function"&&(u.count++,u=Fd.bind(u),f.then(u,u)),p.state.loading|=4,p.instance=T,kr(T);return}T=f.ownerDocument||f,v=MR(v),(C=wi.get(C))&&ty(v,C),T=T.createElement("link"),kr(T);var L=T;L._p=new Promise(function(U,ne){L.onload=U,L.onerror=ne}),rn(T,"link",v),p.instance=T}u.stylesheets===null&&(u.stylesheets=new Map),u.stylesheets.set(p,f),(f=p.state.preload)&&(p.state.loading&3)===0&&(u.count++,p=Fd.bind(u),f.addEventListener("load",p),f.addEventListener("error",p))}}var ny=0;function vU(u,f){return u.stylesheets&&u.count===0&&Vd(u,u.stylesheets),0<u.count||0<u.imgCount?function(p){var v=setTimeout(function(){if(u.stylesheets&&Vd(u,u.stylesheets),u.unsuspend){var T=u.unsuspend;u.unsuspend=null,T()}},6e4+f);0<u.imgBytes&&ny===0&&(ny=62500*QV());var C=setTimeout(function(){if(u.waitingForImages=!1,u.count===0&&(u.stylesheets&&Vd(u,u.stylesheets),u.unsuspend)){var T=u.unsuspend;u.unsuspend=null,T()}},(u.imgBytes>ny?50:800)+f);return u.unsuspend=p,function(){u.unsuspend=null,clearTimeout(v),clearTimeout(C)}}:null}function Fd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Vd(this,this.stylesheets);else if(this.unsuspend){var u=this.unsuspend;this.unsuspend=null,u()}}}var Hd=null;function Vd(u,f){u.stylesheets=null,u.unsuspend!==null&&(u.count++,Hd=new Map,f.forEach(mU,u),Hd=null,Fd.call(u))}function mU(u,f){if(!(f.state.loading&4)){var p=Hd.get(u);if(p)var v=p.get(null);else{p=new Map,Hd.set(u,p);for(var C=u.querySelectorAll("link[data-precedence],style[data-precedence]"),T=0;T<C.length;T++){var L=C[T];(L.nodeName==="LINK"||L.getAttribute("media")!=="not all")&&(p.set(L.dataset.precedence,L),v=L)}v&&p.set(null,v)}C=f.instance,L=C.getAttribute("data-precedence"),T=p.get(L)||v,T===v&&p.set(null,C),p.set(L,C),this.count++,v=Fd.bind(this),C.addEventListener("load",v),C.addEventListener("error",v),T?T.parentNode.insertBefore(C,T.nextSibling):(u=u.nodeType===9?u.head:u,u.insertBefore(C,u.firstChild)),f.state.loading|=4}}var Uc={$$typeof:k,Provider:null,Consumer:null,_currentValue:X,_currentValue2:X,_threadCount:0};function yU(u,f,p,v,C,T,L,U,ne){this.tag=1,this.containerInfo=u,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=ct(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ct(0),this.hiddenUpdates=ct(null),this.identifierPrefix=v,this.onUncaughtError=C,this.onCaughtError=T,this.onRecoverableError=L,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ne,this.incompleteTransitions=new Map}function BR(u,f,p,v,C,T,L,U,ne,ge,Ce,Ee){return u=new yU(u,f,p,L,ne,ge,Ce,Ee,U),f=1,T===!0&&(f|=24),T=ti(3,null,null,f),u.current=T,T.stateNode=u,f=Pm(),f.refCount++,u.pooledCache=f,f.refCount++,T.memoizedState={element:v,isDehydrated:p,cache:f},jm(T),u}function LR(u){return u?(u=To,u):To}function PR(u,f,p,v,C,T){C=LR(C),v.context===null?v.context=C:v.pendingContext=C,v=ps(f),v.payload={element:p},T=T===void 0?null:T,T!==null&&(v.callback=T),p=gs(u,v,f),p!==null&&(qn(p,u,f),Sc(p,u,f))}function zR(u,f){if(u=u.memoizedState,u!==null&&u.dehydrated!==null){var p=u.retryLane;u.retryLane=p!==0&&p<f?p:f}}function iy(u,f){zR(u,f),(u=u.alternate)&&zR(u,f)}function IR(u){if(u.tag===13||u.tag===31){var f=ml(u,67108864);f!==null&&qn(f,u,67108864),iy(u,67108864)}}function qR(u){if(u.tag===13||u.tag===31){var f=si();f=Ut(f);var p=ml(u,f);p!==null&&qn(p,u,f),iy(u,f)}}var Ud=!0;function bU(u,f,p,v){var C=q.T;q.T=null;var T=V.p;try{V.p=2,ay(u,f,p,v)}finally{V.p=T,q.T=C}}function xU(u,f,p,v){var C=q.T;q.T=null;var T=V.p;try{V.p=8,ay(u,f,p,v)}finally{V.p=T,q.T=C}}function ay(u,f,p,v){if(Ud){var C=sy(v);if(C===null)$0(u,f,v,$d,p),FR(u,v);else if(SU(C,u,f,p,v))v.stopPropagation();else if(FR(u,v),f&4&&-1<wU.indexOf(u)){for(;C!==null;){var T=as(C);if(T!==null)switch(T.tag){case 3:if(T=T.stateNode,T.current.memoizedState.isDehydrated){var L=Ye(T.pendingLanes);if(L!==0){var U=T;for(U.pendingLanes|=2,U.entangledLanes|=2;L;){var ne=1<<31-le(L);U.entanglements[1]|=ne,L&=~ne}Qi(T),(It&6)===0&&(Ad=je()+500,Ic(0))}}break;case 31:case 13:U=ml(T,2),U!==null&&qn(U,T,2),Md(),iy(T,2)}if(T=sy(v),T===null&&$0(u,f,v,$d,p),T===C)break;C=T}C!==null&&v.stopPropagation()}else $0(u,f,v,null,p)}}function sy(u){return u=om(u),ly(u)}var $d=null;function ly(u){if($d=null,u=is(u),u!==null){var f=a(u);if(f===null)u=null;else{var p=f.tag;if(p===13){if(u=s(f),u!==null)return u;u=null}else if(p===31){if(u=l(f),u!==null)return u;u=null}else if(p===3){if(f.stateNode.current.memoizedState.isDehydrated)return f.tag===3?f.stateNode.containerInfo:null;u=null}else f!==u&&(u=null)}}return $d=u,null}function jR(u){switch(u){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(dt()){case ke:return 2;case De:return 8;case Be:case Ke:return 32;case Oe:return 268435456;default:return 32}default:return 32}}var oy=!1,Es=null,As=null,Os=null,$c=new Map,Gc=new Map,Ms=[],wU="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 FR(u,f){switch(u){case"focusin":case"focusout":Es=null;break;case"dragenter":case"dragleave":As=null;break;case"mouseover":case"mouseout":Os=null;break;case"pointerover":case"pointerout":$c.delete(f.pointerId);break;case"gotpointercapture":case"lostpointercapture":Gc.delete(f.pointerId)}}function Yc(u,f,p,v,C,T){return u===null||u.nativeEvent!==T?(u={blockedOn:f,domEventName:p,eventSystemFlags:v,nativeEvent:T,targetContainers:[C]},f!==null&&(f=as(f),f!==null&&IR(f)),u):(u.eventSystemFlags|=v,f=u.targetContainers,C!==null&&f.indexOf(C)===-1&&f.push(C),u)}function SU(u,f,p,v,C){switch(f){case"focusin":return Es=Yc(Es,u,f,p,v,C),!0;case"dragenter":return As=Yc(As,u,f,p,v,C),!0;case"mouseover":return Os=Yc(Os,u,f,p,v,C),!0;case"pointerover":var T=C.pointerId;return $c.set(T,Yc($c.get(T)||null,u,f,p,v,C)),!0;case"gotpointercapture":return T=C.pointerId,Gc.set(T,Yc(Gc.get(T)||null,u,f,p,v,C)),!0}return!1}function HR(u){var f=is(u.target);if(f!==null){var p=a(f);if(p!==null){if(f=p.tag,f===13){if(f=s(p),f!==null){u.blockedOn=f,hn(u.priority,function(){qR(p)});return}}else if(f===31){if(f=l(p),f!==null){u.blockedOn=f,hn(u.priority,function(){qR(p)});return}}else if(f===3&&p.stateNode.current.memoizedState.isDehydrated){u.blockedOn=p.tag===3?p.stateNode.containerInfo:null;return}}}u.blockedOn=null}function Gd(u){if(u.blockedOn!==null)return!1;for(var f=u.targetContainers;0<f.length;){var p=sy(u.nativeEvent);if(p===null){p=u.nativeEvent;var v=new p.constructor(p.type,p);lm=v,p.target.dispatchEvent(v),lm=null}else return f=as(p),f!==null&&IR(f),u.blockedOn=p,!1;f.shift()}return!0}function VR(u,f,p){Gd(u)&&p.delete(f)}function CU(){oy=!1,Es!==null&&Gd(Es)&&(Es=null),As!==null&&Gd(As)&&(As=null),Os!==null&&Gd(Os)&&(Os=null),$c.forEach(VR),Gc.forEach(VR)}function Yd(u,f){u.blockedOn===f&&(u.blockedOn=null,oy||(oy=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,CU)))}var Xd=null;function UR(u){Xd!==u&&(Xd=u,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Xd===u&&(Xd=null);for(var f=0;f<u.length;f+=3){var p=u[f],v=u[f+1],C=u[f+2];if(typeof v!="function"){if(ly(v||p)===null)continue;break}var T=as(p);T!==null&&(u.splice(f,3),f-=3,s0(T,{pending:!0,data:C,method:p.method,action:v},v,C))}}))}function Wo(u){function f(ne){return Yd(ne,u)}Es!==null&&Yd(Es,u),As!==null&&Yd(As,u),Os!==null&&Yd(Os,u),$c.forEach(f),Gc.forEach(f);for(var p=0;p<Ms.length;p++){var v=Ms[p];v.blockedOn===u&&(v.blockedOn=null)}for(;0<Ms.length&&(p=Ms[0],p.blockedOn===null);)HR(p),p.blockedOn===null&&Ms.shift();if(p=(u.ownerDocument||u).$$reactFormReplay,p!=null)for(v=0;v<p.length;v+=3){var C=p[v],T=p[v+1],L=C[Nr]||null;if(typeof T=="function")L||UR(p);else if(L){var U=null;if(T&&T.hasAttribute("formAction")){if(C=T,L=T[Nr]||null)U=L.formAction;else if(ly(C)!==null)continue}else U=L.action;typeof U=="function"?p[v+1]=U:(p.splice(v,3),v-=3),UR(p)}}}function $R(){function u(T){T.canIntercept&&T.info==="react-transition"&&T.intercept({handler:function(){return new Promise(function(L){return C=L})},focusReset:"manual",scroll:"manual"})}function f(){C!==null&&(C(),C=null),v||setTimeout(p,20)}function p(){if(!v&&!navigation.transition){var T=navigation.currentEntry;T&&T.url!=null&&navigation.navigate(T.url,{state:T.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var v=!1,C=null;return navigation.addEventListener("navigate",u),navigation.addEventListener("navigatesuccess",f),navigation.addEventListener("navigateerror",f),setTimeout(p,100),function(){v=!0,navigation.removeEventListener("navigate",u),navigation.removeEventListener("navigatesuccess",f),navigation.removeEventListener("navigateerror",f),C!==null&&(C(),C=null)}}}function uy(u){this._internalRoot=u}Wd.prototype.render=uy.prototype.render=function(u){var f=this._internalRoot;if(f===null)throw Error(n(409));var p=f.current,v=si();PR(p,v,u,f,null,null)},Wd.prototype.unmount=uy.prototype.unmount=function(){var u=this._internalRoot;if(u!==null){this._internalRoot=null;var f=u.containerInfo;PR(u.current,2,null,u,null,null),Md(),f[_n]=null}};function Wd(u){this._internalRoot=u}Wd.prototype.unstable_scheduleHydration=function(u){if(u){var f=nr();u={blockedOn:null,target:u,priority:f};for(var p=0;p<Ms.length&&f!==0&&f<Ms[p].priority;p++);Ms.splice(p,0,u),p===0&&HR(u)}};var GR=e.version;if(GR!=="19.2.4")throw Error(n(527,GR,"19.2.4"));V.findDOMNode=function(u){var f=u._reactInternals;if(f===void 0)throw typeof u.render=="function"?Error(n(188)):(u=Object.keys(u).join(","),Error(n(268,u)));return u=c(f),u=u!==null?h(u):null,u=u===null?null:u.stateNode,u};var kU={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:q,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Qd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Qd.isDisabled&&Qd.supportsFiber)try{F=Qd.inject(kU),J=Qd}catch{}}return Wc.createRoot=function(u,f){if(!i(u))throw Error(n(299));var p=!1,v="",C=JO,T=eM,L=tM;return f!=null&&(f.unstable_strictMode===!0&&(p=!0),f.identifierPrefix!==void 0&&(v=f.identifierPrefix),f.onUncaughtError!==void 0&&(C=f.onUncaughtError),f.onCaughtError!==void 0&&(T=f.onCaughtError),f.onRecoverableError!==void 0&&(L=f.onRecoverableError)),f=BR(u,1,!1,null,null,p,v,null,C,T,L,$R),u[_n]=f.current,U0(u),new uy(f)},Wc.hydrateRoot=function(u,f,p){if(!i(u))throw Error(n(299));var v=!1,C="",T=JO,L=eM,U=tM,ne=null;return p!=null&&(p.unstable_strictMode===!0&&(v=!0),p.identifierPrefix!==void 0&&(C=p.identifierPrefix),p.onUncaughtError!==void 0&&(T=p.onUncaughtError),p.onCaughtError!==void 0&&(L=p.onCaughtError),p.onRecoverableError!==void 0&&(U=p.onRecoverableError),p.formState!==void 0&&(ne=p.formState)),f=BR(u,1,!0,f,p??null,v,C,ne,T,L,U,$R),f.context=LR(null),p=f.current,v=si(),v=Ut(v),C=ps(v),C.callback=null,gs(p,C,v),p=v,f.current.lanes=p,Ze(f,p),Qi(f),u[_n]=f.current,U0(u),new Wd(f)},Wc.version="19.2.4",Wc}var rD;function BU(){if(rD)return hy.exports;rD=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(),hy.exports=NU(),hy.exports}var AI=BU();const nD=t=>{let e;const r=new Set,n=(c,h)=>{const d=typeof c=="function"?c(e):c;if(!Object.is(d,e)){const g=e;e=h??(typeof d!="object"||d===null)?d:Object.assign({},e,d),r.forEach(m=>m(e,g))}},i=()=>e,l={setState:n,getState:i,getInitialState:()=>o,subscribe:c=>(r.add(c),()=>r.delete(c))},o=e=t(n,i,l);return l},LU=(t=>t?nD(t):nD),PU=t=>t;function zU(t,e=PU){const r=uf.useSyncExternalStore(t.subscribe,uf.useCallback(()=>e(t.getState()),[t,e]),uf.useCallback(()=>e(t.getInitialState()),[t,e]));return uf.useDebugValue(r),r}const iD=t=>{const e=LU(t),r=n=>zU(e,n);return Object.assign(r,e),r},IU=(t=>t?iD(t):iD);function OI(t){return typeof t>"u"||t===null}function qU(t){return typeof t=="object"&&t!==null}function jU(t){return Array.isArray(t)?t:OI(t)?[]:[t]}function FU(t,e){var r,n,i,a;if(e)for(a=Object.keys(e),r=0,n=a.length;r<n;r+=1)i=a[r],t[i]=e[i];return t}function HU(t,e){var r="",n;for(n=0;n<e;n+=1)r+=t;return r}function VU(t){return t===0&&Number.NEGATIVE_INFINITY===1/t}var UU=OI,$U=qU,GU=jU,YU=HU,XU=VU,WU=FU,zr={isNothing:UU,isObject:$U,toArray:GU,repeat:YU,isNegativeZero:XU,extend:WU};function MI(t,e){var r="",n=t.reason||"(unknown reason)";return t.mark?(t.mark.name&&(r+='in "'+t.mark.name+'" '),r+="("+(t.mark.line+1)+":"+(t.mark.column+1)+")",!e&&t.mark.snippet&&(r+=`
10
+
11
+ `+t.mark.snippet),n+" "+r):n}function _f(t,e){Error.call(this),this.name="YAMLException",this.reason=t,this.mark=e,this.message=MI(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}_f.prototype=Object.create(Error.prototype);_f.prototype.constructor=_f;_f.prototype.toString=function(e){return this.name+": "+MI(this,e)};var An=_f;function vy(t,e,r,n,i){var a="",s="",l=Math.floor(i/2)-1;return n-e>l&&(a=" ... ",e=n-l+a.length),r-n>l&&(s=" ...",r=n+l-s.length),{str:a+t.slice(e,r).replace(/\t/g,"→")+s,pos:n-e+a.length}}function my(t,e){return zr.repeat(" ",e-t.length)+t}function QU(t,e){if(e=Object.create(e||null),!t.buffer)return null;e.maxLength||(e.maxLength=79),typeof e.indent!="number"&&(e.indent=1),typeof e.linesBefore!="number"&&(e.linesBefore=3),typeof e.linesAfter!="number"&&(e.linesAfter=2);for(var r=/\r?\n|\r|\0/g,n=[0],i=[],a,s=-1;a=r.exec(t.buffer);)i.push(a.index),n.push(a.index+a[0].length),t.position<=a.index&&s<0&&(s=n.length-2);s<0&&(s=n.length-1);var l="",o,c,h=Math.min(t.line+e.linesAfter,i.length).toString().length,d=e.maxLength-(e.indent+h+3);for(o=1;o<=e.linesBefore&&!(s-o<0);o++)c=vy(t.buffer,n[s-o],i[s-o],t.position-(n[s]-n[s-o]),d),l=zr.repeat(" ",e.indent)+my((t.line-o+1).toString(),h)+" | "+c.str+`
12
+ `+l;for(c=vy(t.buffer,n[s],i[s],t.position,d),l+=zr.repeat(" ",e.indent)+my((t.line+1).toString(),h)+" | "+c.str+`
13
+ `,l+=zr.repeat("-",e.indent+h+3+c.pos)+`^
14
+ `,o=1;o<=e.linesAfter&&!(s+o>=i.length);o++)c=vy(t.buffer,n[s+o],i[s+o],t.position-(n[s]-n[s+o]),d),l+=zr.repeat(" ",e.indent)+my((t.line+o+1).toString(),h)+" | "+c.str+`
15
+ `;return l.replace(/\n$/,"")}var KU=QU,ZU=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],JU=["scalar","sequence","mapping"];function e7(t){var e={};return t!==null&&Object.keys(t).forEach(function(r){t[r].forEach(function(n){e[String(n)]=r})}),e}function t7(t,e){if(e=e||{},Object.keys(e).forEach(function(r){if(ZU.indexOf(r)===-1)throw new An('Unknown option "'+r+'" is met in definition of "'+t+'" YAML type.')}),this.options=e,this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(r){return r},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.representName=e.representName||null,this.defaultStyle=e.defaultStyle||null,this.multi=e.multi||!1,this.styleAliases=e7(e.styleAliases||null),JU.indexOf(this.kind)===-1)throw new An('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')}var sn=t7;function aD(t,e){var r=[];return t[e].forEach(function(n){var i=r.length;r.forEach(function(a,s){a.tag===n.tag&&a.kind===n.kind&&a.multi===n.multi&&(i=s)}),r[i]=n}),r}function r7(){var t={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},e,r;function n(i){i.multi?(t.multi[i.kind].push(i),t.multi.fallback.push(i)):t[i.kind][i.tag]=t.fallback[i.tag]=i}for(e=0,r=arguments.length;e<r;e+=1)arguments[e].forEach(n);return t}function QC(t){return this.extend(t)}QC.prototype.extend=function(e){var r=[],n=[];if(e instanceof sn)n.push(e);else if(Array.isArray(e))n=n.concat(e);else if(e&&(Array.isArray(e.implicit)||Array.isArray(e.explicit)))e.implicit&&(r=r.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit));else throw new An("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");r.forEach(function(a){if(!(a instanceof sn))throw new An("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(a.loadKind&&a.loadKind!=="scalar")throw new An("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(a.multi)throw new An("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),n.forEach(function(a){if(!(a instanceof sn))throw new An("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(QC.prototype);return i.implicit=(this.implicit||[]).concat(r),i.explicit=(this.explicit||[]).concat(n),i.compiledImplicit=aD(i,"implicit"),i.compiledExplicit=aD(i,"explicit"),i.compiledTypeMap=r7(i.compiledImplicit,i.compiledExplicit),i};var RI=QC,DI=new sn("tag:yaml.org,2002:str",{kind:"scalar",construct:function(t){return t!==null?t:""}}),_I=new sn("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(t){return t!==null?t:[]}}),NI=new sn("tag:yaml.org,2002:map",{kind:"mapping",construct:function(t){return t!==null?t:{}}}),BI=new RI({explicit:[DI,_I,NI]});function n7(t){if(t===null)return!0;var e=t.length;return e===1&&t==="~"||e===4&&(t==="null"||t==="Null"||t==="NULL")}function i7(){return null}function a7(t){return t===null}var LI=new sn("tag:yaml.org,2002:null",{kind:"scalar",resolve:n7,construct:i7,predicate:a7,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function s7(t){if(t===null)return!1;var e=t.length;return e===4&&(t==="true"||t==="True"||t==="TRUE")||e===5&&(t==="false"||t==="False"||t==="FALSE")}function l7(t){return t==="true"||t==="True"||t==="TRUE"}function o7(t){return Object.prototype.toString.call(t)==="[object Boolean]"}var PI=new sn("tag:yaml.org,2002:bool",{kind:"scalar",resolve:s7,construct:l7,predicate:o7,represent:{lowercase:function(t){return t?"true":"false"},uppercase:function(t){return t?"TRUE":"FALSE"},camelcase:function(t){return t?"True":"False"}},defaultStyle:"lowercase"});function u7(t){return 48<=t&&t<=57||65<=t&&t<=70||97<=t&&t<=102}function c7(t){return 48<=t&&t<=55}function f7(t){return 48<=t&&t<=57}function h7(t){if(t===null)return!1;var e=t.length,r=0,n=!1,i;if(!e)return!1;if(i=t[r],(i==="-"||i==="+")&&(i=t[++r]),i==="0"){if(r+1===e)return!0;if(i=t[++r],i==="b"){for(r++;r<e;r++)if(i=t[r],i!=="_"){if(i!=="0"&&i!=="1")return!1;n=!0}return n&&i!=="_"}if(i==="x"){for(r++;r<e;r++)if(i=t[r],i!=="_"){if(!u7(t.charCodeAt(r)))return!1;n=!0}return n&&i!=="_"}if(i==="o"){for(r++;r<e;r++)if(i=t[r],i!=="_"){if(!c7(t.charCodeAt(r)))return!1;n=!0}return n&&i!=="_"}}if(i==="_")return!1;for(;r<e;r++)if(i=t[r],i!=="_"){if(!f7(t.charCodeAt(r)))return!1;n=!0}return!(!n||i==="_")}function d7(t){var e=t,r=1,n;if(e.indexOf("_")!==-1&&(e=e.replace(/_/g,"")),n=e[0],(n==="-"||n==="+")&&(n==="-"&&(r=-1),e=e.slice(1),n=e[0]),e==="0")return 0;if(n==="0"){if(e[1]==="b")return r*parseInt(e.slice(2),2);if(e[1]==="x")return r*parseInt(e.slice(2),16);if(e[1]==="o")return r*parseInt(e.slice(2),8)}return r*parseInt(e,10)}function p7(t){return Object.prototype.toString.call(t)==="[object Number]"&&t%1===0&&!zr.isNegativeZero(t)}var zI=new sn("tag:yaml.org,2002:int",{kind:"scalar",resolve:h7,construct:d7,predicate:p7,represent:{binary:function(t){return t>=0?"0b"+t.toString(2):"-0b"+t.toString(2).slice(1)},octal:function(t){return t>=0?"0o"+t.toString(8):"-0o"+t.toString(8).slice(1)},decimal:function(t){return t.toString(10)},hexadecimal:function(t){return t>=0?"0x"+t.toString(16).toUpperCase():"-0x"+t.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),g7=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function v7(t){return!(t===null||!g7.test(t)||t[t.length-1]==="_")}function m7(t){var e,r;return e=t.replace(/_/g,"").toLowerCase(),r=e[0]==="-"?-1:1,"+-".indexOf(e[0])>=0&&(e=e.slice(1)),e===".inf"?r===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:e===".nan"?NaN:r*parseFloat(e,10)}var y7=/^[-+]?[0-9]+e/;function b7(t,e){var r;if(isNaN(t))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(zr.isNegativeZero(t))return"-0.0";return r=t.toString(10),y7.test(r)?r.replace("e",".e"):r}function x7(t){return Object.prototype.toString.call(t)==="[object Number]"&&(t%1!==0||zr.isNegativeZero(t))}var II=new sn("tag:yaml.org,2002:float",{kind:"scalar",resolve:v7,construct:m7,predicate:x7,represent:b7,defaultStyle:"lowercase"}),qI=BI.extend({implicit:[LI,PI,zI,II]}),jI=qI,FI=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),HI=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function w7(t){return t===null?!1:FI.exec(t)!==null||HI.exec(t)!==null}function S7(t){var e,r,n,i,a,s,l,o=0,c=null,h,d,g;if(e=FI.exec(t),e===null&&(e=HI.exec(t)),e===null)throw new Error("Date resolve error");if(r=+e[1],n=+e[2]-1,i=+e[3],!e[4])return new Date(Date.UTC(r,n,i));if(a=+e[4],s=+e[5],l=+e[6],e[7]){for(o=e[7].slice(0,3);o.length<3;)o+="0";o=+o}return e[9]&&(h=+e[10],d=+(e[11]||0),c=(h*60+d)*6e4,e[9]==="-"&&(c=-c)),g=new Date(Date.UTC(r,n,i,a,s,l,o)),c&&g.setTime(g.getTime()-c),g}function C7(t){return t.toISOString()}var VI=new sn("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:w7,construct:S7,instanceOf:Date,represent:C7});function k7(t){return t==="<<"||t===null}var UI=new sn("tag:yaml.org,2002:merge",{kind:"scalar",resolve:k7}),kT=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
16
+ \r`;function T7(t){if(t===null)return!1;var e,r,n=0,i=t.length,a=kT;for(r=0;r<i;r++)if(e=a.indexOf(t.charAt(r)),!(e>64)){if(e<0)return!1;n+=6}return n%8===0}function E7(t){var e,r,n=t.replace(/[\r\n=]/g,""),i=n.length,a=kT,s=0,l=[];for(e=0;e<i;e++)e%4===0&&e&&(l.push(s>>16&255),l.push(s>>8&255),l.push(s&255)),s=s<<6|a.indexOf(n.charAt(e));return r=i%4*6,r===0?(l.push(s>>16&255),l.push(s>>8&255),l.push(s&255)):r===18?(l.push(s>>10&255),l.push(s>>2&255)):r===12&&l.push(s>>4&255),new Uint8Array(l)}function A7(t){var e="",r=0,n,i,a=t.length,s=kT;for(n=0;n<a;n++)n%3===0&&n&&(e+=s[r>>18&63],e+=s[r>>12&63],e+=s[r>>6&63],e+=s[r&63]),r=(r<<8)+t[n];return i=a%3,i===0?(e+=s[r>>18&63],e+=s[r>>12&63],e+=s[r>>6&63],e+=s[r&63]):i===2?(e+=s[r>>10&63],e+=s[r>>4&63],e+=s[r<<2&63],e+=s[64]):i===1&&(e+=s[r>>2&63],e+=s[r<<4&63],e+=s[64],e+=s[64]),e}function O7(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}var $I=new sn("tag:yaml.org,2002:binary",{kind:"scalar",resolve:T7,construct:E7,predicate:O7,represent:A7}),M7=Object.prototype.hasOwnProperty,R7=Object.prototype.toString;function D7(t){if(t===null)return!0;var e=[],r,n,i,a,s,l=t;for(r=0,n=l.length;r<n;r+=1){if(i=l[r],s=!1,R7.call(i)!=="[object Object]")return!1;for(a in i)if(M7.call(i,a))if(!s)s=!0;else return!1;if(!s)return!1;if(e.indexOf(a)===-1)e.push(a);else return!1}return!0}function _7(t){return t!==null?t:[]}var GI=new sn("tag:yaml.org,2002:omap",{kind:"sequence",resolve:D7,construct:_7}),N7=Object.prototype.toString;function B7(t){if(t===null)return!0;var e,r,n,i,a,s=t;for(a=new Array(s.length),e=0,r=s.length;e<r;e+=1){if(n=s[e],N7.call(n)!=="[object Object]"||(i=Object.keys(n),i.length!==1))return!1;a[e]=[i[0],n[i[0]]]}return!0}function L7(t){if(t===null)return[];var e,r,n,i,a,s=t;for(a=new Array(s.length),e=0,r=s.length;e<r;e+=1)n=s[e],i=Object.keys(n),a[e]=[i[0],n[i[0]]];return a}var YI=new sn("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:B7,construct:L7}),P7=Object.prototype.hasOwnProperty;function z7(t){if(t===null)return!0;var e,r=t;for(e in r)if(P7.call(r,e)&&r[e]!==null)return!1;return!0}function I7(t){return t!==null?t:{}}var XI=new sn("tag:yaml.org,2002:set",{kind:"mapping",resolve:z7,construct:I7}),TT=jI.extend({implicit:[VI,UI],explicit:[$I,GI,YI,XI]}),Gs=Object.prototype.hasOwnProperty,sg=1,WI=2,QI=3,lg=4,yy=1,q7=2,sD=3,j7=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,F7=/[\x85\u2028\u2029]/,H7=/[,\[\]\{\}]/,KI=/^(?:!|!!|![a-z\-]+!)$/i,ZI=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function lD(t){return Object.prototype.toString.call(t)}function fa(t){return t===10||t===13}function Yl(t){return t===9||t===32}function Gn(t){return t===9||t===32||t===10||t===13}function hu(t){return t===44||t===91||t===93||t===123||t===125}function V7(t){var e;return 48<=t&&t<=57?t-48:(e=t|32,97<=e&&e<=102?e-97+10:-1)}function U7(t){return t===120?2:t===117?4:t===85?8:0}function $7(t){return 48<=t&&t<=57?t-48:-1}function oD(t){return t===48?"\0":t===97?"\x07":t===98?"\b":t===116||t===9?" ":t===110?`
17
+ `:t===118?"\v":t===102?"\f":t===114?"\r":t===101?"\x1B":t===32?" ":t===34?'"':t===47?"/":t===92?"\\":t===78?"…":t===95?" ":t===76?"\u2028":t===80?"\u2029":""}function G7(t){return t<=65535?String.fromCharCode(t):String.fromCharCode((t-65536>>10)+55296,(t-65536&1023)+56320)}function JI(t,e,r){e==="__proto__"?Object.defineProperty(t,e,{configurable:!0,enumerable:!0,writable:!0,value:r}):t[e]=r}var eq=new Array(256),tq=new Array(256);for(var Qo=0;Qo<256;Qo++)eq[Qo]=oD(Qo)?1:0,tq[Qo]=oD(Qo);function Y7(t,e){this.input=t,this.filename=e.filename||null,this.schema=e.schema||TT,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=t.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function rq(t,e){var r={name:t.filename,buffer:t.input.slice(0,-1),position:t.position,line:t.line,column:t.position-t.lineStart};return r.snippet=KU(r),new An(e,r)}function st(t,e){throw rq(t,e)}function og(t,e){t.onWarning&&t.onWarning.call(null,rq(t,e))}var uD={YAML:function(e,r,n){var i,a,s;e.version!==null&&st(e,"duplication of %YAML directive"),n.length!==1&&st(e,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),i===null&&st(e,"ill-formed argument of the YAML directive"),a=parseInt(i[1],10),s=parseInt(i[2],10),a!==1&&st(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=s<2,s!==1&&s!==2&&og(e,"unsupported YAML version of the document")},TAG:function(e,r,n){var i,a;n.length!==2&&st(e,"TAG directive accepts exactly two arguments"),i=n[0],a=n[1],KI.test(i)||st(e,"ill-formed tag handle (first argument) of the TAG directive"),Gs.call(e.tagMap,i)&&st(e,'there is a previously declared suffix for "'+i+'" tag handle'),ZI.test(a)||st(e,"ill-formed tag prefix (second argument) of the TAG directive");try{a=decodeURIComponent(a)}catch{st(e,"tag prefix is malformed: "+a)}e.tagMap[i]=a}};function Hs(t,e,r,n){var i,a,s,l;if(e<r){if(l=t.input.slice(e,r),n)for(i=0,a=l.length;i<a;i+=1)s=l.charCodeAt(i),s===9||32<=s&&s<=1114111||st(t,"expected valid JSON character");else j7.test(l)&&st(t,"the stream contains non-printable characters");t.result+=l}}function cD(t,e,r,n){var i,a,s,l;for(zr.isObject(r)||st(t,"cannot merge mappings; the provided source object is unacceptable"),i=Object.keys(r),s=0,l=i.length;s<l;s+=1)a=i[s],Gs.call(e,a)||(JI(e,a,r[a]),n[a]=!0)}function du(t,e,r,n,i,a,s,l,o){var c,h;if(Array.isArray(i))for(i=Array.prototype.slice.call(i),c=0,h=i.length;c<h;c+=1)Array.isArray(i[c])&&st(t,"nested arrays are not supported inside keys"),typeof i=="object"&&lD(i[c])==="[object Object]"&&(i[c]="[object Object]");if(typeof i=="object"&&lD(i)==="[object Object]"&&(i="[object Object]"),i=String(i),e===null&&(e={}),n==="tag:yaml.org,2002:merge")if(Array.isArray(a))for(c=0,h=a.length;c<h;c+=1)cD(t,e,a[c],r);else cD(t,e,a,r);else!t.json&&!Gs.call(r,i)&&Gs.call(e,i)&&(t.line=s||t.line,t.lineStart=l||t.lineStart,t.position=o||t.position,st(t,"duplicated mapping key")),JI(e,i,a),delete r[i];return e}function ET(t){var e;e=t.input.charCodeAt(t.position),e===10?t.position++:e===13?(t.position++,t.input.charCodeAt(t.position)===10&&t.position++):st(t,"a line break is expected"),t.line+=1,t.lineStart=t.position,t.firstTabInLine=-1}function Dr(t,e,r){for(var n=0,i=t.input.charCodeAt(t.position);i!==0;){for(;Yl(i);)i===9&&t.firstTabInLine===-1&&(t.firstTabInLine=t.position),i=t.input.charCodeAt(++t.position);if(e&&i===35)do i=t.input.charCodeAt(++t.position);while(i!==10&&i!==13&&i!==0);if(fa(i))for(ET(t),i=t.input.charCodeAt(t.position),n++,t.lineIndent=0;i===32;)t.lineIndent++,i=t.input.charCodeAt(++t.position);else break}return r!==-1&&n!==0&&t.lineIndent<r&&og(t,"deficient indentation"),n}function nv(t){var e=t.position,r;return r=t.input.charCodeAt(e),!!((r===45||r===46)&&r===t.input.charCodeAt(e+1)&&r===t.input.charCodeAt(e+2)&&(e+=3,r=t.input.charCodeAt(e),r===0||Gn(r)))}function AT(t,e){e===1?t.result+=" ":e>1&&(t.result+=zr.repeat(`
18
+ `,e-1))}function X7(t,e,r){var n,i,a,s,l,o,c,h,d=t.kind,g=t.result,m;if(m=t.input.charCodeAt(t.position),Gn(m)||hu(m)||m===35||m===38||m===42||m===33||m===124||m===62||m===39||m===34||m===37||m===64||m===96||(m===63||m===45)&&(i=t.input.charCodeAt(t.position+1),Gn(i)||r&&hu(i)))return!1;for(t.kind="scalar",t.result="",a=s=t.position,l=!1;m!==0;){if(m===58){if(i=t.input.charCodeAt(t.position+1),Gn(i)||r&&hu(i))break}else if(m===35){if(n=t.input.charCodeAt(t.position-1),Gn(n))break}else{if(t.position===t.lineStart&&nv(t)||r&&hu(m))break;if(fa(m))if(o=t.line,c=t.lineStart,h=t.lineIndent,Dr(t,!1,-1),t.lineIndent>=e){l=!0,m=t.input.charCodeAt(t.position);continue}else{t.position=s,t.line=o,t.lineStart=c,t.lineIndent=h;break}}l&&(Hs(t,a,s,!1),AT(t,t.line-o),a=s=t.position,l=!1),Yl(m)||(s=t.position+1),m=t.input.charCodeAt(++t.position)}return Hs(t,a,s,!1),t.result?!0:(t.kind=d,t.result=g,!1)}function W7(t,e){var r,n,i;if(r=t.input.charCodeAt(t.position),r!==39)return!1;for(t.kind="scalar",t.result="",t.position++,n=i=t.position;(r=t.input.charCodeAt(t.position))!==0;)if(r===39)if(Hs(t,n,t.position,!0),r=t.input.charCodeAt(++t.position),r===39)n=t.position,t.position++,i=t.position;else return!0;else fa(r)?(Hs(t,n,i,!0),AT(t,Dr(t,!1,e)),n=i=t.position):t.position===t.lineStart&&nv(t)?st(t,"unexpected end of the document within a single quoted scalar"):(t.position++,i=t.position);st(t,"unexpected end of the stream within a single quoted scalar")}function Q7(t,e){var r,n,i,a,s,l;if(l=t.input.charCodeAt(t.position),l!==34)return!1;for(t.kind="scalar",t.result="",t.position++,r=n=t.position;(l=t.input.charCodeAt(t.position))!==0;){if(l===34)return Hs(t,r,t.position,!0),t.position++,!0;if(l===92){if(Hs(t,r,t.position,!0),l=t.input.charCodeAt(++t.position),fa(l))Dr(t,!1,e);else if(l<256&&eq[l])t.result+=tq[l],t.position++;else if((s=U7(l))>0){for(i=s,a=0;i>0;i--)l=t.input.charCodeAt(++t.position),(s=V7(l))>=0?a=(a<<4)+s:st(t,"expected hexadecimal character");t.result+=G7(a),t.position++}else st(t,"unknown escape sequence");r=n=t.position}else fa(l)?(Hs(t,r,n,!0),AT(t,Dr(t,!1,e)),r=n=t.position):t.position===t.lineStart&&nv(t)?st(t,"unexpected end of the document within a double quoted scalar"):(t.position++,n=t.position)}st(t,"unexpected end of the stream within a double quoted scalar")}function K7(t,e){var r=!0,n,i,a,s=t.tag,l,o=t.anchor,c,h,d,g,m,y=Object.create(null),b,x,w,S;if(S=t.input.charCodeAt(t.position),S===91)h=93,m=!1,l=[];else if(S===123)h=125,m=!0,l={};else return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=l),S=t.input.charCodeAt(++t.position);S!==0;){if(Dr(t,!0,e),S=t.input.charCodeAt(t.position),S===h)return t.position++,t.tag=s,t.anchor=o,t.kind=m?"mapping":"sequence",t.result=l,!0;r?S===44&&st(t,"expected the node content, but found ','"):st(t,"missed comma between flow collection entries"),x=b=w=null,d=g=!1,S===63&&(c=t.input.charCodeAt(t.position+1),Gn(c)&&(d=g=!0,t.position++,Dr(t,!0,e))),n=t.line,i=t.lineStart,a=t.position,Nu(t,e,sg,!1,!0),x=t.tag,b=t.result,Dr(t,!0,e),S=t.input.charCodeAt(t.position),(g||t.line===n)&&S===58&&(d=!0,S=t.input.charCodeAt(++t.position),Dr(t,!0,e),Nu(t,e,sg,!1,!0),w=t.result),m?du(t,l,y,x,b,w,n,i,a):d?l.push(du(t,null,y,x,b,w,n,i,a)):l.push(b),Dr(t,!0,e),S=t.input.charCodeAt(t.position),S===44?(r=!0,S=t.input.charCodeAt(++t.position)):r=!1}st(t,"unexpected end of the stream within a flow collection")}function Z7(t,e){var r,n,i=yy,a=!1,s=!1,l=e,o=0,c=!1,h,d;if(d=t.input.charCodeAt(t.position),d===124)n=!1;else if(d===62)n=!0;else return!1;for(t.kind="scalar",t.result="";d!==0;)if(d=t.input.charCodeAt(++t.position),d===43||d===45)yy===i?i=d===43?sD:q7:st(t,"repeat of a chomping mode identifier");else if((h=$7(d))>=0)h===0?st(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):s?st(t,"repeat of an indentation width identifier"):(l=e+h-1,s=!0);else break;if(Yl(d)){do d=t.input.charCodeAt(++t.position);while(Yl(d));if(d===35)do d=t.input.charCodeAt(++t.position);while(!fa(d)&&d!==0)}for(;d!==0;){for(ET(t),t.lineIndent=0,d=t.input.charCodeAt(t.position);(!s||t.lineIndent<l)&&d===32;)t.lineIndent++,d=t.input.charCodeAt(++t.position);if(!s&&t.lineIndent>l&&(l=t.lineIndent),fa(d)){o++;continue}if(t.lineIndent<l){i===sD?t.result+=zr.repeat(`
19
+ `,a?1+o:o):i===yy&&a&&(t.result+=`
20
+ `);break}for(n?Yl(d)?(c=!0,t.result+=zr.repeat(`
21
+ `,a?1+o:o)):c?(c=!1,t.result+=zr.repeat(`
22
+ `,o+1)):o===0?a&&(t.result+=" "):t.result+=zr.repeat(`
23
+ `,o):t.result+=zr.repeat(`
24
+ `,a?1+o:o),a=!0,s=!0,o=0,r=t.position;!fa(d)&&d!==0;)d=t.input.charCodeAt(++t.position);Hs(t,r,t.position,!1)}return!0}function fD(t,e){var r,n=t.tag,i=t.anchor,a=[],s,l=!1,o;if(t.firstTabInLine!==-1)return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=a),o=t.input.charCodeAt(t.position);o!==0&&(t.firstTabInLine!==-1&&(t.position=t.firstTabInLine,st(t,"tab characters must not be used in indentation")),!(o!==45||(s=t.input.charCodeAt(t.position+1),!Gn(s))));){if(l=!0,t.position++,Dr(t,!0,-1)&&t.lineIndent<=e){a.push(null),o=t.input.charCodeAt(t.position);continue}if(r=t.line,Nu(t,e,QI,!1,!0),a.push(t.result),Dr(t,!0,-1),o=t.input.charCodeAt(t.position),(t.line===r||t.lineIndent>e)&&o!==0)st(t,"bad indentation of a sequence entry");else if(t.lineIndent<e)break}return l?(t.tag=n,t.anchor=i,t.kind="sequence",t.result=a,!0):!1}function J7(t,e,r){var n,i,a,s,l,o,c=t.tag,h=t.anchor,d={},g=Object.create(null),m=null,y=null,b=null,x=!1,w=!1,S;if(t.firstTabInLine!==-1)return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=d),S=t.input.charCodeAt(t.position);S!==0;){if(!x&&t.firstTabInLine!==-1&&(t.position=t.firstTabInLine,st(t,"tab characters must not be used in indentation")),n=t.input.charCodeAt(t.position+1),a=t.line,(S===63||S===58)&&Gn(n))S===63?(x&&(du(t,d,g,m,y,null,s,l,o),m=y=b=null),w=!0,x=!0,i=!0):x?(x=!1,i=!0):st(t,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),t.position+=1,S=n;else{if(s=t.line,l=t.lineStart,o=t.position,!Nu(t,r,WI,!1,!0))break;if(t.line===a){for(S=t.input.charCodeAt(t.position);Yl(S);)S=t.input.charCodeAt(++t.position);if(S===58)S=t.input.charCodeAt(++t.position),Gn(S)||st(t,"a whitespace character is expected after the key-value separator within a block mapping"),x&&(du(t,d,g,m,y,null,s,l,o),m=y=b=null),w=!0,x=!1,i=!1,m=t.tag,y=t.result;else if(w)st(t,"can not read an implicit mapping pair; a colon is missed");else return t.tag=c,t.anchor=h,!0}else if(w)st(t,"can not read a block mapping entry; a multiline key may not be an implicit key");else return t.tag=c,t.anchor=h,!0}if((t.line===a||t.lineIndent>e)&&(x&&(s=t.line,l=t.lineStart,o=t.position),Nu(t,e,lg,!0,i)&&(x?y=t.result:b=t.result),x||(du(t,d,g,m,y,b,s,l,o),m=y=b=null),Dr(t,!0,-1),S=t.input.charCodeAt(t.position)),(t.line===a||t.lineIndent>e)&&S!==0)st(t,"bad indentation of a mapping entry");else if(t.lineIndent<e)break}return x&&du(t,d,g,m,y,null,s,l,o),w&&(t.tag=c,t.anchor=h,t.kind="mapping",t.result=d),w}function e$(t){var e,r=!1,n=!1,i,a,s;if(s=t.input.charCodeAt(t.position),s!==33)return!1;if(t.tag!==null&&st(t,"duplication of a tag property"),s=t.input.charCodeAt(++t.position),s===60?(r=!0,s=t.input.charCodeAt(++t.position)):s===33?(n=!0,i="!!",s=t.input.charCodeAt(++t.position)):i="!",e=t.position,r){do s=t.input.charCodeAt(++t.position);while(s!==0&&s!==62);t.position<t.length?(a=t.input.slice(e,t.position),s=t.input.charCodeAt(++t.position)):st(t,"unexpected end of the stream within a verbatim tag")}else{for(;s!==0&&!Gn(s);)s===33&&(n?st(t,"tag suffix cannot contain exclamation marks"):(i=t.input.slice(e-1,t.position+1),KI.test(i)||st(t,"named tag handle cannot contain such characters"),n=!0,e=t.position+1)),s=t.input.charCodeAt(++t.position);a=t.input.slice(e,t.position),H7.test(a)&&st(t,"tag suffix cannot contain flow indicator characters")}a&&!ZI.test(a)&&st(t,"tag name cannot contain such characters: "+a);try{a=decodeURIComponent(a)}catch{st(t,"tag name is malformed: "+a)}return r?t.tag=a:Gs.call(t.tagMap,i)?t.tag=t.tagMap[i]+a:i==="!"?t.tag="!"+a:i==="!!"?t.tag="tag:yaml.org,2002:"+a:st(t,'undeclared tag handle "'+i+'"'),!0}function t$(t){var e,r;if(r=t.input.charCodeAt(t.position),r!==38)return!1;for(t.anchor!==null&&st(t,"duplication of an anchor property"),r=t.input.charCodeAt(++t.position),e=t.position;r!==0&&!Gn(r)&&!hu(r);)r=t.input.charCodeAt(++t.position);return t.position===e&&st(t,"name of an anchor node must contain at least one character"),t.anchor=t.input.slice(e,t.position),!0}function r$(t){var e,r,n;if(n=t.input.charCodeAt(t.position),n!==42)return!1;for(n=t.input.charCodeAt(++t.position),e=t.position;n!==0&&!Gn(n)&&!hu(n);)n=t.input.charCodeAt(++t.position);return t.position===e&&st(t,"name of an alias node must contain at least one character"),r=t.input.slice(e,t.position),Gs.call(t.anchorMap,r)||st(t,'unidentified alias "'+r+'"'),t.result=t.anchorMap[r],Dr(t,!0,-1),!0}function Nu(t,e,r,n,i){var a,s,l,o=1,c=!1,h=!1,d,g,m,y,b,x;if(t.listener!==null&&t.listener("open",t),t.tag=null,t.anchor=null,t.kind=null,t.result=null,a=s=l=lg===r||QI===r,n&&Dr(t,!0,-1)&&(c=!0,t.lineIndent>e?o=1:t.lineIndent===e?o=0:t.lineIndent<e&&(o=-1)),o===1)for(;e$(t)||t$(t);)Dr(t,!0,-1)?(c=!0,l=a,t.lineIndent>e?o=1:t.lineIndent===e?o=0:t.lineIndent<e&&(o=-1)):l=!1;if(l&&(l=c||i),(o===1||lg===r)&&(sg===r||WI===r?b=e:b=e+1,x=t.position-t.lineStart,o===1?l&&(fD(t,x)||J7(t,x,b))||K7(t,b)?h=!0:(s&&Z7(t,b)||W7(t,b)||Q7(t,b)?h=!0:r$(t)?(h=!0,(t.tag!==null||t.anchor!==null)&&st(t,"alias node should not have any properties")):X7(t,b,sg===r)&&(h=!0,t.tag===null&&(t.tag="?")),t.anchor!==null&&(t.anchorMap[t.anchor]=t.result)):o===0&&(h=l&&fD(t,x))),t.tag===null)t.anchor!==null&&(t.anchorMap[t.anchor]=t.result);else if(t.tag==="?"){for(t.result!==null&&t.kind!=="scalar"&&st(t,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+t.kind+'"'),d=0,g=t.implicitTypes.length;d<g;d+=1)if(y=t.implicitTypes[d],y.resolve(t.result)){t.result=y.construct(t.result),t.tag=y.tag,t.anchor!==null&&(t.anchorMap[t.anchor]=t.result);break}}else if(t.tag!=="!"){if(Gs.call(t.typeMap[t.kind||"fallback"],t.tag))y=t.typeMap[t.kind||"fallback"][t.tag];else for(y=null,m=t.typeMap.multi[t.kind||"fallback"],d=0,g=m.length;d<g;d+=1)if(t.tag.slice(0,m[d].tag.length)===m[d].tag){y=m[d];break}y||st(t,"unknown tag !<"+t.tag+">"),t.result!==null&&y.kind!==t.kind&&st(t,"unacceptable node kind for !<"+t.tag+'> tag; it should be "'+y.kind+'", not "'+t.kind+'"'),y.resolve(t.result,t.tag)?(t.result=y.construct(t.result,t.tag),t.anchor!==null&&(t.anchorMap[t.anchor]=t.result)):st(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")}return t.listener!==null&&t.listener("close",t),t.tag!==null||t.anchor!==null||h}function n$(t){var e=t.position,r,n,i,a=!1,s;for(t.version=null,t.checkLineBreaks=t.legacy,t.tagMap=Object.create(null),t.anchorMap=Object.create(null);(s=t.input.charCodeAt(t.position))!==0&&(Dr(t,!0,-1),s=t.input.charCodeAt(t.position),!(t.lineIndent>0||s!==37));){for(a=!0,s=t.input.charCodeAt(++t.position),r=t.position;s!==0&&!Gn(s);)s=t.input.charCodeAt(++t.position);for(n=t.input.slice(r,t.position),i=[],n.length<1&&st(t,"directive name must not be less than one character in length");s!==0;){for(;Yl(s);)s=t.input.charCodeAt(++t.position);if(s===35){do s=t.input.charCodeAt(++t.position);while(s!==0&&!fa(s));break}if(fa(s))break;for(r=t.position;s!==0&&!Gn(s);)s=t.input.charCodeAt(++t.position);i.push(t.input.slice(r,t.position))}s!==0&&ET(t),Gs.call(uD,n)?uD[n](t,n,i):og(t,'unknown document directive "'+n+'"')}if(Dr(t,!0,-1),t.lineIndent===0&&t.input.charCodeAt(t.position)===45&&t.input.charCodeAt(t.position+1)===45&&t.input.charCodeAt(t.position+2)===45?(t.position+=3,Dr(t,!0,-1)):a&&st(t,"directives end mark is expected"),Nu(t,t.lineIndent-1,lg,!1,!0),Dr(t,!0,-1),t.checkLineBreaks&&F7.test(t.input.slice(e,t.position))&&og(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&&nv(t)){t.input.charCodeAt(t.position)===46&&(t.position+=3,Dr(t,!0,-1));return}if(t.position<t.length-1)st(t,"end of the stream or a document separator is expected");else return}function nq(t,e){t=String(t),e=e||{},t.length!==0&&(t.charCodeAt(t.length-1)!==10&&t.charCodeAt(t.length-1)!==13&&(t+=`
25
+ `),t.charCodeAt(0)===65279&&(t=t.slice(1)));var r=new Y7(t,e),n=t.indexOf("\0");for(n!==-1&&(r.position=n,st(r,"null byte is not allowed in input")),r.input+="\0";r.input.charCodeAt(r.position)===32;)r.lineIndent+=1,r.position+=1;for(;r.position<r.length-1;)n$(r);return r.documents}function i$(t,e,r){e!==null&&typeof e=="object"&&typeof r>"u"&&(r=e,e=null);var n=nq(t,r);if(typeof e!="function")return n;for(var i=0,a=n.length;i<a;i+=1)e(n[i])}function a$(t,e){var r=nq(t,e);if(r.length!==0){if(r.length===1)return r[0];throw new An("expected a single document in the stream, but found more")}}var s$=i$,l$=a$,iq={loadAll:s$,load:l$},aq=Object.prototype.toString,sq=Object.prototype.hasOwnProperty,OT=65279,o$=9,Nf=10,u$=13,c$=32,f$=33,h$=34,KC=35,d$=37,p$=38,g$=39,v$=42,lq=44,m$=45,ug=58,y$=61,b$=62,x$=63,w$=64,oq=91,uq=93,S$=96,cq=123,C$=124,fq=125,xn={};xn[0]="\\0";xn[7]="\\a";xn[8]="\\b";xn[9]="\\t";xn[10]="\\n";xn[11]="\\v";xn[12]="\\f";xn[13]="\\r";xn[27]="\\e";xn[34]='\\"';xn[92]="\\\\";xn[133]="\\N";xn[160]="\\_";xn[8232]="\\L";xn[8233]="\\P";var k$=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],T$=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function E$(t,e){var r,n,i,a,s,l,o;if(e===null)return{};for(r={},n=Object.keys(e),i=0,a=n.length;i<a;i+=1)s=n[i],l=String(e[s]),s.slice(0,2)==="!!"&&(s="tag:yaml.org,2002:"+s.slice(2)),o=t.compiledTypeMap.fallback[s],o&&sq.call(o.styleAliases,l)&&(l=o.styleAliases[l]),r[s]=l;return r}function A$(t){var e,r,n;if(e=t.toString(16).toUpperCase(),t<=255)r="x",n=2;else if(t<=65535)r="u",n=4;else if(t<=4294967295)r="U",n=8;else throw new An("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+r+zr.repeat("0",n-e.length)+e}var O$=1,Bf=2;function M$(t){this.schema=t.schema||TT,this.indent=Math.max(1,t.indent||2),this.noArrayIndent=t.noArrayIndent||!1,this.skipInvalid=t.skipInvalid||!1,this.flowLevel=zr.isNothing(t.flowLevel)?-1:t.flowLevel,this.styleMap=E$(this.schema,t.styles||null),this.sortKeys=t.sortKeys||!1,this.lineWidth=t.lineWidth||80,this.noRefs=t.noRefs||!1,this.noCompatMode=t.noCompatMode||!1,this.condenseFlow=t.condenseFlow||!1,this.quotingType=t.quotingType==='"'?Bf:O$,this.forceQuotes=t.forceQuotes||!1,this.replacer=typeof t.replacer=="function"?t.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function hD(t,e){for(var r=zr.repeat(" ",e),n=0,i=-1,a="",s,l=t.length;n<l;)i=t.indexOf(`
26
+ `,n),i===-1?(s=t.slice(n),n=l):(s=t.slice(n,i+1),n=i+1),s.length&&s!==`
27
+ `&&(a+=r),a+=s;return a}function ZC(t,e){return`
28
+ `+zr.repeat(" ",t.indent*e)}function R$(t,e){var r,n,i;for(r=0,n=t.implicitTypes.length;r<n;r+=1)if(i=t.implicitTypes[r],i.resolve(e))return!0;return!1}function cg(t){return t===c$||t===o$}function Lf(t){return 32<=t&&t<=126||161<=t&&t<=55295&&t!==8232&&t!==8233||57344<=t&&t<=65533&&t!==OT||65536<=t&&t<=1114111}function dD(t){return Lf(t)&&t!==OT&&t!==u$&&t!==Nf}function pD(t,e,r){var n=dD(t),i=n&&!cg(t);return(r?n:n&&t!==lq&&t!==oq&&t!==uq&&t!==cq&&t!==fq)&&t!==KC&&!(e===ug&&!i)||dD(e)&&!cg(e)&&t===KC||e===ug&&i}function D$(t){return Lf(t)&&t!==OT&&!cg(t)&&t!==m$&&t!==x$&&t!==ug&&t!==lq&&t!==oq&&t!==uq&&t!==cq&&t!==fq&&t!==KC&&t!==p$&&t!==v$&&t!==f$&&t!==C$&&t!==y$&&t!==b$&&t!==g$&&t!==h$&&t!==d$&&t!==w$&&t!==S$}function _$(t){return!cg(t)&&t!==ug}function cf(t,e){var r=t.charCodeAt(e),n;return r>=55296&&r<=56319&&e+1<t.length&&(n=t.charCodeAt(e+1),n>=56320&&n<=57343)?(r-55296)*1024+n-56320+65536:r}function hq(t){var e=/^\n* /;return e.test(t)}var dq=1,JC=2,pq=3,gq=4,su=5;function N$(t,e,r,n,i,a,s,l){var o,c=0,h=null,d=!1,g=!1,m=n!==-1,y=-1,b=D$(cf(t,0))&&_$(cf(t,t.length-1));if(e||s)for(o=0;o<t.length;c>=65536?o+=2:o++){if(c=cf(t,o),!Lf(c))return su;b=b&&pD(c,h,l),h=c}else{for(o=0;o<t.length;c>=65536?o+=2:o++){if(c=cf(t,o),c===Nf)d=!0,m&&(g=g||o-y-1>n&&t[y+1]!==" ",y=o);else if(!Lf(c))return su;b=b&&pD(c,h,l),h=c}g=g||m&&o-y-1>n&&t[y+1]!==" "}return!d&&!g?b&&!s&&!i(t)?dq:a===Bf?su:JC:r>9&&hq(t)?su:s?a===Bf?su:JC:g?gq:pq}function B$(t,e,r,n,i){t.dump=(function(){if(e.length===0)return t.quotingType===Bf?'""':"''";if(!t.noCompatMode&&(k$.indexOf(e)!==-1||T$.test(e)))return t.quotingType===Bf?'"'+e+'"':"'"+e+"'";var a=t.indent*Math.max(1,r),s=t.lineWidth===-1?-1:Math.max(Math.min(t.lineWidth,40),t.lineWidth-a),l=n||t.flowLevel>-1&&r>=t.flowLevel;function o(c){return R$(t,c)}switch(N$(e,l,t.indent,s,o,t.quotingType,t.forceQuotes&&!n,i)){case dq:return e;case JC:return"'"+e.replace(/'/g,"''")+"'";case pq:return"|"+gD(e,t.indent)+vD(hD(e,a));case gq:return">"+gD(e,t.indent)+vD(hD(L$(e,s),a));case su:return'"'+P$(e)+'"';default:throw new An("impossible error: invalid scalar style")}})()}function gD(t,e){var r=hq(t)?String(e):"",n=t[t.length-1]===`
29
+ `,i=n&&(t[t.length-2]===`
30
+ `||t===`
31
+ `),a=i?"+":n?"":"-";return r+a+`
32
+ `}function vD(t){return t[t.length-1]===`
33
+ `?t.slice(0,-1):t}function L$(t,e){for(var r=/(\n+)([^\n]*)/g,n=(function(){var c=t.indexOf(`
34
+ `);return c=c!==-1?c:t.length,r.lastIndex=c,mD(t.slice(0,c),e)})(),i=t[0]===`
35
+ `||t[0]===" ",a,s;s=r.exec(t);){var l=s[1],o=s[2];a=o[0]===" ",n+=l+(!i&&!a&&o!==""?`
36
+ `:"")+mD(o,e),i=a}return n}function mD(t,e){if(t===""||t[0]===" ")return t;for(var r=/ [^ ]/g,n,i=0,a,s=0,l=0,o="";n=r.exec(t);)l=n.index,l-i>e&&(a=s>i?s:l,o+=`
37
+ `+t.slice(i,a),i=a+1),s=l;return o+=`
38
+ `,t.length-i>e&&s>i?o+=t.slice(i,s)+`
39
+ `+t.slice(s+1):o+=t.slice(i),o.slice(1)}function P$(t){for(var e="",r=0,n,i=0;i<t.length;r>=65536?i+=2:i++)r=cf(t,i),n=xn[r],!n&&Lf(r)?(e+=t[i],r>=65536&&(e+=t[i+1])):e+=n||A$(r);return e}function z$(t,e,r){var n="",i=t.tag,a,s,l;for(a=0,s=r.length;a<s;a+=1)l=r[a],t.replacer&&(l=t.replacer.call(r,String(a),l)),(Ga(t,e,l,!1,!1)||typeof l>"u"&&Ga(t,e,null,!1,!1))&&(n!==""&&(n+=","+(t.condenseFlow?"":" ")),n+=t.dump);t.tag=i,t.dump="["+n+"]"}function yD(t,e,r,n){var i="",a=t.tag,s,l,o;for(s=0,l=r.length;s<l;s+=1)o=r[s],t.replacer&&(o=t.replacer.call(r,String(s),o)),(Ga(t,e+1,o,!0,!0,!1,!0)||typeof o>"u"&&Ga(t,e+1,null,!0,!0,!1,!0))&&((!n||i!=="")&&(i+=ZC(t,e)),t.dump&&Nf===t.dump.charCodeAt(0)?i+="-":i+="- ",i+=t.dump);t.tag=a,t.dump=i||"[]"}function I$(t,e,r){var n="",i=t.tag,a=Object.keys(r),s,l,o,c,h;for(s=0,l=a.length;s<l;s+=1)h="",n!==""&&(h+=", "),t.condenseFlow&&(h+='"'),o=a[s],c=r[o],t.replacer&&(c=t.replacer.call(r,o,c)),Ga(t,e,o,!1,!1)&&(t.dump.length>1024&&(h+="? "),h+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),Ga(t,e,c,!1,!1)&&(h+=t.dump,n+=h));t.tag=i,t.dump="{"+n+"}"}function q$(t,e,r,n){var i="",a=t.tag,s=Object.keys(r),l,o,c,h,d,g;if(t.sortKeys===!0)s.sort();else if(typeof t.sortKeys=="function")s.sort(t.sortKeys);else if(t.sortKeys)throw new An("sortKeys must be a boolean or a function");for(l=0,o=s.length;l<o;l+=1)g="",(!n||i!=="")&&(g+=ZC(t,e)),c=s[l],h=r[c],t.replacer&&(h=t.replacer.call(r,c,h)),Ga(t,e+1,c,!0,!0,!0)&&(d=t.tag!==null&&t.tag!=="?"||t.dump&&t.dump.length>1024,d&&(t.dump&&Nf===t.dump.charCodeAt(0)?g+="?":g+="? "),g+=t.dump,d&&(g+=ZC(t,e)),Ga(t,e+1,h,!0,d)&&(t.dump&&Nf===t.dump.charCodeAt(0)?g+=":":g+=": ",g+=t.dump,i+=g));t.tag=a,t.dump=i||"{}"}function bD(t,e,r){var n,i,a,s,l,o;for(i=r?t.explicitTypes:t.implicitTypes,a=0,s=i.length;a<s;a+=1)if(l=i[a],(l.instanceOf||l.predicate)&&(!l.instanceOf||typeof e=="object"&&e instanceof l.instanceOf)&&(!l.predicate||l.predicate(e))){if(r?l.multi&&l.representName?t.tag=l.representName(e):t.tag=l.tag:t.tag="?",l.represent){if(o=t.styleMap[l.tag]||l.defaultStyle,aq.call(l.represent)==="[object Function]")n=l.represent(e,o);else if(sq.call(l.represent,o))n=l.represent[o](e,o);else throw new An("!<"+l.tag+'> tag resolver accepts not "'+o+'" style');t.dump=n}return!0}return!1}function Ga(t,e,r,n,i,a,s){t.tag=null,t.dump=r,bD(t,r,!1)||bD(t,r,!0);var l=aq.call(t.dump),o=n,c;n&&(n=t.flowLevel<0||t.flowLevel>e);var h=l==="[object Object]"||l==="[object Array]",d,g;if(h&&(d=t.duplicates.indexOf(r),g=d!==-1),(t.tag!==null&&t.tag!=="?"||g||t.indent!==2&&e>0)&&(i=!1),g&&t.usedDuplicates[d])t.dump="*ref_"+d;else{if(h&&g&&!t.usedDuplicates[d]&&(t.usedDuplicates[d]=!0),l==="[object Object]")n&&Object.keys(t.dump).length!==0?(q$(t,e,t.dump,i),g&&(t.dump="&ref_"+d+t.dump)):(I$(t,e,t.dump),g&&(t.dump="&ref_"+d+" "+t.dump));else if(l==="[object Array]")n&&t.dump.length!==0?(t.noArrayIndent&&!s&&e>0?yD(t,e-1,t.dump,i):yD(t,e,t.dump,i),g&&(t.dump="&ref_"+d+t.dump)):(z$(t,e,t.dump),g&&(t.dump="&ref_"+d+" "+t.dump));else if(l==="[object String]")t.tag!=="?"&&B$(t,t.dump,e,a,o);else{if(l==="[object Undefined]")return!1;if(t.skipInvalid)return!1;throw new An("unacceptable kind of an object to dump "+l)}t.tag!==null&&t.tag!=="?"&&(c=encodeURI(t.tag[0]==="!"?t.tag.slice(1):t.tag).replace(/!/g,"%21"),t.tag[0]==="!"?c="!"+c:c.slice(0,18)==="tag:yaml.org,2002:"?c="!!"+c.slice(18):c="!<"+c+">",t.dump=c+" "+t.dump)}return!0}function j$(t,e){var r=[],n=[],i,a;for(ek(t,r,n),i=0,a=n.length;i<a;i+=1)e.duplicates.push(r[n[i]]);e.usedDuplicates=new Array(a)}function ek(t,e,r){var n,i,a;if(t!==null&&typeof t=="object")if(i=e.indexOf(t),i!==-1)r.indexOf(i)===-1&&r.push(i);else if(e.push(t),Array.isArray(t))for(i=0,a=t.length;i<a;i+=1)ek(t[i],e,r);else for(n=Object.keys(t),i=0,a=n.length;i<a;i+=1)ek(t[n[i]],e,r)}function F$(t,e){e=e||{};var r=new M$(e);r.noRefs||j$(t,r);var n=t;return r.replacer&&(n=r.replacer.call({"":n},"",n)),Ga(r,0,n,!0,!0)?r.dump+`
40
+ `:""}var H$=F$,V$={dump:H$};function MT(t,e){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}var U$=sn,$$=RI,G$=BI,Y$=qI,X$=jI,W$=TT,Q$=iq.load,K$=iq.loadAll,Z$=V$.dump,J$=An,eG={binary:$I,float:II,map:NI,null:LI,pairs:YI,set:XI,timestamp:VI,bool:PI,int:zI,merge:UI,omap:GI,seq:_I,str:DI},tG=MT("safeLoad","load"),rG=MT("safeLoadAll","loadAll"),nG=MT("safeDump","dump"),tk={Type:U$,Schema:$$,FAILSAFE_SCHEMA:G$,JSON_SCHEMA:Y$,CORE_SCHEMA:X$,DEFAULT_SCHEMA:W$,load:Q$,loadAll:K$,dump:Z$,YAMLException:J$,types:eG,safeLoad:tG,safeLoadAll:rG,safeDump:nG};function Ia(t){if(!t||typeof t!="object")throw new Error("Invalid YAML: Root must be an object");const e={tables:Array.isArray(t.tables)?t.tables:[],relationships:Array.isArray(t.relationships)?t.relationships:[],lineage:Array.isArray(t.lineage)?t.lineage:[],domains:Array.isArray(t.domains)?t.domains:[],annotations:Array.isArray(t.annotations)?t.annotations:[],layout:t.layout||{}};e.domains&&e.layout&&e.domains.forEach(n=>{n.tables.forEach(i=>{e.layout[i]?e.layout[i].parentId=n.id:e.layout[i]={x:0,y:0,parentId:n.id}})});const r=[];return e.tables.forEach(n=>{n.lineage?.upstream&&Array.isArray(n.lineage.upstream)&&n.lineage.upstream.forEach(i=>{e.lineage.some(s=>s.from===i&&s.to===n.id)||r.push({from:i,to:n.id})})}),r.length>0&&(e.lineage=[...e.lineage??[],...r]),e.tables=e.tables.map(n=>{let i=n.sampleData;if(i&&typeof i=="object"&&!Array.isArray(i)){const s=Array.isArray(i.columns)?i.columns:[],l=Array.isArray(i.rows)?i.rows:[];if(s.length>0&&l.length>0){const o=Array.isArray(n.columns)?n.columns:[];i=l.map(c=>o.map(h=>{const d=s.indexOf(h.id);return d!==-1?c[d]:null}))}else l.length>0?i=l:i=[]}const a=n.appearance?{...n.appearance}:void 0;return a&&a.sub_type&&/^type[0-7]$/.test(a.sub_type)&&!a.scd&&(a.scd=a.sub_type,a.sub_type=void 0),{...n,id:n.id||"unknown",name:n.name!==void 0?n.name:n.id||"Unnamed Table",logical_name:n.logical_name,physical_name:n.physical_name,appearance:a,implementation:n.implementation?{...n.implementation,unique_key:n.implementation.unique_key?Array.isArray(n.implementation.unique_key)?n.implementation.unique_key:[n.implementation.unique_key]:void 0,partition_by:n.implementation.partition_by?Array.isArray(n.implementation.partition_by)?n.implementation.partition_by:[n.implementation.partition_by]:void 0}:void 0,columns:Array.isArray(n.columns)?n.columns.map(s=>({...s,logical:s.logical?{...s.logical}:void 0,physical:s.physical?{...s.physical}:void 0})):[],sampleData:Array.isArray(i)?i:[]}}),e}function iG(t){try{const e=tk.load(t);return Ia(e)}catch(e){throw new Error(`YAML Parsing Error: ${e.message}`)}}let Ko=null;const pt=IU((t,e)=>({schema:null,selectedTableId:null,selectedTableIds:[],selectedEdgeId:null,selectedAnnotationId:null,highlightedNodeIds:[],hoveredColumnId:null,isModelLoading:!1,error:null,isCliMode:typeof window<"u"&&window.MODSCAPE_CLI_MODE===!0,isAutoSaveEnabled:!0,lastSavedAt:0,savingStatus:"idle",lastUpdateSource:"visual",yamlInput:"",setYamlInput:r=>{t({yamlInput:r,lastUpdateSource:"user",lastSavedAt:Date.now()}),e().saveSchema()},syncToYamlInput:()=>{const{schema:r}=e();if(r){const n=tk.dump(r,{indent:2,lineWidth:-1,noRefs:!0});t({yamlInput:n,lastUpdateSource:"visual"})}},availableFiles:[],currentModelSlug:null,isSidebarOpen:!0,isRightPanelOpen:!1,isQuickConnectBarOpen:!1,isCommandPaletteOpen:!1,isPresentationMode:!1,activeTab:"editor",activeRightPanelTab:"tables",focusNodeId:null,pathFinderResult:null,showER:!0,showLineage:!0,showAnnotations:!0,isCompactMode:!1,connectMode:null,theme:"dark",isDetailPanelSuppressed:!1,isDetailPanelMinimized:!0,setSchema:r=>{const n=Ia(r);t({schema:n}),e().syncToYamlInput()},parseAndSetSchema:r=>{try{const n=iG(r);t({schema:n,error:null}),e().saveSchema()}catch(n){t({error:n.message})}},setSelectedTableId:r=>t({selectedTableId:r,selectedEdgeId:null,selectedAnnotationId:null,isDetailPanelMinimized:r?e().isDetailPanelMinimized:!0}),setSelectedTableIds:r=>t({selectedTableIds:r}),setSelectedEdgeId:r=>t({selectedEdgeId:r,selectedTableId:null,selectedAnnotationId:null,isDetailPanelMinimized:r?e().isDetailPanelMinimized:!0}),setSelectedAnnotationId:r=>t({selectedAnnotationId:r,selectedTableId:null,selectedEdgeId:null,isDetailPanelMinimized:r?e().isDetailPanelMinimized:!0}),setHighlightedNodeIds:r=>t({highlightedNodeIds:r}),setIsDetailPanelSuppressed:r=>t({isDetailPanelSuppressed:r}),setIsDetailPanelMinimized:r=>t({isDetailPanelMinimized:r}),setHoveredColumnId:r=>t({hoveredColumnId:r}),setIsCliMode:r=>t({isCliMode:r}),setIsSidebarOpen:r=>t({isSidebarOpen:r}),setIsRightPanelOpen:r=>t({isRightPanelOpen:r}),setIsQuickConnectBarOpen:r=>t({isQuickConnectBarOpen:r}),setIsCommandPaletteOpen:r=>t({isCommandPaletteOpen:r}),setActiveTab:r=>t({activeTab:r,isSidebarOpen:!0}),setActiveRightPanelTab:r=>t({activeRightPanelTab:r,isRightPanelOpen:!0}),setIsPresentationMode:r=>t({isPresentationMode:r}),setIsAutoSaveEnabled:r=>t({isAutoSaveEnabled:r}),setLastUpdateSource:r=>t({lastUpdateSource:r}),setPathFinderResult:r=>t({pathFinderResult:r}),setFocusNodeId:r=>t({focusNodeId:r}),toggleTheme:()=>t(r=>({theme:r.theme==="dark"?"light":"dark"})),setShowER:r=>t({showER:r}),setShowLineage:r=>t({showLineage:r}),setShowAnnotations:r=>t({showAnnotations:r}),setIsCompactMode:r=>t({isCompactMode:r}),setConnectMode:r=>t({connectMode:r}),updateNodePosition:(r,n,i,a)=>{const{schema:s}=e();if(!s)return;const l=s.layout||{},o=l[r]||{},c={...l,[r]:{...o,x:Math.round(n),y:Math.round(i),...a?{parentId:a}:{}}};t({schema:{...s,layout:c},lastUpdateSource:"visual"}),e().syncToYamlInput(),e().saveSchema()},updateNodesPosition:r=>{const{schema:n}=e();if(!n)return;const a={...n.layout||{}};r.forEach(({id:s,x:l,y:o,parentId:c})=>{const h=a[s]||{};a[s]={...h,x:Math.round(l),y:Math.round(o),...c?{parentId:c}:{}}}),t({schema:{...n,layout:a},lastUpdateSource:"visual"}),e().syncToYamlInput(),e().saveSchema()},updateNodeDimensions:(r,n,i)=>{const{schema:a}=e();if(!a)return;const s={x:0,y:0,...a.layout?.[r]},l={...a.layout||{},[r]:{...s,width:n,height:i}};t({schema:{...a,layout:l}}),e().syncToYamlInput(),e().saveSchema()},saveSchema:async(r=!1)=>{const{schema:n,isCliMode:i,isAutoSaveEnabled:a,lastUpdateSource:s,currentModelSlug:l}=e();t({lastSavedAt:Date.now()}),s!=="user"&&(!i||!a&&!r||(Ko&&clearTimeout(Ko),Ko=setTimeout(async()=>{const o=e().currentModelSlug;if(l===o)try{const c=tk.dump(n,{indent:2,lineWidth:-1,noRefs:!0}),h=o?`?model=${o}`:"";await fetch(`/api/save${h}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({yaml:c})}),t({lastSavedAt:Date.now(),savingStatus:"saved"}),setTimeout(()=>t({savingStatus:"idle"}),2e3)}catch{t({savingStatus:"error"})}},1e3),t({savingStatus:"saving"})))},refreshModelData:async()=>{const{lastSavedAt:r}=e();if(!(Date.now()-r<3e3))try{const a=await(await fetch("/api/model"+window.location.search)).json();t({schema:Ia(a),selectedTableId:null,selectedEdgeId:null,selectedAnnotationId:null}),e().syncToYamlInput()}catch(i){console.error("Failed to refresh data:",i)}},addTable:(r,n,i)=>{const a=e().schema||{tables:[],relationships:[],domains:[],layout:{}},s=i?i.toLowerCase().replace(/\s+/g,"_"):`new_table_${Date.now()}`,l={id:s,name:i||"NEW_TABLE",appearance:{type:"table"},columns:[{id:"id",logical:{name:"ID",type:"Integer",isPrimaryKey:!0}}]},o={...a,tables:[...a.tables||[],l],layout:{...a.layout||{},[s]:{x:Math.round(r),y:Math.round(n)}}};t({schema:Ia(o),selectedTableId:s}),e().syncToYamlInput(),e().saveSchema()},addDomain:(r,n,i)=>{const a=e().schema||{tables:[],relationships:[],domains:[],layout:{}},s=i?i.toLowerCase().replace(/\s+/g,"_"):`new_domain_${Date.now()}`,l={id:s,name:i||"NEW_DOMAIN",description:"Domain purpose",tables:[],color:"rgba(59, 130, 246, 0.05)"},o={...a,domains:[...a.domains||[],l],layout:{...a.layout||{},[s]:{x:Math.round(r),y:Math.round(n),width:600,height:400}}};t({schema:Ia(o),selectedTableId:s}),e().syncToYamlInput(),e().saveSchema()},addRelationship:(r,n,i,a)=>{const{schema:s}=e();if(!s)return;const l={from:{table:r,column:i?.split("-")[1]},to:{table:n,column:a?.split("-")[1]},type:"one-to-many"},o={...s,relationships:[...s.relationships||[],l]};t({schema:Ia(o)}),e().syncToYamlInput(),e().saveSchema()},bulkAddRelationship:(r,n,i)=>{const{schema:a}=e();if(!a)return;const s=new RegExp("^"+n.replace(/\*/g,".*")+"$","i"),l=a.tables.filter(o=>s.test(o.id)||(o.columns||[]).some(c=>s.test(`${o.id}.${c.id}`)));if(i==="lineage"){const o=a.lineage??[],c=l.filter(h=>!o.some(d=>d.from===r.table&&d.to===h.id)).map(h=>({from:r.table,to:h.id}));t({schema:{...a,lineage:[...o,...c]}})}else{const o=l.map(c=>{let h;return n.includes(".")&&(h=n.split(".")[1]),{from:r,to:{table:c.id,column:h},type:i}});t({schema:{...a,relationships:[...a.relationships||[],...o]}})}e().syncToYamlInput(),e().saveSchema()},addLineage:(r,n)=>{const{schema:i}=e();if(!i)return;const a=i.lineage??[];a.some(s=>s.from===r&&s.to===n)||(t({schema:{...i,lineage:[...a,{from:r,to:n}]}}),e().syncToYamlInput(),e().saveSchema())},updateRelationship:(r,n)=>{const{schema:i}=e();if(!i)return;const a=[...i.relationships];a[r]={...a[r],...n},t({schema:{...i,relationships:a}}),e().syncToYamlInput(),e().saveSchema()},removeEdge:(r,n,i)=>{const{schema:a}=e();if(!a)return;const s=i==="lineage"?a.relationships:a.relationships.filter(o=>!(o.from.table===r&&o.to.table===n)),l=i==="er"?a.lineage??[]:(a.lineage??[]).filter(o=>!(o.from===r&&o.to===n));t({schema:{...a,relationships:s,lineage:l},selectedEdgeId:null}),e().syncToYamlInput(),e().saveSchema()},removeNode:r=>{const{schema:n}=e();if(!n)return;const i=(n.domains||[]).some(h=>h.id===r),a=n.tables.filter(h=>h.id!==r),s=(n.domains||[]).filter(h=>h.id!==r).map(h=>({...h,tables:h.tables.filter(d=>d!==r)})),l=n.relationships.filter(h=>h.from.table!==r&&h.to.table!==r),o=(n.lineage??[]).filter(h=>h.from!==r&&h.to!==r),c={...n.layout||{}};delete c[r],i&&Object.keys(c).forEach(h=>{c[h].parentId===r&&delete c[h].parentId}),t({schema:{...n,tables:a,domains:s,relationships:l,lineage:o,layout:c},selectedTableId:null}),e().syncToYamlInput(),e().saveSchema()},bulkRemoveTables:r=>{const{schema:n}=e();if(!n)return;const i=n.tables.filter(c=>!r.includes(c.id)),a={...n.layout||{}};r.forEach(c=>delete a[c]);const s=(n.relationships||[]).filter(c=>!r.includes(c.from.table)&&!r.includes(c.to.table)),l=(n.lineage??[]).filter(c=>!r.includes(c.from)&&!r.includes(c.to)),o=(n.domains||[]).map(c=>({...c,tables:c.tables.filter(h=>!r.includes(h))}));t({schema:{...n,tables:i,relationships:s,lineage:l,domains:o,layout:a},selectedTableIds:[]}),e().syncToYamlInput(),e().saveSchema()},updateTable:(r,n)=>{const{schema:i}=e();if(!i)return;const a=i.tables.map(s=>s.id===r?{...s,...n}:s);t({schema:{...i,tables:a}}),e().syncToYamlInput(),e().saveSchema()},updateDomain:(r,n)=>{const{schema:i}=e();if(!i)return;const a=(i.domains||[]).map(s=>s.id===r?{...s,...n}:s);t({schema:{...i,domains:a}}),e().syncToYamlInput(),e().saveSchema()},assignTableToDomain:(r,n)=>{const{schema:i}=e();if(!i)return;const a=(i.domains||[]).map(l=>{const o=l.tables.filter(c=>c!==r);return l.id===n?{...l,tables:Array.from(new Set([...o,r]))}:{...l,tables:o}}),s={...i.layout||{},[r]:{x:20,y:20,...i.layout?.[r],...n?{parentId:n}:{}}};t({schema:{...i,domains:a,layout:s}}),e().syncToYamlInput(),e().saveSchema()},bulkAssignTablesToDomain:(r,n)=>{const{schema:i}=e();if(!i)return;const a=(i.domains||[]).map(l=>{const o=l.tables.filter(c=>!r.includes(c));return l.id===n?{...l,tables:Array.from(new Set([...o,...r]))}:{...l,tables:o}}),s={...i.layout||{}};n&&r.forEach(l=>{const o=s[l]||{};s[l]={...o,x:o.x??20,y:o.y??20,parentId:n}}),t({schema:{...i,domains:a,layout:s}}),e().syncToYamlInput(),e().saveSchema()},distributeSelectedTables:r=>{const{schema:n,selectedTableIds:i}=e();if(!n||i.length<2)return;const a=i.map(o=>({id:o,pos:n.layout?.[o]||{x:0,y:0}}));r==="vertical"?a.sort((o,c)=>o.pos.y-c.pos.y):a.sort((o,c)=>o.pos.x-c.pos.x);const s={...n.layout||{}},l=a[0].pos;a.forEach((o,c)=>{s[o.id]={x:r==="vertical"?l.x:l.x+c*280,y:r==="vertical"?l.y+c*320:l.y}}),t({schema:{...n,layout:s}}),e().syncToYamlInput(),e().saveSchema()},applyLayout:r=>{const{schema:n}=e();n&&(t({schema:{...n,layout:r}}),e().syncToYamlInput(),e().saveSchema())},executePipeline:(r,n=!1)=>{const{schema:i,selectedTableIds:a}=e();if(!i)return{stages:[],outputIds:[]};const s=r.split("|").map(h=>h.trim()).filter(Boolean),l=[];let o=[],c=JSON.parse(JSON.stringify(i));return s.forEach(h=>{const d=h.split(/\s+/),g=d[0].toLowerCase(),m=d.slice(1);let y=[...o],b="",x="success";try{if(g==="select"){const w=m.join(" ");if(w==="*")y=[...c.tables.map(S=>S.id),...(c.domains||[]).map(S=>S.id)];else if(w){const S=new RegExp("^"+w.replace(/\*/g,".*")+"$","i"),k=c.tables.filter(M=>M.id===w||S.test(M.id)||S.test(M.name)).map(M=>M.id),E=(c.domains||[]).filter(M=>M.id===w||S.test(M.id)||S.test(M.name)).map(M=>M.id);y=[...k,...E]}else y=[];y.length>0?(b=`Matched ${y.length} objects`,x="success"):(x="error",b=`No objects matched "${w}"`)}else if(g==="selected")y=[...a],b=`Using ${y.length} selected tables`,x="success";else if(g==="mv"){const w=d.findIndex(k=>k.toLowerCase()==="to"),S=w>-1?d.slice(w+1).join(" "):m.join(" ");!o||o.length===0?(x="error",b='No tables to move. Add a "select" stage.'):S?(c.domains||[]).some(E=>E.id===S)?(c.domains=(c.domains||[]).map(E=>{const M=E.tables.filter(R=>!o.includes(R));return E.id===S?{...E,tables:Array.from(new Set([...M,...o]))}:{...E,tables:M}}),o.forEach(E=>{c.layout&&(c.layout[E]={x:20,y:20})}),b=`Move ${o.length} to ${S}`,x="success"):(x="error",b=`Domain "${S}" not found`):(x="active",b="Waiting for domain...")}else if(g==="stack"||g==="v"||g==="h"){const w=g==="v"||m.includes("v")||m.includes("vertical")?"vertical":"horizontal",S=o.map(E=>({id:E,pos:c.layout?.[E]||{x:0,y:0}}));w==="vertical"?S.sort((E,M)=>E.pos.y-M.pos.y):S.sort((E,M)=>E.pos.x-M.pos.x);const k=S.length>0?S[0].pos:{x:0,y:0};S.forEach((E,M)=>{c.layout&&(c.layout[E.id]={x:w==="vertical"?k.x:k.x+M*280,y:w==="vertical"?k.y+M*320:k.y})}),b=`Stacked ${o.length} ${w}`,x="success"}else if(g==="delete"){const w=o.filter(k=>c.tables.some(E=>E.id===k)),S=o.filter(k=>(c.domains||[]).some(E=>E.id===k));if(c.tables=c.tables.filter(k=>!w.includes(k.id)),c.domains=(c.domains||[]).filter(k=>!S.includes(k.id)),c.lineage=(c.lineage??[]).filter(k=>!w.includes(k.from)&&!w.includes(k.to)),S.length>0&&c.layout){const k={...c.layout};Object.keys(k).forEach(E=>{if(S.includes(k[E].parentId)){const{parentId:M,...R}=k[E];k[E]=R}S.includes(E)&&delete k[E]}),c.layout=k}y=[],b=`Deleted ${w.length} tables and ${S.length} domains`,x="success"}else if(g==="clear")c.domains=(c.domains||[]).map(w=>({...w,tables:w.tables.filter(S=>!o.includes(S))})),b=`Cleared domain for ${o.length} tables`,x="success";else if(g==="add"){const w=m[0]?.toLowerCase(),S=m.slice(1).join(" "),k=E=>{const M=E.toLowerCase().replace(/\s+/g,"_");let R=M||`new_${w}_${Date.now()}`,O=1;const N=B=>c.tables.some(D=>D.id===B)||(c.domains||[]).some(D=>D.id===B);for(;N(R);)R=`${M}_${O}`,O++;return R};if(w==="table"){const E=k(S);c.tables.push({id:E,name:S||"NEW_TABLE",columns:[{id:"id",logical:{name:"ID",type:"Integer",isPrimaryKey:!0}}]}),c.layout||(c.layout={}),c.layout[E]={x:400,y:300},b=`Added table ${E}`,x="success"}else if(w==="domain"){const E=k(S);c.domains.push({id:E,name:S||"NEW_DOMAIN",tables:[],color:"rgba(59, 130, 246, 0.05)"}),c.layout||(c.layout={}),c.layout[E]={x:400,y:300,width:600,height:400},b=`Added domain ${E}`,x="success"}}else x="error",b=`Unknown command: ${g}`}catch{x="error",b="Execution error"}l.push({command:g,args:m,inputIds:o,outputIds:y,status:x,message:b}),o=y}),!n&&l.length>0&&l.every(h=>h.status==="success")&&(t({schema:Ia(c)}),e().syncToYamlInput(),e().saveSchema()),{stages:l,outputIds:o}},toggleTableSelection:r=>{const{selectedTableId:n}=e();t(n===r?{selectedTableId:null,isDetailPanelMinimized:!0}:{selectedTableId:r,selectedEdgeId:null,selectedAnnotationId:null})},toggleEdgeSelection:r=>{const{selectedEdgeId:n}=e();t(n===r?{selectedEdgeId:null}:{selectedEdgeId:r,selectedTableId:null,selectedAnnotationId:null})},toggleAnnotationSelection:r=>{const{selectedAnnotationId:n}=e();t(n===r?{selectedAnnotationId:null}:{selectedAnnotationId:r,selectedTableId:null,selectedEdgeId:null})},addAnnotation:(r,n,i)=>{const{schema:a}=e();if(!a)return;const s=`note_${Date.now()}`,l={id:s,targetId:n,targetType:i,text:"New Note",type:"sticky",offset:r},o={...a,annotations:[...a.annotations||[],l]};t({schema:Ia(o),selectedAnnotationId:s,selectedTableId:null,selectedEdgeId:null}),n||e().setFocusNodeId(s),e().syncToYamlInput(),e().saveSchema()},updateAnnotation:(r,n)=>{const{schema:i}=e();if(!i||!i.annotations)return;const a=i.annotations.map(s=>s.id===r?{...s,...n}:s);t({schema:{...i,annotations:a}}),e().syncToYamlInput(),e().saveSchema()},removeAnnotation:r=>{const{schema:n}=e();if(!n||!n.annotations)return;const i=n.annotations.filter(a=>a.id!==r);t({schema:{...n,annotations:i},selectedAnnotationId:null}),e().syncToYamlInput(),e().saveSchema()},fetchAvailableFiles:async()=>{const r=window.__MODSCAPE_DATA__;if(r?.models){const n=r.models.map(i=>({slug:i.slug,name:i.name,path:""}));t({availableFiles:n});return}try{const i=await(await fetch("/api/files")).json();t({availableFiles:i})}catch(n){console.error("Failed to fetch files:",n)}},setCurrentModel:async r=>{Ko&&(clearTimeout(Ko),Ko=null),t({isModelLoading:!0});try{const n=window.__MODSCAPE_DATA__;let i;n?.models?i=n.models.find(l=>l.slug===r)?.schema:i=await(await fetch(`/api/model?model=${r}`)).json(),t({schema:Ia(i),currentModelSlug:r,selectedTableId:null,selectedEdgeId:null,selectedAnnotationId:null,error:null,isModelLoading:!1}),e().syncToYamlInput();const a=new URLSearchParams(window.location.search);a.set("model",r),window.history.replaceState(null,"",`${window.location.pathname}?${a.toString()}`)}catch(n){console.error("Failed to set model:",n),t({isModelLoading:!1})}},getSelectedTable:()=>{const{schema:r,selectedTableId:n}=e();return!r||!n?null:r.tables.find(i=>i.id===n)||null},getSelectedDomain:()=>{const{schema:r,selectedTableId:n}=e();return!r||!n||!r.domains?null:r.domains.find(i=>i.id===n)||null},getSelectedRelationship:()=>{const{schema:r,selectedEdgeId:n}=e();if(!r||!n)return null;if(n.startsWith("lin-")){const s=n.lastIndexOf("-"),l=parseInt(n.slice(s+1)),o=r.lineage?.[l];return o?{relationship:{from:{table:o.from},to:{table:o.to},type:"lineage"},index:l,kind:"lineage"}:null}if(!n.startsWith("er-"))return null;const i=parseInt(n.split("-")[1]),a=r.relationships?.[i];return a?{relationship:a,index:i,kind:"er"}:null},getSelectedAnnotation:()=>{const{schema:r,selectedAnnotationId:n}=e();return!r||!n||!r.annotations?null:r.annotations.find(i=>i.id===n)||null}})),xD=t=>Symbol.iterator in t,wD=t=>"entries"in t,SD=(t,e)=>{const r=t instanceof Map?t:new Map(t.entries()),n=e instanceof Map?e:new Map(e.entries());if(r.size!==n.size)return!1;for(const[i,a]of r)if(!n.has(i)||!Object.is(a,n.get(i)))return!1;return!0},aG=(t,e)=>{const r=t[Symbol.iterator](),n=e[Symbol.iterator]();let i=r.next(),a=n.next();for(;!i.done&&!a.done;){if(!Object.is(i.value,a.value))return!1;i=r.next(),a=n.next()}return!!i.done&&!!a.done};function sG(t,e){return Object.is(t,e)?!0:typeof t!="object"||t===null||typeof e!="object"||e===null||Object.getPrototypeOf(t)!==Object.getPrototypeOf(e)?!1:xD(t)&&xD(e)?wD(t)&&wD(e)?SD(t,e):aG(t,e):SD({entries:()=>Object.entries(t)},{entries:()=>Object.entries(e)})}function so(t){const e=uf.useRef(void 0);return r=>{const n=t(r);return sG(e.current,n)?e.current:e.current=n}}const RT={fact:{color:"#f87171",icon:"📊",label:"FACT"},dimension:{color:"#60a5fa",icon:"🏷️",label:"DIM"},hub:{color:"#fbbf24",icon:"🌐",label:"HUB"},link:{color:"#34d399",icon:"🔗",label:"LINK"},satellite:{color:"#a78bfa",icon:"🛰️",label:"SAT"},mart:{color:"#f5700b",icon:"📈",label:"MART"},table:{color:"#64748b",icon:"📋",label:"TABLE"}};function vq(t){let r=(t.appearance?.type?RT[t.appearance.type]:null)?.label||"";const n=t.appearance?.sub_type,i=t.appearance?.scd;if(t.appearance?.type==="fact"&&n?r=`FACT (${{transaction:"Trans.",periodic:"Periodic",accumulating:"Accum.",factless:"Factless"}[n]||n})`:t.appearance?.type&&n?r=`${t.appearance.type.toUpperCase()} (${n})`:t.appearance?.type&&(r=t.appearance.type.toUpperCase()),i){const a=`SCD ${i.replace("type","T")}`;r=r?`${r} / ${a}`:a}return r}function lG(t){switch(t){case"one-to-many":return"1..N";case"many-to-one":return"N..1";case"many-to-many":return"N..N";case"one-to-one":return"1..1";default:return""}}function oG(t){const e=[],r=new Map;t.domains?.forEach(l=>{l.tables.forEach(o=>{r.set(o,l.id)})});const n=280,i=200,a=3;t.tables.forEach((l,o)=>{const c=t.layout?.[l.id],h=o%a,d=Math.floor(o/a),g=c?.x??h*(n+40),m=c?.y??d*(i+40),y=l.appearance?.type?RT[l.appearance.type]:null,b=l.appearance?.color||y?.color||"#334155";e.push({data:{id:l.id,table:l,domainId:r.get(l.id)??null,typeColor:b,typeLabel:vq(l),typeIcon:l.appearance?.icon||y?.icon||""},position:{x:g,y:m}})});const s=new Set(t.tables.map(l=>l.id));return t.lineage?.forEach((l,o)=>{!s.has(l.from)||!s.has(l.to)||e.push({data:{id:`lin-${l.from}-${l.to}-${o}`,source:l.from,target:l.to,kind:"lineage"},classes:"lineage-edge"})}),t.relationships?.forEach((l,o)=>{!s.has(l.from.table)||!s.has(l.to.table)||e.push({data:{id:`er-${o}`,source:l.from.table,target:l.to.table,kind:"er",label:lG(l.type),fromColumn:l.from.column??null,toColumn:l.to.column??null,relType:l.type??null},classes:"er-edge"})}),e}const by=6,uG=({table:t,isSelected:e,isDimmed:r,isHighlighted:n,isHovered:i,isPendingSource:a,isConnectMode:s,zoom:l,theme:o,hoveredColumnId:c,isCompact:h})=>{const d=t.appearance?.type?RT[t.appearance.type]:null,g=t.appearance?.color||d?.color||"#334155",m=t.appearance?.icon||d?.icon||"",y=vq(t),b=t.columns&&t.columns.length>0,x=l<.35,w=x||h,S=a?"#22c55e":e?"#3b82f6":i?g:s?"#22c55e":"var(--border-main)",k=a?"0 0 0 3px #22c55e, 0 0 20px 6px rgba(34,197,94,0.5)":e?"0 0 0 3px #3b82f6, 0 0 16px 4px rgba(59, 130, 246, 0.45)":i?`0 0 0 2px ${g}, 0 0 20px 6px ${g}80`:n?"0 0 12px 3px rgba(59, 130, 246, 0.35)":s?"0 0 0 1px rgba(34,197,94,0.4)":o==="dark"?"0 4px 6px -1px rgba(0, 0, 0, 0.3)":"0 4px 12px -2px rgba(0, 0, 0, 0.1)";return A.jsxs("div",{"data-testid":"table-node","data-table-id":t.id,style:{width:"100%",height:"100%",minWidth:"220px",position:"relative",cursor:"default",opacity:r?.15:1,transition:"opacity 0.2s ease-in-out",userSelect:"none"},children:[a&&A.jsx("div",{style:{position:"absolute",top:"-10px",right:"8px",padding:"0 6px",height:"14px",backgroundColor:"#22c55e",color:"#fff",fontSize:"8px",fontWeight:900,borderRadius:"4px",display:"flex",alignItems:"center",letterSpacing:"0.05em",textTransform:"uppercase",zIndex:2,pointerEvents:"none"},children:"FROM"}),y&&A.jsx("div",{style:{position:"absolute",top:"-12px",left:"12px",height:"14px",padding:"0 6px",backgroundColor:g,color:"#ffffff",fontSize:"8px",fontWeight:900,borderRadius:"4px 4px 0 0",display:"flex",alignItems:"center",justifyContent:"center",textTransform:"uppercase",letterSpacing:"0.05em",boxShadow:"0 -2px 4px rgba(0,0,0,0.1)",zIndex:1,pointerEvents:"none"},children:y}),A.jsxs("div",{style:{width:"100%",height:"100%",backgroundColor:"var(--node-bg)",borderLeft:`2px solid ${S}`,borderRight:`2px solid ${S}`,borderBottom:`2px solid ${S}`,borderTop:`4px solid ${g}`,borderRadius:"8px",overflow:"hidden",color:"var(--text-primary)",boxShadow:k,fontFamily:"sans-serif",display:"flex",flexDirection:"column",transition:"border-color 0.2s, box-shadow 0.2s"},children:[A.jsxs("div",{style:{padding:x?"8px 10px":"12px",backgroundColor:o==="dark"?"rgba(15, 23, 42, 0.8)":"rgba(241, 245, 249, 0.9)",borderBottom:b&&!w?"1px solid var(--border-main)":"none",flexShrink:0,cursor:"grab",display:"flex",flexDirection:"column",gap:"2px"},children:[A.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[m&&A.jsx("span",{style:{fontSize:x?"14px":"18px"},children:m}),A.jsx("div",{style:{fontSize:x?"12px":"16px",fontWeight:800,color:"var(--text-primary)",lineHeight:"1.2",wordBreak:"break-all"},children:t.name})]}),!x&&A.jsxs(A.Fragment,{children:[t.logical_name&&t.logical_name!==t.name&&A.jsx("div",{style:{fontSize:"11px",fontWeight:500,color:"var(--text-secondary)",paddingLeft:m?"26px":"0",opacity:.8},children:t.logical_name}),A.jsx("div",{title:t.physical_name||t.id,style:{fontSize:"9px",color:o==="dark"?"#94a3b8":"#64748b",fontFamily:"monospace",letterSpacing:"0.02em",paddingLeft:m?"26px":"0",marginTop:"2px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"},children:t.physical_name||t.id})]})]}),!w&&b&&A.jsx("div",{style:{padding:0,overflowY:"auto",flex:1,cursor:"default"},children:A.jsx("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"11px"},children:A.jsxs("tbody",{children:[t.columns.slice(0,by).map((E,M)=>{const R=E.logical?.name||E.id,O=E.physical?.name||E.id,N=R!==O;return A.jsxs("tr",{style:{borderBottom:"1px solid var(--border-main)",backgroundColor:c===E.id?o==="dark"?"rgba(30, 58, 138, 0.6)":"rgba(191, 219, 254, 0.4)":"transparent"},children:[A.jsx("td",{style:{padding:"6px 12px",fontWeight:500,color:"var(--text-primary)"},children:A.jsxs("div",{style:{display:"flex",alignItems:"flex-start"},children:[A.jsxs("span",{style:{color:"var(--text-secondary)",marginRight:"6px",fontSize:"9px",fontFamily:"monospace",width:"14px",textAlign:"right",opacity:.6,marginTop:"2px"},children:[M+1,"."]}),A.jsxs("div",{style:{display:"flex",flexDirection:"column",flex:1,minWidth:0},children:[A.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",overflow:"hidden"},children:[E.logical?.isPrimaryKey&&A.jsx("span",{style:{color:"#eab308"},children:"🔑"}),E.logical?.isForeignKey&&A.jsx("span",{style:{opacity:.8},children:"🔩"}),E.logical?.isPartitionKey&&A.jsx("span",{style:{opacity:.8},children:"📂"}),E.logical?.isMetadata&&A.jsx("span",{style:{opacity:.8},title:"Metadata/Audit Column",children:"🕒"}),E.logical?.additivity==="fully"&&A.jsx("span",{style:{color:"#4ade80"},title:"Fully Additive",children:"Σ"}),E.logical?.additivity==="semi"&&A.jsx("span",{style:{color:"#fbbf24"},title:"Semi-Additive",children:"Σ~"}),E.logical?.additivity==="non"&&A.jsx("span",{style:{color:"#f87171"},title:"Non-Additive",children:"⊘"}),A.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:E.logical?.description||R,children:R})]}),N&&A.jsx("div",{style:{fontSize:"8px",fontFamily:"monospace",opacity:.6,marginTop:"1px",paddingLeft:"2px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:O,children:O})]})]})}),A.jsx("td",{style:{padding:"6px 12px",textAlign:"right",fontStyle:"italic",color:"var(--text-secondary)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"120px",verticalAlign:"top",opacity:.8},children:E.logical?.type||"Unknown"})]},E.id)}),t.columns.length>by&&A.jsx("tr",{children:A.jsxs("td",{colSpan:2,style:{padding:"4px 12px",fontSize:"10px",color:"var(--text-secondary)",textAlign:"center",opacity:.6},children:["+",t.columns.length-by," more"]})})]})})})]})]})},cG=ve.memo(uG);function rk(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function fG(t){if(Array.isArray(t))return t}function hG(t){if(Array.isArray(t))return rk(t)}function sl(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function dG(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,yq(n.key),n)}}function ll(t,e,r){return e&&dG(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Yn(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=DT(t))||e){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(o){throw o},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
41
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,s=!0,l=!1;return{s:function(){r=r.call(t)},n:function(){var o=r.next();return s=o.done,o},e:function(o){l=!0,a=o},f:function(){try{s||r.return==null||r.return()}finally{if(l)throw a}}}}function mq(t,e,r){return(e=yq(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function pG(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function gG(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,a,s,l=[],o=!0,c=!1;try{if(a=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;o=!1}else for(;!(o=(n=a.call(r)).done)&&(l.push(n.value),l.length!==e);o=!0);}catch(h){c=!0,i=h}finally{try{if(!o&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(c)throw i}}return l}}function vG(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
42
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mG(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
43
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Rr(t,e){return fG(t)||gG(t,e)||DT(t,e)||vG()}function fg(t){return hG(t)||pG(t)||DT(t)||mG()}function yG(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function yq(t){var e=yG(t,"string");return typeof e=="symbol"?e:e+""}function qr(t){"@babel/helpers - typeof";return qr=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},qr(t)}function DT(t,e){if(t){if(typeof t=="string")return rk(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)?rk(t,e):void 0}}var Lr=typeof window>"u"?null:window,CD=Lr?Lr.navigator:null;Lr&&Lr.document;var bG=qr(""),bq=qr({}),xG=qr(function(){}),wG=typeof HTMLElement>"u"?"undefined":qr(HTMLElement),fh=function(e){return e&&e.instanceString&&hr(e.instanceString)?e.instanceString():null},lt=function(e){return e!=null&&qr(e)==bG},hr=function(e){return e!=null&&qr(e)===xG},Zt=function(e){return!fi(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},Bt=function(e){return e!=null&&qr(e)===bq&&!Zt(e)&&e.constructor===Object},SG=function(e){return e!=null&&qr(e)===bq},qe=function(e){return e!=null&&qr(e)===qr(1)&&!isNaN(e)},CG=function(e){return qe(e)&&Math.floor(e)===e},hg=function(e){if(wG!=="undefined")return e!=null&&e instanceof HTMLElement},fi=function(e){return hh(e)||xq(e)},hh=function(e){return fh(e)==="collection"&&e._private.single},xq=function(e){return fh(e)==="collection"&&!e._private.single},_T=function(e){return fh(e)==="core"},wq=function(e){return fh(e)==="stylesheet"},kG=function(e){return fh(e)==="event"},Ys=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},TG=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},EG=function(e){return Bt(e)&&qe(e.x1)&&qe(e.x2)&&qe(e.y1)&&qe(e.y2)},AG=function(e){return SG(e)&&hr(e.then)},OG=function(){return CD&&CD.userAgent.match(/msie|trident|edge/i)},Bu=function(e,r){r||(r=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var a=[],s=0;s<arguments.length;s++)a.push(arguments[s]);return a.join("$")});var n=function(){var a=this,s=arguments,l,o=r.apply(a,s),c=n.cache;return(l=c[o])||(l=c[o]=e.apply(a,s)),l};return n.cache={},n},NT=Bu(function(t){return t.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),iv=Bu(function(t){return t.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),Sq=Bu(function(t,e){return t+e[0].toUpperCase()+e.substring(1)},function(t,e){return t+"$"+e}),kD=function(e){return Ys(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},zs=function(e,r){return e.slice(-1*r.length)===r},Ir="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",MG="rgb[a]?\\(("+Ir+"[%]?)\\s*,\\s*("+Ir+"[%]?)\\s*,\\s*("+Ir+"[%]?)(?:\\s*,\\s*("+Ir+"))?\\)",RG="rgb[a]?\\((?:"+Ir+"[%]?)\\s*,\\s*(?:"+Ir+"[%]?)\\s*,\\s*(?:"+Ir+"[%]?)(?:\\s*,\\s*(?:"+Ir+"))?\\)",DG="hsl[a]?\\(("+Ir+")\\s*,\\s*("+Ir+"[%])\\s*,\\s*("+Ir+"[%])(?:\\s*,\\s*("+Ir+"))?\\)",_G="hsl[a]?\\((?:"+Ir+")\\s*,\\s*(?:"+Ir+"[%])\\s*,\\s*(?:"+Ir+"[%])(?:\\s*,\\s*(?:"+Ir+"))?\\)",NG="\\#[0-9a-fA-F]{3}",BG="\\#[0-9a-fA-F]{6}",Cq=function(e,r){return e<r?-1:e>r?1:0},LG=function(e,r){return-1*Cq(e,r)},ft=Object.assign!=null?Object.assign.bind(Object):function(t){for(var e=arguments,r=1;r<e.length;r++){var n=e[r];if(n!=null)for(var i=Object.keys(n),a=0;a<i.length;a++){var s=i[a];t[s]=n[s]}}return t},PG=function(e){if(!(!(e.length===4||e.length===7)||e[0]!=="#")){var r=e.length===4,n,i,a,s=16;return r?(n=parseInt(e[1]+e[1],s),i=parseInt(e[2]+e[2],s),a=parseInt(e[3]+e[3],s)):(n=parseInt(e[1]+e[2],s),i=parseInt(e[3]+e[4],s),a=parseInt(e[5]+e[6],s)),[n,i,a]}},zG=function(e){var r,n,i,a,s,l,o,c;function h(y,b,x){return x<0&&(x+=1),x>1&&(x-=1),x<1/6?y+(b-y)*6*x:x<1/2?b:x<2/3?y+(b-y)*(2/3-x)*6:y}var d=new RegExp("^"+DG+"$").exec(e);if(d){if(n=parseInt(d[1]),n<0?n=(360- -1*n%360)%360:n>360&&(n=n%360),n/=360,i=parseFloat(d[2]),i<0||i>100||(i=i/100,a=parseFloat(d[3]),a<0||a>100)||(a=a/100,s=d[4],s!==void 0&&(s=parseFloat(s),s<0||s>1)))return;if(i===0)l=o=c=Math.round(a*255);else{var g=a<.5?a*(1+i):a+i-a*i,m=2*a-g;l=Math.round(255*h(m,g,n+1/3)),o=Math.round(255*h(m,g,n)),c=Math.round(255*h(m,g,n-1/3))}r=[l,o,c,s]}return r},IG=function(e){var r,n=new RegExp("^"+MG+"$").exec(e);if(n){r=[];for(var i=[],a=1;a<=3;a++){var s=n[a];if(s[s.length-1]==="%"&&(i[a]=!0),s=parseFloat(s),i[a]&&(s=s/100*255),s<0||s>255)return;r.push(Math.floor(s))}var l=i[1]||i[2]||i[3],o=i[1]&&i[2]&&i[3];if(l&&!o)return;var c=n[4];if(c!==void 0){if(c=parseFloat(c),c<0||c>1)return;r.push(c)}}return r},qG=function(e){return jG[e.toLowerCase()]},kq=function(e){return(Zt(e)?e:null)||qG(e)||PG(e)||IG(e)||zG(e)},jG={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]},Tq=function(e){for(var r=e.map,n=e.keys,i=n.length,a=0;a<i;a++){var s=n[a];if(Bt(s))throw Error("Tried to set map with object key");a<n.length-1?(r[s]==null&&(r[s]={}),r=r[s]):r[s]=e.value}},Eq=function(e){for(var r=e.map,n=e.keys,i=n.length,a=0;a<i;a++){var s=n[a];if(Bt(s))throw Error("Tried to get map with object key");if(r=r[s],r==null)return r}return r},Zd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function dh(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var xy,TD;function ph(){if(TD)return xy;TD=1;function t(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}return xy=t,xy}var wy,ED;function FG(){if(ED)return wy;ED=1;var t=typeof Zd=="object"&&Zd&&Zd.Object===Object&&Zd;return wy=t,wy}var Sy,AD;function av(){if(AD)return Sy;AD=1;var t=FG(),e=typeof self=="object"&&self&&self.Object===Object&&self,r=t||e||Function("return this")();return Sy=r,Sy}var Cy,OD;function HG(){if(OD)return Cy;OD=1;var t=av(),e=function(){return t.Date.now()};return Cy=e,Cy}var ky,MD;function VG(){if(MD)return ky;MD=1;var t=/\s/;function e(r){for(var n=r.length;n--&&t.test(r.charAt(n)););return n}return ky=e,ky}var Ty,RD;function UG(){if(RD)return Ty;RD=1;var t=VG(),e=/^\s+/;function r(n){return n&&n.slice(0,t(n)+1).replace(e,"")}return Ty=r,Ty}var Ey,DD;function BT(){if(DD)return Ey;DD=1;var t=av(),e=t.Symbol;return Ey=e,Ey}var Ay,_D;function $G(){if(_D)return Ay;_D=1;var t=BT(),e=Object.prototype,r=e.hasOwnProperty,n=e.toString,i=t?t.toStringTag:void 0;function a(s){var l=r.call(s,i),o=s[i];try{s[i]=void 0;var c=!0}catch{}var h=n.call(s);return c&&(l?s[i]=o:delete s[i]),h}return Ay=a,Ay}var Oy,ND;function GG(){if(ND)return Oy;ND=1;var t=Object.prototype,e=t.toString;function r(n){return e.call(n)}return Oy=r,Oy}var My,BD;function Aq(){if(BD)return My;BD=1;var t=BT(),e=$G(),r=GG(),n="[object Null]",i="[object Undefined]",a=t?t.toStringTag:void 0;function s(l){return l==null?l===void 0?i:n:a&&a in Object(l)?e(l):r(l)}return My=s,My}var Ry,LD;function YG(){if(LD)return Ry;LD=1;function t(e){return e!=null&&typeof e=="object"}return Ry=t,Ry}var Dy,PD;function gh(){if(PD)return Dy;PD=1;var t=Aq(),e=YG(),r="[object Symbol]";function n(i){return typeof i=="symbol"||e(i)&&t(i)==r}return Dy=n,Dy}var _y,zD;function XG(){if(zD)return _y;zD=1;var t=UG(),e=ph(),r=gh(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,s=/^0o[0-7]+$/i,l=parseInt;function o(c){if(typeof c=="number")return c;if(r(c))return n;if(e(c)){var h=typeof c.valueOf=="function"?c.valueOf():c;c=e(h)?h+"":h}if(typeof c!="string")return c===0?c:+c;c=t(c);var d=a.test(c);return d||s.test(c)?l(c.slice(2),d?2:8):i.test(c)?n:+c}return _y=o,_y}var Ny,ID;function WG(){if(ID)return Ny;ID=1;var t=ph(),e=HG(),r=XG(),n="Expected a function",i=Math.max,a=Math.min;function s(l,o,c){var h,d,g,m,y,b,x=0,w=!1,S=!1,k=!0;if(typeof l!="function")throw new TypeError(n);o=r(o)||0,t(c)&&(w=!!c.leading,S="maxWait"in c,g=S?i(r(c.maxWait)||0,o):g,k="trailing"in c?!!c.trailing:k);function E(z){var H=h,$=d;return h=d=void 0,x=z,m=l.apply($,H),m}function M(z){return x=z,y=setTimeout(N,o),w?E(z):m}function R(z){var H=z-b,$=z-x,q=o-H;return S?a(q,g-$):q}function O(z){var H=z-b,$=z-x;return b===void 0||H>=o||H<0||S&&$>=g}function N(){var z=e();if(O(z))return B(z);y=setTimeout(N,R(z))}function B(z){return y=void 0,k&&h?E(z):(h=d=void 0,m)}function D(){y!==void 0&&clearTimeout(y),x=0,h=b=d=y=void 0}function _(){return y===void 0?m:B(e())}function P(){var z=e(),H=O(z);if(h=arguments,d=this,b=z,H){if(y===void 0)return M(b);if(S)return clearTimeout(y),y=setTimeout(N,o),E(b)}return y===void 0&&(y=setTimeout(N,o)),m}return P.cancel=D,P.flush=_,P}return Ny=s,Ny}var QG=WG(),vh=dh(QG),By=Lr?Lr.performance:null,Oq=By&&By.now?function(){return By.now()}:function(){return Date.now()},KG=(function(){if(Lr){if(Lr.requestAnimationFrame)return function(t){Lr.requestAnimationFrame(t)};if(Lr.mozRequestAnimationFrame)return function(t){Lr.mozRequestAnimationFrame(t)};if(Lr.webkitRequestAnimationFrame)return function(t){Lr.webkitRequestAnimationFrame(t)};if(Lr.msRequestAnimationFrame)return function(t){Lr.msRequestAnimationFrame(t)}}return function(t){t&&setTimeout(function(){t(Oq())},1e3/60)}})(),dg=function(e){return KG(e)},Ya=Oq,Pl=9261,Mq=65599,lu=5381,Rq=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Pl,n=r,i;i=e.next(),!i.done;)n=n*Mq+i.value|0;return n},Pf=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Pl;return r*Mq+e|0},zf=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:lu;return(r<<5)+r+e|0},ZG=function(e,r){return e*2097152+r},Ds=function(e){return e[0]*2097152+e[1]},Jd=function(e,r){return[Pf(e[0],r[0]),zf(e[1],r[1])]},qD=function(e,r){var n={value:0,done:!1},i=0,a=e.length,s={next:function(){return i<a?n.value=e[i++]:n.done=!0,n}};return Rq(s,r)},Ql=function(e,r){var n={value:0,done:!1},i=0,a=e.length,s={next:function(){return i<a?n.value=e.charCodeAt(i++):n.done=!0,n}};return Rq(s,r)},Dq=function(){return JG(arguments)},JG=function(e){for(var r,n=0;n<e.length;n++){var i=e[n];n===0?r=Ql(i):r=Ql(i,r)}return r};function eY(t,e,r,n,i){var a=i*Math.PI/180,s=Math.cos(a)*(t-r)-Math.sin(a)*(e-n)+r,l=Math.sin(a)*(t-r)+Math.cos(a)*(e-n)+n;return{x:s,y:l}}var tY=function(e,r,n,i,a,s){return{x:(e-n)*a+n,y:(r-i)*s+i}};function rY(t,e,r){if(r===0)return t;var n=(e.x1+e.x2)/2,i=(e.y1+e.y2)/2,a=e.w/e.h,s=1/a,l=eY(t.x,t.y,n,i,r),o=tY(l.x,l.y,n,i,a,s);return{x:o.x,y:o.y}}var jD=!0,nY=console.warn!=null,iY=console.trace!=null,LT=Number.MAX_SAFE_INTEGER||9007199254740991,_q=function(){return!0},pg=function(){return!1},FD=function(){return 0},PT=function(){},ur=function(e){throw new Error(e)},Nq=function(e){if(e!==void 0)jD=!!e;else return jD},jt=function(e){Nq()&&(nY?console.warn(e):(console.log(e),iY&&console.trace()))},aY=function(e){return ft({},e)},la=function(e){return e==null?e:Zt(e)?e.slice():Bt(e)?aY(e):e},sY=function(e){return e.slice()},Bq=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},lY={},Lq=function(){return lY},cn=function(e){var r=Object.keys(e);return function(n){for(var i={},a=0;a<r.length;a++){var s=r[a],l=n?.[s];i[s]=l===void 0?e[s]:l}return i}},Xs=function(e,r,n){for(var i=e.length-1;i>=0;i--)e[i]===r&&e.splice(i,1)},zT=function(e){e.splice(0,e.length)},oY=function(e,r){for(var n=0;n<r.length;n++){var i=r[n];e.push(i)}},Fn=function(e,r,n){return n&&(r=Sq(n,r)),e[r]},qa=function(e,r,n,i){n&&(r=Sq(n,r)),e[r]=i},uY=(function(){function t(){sl(this,t),this._obj={}}return ll(t,[{key:"set",value:function(r,n){return this._obj[r]=n,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]}}])})(),Ua=typeof Map<"u"?Map:uY,cY="undefined",fY=(function(){function t(e){if(sl(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 n=0;n<r.length;n++)this.add(r[n])}}return ll(t,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(r){var n=this._obj;n[r]!==1&&(n[r]=1,this.size++)}},{key:"delete",value:function(r){var n=this._obj;n[r]===1&&(n[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(n){return r.has(n)})}},{key:"forEach",value:function(r,n){return this.toArray().forEach(r,n)}}])})(),$u=(typeof Set>"u"?"undefined":qr(Set))!==cY?Set:fY,sv=function(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||r===void 0||!_T(e)){ur("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"){ur("An element must be of type `nodes` or `edges`; you specified `"+i+"`");return}this.length=1,this[0]=this;var a=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 $u,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(a.position.x==null&&(a.position.x=0),a.position.y==null&&(a.position.y=0),r.renderedPosition){var s=r.renderedPosition,l=e.pan(),o=e.zoom();a.position={x:(s.x-l.x)/o,y:(s.y-l.y)/o}}var c=[];Zt(r.classes)?c=r.classes:lt(r.classes)&&(c=r.classes.split(/\s+/));for(var h=0,d=c.length;h<d;h++){var g=c[h];!g||g===""||a.classes.add(g)}this.createEmitter(),(n===void 0||n)&&this.restore();var m=r.style||r.css;m&&(jt("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(m))},HD=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(n,i,a){var s;Bt(n)&&!fi(n)&&(s=n,n=s.roots||s.root,i=s.visit,a=s.directed),a=arguments.length===2&&!hr(i)?i:a,i=hr(i)?i:function(){};for(var l=this._private.cy,o=n=lt(n)?this.filter(n):n,c=[],h=[],d={},g={},m={},y=0,b,x=this.byGroup(),w=x.nodes,S=x.edges,k=0;k<o.length;k++){var E=o[k],M=E.id();E.isNode()&&(c.unshift(E),e.bfs&&(m[M]=!0,h.push(E)),g[M]=0)}for(var R=function(){var z=e.bfs?c.shift():c.pop(),H=z.id();if(e.dfs){if(m[H])return 0;m[H]=!0,h.push(z)}var $=g[H],q=d[H],V=q!=null?q.source():null,X=q!=null?q.target():null,ee=q==null?void 0:z.same(V)?X[0]:V[0],te;if(te=i(z,q,ee,y++,$),te===!0)return b=z,1;if(te===!1)return 1;for(var I=z.connectedEdges().filter(function(Z){return(!a||Z.source().same(z))&&S.has(Z)}),G=0;G<I.length;G++){var re=I[G],Y=re.connectedNodes().filter(function(Z){return!Z.same(z)&&w.has(Z)}),W=Y.id();Y.length!==0&&!m[W]&&(Y=Y[0],c.push(Y),e.bfs&&(m[W]=!0,h.push(Y)),d[W]=re,g[W]=g[H]+1)}},O;c.length!==0&&(O=R(),!(O!==0&&O===1)););for(var N=l.collection(),B=0;B<h.length;B++){var D=h[B],_=d[D.id()];_!=null&&N.push(_),N.push(D)}return{path:l.collection(N),found:l.collection(b)}}},If={breadthFirstSearch:HD({bfs:!0}),depthFirstSearch:HD({dfs:!0})};If.bfs=If.breadthFirstSearch;If.dfs=If.depthFirstSearch;var Pp={exports:{}},hY=Pp.exports,VD;function dY(){return VD||(VD=1,(function(t,e){(function(){var r,n,i,a,s,l,o,c,h,d,g,m,y,b,x;i=Math.floor,d=Math.min,n=function(w,S){return w<S?-1:w>S?1:0},h=function(w,S,k,E,M){var R;if(k==null&&(k=0),M==null&&(M=n),k<0)throw new Error("lo must be non-negative");for(E==null&&(E=w.length);k<E;)R=i((k+E)/2),M(S,w[R])<0?E=R:k=R+1;return[].splice.apply(w,[k,k-k].concat(S)),S},l=function(w,S,k){return k==null&&(k=n),w.push(S),b(w,0,w.length-1,k)},s=function(w,S){var k,E;return S==null&&(S=n),k=w.pop(),w.length?(E=w[0],w[0]=k,x(w,0,S)):E=k,E},c=function(w,S,k){var E;return k==null&&(k=n),E=w[0],w[0]=S,x(w,0,k),E},o=function(w,S,k){var E;return k==null&&(k=n),w.length&&k(w[0],S)<0&&(E=[w[0],S],S=E[0],w[0]=E[1],x(w,0,k)),S},a=function(w,S){var k,E,M,R,O,N;for(S==null&&(S=n),R=(function(){N=[];for(var B=0,D=i(w.length/2);0<=D?B<D:B>D;0<=D?B++:B--)N.push(B);return N}).apply(this).reverse(),O=[],E=0,M=R.length;E<M;E++)k=R[E],O.push(x(w,k,S));return O},y=function(w,S,k){var E;if(k==null&&(k=n),E=w.indexOf(S),E!==-1)return b(w,0,E,k),x(w,E,k)},g=function(w,S,k){var E,M,R,O,N;if(k==null&&(k=n),M=w.slice(0,S),!M.length)return M;for(a(M,k),N=w.slice(S),R=0,O=N.length;R<O;R++)E=N[R],o(M,E,k);return M.sort(k).reverse()},m=function(w,S,k){var E,M,R,O,N,B,D,_,P;if(k==null&&(k=n),S*10<=w.length){if(R=w.slice(0,S).sort(k),!R.length)return R;for(M=R[R.length-1],D=w.slice(S),O=0,B=D.length;O<B;O++)E=D[O],k(E,M)<0&&(h(R,E,0,null,k),R.pop(),M=R[R.length-1]);return R}for(a(w,k),P=[],N=0,_=d(S,w.length);0<=_?N<_:N>_;0<=_?++N:--N)P.push(s(w,k));return P},b=function(w,S,k,E){var M,R,O;for(E==null&&(E=n),M=w[k];k>S;){if(O=k-1>>1,R=w[O],E(M,R)<0){w[k]=R,k=O;continue}break}return w[k]=M},x=function(w,S,k){var E,M,R,O,N;for(k==null&&(k=n),M=w.length,N=S,R=w[S],E=2*S+1;E<M;)O=E+1,O<M&&!(k(w[E],w[O])<0)&&(E=O),w[S]=w[E],S=E,E=2*S+1;return w[S]=R,b(w,N,S,k)},r=(function(){w.push=l,w.pop=s,w.replace=c,w.pushpop=o,w.heapify=a,w.updateItem=y,w.nlargest=g,w.nsmallest=m;function w(S){this.cmp=S??n,this.nodes=[]}return w.prototype.push=function(S){return l(this.nodes,S,this.cmp)},w.prototype.pop=function(){return s(this.nodes,this.cmp)},w.prototype.peek=function(){return this.nodes[0]},w.prototype.contains=function(S){return this.nodes.indexOf(S)!==-1},w.prototype.replace=function(S){return c(this.nodes,S,this.cmp)},w.prototype.pushpop=function(S){return o(this.nodes,S,this.cmp)},w.prototype.heapify=function(){return a(this.nodes,this.cmp)},w.prototype.updateItem=function(S){return y(this.nodes,S,this.cmp)},w.prototype.clear=function(){return this.nodes=[]},w.prototype.empty=function(){return this.nodes.length===0},w.prototype.size=function(){return this.nodes.length},w.prototype.clone=function(){var S;return S=new w,S.nodes=this.nodes.slice(0),S},w.prototype.toArray=function(){return this.nodes.slice(0)},w.prototype.insert=w.prototype.push,w.prototype.top=w.prototype.peek,w.prototype.front=w.prototype.peek,w.prototype.has=w.prototype.contains,w.prototype.copy=w.prototype.clone,w})(),(function(w,S){return t.exports=S()})(this,function(){return r})}).call(hY)})(Pp)),Pp.exports}var Ly,UD;function pY(){return UD||(UD=1,Ly=dY()),Ly}var gY=pY(),mh=dh(gY),vY=cn({root:null,weight:function(e){return 1},directed:!1}),mY={dijkstra:function(e){if(!Bt(e)){var r=arguments;e={root:r[0],weight:r[1],directed:r[2]}}var n=vY(e),i=n.root,a=n.weight,s=n.directed,l=this,o=a,c=lt(i)?this.filter(i)[0]:i[0],h={},d={},g={},m=this.byGroup(),y=m.nodes,b=m.edges;b.unmergeBy(function($){return $.isLoop()});for(var x=function(q){return h[q.id()]},w=function(q,V){h[q.id()]=V,S.updateItem(q)},S=new mh(function($,q){return x($)-x(q)}),k=0;k<y.length;k++){var E=y[k];h[E.id()]=E.same(c)?0:1/0,S.push(E)}for(var M=function(q,V){for(var X=(s?q.edgesTo(V):q.edgesWith(V)).intersect(b),ee=1/0,te,I=0;I<X.length;I++){var G=X[I],re=o(G);(re<ee||!te)&&(ee=re,te=G)}return{edge:te,dist:ee}};S.size()>0;){var R=S.pop(),O=x(R),N=R.id();if(g[N]=O,O!==1/0)for(var B=R.neighborhood().intersect(y),D=0;D<B.length;D++){var _=B[D],P=_.id(),z=M(R,_),H=O+z.dist;H<x(_)&&(w(_,H),d[P]={node:R,edge:z.edge})}}return{distanceTo:function(q){var V=lt(q)?y.filter(q)[0]:q[0];return g[V.id()]},pathTo:function(q){var V=lt(q)?y.filter(q)[0]:q[0],X=[],ee=V,te=ee.id();if(V.length>0)for(X.unshift(V);d[te];){var I=d[te];X.unshift(I.edge),X.unshift(I.node),ee=I.node,te=ee.id()}return l.spawn(X)}}}},yY={kruskal:function(e){e=e||function(k){return 1};for(var r=this.byGroup(),n=r.nodes,i=r.edges,a=n.length,s=new Array(a),l=n,o=function(E){for(var M=0;M<s.length;M++){var R=s[M];if(R.has(E))return M}},c=0;c<a;c++)s[c]=this.spawn(n[c]);for(var h=i.sort(function(k,E){return e(k)-e(E)}),d=0;d<h.length;d++){var g=h[d],m=g.source()[0],y=g.target()[0],b=o(m),x=o(y),w=s[b],S=s[x];b!==x&&(l.merge(g),w.merge(S),s.splice(x,1))}return l}},bY=cn({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),xY={aStar:function(e){var r=this.cy(),n=bY(e),i=n.root,a=n.goal,s=n.heuristic,l=n.directed,o=n.weight;i=r.collection(i)[0],a=r.collection(a)[0];var c=i.id(),h=a.id(),d={},g={},m={},y=new mh(function(te,I){return g[te.id()]-g[I.id()]}),b=new $u,x={},w={},S=function(I,G){y.push(I),b.add(G)},k,E,M=function(){k=y.pop(),E=k.id(),b.delete(E)},R=function(I){return b.has(I)};S(i,c),d[c]=0,g[c]=s(i);for(var O=0;y.size()>0;){if(M(),O++,E===h){for(var N=[],B=a,D=h,_=w[D];N.unshift(B),_!=null&&N.unshift(_),B=x[D],B!=null;)D=B.id(),_=w[D];return{found:!0,distance:d[E],path:this.spawn(N),steps:O}}m[E]=!0;for(var P=k._private.edges,z=0;z<P.length;z++){var H=P[z];if(this.hasElementWithId(H.id())&&!(l&&H.data("source")!==E)){var $=H.source(),q=H.target(),V=$.id()!==E?$:q,X=V.id();if(this.hasElementWithId(X)&&!m[X]){var ee=d[E]+o(H);if(!R(X)){d[X]=ee,g[X]=ee+s(V),S(V,X),x[X]=k,w[X]=H;continue}ee<d[X]&&(d[X]=ee,g[X]=ee+s(V),x[X]=k,w[X]=H)}}}}return{found:!1,distance:void 0,path:void 0,steps:O}}},wY=cn({weight:function(e){return 1},directed:!1}),SY={floydWarshall:function(e){for(var r=this.cy(),n=wY(e),i=n.weight,a=n.directed,s=i,l=this.byGroup(),o=l.nodes,c=l.edges,h=o.length,d=h*h,g=function(re){return o.indexOf(re)},m=function(re){return o[re]},y=new Array(d),b=0;b<d;b++){var x=b%h,w=(b-x)/h;w===x?y[b]=0:y[b]=1/0}for(var S=new Array(d),k=new Array(d),E=0;E<c.length;E++){var M=c[E],R=M.source()[0],O=M.target()[0];if(R!==O){var N=g(R),B=g(O),D=N*h+B,_=s(M);if(y[D]>_&&(y[D]=_,S[D]=B,k[D]=M),!a){var P=B*h+N;!a&&y[P]>_&&(y[P]=_,S[P]=N,k[P]=M)}}}for(var z=0;z<h;z++)for(var H=0;H<h;H++)for(var $=H*h+z,q=0;q<h;q++){var V=H*h+q,X=z*h+q;y[$]+y[X]<y[V]&&(y[V]=y[$]+y[X],S[V]=S[$])}var ee=function(re){return(lt(re)?r.filter(re):re)[0]},te=function(re){return g(ee(re))},I={distance:function(re,Y){var W=te(re),Z=te(Y);return y[W*h+Z]},path:function(re,Y){var W=te(re),Z=te(Y),ie=m(W);if(W===Z)return ie.collection();if(S[W*h+Z]==null)return r.collection();var we=r.collection(),de=W,se;for(we.merge(ie);W!==Z;)de=W,W=S[W*h+Z],se=k[de*h+W],we.merge(se),we.merge(m(W));return we}};return I}},CY=cn({weight:function(e){return 1},directed:!1,root:null}),kY={bellmanFord:function(e){var r=this,n=CY(e),i=n.weight,a=n.directed,s=n.root,l=i,o=this,c=this.cy(),h=this.byGroup(),d=h.edges,g=h.nodes,m=g.length,y=new Ua,b=!1,x=[];s=c.collection(s)[0],d.unmergeBy(function(Me){return Me.isLoop()});for(var w=d.length,S=function(He){var $e=y.get(He.id());return $e||($e={},y.set(He.id(),$e)),$e},k=function(He){return(lt(He)?c.$(He):He)[0]},E=function(He){return S(k(He)).dist},M=function(He){for(var $e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:s,Ne=k(He),Ge=[],Ve=Ne;;){if(Ve==null)return r.spawn();var Qe=S(Ve),je=Qe.edge,dt=Qe.pred;if(Ge.unshift(Ve[0]),Ve.same($e)&&Ge.length>0)break;je!=null&&Ge.unshift(je),Ve=dt}return o.spawn(Ge)},R=0;R<m;R++){var O=g[R],N=S(O);O.same(s)?N.dist=0:N.dist=1/0,N.pred=null,N.edge=null}for(var B=!1,D=function(He,$e,Ne,Ge,Ve,Qe){var je=Ge.dist+Qe;je<Ve.dist&&!Ne.same(Ge.edge)&&(Ve.dist=je,Ve.pred=He,Ve.edge=Ne,B=!0)},_=1;_<m;_++){B=!1;for(var P=0;P<w;P++){var z=d[P],H=z.source(),$=z.target(),q=l(z),V=S(H),X=S($);D(H,$,z,V,X,q),a||D($,H,z,X,V,q)}if(!B)break}if(B)for(var ee=[],te=0;te<w;te++){var I=d[te],G=I.source(),re=I.target(),Y=l(I),W=S(G).dist,Z=S(re).dist;if(W+Y<Z||!a&&Z+Y<W)if(b||(jt("Graph contains a negative weight cycle for Bellman-Ford"),b=!0),e.findNegativeWeightCycles!==!1){var ie=[];W+Y<Z&&ie.push(G),!a&&Z+Y<W&&ie.push(re);for(var we=ie.length,de=0;de<we;de++){var se=ie[de],j=[se];j.push(S(se).edge);for(var Q=S(se).pred;j.indexOf(Q)===-1;)j.push(Q),j.push(S(Q).edge),Q=S(Q).pred;j=j.slice(j.indexOf(Q));for(var K=j[0].id(),ue=0,Se=2;Se<j.length;Se+=2)j[Se].id()<K&&(K=j[Se].id(),ue=Se);j=j.slice(ue).concat(j.slice(0,ue)),j.push(j[0]);var at=j.map(function(Me){return Me.id()}).join(",");ee.indexOf(at)===-1&&(x.push(o.spawn(j)),ee.push(at))}}else break}return{distanceTo:E,pathTo:M,hasNegativeWeightCycle:b,negativeWeightCycles:x}}},TY=Math.sqrt(2),EY=function(e,r,n){n.length===0&&ur("Karger-Stein must be run on a connected (sub)graph");for(var i=n[e],a=i[1],s=i[2],l=r[a],o=r[s],c=n,h=c.length-1;h>=0;h--){var d=c[h],g=d[1],m=d[2];(r[g]===l&&r[m]===o||r[g]===o&&r[m]===l)&&c.splice(h,1)}for(var y=0;y<c.length;y++){var b=c[y];b[1]===o?(c[y]=b.slice(),c[y][1]=l):b[2]===o&&(c[y]=b.slice(),c[y][2]=l)}for(var x=0;x<r.length;x++)r[x]===o&&(r[x]=l);return c},Py=function(e,r,n,i){for(;n>i;){var a=Math.floor(Math.random()*r.length);r=EY(a,e,r),n--}return r},AY={kargerStein:function(){var e=this,r=this.byGroup(),n=r.nodes,i=r.edges;i.unmergeBy(function(X){return X.isLoop()});var a=n.length,s=i.length,l=Math.ceil(Math.pow(Math.log(a)/Math.LN2,2)),o=Math.floor(a/TY);if(a<2){ur("At least 2 nodes are required for Karger-Stein algorithm");return}for(var c=[],h=0;h<s;h++){var d=i[h];c.push([h,n.indexOf(d.source()),n.indexOf(d.target())])}for(var g=1/0,m=[],y=new Array(a),b=new Array(a),x=new Array(a),w=function(ee,te){for(var I=0;I<a;I++)te[I]=ee[I]},S=0;S<=l;S++){for(var k=0;k<a;k++)b[k]=k;var E=Py(b,c.slice(),a,o),M=E.slice();w(b,x);var R=Py(b,E,o,2),O=Py(x,M,o,2);R.length<=O.length&&R.length<g?(g=R.length,m=R,w(b,y)):O.length<=R.length&&O.length<g&&(g=O.length,m=O,w(x,y))}for(var N=this.spawn(m.map(function(X){return i[X[0]]})),B=this.spawn(),D=this.spawn(),_=y[0],P=0;P<y.length;P++){var z=y[P],H=n[P];z===_?B.merge(H):D.merge(H)}var $=function(ee){var te=e.spawn();return ee.forEach(function(I){te.merge(I),I.connectedEdges().forEach(function(G){e.contains(G)&&!N.contains(G)&&te.merge(G)})}),te},q=[$(B),$(D)],V={cut:N,components:q,partition1:B,partition2:D};return V}},zy,OY=function(e){return{x:e.x,y:e.y}},lv=function(e,r,n){return{x:e.x*r+n.x,y:e.y*r+n.y}},Pq=function(e,r,n){return{x:(e.x-n.x)/r,y:(e.y-n.y)/r}},pu=function(e){return{x:e[0],y:e[1]}},MY=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,i=1/0,a=r;a<n;a++){var s=e[a];isFinite(s)&&(i=Math.min(s,i))}return i},RY=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,i=-1/0,a=r;a<n;a++){var s=e[a];isFinite(s)&&(i=Math.max(s,i))}return i},DY=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,i=0,a=0,s=r;s<n;s++){var l=e[s];isFinite(l)&&(i+=l,a++)}return i/a},_Y=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;i?e=e.slice(r,n):(n<e.length&&e.splice(n,e.length-n),r>0&&e.splice(0,r));for(var l=0,o=e.length-1;o>=0;o--){var c=e[o];s?isFinite(c)||(e[o]=-1/0,l++):e.splice(o,1)}a&&e.sort(function(g,m){return g-m});var h=e.length,d=Math.floor(h/2);return h%2!==0?e[d+1+l]:(e[d-1+l]+e[d+l])/2},NY=function(e){return Math.PI*e/180},ep=function(e,r){return Math.atan2(r,e)-Math.PI/2},IT=Math.log2||function(t){return Math.log(t)/Math.log(2)},qT=function(e){return e>0?1:e<0?-1:0},Kl=function(e,r){return Math.sqrt(Nl(e,r))},Nl=function(e,r){var n=r.x-e.x,i=r.y-e.y;return n*n+i*i},BY=function(e){for(var r=e.length,n=0,i=0;i<r;i++)n+=e[i];for(var a=0;a<r;a++)e[a]=e[a]/n;return e},Yr=function(e,r,n,i){return(1-i)*(1-i)*e+2*(1-i)*i*r+i*i*n},wu=function(e,r,n,i){return{x:Yr(e.x,r.x,n.x,i),y:Yr(e.y,r.y,n.y,i)}},LY=function(e,r,n,i){var a={x:r.x-e.x,y:r.y-e.y},s=Kl(e,r),l={x:a.x/s,y:a.y/s};return n=n??0,i=i??n*s,{x:e.x+l.x*i,y:e.y+l.y*i}},qf=function(e,r,n){return Math.max(e,Math.min(n,r))},Rn=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}}},PY=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},zY=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},IY=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},zq=function(e,r,n){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,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},zp=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},Ip=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],n,i,a,s;if(r.length===1)n=i=a=s=r[0];else if(r.length===2)n=a=r[0],s=i=r[1];else if(r.length===4){var l=Rr(r,4);n=l[0],i=l[1],a=l[2],s=l[3]}return e.x1-=s,e.x2+=i,e.y1-=n,e.y2+=a,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},$D=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},jT=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)},Is=function(e,r,n){return e.x1<=r&&r<=e.x2&&e.y1<=n&&n<=e.y2},GD=function(e,r){return Is(e,r.x,r.y)},Iq=function(e,r){return Is(e,r.x1,r.y1)&&Is(e,r.x2,r.y2)},qY=(zy=Math.hypot)!==null&&zy!==void 0?zy:function(t,e){return Math.sqrt(t*t+e*e)};function jY(t,e){if(t.length<3)throw new Error("Need at least 3 vertices");var r=function(N,B){return{x:N.x+B.x,y:N.y+B.y}},n=function(N,B){return{x:N.x-B.x,y:N.y-B.y}},i=function(N,B){return{x:N.x*B,y:N.y*B}},a=function(N,B){return N.x*B.y-N.y*B.x},s=function(N){var B=qY(N.x,N.y);return B===0?{x:0,y:0}:{x:N.x/B,y:N.y/B}},l=function(N){for(var B=0,D=0;D<N.length;D++){var _=N[D],P=N[(D+1)%N.length];B+=_.x*P.y-P.x*_.y}return B/2},o=function(N,B,D,_){var P=n(B,N),z=n(_,D),H=a(P,z);if(Math.abs(H)<1e-9)return r(N,i(P,.5));var $=a(n(D,N),z)/H;return r(N,i(P,$))},c=t.map(function(O){return{x:O.x,y:O.y}});l(c)<0&&c.reverse();for(var h=c.length,d=[],g=0;g<h;g++){var m=c[g],y=c[(g+1)%h],b=n(y,m),x=s({x:b.y,y:-b.x});d.push(x)}for(var w=d.map(function(O,N){var B=r(c[N],i(O,e)),D=r(c[(N+1)%h],i(O,e));return{p1:B,p2:D}}),S=[],k=0;k<h;k++){var E=w[(k-1+h)%h],M=w[k],R=o(E.p1,E.p2,M.p1,M.p2);S.push(R)}return S}function FY(t,e,r,n,i,a){var s=QY(t,e,r,n,i),l=jY(s,a),o=Rn();return l.forEach(function(c){return zq(o,c.x,c.y)}),o}var qq=function(e,r,n,i,a,s,l){var o=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",c=o==="auto"?Ws(a,s):o,h=a/2,d=s/2;c=Math.min(c,h,d);var g=c!==h,m=c!==d,y;if(g){var b=n-h+c-l,x=i-d-l,w=n+h-c+l,S=x;if(y=qs(e,r,n,i,b,x,w,S,!1),y.length>0)return y}if(m){var k=n+h+l,E=i-d+c-l,M=k,R=i+d-c+l;if(y=qs(e,r,n,i,k,E,M,R,!1),y.length>0)return y}if(g){var O=n-h+c-l,N=i+d+l,B=n+h-c+l,D=N;if(y=qs(e,r,n,i,O,N,B,D,!1),y.length>0)return y}if(m){var _=n-h-l,P=i-d+c-l,z=_,H=i+d-c+l;if(y=qs(e,r,n,i,_,P,z,H,!1),y.length>0)return y}var $;{var q=n-h+c,V=i-d+c;if($=ff(e,r,n,i,q,V,c+l),$.length>0&&$[0]<=q&&$[1]<=V)return[$[0],$[1]]}{var X=n+h-c,ee=i-d+c;if($=ff(e,r,n,i,X,ee,c+l),$.length>0&&$[0]>=X&&$[1]<=ee)return[$[0],$[1]]}{var te=n+h-c,I=i+d-c;if($=ff(e,r,n,i,te,I,c+l),$.length>0&&$[0]>=te&&$[1]>=I)return[$[0],$[1]]}{var G=n-h+c,re=i+d-c;if($=ff(e,r,n,i,G,re,c+l),$.length>0&&$[0]<=G&&$[1]>=re)return[$[0],$[1]]}return[]},HY=function(e,r,n,i,a,s,l){var o=l,c=Math.min(n,a),h=Math.max(n,a),d=Math.min(i,s),g=Math.max(i,s);return c-o<=e&&e<=h+o&&d-o<=r&&r<=g+o},VY=function(e,r,n,i,a,s,l,o,c){var h={x1:Math.min(n,l,a)-c,x2:Math.max(n,l,a)+c,y1:Math.min(i,o,s)-c,y2:Math.max(i,o,s)+c};return!(e<h.x1||e>h.x2||r<h.y1||r>h.y2)},UY=function(e,r,n,i){n-=i;var a=r*r-4*e*n;if(a<0)return[];var s=Math.sqrt(a),l=2*e,o=(-r+s)/l,c=(-r-s)/l;return[o,c]},$Y=function(e,r,n,i,a){var s=1e-5;e===0&&(e=s),r/=e,n/=e,i/=e;var l,o,c,h,d,g,m,y;if(o=(3*n-r*r)/9,c=-(27*i)+r*(9*n-2*(r*r)),c/=54,l=o*o*o+c*c,a[1]=0,m=r/3,l>0){d=c+Math.sqrt(l),d=d<0?-Math.pow(-d,1/3):Math.pow(d,1/3),g=c-Math.sqrt(l),g=g<0?-Math.pow(-g,1/3):Math.pow(g,1/3),a[0]=-m+d+g,m+=(d+g)/2,a[4]=a[2]=-m,m=Math.sqrt(3)*(-g+d)/2,a[3]=m,a[5]=-m;return}if(a[5]=a[3]=0,l===0){y=c<0?-Math.pow(-c,1/3):Math.pow(c,1/3),a[0]=-m+2*y,a[4]=a[2]=-(y+m);return}o=-o,h=o*o*o,h=Math.acos(c/Math.sqrt(h)),y=2*Math.sqrt(o),a[0]=-m+y*Math.cos(h/3),a[2]=-m+y*Math.cos((h+2*Math.PI)/3),a[4]=-m+y*Math.cos((h+4*Math.PI)/3)},GY=function(e,r,n,i,a,s,l,o){var c=1*n*n-4*n*a+2*n*l+4*a*a-4*a*l+l*l+i*i-4*i*s+2*i*o+4*s*s-4*s*o+o*o,h=9*n*a-3*n*n-3*n*l-6*a*a+3*a*l+9*i*s-3*i*i-3*i*o-6*s*s+3*s*o,d=3*n*n-6*n*a+n*l-n*e+2*a*a+2*a*e-l*e+3*i*i-6*i*s+i*o-i*r+2*s*s+2*s*r-o*r,g=1*n*a-n*n+n*e-a*e+i*s-i*i+i*r-s*r,m=[];$Y(c,h,d,g,m);for(var y=1e-7,b=[],x=0;x<6;x+=2)Math.abs(m[x+1])<y&&m[x]>=0&&m[x]<=1&&b.push(m[x]);b.push(1),b.push(0);for(var w=-1,S,k,E,M=0;M<b.length;M++)S=Math.pow(1-b[M],2)*n+2*(1-b[M])*b[M]*a+b[M]*b[M]*l,k=Math.pow(1-b[M],2)*i+2*(1-b[M])*b[M]*s+b[M]*b[M]*o,E=Math.pow(S-e,2)+Math.pow(k-r,2),w>=0?E<w&&(w=E):w=E;return w},YY=function(e,r,n,i,a,s){var l=[e-n,r-i],o=[a-n,s-i],c=o[0]*o[0]+o[1]*o[1],h=l[0]*l[0]+l[1]*l[1],d=l[0]*o[0]+l[1]*o[1],g=d*d/c;return d<0?h:g>c?(e-a)*(e-a)+(r-s)*(r-s):h-g},Hn=function(e,r,n){for(var i,a,s,l,o,c=0,h=0;h<n.length/2;h++)if(i=n[h*2],a=n[h*2+1],h+1<n.length/2?(s=n[(h+1)*2],l=n[(h+1)*2+1]):(s=n[(h+1-n.length/2)*2],l=n[(h+1-n.length/2)*2+1]),!(i==e&&s==e))if(i>=e&&e>=s||i<=e&&e<=s)o=(e-i)/(s-i)*(l-a)+a,o>r&&c++;else continue;return c%2!==0},Xa=function(e,r,n,i,a,s,l,o,c){var h=new Array(n.length),d;o[0]!=null?(d=Math.atan(o[1]/o[0]),o[0]<0?d=d+Math.PI/2:d=-d-Math.PI/2):d=o;for(var g=Math.cos(-d),m=Math.sin(-d),y=0;y<h.length/2;y++)h[y*2]=s/2*(n[y*2]*g-n[y*2+1]*m),h[y*2+1]=l/2*(n[y*2+1]*g+n[y*2]*m),h[y*2]+=i,h[y*2+1]+=a;var b;if(c>0){var x=vg(h,-c);b=gg(x)}else b=h;return Hn(e,r,b)},XY=function(e,r,n,i,a,s,l,o){for(var c=new Array(n.length*2),h=0;h<o.length;h++){var d=o[h];c[h*4+0]=d.startX,c[h*4+1]=d.startY,c[h*4+2]=d.stopX,c[h*4+3]=d.stopY;var g=Math.pow(d.cx-e,2)+Math.pow(d.cy-r,2);if(g<=Math.pow(d.radius,2))return!0}return Hn(e,r,c)},gg=function(e){for(var r=new Array(e.length/2),n,i,a,s,l,o,c,h,d=0;d<e.length/4;d++){n=e[d*4],i=e[d*4+1],a=e[d*4+2],s=e[d*4+3],d<e.length/4-1?(l=e[(d+1)*4],o=e[(d+1)*4+1],c=e[(d+1)*4+2],h=e[(d+1)*4+3]):(l=e[0],o=e[1],c=e[2],h=e[3]);var g=qs(n,i,a,s,l,o,c,h,!0);r[d*2]=g[0],r[d*2+1]=g[1]}return r},vg=function(e,r){for(var n=new Array(e.length*2),i,a,s,l,o=0;o<e.length/2;o++){i=e[o*2],a=e[o*2+1],o<e.length/2-1?(s=e[(o+1)*2],l=e[(o+1)*2+1]):(s=e[0],l=e[1]);var c=l-a,h=-(s-i),d=Math.sqrt(c*c+h*h),g=c/d,m=h/d;n[o*4]=i+g*r,n[o*4+1]=a+m*r,n[o*4+2]=s+g*r,n[o*4+3]=l+m*r}return n},WY=function(e,r,n,i,a,s){var l=n-e,o=i-r;l/=a,o/=s;var c=Math.sqrt(l*l+o*o),h=c-1;if(h<0)return[];var d=h/c;return[(n-e)*d+e,(i-r)*d+r]},Fl=function(e,r,n,i,a,s,l){return e-=a,r-=s,e/=n/2+l,r/=i/2+l,e*e+r*r<=1},ff=function(e,r,n,i,a,s,l){var o=[n-e,i-r],c=[e-a,r-s],h=o[0]*o[0]+o[1]*o[1],d=2*(c[0]*o[0]+c[1]*o[1]),g=c[0]*c[0]+c[1]*c[1]-l*l,m=d*d-4*h*g;if(m<0)return[];var y=(-d+Math.sqrt(m))/(2*h),b=(-d-Math.sqrt(m))/(2*h),x=Math.min(y,b),w=Math.max(y,b),S=[];if(x>=0&&x<=1&&S.push(x),w>=0&&w<=1&&S.push(w),S.length===0)return[];var k=S[0]*o[0]+e,E=S[0]*o[1]+r;if(S.length>1){if(S[0]==S[1])return[k,E];var M=S[1]*o[0]+e,R=S[1]*o[1]+r;return[k,E,M,R]}else return[k,E]},Iy=function(e,r,n){return r<=e&&e<=n||n<=e&&e<=r?e:e<=r&&r<=n||n<=r&&r<=e?r:n},qs=function(e,r,n,i,a,s,l,o,c){var h=e-a,d=n-e,g=l-a,m=r-s,y=i-r,b=o-s,x=g*m-b*h,w=d*m-y*h,S=b*d-g*y;if(S!==0){var k=x/S,E=w/S,M=.001,R=0-M,O=1+M;return R<=k&&k<=O&&R<=E&&E<=O?[e+k*d,r+k*y]:c?[e+k*d,r+k*y]:[]}else return x===0||w===0?Iy(e,n,l)===l?[l,o]:Iy(e,n,a)===a?[a,s]:Iy(a,l,n)===n?[n,i]:[]:[]},QY=function(e,r,n,i,a){var s=[],l=i/2,o=a/2,c=r,h=n;s.push({x:c+l*e[0],y:h+o*e[1]});for(var d=1;d<e.length/2;d++)s.push({x:c+l*e[d*2],y:h+o*e[d*2+1]});return s},jf=function(e,r,n,i,a,s,l,o){var c=[],h,d=new Array(n.length),g=!0;s==null&&(g=!1);var m;if(g){for(var y=0;y<d.length/2;y++)d[y*2]=n[y*2]*s+i,d[y*2+1]=n[y*2+1]*l+a;if(o>0){var b=vg(d,-o);m=gg(b)}else m=d}else m=n;for(var x,w,S,k,E=0;E<m.length/2;E++)x=m[E*2],w=m[E*2+1],E<m.length/2-1?(S=m[(E+1)*2],k=m[(E+1)*2+1]):(S=m[0],k=m[1]),h=qs(e,r,i,a,x,w,S,k),h.length!==0&&c.push(h[0],h[1]);return c},KY=function(e,r,n,i,a,s,l,o,c){var h=[],d,g=new Array(n.length*2);c.forEach(function(S,k){k===0?(g[g.length-2]=S.startX,g[g.length-1]=S.startY):(g[k*4-2]=S.startX,g[k*4-1]=S.startY),g[k*4]=S.stopX,g[k*4+1]=S.stopY,d=ff(e,r,i,a,S.cx,S.cy,S.radius),d.length!==0&&h.push(d[0],d[1])});for(var m=0;m<g.length/4;m++)d=qs(e,r,i,a,g[m*4],g[m*4+1],g[m*4+2],g[m*4+3],!1),d.length!==0&&h.push(d[0],d[1]);if(h.length>2){for(var y=[h[0],h[1]],b=Math.pow(y[0]-e,2)+Math.pow(y[1]-r,2),x=1;x<h.length/2;x++){var w=Math.pow(h[x*2]-e,2)+Math.pow(h[x*2+1]-r,2);w<=b&&(y[0]=h[x*2],y[1]=h[x*2+1],b=w)}return y}return h},tp=function(e,r,n){var i=[e[0]-r[0],e[1]-r[1]],a=Math.sqrt(i[0]*i[0]+i[1]*i[1]),s=(a-n)/a;return s<0&&(s=1e-5),[r[0]+s*i[0],r[1]+s*i[1]]},Tn=function(e,r){var n=nk(e,r);return n=jq(n),n},jq=function(e){for(var r,n,i=e.length/2,a=1/0,s=1/0,l=-1/0,o=-1/0,c=0;c<i;c++)r=e[2*c],n=e[2*c+1],a=Math.min(a,r),l=Math.max(l,r),s=Math.min(s,n),o=Math.max(o,n);for(var h=2/(l-a),d=2/(o-s),g=0;g<i;g++)r=e[2*g]=e[2*g]*h,n=e[2*g+1]=e[2*g+1]*d,a=Math.min(a,r),l=Math.max(l,r),s=Math.min(s,n),o=Math.max(o,n);if(s<-1)for(var m=0;m<i;m++)n=e[2*m+1]=e[2*m+1]+(-1-s);return e},nk=function(e,r){var n=1/e*2*Math.PI,i=e%2===0?Math.PI/2+n/2:Math.PI/2;i+=r;for(var a=new Array(e*2),s,l=0;l<e;l++)s=l*n+i,a[2*l]=Math.cos(s),a[2*l+1]=Math.sin(-s);return a},Ws=function(e,r){return Math.min(e/4,r/4,8)},Fq=function(e,r){return Math.min(e/10,r/10,8)},FT=function(){return 8},ZY=function(e,r,n){return[e-2*r+n,2*(r-e),e]},ik=function(e,r){return{heightOffset:Math.min(15,.05*r),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}};function qy(t,e){function r(d){for(var g=[],m=0;m<d.length;m++){var y=d[m],b=d[(m+1)%d.length],x={x:b.x-y.x,y:b.y-y.y},w={x:-x.y,y:x.x},S=Math.sqrt(w.x*w.x+w.y*w.y);g.push({x:w.x/S,y:w.y/S})}return g}function n(d,g){var m=1/0,y=-1/0,b=Yn(d),x;try{for(b.s();!(x=b.n()).done;){var w=x.value,S=w.x*g.x+w.y*g.y;m=Math.min(m,S),y=Math.max(y,S)}}catch(k){b.e(k)}finally{b.f()}return{min:m,max:y}}function i(d,g){return!(d.max<g.min||g.max<d.min)}var a=[].concat(fg(r(t)),fg(r(e))),s=Yn(a),l;try{for(s.s();!(l=s.n()).done;){var o=l.value,c=n(t,o),h=n(e,o);if(!i(c,h))return!1}}catch(d){s.e(d)}finally{s.f()}return!0}var JY=cn({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),eX={pageRank:function(e){for(var r=JY(e),n=r.dampingFactor,i=r.precision,a=r.iterations,s=r.weight,l=this._private.cy,o=this.byGroup(),c=o.nodes,h=o.edges,d=c.length,g=d*d,m=h.length,y=new Array(g),b=new Array(d),x=(1-n)/d,w=0;w<d;w++){for(var S=0;S<d;S++){var k=w*d+S;y[k]=0}b[w]=0}for(var E=0;E<m;E++){var M=h[E],R=M.data("source"),O=M.data("target");if(R!==O){var N=c.indexOfId(R),B=c.indexOfId(O),D=s(M),_=B*d+N;y[_]+=D,b[N]+=D}}for(var P=1/d+x,z=0;z<d;z++)if(b[z]===0)for(var H=0;H<d;H++){var $=H*d+z;y[$]=P}else for(var q=0;q<d;q++){var V=q*d+z;y[V]=y[V]/b[z]+x}for(var X=new Array(d),ee=new Array(d),te,I=0;I<d;I++)X[I]=1;for(var G=0;G<a;G++){for(var re=0;re<d;re++)ee[re]=0;for(var Y=0;Y<d;Y++)for(var W=0;W<d;W++){var Z=Y*d+W;ee[Y]+=y[Z]*X[W]}BY(ee),te=X,X=ee,ee=te;for(var ie=0,we=0;we<d;we++){var de=te[we]-X[we];ie+=de*de}if(ie<i)break}var se={rank:function(Q){return Q=l.collection(Q)[0],X[c.indexOf(Q)]}};return se}},YD=cn({root:null,weight:function(e){return 1},directed:!1,alpha:0}),Su={degreeCentralityNormalized:function(e){e=YD(e);var r=this.cy(),n=this.nodes(),i=n.length;if(e.directed){for(var h={},d={},g=0,m=0,y=0;y<i;y++){var b=n[y],x=b.id();e.root=b;var w=this.degreeCentrality(e);g<w.indegree&&(g=w.indegree),m<w.outdegree&&(m=w.outdegree),h[x]=w.indegree,d[x]=w.outdegree}return{indegree:function(k){return g==0?0:(lt(k)&&(k=r.filter(k)),h[k.id()]/g)},outdegree:function(k){return m===0?0:(lt(k)&&(k=r.filter(k)),d[k.id()]/m)}}}else{for(var a={},s=0,l=0;l<i;l++){var o=n[l];e.root=o;var c=this.degreeCentrality(e);s<c.degree&&(s=c.degree),a[o.id()]=c.degree}return{degree:function(k){return s===0?0:(lt(k)&&(k=r.filter(k)),a[k.id()]/s)}}}},degreeCentrality:function(e){e=YD(e);var r=this.cy(),n=this,i=e,a=i.root,s=i.weight,l=i.directed,o=i.alpha;if(a=r.collection(a)[0],l){for(var m=a.connectedEdges(),y=m.filter(function(R){return R.target().same(a)&&n.has(R)}),b=m.filter(function(R){return R.source().same(a)&&n.has(R)}),x=y.length,w=b.length,S=0,k=0,E=0;E<y.length;E++)S+=s(y[E]);for(var M=0;M<b.length;M++)k+=s(b[M]);return{indegree:Math.pow(x,1-o)*Math.pow(S,o),outdegree:Math.pow(w,1-o)*Math.pow(k,o)}}else{for(var c=a.connectedEdges().intersection(n),h=c.length,d=0,g=0;g<c.length;g++)d+=s(c[g]);return{degree:Math.pow(h,1-o)*Math.pow(d,o)}}}};Su.dc=Su.degreeCentrality;Su.dcn=Su.degreeCentralityNormalised=Su.degreeCentralityNormalized;var XD=cn({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),Cu={closenessCentralityNormalized:function(e){for(var r=XD(e),n=r.harmonic,i=r.weight,a=r.directed,s=this.cy(),l={},o=0,c=this.nodes(),h=this.floydWarshall({weight:i,directed:a}),d=0;d<c.length;d++){for(var g=0,m=c[d],y=0;y<c.length;y++)if(d!==y){var b=h.distance(m,c[y]);n?g+=1/b:g+=b}n||(g=1/g),o<g&&(o=g),l[m.id()]=g}return{closeness:function(w){return o==0?0:(lt(w)?w=s.filter(w)[0].id():w=w.id(),l[w]/o)}}},closenessCentrality:function(e){var r=XD(e),n=r.root,i=r.weight,a=r.directed,s=r.harmonic;n=this.filter(n)[0];for(var l=this.dijkstra({root:n,weight:i,directed:a}),o=0,c=this.nodes(),h=0;h<c.length;h++){var d=c[h];if(!d.same(n)){var g=l.distanceTo(d);s?o+=1/g:o+=g}}return s?o:1/o}};Cu.cc=Cu.closenessCentrality;Cu.ccn=Cu.closenessCentralityNormalised=Cu.closenessCentralityNormalized;var tX=cn({weight:null,directed:!1}),ak={betweennessCentrality:function(e){for(var r=tX(e),n=r.directed,i=r.weight,a=i!=null,s=this.cy(),l=this.nodes(),o={},c={},h=0,d={set:function(k,E){c[k]=E,E>h&&(h=E)},get:function(k){return c[k]}},g=0;g<l.length;g++){var m=l[g],y=m.id();n?o[y]=m.outgoers().nodes():o[y]=m.openNeighborhood().nodes(),d.set(y,0)}for(var b=function(){for(var k=l[x].id(),E=[],M={},R={},O={},N=new mh(function(Y,W){return O[Y]-O[W]}),B=0;B<l.length;B++){var D=l[B].id();M[D]=[],R[D]=0,O[D]=1/0}for(R[k]=1,O[k]=0,N.push(k);!N.empty();){var _=N.pop();if(E.push(_),a)for(var P=0;P<o[_].length;P++){var z=o[_][P],H=s.getElementById(_),$=void 0;H.edgesTo(z).length>0?$=H.edgesTo(z)[0]:$=z.edgesTo(H)[0];var q=i($);z=z.id(),O[z]>O[_]+q&&(O[z]=O[_]+q,N.nodes.indexOf(z)<0?N.push(z):N.updateItem(z),R[z]=0,M[z]=[]),O[z]==O[_]+q&&(R[z]=R[z]+R[_],M[z].push(_))}else for(var V=0;V<o[_].length;V++){var X=o[_][V].id();O[X]==1/0&&(N.push(X),O[X]=O[_]+1),O[X]==O[_]+1&&(R[X]=R[X]+R[_],M[X].push(_))}}for(var ee={},te=0;te<l.length;te++)ee[l[te].id()]=0;for(;E.length>0;){for(var I=E.pop(),G=0;G<M[I].length;G++){var re=M[I][G];ee[re]=ee[re]+R[re]/R[I]*(1+ee[I])}I!=l[x].id()&&d.set(I,d.get(I)+ee[I])}},x=0;x<l.length;x++)b();var w={betweenness:function(k){var E=s.collection(k).id();return d.get(E)},betweennessNormalized:function(k){if(h==0)return 0;var E=s.collection(k).id();return d.get(E)/h}};return w.betweennessNormalised=w.betweennessNormalized,w}};ak.bc=ak.betweennessCentrality;var rX=cn({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(t){return 1}]}),nX=function(e){return rX(e)},iX=function(e,r){for(var n=0,i=0;i<r.length;i++)n+=r[i](e);return n},aX=function(e,r,n){for(var i=0;i<r;i++)e[i*r+i]=n},Hq=function(e,r){for(var n,i=0;i<r;i++){n=0;for(var a=0;a<r;a++)n+=e[a*r+i];for(var s=0;s<r;s++)e[s*r+i]=e[s*r+i]/n}},sX=function(e,r,n){for(var i=new Array(n*n),a=0;a<n;a++){for(var s=0;s<n;s++)i[a*n+s]=0;for(var l=0;l<n;l++)for(var o=0;o<n;o++)i[a*n+o]+=e[a*n+l]*r[l*n+o]}return i},lX=function(e,r,n){for(var i=e.slice(0),a=1;a<n;a++)e=sX(e,i,r);return e},oX=function(e,r,n){for(var i=new Array(r*r),a=0;a<r*r;a++)i[a]=Math.pow(e[a],n);return Hq(i,r),i},uX=function(e,r,n,i){for(var a=0;a<n;a++){var s=Math.round(e[a]*Math.pow(10,i))/Math.pow(10,i),l=Math.round(r[a]*Math.pow(10,i))/Math.pow(10,i);if(s!==l)return!1}return!0},cX=function(e,r,n,i){for(var a=[],s=0;s<r;s++){for(var l=[],o=0;o<r;o++)Math.round(e[s*r+o]*1e3)/1e3>0&&l.push(n[o]);l.length!==0&&a.push(i.collection(l))}return a},fX=function(e,r){for(var n=0;n<e.length;n++)if(!r[n]||e[n].id()!==r[n].id())return!1;return!0},hX=function(e){for(var r=0;r<e.length;r++)for(var n=0;n<e.length;n++)r!=n&&fX(e[r],e[n])&&e.splice(n,1);return e},WD=function(e){for(var r=this.nodes(),n=this.edges(),i=this.cy(),a=nX(e),s={},l=0;l<r.length;l++)s[r[l].id()]=l;for(var o=r.length,c=o*o,h=new Array(c),d,g=0;g<c;g++)h[g]=0;for(var m=0;m<n.length;m++){var y=n[m],b=s[y.source().id()],x=s[y.target().id()],w=iX(y,a.attributes);h[b*o+x]+=w,h[x*o+b]+=w}aX(h,o,a.multFactor),Hq(h,o);for(var S=!0,k=0;S&&k<a.maxIterations;)S=!1,d=lX(h,o,a.expandFactor),h=oX(d,o,a.inflateFactor),uX(h,d,c,4)||(S=!0),k++;var E=cX(h,o,r,i);return E=hX(E),E},dX={markovClustering:WD,mcl:WD},pX=function(e){return e},Vq=function(e,r){return Math.abs(r-e)},QD=function(e,r,n){return e+Vq(r,n)},KD=function(e,r,n){return e+Math.pow(n-r,2)},gX=function(e){return Math.sqrt(e)},vX=function(e,r,n){return Math.max(e,Vq(r,n))},Qc=function(e,r,n,i,a){for(var s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:pX,l=i,o,c,h=0;h<e;h++)o=r(h),c=n(h),l=a(l,o,c);return s(l)},Lu={euclidean:function(e,r,n){return e>=2?Qc(e,r,n,0,KD,gX):Qc(e,r,n,0,QD)},squaredEuclidean:function(e,r,n){return Qc(e,r,n,0,KD)},manhattan:function(e,r,n){return Qc(e,r,n,0,QD)},max:function(e,r,n){return Qc(e,r,n,-1/0,vX)}};Lu["squared-euclidean"]=Lu.squaredEuclidean;Lu.squaredeuclidean=Lu.squaredEuclidean;function ov(t,e,r,n,i,a){var s;return hr(t)?s=t:s=Lu[t]||Lu.euclidean,e===0&&hr(t)?s(i,a):s(e,r,n,i,a)}var mX=cn({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),HT=function(e){return mX(e)},mg=function(e,r,n,i,a){var s=a!=="kMedoids",l=s?function(d){return n[d]}:function(d){return i[d](n)},o=function(g){return i[g](r)},c=n,h=r;return ov(e,i.length,l,o,c,h)},jy=function(e,r,n){for(var i=n.length,a=new Array(i),s=new Array(i),l=new Array(r),o=null,c=0;c<i;c++)a[c]=e.min(n[c]).value,s[c]=e.max(n[c]).value;for(var h=0;h<r;h++){o=[];for(var d=0;d<i;d++)o[d]=Math.random()*(s[d]-a[d])+a[d];l[h]=o}return l},Uq=function(e,r,n,i,a){for(var s=1/0,l=0,o=0;o<r.length;o++){var c=mg(n,e,r[o],i,a);c<s&&(s=c,l=o)}return l},$q=function(e,r,n){for(var i=[],a=null,s=0;s<r.length;s++)a=r[s],n[a.id()]===e&&i.push(a);return i},yX=function(e,r,n){return Math.abs(r-e)<=n},bX=function(e,r,n){for(var i=0;i<e.length;i++)for(var a=0;a<e[i].length;a++){var s=Math.abs(e[i][a]-r[i][a]);if(s>n)return!1}return!0},xX=function(e,r,n){for(var i=0;i<n;i++)if(e===r[i])return!0;return!1},ZD=function(e,r){var n=new Array(r);if(e.length<50)for(var i=0;i<r;i++){for(var a=e[Math.floor(Math.random()*e.length)];xX(a,n,i);)a=e[Math.floor(Math.random()*e.length)];n[i]=a}else for(var s=0;s<r;s++)n[s]=e[Math.floor(Math.random()*e.length)];return n},JD=function(e,r,n){for(var i=0,a=0;a<r.length;a++)i+=mg("manhattan",r[a],e,n,"kMedoids");return i},wX=function(e){var r=this.cy(),n=this.nodes(),i=null,a=HT(e),s=new Array(a.k),l={},o;a.testMode?typeof a.testCentroids=="number"?(a.testCentroids,o=jy(n,a.k,a.attributes)):qr(a.testCentroids)==="object"?o=a.testCentroids:o=jy(n,a.k,a.attributes):o=jy(n,a.k,a.attributes);for(var c=!0,h=0;c&&h<a.maxIterations;){for(var d=0;d<n.length;d++)i=n[d],l[i.id()]=Uq(i,o,a.distance,a.attributes,"kMeans");c=!1;for(var g=0;g<a.k;g++){var m=$q(g,n,l);if(m.length!==0){for(var y=a.attributes.length,b=o[g],x=new Array(y),w=new Array(y),S=0;S<y;S++){w[S]=0;for(var k=0;k<m.length;k++)i=m[k],w[S]+=a.attributes[S](i);x[S]=w[S]/m.length,yX(x[S],b[S],a.sensitivityThreshold)||(c=!0)}o[g]=x,s[g]=r.collection(m)}}h++}return s},SX=function(e){var r=this.cy(),n=this.nodes(),i=null,a=HT(e),s=new Array(a.k),l,o={},c,h=new Array(a.k);a.testMode?typeof a.testCentroids=="number"||(qr(a.testCentroids)==="object"?l=a.testCentroids:l=ZD(n,a.k)):l=ZD(n,a.k);for(var d=!0,g=0;d&&g<a.maxIterations;){for(var m=0;m<n.length;m++)i=n[m],o[i.id()]=Uq(i,l,a.distance,a.attributes,"kMedoids");d=!1;for(var y=0;y<l.length;y++){var b=$q(y,n,o);if(b.length!==0){h[y]=JD(l[y],b,a.attributes);for(var x=0;x<b.length;x++)c=JD(b[x],b,a.attributes),c<h[y]&&(h[y]=c,l[y]=b[x],d=!0);s[y]=r.collection(b)}}g++}return s},CX=function(e,r,n,i,a){for(var s,l,o=0;o<r.length;o++)for(var c=0;c<e.length;c++)i[o][c]=Math.pow(n[o][c],a.m);for(var h=0;h<e.length;h++)for(var d=0;d<a.attributes.length;d++){s=0,l=0;for(var g=0;g<r.length;g++)s+=i[g][h]*a.attributes[d](r[g]),l+=i[g][h];e[h][d]=s/l}},kX=function(e,r,n,i,a){for(var s=0;s<e.length;s++)r[s]=e[s].slice();for(var l,o,c,h=2/(a.m-1),d=0;d<n.length;d++)for(var g=0;g<i.length;g++){l=0;for(var m=0;m<n.length;m++)o=mg(a.distance,i[g],n[d],a.attributes,"cmeans"),c=mg(a.distance,i[g],n[m],a.attributes,"cmeans"),l+=Math.pow(o/c,h);e[g][d]=1/l}},TX=function(e,r,n,i){for(var a=new Array(n.k),s=0;s<a.length;s++)a[s]=[];for(var l,o,c=0;c<r.length;c++){l=-1/0,o=-1;for(var h=0;h<r[0].length;h++)r[c][h]>l&&(l=r[c][h],o=h);a[o].push(e[c])}for(var d=0;d<a.length;d++)a[d]=i.collection(a[d]);return a},e_=function(e){var r=this.cy(),n=this.nodes(),i=HT(e),a,s,l,o,c;o=new Array(n.length);for(var h=0;h<n.length;h++)o[h]=new Array(i.k);l=new Array(n.length);for(var d=0;d<n.length;d++)l[d]=new Array(i.k);for(var g=0;g<n.length;g++){for(var m=0,y=0;y<i.k;y++)l[g][y]=Math.random(),m+=l[g][y];for(var b=0;b<i.k;b++)l[g][b]=l[g][b]/m}s=new Array(i.k);for(var x=0;x<i.k;x++)s[x]=new Array(i.attributes.length);c=new Array(n.length);for(var w=0;w<n.length;w++)c[w]=new Array(i.k);for(var S=!0,k=0;S&&k<i.maxIterations;)S=!1,CX(s,n,l,c,i),kX(l,o,s,n,i),bX(l,o,i.sensitivityThreshold)||(S=!0),k++;return a=TX(n,l,i,r),{clusters:a,degreeOfMembership:l}},EX={kMeans:wX,kMedoids:SX,fuzzyCMeans:e_,fcm:e_},AX=cn({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),OX={single:"min",complete:"max"},MX=function(e){var r=AX(e),n=OX[r.linkage];return n!=null&&(r.linkage=n),r},t_=function(e,r,n,i,a){for(var s=0,l=1/0,o,c=a.attributes,h=function(B,D){return ov(a.distance,c.length,function(_){return c[_](B)},function(_){return c[_](D)},B,D)},d=0;d<e.length;d++){var g=e[d].key,m=n[g][i[g]];m<l&&(s=g,l=m)}if(a.mode==="threshold"&&l>=a.threshold||a.mode==="dendrogram"&&e.length===1)return!1;var y=r[s],b=r[i[s]],x;a.mode==="dendrogram"?x={left:y,right:b,key:y.key}:x={value:y.value.concat(b.value),key:y.key},e[y.index]=x,e.splice(b.index,1),r[y.key]=x;for(var w=0;w<e.length;w++){var S=e[w];y.key===S.key?o=1/0:a.linkage==="min"?(o=n[y.key][S.key],n[y.key][S.key]>n[b.key][S.key]&&(o=n[b.key][S.key])):a.linkage==="max"?(o=n[y.key][S.key],n[y.key][S.key]<n[b.key][S.key]&&(o=n[b.key][S.key])):a.linkage==="mean"?o=(n[y.key][S.key]*y.size+n[b.key][S.key]*b.size)/(y.size+b.size):a.mode==="dendrogram"?o=h(S.value,y.value):o=h(S.value[0],y.value[0]),n[y.key][S.key]=n[S.key][y.key]=o}for(var k=0;k<e.length;k++){var E=e[k].key;if(i[E]===y.key||i[E]===b.key){for(var M=E,R=0;R<e.length;R++){var O=e[R].key;n[E][O]<n[E][M]&&(M=O)}i[E]=M}e[k].index=k}return y.key=b.key=y.index=b.index=null,!0},gu=function(e,r,n){e&&(e.value?r.push(e.value):(e.left&&gu(e.left,r),e.right&&gu(e.right,r)))},sk=function(e,r){if(!e)return"";if(e.left&&e.right){var n=sk(e.left,r),i=sk(e.right,r),a=r.add({group:"nodes",data:{id:n+","+i}});return r.add({group:"edges",data:{source:n,target:a.id()}}),r.add({group:"edges",data:{source:i,target:a.id()}}),a.id()}else if(e.value)return e.value.id()},lk=function(e,r,n){if(!e)return[];var i=[],a=[],s=[];return r===0?(e.left&&gu(e.left,i),e.right&&gu(e.right,a),s=i.concat(a),[n.collection(s)]):r===1?e.value?[n.collection(e.value)]:(e.left&&gu(e.left,i),e.right&&gu(e.right,a),[n.collection(i),n.collection(a)]):e.value?[n.collection(e.value)]:(e.left&&(i=lk(e.left,r-1,n)),e.right&&(a=lk(e.right,r-1,n)),i.concat(a))},r_=function(e){for(var r=this.cy(),n=this.nodes(),i=MX(e),a=i.attributes,s=function(k,E){return ov(i.distance,a.length,function(M){return a[M](k)},function(M){return a[M](E)},k,E)},l=[],o=[],c=[],h=[],d=0;d<n.length;d++){var g={value:i.mode==="dendrogram"?n[d]:[n[d]],key:d,index:d};l[d]=g,h[d]=g,o[d]=[],c[d]=0}for(var m=0;m<l.length;m++)for(var y=0;y<=m;y++){var b=void 0;i.mode==="dendrogram"?b=m===y?1/0:s(l[m].value,l[y].value):b=m===y?1/0:s(l[m].value[0],l[y].value[0]),o[m][y]=b,o[y][m]=b,b<o[m][c[m]]&&(c[m]=y)}for(var x=t_(l,h,o,c,i);x;)x=t_(l,h,o,c,i);var w;return i.mode==="dendrogram"?(w=lk(l[0],i.dendrogramDepth,r),i.addDendrogram&&sk(l[0],r)):(w=new Array(l.length),l.forEach(function(S,k){S.key=S.index=null,w[k]=r.collection(S.value)})),w},RX={hierarchicalClustering:r_,hca:r_},DX=cn({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),_X=function(e){var r=e.damping,n=e.preference;.5<=r&&r<1||ur("Damping must range on [0.5, 1). Got: ".concat(r));var i=["median","mean","min","max"];return i.some(function(a){return a===n})||qe(n)||ur("Preference must be one of [".concat(i.map(function(a){return"'".concat(a,"'")}).join(", "),"] or a number. Got: ").concat(n)),DX(e)},NX=function(e,r,n,i){var a=function(l,o){return i[o](l)};return-ov(e,i.length,function(s){return a(r,s)},function(s){return a(n,s)},r,n)},BX=function(e,r){var n=null;return r==="median"?n=_Y(e):r==="mean"?n=DY(e):r==="min"?n=MY(e):r==="max"?n=RY(e):n=r,n},LX=function(e,r,n){for(var i=[],a=0;a<e;a++)r[a*e+a]+n[a*e+a]>0&&i.push(a);return i},n_=function(e,r,n){for(var i=[],a=0;a<e;a++){for(var s=-1,l=-1/0,o=0;o<n.length;o++){var c=n[o];r[a*e+c]>l&&(s=c,l=r[a*e+c])}s>0&&i.push(s)}for(var h=0;h<n.length;h++)i[n[h]]=n[h];return i},PX=function(e,r,n){for(var i=n_(e,r,n),a=0;a<n.length;a++){for(var s=[],l=0;l<i.length;l++)i[l]===n[a]&&s.push(l);for(var o=-1,c=-1/0,h=0;h<s.length;h++){for(var d=0,g=0;g<s.length;g++)d+=r[s[g]*e+s[h]];d>c&&(o=h,c=d)}n[a]=s[o]}return i=n_(e,r,n),i},i_=function(e){for(var r=this.cy(),n=this.nodes(),i=_X(e),a={},s=0;s<n.length;s++)a[n[s].id()]=s;var l,o,c,h,d,g;l=n.length,o=l*l,c=new Array(o);for(var m=0;m<o;m++)c[m]=-1/0;for(var y=0;y<l;y++)for(var b=0;b<l;b++)y!==b&&(c[y*l+b]=NX(i.distance,n[y],n[b],i.attributes));h=BX(c,i.preference);for(var x=0;x<l;x++)c[x*l+x]=h;d=new Array(o);for(var w=0;w<o;w++)d[w]=0;g=new Array(o);for(var S=0;S<o;S++)g[S]=0;for(var k=new Array(l),E=new Array(l),M=new Array(l),R=0;R<l;R++)k[R]=0,E[R]=0,M[R]=0;for(var O=new Array(l*i.minIterations),N=0;N<O.length;N++)O[N]=0;var B;for(B=0;B<i.maxIterations;B++){for(var D=0;D<l;D++){for(var _=-1/0,P=-1/0,z=-1,H=0,$=0;$<l;$++)k[$]=d[D*l+$],H=g[D*l+$]+c[D*l+$],H>=_?(P=_,_=H,z=$):H>P&&(P=H);for(var q=0;q<l;q++)d[D*l+q]=(1-i.damping)*(c[D*l+q]-_)+i.damping*k[q];d[D*l+z]=(1-i.damping)*(c[D*l+z]-P)+i.damping*k[z]}for(var V=0;V<l;V++){for(var X=0,ee=0;ee<l;ee++)k[ee]=g[ee*l+V],E[ee]=Math.max(0,d[ee*l+V]),X+=E[ee];X-=E[V],E[V]=d[V*l+V],X+=E[V];for(var te=0;te<l;te++)g[te*l+V]=(1-i.damping)*Math.min(0,X-E[te])+i.damping*k[te];g[V*l+V]=(1-i.damping)*(X-E[V])+i.damping*k[V]}for(var I=0,G=0;G<l;G++){var re=g[G*l+G]+d[G*l+G]>0?1:0;O[B%i.minIterations*l+G]=re,I+=re}if(I>0&&(B>=i.minIterations-1||B==i.maxIterations-1)){for(var Y=0,W=0;W<l;W++){M[W]=0;for(var Z=0;Z<i.minIterations;Z++)M[W]+=O[Z*l+W];(M[W]===0||M[W]===i.minIterations)&&Y++}if(Y===l)break}}for(var ie=LX(l,d,g),we=PX(l,c,ie),de={},se=0;se<ie.length;se++)de[ie[se]]=[];for(var j=0;j<n.length;j++){var Q=a[n[j].id()],K=we[Q];K!=null&&de[K].push(n[j])}for(var ue=new Array(ie.length),Se=0;Se<ie.length;Se++)ue[Se]=r.collection(de[ie[Se]]);return ue},zX={affinityPropagation:i_,ap:i_},IX=cn({root:void 0,directed:!1}),qX={hierholzer:function(e){if(!Bt(e)){var r=arguments;e={root:r[0],directed:r[1]}}var n=IX(e),i=n.root,a=n.directed,s=this,l=!1,o,c,h;i&&(h=lt(i)?this.filter(i)[0].id():i[0].id());var d={},g={};a?s.forEach(function(S){var k=S.id();if(S.isNode()){var E=S.indegree(!0),M=S.outdegree(!0),R=E-M,O=M-E;R==1?o?l=!0:o=k:O==1?c?l=!0:c=k:(O>1||R>1)&&(l=!0),d[k]=[],S.outgoers().forEach(function(N){N.isEdge()&&d[k].push(N.id())})}else g[k]=[void 0,S.target().id()]}):s.forEach(function(S){var k=S.id();if(S.isNode()){var E=S.degree(!0);E%2&&(o?c?l=!0:c=k:o=k),d[k]=[],S.connectedEdges().forEach(function(M){return d[k].push(M.id())})}else g[k]=[S.source().id(),S.target().id()]});var m={found:!1,trail:void 0};if(l)return m;if(c&&o)if(a){if(h&&c!=h)return m;h=c}else{if(h&&c!=h&&o!=h)return m;h||(h=c)}else h||(h=s[0].id());var y=function(k){for(var E=k,M=[k],R,O,N;d[E].length;)R=d[E].shift(),O=g[R][0],N=g[R][1],E!=N?(d[N]=d[N].filter(function(B){return B!=R}),E=N):!a&&E!=O&&(d[O]=d[O].filter(function(B){return B!=R}),E=O),M.unshift(R),M.unshift(E);return M},b=[],x=[];for(x=y(h);x.length!=1;)d[x[0]].length==0?(b.unshift(s.getElementById(x.shift())),b.unshift(s.getElementById(x.shift()))):x=y(x.shift()).concat(x);b.unshift(s.getElementById(x.shift()));for(var w in d)if(d[w].length)return m;return m.found=!0,m.trail=this.spawn(b,!0),m}},rp=function(){var e=this,r={},n=0,i=0,a=[],s=[],l={},o=function(g,m){for(var y=s.length-1,b=[],x=e.spawn();s[y].x!=g||s[y].y!=m;)b.push(s.pop().edge),y--;b.push(s.pop().edge),b.forEach(function(w){var S=w.connectedNodes().intersection(e);x.merge(w),S.forEach(function(k){var E=k.id(),M=k.connectedEdges().intersection(e);x.merge(k),r[E].cutVertex?x.merge(M.filter(function(R){return R.isLoop()})):x.merge(M)})}),a.push(x)},c=function(g,m,y){g===y&&(i+=1),r[m]={id:n,low:n++,cutVertex:!1};var b=e.getElementById(m).connectedEdges().intersection(e);if(b.size()===0)a.push(e.spawn(e.getElementById(m)));else{var x,w,S,k;b.forEach(function(E){x=E.source().id(),w=E.target().id(),S=x===m?w:x,S!==y&&(k=E.id(),l[k]||(l[k]=!0,s.push({x:m,y:S,edge:E})),S in r?r[m].low=Math.min(r[m].low,r[S].id):(c(g,S,m),r[m].low=Math.min(r[m].low,r[S].low),r[m].id<=r[S].low&&(r[m].cutVertex=!0,o(m,S))))})}};e.forEach(function(d){if(d.isNode()){var g=d.id();g in r||(i=0,c(g,g),r[g].cutVertex=i>1)}});var h=Object.keys(r).filter(function(d){return r[d].cutVertex}).map(function(d){return e.getElementById(d)});return{cut:e.spawn(h),components:a}},jX={hopcroftTarjanBiconnected:rp,htbc:rp,htb:rp,hopcroftTarjanBiconnectedComponents:rp},np=function(){var e=this,r={},n=0,i=[],a=[],s=e.spawn(e),l=function(c){a.push(c),r[c]={index:n,low:n++,explored:!1};var h=e.getElementById(c).connectedEdges().intersection(e);if(h.forEach(function(b){var x=b.target().id();x!==c&&(x in r||l(x),r[x].explored||(r[c].low=Math.min(r[c].low,r[x].low)))}),r[c].index===r[c].low){for(var d=e.spawn();;){var g=a.pop();if(d.merge(e.getElementById(g)),r[g].low=r[c].index,r[g].explored=!0,g===c)break}var m=d.edgesWith(d),y=d.merge(m);i.push(y),s=s.difference(y)}};return e.forEach(function(o){if(o.isNode()){var c=o.id();c in r||l(c)}}),{cut:s,components:i}},FX={tarjanStronglyConnected:np,tsc:np,tscc:np,tarjanStronglyConnectedComponents:np},Gq={};[If,mY,yY,xY,SY,kY,AY,eX,Su,Cu,ak,dX,EX,RX,zX,qX,jX,FX].forEach(function(t){ft(Gq,t)});var Yq=0,Xq=1,Wq=2,ji=function(e){if(!(this instanceof ji))return new ji(e);this.id="Thenable/1.0.7",this.state=Yq,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))};ji.prototype={fulfill:function(e){return a_(this,Xq,"fulfillValue",e)},reject:function(e){return a_(this,Wq,"rejectReason",e)},then:function(e,r){var n=this,i=new ji;return n.onFulfilled.push(l_(e,i,"fulfill")),n.onRejected.push(l_(r,i,"reject")),Qq(n),i.proxy}};var a_=function(e,r,n,i){return e.state===Yq&&(e.state=r,e[n]=i,Qq(e)),e},Qq=function(e){e.state===Xq?s_(e,"onFulfilled",e.fulfillValue):e.state===Wq&&s_(e,"onRejected",e.rejectReason)},s_=function(e,r,n){if(e[r].length!==0){var i=e[r];e[r]=[];var a=function(){for(var l=0;l<i.length;l++)i[l](n)};typeof setImmediate=="function"?setImmediate(a):setTimeout(a,0)}},l_=function(e,r,n){return function(i){if(typeof e!="function")r[n].call(r,i);else{var a;try{a=e(i)}catch(s){r.reject(s);return}Kq(r,a)}}},Kq=function(e,r){if(e===r||e.proxy===r){e.reject(new TypeError("cannot resolve promise with itself"));return}var n;if(qr(r)==="object"&&r!==null||typeof r=="function")try{n=r.then}catch(a){e.reject(a);return}if(typeof n=="function"){var i=!1;try{n.call(r,function(a){i||(i=!0,a===r?e.reject(new TypeError("circular thenable chain")):Kq(e,a))},function(a){i||(i=!0,e.reject(a))})}catch(a){i||e.reject(a)}return}e.fulfill(r)};ji.all=function(t){return new ji(function(e,r){for(var n=new Array(t.length),i=0,a=function(o,c){n[o]=c,i++,i===t.length&&e(n)},s=0;s<t.length;s++)(function(l){var o=t[l],c=o!=null&&o.then!=null;if(c)o.then(function(d){a(l,d)},function(d){r(d)});else{var h=o;a(l,h)}})(s)})};ji.resolve=function(t){return new ji(function(e,r){e(t)})};ji.reject=function(t){return new ji(function(e,r){r(t)})};var Gu=typeof Promise<"u"?Promise:ji,ok=function(e,r,n){var i=_T(e),a=!i,s=this._private=ft({duration:1e3},r,n);if(s.target=e,s.style=s.style||s.css,s.started=!1,s.playing=!1,s.hooked=!1,s.applying=!1,s.progress=0,s.completes=[],s.frames=[],s.complete&&hr(s.complete)&&s.completes.push(s.complete),a){var l=e.position();s.startPosition=s.startPosition||{x:l.x,y:l.y},s.startStyle=s.startStyle||e.cy().style().getAnimationStartStyle(e,s.style)}if(i){var o=e.pan();s.startPan={x:o.x,y:o.y},s.startZoom=e.zoom()}this.length=1,this[0]=this},Zl=ok.prototype;ft(Zl,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var r,n=e.target._private.animation;e.queue?r=n.queue:r=n.current,r.push(this),fi(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,n=r.playing;return e===void 0?r.progress:(n&&this.pause(),r.progress=e,r.started=!1,n&&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 n=function(c,h){var d=e[c];d!=null&&(e[c]=e[h],e[h]=d)};if(n("zoom","startZoom"),n("pan","startPan"),n("position","startPosition"),e.style)for(var i=0;i<e.style.length;i++){var a=e.style[i],s=a.name,l=e.startStyle[s];e.startStyle[s]=a,e.style[i]=l}return r&&this.play(),this},promise:function(e){var r=this._private,n;switch(e){case"frame":n=r.frames;break;default:case"complete":case"completed":n=r.completes}return new Gu(function(i,a){n.push(function(){i()})})}});Zl.complete=Zl.completed;Zl.run=Zl.play;Zl.running=Zl.playing;var HX={animated:function(){return function(){var r=this,n=r.length!==void 0,i=n?r:[r],a=this._private.cy||this;if(!a.styleEnabled())return!1;var s=i[0];if(s)return s._private.animation.current.length>0}},clearQueue:function(){return function(){var r=this,n=r.length!==void 0,i=n?r:[r],a=this._private.cy||this;if(!a.styleEnabled())return this;for(var s=0;s<i.length;s++){var l=i[s];l._private.animation.queue=[]}return this}},delay:function(){return function(r,n){var i=this._private.cy||this;return i.styleEnabled()?this.animate({delay:r,duration:r,complete:n}):this}},delayAnimation:function(){return function(r,n){var i=this._private.cy||this;return i.styleEnabled()?this.animation({delay:r,duration:r,complete:n}):this}},animation:function(){return function(r,n){var i=this,a=i.length!==void 0,s=a?i:[i],l=this._private.cy||this,o=!a,c=!o;if(!l.styleEnabled())return this;var h=l.style();r=ft({},r,n);var d=Object.keys(r).length===0;if(d)return new ok(s[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(c&&(r.style=h.getPropsList(r.style||r.css),r.css=void 0),c&&r.renderedPosition!=null){var g=r.renderedPosition,m=l.pan(),y=l.zoom();r.position=Pq(g,y,m)}if(o&&r.panBy!=null){var b=r.panBy,x=l.pan();r.pan={x:x.x+b.x,y:x.y+b.y}}var w=r.center||r.centre;if(o&&w!=null){var S=l.getCenterPan(w.eles,r.zoom);S!=null&&(r.pan=S)}if(o&&r.fit!=null){var k=r.fit,E=l.getFitViewport(k.eles||k.boundingBox,k.padding);E!=null&&(r.pan=E.pan,r.zoom=E.zoom)}if(o&&Bt(r.zoom)){var M=l.getZoomedViewport(r.zoom);M!=null?(M.zoomed&&(r.zoom=M.zoom),M.panned&&(r.pan=M.pan)):r.zoom=null}return new ok(s[0],r)}},animate:function(){return function(r,n){var i=this,a=i.length!==void 0,s=a?i:[i],l=this._private.cy||this;if(!l.styleEnabled())return this;n&&(r=ft({},r,n));for(var o=0;o<s.length;o++){var c=s[o],h=c.animated()&&(r.queue===void 0||r.queue),d=c.animation(r,h?{queue:!0}:void 0);d.play()}return this}},stop:function(){return function(r,n){var i=this,a=i.length!==void 0,s=a?i:[i],l=this._private.cy||this;if(!l.styleEnabled())return this;for(var o=0;o<s.length;o++){for(var c=s[o],h=c._private,d=h.animation.current,g=0;g<d.length;g++){var m=d[g],y=m._private;n&&(y.duration=0)}r&&(h.animation.queue=[]),n||(h.animation.current=[])}return l.notify("draw"),this}}},Fy,o_;function uv(){if(o_)return Fy;o_=1;var t=Array.isArray;return Fy=t,Fy}var Hy,u_;function VX(){if(u_)return Hy;u_=1;var t=uv(),e=gh(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,s){if(t(a))return!1;var l=typeof a;return l=="number"||l=="symbol"||l=="boolean"||a==null||e(a)?!0:n.test(a)||!r.test(a)||s!=null&&a in Object(s)}return Hy=i,Hy}var Vy,c_;function UX(){if(c_)return Vy;c_=1;var t=Aq(),e=ph(),r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function s(l){if(!e(l))return!1;var o=t(l);return o==n||o==i||o==r||o==a}return Vy=s,Vy}var Uy,f_;function $X(){if(f_)return Uy;f_=1;var t=av(),e=t["__core-js_shared__"];return Uy=e,Uy}var $y,h_;function GX(){if(h_)return $y;h_=1;var t=$X(),e=(function(){var n=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!e&&e in n}return $y=r,$y}var Gy,d_;function YX(){if(d_)return Gy;d_=1;var t=Function.prototype,e=t.toString;function r(n){if(n!=null){try{return e.call(n)}catch{}try{return n+""}catch{}}return""}return Gy=r,Gy}var Yy,p_;function XX(){if(p_)return Yy;p_=1;var t=UX(),e=GX(),r=ph(),n=YX(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,s=Function.prototype,l=Object.prototype,o=s.toString,c=l.hasOwnProperty,h=RegExp("^"+o.call(c).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function d(g){if(!r(g)||e(g))return!1;var m=t(g)?h:a;return m.test(n(g))}return Yy=d,Yy}var Xy,g_;function WX(){if(g_)return Xy;g_=1;function t(e,r){return e?.[r]}return Xy=t,Xy}var Wy,v_;function VT(){if(v_)return Wy;v_=1;var t=XX(),e=WX();function r(n,i){var a=e(n,i);return t(a)?a:void 0}return Wy=r,Wy}var Qy,m_;function cv(){if(m_)return Qy;m_=1;var t=VT(),e=t(Object,"create");return Qy=e,Qy}var Ky,y_;function QX(){if(y_)return Ky;y_=1;var t=cv();function e(){this.__data__=t?t(null):{},this.size=0}return Ky=e,Ky}var Zy,b_;function KX(){if(b_)return Zy;b_=1;function t(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}return Zy=t,Zy}var Jy,x_;function ZX(){if(x_)return Jy;x_=1;var t=cv(),e="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function i(a){var s=this.__data__;if(t){var l=s[a];return l===e?void 0:l}return n.call(s,a)?s[a]:void 0}return Jy=i,Jy}var eb,w_;function JX(){if(w_)return eb;w_=1;var t=cv(),e=Object.prototype,r=e.hasOwnProperty;function n(i){var a=this.__data__;return t?a[i]!==void 0:r.call(a,i)}return eb=n,eb}var tb,S_;function eW(){if(S_)return tb;S_=1;var t=cv(),e="__lodash_hash_undefined__";function r(n,i){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=t&&i===void 0?e:i,this}return tb=r,tb}var rb,C_;function tW(){if(C_)return rb;C_=1;var t=QX(),e=KX(),r=ZX(),n=JX(),i=eW();function a(s){var l=-1,o=s==null?0:s.length;for(this.clear();++l<o;){var c=s[l];this.set(c[0],c[1])}}return a.prototype.clear=t,a.prototype.delete=e,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,rb=a,rb}var nb,k_;function rW(){if(k_)return nb;k_=1;function t(){this.__data__=[],this.size=0}return nb=t,nb}var ib,T_;function Zq(){if(T_)return ib;T_=1;function t(e,r){return e===r||e!==e&&r!==r}return ib=t,ib}var ab,E_;function fv(){if(E_)return ab;E_=1;var t=Zq();function e(r,n){for(var i=r.length;i--;)if(t(r[i][0],n))return i;return-1}return ab=e,ab}var sb,A_;function nW(){if(A_)return sb;A_=1;var t=fv(),e=Array.prototype,r=e.splice;function n(i){var a=this.__data__,s=t(a,i);if(s<0)return!1;var l=a.length-1;return s==l?a.pop():r.call(a,s,1),--this.size,!0}return sb=n,sb}var lb,O_;function iW(){if(O_)return lb;O_=1;var t=fv();function e(r){var n=this.__data__,i=t(n,r);return i<0?void 0:n[i][1]}return lb=e,lb}var ob,M_;function aW(){if(M_)return ob;M_=1;var t=fv();function e(r){return t(this.__data__,r)>-1}return ob=e,ob}var ub,R_;function sW(){if(R_)return ub;R_=1;var t=fv();function e(r,n){var i=this.__data__,a=t(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return ub=e,ub}var cb,D_;function lW(){if(D_)return cb;D_=1;var t=rW(),e=nW(),r=iW(),n=aW(),i=sW();function a(s){var l=-1,o=s==null?0:s.length;for(this.clear();++l<o;){var c=s[l];this.set(c[0],c[1])}}return a.prototype.clear=t,a.prototype.delete=e,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,cb=a,cb}var fb,__;function oW(){if(__)return fb;__=1;var t=VT(),e=av(),r=t(e,"Map");return fb=r,fb}var hb,N_;function uW(){if(N_)return hb;N_=1;var t=tW(),e=lW(),r=oW();function n(){this.size=0,this.__data__={hash:new t,map:new(r||e),string:new t}}return hb=n,hb}var db,B_;function cW(){if(B_)return db;B_=1;function t(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}return db=t,db}var pb,L_;function hv(){if(L_)return pb;L_=1;var t=cW();function e(r,n){var i=r.__data__;return t(n)?i[typeof n=="string"?"string":"hash"]:i.map}return pb=e,pb}var gb,P_;function fW(){if(P_)return gb;P_=1;var t=hv();function e(r){var n=t(this,r).delete(r);return this.size-=n?1:0,n}return gb=e,gb}var vb,z_;function hW(){if(z_)return vb;z_=1;var t=hv();function e(r){return t(this,r).get(r)}return vb=e,vb}var mb,I_;function dW(){if(I_)return mb;I_=1;var t=hv();function e(r){return t(this,r).has(r)}return mb=e,mb}var yb,q_;function pW(){if(q_)return yb;q_=1;var t=hv();function e(r,n){var i=t(this,r),a=i.size;return i.set(r,n),this.size+=i.size==a?0:1,this}return yb=e,yb}var bb,j_;function gW(){if(j_)return bb;j_=1;var t=uW(),e=fW(),r=hW(),n=dW(),i=pW();function a(s){var l=-1,o=s==null?0:s.length;for(this.clear();++l<o;){var c=s[l];this.set(c[0],c[1])}}return a.prototype.clear=t,a.prototype.delete=e,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,bb=a,bb}var xb,F_;function vW(){if(F_)return xb;F_=1;var t=gW(),e="Expected a function";function r(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(e);var a=function(){var s=arguments,l=i?i.apply(this,s):s[0],o=a.cache;if(o.has(l))return o.get(l);var c=n.apply(this,s);return a.cache=o.set(l,c)||o,c};return a.cache=new(r.Cache||t),a}return r.Cache=t,xb=r,xb}var wb,H_;function mW(){if(H_)return wb;H_=1;var t=vW(),e=500;function r(n){var i=t(n,function(s){return a.size===e&&a.clear(),s}),a=i.cache;return i}return wb=r,wb}var Sb,V_;function Jq(){if(V_)return Sb;V_=1;var t=mW(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=t(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(e,function(s,l,o,c){a.push(o?c.replace(r,"$1"):l||s)}),a});return Sb=n,Sb}var Cb,U_;function ej(){if(U_)return Cb;U_=1;function t(e,r){for(var n=-1,i=e==null?0:e.length,a=Array(i);++n<i;)a[n]=r(e[n],n,e);return a}return Cb=t,Cb}var kb,$_;function yW(){if($_)return kb;$_=1;var t=BT(),e=ej(),r=uv(),n=gh(),i=t?t.prototype:void 0,a=i?i.toString:void 0;function s(l){if(typeof l=="string")return l;if(r(l))return e(l,s)+"";if(n(l))return a?a.call(l):"";var o=l+"";return o=="0"&&1/l==-1/0?"-0":o}return kb=s,kb}var Tb,G_;function tj(){if(G_)return Tb;G_=1;var t=yW();function e(r){return r==null?"":t(r)}return Tb=e,Tb}var Eb,Y_;function rj(){if(Y_)return Eb;Y_=1;var t=uv(),e=VX(),r=Jq(),n=tj();function i(a,s){return t(a)?a:e(a,s)?[a]:r(n(a))}return Eb=i,Eb}var Ab,X_;function UT(){if(X_)return Ab;X_=1;var t=gh();function e(r){if(typeof r=="string"||t(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return Ab=e,Ab}var Ob,W_;function bW(){if(W_)return Ob;W_=1;var t=rj(),e=UT();function r(n,i){i=t(i,n);for(var a=0,s=i.length;n!=null&&a<s;)n=n[e(i[a++])];return a&&a==s?n:void 0}return Ob=r,Ob}var Mb,Q_;function xW(){if(Q_)return Mb;Q_=1;var t=bW();function e(r,n,i){var a=r==null?void 0:t(r,n);return a===void 0?i:a}return Mb=e,Mb}var wW=xW(),SW=dh(wW),Rb,K_;function CW(){if(K_)return Rb;K_=1;var t=VT(),e=(function(){try{var r=t(Object,"defineProperty");return r({},"",{}),r}catch{}})();return Rb=e,Rb}var Db,Z_;function kW(){if(Z_)return Db;Z_=1;var t=CW();function e(r,n,i){n=="__proto__"&&t?t(r,n,{configurable:!0,enumerable:!0,value:i,writable:!0}):r[n]=i}return Db=e,Db}var _b,J_;function TW(){if(J_)return _b;J_=1;var t=kW(),e=Zq(),r=Object.prototype,n=r.hasOwnProperty;function i(a,s,l){var o=a[s];(!(n.call(a,s)&&e(o,l))||l===void 0&&!(s in a))&&t(a,s,l)}return _b=i,_b}var Nb,eN;function EW(){if(eN)return Nb;eN=1;var t=9007199254740991,e=/^(?:0|[1-9]\d*)$/;function r(n,i){var a=typeof n;return i=i??t,!!i&&(a=="number"||a!="symbol"&&e.test(n))&&n>-1&&n%1==0&&n<i}return Nb=r,Nb}var Bb,tN;function AW(){if(tN)return Bb;tN=1;var t=TW(),e=rj(),r=EW(),n=ph(),i=UT();function a(s,l,o,c){if(!n(s))return s;l=e(l,s);for(var h=-1,d=l.length,g=d-1,m=s;m!=null&&++h<d;){var y=i(l[h]),b=o;if(y==="__proto__"||y==="constructor"||y==="prototype")return s;if(h!=g){var x=m[y];b=c?c(x,y,m):void 0,b===void 0&&(b=n(x)?x:r(l[h+1])?[]:{})}t(m,y,b),m=m[y]}return s}return Bb=a,Bb}var Lb,rN;function OW(){if(rN)return Lb;rN=1;var t=AW();function e(r,n,i){return r==null?r:t(r,n,i)}return Lb=e,Lb}var MW=OW(),RW=dh(MW),Pb,nN;function DW(){if(nN)return Pb;nN=1;function t(e,r){var n=-1,i=e.length;for(r||(r=Array(i));++n<i;)r[n]=e[n];return r}return Pb=t,Pb}var zb,iN;function _W(){if(iN)return zb;iN=1;var t=ej(),e=DW(),r=uv(),n=gh(),i=Jq(),a=UT(),s=tj();function l(o){return r(o)?t(o,a):n(o)?[o]:e(i(s(o)))}return zb=l,zb}var NW=_W(),BW=dh(NW),LW={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,a){},onSet:function(i){},canSet:function(i){return!0}};return e=ft({},r,e),function(i,a){var s=e,l=this,o=l.length!==void 0,c=o?l:[l],h=o?l[0]:l;if(lt(i)){var d=i.indexOf(".")!==-1,g=d&&BW(i);if(s.allowGetting&&a===void 0){var m;return h&&(s.beforeGet(h),g&&h._private[s.field][i]===void 0?m=SW(h._private[s.field],g):m=h._private[s.field][i]),m}else if(s.allowSetting&&a!==void 0){var y=!s.immutableKeys[i];if(y){var b=mq({},i,a);s.beforeSet(l,b);for(var x=0,w=c.length;x<w;x++){var S=c[x];s.canSet(S)&&(g&&h._private[s.field][i]===void 0?RW(S._private[s.field],g,a):S._private[s.field][i]=a)}s.updateStyle&&l.updateStyle(),s.onSet(l),s.settingTriggersEvent&&l[s.triggerFnName](s.settingEvent)}}}else if(s.allowSetting&&Bt(i)){var k=i,E,M,R=Object.keys(k);s.beforeSet(l,k);for(var O=0;O<R.length;O++){E=R[O],M=k[E];var N=!s.immutableKeys[E];if(N)for(var B=0;B<c.length;B++){var D=c[B];s.canSet(D)&&(D._private[s.field][E]=M)}}s.updateStyle&&l.updateStyle(),s.onSet(l),s.settingTriggersEvent&&l[s.triggerFnName](s.settingEvent)}else if(s.allowBinding&&hr(i)){var _=i;l.on(s.bindingEvent,_)}else if(s.allowGetting&&i===void 0){var P;return h&&(s.beforeGet(h),P=h._private[s.field]),P}return l}},removeData:function(e){var r={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return e=ft({},r,e),function(i){var a=e,s=this,l=s.length!==void 0,o=l?s:[s];if(lt(i)){for(var c=i.split(/\s+/),h=c.length,d=0;d<h;d++){var g=c[d];if(!Ys(g)){var m=!a.immutableKeys[g];if(m)for(var y=0,b=o.length;y<b;y++)o[y]._private[a.field][g]=void 0}}a.triggerEvent&&s[a.triggerFnName](a.event)}else if(i===void 0){for(var x=0,w=o.length;x<w;x++)for(var S=o[x]._private[a.field],k=Object.keys(S),E=0;E<k.length;E++){var M=k[E],R=!a.immutableKeys[M];R&&(S[M]=void 0)}a.triggerEvent&&s[a.triggerFnName](a.event)}return s}}},PW={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(n,i){var a=this,s=Array.prototype.slice.call(arguments,0);return new Gu(function(l,o){var c=function(m){a.off.apply(a,d),l(m)},h=s.concat([c]),d=h.concat([]);a.on.apply(a,h)})}}},qt={};[HX,LW,PW].forEach(function(t){ft(qt,t)});var zW={animate:qt.animate(),animation:qt.animation(),animated:qt.animated(),clearQueue:qt.clearQueue(),delay:qt.delay(),delayAnimation:qt.delayAnimation(),stop:qt.stop()},qp={classes:function(e){var r=this;if(e===void 0){var n=[];return r[0]._private.classes.forEach(function(y){return n.push(y)}),n}else Zt(e)||(e=(e||"").match(/\S+/g)||[]);for(var i=[],a=new $u(e),s=0;s<r.length;s++){for(var l=r[s],o=l._private,c=o.classes,h=!1,d=0;d<e.length;d++){var g=e[d],m=c.has(g);if(!m){h=!0;break}}h||(h=c.size!==e.length),h&&(o.classes=a,i.push(l))}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){Zt(e)||(e=e.match(/\S+/g)||[]);for(var n=this,i=r===void 0,a=[],s=0,l=n.length;s<l;s++)for(var o=n[s],c=o._private.classes,h=!1,d=0;d<e.length;d++){var g=e[d],m=c.has(g),y=!1;r||i&&!m?(c.add(g),y=!0):(!r||i&&m)&&(c.delete(g),y=!0),!h&&y&&(a.push(o),h=!0)}return a.length>0&&this.spawn(a).updateStyle().emit("class"),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,r){var n=this;if(r==null)r=250;else if(r===0)return n;return n.addClass(e),setTimeout(function(){n.removeClass(e)},r),n}};qp.className=qp.classNames=qp.classes;var _t={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:Ir,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};_t.variable="(?:[\\w-.]|(?:\\\\"+_t.metaChar+"))+";_t.className="(?:[\\w-]|(?:\\\\"+_t.metaChar+"))+";_t.value=_t.string+"|"+_t.number;_t.id=_t.variable;(function(){var t,e,r;for(t=_t.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],_t.comparatorOp+="|@"+e;for(t=_t.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],!(e.indexOf("!")>=0)&&e!=="="&&(_t.comparatorOp+="|\\!"+e)})();var Xt=function(){return{checks:[]}},Je={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},uk=[{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 LG(t.selector,e.selector)}),IW=(function(){for(var t={},e,r=0;r<uk.length;r++)e=uk[r],t[e.selector]=e.matches;return t})(),qW=function(e,r){return IW[e](r)},jW="("+uk.map(function(t){return t.selector}).join("|")+")",Zo=function(e){return e.replace(new RegExp("\\\\("+_t.metaChar+")","g"),function(r,n){return n})},_s=function(e,r,n){e[e.length-1]=n},ck=[{name:"group",query:!0,regex:"("+_t.group+")",populate:function(e,r,n){var i=Rr(n,1),a=i[0];r.checks.push({type:Je.GROUP,value:a==="*"?a:a+"s"})}},{name:"state",query:!0,regex:jW,populate:function(e,r,n){var i=Rr(n,1),a=i[0];r.checks.push({type:Je.STATE,value:a})}},{name:"id",query:!0,regex:"\\#("+_t.id+")",populate:function(e,r,n){var i=Rr(n,1),a=i[0];r.checks.push({type:Je.ID,value:Zo(a)})}},{name:"className",query:!0,regex:"\\.("+_t.className+")",populate:function(e,r,n){var i=Rr(n,1),a=i[0];r.checks.push({type:Je.CLASS,value:Zo(a)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+_t.variable+")\\s*\\]",populate:function(e,r,n){var i=Rr(n,1),a=i[0];r.checks.push({type:Je.DATA_EXIST,field:Zo(a)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+_t.variable+")\\s*("+_t.comparatorOp+")\\s*("+_t.value+")\\s*\\]",populate:function(e,r,n){var i=Rr(n,3),a=i[0],s=i[1],l=i[2],o=new RegExp("^"+_t.string+"$").exec(l)!=null;o?l=l.substring(1,l.length-1):l=parseFloat(l),r.checks.push({type:Je.DATA_COMPARE,field:Zo(a),operator:s,value:l})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+_t.boolOp+")\\s*("+_t.variable+")\\s*\\]",populate:function(e,r,n){var i=Rr(n,2),a=i[0],s=i[1];r.checks.push({type:Je.DATA_BOOL,field:Zo(s),operator:a})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+_t.meta+")\\s*("+_t.comparatorOp+")\\s*("+_t.number+")\\s*\\]\\]",populate:function(e,r,n){var i=Rr(n,3),a=i[0],s=i[1],l=i[2];r.checks.push({type:Je.META_COMPARE,field:Zo(a),operator:s,value:parseFloat(l)})}},{name:"nextQuery",separator:!0,regex:_t.separator,populate:function(e,r){var n=e.currentSubject,i=e.edgeCount,a=e.compoundCount,s=e[e.length-1];n!=null&&(s.subject=n,e.currentSubject=null),s.edgeCount=i,s.compoundCount=a,e.edgeCount=0,e.compoundCount=0;var l=e[e.length++]=Xt();return l}},{name:"directedEdge",separator:!0,regex:_t.directedEdge,populate:function(e,r){if(e.currentSubject==null){var n=Xt(),i=r,a=Xt();return n.checks.push({type:Je.DIRECTED_EDGE,source:i,target:a}),_s(e,r,n),e.edgeCount++,a}else{var s=Xt(),l=r,o=Xt();return s.checks.push({type:Je.NODE_SOURCE,source:l,target:o}),_s(e,r,s),e.edgeCount++,o}}},{name:"undirectedEdge",separator:!0,regex:_t.undirectedEdge,populate:function(e,r){if(e.currentSubject==null){var n=Xt(),i=r,a=Xt();return n.checks.push({type:Je.UNDIRECTED_EDGE,nodes:[i,a]}),_s(e,r,n),e.edgeCount++,a}else{var s=Xt(),l=r,o=Xt();return s.checks.push({type:Je.NODE_NEIGHBOR,node:l,neighbor:o}),_s(e,r,s),o}}},{name:"child",separator:!0,regex:_t.child,populate:function(e,r){if(e.currentSubject==null){var n=Xt(),i=Xt(),a=e[e.length-1];return n.checks.push({type:Je.CHILD,parent:a,child:i}),_s(e,r,n),e.compoundCount++,i}else if(e.currentSubject===r){var s=Xt(),l=e[e.length-1],o=Xt(),c=Xt(),h=Xt(),d=Xt();return s.checks.push({type:Je.COMPOUND_SPLIT,left:l,right:o,subject:c}),c.checks=r.checks,r.checks=[{type:Je.TRUE}],d.checks.push({type:Je.TRUE}),o.checks.push({type:Je.PARENT,parent:d,child:h}),_s(e,l,s),e.currentSubject=c,e.compoundCount++,h}else{var g=Xt(),m=Xt(),y=[{type:Je.PARENT,parent:g,child:m}];return g.checks=r.checks,r.checks=y,e.compoundCount++,m}}},{name:"descendant",separator:!0,regex:_t.descendant,populate:function(e,r){if(e.currentSubject==null){var n=Xt(),i=Xt(),a=e[e.length-1];return n.checks.push({type:Je.DESCENDANT,ancestor:a,descendant:i}),_s(e,r,n),e.compoundCount++,i}else if(e.currentSubject===r){var s=Xt(),l=e[e.length-1],o=Xt(),c=Xt(),h=Xt(),d=Xt();return s.checks.push({type:Je.COMPOUND_SPLIT,left:l,right:o,subject:c}),c.checks=r.checks,r.checks=[{type:Je.TRUE}],d.checks.push({type:Je.TRUE}),o.checks.push({type:Je.ANCESTOR,ancestor:d,descendant:h}),_s(e,l,s),e.currentSubject=c,e.compoundCount++,h}else{var g=Xt(),m=Xt(),y=[{type:Je.ANCESTOR,ancestor:g,descendant:m}];return g.checks=r.checks,r.checks=y,e.compoundCount++,m}}},{name:"subject",modifier:!0,regex:_t.subject,populate:function(e,r){if(e.currentSubject!=null&&e.currentSubject!==r)return jt("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=r;var n=e[e.length-1],i=n.checks[0],a=i==null?null:i.type;a===Je.DIRECTED_EDGE?i.type=Je.NODE_TARGET:a===Je.UNDIRECTED_EDGE&&(i.type=Je.NODE_NEIGHBOR,i.node=i.nodes[1],i.neighbor=i.nodes[0],i.nodes=null)}}];ck.forEach(function(t){return t.regexObj=new RegExp("^"+t.regex)});var FW=function(e){for(var r,n,i,a=0;a<ck.length;a++){var s=ck[a],l=s.name,o=e.match(s.regexObj);if(o!=null){n=o,r=s,i=l;var c=o[0];e=e.substring(c.length);break}}return{expr:r,match:n,name:i,remaining:e}},HW=function(e){var r=e.match(/^\s+/);if(r){var n=r[0];e=e.substring(n.length)}return e},VW=function(e){var r=this,n=r.inputText=e,i=r[0]=Xt();for(r.length=1,n=HW(n);;){var a=FW(n);if(a.expr==null)return jt("The selector `"+e+"`is invalid"),!1;var s=a.match.slice(1),l=a.expr.populate(r,i,s);if(l===!1)return!1;if(l!=null&&(i=l),n=a.remaining,n.match(/^\s*$/))break}var o=r[r.length-1];r.currentSubject!=null&&(o.subject=r.currentSubject),o.edgeCount=r.edgeCount,o.compoundCount=r.compoundCount;for(var c=0;c<r.length;c++){var h=r[c];if(h.compoundCount>0&&h.edgeCount>0)return jt("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(h.edgeCount>1)return jt("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;h.edgeCount===1&&jt("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},UW=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(h){return h??""},r=function(h){return lt(h)?'"'+h+'"':e(h)},n=function(h){return" "+h+" "},i=function(h,d){var g=h.type,m=h.value;switch(g){case Je.GROUP:{var y=e(m);return y.substring(0,y.length-1)}case Je.DATA_COMPARE:{var b=h.field,x=h.operator;return"["+b+n(e(x))+r(m)+"]"}case Je.DATA_BOOL:{var w=h.operator,S=h.field;return"["+e(w)+S+"]"}case Je.DATA_EXIST:{var k=h.field;return"["+k+"]"}case Je.META_COMPARE:{var E=h.operator,M=h.field;return"[["+M+n(e(E))+r(m)+"]]"}case Je.STATE:return m;case Je.ID:return"#"+m;case Je.CLASS:return"."+m;case Je.PARENT:case Je.CHILD:return a(h.parent,d)+n(">")+a(h.child,d);case Je.ANCESTOR:case Je.DESCENDANT:return a(h.ancestor,d)+" "+a(h.descendant,d);case Je.COMPOUND_SPLIT:{var R=a(h.left,d),O=a(h.subject,d),N=a(h.right,d);return R+(R.length>0?" ":"")+O+N}case Je.TRUE:return""}},a=function(h,d){return h.checks.reduce(function(g,m,y){return g+(d===h&&y===0?"$":"")+i(m,d)},"")},s="",l=0;l<this.length;l++){var o=this[l];s+=a(o,o.subject),this.length>1&&l<this.length-1&&(s+=", ")}return this.toStringCache=s,s},$W={parse:VW,toString:UW},nj=function(e,r,n){var i,a=lt(e),s=qe(e),l=lt(n),o,c,h=!1,d=!1,g=!1;switch(r.indexOf("!")>=0&&(r=r.replace("!",""),d=!0),r.indexOf("@")>=0&&(r=r.replace("@",""),h=!0),(a||l||h)&&(o=!a&&!s?"":""+e,c=""+n),h&&(e=o=o.toLowerCase(),n=c=c.toLowerCase()),r){case"*=":i=o.indexOf(c)>=0;break;case"$=":i=o.indexOf(c,o.length-c.length)>=0;break;case"^=":i=o.indexOf(c)===0;break;case"=":i=e===n;break;case">":g=!0,i=e>n;break;case">=":g=!0,i=e>=n;break;case"<":g=!0,i=e<n;break;case"<=":g=!0,i=e<=n;break;default:i=!1;break}return d&&(e!=null||!g)&&(i=!i),i},GW=function(e,r){switch(r){case"?":return!!e;case"!":return!e;case"^":return e===void 0}},YW=function(e){return e!==void 0},$T=function(e,r){return e.data(r)},XW=function(e,r){return e[r]()},yr=[],sr=function(e,r){return e.checks.every(function(n){return yr[n.type](n,r)})};yr[Je.GROUP]=function(t,e){var r=t.value;return r==="*"||r===e.group()};yr[Je.STATE]=function(t,e){var r=t.value;return qW(r,e)};yr[Je.ID]=function(t,e){var r=t.value;return e.id()===r};yr[Je.CLASS]=function(t,e){var r=t.value;return e.hasClass(r)};yr[Je.META_COMPARE]=function(t,e){var r=t.field,n=t.operator,i=t.value;return nj(XW(e,r),n,i)};yr[Je.DATA_COMPARE]=function(t,e){var r=t.field,n=t.operator,i=t.value;return nj($T(e,r),n,i)};yr[Je.DATA_BOOL]=function(t,e){var r=t.field,n=t.operator;return GW($T(e,r),n)};yr[Je.DATA_EXIST]=function(t,e){var r=t.field;return t.operator,YW($T(e,r))};yr[Je.UNDIRECTED_EDGE]=function(t,e){var r=t.nodes[0],n=t.nodes[1],i=e.source(),a=e.target();return sr(r,i)&&sr(n,a)||sr(n,i)&&sr(r,a)};yr[Je.NODE_NEIGHBOR]=function(t,e){return sr(t.node,e)&&e.neighborhood().some(function(r){return r.isNode()&&sr(t.neighbor,r)})};yr[Je.DIRECTED_EDGE]=function(t,e){return sr(t.source,e.source())&&sr(t.target,e.target())};yr[Je.NODE_SOURCE]=function(t,e){return sr(t.source,e)&&e.outgoers().some(function(r){return r.isNode()&&sr(t.target,r)})};yr[Je.NODE_TARGET]=function(t,e){return sr(t.target,e)&&e.incomers().some(function(r){return r.isNode()&&sr(t.source,r)})};yr[Je.CHILD]=function(t,e){return sr(t.child,e)&&sr(t.parent,e.parent())};yr[Je.PARENT]=function(t,e){return sr(t.parent,e)&&e.children().some(function(r){return sr(t.child,r)})};yr[Je.DESCENDANT]=function(t,e){return sr(t.descendant,e)&&e.ancestors().some(function(r){return sr(t.ancestor,r)})};yr[Je.ANCESTOR]=function(t,e){return sr(t.ancestor,e)&&e.descendants().some(function(r){return sr(t.descendant,r)})};yr[Je.COMPOUND_SPLIT]=function(t,e){return sr(t.subject,e)&&sr(t.left,e)&&sr(t.right,e)};yr[Je.TRUE]=function(){return!0};yr[Je.COLLECTION]=function(t,e){var r=t.value;return r.has(e)};yr[Je.FILTER]=function(t,e){var r=t.value;return r(e)};var WW=function(e){var r=this;if(r.length===1&&r[0].checks.length===1&&r[0].checks[0].type===Je.ID)return e.getElementById(r[0].checks[0].value).collection();var n=function(a){for(var s=0;s<r.length;s++){var l=r[s];if(sr(l,a))return!0}return!1};return r.text()==null&&(n=function(){return!0}),e.filter(n)},QW=function(e){for(var r=this,n=0;n<r.length;n++){var i=r[n];if(sr(i,e))return!0}return!1},KW={matches:QW,filter:WW},Qs=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||lt(e)&&e.match(/^\s*$/)||(fi(e)?this.addQuery({checks:[{type:Je.COLLECTION,value:e.collection()}]}):hr(e)?this.addQuery({checks:[{type:Je.FILTER,value:e}]}):lt(e)?this.parse(e)||(this.invalid=!0):ur("A selector must be created from a string; found "))},Ks=Qs.prototype;[$W,KW].forEach(function(t){return ft(Ks,t)});Ks.text=function(){return this.inputText};Ks.size=function(){return this.length};Ks.eq=function(t){return this[t]};Ks.sameText=function(t){return!this.invalid&&!t.invalid&&this.text()===t.text()};Ks.addQuery=function(t){this[this.length++]=t};Ks.selector=Ks.toString;var Vs={allAre:function(e){var r=new Qs(e);return this.every(function(n){return r.matches(n)})},is:function(e){var r=new Qs(e);return this.some(function(n){return r.matches(n)})},some:function(e,r){for(var n=0;n<this.length;n++){var i=r?e.apply(r,[this[n],n,this]):e(this[n],n,this);if(i)return!0}return!1},every:function(e,r){for(var n=0;n<this.length;n++){var i=r?e.apply(r,[this[n],n,this]):e(this[n],n,this);if(!i)return!1}return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var r=this.length,n=e.length;return r!==n?!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(n){return r.hasElementWithId(n.id())})},contains:function(e){e=this.cy().collection(e);var r=this;return e.every(function(n){return r.hasElementWithId(n.id())})}};Vs.allAreNeighbours=Vs.allAreNeighbors;Vs.has=Vs.contains;Vs.equal=Vs.equals=Vs.same;var ki=function(e,r){return function(i,a,s,l){var o=i,c=this,h;if(o==null?h="":fi(o)&&o.length===1&&(h=o.id()),c.length===1&&h){var d=c[0]._private,g=d.traversalCache=d.traversalCache||{},m=g[r]=g[r]||[],y=Ql(h),b=m[y];return b||(m[y]=e.call(c,i,a,s,l))}else return e.call(c,i,a,s,l)}},Pu={parent:function(e){var r=[];if(this.length===1){var n=this[0]._private.parent;if(n)return n}for(var i=0;i<this.length;i++){var a=this[i],s=a._private.parent;s&&r.push(s)}return this.spawn(r,!0).filter(e)},parents:function(e){for(var r=[],n=this.parent();n.nonempty();){for(var i=0;i<n.length;i++){var a=n[i];r.push(a)}n=n.parent()}return this.spawn(r,!0).filter(e)},commonAncestors:function(e){for(var r,n=0;n<this.length;n++){var i=this[n],a=i.parents();r=r||a,r=r.intersect(a)}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:ki(function(t){for(var e=[],r=0;r<this.length;r++)for(var n=this[r],i=n._private.children,a=0;a<i.length;a++)e.push(i[a]);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 n(i){for(var a=0;a<i.length;a++){var s=i[a];r.push(s),s.children().nonempty()&&n(s.children())}}return n(this.children()),this.spawn(r,!0).filter(e)}};function GT(t,e,r,n){for(var i=[],a=new $u,s=t.cy(),l=s.hasCompoundNodes(),o=0;o<t.length;o++){var c=t[o];r?i.push(c):l&&n(i,a,c)}for(;i.length>0;){var h=i.shift();e(h),a.add(h.id()),l&&n(i,a,h)}return t}function ij(t,e,r){if(r.isParent())for(var n=r._private.children,i=0;i<n.length;i++){var a=n[i];e.has(a.id())||t.push(a)}}Pu.forEachDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return GT(this,t,e,ij)};function aj(t,e,r){if(r.isChild()){var n=r._private.parent;e.has(n.id())||t.push(n)}}Pu.forEachUp=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return GT(this,t,e,aj)};function ZW(t,e,r){aj(t,e,r),ij(t,e,r)}Pu.forEachUpAndDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return GT(this,t,e,ZW)};Pu.ancestors=Pu.parents;var Ff,sj;Ff=sj={data:qt.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:qt.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:qt.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:qt.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:qt.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:qt.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}};Ff.attr=Ff.data;Ff.removeAttr=Ff.removeData;var JW=sj,dv={};function Ib(t){return function(e){var r=this;if(e===void 0&&(e=!0),r.length!==0)if(r.isNode()&&!r.removed()){for(var n=0,i=r[0],a=i._private.edges,s=0;s<a.length;s++){var l=a[s];!e&&l.isLoop()||(n+=t(i,l))}return n}else return}}ft(dv,{degree:Ib(function(t,e){return e.source().same(e.target())?2:1}),indegree:Ib(function(t,e){return e.target().same(t)?1:0}),outdegree:Ib(function(t,e){return e.source().same(t)?1:0})});function Jo(t,e){return function(r){for(var n,i=this.nodes(),a=0;a<i.length;a++){var s=i[a],l=s[t](r);l!==void 0&&(n===void 0||e(l,n))&&(n=l)}return n}}ft(dv,{minDegree:Jo("degree",function(t,e){return t<e}),maxDegree:Jo("degree",function(t,e){return t>e}),minIndegree:Jo("indegree",function(t,e){return t<e}),maxIndegree:Jo("indegree",function(t,e){return t>e}),minOutdegree:Jo("outdegree",function(t,e){return t<e}),maxOutdegree:Jo("outdegree",function(t,e){return t>e})});ft(dv,{totalDegree:function(e){for(var r=0,n=this.nodes(),i=0;i<n.length;i++)r+=n[i].degree(e);return r}});var qi,lj,oj=function(e,r,n){for(var i=0;i<e.length;i++){var a=e[i];if(!a.locked()){var s=a._private.position,l={x:r.x!=null?r.x-s.x:0,y:r.y!=null?r.y-s.y:0};a.isParent()&&!(l.x===0&&l.y===0)&&a.children().shift(l,n),a.dirtyBoundingBoxCache()}}},aN={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){oj(e,r,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};qi=lj={position:qt.data(aN),silentPosition:qt.data(ft({},aN,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,r){oj(e,r,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,r){if(Bt(e))r?this.silentPosition(e):this.position(e);else if(hr(e)){var n=e,i=this.cy();i.startBatch();for(var a=0;a<this.length;a++){var s=this[a],l=void 0;(l=n(s,a))&&(r?s.silentPosition(l):s.position(l))}i.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,r,n){var i;if(Bt(e)?(i={x:qe(e.x)?e.x:0,y:qe(e.y)?e.y:0},n=r):lt(e)&&qe(r)&&(i={x:0,y:0},i[e]=r),i!=null){var a=this.cy();a.startBatch();for(var s=0;s<this.length;s++){var l=this[s];if(!(a.hasCompoundNodes()&&l.isChild()&&l.ancestors().anySame(this))){var o=l.position(),c={x:o.x+i.x,y:o.y+i.y};n?l.silentPosition(c):l.position(c)}}a.endBatch()}return this},silentShift:function(e,r){return Bt(e)?this.shift(e,!0):lt(e)&&qe(r)&&this.shift(e,r,!0),this},renderedPosition:function(e,r){var n=this[0],i=this.cy(),a=i.zoom(),s=i.pan(),l=Bt(e)?e:void 0,o=l!==void 0||r!==void 0&&lt(e);if(n&&n.isNode())if(o)for(var c=0;c<this.length;c++){var h=this[c];r!==void 0?h.position(e,(r-s[e])/a):l!==void 0&&h.position(Pq(l,a,s))}else{var d=n.position();return l=lv(d,a,s),e===void 0?l:l[e]}else if(!o)return;return this},relativePosition:function(e,r){var n=this[0],i=this.cy(),a=Bt(e)?e:void 0,s=a!==void 0||r!==void 0&&lt(e),l=i.hasCompoundNodes();if(n&&n.isNode())if(s)for(var o=0;o<this.length;o++){var c=this[o],h=l?c.parent():null,d=h&&h.length>0,g=d;d&&(h=h[0]);var m=g?h.position():{x:0,y:0};r!==void 0?c.position(e,r+m[e]):a!==void 0&&c.position({x:a.x+m.x,y:a.y+m.y})}else{var y=n.position(),b=l?n.parent():null,x=b&&b.length>0,w=x;x&&(b=b[0]);var S=w?b.position():{x:0,y:0};return a={x:y.x-S.x,y:y.y-S.y},e===void 0?a:a[e]}else if(!s)return;return this}};qi.modelPosition=qi.point=qi.position;qi.modelPositions=qi.points=qi.positions;qi.renderedPoint=qi.renderedPosition;qi.relativePoint=qi.relativePosition;var eQ=lj,ku,ol;ku=ol={};ol.renderedBoundingBox=function(t){var e=this.boundingBox(t),r=this.cy(),n=r.zoom(),i=r.pan(),a=e.x1*n+i.x,s=e.x2*n+i.x,l=e.y1*n+i.y,o=e.y2*n+i.y;return{x1:a,x2:s,y1:l,y2:o,w:s-a,h:o-l}};ol.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 n=r._private;n.compoundBoundsClean=!1,n.bbCache=null,t||r.emitAndNotify("bounds")}}),this)};ol.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(s){if(!s.isParent())return;var l=s._private,o=s.children(),c=s.pstyle("compound-sizing-wrt-labels").value==="include",h={width:{val:s.pstyle("min-width").pfValue,left:s.pstyle("min-width-bias-left"),right:s.pstyle("min-width-bias-right")},height:{val:s.pstyle("min-height").pfValue,top:s.pstyle("min-height-bias-top"),bottom:s.pstyle("min-height-bias-bottom")}},d=o.boundingBox({includeLabels:c,includeOverlays:!1,useCache:!1}),g=l.position;(d.w===0||d.h===0)&&(d={w:s.pstyle("width").pfValue,h:s.pstyle("height").pfValue},d.x1=g.x-d.w/2,d.x2=g.x+d.w/2,d.y1=g.y-d.h/2,d.y2=g.y+d.h/2);function m(B,D,_){var P=0,z=0,H=D+_;return B>0&&H>0&&(P=D/H*B,z=_/H*B),{biasDiff:P,biasComplementDiff:z}}function y(B,D,_,P){if(_.units==="%")switch(P){case"width":return B>0?_.pfValue*B:0;case"height":return D>0?_.pfValue*D:0;case"average":return B>0&&D>0?_.pfValue*(B+D)/2:0;case"min":return B>0&&D>0?B>D?_.pfValue*D:_.pfValue*B:0;case"max":return B>0&&D>0?B>D?_.pfValue*B:_.pfValue*D:0;default:return 0}else return _.units==="px"?_.pfValue:0}var b=h.width.left.value;h.width.left.units==="px"&&h.width.val>0&&(b=b*100/h.width.val);var x=h.width.right.value;h.width.right.units==="px"&&h.width.val>0&&(x=x*100/h.width.val);var w=h.height.top.value;h.height.top.units==="px"&&h.height.val>0&&(w=w*100/h.height.val);var S=h.height.bottom.value;h.height.bottom.units==="px"&&h.height.val>0&&(S=S*100/h.height.val);var k=m(h.width.val-d.w,b,x),E=k.biasDiff,M=k.biasComplementDiff,R=m(h.height.val-d.h,w,S),O=R.biasDiff,N=R.biasComplementDiff;l.autoPadding=y(d.w,d.h,s.pstyle("padding"),s.pstyle("padding-relative-to").value),l.autoWidth=Math.max(d.w,h.width.val),g.x=(-E+d.x1+d.x2+M)/2,l.autoHeight=Math.max(d.h,h.height.val),g.y=(-O+d.y1+d.y2+N)/2}for(var n=0;n<this.length;n++){var i=this[n],a=i._private;(!a.compoundBoundsClean||t)&&(r(i),e.batching()||(a.compoundBoundsClean=!0))}return this};var Ci=function(e){return e===1/0||e===-1/0?0:e},Li=function(e,r,n,i,a){i-r===0||a-n===0||r==null||n==null||i==null||a==null||(e.x1=r<e.x1?r:e.x1,e.x2=i>e.x2?i:e.x2,e.y1=n<e.y1?n:e.y1,e.y2=a>e.y2?a:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},Ns=function(e,r){return r==null?e:Li(e,r.x1,r.y1,r.x2,r.y2)},Kc=function(e,r,n){return Fn(e,r,n)},ip=function(e,r,n){if(!r.cy().headless()){var i=r._private,a=i.rstyle,s=a.arrowWidth/2,l=r.pstyle(n+"-arrow-shape").value,o,c;if(l!=="none"){n==="source"?(o=a.srcX,c=a.srcY):n==="target"?(o=a.tgtX,c=a.tgtY):(o=a.midX,c=a.midY);var h=i.arrowBounds=i.arrowBounds||{},d=h[n]=h[n]||{};d.x1=o-s,d.y1=c-s,d.x2=o+s,d.y2=c+s,d.w=d.x2-d.x1,d.h=d.y2-d.y1,zp(d,1),Li(e,d.x1,d.y1,d.x2,d.y2)}}},qb=function(e,r,n){if(!r.cy().headless()){var i;n?i=n+"-":i="";var a=r._private,s=a.rstyle,l=r.pstyle(i+"label").strValue;if(l){var o=r.pstyle("text-halign"),c=r.pstyle("text-valign"),h=Kc(s,"labelWidth",n),d=Kc(s,"labelHeight",n),g=Kc(s,"labelX",n),m=Kc(s,"labelY",n),y=r.pstyle(i+"text-margin-x").pfValue,b=r.pstyle(i+"text-margin-y").pfValue,x=r.isEdge(),w=r.pstyle(i+"text-rotation"),S=r.pstyle("text-outline-width").pfValue,k=r.pstyle("text-border-width").pfValue,E=k/2,M=r.pstyle("text-background-padding").pfValue,R=2,O=d,N=h,B=N/2,D=O/2,_,P,z,H;if(x)_=g-B,P=g+B,z=m-D,H=m+D;else{switch(o.value){case"left":_=g-N,P=g;break;case"center":_=g-B,P=g+B;break;case"right":_=g,P=g+N;break}switch(c.value){case"top":z=m-O,H=m;break;case"center":z=m-D,H=m+D;break;case"bottom":z=m,H=m+O;break}}var $=y-Math.max(S,E)-M-R,q=y+Math.max(S,E)+M+R,V=b-Math.max(S,E)-M-R,X=b+Math.max(S,E)+M+R;_+=$,P+=q,z+=V,H+=X;var ee=n||"main",te=a.labelBounds,I=te[ee]=te[ee]||{};I.x1=_,I.y1=z,I.x2=P,I.y2=H,I.w=P-_,I.h=H-z,I.leftPad=$,I.rightPad=q,I.topPad=V,I.botPad=X;var G=x&&w.strValue==="autorotate",re=w.pfValue!=null&&w.pfValue!==0;if(G||re){var Y=G?Kc(a.rstyle,"labelAngle",n):w.pfValue,W=Math.cos(Y),Z=Math.sin(Y),ie=(_+P)/2,we=(z+H)/2;if(!x){switch(o.value){case"left":ie=P;break;case"right":ie=_;break}switch(c.value){case"top":we=H;break;case"bottom":we=z;break}}var de=function(Me,He){return Me=Me-ie,He=He-we,{x:Me*W-He*Z+ie,y:Me*Z+He*W+we}},se=de(_,z),j=de(_,H),Q=de(P,z),K=de(P,H);_=Math.min(se.x,j.x,Q.x,K.x),P=Math.max(se.x,j.x,Q.x,K.x),z=Math.min(se.y,j.y,Q.y,K.y),H=Math.max(se.y,j.y,Q.y,K.y)}var ue=ee+"Rot",Se=te[ue]=te[ue]||{};Se.x1=_,Se.y1=z,Se.x2=P,Se.y2=H,Se.w=P-_,Se.h=H-z,Li(e,_,z,P,H),Li(a.labelBounds.all,_,z,P,H)}return e}},sN=function(e,r){if(!r.cy().headless()){var n=r.pstyle("outline-opacity").value,i=r.pstyle("outline-width").value,a=r.pstyle("outline-offset").value,s=i+a;uj(e,r,n,s,"outside",s/2)}},uj=function(e,r,n,i,a,s){if(!(n===0||i<=0||a==="inside")){var l=r.cy(),o=r.pstyle("shape").value,c=l.renderer().nodeShapes[o],h=r.position(),d=h.x,g=h.y,m=r.width(),y=r.height();if(c.hasMiterBounds){a==="center"&&(i/=2);var b=c.miterBounds(d,g,m,y,i);Ns(e,b)}else s!=null&&s>0&&Ip(e,[s,s,s,s])}},tQ=function(e,r){if(!r.cy().headless()){var n=r.pstyle("border-opacity").value,i=r.pstyle("border-width").pfValue,a=r.pstyle("border-position").value;uj(e,r,n,i,a)}},rQ=function(e,r){var n=e._private.cy,i=n.styleEnabled(),a=n.headless(),s=Rn(),l=e._private,o=e.isNode(),c=e.isEdge(),h,d,g,m,y,b,x=l.rstyle,w=o&&i?e.pstyle("bounds-expansion").pfValue:[0],S=function(at){return at.pstyle("display").value!=="none"},k=!i||S(e)&&(!c||S(e.source())&&S(e.target()));if(k){var E=0,M=0;i&&r.includeOverlays&&(E=e.pstyle("overlay-opacity").value,E!==0&&(M=e.pstyle("overlay-padding").value));var R=0,O=0;i&&r.includeUnderlays&&(R=e.pstyle("underlay-opacity").value,R!==0&&(O=e.pstyle("underlay-padding").value));var N=Math.max(M,O),B=0,D=0;if(i&&(B=e.pstyle("width").pfValue,D=B/2),o&&r.includeNodes){var _=e.position();y=_.x,b=_.y;var P=e.outerWidth(),z=P/2,H=e.outerHeight(),$=H/2;h=y-z,d=y+z,g=b-$,m=b+$,Li(s,h,g,d,m),i&&sN(s,e),i&&r.includeOutlines&&!a&&sN(s,e),i&&tQ(s,e)}else if(c&&r.includeEdges)if(i&&!a){var q=e.pstyle("curve-style").strValue;if(h=Math.min(x.srcX,x.midX,x.tgtX),d=Math.max(x.srcX,x.midX,x.tgtX),g=Math.min(x.srcY,x.midY,x.tgtY),m=Math.max(x.srcY,x.midY,x.tgtY),h-=D,d+=D,g-=D,m+=D,Li(s,h,g,d,m),q==="haystack"){var V=x.haystackPts;if(V&&V.length===2){if(h=V[0].x,g=V[0].y,d=V[1].x,m=V[1].y,h>d){var X=h;h=d,d=X}if(g>m){var ee=g;g=m,m=ee}Li(s,h-D,g-D,d+D,m+D)}}else if(q==="bezier"||q==="unbundled-bezier"||zs(q,"segments")||zs(q,"taxi")){var te;switch(q){case"bezier":case"unbundled-bezier":te=x.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":te=x.linePts;break}if(te!=null)for(var I=0;I<te.length;I++){var G=te[I];h=G.x-D,d=G.x+D,g=G.y-D,m=G.y+D,Li(s,h,g,d,m)}}}else{var re=e.source(),Y=re.position(),W=e.target(),Z=W.position();if(h=Y.x,d=Z.x,g=Y.y,m=Z.y,h>d){var ie=h;h=d,d=ie}if(g>m){var we=g;g=m,m=we}h-=D,d+=D,g-=D,m+=D,Li(s,h,g,d,m)}if(i&&r.includeEdges&&c&&(ip(s,e,"mid-source"),ip(s,e,"mid-target"),ip(s,e,"source"),ip(s,e,"target")),i){var de=e.pstyle("ghost").value==="yes";if(de){var se=e.pstyle("ghost-offset-x").pfValue,j=e.pstyle("ghost-offset-y").pfValue;Li(s,s.x1+se,s.y1+j,s.x2+se,s.y2+j)}}var Q=l.bodyBounds=l.bodyBounds||{};$D(Q,s),Ip(Q,w),zp(Q,1),i&&(h=s.x1,d=s.x2,g=s.y1,m=s.y2,Li(s,h-N,g-N,d+N,m+N));var K=l.overlayBounds=l.overlayBounds||{};$D(K,s),Ip(K,w),zp(K,1);var ue=l.labelBounds=l.labelBounds||{};ue.all!=null?zY(ue.all):ue.all=Rn(),i&&r.includeLabels&&(r.includeMainLabels&&qb(s,e,null),c&&(r.includeSourceLabels&&qb(s,e,"source"),r.includeTargetLabels&&qb(s,e,"target")))}return s.x1=Ci(s.x1),s.y1=Ci(s.y1),s.x2=Ci(s.x2),s.y2=Ci(s.y2),s.w=Ci(s.x2-s.x1),s.h=Ci(s.y2-s.y1),s.w>0&&s.h>0&&k&&(Ip(s,w),zp(s,1)),s},cj=function(e){var r=0,n=function(s){return(s?1:0)<<r++},i=0;return i+=n(e.incudeNodes),i+=n(e.includeEdges),i+=n(e.includeLabels),i+=n(e.includeMainLabels),i+=n(e.includeSourceLabels),i+=n(e.includeTargetLabels),i+=n(e.includeOverlays),i+=n(e.includeOutlines),i},fj=function(e){var r=function(l){return Math.round(l)};if(e.isEdge()){var n=e.source().position(),i=e.target().position();return qD([r(n.x),r(n.y),r(i.x),r(i.y)])}else{var a=e.position();return qD([r(a.x),r(a.y)])}},lN=function(e,r){var n=e._private,i,a=e.isEdge(),s=r==null?oN:cj(r),l=s===oN;if(n.bbCache==null?(i=rQ(e,Hf),n.bbCache=i,n.bbCachePosKey=fj(e)):i=n.bbCache,!l){var o=e.isNode();i=Rn(),(r.includeNodes&&o||r.includeEdges&&!o)&&(r.includeOverlays?Ns(i,n.overlayBounds):Ns(i,n.bodyBounds)),r.includeLabels&&(r.includeMainLabels&&(!a||r.includeSourceLabels&&r.includeTargetLabels)?Ns(i,n.labelBounds.all):(r.includeMainLabels&&Ns(i,n.labelBounds.mainRot),r.includeSourceLabels&&Ns(i,n.labelBounds.sourceRot),r.includeTargetLabels&&Ns(i,n.labelBounds.targetRot))),i.w=i.x2-i.x1,i.h=i.y2-i.y1}return i},Hf={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},oN=cj(Hf),uN=cn(Hf);ol.boundingBox=function(t){var e,r=t===void 0||t.useCache===void 0||t.useCache===!0,n=Bu(function(h){var d=h._private;return d.bbCache==null||d.styleDirty||d.bbCachePosKey!==fj(h)},function(h){return h.id()});if(r&&this.length===1&&!n(this[0]))t===void 0?t=Hf:t=uN(t),e=lN(this[0],t);else{e=Rn(),t=t||Hf;var i=uN(t),a=this,s=a.cy(),l=s.styleEnabled();this.edges().forEach(n),this.nodes().forEach(n),l&&this.recalculateRenderedStyle(r),this.updateCompoundBounds(!r);for(var o=0;o<a.length;o++){var c=a[o];n(c)&&c.dirtyBoundingBoxCache(),Ns(e,lN(c,i))}}return e.x1=Ci(e.x1),e.y1=Ci(e.y1),e.x2=Ci(e.x2),e.y2=Ci(e.y2),e.w=Ci(e.x2-e.x1),e.h=Ci(e.y2-e.y1),e};ol.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};ol.boundingBoxAt=function(t){var e=this.nodes(),r=this.cy(),n=r.hasCompoundNodes(),i=r.collection();if(n&&(i=e.filter(function(c){return c.isParent()}),e=e.not(i)),Bt(t)){var a=t;t=function(){return a}}var s=function(h,d){return h._private.bbAtOldPos=t(h,d)},l=function(h){return h._private.bbAtOldPos};r.startBatch(),e.forEach(s).silentPositions(t),n&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0));var o=PY(this.boundingBox({useCache:!1}));return e.silentPositions(l),n&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0)),r.endBatch(),o};ku.boundingbox=ku.bb=ku.boundingBox;ku.renderedBoundingbox=ku.renderedBoundingBox;var nQ=ol,hf,yh;hf=yh={};var hj=function(e){e.uppercaseName=kD(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=kD(e.outerName),hf[e.name]=function(){var n=this[0],i=n._private,a=i.cy,s=a._private.styleEnabled;if(n)if(s){if(n.isParent())return n.updateCompoundBounds(),i[e.autoName]||0;var l=n.pstyle(e.name);return l.strValue==="label"?(n.recalculateRenderedStyle(),i.rstyle[e.labelName]||0):l.pfValue}else return 1},hf["outer"+e.uppercaseName]=function(){var n=this[0],i=n._private,a=i.cy,s=a._private.styleEnabled;if(n)if(s){var l=n[e.name](),o=n.pstyle("border-position").value,c;o==="center"?c=n.pstyle("border-width").pfValue:o==="outside"?c=2*n.pstyle("border-width").pfValue:c=0;var h=2*n.padding();return l+c+h}else return 1},hf["rendered"+e.uppercaseName]=function(){var n=this[0];if(n){var i=n[e.name]();return i*this.cy().zoom()}},hf["rendered"+e.uppercaseOuterName]=function(){var n=this[0];if(n){var i=n[e.outerName]();return i*this.cy().zoom()}}};hj({name:"width"});hj({name:"height"});yh.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};yh.paddedHeight=function(){var t=this[0];return t.height()+2*t.padding()};yh.paddedWidth=function(){var t=this[0];return t.width()+2*t.padding()};var iQ=yh,aQ=function(e,r){if(e.isEdge()&&e.takesUpSpace())return r(e)},sQ=function(e,r){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy();return lv(r(e),n.zoom(),n.pan())}},lQ=function(e,r){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy(),i=n.pan(),a=n.zoom();return r(e).map(function(s){return lv(s,a,i)})}},oQ=function(e){return e.renderer().getControlPoints(e)},uQ=function(e){return e.renderer().getSegmentPoints(e)},cQ=function(e){return e.renderer().getSourceEndpoint(e)},fQ=function(e){return e.renderer().getTargetEndpoint(e)},hQ=function(e){return e.renderer().getEdgeMidpoint(e)},cN={controlPoints:{get:oQ,mult:!0},segmentPoints:{get:uQ,mult:!0},sourceEndpoint:{get:cQ},targetEndpoint:{get:fQ},midpoint:{get:hQ}},dQ=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)},pQ=Object.keys(cN).reduce(function(t,e){var r=cN[e],n=dQ(e);return t[e]=function(){return aQ(this,r.get)},r.mult?t[n]=function(){return lQ(this,r.get)}:t[n]=function(){return sQ(this,r.get)},t},{}),gQ=ft({},eQ,nQ,iQ,pQ);var dj=function(e,r){this.recycle(e,r)};function Zc(){return!1}function ap(){return!0}dj.prototype={instanceString:function(){return"event"},recycle:function(e,r){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=Zc,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?ap:Zc):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 n=this.position,i=this.cy.zoom(),a=this.cy.pan();this.renderedPosition={x:n.x*i+a.x,y:n.y*i+a.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=ap;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=ap;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=ap,this.stopPropagation()},isDefaultPrevented:Zc,isPropagationStopped:Zc,isImmediatePropagationStopped:Zc};var pj=/^([^.]+)(\.(?:[^.]+))?$/,vQ=".*",gj={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},fN=Object.keys(gj),mQ={};function pv(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:mQ,e=arguments.length>1?arguments[1]:void 0,r=0;r<fN.length;r++){var n=fN[r];this[n]=t[n]||gj[n]}this.context=e||this.context,this.listeners=[],this.emitting=0}var Zs=pv.prototype,vj=function(e,r,n,i,a,s,l){hr(i)&&(a=i,i=null),l&&(s==null?s=l:s=ft({},s,l));for(var o=Zt(n)?n:n.split(/\s+/),c=0;c<o.length;c++){var h=o[c];if(!Ys(h)){var d=h.match(pj);if(d){var g=d[1],m=d[2]?d[2]:null,y=r(e,h,g,m,i,a,s);if(y===!1)break}}}},hN=function(e,r){return e.addEventFields(e.context,r),new dj(r.type,r)},yQ=function(e,r,n){if(kG(n)){r(e,n);return}else if(Bt(n)){r(e,hN(e,n));return}for(var i=Zt(n)?n:n.split(/\s+/),a=0;a<i.length;a++){var s=i[a];if(!Ys(s)){var l=s.match(pj);if(l){var o=l[1],c=l[2]?l[2]:null,h=hN(e,{type:o,namespace:c,target:e.context});r(e,h)}}}};Zs.on=Zs.addListener=function(t,e,r,n,i){return vj(this,function(a,s,l,o,c,h,d){hr(h)&&a.listeners.push({event:s,callback:h,type:l,namespace:o,qualifier:c,conf:d})},t,e,r,n,i),this};Zs.one=function(t,e,r,n){return this.on(t,e,r,n,{one:!0})};Zs.removeListener=Zs.off=function(t,e,r,n){var i=this;this.emitting!==0&&(this.listeners=sY(this.listeners));for(var a=this.listeners,s=function(c){var h=a[c];vj(i,function(d,g,m,y,b,x){if((h.type===m||t==="*")&&(!y&&h.namespace!==".*"||h.namespace===y)&&(!b||d.qualifierCompare(h.qualifier,b))&&(!x||h.callback===x))return a.splice(c,1),!1},t,e,r,n)},l=a.length-1;l>=0;l--)s(l);return this};Zs.removeAllListeners=function(){return this.removeListener("*")};Zs.emit=Zs.trigger=function(t,e,r){var n=this.listeners,i=n.length;return this.emitting++,Zt(e)||(e=[e]),yQ(this,function(a,s){r!=null&&(n=[{event:s.event,type:s.type,namespace:s.namespace,callback:r}],i=n.length);for(var l=function(){var h=n[o];if(h.type===s.type&&(!h.namespace||h.namespace===s.namespace||h.namespace===vQ)&&a.eventMatches(a.context,h,s)){var d=[s];e!=null&&oY(d,e),a.beforeEmit(a.context,h,s),h.conf&&h.conf.one&&(a.listeners=a.listeners.filter(function(y){return y!==h}));var g=a.callbackContext(a.context,h,s),m=h.callback.apply(g,d);a.afterEmit(a.context,h,s),m===!1&&(s.stopPropagation(),s.preventDefault())}},o=0;o<i;o++)l();a.bubble(a.context)&&!s.isPropagationStopped()&&a.parent(a.context).emit(s,e)},t),this.emitting--,this};var bQ={qualifierCompare:function(e,r){return e==null||r==null?e==null&&r==null:e.sameText(r)},eventMatches:function(e,r,n){var i=r.qualifier;return i!=null?e!==n.target&&hh(n.target)&&i.matches(n.target):!0},addEventFields:function(e,r){r.cy=e.cy(),r.target=e},callbackContext:function(e,r,n){return r.qualifier!=null?n.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()}},sp=function(e){return lt(e)?new Qs(e):e},mj={createEmitter:function(){for(var e=0;e<this.length;e++){var r=this[e],n=r._private;n.emitter||(n.emitter=new pv(bQ,r))}return this},emitter:function(){return this._private.emitter},on:function(e,r,n){for(var i=sp(r),a=0;a<this.length;a++){var s=this[a];s.emitter().on(e,i,n)}return this},removeListener:function(e,r,n){for(var i=sp(r),a=0;a<this.length;a++){var s=this[a];s.emitter().removeListener(e,i,n)}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,n){for(var i=sp(r),a=0;a<this.length;a++){var s=this[a];s.emitter().one(e,i,n)}return this},once:function(e,r,n){for(var i=sp(r),a=0;a<this.length;a++){var s=this[a];s.emitter().on(e,i,n,{once:!0,onceCollection:this})}},emit:function(e,r){for(var n=0;n<this.length;n++){var i=this[n];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}};qt.eventAliasesOn(mj);var yj={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(),n=0;n<this.length;n++){var i=this[n];i.isNode()?e.push(i):r.push(i)}return{nodes:e,edges:r}},filter:function(e,r){if(e===void 0)return this;if(lt(e)||fi(e))return new Qs(e).filter(this);if(hr(e)){for(var n=this.spawn(),i=this,a=0;a<i.length;a++){var s=i[a],l=r?e.apply(r,[s,a,i]):e(s,a,i);l&&n.push(s)}return n}return this.spawn()},not:function(e){if(e){lt(e)&&(e=this.filter(e));for(var r=this.spawn(),n=0;n<this.length;n++){var i=this[n],a=e.has(i);a||r.push(i)}return r}else return this},absoluteComplement:function(){var e=this.cy();return e.mutableElements().not(this)},intersect:function(e){if(lt(e)){var r=e;return this.filter(r)}for(var n=this.spawn(),i=this,a=e,s=this.length<e.length,l=s?i:a,o=s?a:i,c=0;c<l.length;c++){var h=l[c];o.has(h)&&n.push(h)}return n},xor:function(e){var r=this._private.cy;lt(e)&&(e=r.$(e));var n=this.spawn(),i=this,a=e,s=function(o,c){for(var h=0;h<o.length;h++){var d=o[h],g=d._private.data.id,m=c.hasElementWithId(g);m||n.push(d)}};return s(i,a),s(a,i),n},diff:function(e){var r=this._private.cy;lt(e)&&(e=r.$(e));var n=this.spawn(),i=this.spawn(),a=this.spawn(),s=this,l=e,o=function(h,d,g){for(var m=0;m<h.length;m++){var y=h[m],b=y._private.data.id,x=d.hasElementWithId(b);x?a.merge(y):g.push(y)}};return o(s,l,n),o(l,s,i),{left:n,right:i,both:a}},add:function(e){var r=this._private.cy;if(!e)return this;if(lt(e)){var n=e;e=r.mutableElements().filter(n)}for(var i=this.spawnSelf(),a=0;a<e.length;a++){var s=e[a],l=!this.has(s);l&&i.push(s)}return i},merge:function(e){var r=this._private,n=r.cy;if(!e)return this;if(e&&lt(e)){var i=e;e=n.mutableElements().filter(i)}for(var a=r.map,s=0;s<e.length;s++){var l=e[s],o=l._private.data.id,c=!a.has(o);if(c){var h=this.length++;this[h]=l,a.set(o,{ele:l,index:h})}}return this},unmergeAt:function(e){var r=this[e],n=r.id(),i=this._private,a=i.map;this[e]=void 0,a.delete(n);var s=e===this.length-1;if(this.length>1&&!s){var l=this.length-1,o=this[l],c=o._private.data.id;this[l]=void 0,this[e]=o,a.set(c,{ele:o,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var r=this._private,n=e._private.data.id,i=r.map,a=i.get(n);if(!a)return this;var s=a.index;return this.unmergeAt(s),this},unmerge:function(e){var r=this._private.cy;if(!e)return this;if(e&&lt(e)){var n=e;e=r.mutableElements().filter(n)}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 n=this[r];e(n)&&this.unmergeAt(r)}return this},map:function(e,r){for(var n=[],i=this,a=0;a<i.length;a++){var s=i[a],l=r?e.apply(r,[s,a,i]):e(s,a,i);n.push(l)}return n},reduce:function(e,r){for(var n=r,i=this,a=0;a<i.length;a++)n=e(n,i[a],a,i);return n},max:function(e,r){for(var n=-1/0,i,a=this,s=0;s<a.length;s++){var l=a[s],o=r?e.apply(r,[l,s,a]):e(l,s,a);o>n&&(n=o,i=l)}return{value:n,ele:i}},min:function(e,r){for(var n=1/0,i,a=this,s=0;s<a.length;s++){var l=a[s],o=r?e.apply(r,[l,s,a]):e(l,s,a);o<n&&(n=o,i=l)}return{value:n,ele:i}}},zt=yj;zt.u=zt["|"]=zt["+"]=zt.union=zt.or=zt.add;zt["\\"]=zt["!"]=zt["-"]=zt.difference=zt.relativeComplement=zt.subtract=zt.not;zt.n=zt["&"]=zt["."]=zt.and=zt.intersection=zt.intersect;zt["^"]=zt["(+)"]=zt["(-)"]=zt.symmetricDifference=zt.symdiff=zt.xor;zt.fnFilter=zt.filterFn=zt.stdFilter=zt.filter;zt.complement=zt.abscomp=zt.absoluteComplement;var xQ={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}},bj=function(e,r){var n=e.cy(),i=n.hasCompoundNodes();function a(h){var d=h.pstyle("z-compound-depth");return d.value==="auto"?i?h.zDepth():0:d.value==="bottom"?-1:d.value==="top"?LT:0}var s=a(e)-a(r);if(s!==0)return s;function l(h){var d=h.pstyle("z-index-compare");return d.value==="auto"&&h.isNode()?1:0}var o=l(e)-l(r);if(o!==0)return o;var c=e.pstyle("z-index").value-r.pstyle("z-index").value;return c!==0?c:e.poolIndex()-r.poolIndex()},yg={forEach:function(e,r){if(hr(e))for(var n=this.length,i=0;i<n;i++){var a=this[i],s=r?e.apply(r,[a,i,this]):e(a,i,this);if(s===!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 n=[],i=this.length;r==null&&(r=i),e==null&&(e=0),e<0&&(e=i+e),r<0&&(r=i+r);for(var a=e;a>=0&&a<r&&a<i;a++)n.push(this[a]);return this.spawn(n)},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(!hr(e))return this;var r=this.toArray().sort(e);return this.spawn(r)},sortByZIndex:function(){return this.sort(bj)},zDepth:function(){var e=this[0];if(e){var r=e._private,n=r.group;if(n==="nodes"){var i=r.data.parent?e.parents().size():0;return e.isParent()?i:LT-1}else{var a=r.source,s=r.target,l=a.zDepth(),o=s.zDepth();return Math.max(l,o,0)}}}};yg.each=yg.forEach;var wQ=function(){var e="undefined",r=(typeof Symbol>"u"?"undefined":qr(Symbol))!=e&&qr(Symbol.iterator)!=e;r&&(yg[Symbol.iterator]=function(){var n=this,i={value:void 0,done:!1},a=0,s=this.length;return mq({next:function(){return a<s?i.value=n[a++]:(i.value=void 0,i.done=!0),i}},Symbol.iterator,function(){return this})})};wQ();var SQ=cn({nodeDimensionsIncludeLabels:!1}),jp={layoutDimensions:function(e){e=SQ(e);var r;if(!this.takesUpSpace())r={w:0,h:0};else if(e.nodeDimensionsIncludeLabels){var n=this.boundingBox();r={w:n.w,h:n.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,n){var i=this.nodes().filter(function(M){return!M.isParent()}),a=this.cy(),s=r.eles,l=function(R){return R.id()},o=Bu(n,l);e.emit({type:"layoutstart",layout:e}),e.animations=[];var c=function(R,O,N){var B={x:O.x1+O.w/2,y:O.y1+O.h/2},D={x:(N.x-B.x)*R,y:(N.y-B.y)*R};return{x:B.x+D.x,y:B.y+D.y}},h=r.spacingFactor&&r.spacingFactor!==1,d=function(){if(!h)return null;for(var R=Rn(),O=0;O<i.length;O++){var N=i[O],B=o(N,O);zq(R,B.x,B.y)}return R},g=d(),m=Bu(function(M,R){var O=o(M,R);if(h){var N=Math.abs(r.spacingFactor);O=c(N,g,O)}return r.transform!=null&&(O=r.transform(M,O)),O},l);if(r.animate){for(var y=0;y<i.length;y++){var b=i[y],x=m(b,y),w=r.animateFilter==null||r.animateFilter(b,y);if(w){var S=b.animation({position:x,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(S)}else b.position(x)}if(r.fit){var k=a.animation({fit:{boundingBox:s.boundingBoxAt(m),padding:r.padding},duration:r.animationDuration,easing:r.animationEasing});e.animations.push(k)}else if(r.zoom!==void 0&&r.pan!==void 0){var E=a.animation({zoom:r.zoom,pan:r.pan,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(E)}e.animations.forEach(function(M){return M.play()}),e.one("layoutready",r.ready),e.emit({type:"layoutready",layout:e}),Gu.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(m),r.fit&&a.fit(r.eles,r.padding),r.zoom!=null&&a.zoom(r.zoom),r.pan&&a.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(ft({},e,{eles:this}))}};jp.createLayout=jp.makeLayout=jp.layout;function xj(t,e,r){var n=r._private,i=n.styleCache=n.styleCache||[],a;return(a=i[t])!=null||(a=i[t]=e(r)),a}function gv(t,e){return t=Ql(t),function(n){return xj(t,e,n)}}function vv(t,e){t=Ql(t);var r=function(i){return e.call(i)};return function(){var i=this[0];if(i)return xj(t,r,i)}}var ln={recalculateRenderedStyle:function(e){var r=this.cy(),n=r.renderer(),i=r.styleEnabled();return n&&i&&n.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e=this.cy(),r=function(a){return a._private.styleCache=null};if(e.hasCompoundNodes()){var n;n=this.spawnSelf().merge(this.descendants()).merge(this.parents()),n.merge(n.connectedEdges()),n.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 n=r._private.batchStyleEles;return n.merge(this),this}var i=r.hasCompoundNodes(),a=this;e=!!(e||e===void 0),i&&(a=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var s=a;return e?s.emitAndNotify("style"):s.emit("style"),a.forEach(function(l){return l._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var r=0;r<this.length;r++){var n=this[r];n._private.styleDirty&&(n._private.styleDirty=!1,e.style().apply(n))}},parsedStyle:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this[0],i=n.cy();if(i.styleEnabled()&&n){n._private.styleDirty&&(n._private.styleDirty=!1,i.style().apply(n));var a=n._private.style[e];return a??(r?i.style().getDefaultProperty(e):null)}},numericStyle:function(e){var r=this[0];if(r.cy().styleEnabled()&&r){var n=r.pstyle(e);return n.pfValue!==void 0?n.pfValue:n.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 n=this[0];if(n)return r.style().getRenderedStyle(n,e)},style:function(e,r){var n=this.cy();if(!n.styleEnabled())return this;var i=!1,a=n.style();if(Bt(e)){var s=e;a.applyBypass(this,s,i),this.emitAndNotify("style")}else if(lt(e))if(r===void 0){var l=this[0];return l?a.getStylePropertyValue(l,e):void 0}else a.applyBypass(this,e,r,i),this.emitAndNotify("style");else if(e===void 0){var o=this[0];return o?a.getRawStyle(o):void 0}return this},removeStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var n=!1,i=r.style(),a=this;if(e===void 0)for(var s=0;s<a.length;s++){var l=a[s];i.removeAllBypasses(l,n)}else{e=e.split(/\s+/);for(var o=0;o<a.length;o++){var c=a[o];i.removeBypasses(c,e,n)}}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(),n=this[0];if(n){var i=n._private,a=n.pstyle("opacity").value;if(!r)return a;var s=i.data.parent?n.parents():null;if(s)for(var l=0;l<s.length;l++){var o=s[l],c=o.pstyle("opacity").value;a=c*a}return a}},transparent:function(){var e=this.cy();if(!e.styleEnabled())return!1;var r=this[0],n=r.cy().hasCompoundNodes();if(r)return n?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 jb(t,e){var r=t._private,n=r.data.parent?t.parents():null;if(n)for(var i=0;i<n.length;i++){var a=n[i];if(!e(a))return!1}return!0}function YT(t){var e=t.ok,r=t.edgeOkViaNode||t.ok,n=t.parentOk||t.ok;return function(){var i=this.cy();if(!i.styleEnabled())return!0;var a=this[0],s=i.hasCompoundNodes();if(a){var l=a._private;if(!e(a))return!1;if(a.isNode())return!s||jb(a,n);var o=l.source,c=l.target;return r(o)&&(!s||jb(o,r))&&(o===c||r(c)&&(!s||jb(c,r)))}}}var Yu=gv("eleTakesUpSpace",function(t){return t.pstyle("display").value==="element"&&t.width()!==0&&(t.isNode()?t.height()!==0:!0)});ln.takesUpSpace=vv("takesUpSpace",YT({ok:Yu}));var CQ=gv("eleInteractive",function(t){return t.pstyle("events").value==="yes"&&t.pstyle("visibility").value==="visible"&&Yu(t)}),kQ=gv("parentInteractive",function(t){return t.pstyle("visibility").value==="visible"&&Yu(t)});ln.interactive=vv("interactive",YT({ok:CQ,parentOk:kQ,edgeOkViaNode:Yu}));ln.noninteractive=function(){var t=this[0];if(t)return!t.interactive()};var TQ=gv("eleVisible",function(t){return t.pstyle("visibility").value==="visible"&&t.pstyle("opacity").pfValue!==0&&Yu(t)}),EQ=Yu;ln.visible=vv("visible",YT({ok:TQ,edgeOkViaNode:EQ}));ln.hidden=function(){var t=this[0];if(t)return!t.visible()};ln.isBundledBezier=vv("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1});ln.bypass=ln.css=ln.style;ln.renderedCss=ln.renderedStyle;ln.removeBypass=ln.removeCss=ln.removeStyle;ln.pstyle=ln.parsedStyle;var Us={};function dN(t){return function(){var e=arguments,r=[];if(e.length===2){var n=e[0],i=e[1];this.on(t.event,n,i)}else if(e.length===1&&hr(e[0])){var a=e[0];this.on(t.event,a)}else if(e.length===0||e.length===1&&Zt(e[0])){for(var s=e.length===1?e[0]:null,l=0;l<this.length;l++){var o=this[l],c=!t.ableField||o._private[t.ableField],h=o._private[t.field]!=t.value;if(t.overrideAble){var d=t.overrideAble(o);if(d!==void 0&&(c=d,!d))return this}c&&(o._private[t.field]=t.value,h&&r.push(o))}var g=this.spawn(r);g.updateStyle(),g.emit(t.event),s&&g.emit(s)}return this}}function Xu(t){Us[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]}},Us[t.on]=dN({event:t.on,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!0}),Us[t.off]=dN({event:t.off,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!1})}Xu({field:"locked",overrideField:function(e){return e.cy().autolock()?!0:void 0},on:"lock",off:"unlock"});Xu({field:"grabbable",overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:"grabify",off:"ungrabify"});Xu({field:"selected",ableField:"selectable",overrideAble:function(e){return e.cy().autounselectify()?!1:void 0},on:"select",off:"unselect"});Xu({field:"selectable",overrideField:function(e){return e.cy().autounselectify()?!1:void 0},on:"selectify",off:"unselectify"});Us.deselect=Us.unselect;Us.grabbed=function(){var t=this[0];if(t)return t._private.grabbed};Xu({field:"active",on:"activate",off:"unactivate"});Xu({field:"pannable",on:"panify",off:"unpanify"});Us.inactive=function(){var t=this[0];if(t)return!t._private.active};var mn={},pN=function(e){return function(n){for(var i=this,a=[],s=0;s<i.length;s++){var l=i[s];if(l.isNode()){for(var o=!1,c=l.connectedEdges(),h=0;h<c.length;h++){var d=c[h],g=d.source(),m=d.target();if(e.noIncomingEdges&&m===l&&g!==l||e.noOutgoingEdges&&g===l&&m!==l){o=!0;break}}o||a.push(l)}}return this.spawn(a,!0).filter(n)}},gN=function(e){return function(r){for(var n=this,i=[],a=0;a<n.length;a++){var s=n[a];if(s.isNode())for(var l=s.connectedEdges(),o=0;o<l.length;o++){var c=l[o],h=c.source(),d=c.target();e.outgoing&&h===s?(i.push(c),i.push(d)):e.incoming&&d===s&&(i.push(c),i.push(h))}}return this.spawn(i,!0).filter(r)}},vN=function(e){return function(r){for(var n=this,i=[],a={};;){var s=e.outgoing?n.outgoers():n.incomers();if(s.length===0)break;for(var l=!1,o=0;o<s.length;o++){var c=s[o],h=c.id();a[h]||(a[h]=!0,i.push(c),l=!0)}if(!l)break;n=s}return this.spawn(i,!0).filter(r)}};mn.clearTraversalCache=function(){for(var t=0;t<this.length;t++)this[t]._private.traversalCache=null};ft(mn,{roots:pN({noIncomingEdges:!0}),leaves:pN({noOutgoingEdges:!0}),outgoers:ki(gN({outgoing:!0}),"outgoers"),successors:vN({outgoing:!0}),incomers:ki(gN({incoming:!0}),"incomers"),predecessors:vN({})});ft(mn,{neighborhood:ki(function(t){for(var e=[],r=this.nodes(),n=0;n<r.length;n++)for(var i=r[n],a=i.connectedEdges(),s=0;s<a.length;s++){var l=a[s],o=l.source(),c=l.target(),h=i===o?c:o;h.length>0&&e.push(h[0]),e.push(l[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)}});mn.neighbourhood=mn.neighborhood;mn.closedNeighbourhood=mn.closedNeighborhood;mn.openNeighbourhood=mn.openNeighborhood;ft(mn,{source:ki(function(e){var r=this[0],n;return r&&(n=r._private.source||r.cy().collection()),n&&e?n.filter(e):n},"source"),target:ki(function(e){var r=this[0],n;return r&&(n=r._private.target||r.cy().collection()),n&&e?n.filter(e):n},"target"),sources:mN({attr:"source"}),targets:mN({attr:"target"})});function mN(t){return function(r){for(var n=[],i=0;i<this.length;i++){var a=this[i],s=a._private[t.attr];s&&n.push(s)}return this.spawn(n,!0).filter(r)}}ft(mn,{edgesWith:ki(yN(),"edgesWith"),edgesTo:ki(yN({thisIsSrc:!0}),"edgesTo")});function yN(t){return function(r){var n=[],i=this._private.cy,a=t||{};lt(r)&&(r=i.$(r));for(var s=0;s<r.length;s++)for(var l=r[s]._private.edges,o=0;o<l.length;o++){var c=l[o],h=c._private.data,d=this.hasElementWithId(h.source)&&r.hasElementWithId(h.target),g=r.hasElementWithId(h.source)&&this.hasElementWithId(h.target),m=d||g;m&&((a.thisIsSrc||a.thisIsTgt)&&(a.thisIsSrc&&!d||a.thisIsTgt&&!g)||n.push(c))}return this.spawn(n,!0)}}ft(mn,{connectedEdges:ki(function(t){for(var e=[],r=this,n=0;n<r.length;n++){var i=r[n];if(i.isNode())for(var a=i._private.edges,s=0;s<a.length;s++){var l=a[s];e.push(l)}}return this.spawn(e,!0).filter(t)},"connectedEdges"),connectedNodes:ki(function(t){for(var e=[],r=this,n=0;n<r.length;n++){var i=r[n];i.isEdge()&&(e.push(i.source()[0]),e.push(i.target()[0]))}return this.spawn(e,!0).filter(t)},"connectedNodes"),parallelEdges:ki(bN(),"parallelEdges"),codirectedEdges:ki(bN({codirected:!0}),"codirectedEdges")});function bN(t){var e={codirected:!1};return t=ft({},e,t),function(n){for(var i=[],a=this.edges(),s=t,l=0;l<a.length;l++)for(var o=a[l],c=o._private,h=c.source,d=h._private.data.id,g=c.data.target,m=h._private.edges,y=0;y<m.length;y++){var b=m[y],x=b._private.data,w=x.target,S=x.source,k=w===g&&S===d,E=d===w&&g===S;(s.codirected&&k||!s.codirected&&(k||E))&&i.push(b)}return this.spawn(i,!0).filter(n)}}ft(mn,{components:function(e){var r=this,n=r.cy(),i=n.collection(),a=e==null?r.nodes():e.nodes(),s=[];e!=null&&a.empty()&&(a=e.sources());var l=function(h,d){i.merge(h),a.unmerge(h),d.merge(h)};if(a.empty())return r.spawn();var o=function(){var h=n.collection();s.push(h);var d=a[0];l(d,h),r.bfs({directed:!1,roots:d,visit:function(m){return l(m,h)}}),h.forEach(function(g){g.connectedEdges().forEach(function(m){r.has(m)&&h.has(m.source())&&h.has(m.target())&&h.merge(m)})})};do o();while(a.length>0);return s},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}});mn.componentsOf=mn.components;var on=function(e,r){var n=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){ur("A collection must have a reference to the core");return}var a=new Ua,s=!1;if(!r)r=[];else if(r.length>0&&Bt(r[0])&&!hh(r[0])){s=!0;for(var l=[],o=new $u,c=0,h=r.length;c<h;c++){var d=r[c];d.data==null&&(d.data={});var g=d.data;if(g.id==null)g.id=Bq();else if(e.hasElementWithId(g.id)||o.has(g.id))continue;var m=new sv(e,d,!1);l.push(m),o.add(g.id)}r=l}this.length=0;for(var y=0,b=r.length;y<b;y++){var x=r[y][0];if(x!=null){var w=x._private.data.id;(!n||!a.has(w))&&(n&&a.set(w,{index:this.length,ele:x}),this[this.length]=x,this.length++)}}this._private={eles:this,cy:e,get map(){return this.lazyMap==null&&this.rebuildMap(),this.lazyMap},set map(S){this.lazyMap=S},rebuildMap:function(){for(var k=this.lazyMap=new Ua,E=this.eles,M=0;M<E.length;M++){var R=E[M];k.set(R.id(),{index:M,ele:R})}}},n&&(this._private.map=a),s&&!i&&this.restore()},rr=sv.prototype=on.prototype=Object.create(Array.prototype);rr.instanceString=function(){return"collection"};rr.spawn=function(t,e){return new on(this.cy(),t,e)};rr.spawnSelf=function(){return this.spawn(this)};rr.cy=function(){return this._private.cy};rr.renderer=function(){return this._private.cy.renderer()};rr.element=function(){return this[0]};rr.collection=function(){return xq(this)?this:new on(this._private.cy,[this])};rr.unique=function(){return new on(this._private.cy,this,!0)};rr.hasElementWithId=function(t){return t=""+t,this._private.map.has(t)};rr.getElementById=function(t){t=""+t;var e=this._private.cy,r=this._private.map.get(t);return r?r.ele:new on(e)};rr.$id=rr.getElementById;rr.poolIndex=function(){var t=this._private.cy,e=t._private.elements,r=this[0]._private.data.id;return e._private.map.get(r).index};rr.indexOf=function(t){var e=t[0]._private.data.id;return this._private.map.get(e).index};rr.indexOfId=function(t){return t=""+t,this._private.map.get(t).index};rr.json=function(t){var e=this.element(),r=this.cy();if(e==null&&t)return this;if(e!=null){var n=e._private;if(Bt(t)){if(r.startBatch(),t.data){e.data(t.data);var i=n.data;if(e.isEdge()){var a=!1,s={},l=t.data.source,o=t.data.target;l!=null&&l!=i.source&&(s.source=""+l,a=!0),o!=null&&o!=i.target&&(s.target=""+o,a=!0),a&&(e=e.move(s))}else{var c="parent"in t.data,h=t.data.parent;c&&(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 d=function(b,x,w){var S=t[b];S!=null&&S!==n[b]&&(S?e[x]():e[w]())};return d("removed","remove","restore"),d("selected","select","unselect"),d("selectable","selectify","unselectify"),d("locked","lock","unlock"),d("grabbable","grabify","ungrabify"),d("pannable","panify","unpanify"),t.classes!=null&&e.classes(t.classes),r.endBatch(),this}else if(t===void 0){var g={data:la(n.data),position:la(n.position),group:n.group,removed:n.removed,selected:n.selected,selectable:n.selectable,locked:n.locked,grabbable:n.grabbable,pannable:n.pannable,classes:null};g.classes="";var m=0;return n.classes.forEach(function(y){return g.classes+=m++===0?y:" "+y}),g}}};rr.jsons=function(){for(var t=[],e=0;e<this.length;e++){var r=this[e],n=r.json();t.push(n)}return t};rr.clone=function(){for(var t=this.cy(),e=[],r=0;r<this.length;r++){var n=this[r],i=n.json(),a=new sv(t,i,!1);e.push(a)}return new on(t,e)};rr.copy=rr.clone;rr.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,n=r.cy(),i=n._private,a=[],s=[],l,o=0,c=r.length;o<c;o++){var h=r[o];e&&!h.removed()||(h.isNode()?a.push(h):s.push(h))}l=a.concat(s);var d,g=function(){l.splice(d,1),d--};for(d=0;d<l.length;d++){var m=l[d],y=m._private,b=y.data;if(m.clearTraversalCache(),!(!e&&!y.removed)){if(b.id===void 0)b.id=Bq();else if(qe(b.id))b.id=""+b.id;else if(Ys(b.id)||!lt(b.id)){ur("Can not create element with invalid string ID `"+b.id+"`"),g();continue}else if(n.hasElementWithId(b.id)){ur("Can not create second element with ID `"+b.id+"`"),g();continue}}var x=b.id;if(m.isNode()){var w=y.position;w.x==null&&(w.x=0),w.y==null&&(w.y=0)}if(m.isEdge()){for(var S=m,k=["source","target"],E=k.length,M=!1,R=0;R<E;R++){var O=k[R],N=b[O];qe(N)&&(N=b[O]=""+b[O]),N==null||N===""?(ur("Can not create edge `"+x+"` with unspecified "+O),M=!0):n.hasElementWithId(N)||(ur("Can not create edge `"+x+"` with nonexistant "+O+" `"+N+"`"),M=!0)}if(M){g();continue}var B=n.getElementById(b.source),D=n.getElementById(b.target);B.same(D)?B._private.edges.push(S):(B._private.edges.push(S),D._private.edges.push(S)),S._private.source=B,S._private.target=D}y.map=new Ua,y.map.set(x,{ele:m,index:0}),y.removed=!1,e&&n.addToPool(m)}for(var _=0;_<a.length;_++){var P=a[_],z=P._private.data;qe(z.parent)&&(z.parent=""+z.parent);var H=z.parent,$=H!=null;if($||P._private.parent){var q=P._private.parent?n.collection().merge(P._private.parent):n.getElementById(H);if(q.empty())z.parent=void 0;else if(q[0].removed())jt("Node added with missing parent, reference to parent removed"),z.parent=void 0,P._private.parent=null;else{for(var V=!1,X=q;!X.empty();){if(P.same(X)){V=!0,z.parent=void 0;break}X=X.parent()}V||(q[0]._private.children.push(P),P._private.parent=q[0],i.hasCompoundNodes=!0)}}}if(l.length>0){for(var ee=l.length===r.length?r:new on(n,l),te=0;te<ee.length;te++){var I=ee[te];I.isNode()||(I.parallelEdges().clearTraversalCache(),I.source().clearTraversalCache(),I.target().clearTraversalCache())}var G;i.hasCompoundNodes?G=n.collection().merge(ee).merge(ee.connectedNodes()).merge(ee.parent()):G=ee,G.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(t),t?ee.emitAndNotify("add"):e&&ee.emit("add")}return r};rr.removed=function(){var t=this[0];return t&&t._private.removed};rr.inside=function(){var t=this[0];return t&&!t._private.removed};rr.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,n=[],i={},a=r._private.cy;function s(H){for(var $=H._private.edges,q=0;q<$.length;q++)o($[q])}function l(H){for(var $=H._private.children,q=0;q<$.length;q++)o($[q])}function o(H){var $=i[H.id()];e&&H.removed()||$||(i[H.id()]=!0,H.isNode()?(n.push(H),s(H),l(H)):n.unshift(H))}for(var c=0,h=r.length;c<h;c++){var d=r[c];o(d)}function g(H,$){var q=H._private.edges;Xs(q,$),H.clearTraversalCache()}function m(H){H.clearTraversalCache()}var y=[];y.ids={};function b(H,$){$=$[0],H=H[0];var q=H._private.children,V=H.id();Xs(q,$),$._private.parent=null,y.ids[V]||(y.ids[V]=!0,y.push(H))}r.dirtyCompoundBoundsCache(),e&&a.removeFromPool(n);for(var x=0;x<n.length;x++){var w=n[x];if(w.isEdge()){var S=w.source()[0],k=w.target()[0];g(S,w),g(k,w);for(var E=w.parallelEdges(),M=0;M<E.length;M++){var R=E[M];m(R),R.isBundledBezier()&&R.dirtyBoundingBoxCache()}}else{var O=w.parent();O.length!==0&&b(O,w)}e&&(w._private.removed=!0)}var N=a._private.elements;a._private.hasCompoundNodes=!1;for(var B=0;B<N.length;B++){var D=N[B];if(D.isParent()){a._private.hasCompoundNodes=!0;break}}var _=new on(this.cy(),n);_.size()>0&&(t?_.emitAndNotify("remove"):e&&_.emit("remove"));for(var P=0;P<y.length;P++){var z=y[P];(!e||!z.removed())&&z.updateStyle()}return _};rr.move=function(t){var e=this._private.cy,r=this,n=!1,i=!1,a=function(y){return y==null?y:""+y};if(t.source!==void 0||t.target!==void 0){var s=a(t.source),l=a(t.target),o=s!=null&&e.hasElementWithId(s),c=l!=null&&e.hasElementWithId(l);(o||c)&&(e.batch(function(){r.remove(n,i),r.emitAndNotify("moveout");for(var m=0;m<r.length;m++){var y=r[m],b=y._private.data;y.isEdge()&&(o&&(b.source=s),c&&(b.target=l))}r.restore(n,i)}),r.emitAndNotify("move"))}else if(t.parent!==void 0){var h=a(t.parent),d=h===null||e.hasElementWithId(h);if(d){var g=h===null?void 0:h;e.batch(function(){var m=r.remove(n,i);m.emitAndNotify("moveout");for(var y=0;y<r.length;y++){var b=r[y],x=b._private.data;b.isNode()&&(x.parent=g)}m.restore(n,i)}),r.emitAndNotify("move")}}return this};[Gq,zW,qp,Vs,Pu,JW,dv,gQ,mj,yj,xQ,yg,jp,ln,Us,mn].forEach(function(t){ft(rr,t)});var AQ={add:function(e){var r,n=this;if(fi(e)){var i=e;if(i._private.cy===n)r=i.restore();else{for(var a=[],s=0;s<i.length;s++){var l=i[s];a.push(l.json())}r=new on(n,a)}}else if(Zt(e)){var o=e;r=new on(n,o)}else if(Bt(e)&&(Zt(e.nodes)||Zt(e.edges))){for(var c=e,h=[],d=["nodes","edges"],g=0,m=d.length;g<m;g++){var y=d[g],b=c[y];if(Zt(b))for(var x=0,w=b.length;x<w;x++){var S=ft({group:y},b[x]);h.push(S)}}r=new on(n,h)}else{var k=e;r=new sv(n,k).collection()}return r},remove:function(e){if(!fi(e)){if(lt(e)){var r=e;e=this.$(r)}}return e.remove()}};function OQ(t,e,r,n){var i=4,a=.001,s=1e-7,l=10,o=11,c=1/(o-1),h=typeof Float32Array<"u";if(arguments.length!==4)return!1;for(var d=0;d<4;++d)if(typeof arguments[d]!="number"||isNaN(arguments[d])||!isFinite(arguments[d]))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(o):new Array(o);function m(D,_){return 1-3*_+3*D}function y(D,_){return 3*_-6*D}function b(D){return 3*D}function x(D,_,P){return((m(_,P)*D+y(_,P))*D+b(_))*D}function w(D,_,P){return 3*m(_,P)*D*D+2*y(_,P)*D+b(_)}function S(D,_){for(var P=0;P<i;++P){var z=w(_,t,r);if(z===0)return _;var H=x(_,t,r)-D;_-=H/z}return _}function k(){for(var D=0;D<o;++D)g[D]=x(D*c,t,r)}function E(D,_,P){var z,H,$=0;do H=_+(P-_)/2,z=x(H,t,r)-D,z>0?P=H:_=H;while(Math.abs(z)>s&&++$<l);return H}function M(D){for(var _=0,P=1,z=o-1;P!==z&&g[P]<=D;++P)_+=c;--P;var H=(D-g[P])/(g[P+1]-g[P]),$=_+H*c,q=w($,t,r);return q>=a?S(D,$):q===0?$:E(D,_,_+c)}var R=!1;function O(){R=!0,(t!==e||r!==n)&&k()}var N=function(_){return R||O(),t===e&&r===n?_:_===0?0:_===1?1:x(M(_),e,n)};N.getControlPoints=function(){return[{x:t,y:e},{x:r,y:n}]};var B="generateBezier("+[t,e,r,n]+")";return N.toString=function(){return B},N}var MQ=(function(){function t(n){return-n.tension*n.x-n.friction*n.v}function e(n,i,a){var s={x:n.x+a.dx*i,v:n.v+a.dv*i,tension:n.tension,friction:n.friction};return{dx:s.v,dv:t(s)}}function r(n,i){var a={dx:n.v,dv:t(n)},s=e(n,i*.5,a),l=e(n,i*.5,s),o=e(n,i,l),c=1/6*(a.dx+2*(s.dx+l.dx)+o.dx),h=1/6*(a.dv+2*(s.dv+l.dv)+o.dv);return n.x=n.x+c*i,n.v=n.v+h*i,n}return function n(i,a,s){var l={x:-1,v:0,tension:null,friction:null},o=[0],c=0,h=1/1e4,d=16/1e3,g,m,y;for(i=parseFloat(i)||500,a=parseFloat(a)||20,s=s||null,l.tension=i,l.friction=a,g=s!==null,g?(c=n(i,a),m=c/s*d):m=d;y=r(y||l,m),o.push(1+y.x),c+=16,Math.abs(y.x)>h&&Math.abs(y.v)>h;);return g?function(b){return o[b*(o.length-1)|0]}:c}})(),er=function(e,r,n,i){var a=OQ(e,r,n,i);return function(s,l,o){return s+(l-s)*a(o)}},Fp={linear:function(e,r,n){return e+(r-e)*n},ease:er(.25,.1,.25,1),"ease-in":er(.42,0,1,1),"ease-out":er(0,0,.58,1),"ease-in-out":er(.42,0,.58,1),"ease-in-sine":er(.47,0,.745,.715),"ease-out-sine":er(.39,.575,.565,1),"ease-in-out-sine":er(.445,.05,.55,.95),"ease-in-quad":er(.55,.085,.68,.53),"ease-out-quad":er(.25,.46,.45,.94),"ease-in-out-quad":er(.455,.03,.515,.955),"ease-in-cubic":er(.55,.055,.675,.19),"ease-out-cubic":er(.215,.61,.355,1),"ease-in-out-cubic":er(.645,.045,.355,1),"ease-in-quart":er(.895,.03,.685,.22),"ease-out-quart":er(.165,.84,.44,1),"ease-in-out-quart":er(.77,0,.175,1),"ease-in-quint":er(.755,.05,.855,.06),"ease-out-quint":er(.23,1,.32,1),"ease-in-out-quint":er(.86,0,.07,1),"ease-in-expo":er(.95,.05,.795,.035),"ease-out-expo":er(.19,1,.22,1),"ease-in-out-expo":er(1,0,0,1),"ease-in-circ":er(.6,.04,.98,.335),"ease-out-circ":er(.075,.82,.165,1),"ease-in-out-circ":er(.785,.135,.15,.86),spring:function(e,r,n){if(n===0)return Fp.linear;var i=MQ(e,r,n);return function(a,s,l){return a+(s-a)*i(l)}},"cubic-bezier":er};function xN(t,e,r,n,i){if(n===1||e===r)return r;var a=i(e,r,n);return t==null||((t.roundValue||t.color)&&(a=Math.round(a)),t.min!==void 0&&(a=Math.max(a,t.min)),t.max!==void 0&&(a=Math.min(a,t.max))),a}function wN(t,e){return t.pfValue!=null||t.value!=null?t.pfValue!=null&&(e==null||e.type.units!=="%")?t.pfValue:t.value:t}function eu(t,e,r,n,i){var a=i!=null?i.type:null;r<0?r=0:r>1&&(r=1);var s=wN(t,i),l=wN(e,i);if(qe(s)&&qe(l))return xN(a,s,l,r,n);if(Zt(s)&&Zt(l)){for(var o=[],c=0;c<l.length;c++){var h=s[c],d=l[c];if(h!=null&&d!=null){var g=xN(a,h,d,r,n);o.push(g)}else o.push(d)}return o}}function RQ(t,e,r,n){var i=!n,a=t._private,s=e._private,l=s.easing,o=s.startTime,c=n?t:t.cy(),h=c.style();if(!s.easingImpl)if(l==null)s.easingImpl=Fp.linear;else{var d;if(lt(l)){var g=h.parse("transition-timing-function",l);d=g.value}else d=l;var m,y;lt(d)?(m=d,y=[]):(m=d[1],y=d.slice(2).map(function(ee){return+ee})),y.length>0?(m==="spring"&&y.push(s.duration),s.easingImpl=Fp[m].apply(null,y)):s.easingImpl=Fp[m]}var b=s.easingImpl,x;if(s.duration===0?x=1:x=(r-o)/s.duration,s.applying&&(x=s.progress),x<0?x=0:x>1&&(x=1),s.delay==null){var w=s.startPosition,S=s.position;if(S&&i&&!t.locked()){var k={};Jc(w.x,S.x)&&(k.x=eu(w.x,S.x,x,b)),Jc(w.y,S.y)&&(k.y=eu(w.y,S.y,x,b)),t.position(k)}var E=s.startPan,M=s.pan,R=a.pan,O=M!=null&&n;O&&(Jc(E.x,M.x)&&(R.x=eu(E.x,M.x,x,b)),Jc(E.y,M.y)&&(R.y=eu(E.y,M.y,x,b)),t.emit("pan"));var N=s.startZoom,B=s.zoom,D=B!=null&&n;D&&(Jc(N,B)&&(a.zoom=qf(a.minZoom,eu(N,B,x,b),a.maxZoom)),t.emit("zoom")),(O||D)&&t.emit("viewport");var _=s.style;if(_&&_.length>0&&i){for(var P=0;P<_.length;P++){var z=_[P],H=z.name,$=z,q=s.startStyle[H],V=h.properties[q.name],X=eu(q,$,x,b,V);h.overrideBypass(t,H,X)}t.emit("style")}}return s.progress=x,x}function Jc(t,e){return t==null||e==null?!1:qe(t)&&qe(e)?!0:!!(t&&e)}function DQ(t,e,r,n){var i=e._private;i.started=!0,i.startTime=r-i.progress*i.duration}function SN(t,e){var r=e._private.aniEles,n=[];function i(h,d){var g=h._private,m=g.animation.current,y=g.animation.queue,b=!1;if(m.length===0){var x=y.shift();x&&m.push(x)}for(var w=function(R){for(var O=R.length-1;O>=0;O--){var N=R[O];N()}R.splice(0,R.length)},S=m.length-1;S>=0;S--){var k=m[S],E=k._private;if(E.stopped){m.splice(S,1),E.hooked=!1,E.playing=!1,E.started=!1,w(E.frames);continue}!E.playing&&!E.applying||(E.playing&&E.applying&&(E.applying=!1),E.started||DQ(h,k,t),RQ(h,k,t,d),E.applying&&(E.applying=!1),w(E.frames),E.step!=null&&E.step(t),k.completed()&&(m.splice(S,1),E.hooked=!1,E.playing=!1,E.started=!1,w(E.completes)),b=!0)}return!d&&m.length===0&&y.length===0&&n.push(h),b}for(var a=!1,s=0;s<r.length;s++){var l=r[s],o=i(l);a=a||o}var c=i(e,!0);(a||c)&&(r.length>0?e.notify("draw",r):e.notify("draw")),r.unmerge(n),e.emit("step")}var _Q={animate:qt.animate(),animation:qt.animation(),animated:qt.animated(),clearQueue:qt.clearQueue(),delay:qt.delay(),delayAnimation:qt.delayAnimation(),stop:qt.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&&dg(function(a){SN(a,e),r()})}var n=e.renderer();n&&n.beforeRender?n.beforeRender(function(a,s){SN(s,e)},n.beforeRenderPriorities.animations):r()}},NQ={qualifierCompare:function(e,r){return e==null||r==null?e==null&&r==null:e.sameText(r)},eventMatches:function(e,r,n){var i=r.qualifier;return i!=null?e!==n.target&&hh(n.target)&&i.matches(n.target):!0},addEventFields:function(e,r){r.cy=e,r.target=e},callbackContext:function(e,r,n){return r.qualifier!=null?n.target:e}},lp=function(e){return lt(e)?new Qs(e):e},wj={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new pv(NQ,this)),this},emitter:function(){return this._private.emitter},on:function(e,r,n){return this.emitter().on(e,lp(r),n),this},removeListener:function(e,r,n){return this.emitter().removeListener(e,lp(r),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,r,n){return this.emitter().one(e,lp(r),n),this},once:function(e,r,n){return this.emitter().one(e,lp(r),n),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}};qt.eventAliasesOn(wj);var fk={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)}};fk.jpeg=fk.jpg;var Hp={layout:function(e){var r=this;if(e==null){ur("Layout options must be specified to make a layout");return}if(e.name==null){ur("A `name` must be specified to make a layout");return}var n=e.name,i=r.extension("layout",n);if(i==null){ur("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var a;lt(e.eles)?a=r.$(e.eles):a=e.eles!=null?e.eles:r.$();var s=new i(ft({},e,{cy:r,eles:a}));return s}};Hp.createLayout=Hp.makeLayout=Hp.layout;var BQ={notify:function(e,r){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var i=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();r!=null&&i.merge(r);return}if(n.notificationsEnabled){var a=this.renderer();this.destroyed()||!a||a.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(n){var i=e.batchNotifications[n];i.empty()?r.notify(n):r.notify(n,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 n=Object.keys(e),i=0;i<n.length;i++){var a=n[i],s=e[a],l=r.getElementById(a);l.data(s)}})}},LQ=cn({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]}),hk={renderTo:function(e,r,n,i){var a=this._private.renderer;return a.renderTo(e,r,n,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,n=r.extension("renderer",e.name);if(n==null){ur("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&&jt("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=LQ(e);i.cy=r,r._private.renderer=new n(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(n){var i=n._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)}};hk.invalidateDimensions=hk.resize;var Vp={collection:function(e,r){return lt(e)?this.$(e):fi(e)?e.collection():Zt(e)?(r||(r={}),new on(this,e,r.unique,r.removed)):new on(this)},nodes:function(e){var r=this.$(function(n){return n.isNode()});return e?r.filter(e):r},edges:function(e){var r=this.$(function(n){return n.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}};Vp.elements=Vp.filter=Vp.$;var Kr={},xf="t",PQ="f";Kr.apply=function(t){for(var e=this,r=e._private,n=r.cy,i=n.collection(),a=0;a<t.length;a++){var s=t[a],l=e.getContextMeta(s);if(!l.empty){var o=e.getContextStyle(l),c=e.applyContextStyle(l,o,s);s._private.appliedInitStyle?e.updateTransitions(s,c.diffProps):s._private.appliedInitStyle=!0;var h=e.updateStyleHints(s);h&&i.push(s)}}return i};Kr.getPropertiesDiff=function(t,e){var r=this,n=r._private.propDiffs=r._private.propDiffs||{},i=t+"-"+e,a=n[i];if(a)return a;for(var s=[],l={},o=0;o<r.length;o++){var c=r[o],h=t[o]===xf,d=e[o]===xf,g=h!==d,m=c.mappedProperties.length>0;if(g||d&&m){var y=void 0;g&&m||g?y=c.properties:m&&(y=c.mappedProperties);for(var b=0;b<y.length;b++){for(var x=y[b],w=x.name,S=!1,k=o+1;k<r.length;k++){var E=r[k],M=e[k]===xf;if(M&&(S=E.properties[x.name]!=null,S))break}!l[w]&&!S&&(l[w]=!0,s.push(w))}}}return n[i]=s,s};Kr.getContextMeta=function(t){for(var e=this,r="",n,i=t._private.styleCxtKey||"",a=0;a<e.length;a++){var s=e[a],l=s.selector&&s.selector.matches(t);l?r+=xf:r+=PQ}return n=e.getPropertiesDiff(i,r),t._private.styleCxtKey=r,{key:r,diffPropNames:n,empty:n.length===0}};Kr.getContextStyle=function(t){var e=t.key,r=this,n=this._private.contextStyles=this._private.contextStyles||{};if(n[e])return n[e];for(var i={_private:{key:e}},a=0;a<r.length;a++){var s=r[a],l=e[a]===xf;if(l)for(var o=0;o<s.properties.length;o++){var c=s.properties[o];i[c.name]=c}}return n[e]=i,i};Kr.applyContextStyle=function(t,e,r){for(var n=this,i=t.diffPropNames,a={},s=n.types,l=0;l<i.length;l++){var o=i[l],c=e[o],h=r.pstyle(o);if(!c)if(h)h.bypass?c={name:o,deleteBypassed:!0}:c={name:o,delete:!0};else continue;if(h!==c){if(c.mapped===s.fn&&h!=null&&h.mapping!=null&&h.mapping.value===c.value){var d=h.mapping,g=d.fnValue=c.value(r);if(g===d.prevFnValue)continue}var m=a[o]={prev:h};n.applyParsedProperty(r,c),m.next=r.pstyle(o),m.next&&m.next.bypass&&(m.next=m.next.bypassed)}}return{diffProps:a}};Kr.updateStyleHints=function(t){var e=t._private,r=this,n=r.propertyGroupNames,i=r.propertyGroupKeys,a=function(Q,K,ue){return r.getPropertiesHash(Q,K,ue)},s=e.styleKey;if(t.removed())return!1;var l=e.group==="nodes",o=t._private.style;n=Object.keys(o);for(var c=0;c<i.length;c++){var h=i[c];e.styleKeys[h]=[Pl,lu]}for(var d=function(Q,K){return e.styleKeys[K][0]=Pf(Q,e.styleKeys[K][0])},g=function(Q,K){return e.styleKeys[K][1]=zf(Q,e.styleKeys[K][1])},m=function(Q,K){d(Q,K),g(Q,K)},y=function(Q,K){for(var ue=0;ue<Q.length;ue++){var Se=Q.charCodeAt(ue);d(Se,K),g(Se,K)}},b=2e9,x=function(Q){return-128<Q&&Q<128&&Math.floor(Q)!==Q?b-(Q*1024|0):Q},w=0;w<n.length;w++){var S=n[w],k=o[S];if(k!=null){var E=this.properties[S],M=E.type,R=E.groupKey,O=void 0;E.hashOverride!=null?O=E.hashOverride(t,k):k.pfValue!=null&&(O=k.pfValue);var N=E.enums==null?k.value:null,B=O!=null,D=N!=null,_=B||D,P=k.units;if(M.number&&_&&!M.multiple){var z=B?O:N;m(x(z),R),!B&&P!=null&&y(P,R)}else y(k.strValue,R)}}for(var H=[Pl,lu],$=0;$<i.length;$++){var q=i[$],V=e.styleKeys[q];H[0]=Pf(V[0],H[0]),H[1]=zf(V[1],H[1])}e.styleKey=ZG(H[0],H[1]);var X=e.styleKeys;e.labelDimsKey=Ds(X.labelDimensions);var ee=a(t,["label"],X.labelDimensions);if(e.labelKey=Ds(ee),e.labelStyleKey=Ds(Jd(X.commonLabel,ee)),!l){var te=a(t,["source-label"],X.labelDimensions);e.sourceLabelKey=Ds(te),e.sourceLabelStyleKey=Ds(Jd(X.commonLabel,te));var I=a(t,["target-label"],X.labelDimensions);e.targetLabelKey=Ds(I),e.targetLabelStyleKey=Ds(Jd(X.commonLabel,I))}if(l){var G=e.styleKeys,re=G.nodeBody,Y=G.nodeBorder,W=G.nodeOutline,Z=G.backgroundImage,ie=G.compound,we=G.pie,de=G.stripe,se=[re,Y,W,Z,ie,we,de].filter(function(j){return j!=null}).reduce(Jd,[Pl,lu]);e.nodeKey=Ds(se),e.hasPie=we!=null&&we[0]!==Pl&&we[1]!==lu,e.hasStripe=de!=null&&de[0]!==Pl&&de[1]!==lu}return s!==e.styleKey};Kr.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};Kr.applyParsedProperty=function(t,e){var r=this,n=e,i=t._private.style,a,s=r.types,l=r.properties[n.name].type,o=n.bypass,c=i[n.name],h=c&&c.bypass,d=t._private,g="mapping",m=function(re){return re==null?null:re.pfValue!=null?re.pfValue:re.value},y=function(){var re=m(c),Y=m(n);r.checkTriggers(t,n.name,re,Y)};if(e.name==="curve-style"&&t.isEdge()&&(e.value!=="bezier"&&t.isLoop()||e.value==="haystack"&&(t.source().isParent()||t.target().isParent()))&&(n=e=this.parse(e.name,"bezier",o)),n.delete)return i[n.name]=void 0,y(),!0;if(n.deleteBypassed)return c?c.bypass?(c.bypassed=void 0,y(),!0):!1:(y(),!0);if(n.deleteBypass)return c?c.bypass?(i[n.name]=c.bypassed,y(),!0):!1:(y(),!0);var b=function(){jt("Do not assign mappings to elements without corresponding data (i.e. ele `"+t.id()+"` has no mapping for property `"+n.name+"` with data field `"+n.field+"`); try a `["+n.field+"]` selector to limit scope to elements with `"+n.field+"` defined")};switch(n.mapped){case s.mapData:{for(var x=n.field.split("."),w=d.data,S=0;S<x.length&&w;S++){var k=x[S];w=w[k]}if(w==null)return b(),!1;var E;if(qe(w)){var M=n.fieldMax-n.fieldMin;M===0?E=0:E=(w-n.fieldMin)/M}else return jt("Do not use continuous mappers without specifying numeric data (i.e. `"+n.field+": "+w+"` for `"+t.id()+"` is non-numeric)"),!1;if(E<0?E=0:E>1&&(E=1),l.color){var R=n.valueMin[0],O=n.valueMax[0],N=n.valueMin[1],B=n.valueMax[1],D=n.valueMin[2],_=n.valueMax[2],P=n.valueMin[3]==null?1:n.valueMin[3],z=n.valueMax[3]==null?1:n.valueMax[3],H=[Math.round(R+(O-R)*E),Math.round(N+(B-N)*E),Math.round(D+(_-D)*E),Math.round(P+(z-P)*E)];a={bypass:n.bypass,name:n.name,value:H,strValue:"rgb("+H[0]+", "+H[1]+", "+H[2]+")"}}else if(l.number){var $=n.valueMin+(n.valueMax-n.valueMin)*E;a=this.parse(n.name,$,n.bypass,g)}else return!1;if(!a)return b(),!1;a.mapping=n,n=a;break}case s.data:{for(var q=n.field.split("."),V=d.data,X=0;X<q.length&&V;X++){var ee=q[X];V=V[ee]}if(V!=null&&(a=this.parse(n.name,V,n.bypass,g)),!a)return b(),!1;a.mapping=n,n=a;break}case s.fn:{var te=n.value,I=n.fnValue!=null?n.fnValue:te(t);if(n.prevFnValue=I,I==null)return jt("Custom function mappers may not return null (i.e. `"+n.name+"` for ele `"+t.id()+"` is null)"),!1;if(a=this.parse(n.name,I,n.bypass,g),!a)return jt("Custom function mappers may not return invalid values for the property type (i.e. `"+n.name+"` for ele `"+t.id()+"` is invalid)"),!1;a.mapping=la(n),n=a;break}case void 0:break;default:return!1}return o?(h?n.bypassed=c.bypassed:n.bypassed=c,i[n.name]=n):h?c.bypassed=n:i[n.name]=n,y(),!0};Kr.cleanElements=function(t,e){for(var r=0;r<t.length;r++){var n=t[r];if(this.clearStyleHints(n),n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),!e)n._private.style={};else for(var i=n._private.style,a=Object.keys(i),s=0;s<a.length;s++){var l=a[s],o=i[l];o!=null&&(o.bypass?o.bypassed=null:i[l]=null)}}};Kr.update=function(){var t=this._private.cy,e=t.mutableElements();e.updateStyle()};Kr.updateTransitions=function(t,e){var r=this,n=t._private,i=t.pstyle("transition-property").value,a=t.pstyle("transition-duration").pfValue,s=t.pstyle("transition-delay").pfValue;if(i.length>0&&a>0){for(var l={},o=!1,c=0;c<i.length;c++){var h=i[c],d=t.pstyle(h),g=e[h];if(g){var m=g.prev,y=m,b=g.next!=null?g.next:d,x=!1,w=void 0,S=1e-6;y&&(qe(y.pfValue)&&qe(b.pfValue)?(x=b.pfValue-y.pfValue,w=y.pfValue+S*x):qe(y.value)&&qe(b.value)?(x=b.value-y.value,w=y.value+S*x):Zt(y.value)&&Zt(b.value)&&(x=y.value[0]!==b.value[0]||y.value[1]!==b.value[1]||y.value[2]!==b.value[2],w=y.strValue),x&&(l[h]=b.strValue,this.applyBypass(t,h,w),o=!0))}}if(!o)return;n.transitioning=!0,new Gu(function(k){s>0?t.delayAnimation(s).play().promise().then(k):k()}).then(function(){return t.animation({style:l,duration:a,easing:t.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){r.removeBypasses(t,i),t.emitAndNotify("style"),n.transitioning=!1})}else n.transitioning&&(this.removeBypasses(t,i),t.emitAndNotify("style"),n.transitioning=!1)};Kr.checkTrigger=function(t,e,r,n,i,a){var s=this.properties[e],l=i(s);t.removed()||l!=null&&l(r,n,t)&&a(s)};Kr.checkZOrderTrigger=function(t,e,r,n){var i=this;this.checkTrigger(t,e,r,n,function(a){return a.triggersZOrder},function(){i._private.cy.notify("zorder",t)})};Kr.checkBoundsTrigger=function(t,e,r,n){this.checkTrigger(t,e,r,n,function(i){return i.triggersBounds},function(i){t.dirtyCompoundBoundsCache(),t.dirtyBoundingBoxCache()})};Kr.checkConnectedEdgesBoundsTrigger=function(t,e,r,n){this.checkTrigger(t,e,r,n,function(i){return i.triggersBoundsOfConnectedEdges},function(i){t.connectedEdges().forEach(function(a){a.dirtyBoundingBoxCache()})})};Kr.checkParallelEdgesBoundsTrigger=function(t,e,r,n){this.checkTrigger(t,e,r,n,function(i){return i.triggersBoundsOfParallelEdges},function(i){t.parallelEdges().forEach(function(a){a.dirtyBoundingBoxCache()})})};Kr.checkTriggers=function(t,e,r,n){t.dirtyStyleCache(),this.checkZOrderTrigger(t,e,r,n),this.checkBoundsTrigger(t,e,r,n),this.checkConnectedEdgesBoundsTrigger(t,e,r,n),this.checkParallelEdgesBoundsTrigger(t,e,r,n)};var bh={};bh.applyBypass=function(t,e,r,n){var i=this,a=[],s=!0;if(e==="*"||e==="**"){if(r!==void 0)for(var l=0;l<i.properties.length;l++){var o=i.properties[l],c=o.name,h=this.parse(c,r,!0);h&&a.push(h)}}else if(lt(e)){var d=this.parse(e,r,!0);d&&a.push(d)}else if(Bt(e)){var g=e;n=r;for(var m=Object.keys(g),y=0;y<m.length;y++){var b=m[y],x=g[b];if(x===void 0&&(x=g[iv(b)]),x!==void 0){var w=this.parse(b,x,!0);w&&a.push(w)}}}else return!1;if(a.length===0)return!1;for(var S=!1,k=0;k<t.length;k++){for(var E=t[k],M={},R=void 0,O=0;O<a.length;O++){var N=a[O];if(n){var B=E.pstyle(N.name);R=M[N.name]={prev:B}}S=this.applyParsedProperty(E,la(N))||S,n&&(R.next=E.pstyle(N.name))}S&&this.updateStyleHints(E),n&&this.updateTransitions(E,M,s)}return S};bh.overrideBypass=function(t,e,r){e=NT(e);for(var n=0;n<t.length;n++){var i=t[n],a=i._private.style[e],s=this.properties[e].type,l=s.color,o=s.mutiple,c=a?a.pfValue!=null?a.pfValue:a.value:null;!a||!a.bypass?this.applyBypass(i,e,r):(a.value=r,a.pfValue!=null&&(a.pfValue=r),l?a.strValue="rgb("+r.join(",")+")":o?a.strValue=r.join(" "):a.strValue=""+r,this.updateStyleHints(i)),this.checkTriggers(i,e,c,r)}};bh.removeAllBypasses=function(t,e){return this.removeBypasses(t,this.propertyNames,e)};bh.removeBypasses=function(t,e,r){for(var n=!0,i=0;i<t.length;i++){for(var a=t[i],s={},l=0;l<e.length;l++){var o=e[l],c=this.properties[o],h=a.pstyle(c.name);if(!(!h||!h.bypass)){var d="",g=this.parse(o,d,!0),m=s[c.name]={prev:h};this.applyParsedProperty(a,g),m.next=a.pstyle(c.name)}}this.updateStyleHints(a),r&&this.updateTransitions(a,s,n)}};var XT={};XT.getEmSizeInPixels=function(){var t=this.containerCss("font-size");return t!=null?parseFloat(t):1};XT.containerCss=function(t){var e=this._private.cy,r=e.container(),n=e.window();if(n&&r&&n.getComputedStyle)return n.getComputedStyle(r).getPropertyValue(t)};var da={};da.getRenderedStyle=function(t,e){return e?this.getStylePropertyValue(t,e,!0):this.getRawStyle(t,!0)};da.getRawStyle=function(t,e){var r=this;if(t=t[0],t){for(var n={},i=0;i<r.properties.length;i++){var a=r.properties[i],s=r.getStylePropertyValue(t,a.name,e);s!=null&&(n[a.name]=s,n[iv(a.name)]=s)}return n}};da.getIndexedStyle=function(t,e,r,n){var i=t.pstyle(e)[r][n];return i??t.cy().style().getDefaultProperty(e)[r][0]};da.getStylePropertyValue=function(t,e,r){var n=this;if(t=t[0],t){var i=n.properties[e];i.alias&&(i=i.pointsTo);var a=i.type,s=t.pstyle(i.name);if(s){var l=s.value,o=s.units,c=s.strValue;if(r&&a.number&&l!=null&&qe(l)){var h=t.cy().zoom(),d=function(x){return x*h},g=function(x,w){return d(x)+w},m=Zt(l),y=m?o.every(function(b){return b!=null}):o!=null;return y?m?l.map(function(b,x){return g(b,o[x])}).join(" "):g(l,o):m?l.map(function(b){return lt(b)?b:""+d(b)}).join(" "):""+d(l)}else if(c!=null)return c}return null}};da.getAnimationStartStyle=function(t,e){for(var r={},n=0;n<e.length;n++){var i=e[n],a=i.name,s=t.pstyle(a);s!==void 0&&(Bt(s)?s=this.parse(a,s.strValue):s=this.parse(a,s)),s&&(r[a]=s)}return r};da.getPropsList=function(t){var e=this,r=[],n=t,i=e.properties;if(n)for(var a=Object.keys(n),s=0;s<a.length;s++){var l=a[s],o=n[l],c=i[l]||i[NT(l)],h=this.parse(c.name,o);h&&r.push(h)}return r};da.getNonDefaultPropertiesHash=function(t,e,r){var n=r.slice(),i,a,s,l,o,c;for(o=0;o<e.length;o++)if(i=e[o],a=t.pstyle(i,!1),a!=null)if(a.pfValue!=null)n[0]=Pf(l,n[0]),n[1]=zf(l,n[1]);else for(s=a.strValue,c=0;c<s.length;c++)l=s.charCodeAt(c),n[0]=Pf(l,n[0]),n[1]=zf(l,n[1]);return n};da.getPropertiesHash=da.getNonDefaultPropertiesHash;var mv={};mv.appendFromJson=function(t){for(var e=this,r=0;r<t.length;r++){var n=t[r],i=n.selector,a=n.style||n.css,s=Object.keys(a);e.selector(i);for(var l=0;l<s.length;l++){var o=s[l],c=a[o];e.css(o,c)}}return e};mv.fromJson=function(t){var e=this;return e.resetToDefault(),e.appendFromJson(t),e};mv.json=function(){for(var t=[],e=this.defaultLength;e<this.length;e++){for(var r=this[e],n=r.selector,i=r.properties,a={},s=0;s<i.length;s++){var l=i[s];a[l.name]=l.strValue}t.push({selector:n?n.toString():"core",style:a})}return t};var WT={};WT.appendFromString=function(t){var e=this,r=this,n=""+t,i,a,s;n=n.replace(/[/][*](\s|.)+?[*][/]/g,"");function l(){n.length>i.length?n=n.substr(i.length):n=""}function o(){a.length>s.length?a=a.substr(s.length):a=""}for(;;){var c=n.match(/^\s*$/);if(c)break;var h=n.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!h){jt("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+n);break}i=h[0];var d=h[1];if(d!=="core"){var g=new Qs(d);if(g.invalid){jt("Skipping parsing of block: Invalid selector found in string stylesheet: "+d),l();continue}}var m=h[2],y=!1;a=m;for(var b=[];;){var x=a.match(/^\s*$/);if(x)break;var w=a.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!w){jt("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+m),y=!0;break}s=w[0];var S=w[1],k=w[2],E=e.properties[S];if(!E){jt("Skipping property: Invalid property name in: "+s),o();continue}var M=r.parse(S,k);if(!M){jt("Skipping property: Invalid property definition in: "+s),o();continue}b.push({name:S,val:k}),o()}if(y){l();break}r.selector(d);for(var R=0;R<b.length;R++){var O=b[R];r.css(O.name,O.val)}l()}return r};WT.fromString=function(t){var e=this;return e.resetToDefault(),e.appendFromString(t),e};var Mr={};(function(){var t=Ir,e=RG,r=_G,n=NG,i=BG,a=function(j){return"^"+j+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},s=function(j){var Q=t+"|\\w+|"+e+"|"+r+"|"+n+"|"+i;return"^"+j+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+t+")\\s*\\,\\s*("+t+")\\s*,\\s*("+Q+")\\s*\\,\\s*("+Q+")\\)$"},l=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];Mr.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:a("data")},layoutData:{mapping:!0,regex:a("layoutData")},scratch:{mapping:!0,regex:a("scratch")},mapData:{mapping:!0,regex:s("mapData")},mapLayoutData:{mapping:!0,regex:s("mapLayoutData")},mapScratch:{mapping:!0,regex:s("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:l,singleRegexMatchValue:!0},urls:{regexes:l,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(j,Q){switch(j.length){case 2:return Q[0]!=="deg"&&Q[0]!=="rad"&&Q[1]!=="deg"&&Q[1]!=="rad";case 1:return lt(j[0])||Q[0]==="deg"||Q[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(j){var Q=j.length;return Q===1||Q===2||Q===4}}};var o={zeroNonZero:function(j,Q){return(j==null||Q==null)&&j!==Q||j==0&&Q!=0?!0:j!=0&&Q==0},any:function(j,Q){return j!=Q},emptyNonEmpty:function(j,Q){var K=Ys(j),ue=Ys(Q);return K&&!ue||!K&&ue}},c=Mr.types,h=[{name:"label",type:c.text,triggersBounds:o.any,triggersZOrder:o.emptyNonEmpty},{name:"text-rotation",type:c.textRotation,triggersBounds:o.any},{name:"text-margin-x",type:c.bidirectionalSize,triggersBounds:o.any},{name:"text-margin-y",type:c.bidirectionalSize,triggersBounds:o.any}],d=[{name:"source-label",type:c.text,triggersBounds:o.any},{name:"source-text-rotation",type:c.textRotation,triggersBounds:o.any},{name:"source-text-margin-x",type:c.bidirectionalSize,triggersBounds:o.any},{name:"source-text-margin-y",type:c.bidirectionalSize,triggersBounds:o.any},{name:"source-text-offset",type:c.size,triggersBounds:o.any}],g=[{name:"target-label",type:c.text,triggersBounds:o.any},{name:"target-text-rotation",type:c.textRotation,triggersBounds:o.any},{name:"target-text-margin-x",type:c.bidirectionalSize,triggersBounds:o.any},{name:"target-text-margin-y",type:c.bidirectionalSize,triggersBounds:o.any},{name:"target-text-offset",type:c.size,triggersBounds:o.any}],m=[{name:"font-family",type:c.fontFamily,triggersBounds:o.any},{name:"font-style",type:c.fontStyle,triggersBounds:o.any},{name:"font-weight",type:c.fontWeight,triggersBounds:o.any},{name:"font-size",type:c.size,triggersBounds:o.any},{name:"text-transform",type:c.textTransform,triggersBounds:o.any},{name:"text-wrap",type:c.textWrap,triggersBounds:o.any},{name:"text-overflow-wrap",type:c.textOverflowWrap,triggersBounds:o.any},{name:"text-max-width",type:c.size,triggersBounds:o.any},{name:"text-outline-width",type:c.size,triggersBounds:o.any},{name:"line-height",type:c.positiveNumber,triggersBounds:o.any}],y=[{name:"text-valign",type:c.valign,triggersBounds:o.any},{name:"text-halign",type:c.halign,triggersBounds:o.any},{name:"color",type:c.color},{name:"text-outline-color",type:c.color},{name:"text-outline-opacity",type:c.zeroOneNumber},{name:"text-background-color",type:c.color},{name:"text-background-opacity",type:c.zeroOneNumber},{name:"text-background-padding",type:c.size,triggersBounds:o.any},{name:"text-border-opacity",type:c.zeroOneNumber},{name:"text-border-color",type:c.color},{name:"text-border-width",type:c.size,triggersBounds:o.any},{name:"text-border-style",type:c.borderStyle,triggersBounds:o.any},{name:"text-background-shape",type:c.textBackgroundShape,triggersBounds:o.any},{name:"text-justification",type:c.justification},{name:"box-select-labels",type:c.bool,triggersBounds:o.any}],b=[{name:"events",type:c.bool,triggersZOrder:o.any},{name:"text-events",type:c.bool,triggersZOrder:o.any},{name:"box-selection",type:c.boxSelection,triggersZOrder:o.any}],x=[{name:"display",type:c.display,triggersZOrder:o.any,triggersBounds:o.any,triggersBoundsOfConnectedEdges:o.any,triggersBoundsOfParallelEdges:function(j,Q,K){return j===Q?!1:K.pstyle("curve-style").value==="bezier"}},{name:"visibility",type:c.visibility,triggersZOrder:o.any},{name:"opacity",type:c.zeroOneNumber,triggersZOrder:o.zeroNonZero},{name:"text-opacity",type:c.zeroOneNumber},{name:"min-zoomed-font-size",type:c.size},{name:"z-compound-depth",type:c.zCompoundDepth,triggersZOrder:o.any},{name:"z-index-compare",type:c.zIndexCompare,triggersZOrder:o.any},{name:"z-index",type:c.number,triggersZOrder:o.any}],w=[{name:"overlay-padding",type:c.size,triggersBounds:o.any},{name:"overlay-color",type:c.color},{name:"overlay-opacity",type:c.zeroOneNumber,triggersBounds:o.zeroNonZero},{name:"overlay-shape",type:c.overlayShape,triggersBounds:o.any},{name:"overlay-corner-radius",type:c.cornerRadius}],S=[{name:"underlay-padding",type:c.size,triggersBounds:o.any},{name:"underlay-color",type:c.color},{name:"underlay-opacity",type:c.zeroOneNumber,triggersBounds:o.zeroNonZero},{name:"underlay-shape",type:c.overlayShape,triggersBounds:o.any},{name:"underlay-corner-radius",type:c.cornerRadius}],k=[{name:"transition-property",type:c.propList},{name:"transition-duration",type:c.time},{name:"transition-delay",type:c.time},{name:"transition-timing-function",type:c.easing}],E=function(j,Q){return Q.value==="label"?-j.poolIndex():Q.pfValue},M=[{name:"height",type:c.nodeSize,triggersBounds:o.any,hashOverride:E},{name:"width",type:c.nodeSize,triggersBounds:o.any,hashOverride:E},{name:"shape",type:c.nodeShape,triggersBounds:o.any},{name:"shape-polygon-points",type:c.polygonPointList,triggersBounds:o.any},{name:"corner-radius",type:c.cornerRadius},{name:"background-color",type:c.color},{name:"background-fill",type:c.fill},{name:"background-opacity",type:c.zeroOneNumber},{name:"background-blacken",type:c.nOneOneNumber},{name:"background-gradient-stop-colors",type:c.colors},{name:"background-gradient-stop-positions",type:c.percentages},{name:"background-gradient-direction",type:c.gradientDirection},{name:"padding",type:c.sizeMaybePercent,triggersBounds:o.any},{name:"padding-relative-to",type:c.paddingRelativeTo,triggersBounds:o.any},{name:"bounds-expansion",type:c.boundsExpansion,triggersBounds:o.any}],R=[{name:"border-color",type:c.color},{name:"border-opacity",type:c.zeroOneNumber},{name:"border-width",type:c.size,triggersBounds:o.any},{name:"border-style",type:c.borderStyle},{name:"border-cap",type:c.lineCap},{name:"border-join",type:c.lineJoin},{name:"border-dash-pattern",type:c.numbers},{name:"border-dash-offset",type:c.number},{name:"border-position",type:c.linePosition}],O=[{name:"outline-color",type:c.color},{name:"outline-opacity",type:c.zeroOneNumber},{name:"outline-width",type:c.size,triggersBounds:o.any},{name:"outline-style",type:c.borderStyle},{name:"outline-offset",type:c.size,triggersBounds:o.any}],N=[{name:"background-image",type:c.urls},{name:"background-image-crossorigin",type:c.bgCrossOrigin},{name:"background-image-opacity",type:c.zeroOneNumbers},{name:"background-image-containment",type:c.bgContainment},{name:"background-image-smoothing",type:c.bools},{name:"background-position-x",type:c.bgPos},{name:"background-position-y",type:c.bgPos},{name:"background-width-relative-to",type:c.bgRelativeTo},{name:"background-height-relative-to",type:c.bgRelativeTo},{name:"background-repeat",type:c.bgRepeat},{name:"background-fit",type:c.bgFit},{name:"background-clip",type:c.bgClip},{name:"background-width",type:c.bgWH},{name:"background-height",type:c.bgWH},{name:"background-offset-x",type:c.bgPos},{name:"background-offset-y",type:c.bgPos}],B=[{name:"position",type:c.position,triggersBounds:o.any},{name:"compound-sizing-wrt-labels",type:c.compoundIncludeLabels,triggersBounds:o.any},{name:"min-width",type:c.size,triggersBounds:o.any},{name:"min-width-bias-left",type:c.sizeMaybePercent,triggersBounds:o.any},{name:"min-width-bias-right",type:c.sizeMaybePercent,triggersBounds:o.any},{name:"min-height",type:c.size,triggersBounds:o.any},{name:"min-height-bias-top",type:c.sizeMaybePercent,triggersBounds:o.any},{name:"min-height-bias-bottom",type:c.sizeMaybePercent,triggersBounds:o.any}],D=[{name:"line-style",type:c.lineStyle},{name:"line-color",type:c.color},{name:"line-fill",type:c.fill},{name:"line-cap",type:c.lineCap},{name:"line-opacity",type:c.zeroOneNumber},{name:"line-dash-pattern",type:c.numbers},{name:"line-dash-offset",type:c.number},{name:"line-outline-width",type:c.size},{name:"line-outline-color",type:c.color},{name:"line-gradient-stop-colors",type:c.colors},{name:"line-gradient-stop-positions",type:c.percentages},{name:"curve-style",type:c.curveStyle,triggersBounds:o.any,triggersBoundsOfParallelEdges:function(j,Q){return j===Q?!1:j==="bezier"||Q==="bezier"}},{name:"haystack-radius",type:c.zeroOneNumber,triggersBounds:o.any},{name:"source-endpoint",type:c.edgeEndpoint,triggersBounds:o.any},{name:"target-endpoint",type:c.edgeEndpoint,triggersBounds:o.any},{name:"control-point-step-size",type:c.size,triggersBounds:o.any},{name:"control-point-distances",type:c.bidirectionalSizes,triggersBounds:o.any},{name:"control-point-weights",type:c.numbers,triggersBounds:o.any},{name:"segment-distances",type:c.bidirectionalSizes,triggersBounds:o.any},{name:"segment-weights",type:c.numbers,triggersBounds:o.any},{name:"segment-radii",type:c.numbers,triggersBounds:o.any},{name:"radius-type",type:c.radiusType,triggersBounds:o.any},{name:"taxi-turn",type:c.bidirectionalSizeMaybePercent,triggersBounds:o.any},{name:"taxi-turn-min-distance",type:c.size,triggersBounds:o.any},{name:"taxi-direction",type:c.axisDirection,triggersBounds:o.any},{name:"taxi-radius",type:c.number,triggersBounds:o.any},{name:"edge-distances",type:c.edgeDistances,triggersBounds:o.any},{name:"arrow-scale",type:c.positiveNumber,triggersBounds:o.any},{name:"loop-direction",type:c.angle,triggersBounds:o.any},{name:"loop-sweep",type:c.angle,triggersBounds:o.any},{name:"source-distance-from-node",type:c.size,triggersBounds:o.any},{name:"target-distance-from-node",type:c.size,triggersBounds:o.any}],_=[{name:"ghost",type:c.bool,triggersBounds:o.any},{name:"ghost-offset-x",type:c.bidirectionalSize,triggersBounds:o.any},{name:"ghost-offset-y",type:c.bidirectionalSize,triggersBounds:o.any},{name:"ghost-opacity",type:c.zeroOneNumber}],P=[{name:"selection-box-color",type:c.color},{name:"selection-box-opacity",type:c.zeroOneNumber},{name:"selection-box-border-color",type:c.color},{name:"selection-box-border-width",type:c.size},{name:"active-bg-color",type:c.color},{name:"active-bg-opacity",type:c.zeroOneNumber},{name:"active-bg-size",type:c.size},{name:"outside-texture-bg-color",type:c.color},{name:"outside-texture-bg-opacity",type:c.zeroOneNumber}],z=[];Mr.pieBackgroundN=16,z.push({name:"pie-size",type:c.sizeMaybePercent}),z.push({name:"pie-hole",type:c.sizeMaybePercent}),z.push({name:"pie-start-angle",type:c.angle});for(var H=1;H<=Mr.pieBackgroundN;H++)z.push({name:"pie-"+H+"-background-color",type:c.color}),z.push({name:"pie-"+H+"-background-size",type:c.percent}),z.push({name:"pie-"+H+"-background-opacity",type:c.zeroOneNumber});var $=[];Mr.stripeBackgroundN=16,$.push({name:"stripe-size",type:c.sizeMaybePercent}),$.push({name:"stripe-direction",type:c.axisDirectionPrimary});for(var q=1;q<=Mr.stripeBackgroundN;q++)$.push({name:"stripe-"+q+"-background-color",type:c.color}),$.push({name:"stripe-"+q+"-background-size",type:c.percent}),$.push({name:"stripe-"+q+"-background-opacity",type:c.zeroOneNumber});var V=[],X=Mr.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:c.arrowShape,triggersBounds:o.any},{name:"arrow-color",type:c.color},{name:"arrow-fill",type:c.arrowFill},{name:"arrow-width",type:c.arrowWidth}].forEach(function(se){X.forEach(function(j){var Q=j+"-"+se.name,K=se.type,ue=se.triggersBounds;V.push({name:Q,type:K,triggersBounds:ue})})},{});var ee=Mr.properties=[].concat(b,k,x,w,S,_,y,m,h,d,g,M,R,O,N,z,$,B,D,V,P),te=Mr.propertyGroups={behavior:b,transition:k,visibility:x,overlay:w,underlay:S,ghost:_,commonLabel:y,labelDimensions:m,mainLabel:h,sourceLabel:d,targetLabel:g,nodeBody:M,nodeBorder:R,nodeOutline:O,backgroundImage:N,pie:z,stripe:$,compound:B,edgeLine:D,edgeArrow:V,core:P},I=Mr.propertyGroupNames={},G=Mr.propertyGroupKeys=Object.keys(te);G.forEach(function(se){I[se]=te[se].map(function(j){return j.name}),te[se].forEach(function(j){return j.groupKey=se})});var re=Mr.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"}];Mr.propertyNames=ee.map(function(se){return se.name});for(var Y=0;Y<ee.length;Y++){var W=ee[Y];ee[W.name]=W}for(var Z=0;Z<re.length;Z++){var ie=re[Z],we=ee[ie.pointsTo],de={name:ie.name,alias:!0,pointsTo:we};ee.push(de),ee[ie.name]=de}})();Mr.getDefaultProperty=function(t){return this.getDefaultProperties()[t]};Mr.getDefaultProperties=function(){var t=this._private;if(t.defaultProperties!=null)return t.defaultProperties;for(var e=ft({"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(o,c){for(var h=1;h<=Mr.pieBackgroundN;h++){var d=c.name.replace("{{i}}",h),g=c.value;o[d]=g}return o},{}),{"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(o,c){for(var h=1;h<=Mr.stripeBackgroundN;h++){var d=c.name.replace("{{i}}",h),g=c.value;o[d]=g}return o},{}),{"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(o,c){return Mr.arrowPrefixes.forEach(function(h){var d=h+"-"+c.name,g=c.value;o[d]=g}),o},{})),r={},n=0;n<this.properties.length;n++){var i=this.properties[n];if(!i.pointsTo){var a=i.name,s=e[a],l=this.parse(a,s);r[a]=l}}return t.defaultProperties=r,t.defaultProperties};Mr.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 yv={};yv.parse=function(t,e,r,n){var i=this;if(hr(e))return i.parseImplWarn(t,e,r,n);var a=n==="mapping"||n===!0||n===!1||n==null?"dontcare":n,s=r?"t":"f",l=""+e,o=Dq(t,l,s,a),c=i.propCache=i.propCache||[],h;return(h=c[o])||(h=c[o]=i.parseImplWarn(t,e,r,n)),(r||n==="mapping")&&(h=la(h),h&&(h.value=la(h.value))),h};yv.parseImplWarn=function(t,e,r,n){var i=this.parseImpl(t,e,r,n);return!i&&e!=null&&jt("The style property `".concat(t,": ").concat(e,"` is invalid")),i&&(i.name==="width"||i.name==="height")&&e==="label"&&jt("The style value of `label` is deprecated for `"+i.name+"`"),i};yv.parseImpl=function(t,e,r,n){var i=this;t=NT(t);var a=i.properties[t],s=e,l=i.types;if(!a||e===void 0)return null;a.alias&&(a=a.pointsTo,t=a.name);var o=lt(e);o&&(e=e.trim());var c=a.type;if(!c)return null;if(r&&(e===""||e===null))return{name:t,value:e,bypass:!0,deleteBypass:!0};if(hr(e))return{name:t,value:e,strValue:"fn",mapped:l.fn,bypass:r};var h,d;if(!(!o||n||e.length<7||e[1]!=="a")){if(e.length>=7&&e[0]==="d"&&(h=new RegExp(l.data.regex).exec(e))){if(r)return!1;var g=l.data;return{name:t,value:h,strValue:""+e,mapped:g,field:h[1],bypass:r}}else if(e.length>=10&&e[0]==="m"&&(d=new RegExp(l.mapData.regex).exec(e))){if(r||c.multiple)return!1;var m=l.mapData;if(!(c.color||c.number))return!1;var y=this.parse(t,d[4]);if(!y||y.mapped)return!1;var b=this.parse(t,d[5]);if(!b||b.mapped)return!1;if(y.pfValue===b.pfValue||y.strValue===b.strValue)return jt("`"+t+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+t+": "+y.strValue+"`"),this.parse(t,y.strValue);if(c.color){var x=y.value,w=b.value,S=x[0]===w[0]&&x[1]===w[1]&&x[2]===w[2]&&(x[3]===w[3]||(x[3]==null||x[3]===1)&&(w[3]==null||w[3]===1));if(S)return!1}return{name:t,value:d,strValue:""+e,mapped:m,field:d[1],fieldMin:parseFloat(d[2]),fieldMax:parseFloat(d[3]),valueMin:y.value,valueMax:b.value,bypass:r}}}if(c.multiple&&n!=="multiple"){var k;if(o?k=e.split(/\s+/):Zt(e)?k=e:k=[e],c.evenMultiple&&k.length%2!==0)return null;for(var E=[],M=[],R=[],O="",N=!1,B=0;B<k.length;B++){var D=i.parse(t,k[B],r,"multiple");N=N||lt(D.value),E.push(D.value),R.push(D.pfValue!=null?D.pfValue:D.value),M.push(D.units),O+=(B>0?" ":"")+D.strValue}return c.validate&&!c.validate(E,M)?null:c.singleEnum&&N?E.length===1&&lt(E[0])?{name:t,value:E[0],strValue:E[0],bypass:r}:null:{name:t,value:E,pfValue:R,strValue:O,bypass:r,units:M}}var _=function(){for(var de=0;de<c.enums.length;de++){var se=c.enums[de];if(se===e)return{name:t,value:e,strValue:""+e,bypass:r}}return null};if(c.number){var P,z="px";if(c.units&&(P=c.units),c.implicitUnits&&(z=c.implicitUnits),!c.unitless)if(o){var H="px|em"+(c.allowPercent?"|\\%":"");P&&(H=P);var $=e.match("^("+Ir+")("+H+")?$");$&&(e=$[1],P=$[2]||z)}else(!P||c.implicitUnits)&&(P=z);if(e=parseFloat(e),isNaN(e)&&c.enums===void 0)return null;if(isNaN(e)&&c.enums!==void 0)return e=s,_();if(c.integer&&!CG(e)||c.min!==void 0&&(e<c.min||c.strictMin&&e===c.min)||c.max!==void 0&&(e>c.max||c.strictMax&&e===c.max))return null;var q={name:t,value:e,strValue:""+e+(P||""),units:P,bypass:r};return c.unitless||P!=="px"&&P!=="em"?q.pfValue=e:q.pfValue=P==="px"||!P?e:this.getEmSizeInPixels()*e,(P==="ms"||P==="s")&&(q.pfValue=P==="ms"?e:1e3*e),(P==="deg"||P==="rad")&&(q.pfValue=P==="rad"?e:NY(e)),P==="%"&&(q.pfValue=e/100),q}else if(c.propList){var V=[],X=""+e;if(X!=="none"){for(var ee=X.split(/\s*,\s*|\s+/),te=0;te<ee.length;te++){var I=ee[te].trim();i.properties[I]?V.push(I):jt("`"+I+"` is not a valid property name")}if(V.length===0)return null}return{name:t,value:V,strValue:V.length===0?"none":V.join(" "),bypass:r}}else if(c.color){var G=kq(e);return G?{name:t,value:G,pfValue:G,strValue:"rgb("+G[0]+","+G[1]+","+G[2]+")",bypass:r}:null}else if(c.regex||c.regexes){if(c.enums){var re=_();if(re)return re}for(var Y=c.regexes?c.regexes:[c.regex],W=0;W<Y.length;W++){var Z=new RegExp(Y[W]),ie=Z.exec(e);if(ie)return{name:t,value:c.singleRegexMatchValue?ie[1]:ie,strValue:""+e,bypass:r}}return null}else return c.string?{name:t,value:""+e,strValue:""+e,bypass:r}:c.enums?_():null};var Qr=function(e){if(!(this instanceof Qr))return new Qr(e);if(!_T(e)){ur("A style must have a core reference");return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},yn=Qr.prototype;yn.instanceString=function(){return"style"};yn.clear=function(){for(var t=this._private,e=t.cy,r=e.elements(),n=0;n<this.length;n++)this[n]=void 0;return this.length=0,t.contextStyles={},t.propDiffs={},this.cleanElements(r,!0),r.forEach(function(i){var a=i[0]._private;a.styleDirty=!0,a.appliedInitStyle=!1}),this};yn.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this};yn.core=function(t){return this._private.coreStyle[t]||this.getDefaultProperty(t)};yn.selector=function(t){var e=t==="core"?null:new Qs(t),r=this.length++;return this[r]={selector:e,properties:[],mappedProperties:[],index:r},this};yn.css=function(){var t=this,e=arguments;if(e.length===1)for(var r=e[0],n=0;n<t.properties.length;n++){var i=t.properties[n],a=r[i.name];a===void 0&&(a=r[iv(i.name)]),a!==void 0&&this.cssRule(i.name,a)}else e.length===2&&this.cssRule(e[0],e[1]);return this};yn.style=yn.css;yn.cssRule=function(t,e){var r=this.parse(t,e);if(r){var n=this.length-1;this[n].properties.push(r),this[n].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[n].mappedProperties.push(r);var i=!this[n].selector;i&&(this._private.coreStyle[r.name]=r)}return this};yn.append=function(t){return wq(t)?t.appendToStyle(this):Zt(t)?this.appendFromJson(t):lt(t)&&this.appendFromString(t),this};Qr.fromJson=function(t,e){var r=new Qr(t);return r.fromJson(e),r};Qr.fromString=function(t,e){return new Qr(t).fromString(e)};[Kr,bh,XT,da,mv,WT,Mr,yv].forEach(function(t){ft(yn,t)});Qr.types=yn.types;Qr.properties=yn.properties;Qr.propertyGroups=yn.propertyGroups;Qr.propertyGroupNames=yn.propertyGroupNames;Qr.propertyGroupKeys=yn.propertyGroupKeys;var zQ={style:function(e){if(e){var r=this.setStyle(e);r.update()}return this._private.style},setStyle:function(e){var r=this._private;return wq(e)?r.style=e.generateStyle(this):Zt(e)?r.style=Qr.fromJson(this,e):lt(e)?r.style=Qr.fromString(this,e):r.style=Qr(this),r.style},updateStyle:function(){this.mutableElements().updateStyle()}},IQ="single",Jl={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=IQ),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,n,i,a,s,l;switch(e.length){case 0:return r;case 1:if(lt(e[0]))return n=e[0],r[n];if(Bt(e[0])){if(!this._private.panningEnabled)return this;a=e[0],s=a.x,l=a.y,qe(s)&&(r.x=s),qe(l)&&(r.y=l),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;n=e[0],i=e[1],(n==="x"||n==="y")&&qe(i)&&(r[n]=i),this.emit("pan viewport");break}return this.notify("viewport"),this},panBy:function(e,r){var n=arguments,i=this._private.pan,a,s,l,o,c;if(!this._private.panningEnabled)return this;switch(n.length){case 1:Bt(e)&&(l=n[0],o=l.x,c=l.y,qe(o)&&(i.x+=o),qe(c)&&(i.y+=c),this.emit("pan viewport"));break;case 2:a=e,s=r,(a==="x"||a==="y")&&qe(s)&&(i[a]+=s),this.emit("pan viewport");break}return this.notify("viewport"),this},gc:function(){this.notify("gc")},fit:function(e,r){var n=this.getFitViewport(e,r);if(n){var i=this._private;i.zoom=n.zoom,i.pan=n.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,r){if(qe(e)&&r===void 0&&(r=e,e=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var n;if(lt(e)){var i=e;e=this.$(i)}else if(EG(e)){var a=e;n={x1:a.x1,y1:a.y1,x2:a.x2,y2:a.y2},n.w=n.x2-n.x1,n.h=n.y2-n.y1}else fi(e)||(e=this.mutableElements());if(!(fi(e)&&e.empty())){n=n||e.boundingBox();var s=this.width(),l=this.height(),o;if(r=qe(r)?r:0,!isNaN(s)&&!isNaN(l)&&s>0&&l>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0){o=Math.min((s-2*r)/n.w,(l-2*r)/n.h),o=o>this._private.maxZoom?this._private.maxZoom:o,o=o<this._private.minZoom?this._private.minZoom:o;var c={x:(s-o*(n.x1+n.x2))/2,y:(l-o*(n.y1+n.y2))/2};return{zoom:o,pan:c}}}}},zoomRange:function(e,r){var n=this._private;if(r==null){var i=e;e=i.min,r=i.max}return qe(e)&&qe(r)&&e<=r?(n.minZoom=e,n.maxZoom=r):qe(e)&&r===void 0&&e<=n.maxZoom?n.minZoom=e:qe(r)&&e===void 0&&r>=n.minZoom&&(n.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,n=r.pan,i=r.zoom,a,s,l=!1;if(r.zoomingEnabled||(l=!0),qe(e)?s=e:Bt(e)&&(s=e.level,e.position!=null?a=lv(e.position,i,n):e.renderedPosition!=null&&(a=e.renderedPosition),a!=null&&!r.panningEnabled&&(l=!0)),s=s>r.maxZoom?r.maxZoom:s,s=s<r.minZoom?r.minZoom:s,l||!qe(s)||s===i||a!=null&&(!qe(a.x)||!qe(a.y)))return null;if(a!=null){var o=n,c=i,h=s,d={x:-h/c*(a.x-o.x)+a.x,y:-h/c*(a.y-o.y)+a.y};return{zoomed:!0,panned:!0,zoom:h,pan:d}}else return{zoomed:!0,panned:!1,zoom:s,pan:n}},zoom:function(e){if(e===void 0)return this._private.zoom;var r=this.getZoomedViewport(e),n=this._private;return r==null||!r.zoomed?this:(n.zoom=r.zoom,r.panned&&(n.pan.x=r.pan.x,n.pan.y=r.pan.y),this.emit("zoom"+(r.panned?" pan":"")+" viewport"),this.notify("viewport"),this)},viewport:function(e){var r=this._private,n=!0,i=!0,a=[],s=!1,l=!1;if(!e)return this;if(qe(e.zoom)||(n=!1),Bt(e.pan)||(i=!1),!n&&!i)return this;if(n){var o=e.zoom;o<r.minZoom||o>r.maxZoom||!r.zoomingEnabled?s=!0:(r.zoom=o,a.push("zoom"))}if(i&&(!s||!e.cancelOnFailedZoom)&&r.panningEnabled){var c=e.pan;qe(c.x)&&(r.pan.x=c.x,l=!1),qe(c.y)&&(r.pan.y=c.y,l=!1),l||a.push("pan")}return a.length>0&&(a.push("viewport"),this.emit(a.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(lt(e)){var n=e;e=this.mutableElements().filter(n)}else fi(e)||(e=this.mutableElements());if(e.length!==0){var i=e.boundingBox(),a=this.width(),s=this.height();r=r===void 0?this._private.zoom:r;var l={x:(a-r*(i.x1+i.x2))/2,y:(s-r*(i.y1+i.y2))/2};return l}}},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,n=this;return e.sizeCache=e.sizeCache||(r?(function(){var i=n.window().getComputedStyle(r),a=function(l){return parseFloat(i.getPropertyValue(l))};return{width:r.clientWidth-a("padding-left")-a("padding-right"),height:r.clientHeight-a("padding-top")-a("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,n=this.renderedExtent(),i={x1:(n.x1-e.x)/r,x2:(n.x2-e.x)/r,y1:(n.y1-e.y)/r,y2:(n.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}};Jl.centre=Jl.center;Jl.autolockNodes=Jl.autolock;Jl.autoungrabifyNodes=Jl.autoungrabify;var Vf={data:qt.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:qt.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:qt.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:qt.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};Vf.attr=Vf.data;Vf.removeAttr=Vf.removeData;var Uf=function(e){var r=this;e=ft({},e);var n=e.container;n&&!hg(n)&&hg(n[0])&&(n=n[0]);var i=n?n._cyreg:null;i=i||{},i&&i.cy&&(i.cy.destroy(),i={});var a=i.readies=i.readies||[];n&&(n._cyreg=i),i.cy=r;var s=Lr!==void 0&&n!==void 0&&!e.headless,l=e;l.layout=ft({name:s?"grid":"null"},l.layout),l.renderer=ft({name:s?"canvas":"null"},l.renderer);var o=function(y,b,x){return b!==void 0?b:x!==void 0?x:y},c=this._private={container:n,ready:!1,options:l,elements:new on(this),listeners:[],aniEles:new on(this),data:l.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:o(!0,l.zoomingEnabled),userZoomingEnabled:o(!0,l.userZoomingEnabled),panningEnabled:o(!0,l.panningEnabled),userPanningEnabled:o(!0,l.userPanningEnabled),boxSelectionEnabled:o(!0,l.boxSelectionEnabled),autolock:o(!1,l.autolock,l.autolockNodes),autoungrabify:o(!1,l.autoungrabify,l.autoungrabifyNodes),autounselectify:o(!1,l.autounselectify),styleEnabled:l.styleEnabled===void 0?s:l.styleEnabled,zoom:qe(l.zoom)?l.zoom:1,pan:{x:Bt(l.pan)&&qe(l.pan.x)?l.pan.x:0,y:Bt(l.pan)&&qe(l.pan.y)?l.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:o(250,l.multiClickDebounceTime)};this.createEmitter(),this.selectionType(l.selectionType),this.zoomRange({min:l.minZoom,max:l.maxZoom});var h=function(y,b){var x=y.some(AG);if(x)return Gu.all(y).then(b);b(y)};c.styleEnabled&&r.setStyle([]);var d=ft({},l,l.renderer);r.initRenderer(d);var g=function(y,b,x){r.notifications(!1);var w=r.mutableElements();w.length>0&&w.remove(),y!=null&&(Bt(y)||Zt(y))&&r.add(y),r.one("layoutready",function(k){r.notifications(!0),r.emit(k),r.one("load",b),r.emitAndNotify("load")}).one("layoutstop",function(){r.one("done",x),r.emit("done")});var S=ft({},r._private.options.layout);S.eles=r.elements(),r.layout(S).run()};h([l.style,l.elements],function(m){var y=m[0],b=m[1];c.styleEnabled&&r.style().append(y),g(b,function(){r.startAnimationLoop(),c.ready=!0,hr(l.ready)&&r.on("ready",l.ready);for(var x=0;x<a.length;x++){var w=a[x];r.on("ready",w)}i&&(i.readies=[]),r.emit("ready")},l.done)})},bg=Uf.prototype;ft(bg,{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 Lr;var r=this._private.container.ownerDocument;return r===void 0||r==null?Lr:r.defaultView||Lr},mount:function(e){if(e!=null){var r=this,n=r._private,i=n.options;return!hg(e)&&hg(e[0])&&(e=e[0]),r.stopAnimationLoop(),r.destroyRenderer(),n.container=e,n.styleEnabled=!0,r.invalidateSize(),r.initRenderer(ft({},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 la(this._private.options)},json:function(e){var r=this,n=r._private,i=r.mutableElements(),a=function(E){return r.getElementById(E.id())};if(Bt(e)){if(r.startBatch(),e.elements){var s={},l=function(E,M){for(var R=[],O=[],N=0;N<E.length;N++){var B=E[N];if(!B.data.id){jt("cy.json() cannot handle elements without an ID attribute");continue}var D=""+B.data.id,_=r.getElementById(D);s[D]=!0,_.length!==0?O.push({ele:_,json:B}):(M&&(B.group=M),R.push(B))}r.add(R);for(var P=0;P<O.length;P++){var z=O[P],H=z.ele,$=z.json;H.json($)}};if(Zt(e.elements))l(e.elements);else for(var o=["nodes","edges"],c=0;c<o.length;c++){var h=o[c],d=e.elements[h];Zt(d)&&l(d,h)}var g=r.collection();i.filter(function(k){return!s[k.id()]}).forEach(function(k){k.isParent()?g.merge(k):k.remove()}),g.forEach(function(k){return k.children().move({parent:null})}),g.forEach(function(k){return a(k).remove()})}e.style&&r.style(e.style),e.zoom!=null&&e.zoom!==n.zoom&&r.zoom(e.zoom),e.pan&&(e.pan.x!==n.pan.x||e.pan.y!==n.pan.y)&&r.pan(e.pan),e.data&&r.data(e.data);for(var m=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],y=0;y<m.length;y++){var b=m[y];e[b]!=null&&r[b](e[b])}return r.endBatch(),this}else{var x=!!e,w={};x?w.elements=this.elements().map(function(k){return k.json()}):(w.elements={},i.forEach(function(k){var E=k.group();w.elements[E]||(w.elements[E]=[]),w.elements[E].push(k.json())})),this._private.styleEnabled&&(w.style=r.style().json()),w.data=la(r.data());var S=n.options;return w.zoomingEnabled=n.zoomingEnabled,w.userZoomingEnabled=n.userZoomingEnabled,w.zoom=n.zoom,w.minZoom=n.minZoom,w.maxZoom=n.maxZoom,w.panningEnabled=n.panningEnabled,w.userPanningEnabled=n.userPanningEnabled,w.pan=la(n.pan),w.boxSelectionEnabled=n.boxSelectionEnabled,w.renderer=la(S.renderer),w.hideEdgesOnViewport=S.hideEdgesOnViewport,w.textureOnViewport=S.textureOnViewport,w.wheelSensitivity=S.wheelSensitivity,w.motionBlur=S.motionBlur,w.multiClickDebounceTime=S.multiClickDebounceTime,w}}});bg.$id=bg.getElementById;[AQ,_Q,wj,fk,Hp,BQ,hk,Vp,zQ,Jl,Vf].forEach(function(t){ft(bg,t)});var qQ={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}},jQ={maximal:!1,acyclic:!1},tu=function(e){return e.scratch("breadthfirst")},CN=function(e,r){return e.scratch("breadthfirst",r)};function Sj(t){this.options=ft({},qQ,jQ,t)}Sj.prototype.run=function(){var t=this.options,e=t.cy,r=t.eles,n=r.nodes().filter(function($e){return $e.isChildless()}),i=r,a=t.directed,s=t.acyclic||t.maximal||t.maximalAdjustments>0,l=!!t.boundingBox,o=Rn(l?t.boundingBox:structuredClone(e.extent())),c;if(fi(t.roots))c=t.roots;else if(Zt(t.roots)){for(var h=[],d=0;d<t.roots.length;d++){var g=t.roots[d],m=e.getElementById(g);h.push(m)}c=e.collection(h)}else if(lt(t.roots))c=e.$(t.roots);else if(a)c=n.roots();else{var y=r.components();c=e.collection();for(var b=function(){var Ne=y[x],Ge=Ne.maxDegree(!1),Ve=Ne.filter(function(Qe){return Qe.degree(!1)===Ge});c=c.add(Ve)},x=0;x<y.length;x++)b()}var w=[],S={},k=function(Ne,Ge){w[Ge]==null&&(w[Ge]=[]);var Ve=w[Ge].length;w[Ge].push(Ne),CN(Ne,{index:Ve,depth:Ge})},E=function(Ne,Ge){var Ve=tu(Ne),Qe=Ve.depth,je=Ve.index;w[Qe][je]=null,Ne.isChildless()&&k(Ne,Ge)};i.bfs({roots:c,directed:t.directed,visit:function(Ne,Ge,Ve,Qe,je){var dt=Ne[0],ke=dt.id();dt.isChildless()&&k(dt,je),S[ke]=!0}});for(var M=[],R=0;R<n.length;R++){var O=n[R];S[O.id()]||M.push(O)}var N=function(Ne){for(var Ge=w[Ne],Ve=0;Ve<Ge.length;Ve++){var Qe=Ge[Ve];if(Qe==null){Ge.splice(Ve,1),Ve--;continue}CN(Qe,{depth:Ne,index:Ve})}},B=function(Ne,Ge){for(var Ve=tu(Ne),Qe=Ne.incomers().filter(function(Oe){return Oe.isNode()&&r.has(Oe)}),je=-1,dt=Ne.id(),ke=0;ke<Qe.length;ke++){var De=Qe[ke],Be=tu(De);je=Math.max(je,Be.depth)}if(Ve.depth<=je){if(!t.acyclic&&Ge[dt])return null;var Ke=je+1;return E(Ne,Ke),Ge[dt]=Ke,!0}return!1};if(a&&s){var D=[],_={},P=function(Ne){return D.push(Ne)},z=function(){return D.shift()};for(n.forEach(function($e){return D.push($e)});D.length>0;){var H=z(),$=B(H,_);if($)H.outgoers().filter(function($e){return $e.isNode()&&r.has($e)}).forEach(P);else if($===null){jt("Detected double maximal shift for node `"+H.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var q=0;if(t.avoidOverlap)for(var V=0;V<n.length;V++){var X=n[V],ee=X.layoutDimensions(t),te=ee.w,I=ee.h;q=Math.max(q,te,I)}var G={},re=function(Ne){if(G[Ne.id()])return G[Ne.id()];for(var Ge=tu(Ne).depth,Ve=Ne.neighborhood(),Qe=0,je=0,dt=0;dt<Ve.length;dt++){var ke=Ve[dt];if(!(ke.isEdge()||ke.isParent()||!n.has(ke))){var De=tu(ke);if(De!=null){var Be=De.index,Ke=De.depth;if(!(Be==null||Ke==null)){var Oe=w[Ke].length;Ke<Ge&&(Qe+=Be/Oe,je++)}}}}return je=Math.max(1,je),Qe=Qe/je,je===0&&(Qe=0),G[Ne.id()]=Qe,Qe},Y=function(Ne,Ge){var Ve=re(Ne),Qe=re(Ge),je=Ve-Qe;return je===0?Cq(Ne.id(),Ge.id()):je};t.depthSort!==void 0&&(Y=t.depthSort);for(var W=w.length,Z=0;Z<W;Z++)w[Z].sort(Y),N(Z);for(var ie=[],we=0;we<M.length;we++)ie.push(M[we]);var de=function(){for(var Ne=0;Ne<W;Ne++)N(Ne)};ie.length&&(w.unshift(ie),W=w.length,de());for(var se=0,j=0;j<W;j++)se=Math.max(w[j].length,se);var Q={x:o.x1+o.w/2,y:o.y1+o.h/2},K=n.reduce(function($e,Ne){return(function(Ge){return{w:$e.w===-1?Ge.w:($e.w+Ge.w)/2,h:$e.h===-1?Ge.h:($e.h+Ge.h)/2}})(Ne.boundingBox({includeLabels:t.nodeDimensionsIncludeLabels}))},{w:-1,h:-1}),ue=Math.max(W===1?0:l?(o.h-t.padding*2-K.h)/(W-1):(o.h-t.padding*2-K.h)/(W+1),q),Se=w.reduce(function($e,Ne){return Math.max($e,Ne.length)},0),at=function(Ne){var Ge=tu(Ne),Ve=Ge.depth,Qe=Ge.index;if(t.circle){var je=Math.min(o.w/2/W,o.h/2/W);je=Math.max(je,q);var dt=je*Ve+je-(W>0&&w[0].length<=3?je/2:0),ke=2*Math.PI/w[Ve].length*Qe;return Ve===0&&w[0].length===1&&(dt=1),{x:Q.x+dt*Math.cos(ke),y:Q.y+dt*Math.sin(ke)}}else{var De=w[Ve].length,Be=Math.max(De===1?0:l?(o.w-t.padding*2-K.w)/((t.grid?Se:De)-1):(o.w-t.padding*2-K.w)/((t.grid?Se:De)+1),q),Ke={x:Q.x+(Qe+1-(De+1)/2)*Be,y:Q.y+(Ve+1-(W+1)/2)*ue};return Ke}},Me={downward:0,leftward:90,upward:180,rightward:-90};Object.keys(Me).indexOf(t.direction)===-1&&ur("Invalid direction '".concat(t.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(Me).join(", ")));var He=function(Ne){return rY(at(Ne),o,Me[t.direction])};return r.nodes().layoutPositions(this,t,He),this};var FQ={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 Cj(t){this.options=ft({},FQ,t)}Cj.prototype.run=function(){var t=this.options,e=t,r=t.cy,n=e.eles,i=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,a=n.nodes().not(":parent");e.sort&&(a=a.sort(e.sort));for(var s=Rn(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),l={x:s.x1+s.w/2,y:s.y1+s.h/2},o=e.sweep===void 0?2*Math.PI-2*Math.PI/a.length:e.sweep,c=o/Math.max(1,a.length-1),h,d=0,g=0;g<a.length;g++){var m=a[g],y=m.layoutDimensions(e),b=y.w,x=y.h;d=Math.max(d,b,x)}if(qe(e.radius)?h=e.radius:a.length<=1?h=0:h=Math.min(s.h,s.w)/2-d,a.length>1&&e.avoidOverlap){d*=1.75;var w=Math.cos(c)-Math.cos(0),S=Math.sin(c)-Math.sin(0),k=Math.sqrt(d*d/(w*w+S*S));h=Math.max(k,h)}var E=function(R,O){var N=e.startAngle+O*c*(i?1:-1),B=h*Math.cos(N),D=h*Math.sin(N),_={x:l.x+B,y:l.y+D};return _};return n.nodes().layoutPositions(this,e,E),this};var HQ={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 kj(t){this.options=ft({},HQ,t)}kj.prototype.run=function(){for(var t=this.options,e=t,r=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,n=t.cy,i=e.eles,a=i.nodes().not(":parent"),s=Rn(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),l={x:s.x1+s.w/2,y:s.y1+s.h/2},o=[],c=0,h=0;h<a.length;h++){var d=a[h],g=void 0;g=e.concentric(d),o.push({value:g,node:d}),d._private.scratch.concentric=g}a.updateStyle();for(var m=0;m<a.length;m++){var y=a[m],b=y.layoutDimensions(e);c=Math.max(c,b.w,b.h)}o.sort(function(ue,Se){return Se.value-ue.value});for(var x=e.levelWidth(a),w=[[]],S=w[0],k=0;k<o.length;k++){var E=o[k];if(S.length>0){var M=Math.abs(S[0].value-E.value);M>=x&&(S=[],w.push(S))}S.push(E)}var R=c+e.minNodeSpacing;if(!e.avoidOverlap){var O=w.length>0&&w[0].length>1,N=Math.min(s.w,s.h)/2-R,B=N/(w.length+O?1:0);R=Math.min(R,B)}for(var D=0,_=0;_<w.length;_++){var P=w[_],z=e.sweep===void 0?2*Math.PI-2*Math.PI/P.length:e.sweep,H=P.dTheta=z/Math.max(1,P.length-1);if(P.length>1&&e.avoidOverlap){var $=Math.cos(H)-Math.cos(0),q=Math.sin(H)-Math.sin(0),V=Math.sqrt(R*R/($*$+q*q));D=Math.max(V,D)}P.r=D,D+=R}if(e.equidistant){for(var X=0,ee=0,te=0;te<w.length;te++){var I=w[te],G=I.r-ee;X=Math.max(X,G)}ee=0;for(var re=0;re<w.length;re++){var Y=w[re];re===0&&(ee=Y.r),Y.r=ee,ee+=X}}for(var W={},Z=0;Z<w.length;Z++)for(var ie=w[Z],we=ie.dTheta,de=ie.r,se=0;se<ie.length;se++){var j=ie[se],Q=e.startAngle+(r?1:-1)*we*se,K={x:l.x+de*Math.cos(Q),y:l.y+de*Math.sin(Q)};W[j.node.id()]=K}return i.nodes().layoutPositions(this,e,function(ue){var Se=ue.id();return W[Se]}),this};var Fb,VQ={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 bv(t){this.options=ft({},VQ,t),this.options.layout=this;var e=this.options.eles.nodes(),r=this.options.eles.edges(),n=r.filter(function(i){var a=i.source().data("id"),s=i.target().data("id"),l=e.some(function(c){return c.data("id")===a}),o=e.some(function(c){return c.data("id")===s});return!l||!o});this.options.eles=this.options.eles.not(n)}bv.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?Fb=!0:Fb=!1;var n=UQ(e,r,t);Fb&&GQ(n),t.randomize&&YQ(n);var i=Ya(),a=function(){XQ(n,e,t),t.fit===!0&&e.fit(t.padding)},s=function(g){return!(r.stopped||g>=t.numIter||(WQ(n,t),n.temperature=n.temperature*t.coolingFactor,n.temperature<t.minTemp))},l=function(){if(t.animate===!0||t.animate===!1)a(),r.one("layoutstop",t.stop),r.emit({type:"layoutstop",layout:r});else{var g=t.eles.nodes(),m=Ej(n,t,g);g.layoutPositions(r,t,m)}},o=0,c=!0;if(t.animate===!0){var h=function(){for(var g=0;c&&g<t.refresh;)c=s(o),o++,g++;if(!c)TN(n,t),l();else{var m=Ya();m-i>=t.animationThreshold&&a(),dg(h)}};h()}else{for(;c;)c=s(o),o++;TN(n,t),l()}return this};bv.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};bv.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var UQ=function(e,r,n){for(var i=n.eles.edges(),a=n.eles.nodes(),s=Rn(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),l={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:a.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:i.size(),temperature:n.initialTemp,clientWidth:s.w,clientHeight:s.h,boundingBox:s},o=n.eles.components(),c={},h=0;h<o.length;h++)for(var d=o[h],g=0;g<d.length;g++){var m=d[g];c[m.id()]=h}for(var h=0;h<l.nodeSize;h++){var y=a[h],b=y.layoutDimensions(n),x={};x.isLocked=y.locked(),x.id=y.data("id"),x.parentId=y.data("parent"),x.cmptId=c[y.id()],x.children=[],x.positionX=y.position("x"),x.positionY=y.position("y"),x.offsetX=0,x.offsetY=0,x.height=b.w,x.width=b.h,x.maxX=x.positionX+x.width/2,x.minX=x.positionX-x.width/2,x.maxY=x.positionY+x.height/2,x.minY=x.positionY-x.height/2,x.padLeft=parseFloat(y.style("padding")),x.padRight=parseFloat(y.style("padding")),x.padTop=parseFloat(y.style("padding")),x.padBottom=parseFloat(y.style("padding")),x.nodeRepulsion=hr(n.nodeRepulsion)?n.nodeRepulsion(y):n.nodeRepulsion,l.layoutNodes.push(x),l.idToIndex[x.id]=h}for(var w=[],S=0,k=-1,E=[],h=0;h<l.nodeSize;h++){var y=l.layoutNodes[h],M=y.parentId;M!=null?l.layoutNodes[l.idToIndex[M]].children.push(y.id):(w[++k]=y.id,E.push(y.id))}for(l.graphSet.push(E);S<=k;){var R=w[S++],O=l.idToIndex[R],m=l.layoutNodes[O],N=m.children;if(N.length>0){l.graphSet.push(N);for(var h=0;h<N.length;h++)w[++k]=N[h]}}for(var h=0;h<l.graphSet.length;h++)for(var B=l.graphSet[h],g=0;g<B.length;g++){var D=l.idToIndex[B[g]];l.indexToGraph[D]=h}for(var h=0;h<l.edgeSize;h++){var _=i[h],P={};P.id=_.data("id"),P.sourceId=_.data("source"),P.targetId=_.data("target");var z=hr(n.idealEdgeLength)?n.idealEdgeLength(_):n.idealEdgeLength,H=hr(n.edgeElasticity)?n.edgeElasticity(_):n.edgeElasticity,$=l.idToIndex[P.sourceId],q=l.idToIndex[P.targetId],V=l.indexToGraph[$],X=l.indexToGraph[q];if(V!=X){for(var ee=$Q(P.sourceId,P.targetId,l),te=l.graphSet[ee],I=0,x=l.layoutNodes[$];te.indexOf(x.id)===-1;)x=l.layoutNodes[l.idToIndex[x.parentId]],I++;for(x=l.layoutNodes[q];te.indexOf(x.id)===-1;)x=l.layoutNodes[l.idToIndex[x.parentId]],I++;z*=I*n.nestingFactor}P.idealLength=z,P.elasticity=H,l.layoutEdges.push(P)}return l},$Q=function(e,r,n){var i=Tj(e,r,0,n);return 2>i.count?0:i.graph},Tj=function(e,r,n,i){var a=i.graphSet[n];if(-1<a.indexOf(e)&&-1<a.indexOf(r))return{count:2,graph:n};for(var s=0,l=0;l<a.length;l++){var o=a[l],c=i.idToIndex[o],h=i.layoutNodes[c].children;if(h.length!==0){var d=i.indexToGraph[i.idToIndex[h[0]]],g=Tj(e,r,d,i);if(g.count!==0)if(g.count===1){if(s++,s===2)break}else return g}}return{count:s,graph:n}},GQ,YQ=function(e,r){for(var n=e.clientWidth,i=e.clientHeight,a=0;a<e.nodeSize;a++){var s=e.layoutNodes[a];s.children.length===0&&!s.isLocked&&(s.positionX=Math.random()*n,s.positionY=Math.random()*i)}},Ej=function(e,r,n){var i=e.boundingBox,a={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return r.boundingBox&&(n.forEach(function(s){var l=e.layoutNodes[e.idToIndex[s.data("id")]];a.x1=Math.min(a.x1,l.positionX),a.x2=Math.max(a.x2,l.positionX),a.y1=Math.min(a.y1,l.positionY),a.y2=Math.max(a.y2,l.positionY)}),a.w=a.x2-a.x1,a.h=a.y2-a.y1),function(s,l){var o=e.layoutNodes[e.idToIndex[s.data("id")]];if(r.boundingBox){var c=a.w===0?.5:(o.positionX-a.x1)/a.w,h=a.h===0?.5:(o.positionY-a.y1)/a.h;return{x:i.x1+c*i.w,y:i.y1+h*i.h}}else return{x:o.positionX,y:o.positionY}}},XQ=function(e,r,n){var i=n.layout,a=n.eles.nodes(),s=Ej(e,n,a);a.positions(s),e.ready!==!0&&(e.ready=!0,i.one("layoutready",n.ready),i.emit({type:"layoutready",layout:this}))},WQ=function(e,r,n){QQ(e,r),JQ(e),eK(e,r),tK(e),rK(e)},QQ=function(e,r){for(var n=0;n<e.graphSet.length;n++)for(var i=e.graphSet[n],a=i.length,s=0;s<a;s++)for(var l=e.layoutNodes[e.idToIndex[i[s]]],o=s+1;o<a;o++){var c=e.layoutNodes[e.idToIndex[i[o]]];KQ(l,c,e,r)}},kN=function(e){return-1+2*e*Math.random()},KQ=function(e,r,n,i){var a=e.cmptId,s=r.cmptId;if(!(a!==s&&!n.isCompound)){var l=r.positionX-e.positionX,o=r.positionY-e.positionY,c=1;l===0&&o===0&&(l=kN(c),o=kN(c));var h=ZQ(e,r,l,o);if(h>0)var d=i.nodeOverlap*h,g=Math.sqrt(l*l+o*o),m=d*l/g,y=d*o/g;else var b=xg(e,l,o),x=xg(r,-1*l,-1*o),w=x.x-b.x,S=x.y-b.y,k=w*w+S*S,g=Math.sqrt(k),d=(e.nodeRepulsion+r.nodeRepulsion)/k,m=d*w/g,y=d*S/g;e.isLocked||(e.offsetX-=m,e.offsetY-=y),r.isLocked||(r.offsetX+=m,r.offsetY+=y)}},ZQ=function(e,r,n,i){if(n>0)var a=e.maxX-r.minX;else var a=r.maxX-e.minX;if(i>0)var s=e.maxY-r.minY;else var s=r.maxY-e.minY;return a>=0&&s>=0?Math.sqrt(a*a+s*s):0},xg=function(e,r,n){var i=e.positionX,a=e.positionY,s=e.height||1,l=e.width||1,o=n/r,c=s/l,h={};return r===0&&0<n||r===0&&0>n?(h.x=i,h.y=a+s/2,h):0<r&&-1*c<=o&&o<=c?(h.x=i+l/2,h.y=a+l*n/2/r,h):0>r&&-1*c<=o&&o<=c?(h.x=i-l/2,h.y=a-l*n/2/r,h):0<n&&(o<=-1*c||o>=c)?(h.x=i+s*r/2/n,h.y=a+s/2,h):(0>n&&(o<=-1*c||o>=c)&&(h.x=i-s*r/2/n,h.y=a-s/2),h)},JQ=function(e,r){for(var n=0;n<e.edgeSize;n++){var i=e.layoutEdges[n],a=e.idToIndex[i.sourceId],s=e.layoutNodes[a],l=e.idToIndex[i.targetId],o=e.layoutNodes[l],c=o.positionX-s.positionX,h=o.positionY-s.positionY;if(!(c===0&&h===0)){var d=xg(s,c,h),g=xg(o,-1*c,-1*h),m=g.x-d.x,y=g.y-d.y,b=Math.sqrt(m*m+y*y),x=Math.pow(i.idealLength-b,2)/i.elasticity;if(b!==0)var w=x*m/b,S=x*y/b;else var w=0,S=0;s.isLocked||(s.offsetX+=w,s.offsetY+=S),o.isLocked||(o.offsetX-=w,o.offsetY-=S)}}},eK=function(e,r){if(r.gravity!==0)for(var n=1,i=0;i<e.graphSet.length;i++){var a=e.graphSet[i],s=a.length;if(i===0)var l=e.clientHeight/2,o=e.clientWidth/2;else var c=e.layoutNodes[e.idToIndex[a[0]]],h=e.layoutNodes[e.idToIndex[c.parentId]],l=h.positionX,o=h.positionY;for(var d=0;d<s;d++){var g=e.layoutNodes[e.idToIndex[a[d]]];if(!g.isLocked){var m=l-g.positionX,y=o-g.positionY,b=Math.sqrt(m*m+y*y);if(b>n){var x=r.gravity*m/b,w=r.gravity*y/b;g.offsetX+=x,g.offsetY+=w}}}}},tK=function(e,r){var n=[],i=0,a=-1;for(n.push.apply(n,e.graphSet[0]),a+=e.graphSet[0].length;i<=a;){var s=n[i++],l=e.idToIndex[s],o=e.layoutNodes[l],c=o.children;if(0<c.length&&!o.isLocked){for(var h=o.offsetX,d=o.offsetY,g=0;g<c.length;g++){var m=e.layoutNodes[e.idToIndex[c[g]]];m.offsetX+=h,m.offsetY+=d,n[++a]=c[g]}o.offsetX=0,o.offsetY=0}}},rK=function(e,r){for(var n=0;n<e.nodeSize;n++){var i=e.layoutNodes[n];0<i.children.length&&(i.maxX=void 0,i.minX=void 0,i.maxY=void 0,i.minY=void 0)}for(var n=0;n<e.nodeSize;n++){var i=e.layoutNodes[n];if(!(0<i.children.length||i.isLocked)){var a=nK(i.offsetX,i.offsetY,e.temperature);i.positionX+=a.x,i.positionY+=a.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,Aj(i,e)}}for(var n=0;n<e.nodeSize;n++){var i=e.layoutNodes[n];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)}},nK=function(e,r,n){var i=Math.sqrt(e*e+r*r);if(i>n)var a={x:n*e/i,y:n*r/i};else var a={x:e,y:r};return a},Aj=function(e,r){var n=e.parentId;if(n!=null){var i=r.layoutNodes[r.idToIndex[n]],a=!1;if((i.maxX==null||e.maxX+i.padRight>i.maxX)&&(i.maxX=e.maxX+i.padRight,a=!0),(i.minX==null||e.minX-i.padLeft<i.minX)&&(i.minX=e.minX-i.padLeft,a=!0),(i.maxY==null||e.maxY+i.padBottom>i.maxY)&&(i.maxY=e.maxY+i.padBottom,a=!0),(i.minY==null||e.minY-i.padTop<i.minY)&&(i.minY=e.minY-i.padTop,a=!0),a)return Aj(i,r)}},TN=function(e,r){for(var n=e.layoutNodes,i=[],a=0;a<n.length;a++){var s=n[a],l=s.cmptId,o=i[l]=i[l]||[];o.push(s)}for(var c=0,a=0;a<i.length;a++){var h=i[a];if(h){h.x1=1/0,h.x2=-1/0,h.y1=1/0,h.y2=-1/0;for(var d=0;d<h.length;d++){var g=h[d];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,c+=h.w*h.h}}i.sort(function(S,k){return k.w*k.h-S.w*S.h});for(var m=0,y=0,b=0,x=0,w=Math.sqrt(c)*e.clientWidth/e.clientHeight,a=0;a<i.length;a++){var h=i[a];if(h){for(var d=0;d<h.length;d++){var g=h[d];g.isLocked||(g.positionX+=m-h.x1,g.positionY+=y-h.y1)}m+=h.w+r.componentSpacing,b+=h.w+r.componentSpacing,x=Math.max(x,h.h),b>w&&(y+=x+r.componentSpacing,m=0,b=0,x=0)}}},iK={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 Oj(t){this.options=ft({},iK,t)}Oj.prototype.run=function(){var t=this.options,e=t,r=t.cy,n=e.eles,i=n.nodes().not(":parent");e.sort&&(i=i.sort(e.sort));var a=Rn(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(a.h===0||a.w===0)n.nodes().layoutPositions(this,e,function(re){return{x:a.x1,y:a.y1}});else{var s=i.size(),l=Math.sqrt(s*a.h/a.w),o=Math.round(l),c=Math.round(a.w/a.h*l),h=function(Y){if(Y==null)return Math.min(o,c);var W=Math.min(o,c);W==o?o=Y:c=Y},d=function(Y){if(Y==null)return Math.max(o,c);var W=Math.max(o,c);W==o?o=Y:c=Y},g=e.rows,m=e.cols!=null?e.cols:e.columns;if(g!=null&&m!=null)o=g,c=m;else if(g!=null&&m==null)o=g,c=Math.ceil(s/o);else if(g==null&&m!=null)c=m,o=Math.ceil(s/c);else if(c*o>s){var y=h(),b=d();(y-1)*b>=s?h(y-1):(b-1)*y>=s&&d(b-1)}else for(;c*o<s;){var x=h(),w=d();(w+1)*x>=s?d(w+1):h(x+1)}var S=a.w/c,k=a.h/o;if(e.condense&&(S=0,k=0),e.avoidOverlap)for(var E=0;E<i.length;E++){var M=i[E],R=M._private.position;(R.x==null||R.y==null)&&(R.x=0,R.y=0);var O=M.layoutDimensions(e),N=e.avoidOverlapPadding,B=O.w+N,D=O.h+N;S=Math.max(S,B),k=Math.max(k,D)}for(var _={},P=function(Y,W){return!!_["c-"+Y+"-"+W]},z=function(Y,W){_["c-"+Y+"-"+W]=!0},H=0,$=0,q=function(){$++,$>=c&&($=0,H++)},V={},X=0;X<i.length;X++){var ee=i[X],te=e.position(ee);if(te&&(te.row!==void 0||te.col!==void 0)){var I={row:te.row,col:te.col};if(I.col===void 0)for(I.col=0;P(I.row,I.col);)I.col++;else if(I.row===void 0)for(I.row=0;P(I.row,I.col);)I.row++;V[ee.id()]=I,z(I.row,I.col)}}var G=function(Y,W){var Z,ie;if(Y.locked()||Y.isParent())return!1;var we=V[Y.id()];if(we)Z=we.col*S+S/2+a.x1,ie=we.row*k+k/2+a.y1;else{for(;P(H,$);)q();Z=$*S+S/2+a.x1,ie=H*k+k/2+a.y1,z(H,$),q()}return{x:Z,y:ie}};i.layoutPositions(this,e,G)}return this};var aK={ready:function(){},stop:function(){}};function QT(t){this.options=ft({},aK,t)}QT.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};QT.prototype.stop=function(){return this};var sK={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 Mj(t){this.options=ft({},sK,t)}Mj.prototype.run=function(){var t=this.options,e=t.eles,r=e.nodes(),n=hr(t.positions);function i(a){if(t.positions==null)return OY(a.position());if(n)return t.positions(a);var s=t.positions[a._private.data.id];return s??null}return r.layoutPositions(this,t,function(a,s){var l=i(a);return a.locked()||l==null?!1:l}),this};var lK={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 Rj(t){this.options=ft({},lK,t)}Rj.prototype.run=function(){var t=this.options,e=t.cy,r=t.eles,n=Rn(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),i=function(s,l){return{x:n.x1+Math.round(Math.random()*n.w),y:n.y1+Math.round(Math.random()*n.h)}};return r.nodes().layoutPositions(this,t,i),this};var oK=[{name:"breadthfirst",impl:Sj},{name:"circle",impl:Cj},{name:"concentric",impl:kj},{name:"cose",impl:bv},{name:"grid",impl:Oj},{name:"null",impl:QT},{name:"preset",impl:Mj},{name:"random",impl:Rj}];function Dj(t){this.options=t,this.notifications=0}var EN=function(){},AN=function(){throw new Error("A headless instance can not render images")};Dj.prototype={recalculateRenderedStyle:EN,notify:function(){this.notifications++},init:EN,isHeadless:function(){return!0},png:AN,jpg:AN};var KT={};KT.arrowShapeWidth=.3;KT.registerArrowShapes=function(){var t=this.arrowShapes={},e=this,r=function(c,h,d,g,m,y,b){var x=m.x-d/2-b,w=m.x+d/2+b,S=m.y-d/2-b,k=m.y+d/2+b,E=x<=c&&c<=w&&S<=h&&h<=k;return E},n=function(c,h,d,g,m){var y=c*Math.cos(g)-h*Math.sin(g),b=c*Math.sin(g)+h*Math.cos(g),x=y*d,w=b*d,S=x+m.x,k=w+m.y;return{x:S,y:k}},i=function(c,h,d,g){for(var m=[],y=0;y<c.length;y+=2){var b=c[y],x=c[y+1];m.push(n(b,x,h,d,g))}return m},a=function(c){for(var h=[],d=0;d<c.length;d++){var g=c[d];h.push(g.x,g.y)}return h},s=function(c){return c.pstyle("width").pfValue*c.pstyle("arrow-scale").pfValue*2},l=function(c,h){lt(h)&&(h=t[h]),t[c]=ft({name:c,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(g,m,y,b,x,w){var S=a(i(this.points,y+2*w,b,x)),k=Hn(g,m,S);return k},roughCollide:r,draw:function(g,m,y,b){var x=i(this.points,m,y,b);e.arrowShapeImpl("polygon")(g,x)},spacing:function(g){return 0},gap:s},h)};l("none",{collide:pg,roughCollide:pg,draw:PT,spacing:FD,gap:FD}),l("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),l("arrow","triangle"),l("triangle-backcurve",{points:t.triangle.points,controlPoint:[0,-.15],roughCollide:r,draw:function(c,h,d,g,m){var y=i(this.points,h,d,g),b=this.controlPoint,x=n(b[0],b[1],h,d,g);e.arrowShapeImpl(this.name)(c,y,x)},gap:function(c){return s(c)*.8}}),l("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(c,h,d,g,m,y,b){var x=a(i(this.points,d+2*b,g,m)),w=a(i(this.pointsTee,d+2*b,g,m)),S=Hn(c,h,x)||Hn(c,h,w);return S},draw:function(c,h,d,g,m){var y=i(this.points,h,d,g),b=i(this.pointsTee,h,d,g);e.arrowShapeImpl(this.name)(c,y,b)}}),l("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(c,h,d,g,m,y,b){var x=m,w=Math.pow(x.x-c,2)+Math.pow(x.y-h,2)<=Math.pow((d+2*b)*this.radius,2),S=a(i(this.points,d+2*b,g,m));return Hn(c,h,S)||w},draw:function(c,h,d,g,m){var y=i(this.pointsTr,h,d,g);e.arrowShapeImpl(this.name)(c,y,g.x,g.y,this.radius*h)},spacing:function(c){return e.getArrowWidth(c.pstyle("width").pfValue,c.pstyle("arrow-scale").value)*this.radius}}),l("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(c,h){var d=this.baseCrossLinePts.slice(),g=h/c,m=3,y=5;return d[m]=d[m]-g,d[y]=d[y]-g,d},collide:function(c,h,d,g,m,y,b){var x=a(i(this.points,d+2*b,g,m)),w=a(i(this.crossLinePts(d,y),d+2*b,g,m)),S=Hn(c,h,x)||Hn(c,h,w);return S},draw:function(c,h,d,g,m){var y=i(this.points,h,d,g),b=i(this.crossLinePts(h,m),h,d,g);e.arrowShapeImpl(this.name)(c,y,b)}}),l("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(c){return s(c)*.525}}),l("circle",{radius:.15,collide:function(c,h,d,g,m,y,b){var x=m,w=Math.pow(x.x-c,2)+Math.pow(x.y-h,2)<=Math.pow((d+2*b)*this.radius,2);return w},draw:function(c,h,d,g,m){e.arrowShapeImpl(this.name)(c,g.x,g.y,this.radius*h)},spacing:function(c){return e.getArrowWidth(c.pstyle("width").pfValue,c.pstyle("arrow-scale").value)*this.radius}}),l("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(c){return 1},gap:function(c){return 1}}),l("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),l("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(c){return c.pstyle("width").pfValue*c.pstyle("arrow-scale").value}}),l("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(c){return .95*c.pstyle("width").pfValue*c.pstyle("arrow-scale").value}})};var lo={};lo.projectIntoViewport=function(t,e){var r=this.cy,n=this.findContainerClientCoords(),i=n[0],a=n[1],s=n[4],l=r.pan(),o=r.zoom(),c=((t-i)/s-l.x)/o,h=((e-a)/s-l.y)/o;return[c,h]};lo.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var t=this.container,e=t.getBoundingClientRect(),r=this.cy.window().getComputedStyle(t),n=function(w){return parseFloat(r.getPropertyValue(w))},i={left:n("padding-left"),right:n("padding-right"),top:n("padding-top"),bottom:n("padding-bottom")},a={left:n("border-left-width"),right:n("border-right-width"),top:n("border-top-width"),bottom:n("border-bottom-width")},s=t.clientWidth,l=t.clientHeight,o=i.left+i.right,c=i.top+i.bottom,h=a.left+a.right,d=e.width/(s+h),g=s-o,m=l-c,y=e.left+i.left+a.left,b=e.top+i.top+a.top;return this.containerBB=[y,b,g,m,d]};lo.invalidateContainerClientCoordsCache=function(){this.containerBB=null};lo.findNearestElement=function(t,e,r,n){return this.findNearestElements(t,e,r,n)[0]};lo.findNearestElements=function(t,e,r,n){var i=this,a=this,s=a.getCachedZSortedEles(),l=[],o=a.cy.zoom(),c=a.cy.hasCompoundNodes(),h=(n?24:8)/o,d=(n?8:2)/o,g=(n?8:2)/o,m=1/0,y,b;r&&(s=s.interactive);function x(O,N){if(O.isNode()){if(b)return;b=O,l.push(O)}if(O.isEdge()&&(N==null||N<m))if(y){if(y.pstyle("z-compound-depth").value===O.pstyle("z-compound-depth").value&&y.pstyle("z-compound-depth").value===O.pstyle("z-compound-depth").value){for(var B=0;B<l.length;B++)if(l[B].isEdge()){l[B]=O,y=O,m=N??m;break}}}else l.push(O),y=O,m=N??m}function w(O){var N=O.outerWidth()+2*d,B=O.outerHeight()+2*d,D=N/2,_=B/2,P=O.position(),z=O.pstyle("corner-radius").value==="auto"?"auto":O.pstyle("corner-radius").pfValue,H=O._private.rscratch;if(P.x-D<=t&&t<=P.x+D&&P.y-_<=e&&e<=P.y+_){var $=a.nodeShapes[i.getNodeShape(O)];if($.checkPoint(t,e,0,N,B,P.x,P.y,z,H))return x(O,0),!0}}function S(O){var N=O._private,B=N.rscratch,D=O.pstyle("width").pfValue,_=O.pstyle("arrow-scale").value,P=D/2+h,z=P*P,H=P*2,X=N.source,ee=N.target,$;if(B.edgeType==="segments"||B.edgeType==="straight"||B.edgeType==="haystack"){for(var q=B.allpts,V=0;V+3<q.length;V+=2)if(HY(t,e,q[V],q[V+1],q[V+2],q[V+3],H)&&z>($=YY(t,e,q[V],q[V+1],q[V+2],q[V+3])))return x(O,$),!0}else if(B.edgeType==="bezier"||B.edgeType==="multibezier"||B.edgeType==="self"||B.edgeType==="compound"){for(var q=B.allpts,V=0;V+5<B.allpts.length;V+=4)if(VY(t,e,q[V],q[V+1],q[V+2],q[V+3],q[V+4],q[V+5],H)&&z>($=GY(t,e,q[V],q[V+1],q[V+2],q[V+3],q[V+4],q[V+5])))return x(O,$),!0}for(var X=X||N.source,ee=ee||N.target,te=i.getArrowWidth(D,_),I=[{name:"source",x:B.arrowStartX,y:B.arrowStartY,angle:B.srcArrowAngle},{name:"target",x:B.arrowEndX,y:B.arrowEndY,angle:B.tgtArrowAngle},{name:"mid-source",x:B.midX,y:B.midY,angle:B.midsrcArrowAngle},{name:"mid-target",x:B.midX,y:B.midY,angle:B.midtgtArrowAngle}],V=0;V<I.length;V++){var G=I[V],re=a.arrowShapes[O.pstyle(G.name+"-arrow-shape").value],Y=O.pstyle("width").pfValue;if(re.roughCollide(t,e,te,G.angle,{x:G.x,y:G.y},Y,h)&&re.collide(t,e,te,G.angle,{x:G.x,y:G.y},Y,h))return x(O),!0}c&&l.length>0&&(w(X),w(ee))}function k(O,N,B){return Fn(O,N,B)}function E(O,N){var B=O._private,D=g,_;N?_=N+"-":_="",O.boundingBox();var P=B.labelBounds[N||"main"],z=O.pstyle(_+"label").value,H=O.pstyle("text-events").strValue==="yes";if(!(!H||!z)){var $=k(B.rscratch,"labelX",N),q=k(B.rscratch,"labelY",N),V=k(B.rscratch,"labelAngle",N),X=O.pstyle(_+"text-margin-x").pfValue,ee=O.pstyle(_+"text-margin-y").pfValue,te=P.x1-D-X,I=P.x2+D-X,G=P.y1-D-ee,re=P.y2+D-ee;if(V){var Y=Math.cos(V),W=Math.sin(V),Z=function(K,ue){return K=K-$,ue=ue-q,{x:K*Y-ue*W+$,y:K*W+ue*Y+q}},ie=Z(te,G),we=Z(te,re),de=Z(I,G),se=Z(I,re),j=[ie.x+X,ie.y+ee,de.x+X,de.y+ee,se.x+X,se.y+ee,we.x+X,we.y+ee];if(Hn(t,e,j))return x(O),!0}else if(Is(P,t,e))return x(O),!0}}for(var M=s.length-1;M>=0;M--){var R=s[M];R.isNode()?w(R)||E(R):S(R)||E(R)||E(R,"source")||E(R,"target")}return l};lo.getAllInBox=function(t,e,r,n){var i=this.getCachedZSortedEles().interactive,a=this.cy.zoom(),s=2/a,l=[],o=Math.min(t,r),c=Math.max(t,r),h=Math.min(e,n),d=Math.max(e,n);t=o,r=c,e=h,n=d;var g=Rn({x1:t,y1:e,x2:r,y2:n}),m=[{x:g.x1,y:g.y1},{x:g.x2,y:g.y1},{x:g.x2,y:g.y2},{x:g.x1,y:g.y2}],y=[[m[0],m[1]],[m[1],m[2]],[m[2],m[3]],[m[3],m[0]]];function b(K,ue,Se){return Fn(K,ue,Se)}function x(K,ue){var Se=K._private,at=s,Me="";K.boundingBox();var He=Se.labelBounds.main;if(!He)return null;var $e=b(Se.rscratch,"labelX",ue),Ne=b(Se.rscratch,"labelY",ue),Ge=b(Se.rscratch,"labelAngle",ue),Ve=K.pstyle(Me+"text-margin-x").pfValue,Qe=K.pstyle(Me+"text-margin-y").pfValue,je=He.x1-at-Ve,dt=He.x2+at-Ve,ke=He.y1-at-Qe,De=He.y2+at-Qe;if(Ge){var Be=Math.cos(Ge),Ke=Math.sin(Ge),Oe=function(ce,F){return ce=ce-$e,F=F-Ne,{x:ce*Be-F*Ke+$e,y:ce*Ke+F*Be+Ne}};return[Oe(je,ke),Oe(dt,ke),Oe(dt,De),Oe(je,De)]}else return[{x:je,y:ke},{x:dt,y:ke},{x:dt,y:De},{x:je,y:De}]}function w(K,ue,Se,at){function Me(He,$e,Ne){return(Ne.y-He.y)*($e.x-He.x)>($e.y-He.y)*(Ne.x-He.x)}return Me(K,Se,at)!==Me(ue,Se,at)&&Me(K,ue,Se)!==Me(K,ue,at)}for(var S=0;S<i.length;S++){var k=i[S];if(k.isNode()){var E=k,M=E.pstyle("text-events").strValue==="yes",R=E.pstyle("box-selection").strValue,O=E.pstyle("box-select-labels").strValue==="yes";if(R==="none")continue;var N=(R==="overlap"||O)&&M,B=E.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:N});if(R==="contain"){var D=!1;if(O&&M){var _=x(E);_&&qy(_,m)&&(l.push(E),D=!0)}!D&&Iq(g,B)&&l.push(E)}else if(R==="overlap"&&jT(g,B)){var P=E.boundingBox({includeNodes:!0,includeEdges:!0,includeLabels:!1,includeMainLabels:!1,includeSourceLabels:!1,includeTargetLabels:!1}),z=[{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(qy(z,m))l.push(E);else{var H=x(E);H&&qy(H,m)&&l.push(E)}}}else{var $=k,q=$._private,V=q.rscratch,X=$.pstyle("box-selection").strValue;if(X==="none")continue;if(X==="contain"){if(V.startX!=null&&V.startY!=null&&!Is(g,V.startX,V.startY)||V.endX!=null&&V.endY!=null&&!Is(g,V.endX,V.endY))continue;if(V.edgeType==="bezier"||V.edgeType==="multibezier"||V.edgeType==="self"||V.edgeType==="compound"||V.edgeType==="segments"||V.edgeType==="haystack"){for(var ee=q.rstyle.bezierPts||q.rstyle.linePts||q.rstyle.haystackPts,te=!0,I=0;I<ee.length;I++)if(!GD(g,ee[I])){te=!1;break}te&&l.push($)}else V.edgeType==="straight"&&l.push($)}else if(X==="overlap"){var G=!1;if(V.startX!=null&&V.startY!=null&&V.endX!=null&&V.endY!=null&&(Is(g,V.startX,V.startY)||Is(g,V.endX,V.endY)))l.push($),G=!0;else if(!G&&V.edgeType==="haystack"){for(var re=q.rstyle.haystackPts,Y=0;Y<re.length;Y++)if(GD(g,re[Y])){l.push($),G=!0;break}}if(!G){var W=q.rstyle.bezierPts||q.rstyle.linePts||q.rstyle.haystackPts;if((!W||W.length<2)&&V.edgeType==="straight"&&V.startX!=null&&V.startY!=null&&V.endX!=null&&V.endY!=null&&(W=[{x:V.startX,y:V.startY},{x:V.endX,y:V.endY}]),!W||W.length<2)continue;for(var Z=0;Z<W.length-1;Z++){for(var ie=W[Z],we=W[Z+1],de=0;de<y.length;de++){var se=Rr(y[de],2),j=se[0],Q=se[1];if(w(ie,we,j,Q)){l.push($),G=!0;break}}if(G)break}}}}}return l};var wg={};wg.calculateArrowAngles=function(t){var e=t._private.rscratch,r=e.edgeType==="haystack",n=e.edgeType==="bezier",i=e.edgeType==="multibezier",a=e.edgeType==="segments",s=e.edgeType==="compound",l=e.edgeType==="self",o,c,h,d,g,m,w,S;if(r?(h=e.haystackPts[0],d=e.haystackPts[1],g=e.haystackPts[2],m=e.haystackPts[3]):(h=e.arrowStartX,d=e.arrowStartY,g=e.arrowEndX,m=e.arrowEndY),w=e.midX,S=e.midY,a)o=h-e.segpts[0],c=d-e.segpts[1];else if(i||s||l||n){var y=e.allpts,b=Yr(y[0],y[2],y[4],.1),x=Yr(y[1],y[3],y[5],.1);o=h-b,c=d-x}else o=h-w,c=d-S;e.srcArrowAngle=ep(o,c);var w=e.midX,S=e.midY;if(r&&(w=(h+g)/2,S=(d+m)/2),o=g-h,c=m-d,a){var y=e.allpts;if(y.length/2%2===0){var k=y.length/2,E=k-2;o=y[k]-y[E],c=y[k+1]-y[E+1]}else if(e.isRound)o=e.midVector[1],c=-e.midVector[0];else{var k=y.length/2-1,E=k-2;o=y[k]-y[E],c=y[k+1]-y[E+1]}}else if(i||s||l){var y=e.allpts,M=e.ctrlpts,R,O,N,B;if(M.length/2%2===0){var D=y.length/2-1,_=D+2,P=_+2;R=Yr(y[D],y[_],y[P],0),O=Yr(y[D+1],y[_+1],y[P+1],0),N=Yr(y[D],y[_],y[P],1e-4),B=Yr(y[D+1],y[_+1],y[P+1],1e-4)}else{var _=y.length/2-1,D=_-2,P=_+2;R=Yr(y[D],y[_],y[P],.4999),O=Yr(y[D+1],y[_+1],y[P+1],.4999),N=Yr(y[D],y[_],y[P],.5),B=Yr(y[D+1],y[_+1],y[P+1],.5)}o=N-R,c=B-O}if(e.midtgtArrowAngle=ep(o,c),e.midDispX=o,e.midDispY=c,o*=-1,c*=-1,a){var y=e.allpts;if(y.length/2%2!==0){if(!e.isRound){var k=y.length/2-1,z=k+2;o=-(y[z]-y[k]),c=-(y[z+1]-y[k+1])}}}if(e.midsrcArrowAngle=ep(o,c),a)o=g-e.segpts[e.segpts.length-2],c=m-e.segpts[e.segpts.length-1];else if(i||s||l||n){var y=e.allpts,H=y.length,b=Yr(y[H-6],y[H-4],y[H-2],.9),x=Yr(y[H-5],y[H-3],y[H-1],.9);o=g-b,c=m-x}else o=g-w,c=m-S;e.tgtArrowAngle=ep(o,c)};wg.getArrowWidth=wg.getArrowHeight=function(t,e){var r=this.arrowWidthCache=this.arrowWidthCache||{},n=r[t+", "+e];return n||(n=Math.max(Math.pow(t*13.37,.9),29)*e,r[t+", "+e]=n,n)};var dk,pk,ra={},Si={},ON,MN,zl,Up,za,Rl,Bl,Ki,ru,op,_j,Nj,gk,vk,RN,DN=function(e,r,n){n.x=r.x-e.x,n.y=r.y-e.y,n.len=Math.sqrt(n.x*n.x+n.y*n.y),n.nx=n.x/n.len,n.ny=n.y/n.len,n.ang=Math.atan2(n.ny,n.nx)},uK=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},cK=function(e,r,n,i,a){if(e!==RN?DN(r,e,ra):uK(Si,ra),DN(r,n,Si),ON=ra.nx*Si.ny-ra.ny*Si.nx,MN=ra.nx*Si.nx-ra.ny*-Si.ny,za=Math.asin(Math.max(-1,Math.min(1,ON))),Math.abs(za)<1e-6){dk=r.x,pk=r.y,Bl=ru=0;return}zl=1,Up=!1,MN<0?za<0?za=Math.PI+za:(za=Math.PI-za,zl=-1,Up=!0):za>0&&(zl=-1,Up=!0),r.radius!==void 0?ru=r.radius:ru=i,Rl=za/2,op=Math.min(ra.len/2,Si.len/2),a?(Ki=Math.abs(Math.cos(Rl)*ru/Math.sin(Rl)),Ki>op?(Ki=op,Bl=Math.abs(Ki*Math.sin(Rl)/Math.cos(Rl))):Bl=ru):(Ki=Math.min(op,ru),Bl=Math.abs(Ki*Math.sin(Rl)/Math.cos(Rl))),gk=r.x+Si.nx*Ki,vk=r.y+Si.ny*Ki,dk=gk-Si.ny*Bl*zl,pk=vk+Si.nx*Bl*zl,_j=r.x+ra.nx*Ki,Nj=r.y+ra.ny*Ki,RN=r};function Bj(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 ZT(t,e,r,n){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return n===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}:(cK(t,e,r,n,i),{cx:dk,cy:pk,radius:Bl,startX:_j,startY:Nj,stopX:gk,stopY:vk,startAngle:ra.ang+Math.PI/2*zl,endAngle:Si.ang-Math.PI/2*zl,counterClockwise:Up})}var $f=.01,fK=Math.sqrt(2*$f),wn={};wn.findMidptPtsEtc=function(t,e){var r=e.posPts,n=e.intersectionPts,i=e.vectorNormInverse,a,s=t.pstyle("source-endpoint"),l=t.pstyle("target-endpoint"),o=s.units!=null&&l.units!=null,c=function(M,R,O,N){var B=N-R,D=O-M,_=Math.sqrt(D*D+B*B);return{x:-B/_,y:D/_}},h=t.pstyle("edge-distances").value;switch(h){case"node-position":a=r;break;case"intersection":a=n;break;case"endpoints":{if(o){var d=this.manualEndptToPx(t.source()[0],s),g=Rr(d,2),m=g[0],y=g[1],b=this.manualEndptToPx(t.target()[0],l),x=Rr(b,2),w=x[0],S=x[1],k={x1:m,y1:y,x2:w,y2:S};i=c(m,y,w,S),a=k}else jt("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).")),a=n;break}}return{midptPts:a,vectorNormInverse:i}};wn.findHaystackPoints=function(t){for(var e=0;e<t.length;e++){var r=t[e],n=r._private,i=n.rscratch;if(!i.haystack){var a=Math.random()*2*Math.PI;i.source={x:Math.cos(a),y:Math.sin(a)},a=Math.random()*2*Math.PI,i.target={x:Math.cos(a),y:Math.sin(a)}}var s=n.source,l=n.target,o=s.position(),c=l.position(),h=s.width(),d=l.width(),g=s.height(),m=l.height(),y=r.pstyle("haystack-radius").value,b=y/2;i.haystackPts=i.allpts=[i.source.x*h*b+o.x,i.source.y*g*b+o.y,i.target.x*d*b+c.x,i.target.y*m*b+c.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)}};wn.findSegmentsPoints=function(t,e){var r=t._private.rscratch,n=t.pstyle("segment-weights"),i=t.pstyle("segment-distances"),a=t.pstyle("segment-radii"),s=t.pstyle("radius-type"),l=Math.min(n.pfValue.length,i.pfValue.length),o=a.pfValue[a.pfValue.length-1],c=s.pfValue[s.pfValue.length-1];r.edgeType="segments",r.segpts=[],r.radii=[],r.isArcRadius=[];for(var h=0;h<l;h++){var d=n.pfValue[h],g=i.pfValue[h],m=1-d,y=d,b=this.findMidptPtsEtc(t,e),x=b.midptPts,w=b.vectorNormInverse,S={x:x.x1*m+x.x2*y,y:x.y1*m+x.y2*y};r.segpts.push(S.x+w.x*g,S.y+w.y*g),r.radii.push(a.pfValue[h]!==void 0?a.pfValue[h]:o),r.isArcRadius.push((s.pfValue[h]!==void 0?s.pfValue[h]:c)==="arc-radius")}};wn.findLoopPoints=function(t,e,r,n){var i=t._private.rscratch,a=e.dirCounts,s=e.srcPos,l=t.pstyle("control-point-distances"),o=l?l.pfValue[0]:void 0,c=t.pstyle("loop-direction").pfValue,h=t.pstyle("loop-sweep").pfValue,d=t.pstyle("control-point-step-size").pfValue;i.edgeType="self";var g=r,m=d;n&&(g=0,m=o);var y=c-Math.PI/2,b=y-h/2,x=y+h/2,w=c+"_"+h;g=a[w]===void 0?a[w]=0:++a[w],i.ctrlpts=[s.x+Math.cos(b)*1.4*m*(g/3+1),s.y+Math.sin(b)*1.4*m*(g/3+1),s.x+Math.cos(x)*1.4*m*(g/3+1),s.y+Math.sin(x)*1.4*m*(g/3+1)]};wn.findCompoundLoopPoints=function(t,e,r,n){var i=t._private.rscratch;i.edgeType="compound";var a=e.srcPos,s=e.tgtPos,l=e.srcW,o=e.srcH,c=e.tgtW,h=e.tgtH,d=t.pstyle("control-point-step-size").pfValue,g=t.pstyle("control-point-distances"),m=g?g.pfValue[0]:void 0,y=r,b=d;n&&(y=0,b=m);var x=50,w={x:a.x-l/2,y:a.y-o/2},S={x:s.x-c/2,y:s.y-h/2},k={x:Math.min(w.x,S.x),y:Math.min(w.y,S.y)},E=.5,M=Math.max(E,Math.log(l*$f)),R=Math.max(E,Math.log(c*$f));i.ctrlpts=[k.x,k.y-(1+Math.pow(x,1.12)/100)*b*(y/3+1)*M,k.x-(1+Math.pow(x,1.12)/100)*b*(y/3+1)*R,k.y]};wn.findStraightEdgePoints=function(t){t._private.rscratch.edgeType="straight"};wn.findBezierPoints=function(t,e,r,n,i){var a=t._private.rscratch,s=t.pstyle("control-point-step-size").pfValue,l=t.pstyle("control-point-distances"),o=t.pstyle("control-point-weights"),c=l&&o?Math.min(l.value.length,o.value.length):1,h=l?l.pfValue[0]:void 0,d=o.value[0],g=n;a.edgeType=g?"multibezier":"bezier",a.ctrlpts=[];for(var m=0;m<c;m++){var y=(.5-e.eles.length/2+r)*s*(i?-1:1),b=void 0,x=qT(y);g&&(h=l?l.pfValue[m]:s,d=o.value[m]),n?b=h:b=h!==void 0?x*h:void 0;var w=b!==void 0?b:y,S=1-d,k=d,E=this.findMidptPtsEtc(t,e),M=E.midptPts,R=E.vectorNormInverse,O={x:M.x1*S+M.x2*k,y:M.y1*S+M.y2*k};a.ctrlpts.push(O.x+R.x*w,O.y+R.y*w)}};wn.findTaxiPoints=function(t,e){var r=t._private.rscratch;r.edgeType="segments";var n="vertical",i="horizontal",a="leftward",s="rightward",l="downward",o="upward",c="auto",h=e.posPts,d=e.srcW,g=e.srcH,m=e.tgtW,y=e.tgtH,b=t.pstyle("edge-distances").value,x=b!=="node-position",w=t.pstyle("taxi-direction").value,S=w,k=t.pstyle("taxi-turn"),E=k.units==="%",M=k.pfValue,R=M<0,O=t.pstyle("taxi-turn-min-distance").pfValue,N=x?(d+m)/2:0,B=x?(g+y)/2:0,D=h.x2-h.x1,_=h.y2-h.y1,P=function(F,J){return F>0?Math.max(F-J,0):Math.min(F+J,0)},z=P(D,N),H=P(_,B),$=!1;S===c?w=Math.abs(z)>Math.abs(H)?i:n:S===o||S===l?(w=n,$=!0):(S===a||S===s)&&(w=i,$=!0);var q=w===n,V=q?H:z,X=q?_:D,ee=qT(X),te=!1;!($&&(E||R))&&(S===l&&X<0||S===o&&X>0||S===a&&X>0||S===s&&X<0)&&(ee*=-1,V=ee*Math.abs(V),te=!0);var I;if(E){var G=M<0?1+M:M;I=G*V}else{var re=M<0?V:0;I=re+M*ee}var Y=function(F){return Math.abs(F)<O||Math.abs(F)>=Math.abs(V)},W=Y(I),Z=Y(Math.abs(V)-Math.abs(I)),ie=W||Z;if(ie&&!te)if(q){var we=Math.abs(X)<=g/2,de=Math.abs(D)<=m/2;if(we){var se=(h.x1+h.x2)/2,j=h.y1,Q=h.y2;r.segpts=[se,j,se,Q]}else if(de){var K=(h.y1+h.y2)/2,ue=h.x1,Se=h.x2;r.segpts=[ue,K,Se,K]}else r.segpts=[h.x1,h.y2]}else{var at=Math.abs(X)<=d/2,Me=Math.abs(_)<=y/2;if(at){var He=(h.y1+h.y2)/2,$e=h.x1,Ne=h.x2;r.segpts=[$e,He,Ne,He]}else if(Me){var Ge=(h.x1+h.x2)/2,Ve=h.y1,Qe=h.y2;r.segpts=[Ge,Ve,Ge,Qe]}else r.segpts=[h.x2,h.y1]}else if(q){var je=h.y1+I+(x?g/2*ee:0),dt=h.x1,ke=h.x2;r.segpts=[dt,je,ke,je]}else{var De=h.x1+I+(x?d/2*ee:0),Be=h.y1,Ke=h.y2;r.segpts=[De,Be,De,Ke]}if(r.isRound){var Oe=t.pstyle("taxi-radius").value,Re=t.pstyle("radius-type").value[0]==="arc-radius";r.radii=new Array(r.segpts.length/2).fill(Oe),r.isArcRadius=new Array(r.segpts.length/2).fill(Re)}};wn.tryToCorrectInvalidPoints=function(t,e){var r=t._private.rscratch;if(r.edgeType==="bezier"){var n=e.srcPos,i=e.tgtPos,a=e.srcW,s=e.srcH,l=e.tgtW,o=e.tgtH,c=e.srcShape,h=e.tgtShape,d=e.srcCornerRadius,g=e.tgtCornerRadius,m=e.srcRs,y=e.tgtRs,b=!qe(r.startX)||!qe(r.startY),x=!qe(r.arrowStartX)||!qe(r.arrowStartY),w=!qe(r.endX)||!qe(r.endY),S=!qe(r.arrowEndX)||!qe(r.arrowEndY),k=3,E=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth,M=k*E,R=Kl({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.startX,y:r.startY}),O=R<M,N=Kl({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.endX,y:r.endY}),B=N<M,D=!1;if(b||x||O){D=!0;var _={x:r.ctrlpts[0]-n.x,y:r.ctrlpts[1]-n.y},P=Math.sqrt(_.x*_.x+_.y*_.y),z={x:_.x/P,y:_.y/P},H=Math.max(a,s),$={x:r.ctrlpts[0]+z.x*2*H,y:r.ctrlpts[1]+z.y*2*H},q=c.intersectLine(n.x,n.y,a,s,$.x,$.y,0,d,m);O?(r.ctrlpts[0]=r.ctrlpts[0]+z.x*(M-R),r.ctrlpts[1]=r.ctrlpts[1]+z.y*(M-R)):(r.ctrlpts[0]=q[0]+z.x*M,r.ctrlpts[1]=q[1]+z.y*M)}if(w||S||B){D=!0;var V={x:r.ctrlpts[0]-i.x,y:r.ctrlpts[1]-i.y},X=Math.sqrt(V.x*V.x+V.y*V.y),ee={x:V.x/X,y:V.y/X},te=Math.max(a,s),I={x:r.ctrlpts[0]+ee.x*2*te,y:r.ctrlpts[1]+ee.y*2*te},G=h.intersectLine(i.x,i.y,l,o,I.x,I.y,0,g,y);B?(r.ctrlpts[0]=r.ctrlpts[0]+ee.x*(M-N),r.ctrlpts[1]=r.ctrlpts[1]+ee.y*(M-N)):(r.ctrlpts[0]=G[0]+ee.x*M,r.ctrlpts[1]=G[1]+ee.y*M)}D&&this.findEndpoints(t)}};wn.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 n,i;e.ctrlpts.length/2%2===0?(n=e.allpts.length/2-1,e.midX=e.allpts[n],e.midY=e.allpts[n+1]):(n=e.allpts.length/2-3,i=.5,e.midX=Yr(e.allpts[n],e.allpts[n+2],e.allpts[n+4],i),e.midY=Yr(e.allpts[n+1],e.allpts[n+3],e.allpts[n+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 a=2;a+3<e.allpts.length;a+=2){var s=e.radii[a/2-1],l=e.isArcRadius[a/2-1];e.roundCorners.push(ZT({x:e.allpts[a-2],y:e.allpts[a-1]},{x:e.allpts[a],y:e.allpts[a+1],radius:s},{x:e.allpts[a+2],y:e.allpts[a+3]},s,l))}}if(e.segpts.length%4===0){var o=e.segpts.length/2,c=o-2;e.midX=(e.segpts[c]+e.segpts[o])/2,e.midY=(e.segpts[c+1]+e.segpts[o+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 d={x:e.segpts[h],y:e.segpts[h+1]},g=e.roundCorners[h/2];if(g.radius===0){var m={x:e.segpts[h+2],y:e.segpts[h+3]};e.midX=d.x,e.midY=d.y,e.midVector=[d.y-m.y,m.x-d.x]}else{var y=[d.x-g.cx,d.y-g.cy],b=g.radius/Math.sqrt(Math.pow(y[0],2)+Math.pow(y[1],2));y=y.map(function(x){return x*b}),e.midX=g.cx+y[0],e.midY=g.cy+y[1],e.midVector=y}}}}};wn.checkForInvalidEdgeWarning=function(t){var e=t[0]._private.rscratch;e.nodesOverlap||qe(e.startX)&&qe(e.startY)&&qe(e.endX)&&qe(e.endY)?e.loggedErr=!1:e.loggedErr||(e.loggedErr=!0,jt("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."))};wn.findEdgeControlPoints=function(t){var e=this;if(!(!t||t.length===0)){for(var r=this,n=r.cy,i=n.hasCompoundNodes(),a=new Ua,s=function(B,D){return[].concat(fg(B),[D?1:0]).join("-")},l=[],o=[],c=0;c<t.length;c++){var h=t[c],d=h._private,g=h.pstyle("curve-style").value;if(!(h.removed()||!h.takesUpSpace())){if(g==="haystack"){o.push(h);continue}var m=g==="unbundled-bezier"||zs(g,"segments")||g==="straight"||g==="straight-triangle"||zs(g,"taxi"),y=g==="unbundled-bezier"||g==="bezier",b=d.source,x=d.target,w=b.poolIndex(),S=x.poolIndex(),k=[w,S].sort(),E=s(k,m),M=a.get(E);M==null&&(M={eles:[]},l.push({pairId:k,edgeIsUnbundled:m}),a.set(E,M)),M.eles.push(h),m&&(M.hasUnbundled=!0),y&&(M.hasBezier=!0)}}for(var R=function(){var B=l[O],D=B.pairId,_=B.edgeIsUnbundled,P=s(D,_),z=a.get(P),H;if(!z.hasUnbundled){var $=z.eles[0].parallelEdges().filter(function(Re){return Re.isBundledBezier()});zT(z.eles),$.forEach(function(Re){return z.eles.push(Re)}),z.eles.sort(function(Re,ce){return Re.poolIndex()-ce.poolIndex()})}var q=z.eles[0],V=q.source(),X=q.target();if(V.poolIndex()>X.poolIndex()){var ee=V;V=X,X=ee}var te=z.srcPos=V.position(),I=z.tgtPos=X.position(),G=z.srcW=V.outerWidth(),re=z.srcH=V.outerHeight(),Y=z.tgtW=X.outerWidth(),W=z.tgtH=X.outerHeight(),Z=z.srcShape=r.nodeShapes[e.getNodeShape(V)],ie=z.tgtShape=r.nodeShapes[e.getNodeShape(X)],we=z.srcCornerRadius=V.pstyle("corner-radius").value==="auto"?"auto":V.pstyle("corner-radius").pfValue,de=z.tgtCornerRadius=X.pstyle("corner-radius").value==="auto"?"auto":X.pstyle("corner-radius").pfValue,se=z.tgtRs=X._private.rscratch,j=z.srcRs=V._private.rscratch;z.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var Q=0;Q<z.eles.length;Q++){var K=z.eles[Q],ue=K[0]._private.rscratch,Se=K.pstyle("curve-style").value,at=Se==="unbundled-bezier"||zs(Se,"segments")||zs(Se,"taxi"),Me=!V.same(K.source());if(!z.calculatedIntersection&&V!==X&&(z.hasBezier||z.hasUnbundled)){z.calculatedIntersection=!0;var He=Z.intersectLine(te.x,te.y,G,re,I.x,I.y,0,we,j),$e=z.srcIntn=He,Ne=ie.intersectLine(I.x,I.y,Y,W,te.x,te.y,0,de,se),Ge=z.tgtIntn=Ne,Ve=z.intersectionPts={x1:He[0],x2:Ne[0],y1:He[1],y2:Ne[1]},Qe=z.posPts={x1:te.x,x2:I.x,y1:te.y,y2:I.y},je=Ne[1]-He[1],dt=Ne[0]-He[0],ke=Math.sqrt(dt*dt+je*je);qe(ke)&&ke>=fK||(ke=Math.sqrt(Math.max(dt*dt,$f)+Math.max(je*je,$f)));var De=z.vector={x:dt,y:je},Be=z.vectorNorm={x:De.x/ke,y:De.y/ke},Ke={x:-Be.y,y:Be.x};z.nodesOverlap=!qe(ke)||ie.checkPoint(He[0],He[1],0,Y,W,I.x,I.y,de,se)||Z.checkPoint(Ne[0],Ne[1],0,G,re,te.x,te.y,we,j),z.vectorNormInverse=Ke,H={nodesOverlap:z.nodesOverlap,dirCounts:z.dirCounts,calculatedIntersection:!0,hasBezier:z.hasBezier,hasUnbundled:z.hasUnbundled,eles:z.eles,srcPos:I,srcRs:se,tgtPos:te,tgtRs:j,srcW:Y,srcH:W,tgtW:G,tgtH:re,srcIntn:Ge,tgtIntn:$e,srcShape:ie,tgtShape:Z,posPts:{x1:Qe.x2,y1:Qe.y2,x2:Qe.x1,y2:Qe.y1},intersectionPts:{x1:Ve.x2,y1:Ve.y2,x2:Ve.x1,y2:Ve.y1},vector:{x:-De.x,y:-De.y},vectorNorm:{x:-Be.x,y:-Be.y},vectorNormInverse:{x:-Ke.x,y:-Ke.y}}}var Oe=Me?H:z;ue.nodesOverlap=Oe.nodesOverlap,ue.srcIntn=Oe.srcIntn,ue.tgtIntn=Oe.tgtIntn,ue.isRound=Se.startsWith("round"),i&&(V.isParent()||V.isChild()||X.isParent()||X.isChild())&&(V.parents().anySame(X)||X.parents().anySame(V)||V.same(X)&&V.isParent())?e.findCompoundLoopPoints(K,Oe,Q,at):V===X?e.findLoopPoints(K,Oe,Q,at):Se.endsWith("segments")?e.findSegmentsPoints(K,Oe):Se.endsWith("taxi")?e.findTaxiPoints(K,Oe):Se==="straight"||!at&&z.eles.length%2===1&&Q===Math.floor(z.eles.length/2)?e.findStraightEdgePoints(K):e.findBezierPoints(K,Oe,Q,at,Me),e.findEndpoints(K),e.tryToCorrectInvalidPoints(K,Oe),e.checkForInvalidEdgeWarning(K),e.storeAllpts(K),e.storeEdgeProjections(K),e.calculateArrowAngles(K),e.recalculateEdgeLabelProjections(K),e.calculateLabelAngles(K)}},O=0;O<l.length;O++)R();this.findHaystackPoints(o)}};function Lj(t){var e=[];if(t!=null){for(var r=0;r<t.length;r+=2){var n=t[r],i=t[r+1];e.push({x:n,y:i})}return e}}wn.getSegmentPoints=function(t){var e=t[0]._private.rscratch;this.recalculateRenderedStyle(t);var r=e.edgeType;if(r==="segments")return Lj(e.segpts)};wn.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 Lj(e.ctrlpts)};wn.getEdgeMidpoint=function(t){var e=t[0]._private.rscratch;return this.recalculateRenderedStyle(t),{x:e.midX,y:e.midY}};var xh={};xh.manualEndptToPx=function(t,e){var r=this,n=t.position(),i=t.outerWidth(),a=t.outerHeight(),s=t._private.rscratch;if(e.value.length===2){var l=[e.pfValue[0],e.pfValue[1]];return e.units[0]==="%"&&(l[0]=l[0]*i),e.units[1]==="%"&&(l[1]=l[1]*a),l[0]+=n.x,l[1]+=n.y,l}else{var o=e.pfValue[0];o=-Math.PI/2+o;var c=2*Math.max(i,a),h=[n.x+Math.cos(o)*c,n.y+Math.sin(o)*c];return r.nodeShapes[this.getNodeShape(t)].intersectLine(n.x,n.y,i,a,h[0],h[1],0,t.pstyle("corner-radius").value==="auto"?"auto":t.pstyle("corner-radius").pfValue,s)}};xh.findEndpoints=function(t){var e,r,n,i,a=this,s,l=t.source()[0],o=t.target()[0],c=l.position(),h=o.position(),d=t.pstyle("target-arrow-shape").value,g=t.pstyle("source-arrow-shape").value,m=t.pstyle("target-distance-from-node").pfValue,y=t.pstyle("source-distance-from-node").pfValue,b=l._private.rscratch,x=o._private.rscratch,w=t.pstyle("curve-style").value,S=t._private.rscratch,k=S.edgeType,E=zs(w,"taxi"),M=k==="self"||k==="compound",R=k==="bezier"||k==="multibezier"||M,O=k!=="bezier",N=k==="straight"||k==="segments",B=k==="segments",D=R||O||N,_=M||E,P=t.pstyle("source-endpoint"),z=_?"outside-to-node":P.value,H=l.pstyle("corner-radius").value==="auto"?"auto":l.pstyle("corner-radius").pfValue,$=t.pstyle("target-endpoint"),q=_?"outside-to-node":$.value,V=o.pstyle("corner-radius").value==="auto"?"auto":o.pstyle("corner-radius").pfValue;S.srcManEndpt=P,S.tgtManEndpt=$;var X,ee,te,I,G=(e=($==null||(r=$.pfValue)===null||r===void 0?void 0:r.length)===2?$.pfValue:null)!==null&&e!==void 0?e:[0,0],re=(n=(P==null||(i=P.pfValue)===null||i===void 0?void 0:i.length)===2?P.pfValue:null)!==null&&n!==void 0?n:[0,0];if(R){var Y=[S.ctrlpts[0],S.ctrlpts[1]],W=O?[S.ctrlpts[S.ctrlpts.length-2],S.ctrlpts[S.ctrlpts.length-1]]:Y;X=W,ee=Y}else if(N){var Z=B?S.segpts.slice(0,2):[h.x+G[0],h.y+G[1]],ie=B?S.segpts.slice(S.segpts.length-2):[c.x+re[0],c.y+re[1]];X=ie,ee=Z}if(q==="inside-to-node")s=[h.x,h.y];else if($.units)s=this.manualEndptToPx(o,$);else if(q==="outside-to-line")s=S.tgtIntn;else if(q==="outside-to-node"||q==="outside-to-node-or-label"?te=X:(q==="outside-to-line"||q==="outside-to-line-or-label")&&(te=[c.x,c.y]),s=a.nodeShapes[this.getNodeShape(o)].intersectLine(h.x,h.y,o.outerWidth(),o.outerHeight(),te[0],te[1],0,V,x),q==="outside-to-node-or-label"||q==="outside-to-line-or-label"){var we=o._private.rscratch,de=we.labelWidth,se=we.labelHeight,j=we.labelX,Q=we.labelY,K=de/2,ue=se/2,Se=o.pstyle("text-valign").value;Se==="top"?Q-=ue:Se==="bottom"&&(Q+=ue);var at=o.pstyle("text-halign").value;at==="left"?j-=K:at==="right"&&(j+=K);var Me=jf(te[0],te[1],[j-K,Q-ue,j+K,Q-ue,j+K,Q+ue,j-K,Q+ue],h.x,h.y);if(Me.length>0){var He=c,$e=Nl(He,pu(s)),Ne=Nl(He,pu(Me)),Ge=$e;if(Ne<$e&&(s=Me,Ge=Ne),Me.length>2){var Ve=Nl(He,{x:Me[2],y:Me[3]});Ve<Ge&&(s=[Me[2],Me[3]])}}}var Qe=tp(s,X,a.arrowShapes[d].spacing(t)+m),je=tp(s,X,a.arrowShapes[d].gap(t)+m);if(S.endX=je[0],S.endY=je[1],S.arrowEndX=Qe[0],S.arrowEndY=Qe[1],z==="inside-to-node")s=[c.x,c.y];else if(P.units)s=this.manualEndptToPx(l,P);else if(z==="outside-to-line")s=S.srcIntn;else if(z==="outside-to-node"||z==="outside-to-node-or-label"?I=ee:(z==="outside-to-line"||z==="outside-to-line-or-label")&&(I=[h.x,h.y]),s=a.nodeShapes[this.getNodeShape(l)].intersectLine(c.x,c.y,l.outerWidth(),l.outerHeight(),I[0],I[1],0,H,b),z==="outside-to-node-or-label"||z==="outside-to-line-or-label"){var dt=l._private.rscratch,ke=dt.labelWidth,De=dt.labelHeight,Be=dt.labelX,Ke=dt.labelY,Oe=ke/2,Re=De/2,ce=l.pstyle("text-valign").value;ce==="top"?Ke-=Re:ce==="bottom"&&(Ke+=Re);var F=l.pstyle("text-halign").value;F==="left"?Be-=Oe:F==="right"&&(Be+=Oe);var J=jf(I[0],I[1],[Be-Oe,Ke-Re,Be+Oe,Ke-Re,Be+Oe,Ke+Re,Be-Oe,Ke+Re],c.x,c.y);if(J.length>0){var oe=h,le=Nl(oe,pu(s)),he=Nl(oe,pu(J)),_e=le;if(he<le&&(s=[J[0],J[1]],_e=he),J.length>2){var be=Nl(oe,{x:J[2],y:J[3]});be<_e&&(s=[J[2],J[3]])}}}var ze=tp(s,ee,a.arrowShapes[g].spacing(t)+y),Le=tp(s,ee,a.arrowShapes[g].gap(t)+y);S.startX=Le[0],S.startY=Le[1],S.arrowStartX=ze[0],S.arrowStartY=ze[1],D&&(!qe(S.startX)||!qe(S.startY)||!qe(S.endX)||!qe(S.endY)?S.badLine=!0:S.badLine=!1)};xh.getSourceEndpoint=function(t){var e=t[0]._private.rscratch;return this.recalculateRenderedStyle(t),e.edgeType==="haystack"?{x:e.haystackPts[0],y:e.haystackPts[1]}:{x:e.arrowStartX,y:e.arrowStartY}};xh.getTargetEndpoint=function(t){var e=t[0]._private.rscratch;return this.recalculateRenderedStyle(t),e.edgeType==="haystack"?{x:e.haystackPts[2],y:e.haystackPts[3]}:{x:e.arrowEndX,y:e.arrowEndY}};var JT={};function hK(t,e,r){for(var n=function(c,h,d,g){return Yr(c,h,d,g)},i=e._private,a=i.rstyle.bezierPts,s=0;s<t.bezierProjPcts.length;s++){var l=t.bezierProjPcts[s];a.push({x:n(r[0],r[2],r[4],l),y:n(r[1],r[3],r[5],l)})}}JT.storeEdgeProjections=function(t){var e=t._private,r=e.rscratch,n=r.edgeType;if(e.rstyle.bezierPts=null,e.rstyle.linePts=null,e.rstyle.haystackPts=null,n==="multibezier"||n==="bezier"||n==="self"||n==="compound"){e.rstyle.bezierPts=[];for(var i=0;i+5<r.allpts.length;i+=4)hK(this,t,r.allpts.slice(i,i+6))}else if(n==="segments")for(var a=e.rstyle.linePts=[],i=0;i+1<r.allpts.length;i+=2)a.push({x:r.allpts[i],y:r.allpts[i+1]});else if(n==="haystack"){var s=r.haystackPts;e.rstyle.haystackPts=[{x:s[0],y:s[1]},{x:s[2],y:s[3]}]}e.rstyle.arrowWidth=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth};JT.recalculateEdgeProjections=function(t){this.findEdgeControlPoints(t)};var pa={};pa.recalculateNodeLabelProjection=function(t){var e=t.pstyle("label").strValue;if(!Ys(e)){var r,n,i=t._private,a=t.width(),s=t.height(),l=t.padding(),o=t.position(),c=t.pstyle("text-halign").strValue,h=t.pstyle("text-valign").strValue,d=i.rscratch,g=i.rstyle;switch(c){case"left":r=o.x-a/2-l;break;case"right":r=o.x+a/2+l;break;default:r=o.x}switch(h){case"top":n=o.y-s/2-l;break;case"bottom":n=o.y+s/2+l;break;default:n=o.y}d.labelX=r,d.labelY=n,g.labelX=r,g.labelY=n,this.calculateLabelAngles(t),this.applyLabelDimensions(t)}};var Pj=function(e,r){var n=Math.atan(r/e);return e===0&&n<0&&(n=n*-1),n},zj=function(e,r){var n=r.x-e.x,i=r.y-e.y;return Pj(n,i)},dK=function(e,r,n,i){var a=qf(0,i-.001,1),s=qf(0,i+.001,1),l=wu(e,r,n,a),o=wu(e,r,n,s);return zj(l,o)};pa.recalculateEdgeLabelProjections=function(t){var e,r=t._private,n=r.rscratch,i=this,a={mid:t.pstyle("label").strValue,source:t.pstyle("source-label").strValue,target:t.pstyle("target-label").strValue};if(a.mid||a.source||a.target){e={x:n.midX,y:n.midY};var s=function(d,g,m){qa(r.rscratch,d,g,m),qa(r.rstyle,d,g,m)};s("labelX",null,e.x),s("labelY",null,e.y);var l=Pj(n.midDispX,n.midDispY);s("labelAutoAngle",null,l);var o=function(){if(o.cache)return o.cache;for(var d=[],g=0;g+5<n.allpts.length;g+=4){var m={x:n.allpts[g],y:n.allpts[g+1]},y={x:n.allpts[g+2],y:n.allpts[g+3]},b={x:n.allpts[g+4],y:n.allpts[g+5]};d.push({p0:m,p1:y,p2:b,startDist:0,length:0,segments:[]})}var x=r.rstyle.bezierPts,w=i.bezierProjPcts.length;function S(O,N,B,D,_){var P=Kl(N,B),z=O.segments[O.segments.length-1],H={p0:N,p1:B,t0:D,t1:_,startDist:z?z.startDist+z.length:0,length:P};O.segments.push(H),O.length+=P}for(var k=0;k<d.length;k++){var E=d[k],M=d[k-1];M&&(E.startDist=M.startDist+M.length),S(E,E.p0,x[k*w],0,i.bezierProjPcts[0]);for(var R=0;R<w-1;R++)S(E,x[k*w+R],x[k*w+R+1],i.bezierProjPcts[R],i.bezierProjPcts[R+1]);S(E,x[k*w+w-1],E.p2,i.bezierProjPcts[w-1],1)}return o.cache=d},c=function(d){var g,m=d==="source";if(a[d]){var y=t.pstyle(d+"-text-offset").pfValue;switch(n.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var b=o(),x,w=0,S=0,k=0;k<b.length;k++){for(var E=b[m?k:b.length-1-k],M=0;M<E.segments.length;M++){var R=E.segments[m?M:E.segments.length-1-M],O=k===b.length-1&&M===E.segments.length-1;if(w=S,S+=R.length,S>=y||O){x={cp:E,segment:R};break}}if(x)break}var N=x.cp,B=x.segment,D=(y-w)/B.length,_=B.t1-B.t0,P=m?B.t0+_*D:B.t1-_*D;P=qf(0,P,1),e=wu(N.p0,N.p1,N.p2,P),g=dK(N.p0,N.p1,N.p2,P);break}case"straight":case"segments":case"haystack":{for(var z=0,H,$,q,V,X=n.allpts.length,ee=0;ee+3<X&&(m?(q={x:n.allpts[ee],y:n.allpts[ee+1]},V={x:n.allpts[ee+2],y:n.allpts[ee+3]}):(q={x:n.allpts[X-2-ee],y:n.allpts[X-1-ee]},V={x:n.allpts[X-4-ee],y:n.allpts[X-3-ee]}),H=Kl(q,V),$=z,z+=H,!(z>=y));ee+=2);var te=y-$,I=te/H;I=qf(0,I,1),e=LY(q,V,I),g=zj(q,V);break}}s("labelX",d,e.x),s("labelY",d,e.y),s("labelAutoAngle",d,g)}};c("source"),c("target"),this.applyLabelDimensions(t)}};pa.applyLabelDimensions=function(t){this.applyPrefixedLabelDimensions(t),t.isEdge()&&(this.applyPrefixedLabelDimensions(t,"source"),this.applyPrefixedLabelDimensions(t,"target"))};pa.applyPrefixedLabelDimensions=function(t,e){var r=t._private,n=this.getLabelText(t,e),i=Ql(n,t._private.labelDimsKey);if(Fn(r.rscratch,"prefixedLabelDimsKey",e)!==i){qa(r.rscratch,"prefixedLabelDimsKey",e,i);var a=this.calculateLabelDimensions(t,n),s=t.pstyle("line-height").pfValue,l=t.pstyle("text-wrap").strValue,o=Fn(r.rscratch,"labelWrapCachedLines",e)||[],c=l!=="wrap"?1:Math.max(o.length,1),h=a.height/c,d=h*s,g=a.width,m=a.height+(c-1)*(s-1)*h;qa(r.rstyle,"labelWidth",e,g),qa(r.rscratch,"labelWidth",e,g),qa(r.rstyle,"labelHeight",e,m),qa(r.rscratch,"labelHeight",e,m),qa(r.rscratch,"labelLineHeight",e,d)}};pa.getLabelText=function(t,e){var r=t._private,n=e?e+"-":"",i=t.pstyle(n+"label").strValue,a=t.pstyle("text-transform").value,s=function(re,Y){return Y?(qa(r.rscratch,re,e,Y),Y):Fn(r.rscratch,re,e)};if(!i)return"";a=="none"||(a=="uppercase"?i=i.toUpperCase():a=="lowercase"&&(i=i.toLowerCase()));var l=t.pstyle("text-wrap").value;if(l==="wrap"){var o=s("labelKey");if(o!=null&&s("labelWrapKey")===o)return s("labelWrapCachedText");for(var c="​",h=i.split(`
44
+ `),d=t.pstyle("text-max-width").pfValue,g=t.pstyle("text-overflow-wrap").value,m=g==="anywhere",y=[],b=/[\s\u200b]+|$/g,x=0;x<h.length;x++){var w=h[x],S=this.calculateLabelDimensions(t,w),k=S.width;if(m){var E=w.split("").join(c);w=E}if(k>d){var M=w.matchAll(b),R="",O=0,N=Yn(M),B;try{for(N.s();!(B=N.n()).done;){var D=B.value,_=D[0],P=w.substring(O,D.index);O=D.index+_.length;var z=R.length===0?P:R+P+_,H=this.calculateLabelDimensions(t,z),$=H.width;$<=d?R+=P+_:(R&&y.push(R),R=P+_)}}catch(G){N.e(G)}finally{N.f()}R.match(/^[\s\u200b]+$/)||y.push(R)}else y.push(w)}s("labelWrapCachedLines",y),i=s("labelWrapCachedText",y.join(`
45
+ `)),s("labelWrapKey",o)}else if(l==="ellipsis"){var q=t.pstyle("text-max-width").pfValue,V="",X="…",ee=!1;if(this.calculateLabelDimensions(t,i).width<q)return i;for(var te=0;te<i.length;te++){var I=this.calculateLabelDimensions(t,V+i[te]+X).width;if(I>q)break;V+=i[te],te===i.length-1&&(ee=!0)}return ee||(V+=X),V}return i};pa.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};pa.calculateLabelDimensions=function(t,e){var r=this,n=r.cy.window(),i=n.document,a=0,s=t.pstyle("font-style").strValue,l=t.pstyle("font-size").pfValue,o=t.pstyle("font-family").strValue,c=t.pstyle("font-weight").strValue,h=this.labelCalcCanvas,d=this.labelCalcCanvasContext;if(!h){h=this.labelCalcCanvas=i.createElement("canvas"),d=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"}d.font="".concat(s," ").concat(c," ").concat(l,"px ").concat(o);for(var m=0,y=0,b=e.split(`
46
+ `),x=0;x<b.length;x++){var w=b[x],S=d.measureText(w),k=Math.ceil(S.width),E=l;m=Math.max(k,m),y+=E}return m+=a,y+=a,{width:m,height:y}};pa.calculateLabelAngle=function(t,e){var r=t._private,n=r.rscratch,i=t.isEdge(),a=e?e+"-":"",s=t.pstyle(a+"text-rotation"),l=s.strValue;return l==="none"?0:i&&l==="autorotate"?n.labelAutoAngle:l==="autorotate"?0:s.pfValue};pa.calculateLabelAngles=function(t){var e=this,r=t.isEdge(),n=t._private,i=n.rscratch;i.labelAngle=e.calculateLabelAngle(t),r&&(i.sourceLabelAngle=e.calculateLabelAngle(t,"source"),i.targetLabelAngle=e.calculateLabelAngle(t,"target"))};var Ij={},_N=28,NN=!1;Ij.getNodeShape=function(t){var e=this,r=t.pstyle("shape").value;if(r==="cutrectangle"&&(t.width()<_N||t.height()<_N))return NN||(jt("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),NN=!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 n=t.pstyle("shape-polygon-points").value;return e.nodeShapes.makePolygon(n).name}return r};var xv={};xv.registerCalculationListeners=function(){var t=this.cy,e=t.collection(),r=this,n=function(s){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(s),l)for(var o=0;o<s.length;o++){var c=s[o],h=c._private,d=h.rstyle;d.clean=!1,d.cleanConnected=!1}};r.binder(t).on("bounds.* dirty.*",function(s){var l=s.target;n(l)}).on("style.* background.*",function(s){var l=s.target;n(l,!1)});var i=function(s){if(s){var l=r.onUpdateEleCalcsFns;e.cleanStyle();for(var o=0;o<e.length;o++){var c=e[o],h=c._private.rstyle;c.isNode()&&!h.cleanConnected&&(n(c.connectedEdges()),h.cleanConnected=!0)}if(l)for(var d=0;d<l.length;d++){var g=l[d];g(s,e)}r.recalculateRenderedStyle(e),e=t.collection()}};r.flushRenderedStyleQueue=function(){i(!0)},r.beforeRender(i,r.beforeRenderPriorities.eleCalcs)};xv.onUpdateEleCalcs=function(t){var e=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];e.push(t)};xv.recalculateRenderedStyle=function(t,e){var r=function(E){return E._private.rstyle.cleanConnected};if(t.length!==0){var n=[],i=[];if(!this.destroyed){e===void 0&&(e=!0);for(var a=0;a<t.length;a++){var s=t[a],l=s._private,o=l.rstyle;s.isEdge()&&(!r(s.source())||!r(s.target()))&&(o.clean=!1),s.isEdge()&&s.isBundledBezier()&&s.parallelEdges().some(function(k){return!k._private.rstyle.clean&&k.isBundledBezier()})&&(o.clean=!1),!(e&&o.clean||s.removed())&&s.pstyle("display").value!=="none"&&(l.group==="nodes"?i.push(s):n.push(s),o.clean=!0)}for(var c=0;c<i.length;c++){var h=i[c],d=h._private,g=d.rstyle,m=h.position();this.recalculateNodeLabelProjection(h),g.nodeX=m.x,g.nodeY=m.y,g.nodeW=h.pstyle("width").pfValue,g.nodeH=h.pstyle("height").pfValue}this.recalculateEdgeProjections(n);for(var y=0;y<n.length;y++){var b=n[y],x=b._private,w=x.rstyle,S=x.rscratch;w.srcX=S.arrowStartX,w.srcY=S.arrowStartY,w.tgtX=S.arrowEndX,w.tgtY=S.arrowEndY,w.midX=S.midX,w.midY=S.midY,w.labelAngle=S.labelAngle,w.sourceLabelAngle=S.sourceLabelAngle,w.targetLabelAngle=S.targetLabelAngle}}}};var wv={};wv.updateCachedGrabbedEles=function(){var t=this.cachedZSortedEles;if(t){t.drag=[],t.nondrag=[];for(var e=[],r=0;r<t.length;r++){var n=t[r],i=n._private.rscratch;n.grabbed()&&!n.isParent()?e.push(n):i.inDragLayer?t.drag.push(n):t.nondrag.push(n)}for(var r=0;r<e.length;r++){var n=e[r];t.drag.push(n)}}};wv.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null};wv.getCachedZSortedEles=function(t){if(t||!this.cachedZSortedEles){var e=this.cy.mutableElements().toArray();e.sort(bj),e.interactive=e.filter(function(r){return r.interactive()}),this.cachedZSortedEles=e,this.updateCachedGrabbedEles()}else e=this.cachedZSortedEles;return e};var qj={};[lo,wg,wn,xh,JT,pa,Ij,xv,wv].forEach(function(t){ft(qj,t)});var jj={};jj.getCachedImage=function(t,e,r){var n=this,i=n.imageCache=n.imageCache||{},a=i[t];if(a)return a.image.complete||a.image.addEventListener("load",r),a.image;a=i[t]=i[t]||{};var s=a.image=new Image;s.addEventListener("load",r),s.addEventListener("error",function(){s.error=!0});var l="data:",o=t.substring(0,l.length).toLowerCase()===l;return o||(e=e==="null"?null:e,s.crossOrigin=e),s.src=t,s};var Wu={};Wu.registerBinding=function(t,e,r,n){var i=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(t)){for(var a=[],s=0;s<t.length;s++){var l=t[s];if(l!==void 0){var o=this.binder(l);a.push(o.on.apply(o,i))}}return a}var o=this.binder(t);return o.on.apply(o,i)};Wu.binder=function(t){var e=this,r=e.cy.window(),n=t===r||t===r.document||t===r.document.body||TG(t);if(e.supportsPassiveEvents==null){var i=!1;try{var a=Object.defineProperty({},"passive",{get:function(){return i=!0,!0}});r.addEventListener("test",null,a)}catch{}e.supportsPassiveEvents=i}var s=function(o,c,h){var d=Array.prototype.slice.call(arguments);return n&&e.supportsPassiveEvents&&(d[2]={capture:h??!1,passive:!1,once:!1}),e.bindings.push({target:t,args:d}),(t.addEventListener||t.on).apply(t,d),this};return{on:s,addEventListener:s,addListener:s,bind:s}};Wu.nodeIsDraggable=function(t){return t&&t.isNode()&&!t.locked()&&t.grabbable()};Wu.nodeIsGrabbable=function(t){return this.nodeIsDraggable(t)&&t.interactive()};Wu.load=function(){var t=this,e=t.cy.window(),r=function(F){return F.selected()},n=function(F){var J=F.getRootNode();if(J&&J.nodeType===11&&J.host!==void 0)return J},i=function(F,J,oe,le){F==null&&(F=t.cy);for(var he=0;he<J.length;he++){var _e=J[he];F.emit({originalEvent:oe,type:_e,position:le})}},a=function(F){return F.shiftKey||F.metaKey||F.ctrlKey},s=function(F,J){var oe=!0;if(t.cy.hasCompoundNodes()&&F&&F.pannable())for(var le=0;J&&le<J.length;le++){var F=J[le];if(F.isNode()&&F.isParent()&&!F.pannable()){oe=!1;break}}else oe=!0;return oe},l=function(F){F[0]._private.grabbed=!0},o=function(F){F[0]._private.grabbed=!1},c=function(F){F[0]._private.rscratch.inDragLayer=!0},h=function(F){F[0]._private.rscratch.inDragLayer=!1},d=function(F){F[0]._private.rscratch.isGrabTarget=!0},g=function(F){F[0]._private.rscratch.isGrabTarget=!1},m=function(F,J){var oe=J.addToList,le=oe.has(F);!le&&F.grabbable()&&!F.locked()&&(oe.merge(F),l(F))},y=function(F,J){if(F.cy().hasCompoundNodes()&&!(J.inDragLayer==null&&J.addToList==null)){var oe=F.descendants();J.inDragLayer&&(oe.forEach(c),oe.connectedEdges().forEach(c)),J.addToList&&m(oe,J)}},b=function(F,J){J=J||{};var oe=F.cy().hasCompoundNodes();J.inDragLayer&&(F.forEach(c),F.neighborhood().stdFilter(function(le){return!oe||le.isEdge()}).forEach(c)),J.addToList&&F.forEach(function(le){m(le,J)}),y(F,J),S(F,{inDragLayer:J.inDragLayer}),t.updateCachedGrabbedEles()},x=b,w=function(F){F&&(t.getCachedZSortedEles().forEach(function(J){o(J),h(J),g(J)}),t.updateCachedGrabbedEles())},S=function(F,J){if(!(J.inDragLayer==null&&J.addToList==null)&&F.cy().hasCompoundNodes()){var oe=F.ancestors().orphans();if(!oe.same(F)){var le=oe.descendants().spawnSelf().merge(oe).unmerge(F).unmerge(F.descendants()),he=le.connectedEdges();J.inDragLayer&&(he.forEach(c),le.forEach(c)),J.addToList&&le.forEach(function(_e){m(_e,J)})}}},k=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},E=typeof MutationObserver<"u",M=typeof ResizeObserver<"u";E?(t.removeObserver=new MutationObserver(function(ce){for(var F=0;F<ce.length;F++){var J=ce[F],oe=J.removedNodes;if(oe)for(var le=0;le<oe.length;le++){var he=oe[le];if(he===t.container){t.destroy();break}}}}),t.container.parentNode&&t.removeObserver.observe(t.container.parentNode,{childList:!0})):t.registerBinding(t.container,"DOMNodeRemoved",function(ce){t.destroy()});var R=vh(function(){t.cy.resize()},100);E&&(t.styleObserver=new MutationObserver(R),t.styleObserver.observe(t.container,{attributes:!0})),t.registerBinding(e,"resize",R),M&&(t.resizeObserver=new ResizeObserver(R),t.resizeObserver.observe(t.container));var O=function(F,J){for(;F!=null;)J(F),F=F.parentNode},N=function(){t.invalidateContainerClientCoordsCache()};O(t.container,function(ce){t.registerBinding(ce,"transitionend",N),t.registerBinding(ce,"animationend",N),t.registerBinding(ce,"scroll",N)}),t.registerBinding(t.container,"contextmenu",function(ce){ce.preventDefault()});var B=function(){return t.selection[4]!==0},D=function(F){for(var J=t.findContainerClientCoords(),oe=J[0],le=J[1],he=J[2],_e=J[3],be=F.touches?F.touches:[F],ze=!1,Le=0;Le<be.length;Le++){var Pe=be[Le];if(oe<=Pe.clientX&&Pe.clientX<=oe+he&&le<=Pe.clientY&&Pe.clientY<=le+_e){ze=!0;break}}if(!ze)return!1;for(var Ye=t.container,et=F.target,Ie=et.parentNode,nt=!1;Ie;){if(Ie===Ye){nt=!0;break}Ie=Ie.parentNode}return!!nt};t.registerBinding(t.container,"mousedown",function(F){if(D(F)&&!(t.hoverData.which===1&&F.which!==1)){F.preventDefault(),k(),t.hoverData.capture=!0,t.hoverData.which=F.which;var J=t.cy,oe=[F.clientX,F.clientY],le=t.projectIntoViewport(oe[0],oe[1]),he=t.selection,_e=t.findNearestElements(le[0],le[1],!0,!1),be=_e[0],ze=t.dragData.possibleDragElements;t.hoverData.mdownPos=le,t.hoverData.mdownGPos=oe;var Le=function(rt){return{originalEvent:F,type:rt,position:{x:le[0],y:le[1]}}},Pe=function(){t.hoverData.tapholdCancelled=!1,clearTimeout(t.hoverData.tapholdTimeout),t.hoverData.tapholdTimeout=setTimeout(function(){if(!t.hoverData.tapholdCancelled){var rt=t.hoverData.down;rt?rt.emit(Le("taphold")):J.emit(Le("taphold"))}},t.tapholdDuration)};if(F.which==3){t.hoverData.cxtStarted=!0;var Ye={originalEvent:F,type:"cxttapstart",position:{x:le[0],y:le[1]}};be?(be.activate(),be.emit(Ye),t.hoverData.down=be):J.emit(Ye),t.hoverData.downTime=new Date().getTime(),t.hoverData.cxtDragged=!1}else if(F.which==1){be&&be.activate();{if(be!=null&&t.nodeIsGrabbable(be)){var et=function(rt){rt.emit(Le("grab"))};if(d(be),!be.selected())ze=t.dragData.possibleDragElements=J.collection(),x(be,{addToList:ze}),be.emit(Le("grabon")).emit(Le("grab"));else{ze=t.dragData.possibleDragElements=J.collection();var Ie=J.$(function(nt){return nt.isNode()&&nt.selected()&&t.nodeIsGrabbable(nt)});b(Ie,{addToList:ze}),be.emit(Le("grabon")),Ie.forEach(et)}t.redrawHint("eles",!0),t.redrawHint("drag",!0)}t.hoverData.down=be,t.hoverData.downs=_e,t.hoverData.downTime=new Date().getTime()}i(be,["mousedown","tapstart","vmousedown"],F,{x:le[0],y:le[1]}),be==null?(he[4]=1,t.data.bgActivePosistion={x:le[0],y:le[1]},t.redrawHint("select",!0),t.redraw()):be.pannable()&&(he[4]=1),Pe()}he[0]=he[2]=le[0],he[1]=he[3]=le[1]}},!1);var _=n(t.container);t.registerBinding([e,_],"mousemove",function(F){var J=t.hoverData.capture;if(!(!J&&!D(F))){var oe=!1,le=t.cy,he=le.zoom(),_e=[F.clientX,F.clientY],be=t.projectIntoViewport(_e[0],_e[1]),ze=t.hoverData.mdownPos,Le=t.hoverData.mdownGPos,Pe=t.selection,Ye=null;!t.hoverData.draggingEles&&!t.hoverData.dragging&&!t.hoverData.selecting&&(Ye=t.findNearestElement(be[0],be[1],!0,!1));var et=t.hoverData.last,Ie=t.hoverData.down,nt=[be[0]-Pe[2],be[1]-Pe[3]],rt=t.dragData.possibleDragElements,ct;if(Le){var Ze=_e[0]-Le[0],vt=Ze*Ze,wt=_e[1]-Le[1],Mt=wt*wt,Ft=vt+Mt;t.hoverData.isOverThresholdDrag=ct=Ft>=t.desktopTapThreshold2}var Ut=a(F);ct&&(t.hoverData.tapholdCancelled=!0);var Zr=function(){var Ur=t.hoverData.dragDelta=t.hoverData.dragDelta||[];Ur.length===0?(Ur.push(nt[0]),Ur.push(nt[1])):(Ur[0]+=nt[0],Ur[1]+=nt[1])};oe=!0,i(Ye,["mousemove","vmousemove","tapdrag"],F,{x:be[0],y:be[1]});var nr=function(Ur){return{originalEvent:F,type:Ur,position:{x:be[0],y:be[1]}}},hn=function(){t.data.bgActivePosistion=void 0,t.hoverData.selecting||le.emit(nr("boxstart")),Pe[4]=1,t.hoverData.selecting=!0,t.redrawHint("select",!0),t.redraw()};if(t.hoverData.which===3){if(ct){var Fr=nr("cxtdrag");Ie?Ie.emit(Fr):le.emit(Fr),t.hoverData.cxtDragged=!0,(!t.hoverData.cxtOver||Ye!==t.hoverData.cxtOver)&&(t.hoverData.cxtOver&&t.hoverData.cxtOver.emit(nr("cxtdragout")),t.hoverData.cxtOver=Ye,Ye&&Ye.emit(nr("cxtdragover")))}}else if(t.hoverData.dragging){if(oe=!0,le.panningEnabled()&&le.userPanningEnabled()){var lr;if(t.hoverData.justStartedPan){var Nr=t.hoverData.mdownPos;lr={x:(be[0]-Nr[0])*he,y:(be[1]-Nr[1])*he},t.hoverData.justStartedPan=!1}else lr={x:nt[0]*he,y:nt[1]*he};le.panBy(lr),le.emit(nr("dragpan")),t.hoverData.dragged=!0}be=t.projectIntoViewport(F.clientX,F.clientY)}else if(Pe[4]==1&&(Ie==null||Ie.pannable())){if(ct){if(!t.hoverData.dragging&&le.boxSelectionEnabled()&&(Ut||!le.panningEnabled()||!le.userPanningEnabled()))hn();else if(!t.hoverData.selecting&&le.panningEnabled()&&le.userPanningEnabled()){var _n=s(Ie,t.hoverData.downs);_n&&(t.hoverData.dragging=!0,t.hoverData.justStartedPan=!0,Pe[4]=0,t.data.bgActivePosistion=pu(ze),t.redrawHint("select",!0),t.redraw())}Ie&&Ie.pannable()&&Ie.active()&&Ie.unactivate()}}else{if(Ie&&Ie.pannable()&&Ie.active()&&Ie.unactivate(),(!Ie||!Ie.grabbed())&&Ye!=et&&(et&&i(et,["mouseout","tapdragout"],F,{x:be[0],y:be[1]}),Ye&&i(Ye,["mouseover","tapdragover"],F,{x:be[0],y:be[1]}),t.hoverData.last=Ye),Ie)if(ct){if(le.boxSelectionEnabled()&&Ut)Ie&&Ie.grabbed()&&(w(rt),Ie.emit(nr("freeon")),rt.emit(nr("free")),t.dragData.didDrag&&(Ie.emit(nr("dragfreeon")),rt.emit(nr("dragfree")))),hn();else if(Ie&&Ie.grabbed()&&t.nodeIsDraggable(Ie)){var Hr=!t.dragData.didDrag;Hr&&t.redrawHint("eles",!0),t.dragData.didDrag=!0,t.hoverData.draggingEles||b(rt,{inDragLayer:!0});var Vr={x:0,y:0};if(qe(nt[0])&&qe(nt[1])&&(Vr.x+=nt[0],Vr.y+=nt[1],Hr)){var dn=t.hoverData.dragDelta;dn&&qe(dn[0])&&qe(dn[1])&&(Vr.x+=dn[0],Vr.y+=dn[1])}t.hoverData.draggingEles=!0,rt.silentShift(Vr).emit(nr("position")).emit(nr("drag")),t.redrawHint("drag",!0),t.redraw()}}else Zr();oe=!0}if(Pe[2]=be[0],Pe[3]=be[1],oe)return F.stopPropagation&&F.stopPropagation(),F.preventDefault&&F.preventDefault(),!1}},!1);var P,z,H;t.registerBinding(e,"mouseup",function(F){if(!(t.hoverData.which===1&&F.which!==1&&t.hoverData.capture)){var J=t.hoverData.capture;if(J){t.hoverData.capture=!1;var oe=t.cy,le=t.projectIntoViewport(F.clientX,F.clientY),he=t.selection,_e=t.findNearestElement(le[0],le[1],!0,!1),be=t.dragData.possibleDragElements,ze=t.hoverData.down,Le=a(F);t.data.bgActivePosistion&&(t.redrawHint("select",!0),t.redraw()),t.hoverData.tapholdCancelled=!0,t.data.bgActivePosistion=void 0,ze&&ze.unactivate();var Pe=function(Ze){return{originalEvent:F,type:Ze,position:{x:le[0],y:le[1]}}};if(t.hoverData.which===3){var Ye=Pe("cxttapend");if(ze?ze.emit(Ye):oe.emit(Ye),!t.hoverData.cxtDragged){var et=Pe("cxttap");ze?ze.emit(et):oe.emit(et)}t.hoverData.cxtDragged=!1,t.hoverData.which=null}else if(t.hoverData.which===1){if(i(_e,["mouseup","tapend","vmouseup"],F,{x:le[0],y:le[1]}),!t.dragData.didDrag&&!t.hoverData.dragged&&!t.hoverData.selecting&&!t.hoverData.isOverThresholdDrag&&(i(ze,["click","tap","vclick"],F,{x:le[0],y:le[1]}),z=!1,F.timeStamp-H<=oe.multiClickDebounceTime()?(P&&clearTimeout(P),z=!0,H=null,i(ze,["dblclick","dbltap","vdblclick"],F,{x:le[0],y:le[1]})):(P=setTimeout(function(){z||i(ze,["oneclick","onetap","voneclick"],F,{x:le[0],y:le[1]})},oe.multiClickDebounceTime()),H=F.timeStamp)),ze==null&&!t.dragData.didDrag&&!t.hoverData.selecting&&!t.hoverData.dragged&&!a(F)&&(oe.$(r).unselect(["tapunselect"]),be.length>0&&t.redrawHint("eles",!0),t.dragData.possibleDragElements=be=oe.collection()),_e==ze&&!t.dragData.didDrag&&!t.hoverData.selecting&&_e!=null&&_e._private.selectable&&(t.hoverData.dragging||(oe.selectionType()==="additive"||Le?_e.selected()?_e.unselect(["tapunselect"]):_e.select(["tapselect"]):Le||(oe.$(r).unmerge(_e).unselect(["tapunselect"]),_e.select(["tapselect"]))),t.redrawHint("eles",!0)),t.hoverData.selecting){var Ie=oe.collection(t.getAllInBox(he[0],he[1],he[2],he[3]));t.redrawHint("select",!0),Ie.length>0&&t.redrawHint("eles",!0),oe.emit(Pe("boxend"));var nt=function(Ze){return Ze.selectable()&&!Ze.selected()};oe.selectionType()==="additive"||Le||oe.$(r).unmerge(Ie).unselect(),Ie.emit(Pe("box")).stdFilter(nt).select().emit(Pe("boxselect")),t.redraw()}if(t.hoverData.dragging&&(t.hoverData.dragging=!1,t.redrawHint("select",!0),t.redrawHint("eles",!0),t.redraw()),!he[4]){t.redrawHint("drag",!0),t.redrawHint("eles",!0);var rt=ze&&ze.grabbed();w(be),rt&&(ze.emit(Pe("freeon")),be.emit(Pe("free")),t.dragData.didDrag&&(ze.emit(Pe("dragfreeon")),be.emit(Pe("dragfree"))))}}he[4]=0,t.hoverData.down=null,t.hoverData.cxtStarted=!1,t.hoverData.draggingEles=!1,t.hoverData.selecting=!1,t.hoverData.isOverThresholdDrag=!1,t.dragData.didDrag=!1,t.hoverData.dragged=!1,t.hoverData.dragDelta=[],t.hoverData.mdownPos=null,t.hoverData.mdownGPos=null,t.hoverData.which=null}}},!1);var $=[],q=4,V,X=1e5,ee=function(F,J){for(var oe=0;oe<F.length;oe++)if(F[oe]%J!==0)return!1;return!0},te=function(F){for(var J=Math.abs(F[0]),oe=1;oe<F.length;oe++)if(Math.abs(F[oe])!==J)return!1;return!0},I=function(F){var J=!1,oe=F.deltaY;if(oe==null&&(F.wheelDeltaY!=null?oe=F.wheelDeltaY/4:F.wheelDelta!=null&&(oe=F.wheelDelta/4)),oe!==0){if(V==null)if($.length>=q){var le=$;if(V=ee(le,5),!V){var he=Math.abs(le[0]);V=te(le)&&he>5}if(V)for(var _e=0;_e<le.length;_e++)X=Math.min(Math.abs(le[_e]),X)}else $.push(oe),J=!0;else V&&(X=Math.min(Math.abs(oe),X));if(!t.scrollingPage){var be=t.cy,ze=be.zoom(),Le=be.pan(),Pe=t.projectIntoViewport(F.clientX,F.clientY),Ye=[Pe[0]*ze+Le.x,Pe[1]*ze+Le.y];if(t.hoverData.draggingEles||t.hoverData.dragging||t.hoverData.cxtStarted||B()){F.preventDefault();return}if(be.panningEnabled()&&be.userPanningEnabled()&&be.zoomingEnabled()&&be.userZoomingEnabled()){F.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 et;J&&Math.abs(oe)>5&&(oe=qT(oe)*5),et=oe/-250,V&&(et/=X,et*=3),et=et*t.wheelSensitivity;var Ie=F.deltaMode===1;Ie&&(et*=33);var nt=be.zoom()*Math.pow(10,et);F.type==="gesturechange"&&(nt=t.gestureStartZoom*F.scale),be.zoom({level:nt,renderedPosition:{x:Ye[0],y:Ye[1]}}),be.emit({type:F.type==="gesturechange"?"pinchzoom":"scrollzoom",originalEvent:F,position:{x:Pe[0],y:Pe[1]}})}}}};t.registerBinding(t.container,"wheel",I,!0),t.registerBinding(e,"scroll",function(F){t.scrollingPage=!0,clearTimeout(t.scrollingPageTimeout),t.scrollingPageTimeout=setTimeout(function(){t.scrollingPage=!1},250)},!0),t.registerBinding(t.container,"gesturestart",function(F){t.gestureStartZoom=t.cy.zoom(),t.hasTouchStarted||F.preventDefault()},!0),t.registerBinding(t.container,"gesturechange",function(ce){t.hasTouchStarted||I(ce)},!0),t.registerBinding(t.container,"mouseout",function(F){var J=t.projectIntoViewport(F.clientX,F.clientY);t.cy.emit({originalEvent:F,type:"mouseout",position:{x:J[0],y:J[1]}})},!1),t.registerBinding(t.container,"mouseover",function(F){var J=t.projectIntoViewport(F.clientX,F.clientY);t.cy.emit({originalEvent:F,type:"mouseover",position:{x:J[0],y:J[1]}})},!1);var G,re,Y,W,Z,ie,we,de,se,j,Q,K,ue,Se=function(F,J,oe,le){return Math.sqrt((oe-F)*(oe-F)+(le-J)*(le-J))},at=function(F,J,oe,le){return(oe-F)*(oe-F)+(le-J)*(le-J)},Me;t.registerBinding(t.container,"touchstart",Me=function(F){if(t.hasTouchStarted=!0,!!D(F)){k(),t.touchData.capture=!0,t.data.bgActivePosistion=void 0;var J=t.cy,oe=t.touchData.now,le=t.touchData.earlier;if(F.touches[0]){var he=t.projectIntoViewport(F.touches[0].clientX,F.touches[0].clientY);oe[0]=he[0],oe[1]=he[1]}if(F.touches[1]){var he=t.projectIntoViewport(F.touches[1].clientX,F.touches[1].clientY);oe[2]=he[0],oe[3]=he[1]}if(F.touches[2]){var he=t.projectIntoViewport(F.touches[2].clientX,F.touches[2].clientY);oe[4]=he[0],oe[5]=he[1]}var _e=function(Ut){return{originalEvent:F,type:Ut,position:{x:oe[0],y:oe[1]}}};if(F.touches[1]){t.touchData.singleTouchMoved=!0,w(t.dragData.touchDragEles);var be=t.findContainerClientCoords();se=be[0],j=be[1],Q=be[2],K=be[3],G=F.touches[0].clientX-se,re=F.touches[0].clientY-j,Y=F.touches[1].clientX-se,W=F.touches[1].clientY-j,ue=0<=G&&G<=Q&&0<=Y&&Y<=Q&&0<=re&&re<=K&&0<=W&&W<=K;var ze=J.pan(),Le=J.zoom();Z=Se(G,re,Y,W),ie=at(G,re,Y,W),we=[(G+Y)/2,(re+W)/2],de=[(we[0]-ze.x)/Le,(we[1]-ze.y)/Le];var Pe=200,Ye=Pe*Pe;if(ie<Ye&&!F.touches[2]){var et=t.findNearestElement(oe[0],oe[1],!0,!0),Ie=t.findNearestElement(oe[2],oe[3],!0,!0);et&&et.isNode()?(et.activate().emit(_e("cxttapstart")),t.touchData.start=et):Ie&&Ie.isNode()?(Ie.activate().emit(_e("cxttapstart")),t.touchData.start=Ie):J.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(F.touches[2])J.boxSelectionEnabled()&&F.preventDefault();else if(!F.touches[1]){if(F.touches[0]){var nt=t.findNearestElements(oe[0],oe[1],!0,!0),rt=nt[0];if(rt!=null&&(rt.activate(),t.touchData.start=rt,t.touchData.starts=nt,t.nodeIsGrabbable(rt))){var ct=t.dragData.touchDragEles=J.collection(),Ze=null;t.redrawHint("eles",!0),t.redrawHint("drag",!0),rt.selected()?(Ze=J.$(function(Ft){return Ft.selected()&&t.nodeIsGrabbable(Ft)}),b(Ze,{addToList:ct})):x(rt,{addToList:ct}),d(rt),rt.emit(_e("grabon")),Ze?Ze.forEach(function(Ft){Ft.emit(_e("grab"))}):rt.emit(_e("grab"))}i(rt,["touchstart","tapstart","vmousedown"],F,{x:oe[0],y:oe[1]}),rt==null&&(t.data.bgActivePosistion={x:he[0],y:he[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"],F,{x:oe[0],y:oe[1]})},t.tapholdDuration)}}if(F.touches.length>=1){for(var vt=t.touchData.startPosition=[null,null,null,null,null,null],wt=0;wt<oe.length;wt++)vt[wt]=le[wt]=oe[wt];var Mt=F.touches[0];t.touchData.startGPosition=[Mt.clientX,Mt.clientY]}}},!1);var He;t.registerBinding(e,"touchmove",He=function(F){var J=t.touchData.capture;if(!(!J&&!D(F))){var oe=t.selection,le=t.cy,he=t.touchData.now,_e=t.touchData.earlier,be=le.zoom();if(F.touches[0]){var ze=t.projectIntoViewport(F.touches[0].clientX,F.touches[0].clientY);he[0]=ze[0],he[1]=ze[1]}if(F.touches[1]){var ze=t.projectIntoViewport(F.touches[1].clientX,F.touches[1].clientY);he[2]=ze[0],he[3]=ze[1]}if(F.touches[2]){var ze=t.projectIntoViewport(F.touches[2].clientX,F.touches[2].clientY);he[4]=ze[0],he[5]=ze[1]}var Le=function(jh){return{originalEvent:F,type:jh,position:{x:he[0],y:he[1]}}},Pe=t.touchData.startGPosition,Ye;if(J&&F.touches[0]&&Pe){for(var et=[],Ie=0;Ie<he.length;Ie++)et[Ie]=he[Ie]-_e[Ie];var nt=F.touches[0].clientX-Pe[0],rt=nt*nt,ct=F.touches[0].clientY-Pe[1],Ze=ct*ct,vt=rt+Ze;Ye=vt>=t.touchTapThreshold2}if(J&&t.touchData.cxt){F.preventDefault();var wt=F.touches[0].clientX-se,Mt=F.touches[0].clientY-j,Ft=F.touches[1].clientX-se,Ut=F.touches[1].clientY-j,Zr=at(wt,Mt,Ft,Ut),nr=Zr/ie,hn=150,Fr=hn*hn,lr=1.5,Nr=lr*lr;if(nr>=Nr||Zr>=Fr){t.touchData.cxt=!1,t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var _n=Le("cxttapend");t.touchData.start?(t.touchData.start.unactivate().emit(_n),t.touchData.start=null):le.emit(_n)}}if(J&&t.touchData.cxt){var _n=Le("cxtdrag");t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.touchData.start?t.touchData.start.emit(_n):le.emit(_n),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxtDragged=!0;var Hr=t.findNearestElement(he[0],he[1],!0,!0);(!t.touchData.cxtOver||Hr!==t.touchData.cxtOver)&&(t.touchData.cxtOver&&t.touchData.cxtOver.emit(Le("cxtdragout")),t.touchData.cxtOver=Hr,Hr&&Hr.emit(Le("cxtdragover")))}else if(J&&F.touches[2]&&le.boxSelectionEnabled())F.preventDefault(),t.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,t.touchData.selecting||le.emit(Le("boxstart")),t.touchData.selecting=!0,t.touchData.didSelect=!0,oe[4]=1,!oe||oe.length===0||oe[0]===void 0?(oe[0]=(he[0]+he[2]+he[4])/3,oe[1]=(he[1]+he[3]+he[5])/3,oe[2]=(he[0]+he[2]+he[4])/3+1,oe[3]=(he[1]+he[3]+he[5])/3+1):(oe[2]=(he[0]+he[2]+he[4])/3,oe[3]=(he[1]+he[3]+he[5])/3),t.redrawHint("select",!0),t.redraw();else if(J&&F.touches[1]&&!t.touchData.didSelect&&le.zoomingEnabled()&&le.panningEnabled()&&le.userZoomingEnabled()&&le.userPanningEnabled()){F.preventDefault(),t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var Vr=t.dragData.touchDragEles;if(Vr){t.redrawHint("drag",!0);for(var dn=0;dn<Vr.length;dn++){var ns=Vr[dn]._private;ns.grabbed=!1,ns.rscratch.inDragLayer=!1}}var Ur=t.touchData.start,wt=F.touches[0].clientX-se,Mt=F.touches[0].clientY-j,Ft=F.touches[1].clientX-se,Ut=F.touches[1].clientY-j,go=Se(wt,Mt,Ft,Ut),is=go/Z;if(ue){var as=wt-G,dl=Mt-re,ss=Ft-Y,kr=Ut-W,zh=(as+ss)/2,Ih=(dl+kr)/2,Jn=le.zoom(),Gi=Jn*is,vo=le.pan(),ac=de[0]*Jn+vo.x,sc=de[1]*Jn+vo.y,rm={x:-Gi/Jn*(ac-vo.x-zh)+ac,y:-Gi/Jn*(sc-vo.y-Ih)+sc};if(Ur&&Ur.active()){var Vr=t.dragData.touchDragEles;w(Vr),t.redrawHint("drag",!0),t.redrawHint("eles",!0),Ur.unactivate().emit(Le("freeon")),Vr.emit(Le("free")),t.dragData.didDrag&&(Ur.emit(Le("dragfreeon")),Vr.emit(Le("dragfree")))}le.viewport({zoom:Gi,pan:rm,cancelOnFailedZoom:!0}),le.emit(Le("pinchzoom")),Z=go,G=wt,re=Mt,Y=Ft,W=Ut,t.pinching=!0}if(F.touches[0]){var ze=t.projectIntoViewport(F.touches[0].clientX,F.touches[0].clientY);he[0]=ze[0],he[1]=ze[1]}if(F.touches[1]){var ze=t.projectIntoViewport(F.touches[1].clientX,F.touches[1].clientY);he[2]=ze[0],he[3]=ze[1]}if(F.touches[2]){var ze=t.projectIntoViewport(F.touches[2].clientX,F.touches[2].clientY);he[4]=ze[0],he[5]=ze[1]}}else if(F.touches[0]&&!t.touchData.didSelect){var pn=t.touchData.start,ls=t.touchData.last,Hr;if(!t.hoverData.draggingEles&&!t.swipePanning&&(Hr=t.findNearestElement(he[0],he[1],!0,!0)),J&&pn!=null&&F.preventDefault(),J&&pn!=null&&t.nodeIsDraggable(pn))if(Ye){var Vr=t.dragData.touchDragEles,hi=!t.dragData.didDrag;hi&&b(Vr,{inDragLayer:!0}),t.dragData.didDrag=!0;var $r={x:0,y:0};if(qe(et[0])&&qe(et[1])&&($r.x+=et[0],$r.y+=et[1],hi)){t.redrawHint("eles",!0);var Nn=t.touchData.dragDelta;Nn&&qe(Nn[0])&&qe(Nn[1])&&($r.x+=Nn[0],$r.y+=Nn[1])}t.hoverData.draggingEles=!0,Vr.silentShift($r).emit(Le("position")).emit(Le("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 Nn=t.touchData.dragDelta=t.touchData.dragDelta||[];Nn.length===0?(Nn.push(et[0]),Nn.push(et[1])):(Nn[0]+=et[0],Nn[1]+=et[1])}if(i(pn||Hr,["touchmove","tapdrag","vmousemove"],F,{x:he[0],y:he[1]}),(!pn||!pn.grabbed())&&Hr!=ls&&(ls&&ls.emit(Le("tapdragout")),Hr&&Hr.emit(Le("tapdragover"))),t.touchData.last=Hr,J)for(var dn=0;dn<he.length;dn++)he[dn]&&t.touchData.startPosition[dn]&&Ye&&(t.touchData.singleTouchMoved=!0);if(J&&(pn==null||pn.pannable())&&le.panningEnabled()&&le.userPanningEnabled()){var nm=s(pn,t.touchData.starts);nm&&(F.preventDefault(),t.data.bgActivePosistion||(t.data.bgActivePosistion=pu(t.touchData.startPosition)),t.swipePanning?(le.panBy({x:et[0]*be,y:et[1]*be}),le.emit(Le("dragpan"))):Ye&&(t.swipePanning=!0,le.panBy({x:nt*be,y:ct*be}),le.emit(Le("dragpan")),pn&&(pn.unactivate(),t.redrawHint("select",!0),t.touchData.start=null)));var ze=t.projectIntoViewport(F.touches[0].clientX,F.touches[0].clientY);he[0]=ze[0],he[1]=ze[1]}}for(var Ie=0;Ie<he.length;Ie++)_e[Ie]=he[Ie];J&&F.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 $e;t.registerBinding(e,"touchcancel",$e=function(F){var J=t.touchData.start;t.touchData.capture=!1,J&&J.unactivate()});var Ne,Ge,Ve,Qe;if(t.registerBinding(e,"touchend",Ne=function(F){var J=t.touchData.start,oe=t.touchData.capture;if(oe)F.touches.length===0&&(t.touchData.capture=!1),F.preventDefault();else return;var le=t.selection;t.swipePanning=!1,t.hoverData.draggingEles=!1;var he=t.cy,_e=he.zoom(),be=t.touchData.now,ze=t.touchData.earlier;if(F.touches[0]){var Le=t.projectIntoViewport(F.touches[0].clientX,F.touches[0].clientY);be[0]=Le[0],be[1]=Le[1]}if(F.touches[1]){var Le=t.projectIntoViewport(F.touches[1].clientX,F.touches[1].clientY);be[2]=Le[0],be[3]=Le[1]}if(F.touches[2]){var Le=t.projectIntoViewport(F.touches[2].clientX,F.touches[2].clientY);be[4]=Le[0],be[5]=Le[1]}var Pe=function(Fr){return{originalEvent:F,type:Fr,position:{x:be[0],y:be[1]}}};J&&J.unactivate();var Ye;if(t.touchData.cxt){if(Ye=Pe("cxttapend"),J?J.emit(Ye):he.emit(Ye),!t.touchData.cxtDragged){var et=Pe("cxttap");J?J.emit(et):he.emit(et)}t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!1,t.touchData.start=null,t.redraw();return}if(!F.touches[2]&&he.boxSelectionEnabled()&&t.touchData.selecting){t.touchData.selecting=!1;var Ie=he.collection(t.getAllInBox(le[0],le[1],le[2],le[3]));le[0]=void 0,le[1]=void 0,le[2]=void 0,le[3]=void 0,le[4]=0,t.redrawHint("select",!0),he.emit(Pe("boxend"));var nt=function(Fr){return Fr.selectable()&&!Fr.selected()};Ie.emit(Pe("box")).stdFilter(nt).select().emit(Pe("boxselect")),Ie.nonempty()&&t.redrawHint("eles",!0),t.redraw()}if(J?.unactivate(),F.touches[2])t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);else if(!F.touches[1]){if(!F.touches[0]){if(!F.touches[0]){t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var rt=t.dragData.touchDragEles;if(J!=null){var ct=J._private.grabbed;w(rt),t.redrawHint("drag",!0),t.redrawHint("eles",!0),ct&&(J.emit(Pe("freeon")),rt.emit(Pe("free")),t.dragData.didDrag&&(J.emit(Pe("dragfreeon")),rt.emit(Pe("dragfree")))),i(J,["touchend","tapend","vmouseup","tapdragout"],F,{x:be[0],y:be[1]}),J.unactivate(),t.touchData.start=null}else{var Ze=t.findNearestElement(be[0],be[1],!0,!0);i(Ze,["touchend","tapend","vmouseup","tapdragout"],F,{x:be[0],y:be[1]})}var vt=t.touchData.startPosition[0]-be[0],wt=vt*vt,Mt=t.touchData.startPosition[1]-be[1],Ft=Mt*Mt,Ut=wt+Ft,Zr=Ut*_e*_e;t.touchData.singleTouchMoved||(J||he.$(":selected").unselect(["tapunselect"]),i(J,["tap","vclick"],F,{x:be[0],y:be[1]}),Ge=!1,F.timeStamp-Qe<=he.multiClickDebounceTime()?(Ve&&clearTimeout(Ve),Ge=!0,Qe=null,i(J,["dbltap","vdblclick"],F,{x:be[0],y:be[1]})):(Ve=setTimeout(function(){Ge||i(J,["onetap","voneclick"],F,{x:be[0],y:be[1]})},he.multiClickDebounceTime()),Qe=F.timeStamp)),J!=null&&!t.dragData.didDrag&&J._private.selectable&&Zr<t.touchTapThreshold2&&!t.pinching&&(he.selectionType()==="single"?(he.$(r).unmerge(J).unselect(["tapunselect"]),J.select(["tapselect"])):J.selected()?J.unselect(["tapunselect"]):J.select(["tapselect"]),t.redrawHint("eles",!0)),t.touchData.singleTouchMoved=!0}}}for(var nr=0;nr<be.length;nr++)ze[nr]=be[nr];t.dragData.didDrag=!1,F.touches.length===0&&(t.touchData.dragDelta=[],t.touchData.startPosition=[null,null,null,null,null,null],t.touchData.startGPosition=null,t.touchData.didSelect=!1),F.touches.length<2&&(F.touches.length===1&&(t.touchData.startGPosition=[F.touches[0].clientX,F.touches[0].clientY]),t.pinching=!1,t.redrawHint("eles",!0),t.redraw())},!1),typeof TouchEvent>"u"){var je=[],dt=function(F){return{clientX:F.clientX,clientY:F.clientY,force:1,identifier:F.pointerId,pageX:F.pageX,pageY:F.pageY,radiusX:F.width/2,radiusY:F.height/2,screenX:F.screenX,screenY:F.screenY,target:F.target}},ke=function(F){return{event:F,touch:dt(F)}},De=function(F){je.push(ke(F))},Be=function(F){for(var J=0;J<je.length;J++){var oe=je[J];if(oe.event.pointerId===F.pointerId){je.splice(J,1);return}}},Ke=function(F){var J=je.filter(function(oe){return oe.event.pointerId===F.pointerId})[0];J.event=F,J.touch=dt(F)},Oe=function(F){F.touches=je.map(function(J){return J.touch})},Re=function(F){return F.pointerType==="mouse"||F.pointerType===4};t.registerBinding(t.container,"pointerdown",function(ce){Re(ce)||(ce.preventDefault(),De(ce),Oe(ce),Me(ce))}),t.registerBinding(t.container,"pointerup",function(ce){Re(ce)||(Be(ce),Oe(ce),Ne(ce))}),t.registerBinding(t.container,"pointercancel",function(ce){Re(ce)||(Be(ce),Oe(ce),$e(ce))}),t.registerBinding(t.container,"pointermove",function(ce){Re(ce)||(ce.preventDefault(),Ke(ce),Oe(ce),He(ce))})}};var Ja={};Ja.generatePolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,draw:function(n,i,a,s,l,o){this.renderer.nodeShapeImpl("polygon",n,i,a,s,l,this.points)},intersectLine:function(n,i,a,s,l,o,c,h){return jf(l,o,this.points,n,i,a/2,s/2,c)},checkPoint:function(n,i,a,s,l,o,c,h){return Xa(n,i,this.points,o,c,s,l,[0,-1],a)},hasMiterBounds:t!=="rectangle",miterBounds:function(n,i,a,s,l,o){return FY(this.points,n,i,a,s,l)}}};Ja.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,r,n,i,a,s){this.renderer.nodeShapeImpl(this.name,e,r,n,i,a)},intersectLine:function(e,r,n,i,a,s,l,o){return WY(a,s,e,r,n/2+l,i/2+l)},checkPoint:function(e,r,n,i,a,s,l,o){return Fl(e,r,i,a,s,l,n)}}};Ja.generateRoundPolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,getOrCreateCorners:function(n,i,a,s,l,o,c){if(o[c]!==void 0&&o[c+"-cx"]===n&&o[c+"-cy"]===i)return o[c];o[c]=new Array(e.length/2),o[c+"-cx"]=n,o[c+"-cy"]=i;var h=a/2,d=s/2;l=l==="auto"?Fq(a,s):l;for(var g=new Array(e.length/2),m=0;m<e.length/2;m++)g[m]={x:n+h*e[m*2],y:i+d*e[m*2+1]};var y,b,x,w,S=g.length;for(b=g[S-1],y=0;y<S;y++)x=g[y%S],w=g[(y+1)%S],o[c][y]=ZT(b,x,w,l),b=x,x=w;return o[c]},draw:function(n,i,a,s,l,o,c){this.renderer.nodeShapeImpl("round-polygon",n,i,a,s,l,this.points,this.getOrCreateCorners(i,a,s,l,o,c,"drawCorners"))},intersectLine:function(n,i,a,s,l,o,c,h,d){return KY(l,o,this.points,n,i,a,s,c,this.getOrCreateCorners(n,i,a,s,h,d,"corners"))},checkPoint:function(n,i,a,s,l,o,c,h,d){return XY(n,i,this.points,o,c,s,l,this.getOrCreateCorners(o,c,s,l,h,d,"corners"))}}};Ja.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:Tn(4,0),draw:function(e,r,n,i,a,s){this.renderer.nodeShapeImpl(this.name,e,r,n,i,a,this.points,s)},intersectLine:function(e,r,n,i,a,s,l,o){return qq(a,s,e,r,n,i,l,o)},checkPoint:function(e,r,n,i,a,s,l,o){var c=i/2,h=a/2;o=o==="auto"?Ws(i,a):o,o=Math.min(c,h,o);var d=o*2;return!!(Xa(e,r,this.points,s,l,i,a-d,[0,-1],n)||Xa(e,r,this.points,s,l,i-d,a,[0,-1],n)||Fl(e,r,d,d,s-c+o,l-h+o,n)||Fl(e,r,d,d,s+c-o,l-h+o,n)||Fl(e,r,d,d,s+c-o,l+h-o,n)||Fl(e,r,d,d,s-c+o,l+h-o,n))}}};Ja.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:FT(),points:Tn(4,0),draw:function(e,r,n,i,a,s){this.renderer.nodeShapeImpl(this.name,e,r,n,i,a,null,s)},generateCutTrianglePts:function(e,r,n,i,a){var s=a==="auto"?this.cornerLength:a,l=r/2,o=e/2,c=n-o,h=n+o,d=i-l,g=i+l;return{topLeft:[c,d+s,c+s,d,c+s,d+s],topRight:[h-s,d,h,d+s,h-s,d+s],bottomRight:[h,g-s,h-s,g,h-s,g-s],bottomLeft:[c+s,g,c,g-s,c+s,g-s]}},intersectLine:function(e,r,n,i,a,s,l,o){var c=this.generateCutTrianglePts(n+2*l,i+2*l,e,r,o),h=[].concat.apply([],[c.topLeft.splice(0,4),c.topRight.splice(0,4),c.bottomRight.splice(0,4),c.bottomLeft.splice(0,4)]);return jf(a,s,h,e,r)},checkPoint:function(e,r,n,i,a,s,l,o){var c=o==="auto"?this.cornerLength:o;if(Xa(e,r,this.points,s,l,i,a-2*c,[0,-1],n)||Xa(e,r,this.points,s,l,i-2*c,a,[0,-1],n))return!0;var h=this.generateCutTrianglePts(i,a,s,l);return Hn(e,r,h.topLeft)||Hn(e,r,h.topRight)||Hn(e,r,h.bottomRight)||Hn(e,r,h.bottomLeft)}}};Ja.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:Tn(4,0),draw:function(e,r,n,i,a,s){this.renderer.nodeShapeImpl(this.name,e,r,n,i,a)},intersectLine:function(e,r,n,i,a,s,l,o){var c=.15,h=.5,d=.85,g=this.generateBarrelBezierPts(n+2*l,i+2*l,e,r),m=function(x){var w=wu({x:x[0],y:x[1]},{x:x[2],y:x[3]},{x:x[4],y:x[5]},c),S=wu({x:x[0],y:x[1]},{x:x[2],y:x[3]},{x:x[4],y:x[5]},h),k=wu({x:x[0],y:x[1]},{x:x[2],y:x[3]},{x:x[4],y:x[5]},d);return[x[0],x[1],w.x,w.y,S.x,S.y,k.x,k.y,x[4],x[5]]},y=[].concat(m(g.topLeft),m(g.topRight),m(g.bottomRight),m(g.bottomLeft));return jf(a,s,y,e,r)},generateBarrelBezierPts:function(e,r,n,i){var a=r/2,s=e/2,l=n-s,o=n+s,c=i-a,h=i+a,d=ik(e,r),g=d.heightOffset,m=d.widthOffset,y=d.ctrlPtOffsetPct*e,b={topLeft:[l,c+g,l+y,c,l+m,c],topRight:[o-m,c,o-y,c,o,c+g],bottomRight:[o,h-g,o-y,h,o-m,h],bottomLeft:[l+m,h,l+y,h,l,h-g]};return b.topLeft.isTop=!0,b.topRight.isTop=!0,b.bottomLeft.isBottom=!0,b.bottomRight.isBottom=!0,b},checkPoint:function(e,r,n,i,a,s,l,o){var c=ik(i,a),h=c.heightOffset,d=c.widthOffset;if(Xa(e,r,this.points,s,l,i,a-2*h,[0,-1],n)||Xa(e,r,this.points,s,l,i-2*d,a,[0,-1],n))return!0;for(var g=this.generateBarrelBezierPts(i,a,s,l),m=function(N,B,D){var _=D[4],P=D[2],z=D[0],H=D[5],$=D[1],q=Math.min(_,z),V=Math.max(_,z),X=Math.min(H,$),ee=Math.max(H,$);if(q<=N&&N<=V&&X<=B&&B<=ee){var te=ZY(_,P,z),I=UY(te[0],te[1],te[2],N),G=I.filter(function(re){return 0<=re&&re<=1});if(G.length>0)return G[0]}return null},y=Object.keys(g),b=0;b<y.length;b++){var x=y[b],w=g[x],S=m(e,r,w);if(S!=null){var k=w[5],E=w[3],M=w[1],R=Yr(k,E,M,S);if(w.isTop&&R<=r||w.isBottom&&r<=R)return!0}}return!1}}};Ja.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:Tn(4,0),draw:function(e,r,n,i,a,s){this.renderer.nodeShapeImpl(this.name,e,r,n,i,a,this.points,s)},intersectLine:function(e,r,n,i,a,s,l,o){var c=e-(n/2+l),h=r-(i/2+l),d=h,g=e+(n/2+l),m=qs(a,s,e,r,c,h,g,d,!1);return m.length>0?m:qq(a,s,e,r,n,i,l,o)},checkPoint:function(e,r,n,i,a,s,l,o){o=o==="auto"?Ws(i,a):o;var c=2*o;if(Xa(e,r,this.points,s,l,i,a-c,[0,-1],n)||Xa(e,r,this.points,s,l,i-c,a,[0,-1],n))return!0;var h=i/2+2*n,d=a/2+2*n,g=[s-h,l-d,s-h,l,s+h,l,s+h,l-d];return!!(Hn(e,r,g)||Fl(e,r,c,c,s+i/2-o,l+a/2-o,n)||Fl(e,r,c,c,s-i/2+o,l+a/2-o,n))}}};Ja.registerNodeShapes=function(){var t=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",Tn(3,0)),this.generateRoundPolygon("round-triangle",Tn(3,0)),this.generatePolygon("rectangle",Tn(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",Tn(5,0)),this.generateRoundPolygon("round-pentagon",Tn(5,0)),this.generatePolygon("hexagon",Tn(6,0)),this.generateRoundPolygon("round-hexagon",Tn(6,0)),this.generatePolygon("heptagon",Tn(7,0)),this.generateRoundPolygon("round-heptagon",Tn(7,0)),this.generatePolygon("octagon",Tn(8,0)),this.generateRoundPolygon("round-octagon",Tn(8,0));var n=new Array(20);{var i=nk(5,0),a=nk(5,Math.PI/5),s=.5*(3-Math.sqrt(5));s*=1.57;for(var l=0;l<a.length/2;l++)a[l*2]*=s,a[l*2+1]*=s;for(var l=0;l<20/4;l++)n[l*4]=i[l*2],n[l*4+1]=i[l*2+1],n[l*4+2]=a[l*2],n[l*4+3]=a[l*2+1]}n=jq(n),this.generatePolygon("star",n),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 o=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",o),this.generateRoundPolygon("round-tag",o)}t.makePolygon=function(c){var h=c.join("$"),d="polygon-"+h,g;return(g=this[d])?g:e.generatePolygon(d,c)}};var wh={};wh.timeToRender=function(){return this.redrawTotalTime/this.redrawCount};wh.redraw=function(t){t=t||Lq();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};wh.beforeRender=function(t,e){if(!this.destroyed){e==null&&ur("Priority is not optional for beforeRender");var r=this.beforeRenderCallbacks;r.push({fn:t,priority:e}),r.sort(function(n,i){return i.priority-n.priority})}};var BN=function(e,r,n){for(var i=e.beforeRenderCallbacks,a=0;a<i.length;a++)i[a].fn(r,n)};wh.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){BN(t,!0,i);var a=Ya();t.render(t.renderOptions);var s=t.lastDrawTime=Ya();t.averageRedrawTime===void 0&&(t.averageRedrawTime=s-a),t.redrawCount===void 0&&(t.redrawCount=0),t.redrawCount++,t.redrawTotalTime===void 0&&(t.redrawTotalTime=0);var l=s-a;t.redrawTotalTime+=l,t.lastRedrawTime=l,t.averageRedrawTime=t.averageRedrawTime/2+l/2,t.requestedFrame=!1}else BN(t,!1,i);t.skipFrame=!1,dg(r)}};dg(r)}};var pK=function(e){this.init(e)},Fj=pK,Qu=Fj.prototype;Qu.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"];Qu.init=function(t){var e=this;e.options=t,e.cy=t.cy;var r=e.container=t.cy.container(),n=e.cy.window();if(n){var i=n.document,a=i.head,s="__________cytoscape_stylesheet",l="__________cytoscape_container",o=i.getElementById(s)!=null;if(r.className.indexOf(l)<0&&(r.className=(r.className||"")+" "+l),!o){var c=i.createElement("style");c.id=s,c.textContent="."+l+" { position: relative; }",a.insertBefore(c,a.children[0])}var h=n.getComputedStyle(r),d=h.getPropertyValue("position");d==="static"&&jt("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=qe(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()};Qu.notify=function(t,e){var r=this,n=r.cy;if(!this.destroyed){if(t==="init"){r.load();return}if(t==="destroy"){r.destroy();return}(t==="add"||t==="remove"||t==="move"&&n.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()}};Qu.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],n=r,i=n.target;(i.off||i.removeEventListener).apply(i,n.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{}};Qu.isHeadless=function(){return!1};[KT,qj,jj,Wu,Ja,wh].forEach(function(t){ft(Qu,t)});var Hb=1e3/60,Hj={setupDequeueing:function(e){return function(){var n=this,i=this.renderer;if(!n.dequeueingSetup){n.dequeueingSetup=!0;var a=vh(function(){i.redrawHint("eles",!0),i.redrawHint("drag",!0),i.redraw()},e.deqRedrawThreshold),s=function(c,h){var d=Ya(),g=i.averageRedrawTime,m=i.lastRedrawTime,y=[],b=i.cy.extent(),x=i.getPixelRatio();for(c||i.flushRenderedStyleQueue();;){var w=Ya(),S=w-d,k=w-h;if(m<Hb){var E=Hb-(c?g:0);if(k>=e.deqFastCost*E)break}else if(c){if(S>=e.deqCost*m||S>=e.deqAvgCost*g)break}else if(k>=e.deqNoDrawCost*Hb)break;var M=e.deq(n,x,b);if(M.length>0)for(var R=0;R<M.length;R++)y.push(M[R]);else break}y.length>0&&(e.onDeqd(n,y),!c&&e.shouldRedraw(n,y,x,b)&&a())},l=e.priority||PT;i.beforeRender(s,l(n))}}}},gK=(function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:pg;sl(this,t),this.idsByKey=new Ua,this.keyForId=new Ua,this.cachesByLvl=new Ua,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=r}return ll(t,[{key:"getIdsFor",value:function(r){r==null&&ur("Can not get id list for null key");var n=this.idsByKey,i=this.idsByKey.get(r);return i||(i=new $u,n.set(r,i)),i}},{key:"addIdForKey",value:function(r,n){r!=null&&this.getIdsFor(r).add(n)}},{key:"deleteIdForKey",value:function(r,n){r!=null&&this.getIdsFor(r).delete(n)}},{key:"getNumberOfIdsForKey",value:function(r){return r==null?0:this.getIdsFor(r).size}},{key:"updateKeyMappingFor",value:function(r){var n=r.id(),i=this.keyForId.get(n),a=this.getKey(r);this.deleteIdForKey(i,n),this.addIdForKey(a,n),this.keyForId.set(n,a)}},{key:"deleteKeyMappingFor",value:function(r){var n=r.id(),i=this.keyForId.get(n);this.deleteIdForKey(i,n),this.keyForId.delete(n)}},{key:"keyHasChangedFor",value:function(r){var n=r.id(),i=this.keyForId.get(n),a=this.getKey(r);return i!==a}},{key:"isInvalid",value:function(r){return this.keyHasChangedFor(r)||this.doesEleInvalidateKey(r)}},{key:"getCachesAt",value:function(r){var n=this.cachesByLvl,i=this.lvls,a=n.get(r);return a||(a=new Ua,n.set(r,a),i.push(r)),a}},{key:"getCache",value:function(r,n){return this.getCachesAt(n).get(r)}},{key:"get",value:function(r,n){var i=this.getKey(r),a=this.getCache(i,n);return a!=null&&this.updateKeyMappingFor(r),a}},{key:"getForCachedKey",value:function(r,n){var i=this.keyForId.get(r.id()),a=this.getCache(i,n);return a}},{key:"hasCache",value:function(r,n){return this.getCachesAt(n).has(r)}},{key:"has",value:function(r,n){var i=this.getKey(r);return this.hasCache(i,n)}},{key:"setCache",value:function(r,n,i){i.key=r,this.getCachesAt(n).set(r,i)}},{key:"set",value:function(r,n,i){var a=this.getKey(r);this.setCache(a,n,i),this.updateKeyMappingFor(r)}},{key:"deleteCache",value:function(r,n){this.getCachesAt(n).delete(r)}},{key:"delete",value:function(r,n){var i=this.getKey(r);this.deleteCache(i,n)}},{key:"invalidateKey",value:function(r){var n=this;this.lvls.forEach(function(i){return n.deleteCache(r,i)})}},{key:"invalidate",value:function(r){var n=r.id(),i=this.keyForId.get(n);this.deleteKeyMappingFor(r);var a=this.doesEleInvalidateKey(r);return a&&this.invalidateKey(i),a||this.getNumberOfIdsForKey(i)===0}}])})(),LN=25,up=50,$p=-4,mk=3,Vj=7.99,vK=8,mK=1024,yK=1024,bK=1024,xK=.2,wK=.8,SK=10,CK=.15,kK=.1,TK=.9,EK=.9,AK=100,OK=1,vu={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},MK=cn({getKey:null,doesEleInvalidateKey:pg,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:_q,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),df=function(e,r){var n=this;n.renderer=e,n.onDequeues=[];var i=MK(r);ft(n,i),n.lookup=new gK(i.getKey,i.doesEleInvalidateKey),n.setupDequeueing()},jr=df.prototype;jr.reasons=vu;jr.getTextureQueue=function(t){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[t]=e.eleImgCaches[t]||[]};jr.getRetiredTextureQueue=function(t){var e=this,r=e.eleImgCaches.retired=e.eleImgCaches.retired||{},n=r[t]=r[t]||[];return n};jr.getElementQueue=function(){var t=this,e=t.eleCacheQueue=t.eleCacheQueue||new mh(function(r,n){return n.reqs-r.reqs});return e};jr.getElementKeyToQueue=function(){var t=this,e=t.eleKeyToCacheQueue=t.eleKeyToCacheQueue||{};return e};jr.getElement=function(t,e,r,n,i){var a=this,s=this.renderer,l=s.cy.zoom(),o=this.lookup;if(!e||e.w===0||e.h===0||isNaN(e.w)||isNaN(e.h)||!t.visible()||t.removed()||!a.allowEdgeTxrCaching&&t.isEdge()||!a.allowParentTxrCaching&&t.isParent())return null;if(n==null&&(n=Math.ceil(IT(l*r))),n<$p)n=$p;else if(l>=Vj||n>mk)return null;var c=Math.pow(2,n),h=e.h*c,d=e.w*c,g=s.eleTextBiggerThanMin(t,c);if(!this.isVisible(t,g))return null;var m=o.get(t,n);if(m&&m.invalidated&&(m.invalidated=!1,m.texture.invalidatedWidth-=m.width),m)return m;var y;if(h<=LN?y=LN:h<=up?y=up:y=Math.ceil(h/up)*up,h>bK||d>yK)return null;var b=a.getTextureQueue(y),x=b[b.length-2],w=function(){return a.recycleTexture(y,d)||a.addTexture(y,d)};x||(x=b[b.length-1]),x||(x=w()),x.width-x.usedWidth<d&&(x=w());for(var S=function(q){return q&&q.scaledLabelShown===g},k=i&&i===vu.dequeue,E=i&&i===vu.highQuality,M=i&&i===vu.downscale,R,O=n+1;O<=mk;O++){var N=o.get(t,O);if(N){R=N;break}}var B=R&&R.level===n+1?R:null,D=function(){x.context.drawImage(B.texture.canvas,B.x,0,B.width,B.height,x.usedWidth,0,d,h)};if(x.context.setTransform(1,0,0,1,0,0),x.context.clearRect(x.usedWidth,0,d,y),S(B))D();else if(S(R))if(E){for(var _=R.level;_>n;_--)B=a.getElement(t,e,r,_,vu.downscale);D()}else return a.queueElement(t,R.level-1),R;else{var P;if(!k&&!E&&!M)for(var z=n-1;z>=$p;z--){var H=o.get(t,z);if(H){P=H;break}}if(S(P))return a.queueElement(t,n),P;x.context.translate(x.usedWidth,0),x.context.scale(c,c),this.drawElement(x.context,t,e,g,!1),x.context.scale(1/c,1/c),x.context.translate(-x.usedWidth,0)}return m={x:x.usedWidth,texture:x,level:n,scale:c,width:d,height:h,scaledLabelShown:g},x.usedWidth+=Math.ceil(d+vK),x.eleCaches.push(m),o.set(t,n,m),a.checkTextureFullness(x),m};jr.invalidateElements=function(t){for(var e=0;e<t.length;e++)this.invalidateElement(t[e])};jr.invalidateElement=function(t){var e=this,r=e.lookup,n=[],i=r.isInvalid(t);if(i){for(var a=$p;a<=mk;a++){var s=r.getForCachedKey(t,a);s&&n.push(s)}var l=r.invalidate(t);if(l)for(var o=0;o<n.length;o++){var c=n[o],h=c.texture;h.invalidatedWidth+=c.width,c.invalidated=!0,e.checkTextureUtility(h)}e.removeFromQueue(t)}};jr.checkTextureUtility=function(t){t.invalidatedWidth>=xK*t.width&&this.retireTexture(t)};jr.checkTextureFullness=function(t){var e=this,r=e.getTextureQueue(t.height);t.usedWidth/t.width>wK&&t.fullnessChecks>=SK?Xs(r,t):t.fullnessChecks++};jr.retireTexture=function(t){var e=this,r=t.height,n=e.getTextureQueue(r),i=this.lookup;Xs(n,t),t.retired=!0;for(var a=t.eleCaches,s=0;s<a.length;s++){var l=a[s];i.deleteCache(l.key,l.level)}zT(a);var o=e.getRetiredTextureQueue(r);o.push(t)};jr.addTexture=function(t,e){var r=this,n=r.getTextureQueue(t),i={};return n.push(i),i.eleCaches=[],i.height=t,i.width=Math.max(mK,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};jr.recycleTexture=function(t,e){for(var r=this,n=r.getTextureQueue(t),i=r.getRetiredTextureQueue(t),a=0;a<i.length;a++){var s=i[a];if(s.width>=e)return s.retired=!1,s.usedWidth=0,s.invalidatedWidth=0,s.fullnessChecks=0,zT(s.eleCaches),s.context.setTransform(1,0,0,1,0,0),s.context.clearRect(0,0,s.width,s.height),Xs(i,s),n.push(s),s}};jr.queueElement=function(t,e){var r=this,n=r.getElementQueue(),i=r.getElementKeyToQueue(),a=this.getKey(t),s=i[a];if(s)s.level=Math.max(s.level,e),s.eles.merge(t),s.reqs++,n.updateItem(s);else{var l={eles:t.spawn().merge(t),level:e,reqs:1,key:a};n.push(l),i[a]=l}};jr.dequeue=function(t){for(var e=this,r=e.getElementQueue(),n=e.getElementKeyToQueue(),i=[],a=e.lookup,s=0;s<OK&&r.size()>0;s++){var l=r.pop(),o=l.key,c=l.eles[0],h=a.hasCache(c,l.level);if(n[o]=null,h)continue;i.push(l);var d=e.getBoundingBox(c);e.getElement(c,d,t,l.level,vu.dequeue)}return i};jr.removeFromQueue=function(t){var e=this,r=e.getElementQueue(),n=e.getElementKeyToQueue(),i=this.getKey(t),a=n[i];a!=null&&(a.eles.length===1?(a.reqs=LT,r.updateItem(a),r.pop(),n[i]=null):a.eles.unmerge(t))};jr.onDequeue=function(t){this.onDequeues.push(t)};jr.offDequeue=function(t){Xs(this.onDequeues,t)};jr.setupDequeueing=Hj.setupDequeueing({deqRedrawThreshold:AK,deqCost:CK,deqAvgCost:kK,deqNoDrawCost:TK,deqFastCost:EK,deq:function(e,r,n){return e.dequeue(r,n)},onDeqd:function(e,r){for(var n=0;n<e.onDequeues.length;n++){var i=e.onDequeues[n];i(r)}},shouldRedraw:function(e,r,n,i){for(var a=0;a<r.length;a++)for(var s=r[a].eles,l=0;l<s.length;l++){var o=s[l].boundingBox();if(jT(o,i))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var RK=1,wf=-4,Sg=2,DK=3.99,_K=50,NK=50,BK=.15,LK=.1,PK=.9,zK=.9,IK=1,PN=250,qK=4e3*4e3,zN=32767,jK=!0,Uj=function(e){var r=this,n=r.renderer=e,i=n.cy;r.layersByLevel={},r.firstGet=!0,r.lastInvalidationTime=Ya()-2*PN,r.skipping=!1,r.eleTxrDeqs=i.collection(),r.scheduleElementRefinement=vh(function(){r.refineElementTextures(r.eleTxrDeqs),r.eleTxrDeqs.unmerge(r.eleTxrDeqs)},NK),n.beforeRender(function(s,l){l-r.lastInvalidationTime<=PN?r.skipping=!0:r.skipping=!1},n.beforeRenderPriorities.lyrTxrSkip);var a=function(l,o){return o.reqs-l.reqs};r.layersQueue=new mh(a),r.setupDequeueing()},fn=Uj.prototype,IN=0,FK=Math.pow(2,53)-1;fn.makeLayer=function(t,e){var r=Math.pow(2,e),n=Math.ceil(t.w*r),i=Math.ceil(t.h*r),a=this.renderer.makeOffscreenCanvas(n,i),s={id:IN=++IN%FK,bb:t,level:e,width:n,height:i,canvas:a,context:a.getContext("2d"),eles:[],elesQueue:[],reqs:0},l=s.context,o=-s.bb.x1,c=-s.bb.y1;return l.scale(r,r),l.translate(o,c),s};fn.getLayers=function(t,e,r){var n=this,i=n.renderer,a=i.cy,s=a.zoom(),l=n.firstGet;if(n.firstGet=!1,r==null){if(r=Math.ceil(IT(s*e)),r<wf)r=wf;else if(s>=DK||r>Sg)return null}n.validateLayersElesOrdering(r,t);var o=n.layersByLevel,c=Math.pow(2,r),h=o[r]=o[r]||[],d,g=n.levelIsComplete(r,t),m,y=function(){var D=function($){if(n.validateLayersElesOrdering($,t),n.levelIsComplete($,t))return m=o[$],!0},_=function($){if(!m)for(var q=r+$;wf<=q&&q<=Sg&&!D(q);q+=$);};_(1),_(-1);for(var P=h.length-1;P>=0;P--){var z=h[P];z.invalid&&Xs(h,z)}};if(!g)y();else return h;var b=function(){if(!d){d=Rn();for(var D=0;D<t.length;D++)IY(d,t[D].boundingBox())}return d},x=function(D){D=D||{};var _=D.after;b();var P=Math.ceil(d.w*c),z=Math.ceil(d.h*c);if(P>zN||z>zN)return null;var H=P*z;if(H>qK)return null;var $=n.makeLayer(d,r);if(_!=null){var q=h.indexOf(_)+1;h.splice(q,0,$)}else(D.insert===void 0||D.insert)&&h.unshift($);return $};if(n.skipping&&!l)return null;for(var w=null,S=t.length/RK,k=!l,E=0;E<t.length;E++){var M=t[E],R=M._private.rscratch,O=R.imgLayerCaches=R.imgLayerCaches||{},N=O[r];if(N){w=N;continue}if((!w||w.eles.length>=S||!Iq(w.bb,M.boundingBox()))&&(w=x({insert:!0,after:w}),!w))return null;m||k?n.queueLayer(w,M):n.drawEleInLayer(w,M,r,e),w.eles.push(M),O[r]=w}return m||(k?null:h)};fn.getEleLevelForLayerLevel=function(t,e){return t};fn.drawEleInLayer=function(t,e,r,n){var i=this,a=this.renderer,s=t.context,l=e.boundingBox();l.w===0||l.h===0||!e.visible()||(r=i.getEleLevelForLayerLevel(r,n),a.setImgSmoothing(s,!1),a.drawCachedElement(s,e,null,null,r,jK),a.setImgSmoothing(s,!0))};fn.levelIsComplete=function(t,e){var r=this,n=r.layersByLevel[t];if(!n||n.length===0)return!1;for(var i=0,a=0;a<n.length;a++){var s=n[a];if(s.reqs>0||s.invalid)return!1;i+=s.eles.length}return i===e.length};fn.validateLayersElesOrdering=function(t,e){var r=this.layersByLevel[t];if(r)for(var n=0;n<r.length;n++){for(var i=r[n],a=-1,s=0;s<e.length;s++)if(i.eles[0]===e[s]){a=s;break}if(a<0){this.invalidateLayer(i);continue}for(var l=a,s=0;s<i.eles.length;s++)if(i.eles[s]!==e[l+s]){this.invalidateLayer(i);break}}};fn.updateElementsInLayers=function(t,e){for(var r=this,n=hh(t[0]),i=0;i<t.length;i++)for(var a=n?null:t[i],s=n?t[i]:t[i].ele,l=s._private.rscratch,o=l.imgLayerCaches=l.imgLayerCaches||{},c=wf;c<=Sg;c++){var h=o[c];h&&(a&&r.getEleLevelForLayerLevel(h.level)!==a.level||e(h,s,a))}};fn.haveLayers=function(){for(var t=this,e=!1,r=wf;r<=Sg;r++){var n=t.layersByLevel[r];if(n&&n.length>0){e=!0;break}}return e};fn.invalidateElements=function(t){var e=this;t.length!==0&&(e.lastInvalidationTime=Ya(),!(t.length===0||!e.haveLayers())&&e.updateElementsInLayers(t,function(n,i,a){e.invalidateLayer(n)}))};fn.invalidateLayer=function(t){if(this.lastInvalidationTime=Ya(),!t.invalid){var e=t.level,r=t.eles,n=this.layersByLevel[e];Xs(n,t),t.elesQueue=[],t.invalid=!0,t.replacement&&(t.replacement.invalid=!0);for(var i=0;i<r.length;i++){var a=r[i]._private.rscratch.imgLayerCaches;a&&(a[e]=null)}}};fn.refineElementTextures=function(t){var e=this;e.updateElementsInLayers(t,function(n,i,a){var s=n.replacement;if(s||(s=n.replacement=e.makeLayer(n.bb,n.level),s.replaces=n,s.eles=n.eles),!s.reqs)for(var l=0;l<s.eles.length;l++)e.queueLayer(s,s.eles[l])})};fn.enqueueElementRefinement=function(t){this.eleTxrDeqs.merge(t),this.scheduleElementRefinement()};fn.queueLayer=function(t,e){var r=this,n=r.layersQueue,i=t.elesQueue,a=i.hasId=i.hasId||{};if(!t.replacement){if(e){if(a[e.id()])return;i.push(e),a[e.id()]=!0}t.reqs?(t.reqs++,n.updateItem(t)):(t.reqs=1,n.push(t))}};fn.dequeue=function(t){for(var e=this,r=e.layersQueue,n=[],i=0;i<IK&&r.size()!==0;){var a=r.peek();if(a.replacement){r.pop();continue}if(a.replaces&&a!==a.replaces.replacement){r.pop();continue}if(a.invalid){r.pop();continue}var s=a.elesQueue.shift();s&&(e.drawEleInLayer(a,s,a.level,t),i++),n.length===0&&n.push(!0),a.elesQueue.length===0&&(r.pop(),a.reqs=0,a.replaces&&e.applyLayerReplacement(a),e.requestRedraw())}return n};fn.applyLayerReplacement=function(t){var e=this,r=e.layersByLevel[t.level],n=t.replaces,i=r.indexOf(n);if(!(i<0||n.invalid)){r[i]=t;for(var a=0;a<t.eles.length;a++){var s=t.eles[a]._private,l=s.imgLayerCaches=s.imgLayerCaches||{};l&&(l[t.level]=t)}e.requestRedraw()}};fn.requestRedraw=vh(function(){var t=this.renderer;t.redrawHint("eles",!0),t.redrawHint("drag",!0),t.redraw()},100);fn.setupDequeueing=Hj.setupDequeueing({deqRedrawThreshold:_K,deqCost:BK,deqAvgCost:LK,deqNoDrawCost:PK,deqFastCost:zK,deq:function(e,r){return e.dequeue(r)},onDeqd:PT,shouldRedraw:_q,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var $j={},qN;function HK(t,e){for(var r=0;r<e.length;r++){var n=e[r];t.lineTo(n.x,n.y)}}function VK(t,e,r){for(var n,i=0;i<e.length;i++){var a=e[i];i===0&&(n=a),t.lineTo(a.x,a.y)}t.quadraticCurveTo(r.x,r.y,n.x,n.y)}function jN(t,e,r){t.beginPath&&t.beginPath();for(var n=e,i=0;i<n.length;i++){var a=n[i];t.lineTo(a.x,a.y)}var s=r,l=r[0];t.moveTo(l.x,l.y);for(var i=1;i<s.length;i++){var a=s[i];t.lineTo(a.x,a.y)}t.closePath&&t.closePath()}function UK(t,e,r,n,i){t.beginPath&&t.beginPath(),t.arc(r,n,i,0,Math.PI*2,!1);var a=e,s=a[0];t.moveTo(s.x,s.y);for(var l=0;l<a.length;l++){var o=a[l];t.lineTo(o.x,o.y)}t.closePath&&t.closePath()}function $K(t,e,r,n){t.arc(e,r,n,0,Math.PI*2,!1)}$j.arrowShapeImpl=function(t){return(qN||(qN={polygon:HK,"triangle-backcurve":VK,"triangle-tee":jN,"circle-triangle":UK,"triangle-cross":jN,circle:$K}))[t]};var ga={};ga.drawElement=function(t,e,r,n,i,a){var s=this;e.isNode()?s.drawNode(t,e,r,n,i,a):s.drawEdge(t,e,r,n,i,a)};ga.drawElementOverlay=function(t,e){var r=this;e.isNode()?r.drawNodeOverlay(t,e):r.drawEdgeOverlay(t,e)};ga.drawElementUnderlay=function(t,e){var r=this;e.isNode()?r.drawNodeUnderlay(t,e):r.drawEdgeUnderlay(t,e)};ga.drawCachedElementPortion=function(t,e,r,n,i,a,s,l){var o=this,c=r.getBoundingBox(e);if(!(c.w===0||c.h===0)){var h=r.getElement(e,c,n,i,a);if(h!=null){var d=l(o,e);if(d===0)return;var g=s(o,e),m=c.x1,y=c.y1,b=c.w,x=c.h,w,S,k,E,M;if(g!==0){var R=r.getRotationPoint(e);k=R.x,E=R.y,t.translate(k,E),t.rotate(g),M=o.getImgSmoothing(t),M||o.setImgSmoothing(t,!0);var O=r.getRotationOffset(e);w=O.x,S=O.y}else w=m,S=y;var N;d!==1&&(N=t.globalAlpha,t.globalAlpha=N*d),t.drawImage(h.texture.canvas,h.x,0,h.width,h.height,w,S,b,x),d!==1&&(t.globalAlpha=N),g!==0&&(t.rotate(-g),t.translate(-k,-E),M||o.setImgSmoothing(t,!1))}else r.drawElement(t,e)}};var GK=function(){return 0},YK=function(e,r){return e.getTextAngle(r,null)},XK=function(e,r){return e.getTextAngle(r,"source")},WK=function(e,r){return e.getTextAngle(r,"target")},QK=function(e,r){return r.effectiveOpacity()},Vb=function(e,r){return r.pstyle("text-opacity").pfValue*r.effectiveOpacity()};ga.drawCachedElement=function(t,e,r,n,i,a){var s=this,l=s.data,o=l.eleTxrCache,c=l.lblTxrCache,h=l.slbTxrCache,d=l.tlbTxrCache,g=e.boundingBox(),m=a===!0?o.reasons.highQuality:null;if(!(g.w===0||g.h===0||!e.visible())&&(!n||jT(g,n))){var y=e.isEdge(),b=e.element()._private.rscratch.badLine;s.drawElementUnderlay(t,e),s.drawCachedElementPortion(t,e,o,r,i,m,GK,QK),(!y||!b)&&s.drawCachedElementPortion(t,e,c,r,i,m,YK,Vb),y&&!b&&(s.drawCachedElementPortion(t,e,h,r,i,m,XK,Vb),s.drawCachedElementPortion(t,e,d,r,i,m,WK,Vb)),s.drawElementOverlay(t,e)}};ga.drawElements=function(t,e){for(var r=this,n=0;n<e.length;n++){var i=e[n];r.drawElement(t,i)}};ga.drawCachedElements=function(t,e,r,n){for(var i=this,a=0;a<e.length;a++){var s=e[a];i.drawCachedElement(t,s,r,n)}};ga.drawCachedNodes=function(t,e,r,n){for(var i=this,a=0;a<e.length;a++){var s=e[a];s.isNode()&&i.drawCachedElement(t,s,r,n)}};ga.drawLayeredElements=function(t,e,r,n){var i=this,a=i.data.lyrTxrCache.getLayers(e,r);if(a)for(var s=0;s<a.length;s++){var l=a[s],o=l.bb;o.w===0||o.h===0||t.drawImage(l.canvas,o.x1,o.y1,o.w,o.h)}else i.drawCachedElements(t,e,r,n)};var es={};es.drawEdge=function(t,e,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,l=e._private.rscratch;if(!(a&&!e.visible())&&!(l.badLine||l.allpts==null||isNaN(l.allpts[0]))){var o;r&&(o=r,t.translate(-o.x1,-o.y1));var c=a?e.pstyle("opacity").value:1,h=a?e.pstyle("line-opacity").value:1,d=e.pstyle("curve-style").value,g=e.pstyle("line-style").value,m=e.pstyle("width").pfValue,y=e.pstyle("line-cap").value,b=e.pstyle("line-outline-width").value,x=e.pstyle("line-outline-color").value,w=c*h,S=c*h,k=function(){var $=arguments.length>0&&arguments[0]!==void 0?arguments[0]:w;d==="straight-triangle"?(s.eleStrokeStyle(t,e,$),s.drawEdgeTrianglePath(e,t,l.allpts)):(t.lineWidth=m,t.lineCap=y,s.eleStrokeStyle(t,e,$),s.drawEdgePath(e,t,l.allpts,g),t.lineCap="butt")},E=function(){var $=arguments.length>0&&arguments[0]!==void 0?arguments[0]:w;if(t.lineWidth=m+b,t.lineCap=y,b>0)s.colorStrokeStyle(t,x[0],x[1],x[2],$);else{t.lineCap="butt";return}d==="straight-triangle"?s.drawEdgeTrianglePath(e,t,l.allpts):(s.drawEdgePath(e,t,l.allpts,g),t.lineCap="butt")},M=function(){i&&s.drawEdgeOverlay(t,e)},R=function(){i&&s.drawEdgeUnderlay(t,e)},O=function(){var $=arguments.length>0&&arguments[0]!==void 0?arguments[0]:S;s.drawArrowheads(t,e,$)},N=function(){s.drawElementText(t,e,null,n)};t.lineJoin="round";var B=e.pstyle("ghost").value==="yes";if(B){var D=e.pstyle("ghost-offset-x").pfValue,_=e.pstyle("ghost-offset-y").pfValue,P=e.pstyle("ghost-opacity").value,z=w*P;t.translate(D,_),k(z),O(z),t.translate(-D,-_)}else E();R(),k(),O(),M(),N(),r&&t.translate(o.x1,o.y1)}};var Gj=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,n){if(n.visible()){var i=n.pstyle("".concat(e,"-opacity")).value;if(i!==0){var a=this,s=a.usePaths(),l=n._private.rscratch,o=n.pstyle("".concat(e,"-padding")).pfValue,c=2*o,h=n.pstyle("".concat(e,"-color")).value;r.lineWidth=c,l.edgeType==="self"&&!s?r.lineCap="butt":r.lineCap="round",a.colorStrokeStyle(r,h[0],h[1],h[2],i),a.drawEdgePath(n,r,l.allpts,"solid")}}}};es.drawEdgeOverlay=Gj("overlay");es.drawEdgeUnderlay=Gj("underlay");es.drawEdgePath=function(t,e,r,n){var i=t._private.rscratch,a=e,s,l=!1,o=this.usePaths(),c=t.pstyle("line-dash-pattern").pfValue,h=t.pstyle("line-dash-offset").pfValue;if(o){var d=r.join("$"),g=i.pathCacheKey&&i.pathCacheKey===d;g?(s=e=i.pathCache,l=!0):(s=e=new Path2D,i.pathCacheKey=d,i.pathCache=s)}if(a.setLineDash)switch(n){case"dotted":a.setLineDash([1,1]);break;case"dashed":a.setLineDash(c),a.lineDashOffset=h;break;case"solid":a.setLineDash([]);break}if(!l&&!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 m=2;m+3<r.length;m+=4)e.quadraticCurveTo(r[m],r[m+1],r[m+2],r[m+3]);break;case"straight":case"haystack":for(var y=2;y+1<r.length;y+=2)e.lineTo(r[y],r[y+1]);break;case"segments":if(i.isRound){var b=Yn(i.roundCorners),x;try{for(b.s();!(x=b.n()).done;){var w=x.value;Bj(e,w)}}catch(k){b.e(k)}finally{b.f()}e.lineTo(r[r.length-2],r[r.length-1])}else for(var S=2;S+1<r.length;S+=2)e.lineTo(r[S],r[S+1]);break}e=a,o?e.stroke(s):e.stroke(),e.setLineDash&&e.setLineDash([])};es.drawEdgeTrianglePath=function(t,e,r){e.fillStyle=e.strokeStyle;for(var n=t.pstyle("width").pfValue,i=0;i+1<r.length;i+=2){var a=[r[i+2]-r[i],r[i+3]-r[i+1]],s=Math.sqrt(a[0]*a[0]+a[1]*a[1]),l=[a[1]/s,-a[0]/s],o=[l[0]*n/2,l[1]*n/2];e.beginPath(),e.moveTo(r[i]-o[0],r[i+1]-o[1]),e.lineTo(r[i]+o[0],r[i+1]+o[1]),e.lineTo(r[i+2],r[i+3]),e.closePath(),e.fill()}};es.drawArrowheads=function(t,e,r){var n=e._private.rscratch,i=n.edgeType==="haystack";i||this.drawArrowhead(t,e,"source",n.arrowStartX,n.arrowStartY,n.srcArrowAngle,r),this.drawArrowhead(t,e,"mid-target",n.midX,n.midY,n.midtgtArrowAngle,r),this.drawArrowhead(t,e,"mid-source",n.midX,n.midY,n.midsrcArrowAngle,r),i||this.drawArrowhead(t,e,"target",n.arrowEndX,n.arrowEndY,n.tgtArrowAngle,r)};es.drawArrowhead=function(t,e,r,n,i,a,s){if(!(isNaN(n)||n==null||isNaN(i)||i==null||isNaN(a)||a==null)){var l=this,o=e.pstyle(r+"-arrow-shape").value;if(o!=="none"){var c=e.pstyle(r+"-arrow-fill").value==="hollow"?"both":"filled",h=e.pstyle(r+"-arrow-fill").value,d=e.pstyle("width").pfValue,g=e.pstyle(r+"-arrow-width"),m=g.value==="match-line"?d:g.pfValue;g.units==="%"&&(m*=d);var y=e.pstyle("opacity").value;s===void 0&&(s=y);var b=t.globalCompositeOperation;(s!==1||h==="hollow")&&(t.globalCompositeOperation="destination-out",l.colorFillStyle(t,255,255,255,1),l.colorStrokeStyle(t,255,255,255,1),l.drawArrowShape(e,t,c,d,o,m,n,i,a),t.globalCompositeOperation=b);var x=e.pstyle(r+"-arrow-color").value;l.colorFillStyle(t,x[0],x[1],x[2],s),l.colorStrokeStyle(t,x[0],x[1],x[2],s),l.drawArrowShape(e,t,h,d,o,m,n,i,a)}}};es.drawArrowShape=function(t,e,r,n,i,a,s,l,o){var c=this,h=this.usePaths()&&i!=="triangle-cross",d=!1,g,m=e,y={x:s,y:l},b=t.pstyle("arrow-scale").value,x=this.getArrowWidth(n,b),w=c.arrowShapes[i];if(h){var S=c.arrowPathCache=c.arrowPathCache||[],k=Ql(i),E=S[k];E!=null?(g=e=E,d=!0):(g=e=new Path2D,S[k]=g)}d||(e.beginPath&&e.beginPath(),h?w.draw(e,1,0,{x:0,y:0},1):w.draw(e,x,o,y,n),e.closePath&&e.closePath()),e=m,h&&(e.translate(s,l),e.rotate(o),e.scale(x,x)),(r==="filled"||r==="both")&&(h?e.fill(g):e.fill()),(r==="hollow"||r==="both")&&(e.lineWidth=a/(h?x:1),e.lineJoin="miter",h?e.stroke(g):e.stroke()),h&&(e.scale(1/x,1/x),e.rotate(-o),e.translate(-s,-l))};var eE={};eE.safeDrawImage=function(t,e,r,n,i,a,s,l,o,c){if(!(i<=0||a<=0||o<=0||c<=0))try{t.drawImage(e,r,n,i,a,s,l,o,c)}catch(h){jt(h)}};eE.drawInscribedImage=function(t,e,r,n,i){var a=this,s=r.position(),l=s.x,o=s.y,c=r.cy().style(),h=c.getIndexedStyle.bind(c),d=h(r,"background-fit","value",n),g=h(r,"background-repeat","value",n),m=r.width(),y=r.height(),b=r.padding()*2,x=m+(h(r,"background-width-relative-to","value",n)==="inner"?0:b),w=y+(h(r,"background-height-relative-to","value",n)==="inner"?0:b),S=r._private.rscratch,k=h(r,"background-clip","value",n),E=k==="node",M=h(r,"background-image-opacity","value",n)*i,R=h(r,"background-image-smoothing","value",n),O=r.pstyle("corner-radius").value;O!=="auto"&&(O=r.pstyle("corner-radius").pfValue);var N=e.width||e.cachedW,B=e.height||e.cachedH;(N==null||B==null)&&(document.body.appendChild(e),N=e.cachedW=e.width||e.offsetWidth,B=e.cachedH=e.height||e.offsetHeight,document.body.removeChild(e));var D=N,_=B;if(h(r,"background-width","value",n)!=="auto"&&(h(r,"background-width","units",n)==="%"?D=h(r,"background-width","pfValue",n)*x:D=h(r,"background-width","pfValue",n)),h(r,"background-height","value",n)!=="auto"&&(h(r,"background-height","units",n)==="%"?_=h(r,"background-height","pfValue",n)*w:_=h(r,"background-height","pfValue",n)),!(D===0||_===0)){if(d==="contain"){var P=Math.min(x/D,w/_);D*=P,_*=P}else if(d==="cover"){var P=Math.max(x/D,w/_);D*=P,_*=P}var z=l-x/2,H=h(r,"background-position-x","units",n),$=h(r,"background-position-x","pfValue",n);H==="%"?z+=(x-D)*$:z+=$;var q=h(r,"background-offset-x","units",n),V=h(r,"background-offset-x","pfValue",n);q==="%"?z+=(x-D)*V:z+=V;var X=o-w/2,ee=h(r,"background-position-y","units",n),te=h(r,"background-position-y","pfValue",n);ee==="%"?X+=(w-_)*te:X+=te;var I=h(r,"background-offset-y","units",n),G=h(r,"background-offset-y","pfValue",n);I==="%"?X+=(w-_)*G:X+=G,S.pathCache&&(z-=l,X-=o,l=0,o=0);var re=t.globalAlpha;t.globalAlpha=M;var Y=a.getImgSmoothing(t),W=!1;if(R==="no"&&Y?(a.setImgSmoothing(t,!1),W=!0):R==="yes"&&!Y&&(a.setImgSmoothing(t,!0),W=!0),g==="no-repeat")E&&(t.save(),S.pathCache?t.clip(S.pathCache):(a.nodeShapes[a.getNodeShape(r)].draw(t,l,o,x,w,O,S),t.clip())),a.safeDrawImage(t,e,0,0,N,B,z,X,D,_),E&&t.restore();else{var Z=t.createPattern(e,g);t.fillStyle=Z,a.nodeShapes[a.getNodeShape(r)].draw(t,l,o,x,w,O,S),t.translate(z,X),t.fill(),t.translate(-z,-X)}t.globalAlpha=re,W&&a.setImgSmoothing(t,Y)}};var oo={};oo.eleTextBiggerThanMin=function(t,e){if(!e){var r=t.cy().zoom(),n=this.getPixelRatio(),i=Math.ceil(IT(r*n));e=Math.pow(2,i)}var a=t.pstyle("font-size").pfValue*e,s=t.pstyle("min-zoomed-font-size").pfValue;return!(a<s)};oo.drawElementText=function(t,e,r,n,i){var a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this;if(n==null){if(a&&!s.eleTextBiggerThanMin(e))return}else if(n===!1)return;if(e.isNode()){var l=e.pstyle("label");if(!l||!l.value)return;var o=s.getLabelJustification(e);t.textAlign=o,t.textBaseline="bottom"}else{var c=e.element()._private.rscratch.badLine,h=e.pstyle("label"),d=e.pstyle("source-label"),g=e.pstyle("target-label");if(c||(!h||!h.value)&&(!d||!d.value)&&(!g||!g.value))return;t.textAlign="center",t.textBaseline="bottom"}var m=!r,y;r&&(y=r,t.translate(-y.x1,-y.y1)),i==null?(s.drawText(t,e,null,m,a),e.isEdge()&&(s.drawText(t,e,"source",m,a),s.drawText(t,e,"target",m,a))):s.drawText(t,e,i,m,a),r&&t.translate(y.x1,y.y1)};oo.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};oo.setupTextStyle=function(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,n=e.pstyle("font-style").strValue,i=e.pstyle("font-size").pfValue+"px",a=e.pstyle("font-family").strValue,s=e.pstyle("font-weight").strValue,l=r?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,o=e.pstyle("text-outline-opacity").value*l,c=e.pstyle("color").value,h=e.pstyle("text-outline-color").value;t.font=n+" "+s+" "+i+" "+a,t.lineJoin="round",this.colorFillStyle(t,c[0],c[1],c[2],l),this.colorStrokeStyle(t,h[0],h[1],h[2],o)};function KK(t,e,r,n,i){var a=Math.min(n,i),s=a/2,l=e+n/2,o=r+i/2;t.beginPath(),t.arc(l,o,s,0,Math.PI*2),t.closePath()}function FN(t,e,r,n,i){var a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,s=Math.min(a,n/2,i/2);t.beginPath(),t.moveTo(e+s,r),t.lineTo(e+n-s,r),t.quadraticCurveTo(e+n,r,e+n,r+s),t.lineTo(e+n,r+i-s),t.quadraticCurveTo(e+n,r+i,e+n-s,r+i),t.lineTo(e+s,r+i),t.quadraticCurveTo(e,r+i,e,r+i-s),t.lineTo(e,r+s),t.quadraticCurveTo(e,r,e+s,r),t.closePath()}oo.getTextAngle=function(t,e){var r,n=t._private,i=n.rscratch,a=e?e+"-":"",s=t.pstyle(a+"text-rotation");if(s.strValue==="autorotate"){var l=Fn(i,"labelAngle",e);r=t.isEdge()?l:0}else s.strValue==="none"?r=0:r=s.pfValue;return r};oo.drawText=function(t,e,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=e._private,s=a.rscratch,l=i?e.effectiveOpacity():1;if(!(i&&(l===0||e.pstyle("text-opacity").value===0))){r==="main"&&(r=null);var o=Fn(s,"labelX",r),c=Fn(s,"labelY",r),h,d,g=this.getLabelText(e,r);if(g!=null&&g!==""&&!isNaN(o)&&!isNaN(c)){this.setupTextStyle(t,e,i);var m=r?r+"-":"",y=Fn(s,"labelWidth",r),b=Fn(s,"labelHeight",r),x=e.pstyle(m+"text-margin-x").pfValue,w=e.pstyle(m+"text-margin-y").pfValue,S=e.isEdge(),k=e.pstyle("text-halign").value,E=e.pstyle("text-valign").value;S&&(k="center",E="center"),o+=x,c+=w;var M;switch(n?M=this.getTextAngle(e,r):M=0,M!==0&&(h=o,d=c,t.translate(h,d),t.rotate(M),o=0,c=0),E){case"top":break;case"center":c+=b/2;break;case"bottom":c+=b;break}var R=e.pstyle("text-background-opacity").value,O=e.pstyle("text-border-opacity").value,N=e.pstyle("text-border-width").pfValue,B=e.pstyle("text-background-padding").pfValue,D=e.pstyle("text-background-shape").strValue,_=D==="round-rectangle"||D==="roundrectangle",P=D==="circle",z=2;if(R>0||N>0&&O>0){var H=t.fillStyle,$=t.strokeStyle,q=t.lineWidth,V=e.pstyle("text-background-color").value,X=e.pstyle("text-border-color").value,ee=e.pstyle("text-border-style").value,te=R>0,I=N>0&&O>0,G=o-B;switch(k){case"left":G-=y;break;case"center":G-=y/2;break}var re=c-b-B,Y=y+2*B,W=b+2*B;if(te&&(t.fillStyle="rgba(".concat(V[0],",").concat(V[1],",").concat(V[2],",").concat(R*l,")")),I&&(t.strokeStyle="rgba(".concat(X[0],",").concat(X[1],",").concat(X[2],",").concat(O*l,")"),t.lineWidth=N,t.setLineDash))switch(ee){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"double":t.lineWidth=N/4,t.setLineDash([]);break;default:t.setLineDash([]);break}if(_?(t.beginPath(),FN(t,G,re,Y,W,z)):P?(t.beginPath(),KK(t,G,re,Y,W)):(t.beginPath(),t.rect(G,re,Y,W)),te&&t.fill(),I&&t.stroke(),I&&ee==="double"){var Z=N/2;t.beginPath(),_?FN(t,G+Z,re+Z,Y-2*Z,W-2*Z,z):t.rect(G+Z,re+Z,Y-2*Z,W-2*Z),t.stroke()}t.fillStyle=H,t.strokeStyle=$,t.lineWidth=q,t.setLineDash&&t.setLineDash([])}var ie=2*e.pstyle("text-outline-width").pfValue;if(ie>0&&(t.lineWidth=ie),e.pstyle("text-wrap").value==="wrap"){var we=Fn(s,"labelWrapCachedLines",r),de=Fn(s,"labelLineHeight",r),se=y/2,j=this.getLabelJustification(e);switch(j==="auto"||(k==="left"?j==="left"?o+=-y:j==="center"&&(o+=-se):k==="center"?j==="left"?o+=-se:j==="right"&&(o+=se):k==="right"&&(j==="center"?o+=se:j==="right"&&(o+=y))),E){case"top":c-=(we.length-1)*de;break;case"center":case"bottom":c-=(we.length-1)*de;break}for(var Q=0;Q<we.length;Q++)ie>0&&t.strokeText(we[Q],o,c),t.fillText(we[Q],o,c),c+=de}else ie>0&&t.strokeText(g,o,c),t.fillText(g,o,c);M!==0&&(t.rotate(-M),t.translate(-h,-d))}}};var ul={};ul.drawNode=function(t,e,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,l,o,c=e._private,h=c.rscratch,d=e.position();if(!(!qe(d.x)||!qe(d.y))&&!(a&&!e.visible())){var g=a?e.effectiveOpacity():1,m=s.usePaths(),y,b=!1,x=e.padding();l=e.width()+2*x,o=e.height()+2*x;var w;r&&(w=r,t.translate(-w.x1,-w.y1));for(var S=e.pstyle("background-image"),k=S.value,E=new Array(k.length),M=new Array(k.length),R=0,O=0;O<k.length;O++){var N=k[O],B=E[O]=N!=null&&N!=="none";if(B){var D=e.cy().style().getIndexedStyle(e,"background-image-crossorigin","value",O);R++,M[O]=s.getCachedImage(N,D,function(){c.backgroundTimestamp=Date.now(),e.emitAndNotify("background")})}}var _=e.pstyle("background-blacken").value,P=e.pstyle("border-width").pfValue,z=e.pstyle("background-opacity").value*g,H=e.pstyle("border-color").value,$=e.pstyle("border-style").value,q=e.pstyle("border-join").value,V=e.pstyle("border-cap").value,X=e.pstyle("border-position").value,ee=e.pstyle("border-dash-pattern").pfValue,te=e.pstyle("border-dash-offset").pfValue,I=e.pstyle("border-opacity").value*g,G=e.pstyle("outline-width").pfValue,re=e.pstyle("outline-color").value,Y=e.pstyle("outline-style").value,W=e.pstyle("outline-opacity").value*g,Z=e.pstyle("outline-offset").value,ie=e.pstyle("corner-radius").value;ie!=="auto"&&(ie=e.pstyle("corner-radius").pfValue);var we=function(){var Re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:z;s.eleFillStyle(t,e,Re)},de=function(){var Re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:I;s.colorStrokeStyle(t,H[0],H[1],H[2],Re)},se=function(){var Re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:W;s.colorStrokeStyle(t,re[0],re[1],re[2],Re)},j=function(Re,ce,F,J){var oe=s.nodePathCache=s.nodePathCache||[],le=Dq(F==="polygon"?F+","+J.join(","):F,""+ce,""+Re,""+ie),he=oe[le],_e,be=!1;return he!=null?(_e=he,be=!0,h.pathCache=_e):(_e=new Path2D,oe[le]=h.pathCache=_e),{path:_e,cacheHit:be}},Q=e.pstyle("shape").strValue,K=e.pstyle("shape-polygon-points").pfValue;if(m){t.translate(d.x,d.y);var ue=j(l,o,Q,K);y=ue.path,b=ue.cacheHit}var Se=function(){if(!b){var Re=d;m&&(Re={x:0,y:0}),s.nodeShapes[s.getNodeShape(e)].draw(y||t,Re.x,Re.y,l,o,ie,h)}m?t.fill(y):t.fill()},at=function(){for(var Re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:g,ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,F=c.backgrounding,J=0,oe=0;oe<M.length;oe++){var le=e.cy().style().getIndexedStyle(e,"background-image-containment","value",oe);if(ce&&le==="over"||!ce&&le==="inside"){J++;continue}E[oe]&&M[oe].complete&&!M[oe].error&&(J++,s.drawInscribedImage(t,M[oe],e,oe,Re))}c.backgrounding=J!==R,F!==c.backgrounding&&e.updateStyle(!1)},Me=function(){var Re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:g;s.hasPie(e)&&(s.drawPie(t,e,ce),Re&&(m||s.nodeShapes[s.getNodeShape(e)].draw(t,d.x,d.y,l,o,ie,h)))},He=function(){var Re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:g;s.hasStripe(e)&&(t.save(),m?t.clip(h.pathCache):(s.nodeShapes[s.getNodeShape(e)].draw(t,d.x,d.y,l,o,ie,h),t.clip()),s.drawStripe(t,e,ce),t.restore(),Re&&(m||s.nodeShapes[s.getNodeShape(e)].draw(t,d.x,d.y,l,o,ie,h)))},$e=function(){var Re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:g,ce=(_>0?_:-_)*Re,F=_>0?0:255;_!==0&&(s.colorFillStyle(t,F,F,F,ce),m?t.fill(y):t.fill())},Ne=function(){if(P>0){if(t.lineWidth=P,t.lineCap=V,t.lineJoin=q,t.setLineDash)switch($){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash(ee),t.lineDashOffset=te;break;case"solid":case"double":t.setLineDash([]);break}if(X!=="center"){if(t.save(),t.lineWidth*=2,X==="inside")m?t.clip(y):t.clip();else{var Re=new Path2D;Re.rect(-l/2-P,-o/2-P,l+2*P,o+2*P),Re.addPath(y),t.clip(Re,"evenodd")}m?t.stroke(y):t.stroke(),t.restore()}else m?t.stroke(y):t.stroke();if($==="double"){t.lineWidth=P/3;var ce=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",m?t.stroke(y):t.stroke(),t.globalCompositeOperation=ce}t.setLineDash&&t.setLineDash([])}},Ge=function(){if(G>0){if(t.lineWidth=G,t.lineCap="butt",t.setLineDash)switch(Y){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"solid":case"double":t.setLineDash([]);break}var Re=d;m&&(Re={x:0,y:0});var ce=s.getNodeShape(e),F=P;X==="inside"&&(F=0),X==="outside"&&(F*=2);var J=(l+F+(G+Z))/l,oe=(o+F+(G+Z))/o,le=l*J,he=o*oe,_e=s.nodeShapes[ce].points,be;if(m){var ze=j(le,he,ce,_e);be=ze.path}if(ce==="ellipse")s.drawEllipsePath(be||t,Re.x,Re.y,le,he);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(ce)){var Le=0,Pe=0,Ye=0;ce==="round-diamond"?Le=(F+Z+G)*1.4:ce==="round-heptagon"?(Le=(F+Z+G)*1.075,Ye=-(F/2+Z+G)/35):ce==="round-hexagon"?Le=(F+Z+G)*1.12:ce==="round-pentagon"?(Le=(F+Z+G)*1.13,Ye=-(F/2+Z+G)/15):ce==="round-tag"?(Le=(F+Z+G)*1.12,Pe=(F/2+G+Z)*.07):ce==="round-triangle"&&(Le=(F+Z+G)*(Math.PI/2),Ye=-(F+Z/2+G)/Math.PI),Le!==0&&(J=(l+Le)/l,le=l*J,["round-hexagon","round-tag"].includes(ce)||(oe=(o+Le)/o,he=o*oe)),ie=ie==="auto"?Fq(le,he):ie;for(var et=le/2,Ie=he/2,nt=ie+(F+G+Z)/2,rt=new Array(_e.length/2),ct=new Array(_e.length/2),Ze=0;Ze<_e.length/2;Ze++)rt[Ze]={x:Re.x+Pe+et*_e[Ze*2],y:Re.y+Ye+Ie*_e[Ze*2+1]};var vt,wt,Mt,Ft,Ut=rt.length;for(wt=rt[Ut-1],vt=0;vt<Ut;vt++)Mt=rt[vt%Ut],Ft=rt[(vt+1)%Ut],ct[vt]=ZT(wt,Mt,Ft,nt),wt=Mt,Mt=Ft;s.drawRoundPolygonPath(be||t,Re.x+Pe,Re.y+Ye,l*J,o*oe,_e,ct)}else if(["roundrectangle","round-rectangle"].includes(ce))ie=ie==="auto"?Ws(le,he):ie,s.drawRoundRectanglePath(be||t,Re.x,Re.y,le,he,ie+(F+G+Z)/2);else if(["cutrectangle","cut-rectangle"].includes(ce))ie=ie==="auto"?FT():ie,s.drawCutRectanglePath(be||t,Re.x,Re.y,le,he,null,ie+(F+G+Z)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(ce))ie=ie==="auto"?Ws(le,he):ie,s.drawBottomRoundRectanglePath(be||t,Re.x,Re.y,le,he,ie+(F+G+Z)/2);else if(ce==="barrel")s.drawBarrelPath(be||t,Re.x,Re.y,le,he);else if(ce.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(ce)){var Zr=(F+G+Z)/l;_e=gg(vg(_e,Zr)),s.drawPolygonPath(be||t,Re.x,Re.y,l,o,_e)}else{var nr=(F+G+Z)/l;_e=gg(vg(_e,-nr)),s.drawPolygonPath(be||t,Re.x,Re.y,l,o,_e)}if(m?t.stroke(be):t.stroke(),Y==="double"){t.lineWidth=F/3;var hn=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",m?t.stroke(be):t.stroke(),t.globalCompositeOperation=hn}t.setLineDash&&t.setLineDash([])}},Ve=function(){i&&s.drawNodeOverlay(t,e,d,l,o)},Qe=function(){i&&s.drawNodeUnderlay(t,e,d,l,o)},je=function(){s.drawElementText(t,e,null,n)},dt=e.pstyle("ghost").value==="yes";if(dt){var ke=e.pstyle("ghost-offset-x").pfValue,De=e.pstyle("ghost-offset-y").pfValue,Be=e.pstyle("ghost-opacity").value,Ke=Be*g;t.translate(ke,De),se(),Ge(),we(Be*z),Se(),at(Ke,!0),de(Be*I),Ne(),Me(_!==0||P!==0),He(_!==0||P!==0),at(Ke,!1),$e(Ke),t.translate(-ke,-De)}m&&t.translate(-d.x,-d.y),Qe(),m&&t.translate(d.x,d.y),se(),Ge(),we(),Se(),at(g,!0),de(),Ne(),Me(_!==0||P!==0),He(_!==0||P!==0),at(g,!1),$e(),m&&t.translate(-d.x,-d.y),je(),Ve(),r&&t.translate(w.x1,w.y1)}};var Yj=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,n,i,a,s){var l=this;if(n.visible()){var o=n.pstyle("".concat(e,"-padding")).pfValue,c=n.pstyle("".concat(e,"-opacity")).value,h=n.pstyle("".concat(e,"-color")).value,d=n.pstyle("".concat(e,"-shape")).value,g=n.pstyle("".concat(e,"-corner-radius")).value;if(c>0){if(i=i||n.position(),a==null||s==null){var m=n.padding();a=n.width()+2*m,s=n.height()+2*m}l.colorFillStyle(r,h[0],h[1],h[2],c),l.nodeShapes[d].draw(r,i.x,i.y,a+o*2,s+o*2,g),r.fill()}}}};ul.drawNodeOverlay=Yj("overlay");ul.drawNodeUnderlay=Yj("underlay");ul.hasPie=function(t){return t=t[0],t._private.hasPie};ul.hasStripe=function(t){return t=t[0],t._private.hasStripe};ul.drawPie=function(t,e,r,n){e=e[0],n=n||e.position();var i=e.cy().style(),a=e.pstyle("pie-size"),s=e.pstyle("pie-hole"),l=e.pstyle("pie-start-angle").pfValue,o=n.x,c=n.y,h=e.width(),d=e.height(),g=Math.min(h,d)/2,m,y=0,b=this.usePaths();if(b&&(o=0,c=0),a.units==="%"?g=g*a.pfValue:a.pfValue!==void 0&&(g=a.pfValue/2),s.units==="%"?m=g*s.pfValue:s.pfValue!==void 0&&(m=s.pfValue/2),!(m>=g))for(var x=1;x<=i.pieBackgroundN;x++){var w=e.pstyle("pie-"+x+"-background-size").value,S=e.pstyle("pie-"+x+"-background-color").value,k=e.pstyle("pie-"+x+"-background-opacity").value*r,E=w/100;E+y>1&&(E=1-y);var M=1.5*Math.PI+2*Math.PI*y;M+=l;var R=2*Math.PI*E,O=M+R;w===0||y>=1||y+E>1||(m===0?(t.beginPath(),t.moveTo(o,c),t.arc(o,c,g,M,O),t.closePath()):(t.beginPath(),t.arc(o,c,g,M,O),t.arc(o,c,m,O,M,!0),t.closePath()),this.colorFillStyle(t,S[0],S[1],S[2],k),t.fill(),y+=E)}};ul.drawStripe=function(t,e,r,n){e=e[0],n=n||e.position();var i=e.cy().style(),a=n.x,s=n.y,l=e.width(),o=e.height(),c=0,h=this.usePaths();t.save();var d=e.pstyle("stripe-direction").value,g=e.pstyle("stripe-size");switch(d){case"vertical":break;case"righward":t.rotate(-Math.PI/2);break}var m=l,y=o;g.units==="%"?(m=m*g.pfValue,y=y*g.pfValue):g.pfValue!==void 0&&(m=g.pfValue,y=g.pfValue),h&&(a=0,s=0),s-=m/2,a-=y/2;for(var b=1;b<=i.stripeBackgroundN;b++){var x=e.pstyle("stripe-"+b+"-background-size").value,w=e.pstyle("stripe-"+b+"-background-color").value,S=e.pstyle("stripe-"+b+"-background-opacity").value*r,k=x/100;k+c>1&&(k=1-c),!(x===0||c>=1||c+k>1)&&(t.beginPath(),t.rect(a,s+y*c,m,y*k),t.closePath(),this.colorFillStyle(t,w[0],w[1],w[2],S),t.fill(),c+=k)}t.restore()};var Dn={},ZK=100;Dn.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};Dn.paintCache=function(t){for(var e=this.paintCaches=this.paintCaches||[],r=!0,n,i=0;i<e.length;i++)if(n=e[i],n.context===t){r=!1;break}return r&&(n={context:t},e.push(n)),n};Dn.createGradientStyleFor=function(t,e,r,n,i){var a,s=this.usePaths(),l=r.pstyle(e+"-gradient-stop-colors").value,o=r.pstyle(e+"-gradient-stop-positions").pfValue;if(n==="radial-gradient")if(r.isEdge()){var c=r.sourceEndpoint(),h=r.targetEndpoint(),d=r.midpoint(),g=Kl(c,d),m=Kl(h,d);a=t.createRadialGradient(d.x,d.y,0,d.x,d.y,Math.max(g,m))}else{var y=s?{x:0,y:0}:r.position(),b=r.paddedWidth(),x=r.paddedHeight();a=t.createRadialGradient(y.x,y.y,0,y.x,y.y,Math.max(b,x))}else if(r.isEdge()){var w=r.sourceEndpoint(),S=r.targetEndpoint();a=t.createLinearGradient(w.x,w.y,S.x,S.y)}else{var k=s?{x:0,y:0}:r.position(),E=r.paddedWidth(),M=r.paddedHeight(),R=E/2,O=M/2,N=r.pstyle("background-gradient-direction").value;switch(N){case"to-bottom":a=t.createLinearGradient(k.x,k.y-O,k.x,k.y+O);break;case"to-top":a=t.createLinearGradient(k.x,k.y+O,k.x,k.y-O);break;case"to-left":a=t.createLinearGradient(k.x+R,k.y,k.x-R,k.y);break;case"to-right":a=t.createLinearGradient(k.x-R,k.y,k.x+R,k.y);break;case"to-bottom-right":case"to-right-bottom":a=t.createLinearGradient(k.x-R,k.y-O,k.x+R,k.y+O);break;case"to-top-right":case"to-right-top":a=t.createLinearGradient(k.x-R,k.y+O,k.x+R,k.y-O);break;case"to-bottom-left":case"to-left-bottom":a=t.createLinearGradient(k.x+R,k.y-O,k.x-R,k.y+O);break;case"to-top-left":case"to-left-top":a=t.createLinearGradient(k.x+R,k.y+O,k.x-R,k.y-O);break}}if(!a)return null;for(var B=o.length===l.length,D=l.length,_=0;_<D;_++)a.addColorStop(B?o[_]:_/(D-1),"rgba("+l[_][0]+","+l[_][1]+","+l[_][2]+","+i+")");return a};Dn.gradientFillStyle=function(t,e,r,n){var i=this.createGradientStyleFor(t,"background",e,r,n);if(!i)return null;t.fillStyle=i};Dn.colorFillStyle=function(t,e,r,n,i){t.fillStyle="rgba("+e+","+r+","+n+","+i+")"};Dn.eleFillStyle=function(t,e,r){var n=e.pstyle("background-fill").value;if(n==="linear-gradient"||n==="radial-gradient")this.gradientFillStyle(t,e,n,r);else{var i=e.pstyle("background-color").value;this.colorFillStyle(t,i[0],i[1],i[2],r)}};Dn.gradientStrokeStyle=function(t,e,r,n){var i=this.createGradientStyleFor(t,"line",e,r,n);if(!i)return null;t.strokeStyle=i};Dn.colorStrokeStyle=function(t,e,r,n,i){t.strokeStyle="rgba("+e+","+r+","+n+","+i+")"};Dn.eleStrokeStyle=function(t,e,r){var n=e.pstyle("line-fill").value;if(n==="linear-gradient"||n==="radial-gradient")this.gradientStrokeStyle(t,e,n,r);else{var i=e.pstyle("line-color").value;this.colorStrokeStyle(t,i[0],i[1],i[2],r)}};Dn.matchCanvasSize=function(t){var e=this,r=e.data,n=e.findContainerClientCoords(),i=n[2],a=n[3],s=e.getPixelRatio(),l=e.motionBlurPxRatio;(t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE]||t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG])&&(s=l);var o=i*s,c=a*s,h;if(!(o===e.canvasWidth&&c===e.canvasHeight)){e.fontCaches=null;var d=r.canvasContainer;d.style.width=i+"px",d.style.height=a+"px";for(var g=0;g<e.CANVAS_LAYERS;g++)h=r.canvases[g],h.width=o,h.height=c,h.style.width=i+"px",h.style.height=a+"px";for(var g=0;g<e.BUFFER_COUNT;g++)h=r.bufferCanvases[g],h.width=o,h.height=c,h.style.width=i+"px",h.style.height=a+"px";e.textureMult=1,s<=1&&(h=r.bufferCanvases[e.TEXTURE_BUFFER],e.textureMult=2,h.width=o*e.textureMult,h.height=c*e.textureMult),e.canvasWidth=o,e.canvasHeight=c,e.pixelRatio=s}};Dn.renderTo=function(t,e,r,n){this.render({forcedContext:t,forcedZoom:e,forcedPan:r,drawAllLayers:!0,forcedPxRatio:n})};Dn.clearCanvas=function(){var t=this,e=t.data;function r(n){n.clearRect(0,0,t.canvasWidth,t.canvasHeight)}r(e.contexts[t.NODE]),r(e.contexts[t.DRAG])};Dn.render=function(t){var e=this;t=t||Lq();var r=e.cy,n=t.forcedContext,i=t.drawAllLayers,a=t.drawOnlyNodeLayer,s=t.forcedZoom,l=t.forcedPan,o=t.forcedPxRatio===void 0?this.getPixelRatio():t.forcedPxRatio,c=e.data,h=c.canvasNeedsRedraw,d=e.textureOnViewport&&!n&&(e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming),g=t.motionBlur!==void 0?t.motionBlur:e.motionBlur,m=e.motionBlurPxRatio,y=r.hasCompoundNodes(),b=e.hoverData.draggingEles,x=!!(e.hoverData.selecting||e.touchData.selecting);g=g&&!n&&e.motionBlurEnabled&&!x;var w=g;n||(e.prevPxRatio!==o&&(e.invalidateContainerClientCoordsCache(),e.matchCanvasSize(e.container),e.redrawHint("eles",!0),e.redrawHint("drag",!0)),e.prevPxRatio=o),!n&&e.motionBlurTimeout&&clearTimeout(e.motionBlurTimeout),g&&(e.mbFrames==null&&(e.mbFrames=0),e.mbFrames++,e.mbFrames<3&&(w=!1),e.mbFrames>e.minMbLowQualFrames&&(e.motionBlurPxRatio=e.mbPxRBlurry)),e.clearingMotionBlur&&(e.motionBlurPxRatio=1),e.textureDrawLastFrame&&!d&&(h[e.NODE]=!0,h[e.SELECT_BOX]=!0);var S=r.style(),k=r.zoom(),E=s!==void 0?s:k,M=r.pan(),R={x:M.x,y:M.y},O={zoom:k,pan:{x:M.x,y:M.y}},N=e.prevViewport,B=N===void 0||O.zoom!==N.zoom||O.pan.x!==N.pan.x||O.pan.y!==N.pan.y;!B&&!(b&&!y)&&(e.motionBlurPxRatio=1),l&&(R=l),E*=o,R.x*=o,R.y*=o;var D=e.getCachedZSortedEles();function _(de,se,j,Q,K){var ue=de.globalCompositeOperation;de.globalCompositeOperation="destination-out",e.colorFillStyle(de,255,255,255,e.motionBlurTransparency),de.fillRect(se,j,Q,K),de.globalCompositeOperation=ue}function P(de,se){var j,Q,K,ue;!e.clearingMotionBlur&&(de===c.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]||de===c.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG])?(j={x:M.x*m,y:M.y*m},Q=k*m,K=e.canvasWidth*m,ue=e.canvasHeight*m):(j=R,Q=E,K=e.canvasWidth,ue=e.canvasHeight),de.setTransform(1,0,0,1,0,0),se==="motionBlur"?_(de,0,0,K,ue):!n&&(se===void 0||se)&&de.clearRect(0,0,K,ue),i||(de.translate(j.x,j.y),de.scale(Q,Q)),l&&de.translate(l.x,l.y),s&&de.scale(s,s)}if(d||(e.textureDrawLastFrame=!1),d){if(e.textureDrawLastFrame=!0,!e.textureCache){e.textureCache={},e.textureCache.bb=r.mutableElements().boundingBox(),e.textureCache.texture=e.data.bufferCanvases[e.TEXTURE_BUFFER];var z=e.data.bufferContexts[e.TEXTURE_BUFFER];z.setTransform(1,0,0,1,0,0),z.clearRect(0,0,e.canvasWidth*e.textureMult,e.canvasHeight*e.textureMult),e.render({forcedContext:z,drawOnlyNodeLayer:!0,forcedPxRatio:o*e.textureMult});var O=e.textureCache.viewport={zoom:r.zoom(),pan:r.pan(),width:e.canvasWidth,height:e.canvasHeight};O.mpan={x:(0-O.pan.x)/O.zoom,y:(0-O.pan.y)/O.zoom}}h[e.DRAG]=!1,h[e.NODE]=!1;var H=c.contexts[e.NODE],$=e.textureCache.texture,O=e.textureCache.viewport;H.setTransform(1,0,0,1,0,0),g?_(H,0,0,O.width,O.height):H.clearRect(0,0,O.width,O.height);var q=S.core("outside-texture-bg-color").value,V=S.core("outside-texture-bg-opacity").value;e.colorFillStyle(H,q[0],q[1],q[2],V),H.fillRect(0,0,O.width,O.height);var k=r.zoom();P(H,!1),H.clearRect(O.mpan.x,O.mpan.y,O.width/O.zoom/o,O.height/O.zoom/o),H.drawImage($,O.mpan.x,O.mpan.y,O.width/O.zoom/o,O.height/O.zoom/o)}else e.textureOnViewport&&!n&&(e.textureCache=null);var X=r.extent(),ee=e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming||e.hoverData.draggingEles||e.cy.animated(),te=e.hideEdgesOnViewport&&ee,I=[];if(I[e.NODE]=!h[e.NODE]&&g&&!e.clearedForMotionBlur[e.NODE]||e.clearingMotionBlur,I[e.NODE]&&(e.clearedForMotionBlur[e.NODE]=!0),I[e.DRAG]=!h[e.DRAG]&&g&&!e.clearedForMotionBlur[e.DRAG]||e.clearingMotionBlur,I[e.DRAG]&&(e.clearedForMotionBlur[e.DRAG]=!0),h[e.NODE]||i||a||I[e.NODE]){var G=g&&!I[e.NODE]&&m!==1,H=n||(G?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]:c.contexts[e.NODE]),re=g&&!G?"motionBlur":void 0;P(H,re),te?e.drawCachedNodes(H,D.nondrag,o,X):e.drawLayeredElements(H,D.nondrag,o,X),e.debug&&e.drawDebugPoints(H,D.nondrag),!i&&!g&&(h[e.NODE]=!1)}if(!a&&(h[e.DRAG]||i||I[e.DRAG])){var G=g&&!I[e.DRAG]&&m!==1,H=n||(G?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG]:c.contexts[e.DRAG]);P(H,g&&!G?"motionBlur":void 0),te?e.drawCachedNodes(H,D.drag,o,X):e.drawCachedElements(H,D.drag,o,X),e.debug&&e.drawDebugPoints(H,D.drag),!i&&!g&&(h[e.DRAG]=!1)}if(this.drawSelectionRectangle(t,P),g&&m!==1){var Y=c.contexts[e.NODE],W=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE],Z=c.contexts[e.DRAG],ie=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG],we=function(se,j,Q){se.setTransform(1,0,0,1,0,0),Q||!w?se.clearRect(0,0,e.canvasWidth,e.canvasHeight):_(se,0,0,e.canvasWidth,e.canvasHeight);var K=m;se.drawImage(j,0,0,e.canvasWidth*K,e.canvasHeight*K,0,0,e.canvasWidth,e.canvasHeight)};(h[e.NODE]||I[e.NODE])&&(we(Y,W,I[e.NODE]),h[e.NODE]=!1),(h[e.DRAG]||I[e.DRAG])&&(we(Z,ie,I[e.DRAG]),h[e.DRAG]=!1)}e.prevViewport=O,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=!d,e.mbFrames=0,h[e.NODE]=!0,h[e.DRAG]=!0,e.redraw()},ZK)),n||r.emit("render")};var ef;Dn.drawSelectionRectangle=function(t,e){var r=this,n=r.cy,i=r.data,a=n.style(),s=t.drawOnlyNodeLayer,l=t.drawAllLayers,o=i.canvasNeedsRedraw,c=t.forcedContext;if(r.showFps||!s&&o[r.SELECT_BOX]&&!l){var h=c||i.contexts[r.SELECT_BOX];if(e(h),r.selection[4]==1&&(r.hoverData.selecting||r.touchData.selecting)){var d=r.cy.zoom(),g=a.core("selection-box-border-width").value/d;h.lineWidth=g,h.fillStyle="rgba("+a.core("selection-box-color").value[0]+","+a.core("selection-box-color").value[1]+","+a.core("selection-box-color").value[2]+","+a.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("+a.core("selection-box-border-color").value[0]+","+a.core("selection-box-border-color").value[1]+","+a.core("selection-box-border-color").value[2]+","+a.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 d=r.cy.zoom(),m=i.bgActivePosistion;h.fillStyle="rgba("+a.core("active-bg-color").value[0]+","+a.core("active-bg-color").value[1]+","+a.core("active-bg-color").value[2]+","+a.core("active-bg-opacity").value+")",h.beginPath(),h.arc(m.x,m.y,a.core("active-bg-size").pfValue/d,0,2*Math.PI),h.fill()}var y=r.lastRedrawTime;if(r.showFps&&y){y=Math.round(y);var b=Math.round(1e3/y),x="1 frame = "+y+" ms = "+b+" 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",!ef){var w=h.measureText(x);ef=w.actualBoundingBoxAscent}h.fillText(x,0,ef);var S=60;h.strokeRect(0,ef+10,250,20),h.fillRect(0,ef+10,250*Math.min(b/S,1),20)}l||(o[r.SELECT_BOX]=!1)}};function HN(t,e,r){var n=t.createShader(e);if(t.shaderSource(n,r),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS))throw new Error(t.getShaderInfoLog(n));return n}function JK(t,e,r){var n=HN(t,t.VERTEX_SHADER,e),i=HN(t,t.FRAGMENT_SHADER,r),a=t.createProgram();if(t.attachShader(a,n),t.attachShader(a,i),t.linkProgram(a),!t.getProgramParameter(a,t.LINK_STATUS))throw new Error("Could not initialize shaders");return a}function eZ(t,e,r){r===void 0&&(r=e);var n=t.makeOffscreenCanvas(e,r),i=n.context=n.getContext("2d");return n.clear=function(){return i.clearRect(0,0,n.width,n.height)},n.clear(),n}function tE(t){var e=t.pixelRatio,r=t.cy.zoom(),n=t.cy.pan();return{zoom:r*e,pan:{x:n.x*e,y:n.y*e}}}function tZ(t){var e=t.pixelRatio,r=t.cy.zoom();return r*e}function rZ(t,e,r,n,i){var a=n*r+e.x,s=i*r+e.y;return s=Math.round(t.canvasHeight-s),[a,s]}function nZ(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 iZ(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 Dl(t,e,r){var n=t[0]/255,i=t[1]/255,a=t[2]/255,s=e,l=r||new Array(4);return l[0]=n*s,l[1]=i*s,l[2]=a*s,l[3]=s,l}function nu(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 aZ(t){return t[0]+(t[1]<<8)+(t[2]<<16)+(t[3]<<24)}function sZ(t,e){var r=t.createTexture();return r.buffer=function(n){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,n),t.generateMipmap(t.TEXTURE_2D),t.bindTexture(t.TEXTURE_2D,null)},r.deleteTexture=function(){t.deleteTexture(r)},r}function Xj(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 Wj(t,e,r){switch(e){case t.FLOAT:return new Float32Array(r);case t.INT:return new Int32Array(r)}}function lZ(t,e,r,n,i,a){switch(e){case t.FLOAT:return new Float32Array(r.buffer,a*n,i);case t.INT:return new Int32Array(r.buffer,a*n,i)}}function oZ(t,e,r,n){var i=Xj(t,e),a=Rr(i,2),s=a[0],l=a[1],o=Wj(t,l,n),c=t.createBuffer();return t.bindBuffer(t.ARRAY_BUFFER,c),t.bufferData(t.ARRAY_BUFFER,o,t.STATIC_DRAW),l===t.FLOAT?t.vertexAttribPointer(r,s,l,!1,0,0):l===t.INT&&t.vertexAttribIPointer(r,s,l,0,0),t.enableVertexAttribArray(r),t.bindBuffer(t.ARRAY_BUFFER,null),c}function Zi(t,e,r,n){var i=Xj(t,r),a=Rr(i,3),s=a[0],l=a[1],o=a[2],c=Wj(t,l,e*s),h=s*o,d=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,d),t.bufferData(t.ARRAY_BUFFER,e*h,t.DYNAMIC_DRAW),t.enableVertexAttribArray(n),l===t.FLOAT?t.vertexAttribPointer(n,s,l,!1,h,0):l===t.INT&&t.vertexAttribIPointer(n,s,l,h,0),t.vertexAttribDivisor(n,1),t.bindBuffer(t.ARRAY_BUFFER,null);for(var g=new Array(e),m=0;m<e;m++)g[m]=lZ(t,l,c,h,s,m);return d.dataArray=c,d.stride=h,d.size=s,d.getView=function(y){return g[y]},d.setPoint=function(y,b,x){var w=g[y];w[0]=b,w[1]=x},d.bufferSubData=function(y){t.bindBuffer(t.ARRAY_BUFFER,d),y?t.bufferSubData(t.ARRAY_BUFFER,0,c,0,y*s):t.bufferSubData(t.ARRAY_BUFFER,0,c)},d}function uZ(t,e,r){for(var n=9,i=new Float32Array(e*n),a=new Array(e),s=0;s<e;s++){var l=s*n*4;a[s]=new Float32Array(i.buffer,l,n)}var o=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,o),t.bufferData(t.ARRAY_BUFFER,i.byteLength,t.DYNAMIC_DRAW);for(var c=0;c<3;c++){var h=r+c;t.enableVertexAttribArray(h),t.vertexAttribPointer(h,3,t.FLOAT,!1,36,c*12),t.vertexAttribDivisor(h,1)}return t.bindBuffer(t.ARRAY_BUFFER,null),o.getMatrixView=function(d){return a[d]},o.setData=function(d,g){a[g].set(d,0)},o.bufferSubData=function(){t.bindBuffer(t.ARRAY_BUFFER,o),t.bufferSubData(t.ARRAY_BUFFER,0,i)},o}function cZ(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(n,i){t.bindTexture(t.TEXTURE_2D,r),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,n,i,0,t.RGBA,t.UNSIGNED_BYTE,null)},e}var VN=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 Ub(){var t=new VN(9);return VN!=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 UN(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 fZ(t,e,r){var n=e[0],i=e[1],a=e[2],s=e[3],l=e[4],o=e[5],c=e[6],h=e[7],d=e[8],g=r[0],m=r[1],y=r[2],b=r[3],x=r[4],w=r[5],S=r[6],k=r[7],E=r[8];return t[0]=g*n+m*s+y*c,t[1]=g*i+m*l+y*h,t[2]=g*a+m*o+y*d,t[3]=b*n+x*s+w*c,t[4]=b*i+x*l+w*h,t[5]=b*a+x*o+w*d,t[6]=S*n+k*s+E*c,t[7]=S*i+k*l+E*h,t[8]=S*a+k*o+E*d,t}function Gp(t,e,r){var n=e[0],i=e[1],a=e[2],s=e[3],l=e[4],o=e[5],c=e[6],h=e[7],d=e[8],g=r[0],m=r[1];return t[0]=n,t[1]=i,t[2]=a,t[3]=s,t[4]=l,t[5]=o,t[6]=g*n+m*s+c,t[7]=g*i+m*l+h,t[8]=g*a+m*o+d,t}function $N(t,e,r){var n=e[0],i=e[1],a=e[2],s=e[3],l=e[4],o=e[5],c=e[6],h=e[7],d=e[8],g=Math.sin(r),m=Math.cos(r);return t[0]=m*n+g*s,t[1]=m*i+g*l,t[2]=m*a+g*o,t[3]=m*s-g*n,t[4]=m*l-g*i,t[5]=m*o-g*a,t[6]=c,t[7]=h,t[8]=d,t}function yk(t,e,r){var n=r[0],i=r[1];return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*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 hZ(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 dZ=(function(){function t(e,r,n,i){sl(this,t),this.debugID=Math.floor(Math.random()*1e4),this.r=e,this.texSize=r,this.texRows=n,this.texHeight=Math.floor(r/n),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 ll(t,[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(r){var n=r.w,i=r.h,a=this.texHeight,s=this.texSize,l=a/i,o=n*l,c=i*l;return o>s&&(l=s/n,o=n*l,c=i*l),{scale:l,texW:o,texH:c}}},{key:"draw",value:function(r,n,i){var a=this;if(this.locked)throw new Error("can't draw, atlas is locked");var s=this.texSize,l=this.texRows,o=this.texHeight,c=this.getScale(n),h=c.scale,d=c.texW,g=c.texH,m=function(k,E){if(i&&E){var M=E.context,R=k.x,O=k.row,N=R,B=o*O;M.save(),M.translate(N,B),M.scale(h,h),i(M,n),M.restore()}},y=[null,null],b=function(){m(a.freePointer,a.canvas),y[0]={x:a.freePointer.x,y:a.freePointer.row*o,w:d,h:g},y[1]={x:a.freePointer.x+d,y:a.freePointer.row*o,w:0,h:g},a.freePointer.x+=d,a.freePointer.x==s&&(a.freePointer.x=0,a.freePointer.row++)},x=function(){var k=a.scratch,E=a.canvas;k.clear(),m({x:0,row:0},k);var M=s-a.freePointer.x,R=d-M,O=o;{var N=a.freePointer.x,B=a.freePointer.row*o,D=M;E.context.drawImage(k,0,0,D,O,N,B,D,O),y[0]={x:N,y:B,w:D,h:g}}{var _=M,P=(a.freePointer.row+1)*o,z=R;E&&E.context.drawImage(k,_,0,z,O,0,P,z,O),y[1]={x:0,y:P,w:z,h:g}}a.freePointer.x=R,a.freePointer.row++},w=function(){a.freePointer.x=0,a.freePointer.row++};if(this.freePointer.x+d<=s)b();else{if(this.freePointer.row>=l-1)return!1;this.freePointer.x===s?(w(),b()):this.enableWrapping?x():(w(),b())}return this.keyToLocation.set(r,y),this.needsBuffer=!0,y}},{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 n=this.texSize,i=this.texRows,a=this.getScale(r),s=a.texW;return this.freePointer.x+s>n?this.freePointer.row<i-1:!0}},{key:"bufferIfNeeded",value:function(r){this.texture||(this.texture=sZ(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}}])})(),pZ=(function(){function t(e,r,n,i){sl(this,t),this.r=e,this.texSize=r,this.texRows=n,this.createTextureCanvas=i,this.atlases=[],this.styleKeyToAtlas=new Map,this.markedKeys=new Set}return ll(t,[{key:"getKeys",value:function(){return new Set(this.styleKeyToAtlas.keys())}},{key:"_createAtlas",value:function(){var r=this.r,n=this.texSize,i=this.texRows,a=this.createTextureCanvas;return new dZ(r,n,i,a)}},{key:"_getScratchCanvas",value:function(){if(!this.scratch){var r=this.r,n=this.texSize,i=this.texRows,a=this.createTextureCanvas,s=Math.floor(n/i);this.scratch=a(r,n,s,"scratch")}return this.scratch}},{key:"draw",value:function(r,n,i){var a=this.styleKeyToAtlas.get(r);return a||(a=this.atlases[this.atlases.length-1],(!a||!a.canFit(n))&&(a&&a.lock(),a=this._createAtlas(),this.atlases.push(a)),a.draw(r,n,i),this.styleKeyToAtlas.set(r,a)),a}},{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,n=this.markedKeys;if(n.size===0){console.log("nothing to garbage collect");return}var i=[],a=new Map,s=null,l=Yn(this.atlases),o;try{var c=function(){var d=o.value,g=d.getKeys(),m=gZ(n,g);if(m.size===0)return i.push(d),g.forEach(function(M){return a.set(M,d)}),1;s||(s=r._createAtlas(),i.push(s));var y=Yn(g),b;try{for(y.s();!(b=y.n()).done;){var x=b.value;if(!m.has(x)){var w=d.getOffsets(x),S=Rr(w,2),k=S[0],E=S[1];s.canFit({w:k.w+E.w,h:k.h})||(s.lock(),s=r._createAtlas(),i.push(s)),d.canvas&&(r._copyTextureToNewAtlas(x,d,s),a.set(x,s))}}}catch(M){y.e(M)}finally{y.f()}d.dispose()};for(l.s();!(o=l.n()).done;)c()}catch(h){l.e(h)}finally{l.f()}this.atlases=i,this.styleKeyToAtlas=a,this.markedKeys=new Set}},{key:"_copyTextureToNewAtlas",value:function(r,n,i){var a=n.getOffsets(r),s=Rr(a,2),l=s[0],o=s[1];if(o.w===0)i.draw(r,l,function(g){g.drawImage(n.canvas,l.x,l.y,l.w,l.h,0,0,l.w,l.h)});else{var c=this._getScratchCanvas();c.clear(),c.context.drawImage(n.canvas,l.x,l.y,l.w,l.h,0,0,l.w,l.h),c.context.drawImage(n.canvas,o.x,o.y,o.w,o.h,l.w,0,o.w,o.h);var h=l.w+o.w,d=l.h;i.draw(r,{w:h,h:d},function(g){g.drawImage(c,0,0,h,d,0,0,h,d)})}}},{key:"getCounts",value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}])})();function gZ(t,e){return t.intersection?t.intersection(e):new Set(fg(t).filter(function(r){return e.has(r)}))}var vZ=(function(){function t(e,r){sl(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 ll(t,[{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"addAtlasCollection",value:function(r,n){var i=this.globalOptions,a=i.webglTexSize,s=i.createTextureCanvas,l=n.texRows,o=this._cacheScratchCanvas(s),c=new pZ(this.r,a,l,o);this.collections.set(r,c)}},{key:"addRenderType",value:function(r,n){var i=n.collection;if(!this.collections.has(i))throw new Error("invalid atlas collection name '".concat(i,"'"));var a=this.collections.get(i),s=ft({type:r,atlasCollection:a},n);this.renderTypes.set(r,s)}},{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 n=-1,i=-1,a=null;return function(s,l,o,c){return c?((!a||l!=n||o!=i)&&(n=l,i=o,a=r(s,l,o)),a):r(s,l,o)}}},{key:"_key",value:function(r,n){return"".concat(r,"-").concat(n)}},{key:"invalidate",value:function(r){var n=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=i.forceRedraw,s=a===void 0?!1:a,l=i.filterEle,o=l===void 0?function(){return!0}:l,c=i.filterType,h=c===void 0?function(){return!0}:c,d=!1,g=!1,m=Yn(r),y;try{for(m.s();!(y=m.n()).done;){var b=y.value;if(o(b)){var x=Yn(this.renderTypes.values()),w;try{var S=function(){var E=w.value,M=E.type;if(h(M)){var R=n.collections.get(E.collection),O=E.getKey(b),N=Array.isArray(O)?O:[O];if(s)N.forEach(function(P){return R.markKeyForGC(P)}),g=!0;else{var B=E.getID?E.getID(b):b.id(),D=n._key(M,B),_=n.typeAndIdToKey.get(D);_!==void 0&&!iZ(N,_)&&(d=!0,n.typeAndIdToKey.delete(D),_.forEach(function(P){return R.markKeyForGC(P)}))}}};for(x.s();!(w=x.n()).done;)S()}catch(k){x.e(k)}finally{x.f()}}}}catch(k){m.e(k)}finally{m.f()}return g&&(this.gc(),d=!1),d}},{key:"gc",value:function(){var r=Yn(this.collections.values()),n;try{for(r.s();!(n=r.n()).done;){var i=n.value;i.gc()}}catch(a){r.e(a)}finally{r.f()}}},{key:"getOrCreateAtlas",value:function(r,n,i,a){var s=this.renderTypes.get(n),l=this.collections.get(s.collection),o=!1,c=l.draw(a,i,function(g){s.drawClipped?(g.save(),g.beginPath(),g.rect(0,0,i.w,i.h),g.clip(),s.drawElement(g,r,i,!0,!0),g.restore()):s.drawElement(g,r,i,!0,!0),o=!0});if(o){var h=s.getID?s.getID(r):r.id(),d=this._key(n,h);this.typeAndIdToKey.has(d)?this.typeAndIdToKey.get(d).push(a):this.typeAndIdToKey.set(d,[a])}return c}},{key:"getAtlasInfo",value:function(r,n){var i=this,a=this.renderTypes.get(n),s=a.getKey(r),l=Array.isArray(s)?s:[s];return l.map(function(o){var c=a.getBoundingBox(r,o),h=i.getOrCreateAtlas(r,n,c,o),d=h.getOffsets(o),g=Rr(d,2),m=g[0],y=g[1];return{atlas:h,tex:m,tex1:m,tex2:y,bb:c}})}},{key:"getDebugInfo",value:function(){var r=[],n=Yn(this.collections),i;try{for(n.s();!(i=n.n()).done;){var a=Rr(i.value,2),s=a[0],l=a[1],o=l.getCounts(),c=o.keyCount,h=o.atlasCount;r.push({type:s,keyCount:c,atlasCount:h})}}catch(d){n.e(d)}finally{n.f()}return r}}])})(),mZ=(function(){function t(e){sl(this,t),this.globalOptions=e,this.atlasSize=e.webglTexSize,this.maxAtlasesPerBatch=e.webglTexPerBatch,this.batchAtlases=[]}return ll(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,n){return n})}},{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 n=this.batchAtlases.indexOf(r);if(n<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw new Error("cannot add more atlases to batch");this.batchAtlases.push(r),n=this.batchAtlases.length-1}return n}}])})(),yZ=`
47
+ float circleSD(vec2 p, float r) {
48
+ return distance(vec2(0), p) - r; // signed distance
49
+ }
50
+ `,bZ=`
51
+ float rectangleSD(vec2 p, vec2 b) {
52
+ vec2 d = abs(p)-b;
53
+ return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);
54
+ }
55
+ `,xZ=`
56
+ float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {
57
+ cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;
58
+ cr.x = (p.y > 0.0) ? cr.x : cr.y;
59
+ vec2 q = abs(p) - b + cr.x;
60
+ return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;
61
+ }
62
+ `,wZ=`
63
+ float ellipseSD(vec2 p, vec2 ab) {
64
+ p = abs( p ); // symmetry
65
+
66
+ // find root with Newton solver
67
+ vec2 q = ab*(p-ab);
68
+ float w = (q.x<q.y)? 1.570796327 : 0.0;
69
+ for( int i=0; i<5; i++ ) {
70
+ vec2 cs = vec2(cos(w),sin(w));
71
+ vec2 u = ab*vec2( cs.x,cs.y);
72
+ vec2 v = ab*vec2(-cs.y,cs.x);
73
+ w = w + dot(p-u,v)/(dot(p-u,u)+dot(v,v));
74
+ }
75
+
76
+ // compute final point and distance
77
+ float d = length(p-ab*vec2(cos(w),sin(w)));
78
+
79
+ // return signed distance
80
+ return (dot(p/ab,p/ab)>1.0) ? d : -d;
81
+ }
82
+ `,Sf={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},Cg={IGNORE:1,USE_BB:2},$b=0,GN=1,YN=2,Gb=3,iu=4,cp=5,tf=6,rf=7,SZ=(function(){function t(e,r,n){sl(this,t),this.r=e,this.gl=r,this.maxInstances=n.webglBatchSize,this.atlasSize=n.webglTexSize,this.bgColor=n.bgColor,this.debug=n.webglDebug,this.batchDebugInfo=[],n.enableWrapping=!0,n.createTextureCanvas=eZ,this.atlasManager=new vZ(e,n),this.batchManager=new mZ(n),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(Sf.SCREEN),this.pickingProgram=this._createShaderProgram(Sf.PICKING),this.vao=this._createVAO()}return ll(t,[{key:"addAtlasCollection",value:function(r,n){this.atlasManager.addAtlasCollection(r,n)}},{key:"addTextureAtlasRenderType",value:function(r,n){this.atlasManager.addRenderType(r,n)}},{key:"addSimpleShapeRenderType",value:function(r,n){this.simpleShapeOptions.set(r,n)}},{key:"invalidate",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=n.type,a=this.atlasManager;return i?a.invalidate(r,{filterType:function(l){return l===i},forceRedraw:!0}):a.invalidate(r)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(r){var n=this.gl,i=`#version 300 es
83
+ precision highp float;
84
+
85
+ uniform mat3 uPanZoomMatrix;
86
+ uniform int uAtlasSize;
87
+
88
+ // instanced
89
+ in vec2 aPosition; // a vertex from the unit square
90
+
91
+ in mat3 aTransform; // used to transform verticies, eg into a bounding box
92
+ in int aVertType; // the type of thing we are rendering
93
+
94
+ // the z-index that is output when using picking mode
95
+ in vec4 aIndex;
96
+
97
+ // For textures
98
+ in int aAtlasId; // which shader unit/atlas to use
99
+ in vec4 aTex; // x/y/w/h of texture in atlas
100
+
101
+ // for edges
102
+ in vec4 aPointAPointB;
103
+ in vec4 aPointCPointD;
104
+ in vec2 aLineWidth; // also used for node border width
105
+
106
+ // simple shapes
107
+ in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]
108
+ in vec4 aColor; // also used for edges
109
+ in vec4 aBorderColor; // aLineWidth is used for border width
110
+
111
+ // output values passed to the fragment shader
112
+ out vec2 vTexCoord;
113
+ out vec4 vColor;
114
+ out vec2 vPosition;
115
+ // flat values are not interpolated
116
+ flat out int vAtlasId;
117
+ flat out int vVertType;
118
+ flat out vec2 vTopRight;
119
+ flat out vec2 vBotLeft;
120
+ flat out vec4 vCornerRadius;
121
+ flat out vec4 vBorderColor;
122
+ flat out vec2 vBorderWidth;
123
+ flat out vec4 vIndex;
124
+
125
+ void main(void) {
126
+ int vid = gl_VertexID;
127
+ vec2 position = aPosition; // TODO make this a vec3, simplifies some code below
128
+
129
+ if(aVertType == `.concat($b,`) {
130
+ float texX = aTex.x; // texture coordinates
131
+ float texY = aTex.y;
132
+ float texW = aTex.z;
133
+ float texH = aTex.w;
134
+
135
+ if(vid == 1 || vid == 2 || vid == 4) {
136
+ texX += texW;
137
+ }
138
+ if(vid == 2 || vid == 4 || vid == 5) {
139
+ texY += texH;
140
+ }
141
+
142
+ float d = float(uAtlasSize);
143
+ vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1
144
+
145
+ gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
146
+ }
147
+ else if(aVertType == `).concat(iu," || aVertType == ").concat(rf,`
148
+ || aVertType == `).concat(cp," || aVertType == ").concat(tf,`) { // simple shapes
149
+
150
+ // the bounding box is needed by the fragment shader
151
+ vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat
152
+ vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat
153
+ vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated
154
+
155
+ // calculations are done in the fragment shader, just pass these along
156
+ vColor = aColor;
157
+ vCornerRadius = aCornerRadius;
158
+ vBorderColor = aBorderColor;
159
+ vBorderWidth = aLineWidth;
160
+
161
+ gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
162
+ }
163
+ else if(aVertType == `).concat(GN,`) {
164
+ vec2 source = aPointAPointB.xy;
165
+ vec2 target = aPointAPointB.zw;
166
+
167
+ // adjust the geometry so that the line is centered on the edge
168
+ position.y = position.y - 0.5;
169
+
170
+ // stretch the unit square into a long skinny rectangle
171
+ vec2 xBasis = target - source;
172
+ vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));
173
+ vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;
174
+
175
+ gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);
176
+ vColor = aColor;
177
+ }
178
+ else if(aVertType == `).concat(YN,`) {
179
+ vec2 pointA = aPointAPointB.xy;
180
+ vec2 pointB = aPointAPointB.zw;
181
+ vec2 pointC = aPointCPointD.xy;
182
+ vec2 pointD = aPointCPointD.zw;
183
+
184
+ // adjust the geometry so that the line is centered on the edge
185
+ position.y = position.y - 0.5;
186
+
187
+ vec2 p0, p1, p2, pos;
188
+ if(position.x == 0.0) { // The left side of the unit square
189
+ p0 = pointA;
190
+ p1 = pointB;
191
+ p2 = pointC;
192
+ pos = position;
193
+ } else { // The right side of the unit square, use same approach but flip the geometry upside down
194
+ p0 = pointD;
195
+ p1 = pointC;
196
+ p2 = pointB;
197
+ pos = vec2(0.0, -position.y);
198
+ }
199
+
200
+ vec2 p01 = p1 - p0;
201
+ vec2 p12 = p2 - p1;
202
+ vec2 p21 = p1 - p2;
203
+
204
+ // Find the normal vector.
205
+ vec2 tangent = normalize(normalize(p12) + normalize(p01));
206
+ vec2 normal = vec2(-tangent.y, tangent.x);
207
+
208
+ // Find the vector perpendicular to p0 -> p1.
209
+ vec2 p01Norm = normalize(vec2(-p01.y, p01.x));
210
+
211
+ // Determine the bend direction.
212
+ float sigma = sign(dot(p01 + p21, normal));
213
+ float width = aLineWidth[0];
214
+
215
+ if(sign(pos.y) == -sigma) {
216
+ // This is an intersecting vertex. Adjust the position so that there's no overlap.
217
+ vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);
218
+ gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
219
+ } else {
220
+ // This is a non-intersecting vertex. Treat it like a mitre join.
221
+ vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);
222
+ gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
223
+ }
224
+
225
+ vColor = aColor;
226
+ }
227
+ else if(aVertType == `).concat(Gb,` && vid < 3) {
228
+ // massage the first triangle into an edge arrow
229
+ if(vid == 0)
230
+ position = vec2(-0.15, -0.3);
231
+ if(vid == 1)
232
+ position = vec2( 0.0, 0.0);
233
+ if(vid == 2)
234
+ position = vec2( 0.15, -0.3);
235
+
236
+ gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
237
+ vColor = aColor;
238
+ }
239
+ else {
240
+ gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space
241
+ }
242
+
243
+ vAtlasId = aAtlasId;
244
+ vVertType = aVertType;
245
+ vIndex = aIndex;
246
+ }
247
+ `),a=this.batchManager.getIndexArray(),s=`#version 300 es
248
+ precision highp float;
249
+
250
+ // declare texture unit for each texture atlas in the batch
251
+ `.concat(a.map(function(c){return"uniform sampler2D uTexture".concat(c,";")}).join(`
252
+ `),`
253
+
254
+ uniform vec4 uBGColor;
255
+ uniform float uZoom;
256
+
257
+ in vec2 vTexCoord;
258
+ in vec4 vColor;
259
+ in vec2 vPosition; // model coordinates
260
+
261
+ flat in int vAtlasId;
262
+ flat in vec4 vIndex;
263
+ flat in int vVertType;
264
+ flat in vec2 vTopRight;
265
+ flat in vec2 vBotLeft;
266
+ flat in vec4 vCornerRadius;
267
+ flat in vec4 vBorderColor;
268
+ flat in vec2 vBorderWidth;
269
+
270
+ out vec4 outColor;
271
+
272
+ `).concat(yZ,`
273
+ `).concat(bZ,`
274
+ `).concat(xZ,`
275
+ `).concat(wZ,`
276
+
277
+ vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha
278
+ return vec4(
279
+ top.rgb + (bot.rgb * (1.0 - top.a)),
280
+ top.a + (bot.a * (1.0 - top.a))
281
+ );
282
+ }
283
+
284
+ vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance
285
+ // scale to the zoom level so that borders don't look blurry when zoomed in
286
+ // note 1.5 is an aribitrary value chosen because it looks good
287
+ return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d)));
288
+ }
289
+
290
+ void main(void) {
291
+ if(vVertType == `).concat($b,`) {
292
+ // look up the texel from the texture unit
293
+ `).concat(a.map(function(c){return"if(vAtlasId == ".concat(c,") outColor = texture(uTexture").concat(c,", vTexCoord);")}).join(`
294
+ else `),`
295
+ }
296
+ else if(vVertType == `).concat(Gb,`) {
297
+ // mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';
298
+ outColor = blend(vColor, uBGColor);
299
+ outColor.a = 1.0; // make opaque, masks out line under arrow
300
+ }
301
+ else if(vVertType == `).concat(iu,` && vBorderWidth == vec2(0.0)) { // simple rectangle with no border
302
+ outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done
303
+ }
304
+ else if(vVertType == `).concat(iu," || vVertType == ").concat(rf,`
305
+ || vVertType == `).concat(cp," || vVertType == ").concat(tf,`) { // use SDF
306
+
307
+ float outerBorder = vBorderWidth[0];
308
+ float innerBorder = vBorderWidth[1];
309
+ float borderPadding = outerBorder * 2.0;
310
+ float w = vTopRight.x - vBotLeft.x - borderPadding;
311
+ float h = vTopRight.y - vBotLeft.y - borderPadding;
312
+ vec2 b = vec2(w/2.0, h/2.0); // half width, half height
313
+ vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center
314
+
315
+ float d; // signed distance
316
+ if(vVertType == `).concat(iu,`) {
317
+ d = rectangleSD(p, b);
318
+ } else if(vVertType == `).concat(rf,` && w == h) {
319
+ d = circleSD(p, b.x); // faster than ellipse
320
+ } else if(vVertType == `).concat(rf,`) {
321
+ d = ellipseSD(p, b);
322
+ } else {
323
+ d = roundRectangleSD(p, b, vCornerRadius.wzyx);
324
+ }
325
+
326
+ // use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling
327
+ // we must smooth colors inwards, because we can't change pixels outside the shape's bounding box
328
+ if(d > 0.0) {
329
+ if(d > outerBorder) {
330
+ discard;
331
+ } else {
332
+ outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);
333
+ }
334
+ } else {
335
+ if(d > innerBorder) {
336
+ vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;
337
+ vec4 innerBorderColor = blend(vBorderColor, vColor);
338
+ outColor = distInterp(innerBorderColor, outerColor, d);
339
+ }
340
+ else {
341
+ vec4 outerColor;
342
+ if(innerBorder == 0.0 && outerBorder == 0.0) {
343
+ outerColor = vec4(0);
344
+ } else if(innerBorder == 0.0) {
345
+ outerColor = vBorderColor;
346
+ } else {
347
+ outerColor = blend(vBorderColor, vColor);
348
+ }
349
+ outColor = distInterp(vColor, outerColor, d - innerBorder);
350
+ }
351
+ }
352
+ }
353
+ else {
354
+ outColor = vColor;
355
+ }
356
+
357
+ `).concat(r.picking?`if(outColor.a == 0.0) discard;
358
+ else outColor = vIndex;`:"",`
359
+ }
360
+ `),l=JK(n,i,s);l.aPosition=n.getAttribLocation(l,"aPosition"),l.aIndex=n.getAttribLocation(l,"aIndex"),l.aVertType=n.getAttribLocation(l,"aVertType"),l.aTransform=n.getAttribLocation(l,"aTransform"),l.aAtlasId=n.getAttribLocation(l,"aAtlasId"),l.aTex=n.getAttribLocation(l,"aTex"),l.aPointAPointB=n.getAttribLocation(l,"aPointAPointB"),l.aPointCPointD=n.getAttribLocation(l,"aPointCPointD"),l.aLineWidth=n.getAttribLocation(l,"aLineWidth"),l.aColor=n.getAttribLocation(l,"aColor"),l.aCornerRadius=n.getAttribLocation(l,"aCornerRadius"),l.aBorderColor=n.getAttribLocation(l,"aBorderColor"),l.uPanZoomMatrix=n.getUniformLocation(l,"uPanZoomMatrix"),l.uAtlasSize=n.getUniformLocation(l,"uAtlasSize"),l.uBGColor=n.getUniformLocation(l,"uBGColor"),l.uZoom=n.getUniformLocation(l,"uZoom"),l.uTextures=[];for(var o=0;o<this.batchManager.getMaxAtlasesPerBatch();o++)l.uTextures.push(n.getUniformLocation(l,"uTexture".concat(o)));return l}},{key:"_createVAO",value:function(){var r=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=r.length/2;var n=this.maxInstances,i=this.gl,a=this.program,s=i.createVertexArray();return i.bindVertexArray(s),oZ(i,"vec2",a.aPosition,r),this.transformBuffer=uZ(i,n,a.aTransform),this.indexBuffer=Zi(i,n,"vec4",a.aIndex),this.vertTypeBuffer=Zi(i,n,"int",a.aVertType),this.atlasIdBuffer=Zi(i,n,"int",a.aAtlasId),this.texBuffer=Zi(i,n,"vec4",a.aTex),this.pointAPointBBuffer=Zi(i,n,"vec4",a.aPointAPointB),this.pointCPointDBuffer=Zi(i,n,"vec4",a.aPointCPointD),this.lineWidthBuffer=Zi(i,n,"vec2",a.aLineWidth),this.colorBuffer=Zi(i,n,"vec4",a.aColor),this.cornerRadiusBuffer=Zi(i,n,"vec4",a.aCornerRadius),this.borderColorBuffer=Zi(i,n,"vec4",a.aBorderColor),i.bindVertexArray(null),s}},{key:"buffers",get:function(){var r=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(n){return zs(n,"Buffer")}).map(function(n){return r[n]})),this._buffers}},{key:"startFrame",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Sf.SCREEN;this.panZoomMatrix=r,this.renderTarget=n,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,n){return r.visible()?n&&n.isVisible?n.isVisible(r):!0:!1}},{key:"drawTexture",value:function(r,n,i){var a=this.atlasManager,s=this.batchManager,l=a.getRenderTypeOpts(i);if(this._isVisible(r,l)&&!(r.isEdge()&&!this._isValidEdge(r))){if(this.renderTarget.picking&&l.getTexPickingMode){var o=l.getTexPickingMode(r);if(o===Cg.IGNORE)return;if(o==Cg.USE_BB){this.drawPickingRectangle(r,n,i);return}}var c=a.getAtlasInfo(r,i),h=Yn(c),d;try{for(h.s();!(d=h.n()).done;){var g=d.value,m=g.atlas,y=g.tex1,b=g.tex2;s.canAddToCurrentBatch(m)||this.endBatch();for(var x=s.getAtlasIndexForBatch(m),w=0,S=[[y,!0],[b,!1]];w<S.length;w++){var k=Rr(S[w],2),E=k[0],M=k[1];if(E.w!=0){var R=this.instanceCount;this.vertTypeBuffer.getView(R)[0]=$b;var O=this.indexBuffer.getView(R);nu(n,O);var N=this.atlasIdBuffer.getView(R);N[0]=x;var B=this.texBuffer.getView(R);B[0]=E.x,B[1]=E.y,B[2]=E.w,B[3]=E.h;var D=this.transformBuffer.getMatrixView(R);this.setTransformMatrix(r,D,l,g,M),this.instanceCount++,M||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(_){h.e(_)}finally{h.f()}}}},{key:"setTransformMatrix",value:function(r,n,i,a){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,l=0;if(i.shapeProps&&i.shapeProps.padding&&(l=r.pstyle(i.shapeProps.padding).pfValue),a){var o=a.bb,c=a.tex1,h=a.tex2,d=c.w/(c.w+h.w);s||(d=1-d);var g=this._getAdjustedBB(o,l,s,d);this._applyTransformMatrix(n,g,i,r)}else{var m=i.getBoundingBox(r),y=this._getAdjustedBB(m,l,!0,1);this._applyTransformMatrix(n,y,i,r)}}},{key:"_applyTransformMatrix",value:function(r,n,i,a){var s,l;UN(r);var o=i.getRotation?i.getRotation(a):0;if(o!==0){var c=i.getRotationPoint(a),h=c.x,d=c.y;Gp(r,r,[h,d]),$N(r,r,o);var g=i.getRotationOffset(a);s=g.x+(n.xOffset||0),l=g.y+(n.yOffset||0)}else s=n.x1,l=n.y1;Gp(r,r,[s,l]),yk(r,r,[n.w,n.h])}},{key:"_getAdjustedBB",value:function(r,n,i,a){var s=r.x1,l=r.y1,o=r.w,c=r.h,h=r.yOffset;n&&(s-=n,l-=n,o+=2*n,c+=2*n);var d=0,g=o*a;return i&&a<1?o=g:!i&&a<1&&(d=o-g,s+=d,o=g),{x1:s,y1:l,w:o,h:c,xOffset:d,yOffset:h}}},{key:"drawPickingRectangle",value:function(r,n,i){var a=this.atlasManager.getRenderTypeOpts(i),s=this.instanceCount;this.vertTypeBuffer.getView(s)[0]=iu;var l=this.indexBuffer.getView(s);nu(n,l);var o=this.colorBuffer.getView(s);Dl([0,0,0],1,o);var c=this.transformBuffer.getMatrixView(s);this.setTransformMatrix(r,c,a),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(r,n,i){var a=this.simpleShapeOptions.get(i);if(this._isVisible(r,a)){var s=a.shapeProps,l=this._getVertTypeForShape(r,s.shape);if(l===void 0||a.isSimple&&!a.isSimple(r)){this.drawTexture(r,n,i);return}var o=this.instanceCount;if(this.vertTypeBuffer.getView(o)[0]=l,l===cp||l===tf){var c=a.getBoundingBox(r),h=this._getCornerRadius(r,s.radius,c),d=this.cornerRadiusBuffer.getView(o);d[0]=h,d[1]=h,d[2]=h,d[3]=h,l===tf&&(d[0]=0,d[2]=0)}var g=this.indexBuffer.getView(o);nu(n,g);var m=r.pstyle(s.color).value,y=r.pstyle(s.opacity).value,b=this.colorBuffer.getView(o);Dl(m,y,b);var x=this.lineWidthBuffer.getView(o);if(x[0]=0,x[1]=0,s.border){var w=r.pstyle("border-width").value;if(w>0){var S=r.pstyle("border-color").value,k=r.pstyle("border-opacity").value,E=this.borderColorBuffer.getView(o);Dl(S,k,E);var M=r.pstyle("border-position").value;if(M==="inside")x[0]=0,x[1]=-w;else if(M==="outside")x[0]=w,x[1]=0;else{var R=w/2;x[0]=R,x[1]=-R}}}var O=this.transformBuffer.getMatrixView(o);this.setTransformMatrix(r,O,a),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"_getVertTypeForShape",value:function(r,n){var i=r.pstyle(n).value;switch(i){case"rectangle":return iu;case"ellipse":return rf;case"roundrectangle":case"round-rectangle":return cp;case"bottom-round-rectangle":return tf;default:return}}},{key:"_getCornerRadius",value:function(r,n,i){var a=i.w,s=i.h;if(r.pstyle(n).value==="auto")return Ws(a,s);var l=r.pstyle(n).pfValue,o=a/2,c=s/2;return Math.min(l,c,o)}},{key:"drawEdgeArrow",value:function(r,n,i){if(r.visible()){var a=r._private.rscratch,s,l,o;if(i==="source"?(s=a.arrowStartX,l=a.arrowStartY,o=a.srcArrowAngle):(s=a.arrowEndX,l=a.arrowEndY,o=a.tgtArrowAngle),!(isNaN(s)||s==null||isNaN(l)||l==null||isNaN(o)||o==null)){var c=r.pstyle(i+"-arrow-shape").value;if(c!=="none"){var h=r.pstyle(i+"-arrow-color").value,d=r.pstyle("opacity").value,g=r.pstyle("line-opacity").value,m=d*g,y=r.pstyle("width").pfValue,b=r.pstyle("arrow-scale").value,x=this.r.getArrowWidth(y,b),w=this.instanceCount,S=this.transformBuffer.getMatrixView(w);UN(S),Gp(S,S,[s,l]),yk(S,S,[x,x]),$N(S,S,o),this.vertTypeBuffer.getView(w)[0]=Gb;var k=this.indexBuffer.getView(w);nu(n,k);var E=this.colorBuffer.getView(w);Dl(h,m,E),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"drawEdgeLine",value:function(r,n){if(r.visible()){var i=this._getEdgePoints(r);if(i){var a=r.pstyle("opacity").value,s=r.pstyle("line-opacity").value,l=r.pstyle("width").pfValue,o=r.pstyle("line-color").value,c=a*s;if(i.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),i.length==4){var h=this.instanceCount;this.vertTypeBuffer.getView(h)[0]=GN;var d=this.indexBuffer.getView(h);nu(n,d);var g=this.colorBuffer.getView(h);Dl(o,c,g);var m=this.lineWidthBuffer.getView(h);m[0]=l;var y=this.pointAPointBBuffer.getView(h);y[0]=i[0],y[1]=i[1],y[2]=i[2],y[3]=i[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var b=0;b<i.length-2;b+=2){var x=this.instanceCount;this.vertTypeBuffer.getView(x)[0]=YN;var w=this.indexBuffer.getView(x);nu(n,w);var S=this.colorBuffer.getView(x);Dl(o,c,S);var k=this.lineWidthBuffer.getView(x);k[0]=l;var E=i[b-2],M=i[b-1],R=i[b],O=i[b+1],N=i[b+2],B=i[b+3],D=i[b+4],_=i[b+5];b==0&&(E=2*R-N+.001,M=2*O-B+.001),b==i.length-4&&(D=2*N-R+.001,_=2*B-O+.001);var P=this.pointAPointBBuffer.getView(x);P[0]=E,P[1]=M,P[2]=R,P[3]=O;var z=this.pointCPointDBuffer.getView(x);z[0]=N,z[1]=B,z[2]=D,z[3]=_,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"_isValidEdge",value:function(r){var n=r._private.rscratch;return!(n.badLine||n.allpts==null||isNaN(n.allpts[0]))}},{key:"_getEdgePoints",value:function(r){var n=r._private.rscratch;if(this._isValidEdge(r)){var i=n.allpts;if(i.length==4)return i;var a=this._getNumSegments(r);return this._getCurveSegmentPoints(i,a)}}},{key:"_getNumSegments",value:function(r){var n=15;return Math.min(Math.max(n,5),this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(r,n){if(r.length==4)return r;for(var i=Array((n+1)*2),a=0;a<=n;a++)if(a==0)i[0]=r[0],i[1]=r[1];else if(a==n)i[a*2]=r[r.length-2],i[a*2+1]=r[r.length-1];else{var s=a/n;this._setCurvePoint(r,s,i,a*2)}return i}},{key:"_setCurvePoint",value:function(r,n,i,a){if(r.length<=2)i[a]=r[0],i[a+1]=r[1];else{for(var s=Array(r.length-2),l=0;l<s.length;l+=2){var o=(1-n)*r[l]+n*r[l+2],c=(1-n)*r[l+1]+n*r[l+3];s[l]=o,s[l+1]=c}return this._setCurvePoint(s,n,i,a)}}},{key:"endBatch",value:function(){var r=this.gl,n=this.vao,i=this.vertexCount,a=this.instanceCount;if(a!==0){var s=this.renderTarget.picking?this.pickingProgram:this.program;r.useProgram(s),r.bindVertexArray(n);var l=Yn(this.buffers),o;try{for(l.s();!(o=l.n()).done;){var c=o.value;c.bufferSubData(a)}}catch(y){l.e(y)}finally{l.f()}for(var h=this.batchManager.getAtlases(),d=0;d<h.length;d++)h[d].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(s.uTextures[g],g);r.uniform1f(s.uZoom,tZ(this.r)),r.uniformMatrix3fv(s.uPanZoomMatrix,!1,this.panZoomMatrix),r.uniform1i(s.uAtlasSize,this.batchManager.getAtlasSize());var m=Dl(this.bgColor,1);r.uniform4fv(s.uBGColor,m),r.drawArraysInstanced(r.TRIANGLES,0,i,a),r.bindVertexArray(null),r.bindTexture(r.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:a,atlasCount:h.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var r=this.atlasManager.getDebugInfo(),n=r.reduce(function(s,l){return s+l.atlasCount},0),i=this.batchDebugInfo,a=i.reduce(function(s,l){return s+l.count},0);return{atlasInfo:r,totalAtlases:n,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:i.length,batchInfo:i,totalInstances:a}}}])})(),Qj={};Qj.initWebgl=function(t,e){var r=this,n=r.data.contexts[r.WEBGL];t.bgColor=CZ(r),t.webglTexSize=Math.min(t.webglTexSize,n.getParameter(n.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,n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS)),r.webglDebug=t.webglDebug,r.webglDebugShowAtlases=t.webglDebugShowAtlases,r.pickingFrameBuffer=cZ(n),r.pickingFrameBuffer.needsDraw=!0,r.drawing=new SZ(r,n,t);var i=function(d){return function(g){return r.getTextAngle(g,d)}},a=function(d){return function(g){var m=g.pstyle(d);return m&&m.value}},s=function(d){return function(g){return g.pstyle("".concat(d,"-opacity")).value>0}},l=function(d){var g=d.pstyle("text-events").strValue==="yes";return g?Cg.USE_BB:Cg.IGNORE},o=function(d){var g=d.position(),m=g.x,y=g.y,b=d.outerWidth(),x=d.outerHeight();return{w:b,h:x,x1:m-b/2,y1:y-x/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:o,isSimple:nZ,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),r.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:o,isVisible:s("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),r.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:o,isVisible:s("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:l,getKey:Yb(e.getLabelKey,null),getBoundingBox:Xb(e.getLabelBox,null),drawClipped:!0,drawElement:e.drawLabel,getRotation:i(null),getRotationPoint:e.getLabelRotationPoint,getRotationOffset:e.getLabelRotationOffset,isVisible:a("label")}),r.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:l,getKey:Yb(e.getSourceLabelKey,"source"),getBoundingBox:Xb(e.getSourceLabelBox,"source"),drawClipped:!0,drawElement:e.drawSourceLabel,getRotation:i("source"),getRotationPoint:e.getSourceLabelRotationPoint,getRotationOffset:e.getSourceLabelRotationOffset,isVisible:a("source-label")}),r.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:l,getKey:Yb(e.getTargetLabelKey,"target"),getBoundingBox:Xb(e.getTargetLabelBox,"target"),drawClipped:!0,drawElement:e.drawTargetLabel,getRotation:i("target"),getRotationPoint:e.getTargetLabelRotationPoint,getRotationOffset:e.getTargetLabelRotationOffset,isVisible:a("target-label")});var c=vh(function(){console.log("garbage collect flag set"),r.data.gc=!0},1e4);r.onUpdateEleCalcs(function(h,d){var g=!1;d&&d.length>0&&(g|=r.drawing.invalidate(d)),g&&c()}),kZ(r)};function CZ(t){var e=t.cy.container(),r=e&&e.style&&e.style.backgroundColor||"white";return kq(r)}function Kj(t,e){var r=t._private.rscratch;return Fn(r,"labelWrapCachedLines",e)||[]}var Yb=function(e,r){return function(n){var i=e(n),a=Kj(n,r);return a.length>1?a.map(function(s,l){return"".concat(i,"_").concat(l)}):i}},Xb=function(e,r){return function(n,i){var a=e(n);if(typeof i=="string"){var s=i.indexOf("_");if(s>0){var l=Number(i.substring(s+1)),o=Kj(n,r),c=a.h/o.length,h=c*l,d=a.y1+h;return{x1:a.x1,w:a.w,y1:d,h:c,yOffset:h}}}return a}};function kZ(t){{var e=t.render;t.render=function(a){a=a||{};var s=t.cy;t.webgl&&(s.zoom()>Vj?(TZ(t),e.call(t,a)):(EZ(t),Jj(t,a,Sf.SCREEN)))}}{var r=t.matchCanvasSize;t.matchCanvasSize=function(a){r.call(t,a),t.pickingFrameBuffer.setFramebufferAttachmentSizes(t.canvasWidth,t.canvasHeight),t.pickingFrameBuffer.needsDraw=!0}}t.findNearestElements=function(a,s,l,o){return _Z(t,a,s)};{var n=t.invalidateCachedZSortedEles;t.invalidateCachedZSortedEles=function(){n.call(t),t.pickingFrameBuffer.needsDraw=!0}}{var i=t.notify;t.notify=function(a,s){i.call(t,a,s),a==="viewport"||a==="bounds"?t.pickingFrameBuffer.needsDraw=!0:a==="background"&&t.drawing.invalidate(s,{type:"node-body"})}}}function TZ(t){var e=t.data.contexts[t.WEBGL];e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}function EZ(t){var e=function(n){n.save(),n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,t.canvasWidth,t.canvasHeight),n.restore()};e(t.data.contexts[t.NODE]),e(t.data.contexts[t.DRAG])}function AZ(t){var e=t.canvasWidth,r=t.canvasHeight,n=tE(t),i=n.pan,a=n.zoom,s=Ub();Gp(s,s,[i.x,i.y]),yk(s,s,[a,a]);var l=Ub();hZ(l,e,r);var o=Ub();return fZ(o,l,s),o}function Zj(t,e){var r=t.canvasWidth,n=t.canvasHeight,i=tE(t),a=i.pan,s=i.zoom;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,r,n),e.translate(a.x,a.y),e.scale(s,s)}function OZ(t,e){t.drawSelectionRectangle(e,function(r){return Zj(t,r)})}function MZ(t){var e=t.data.contexts[t.NODE];e.save(),Zj(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 RZ(t){var e=function(i,a,s){for(var l=i.atlasManager.getAtlasCollection(a),o=t.data.contexts[t.NODE],c=l.atlases,h=0;h<c.length;h++){var d=c[h],g=d.canvas;if(g){var m=g.width,y=g.height,b=m*h,x=g.height*s,w=.4;o.save(),o.scale(w,w),o.drawImage(g,b,x),o.strokeStyle="black",o.rect(b,x,m,y),o.stroke(),o.restore()}}},r=0;e(t.drawing,"node",r++),e(t.drawing,"label",r++)}function DZ(t,e,r,n,i){var a,s,l,o,c=tE(t),h=c.pan,d=c.zoom;{var g=rZ(t,h,d,e,r),m=Rr(g,2),y=m[0],b=m[1],x=6;a=y-x/2,s=b-x/2,l=x,o=x}if(l===0||o===0)return[];var w=t.data.contexts[t.WEBGL];w.bindFramebuffer(w.FRAMEBUFFER,t.pickingFrameBuffer),t.pickingFrameBuffer.needsDraw&&(w.viewport(0,0,w.canvas.width,w.canvas.height),Jj(t,null,Sf.PICKING),t.pickingFrameBuffer.needsDraw=!1);var S=l*o,k=new Uint8Array(S*4);w.readPixels(a,s,l,o,w.RGBA,w.UNSIGNED_BYTE,k),w.bindFramebuffer(w.FRAMEBUFFER,null);for(var E=new Set,M=0;M<S;M++){var R=k.slice(M*4,M*4+4),O=aZ(R)-1;O>=0&&E.add(O)}return E}function _Z(t,e,r){var n=DZ(t,e,r),i=t.getCachedZSortedEles(),a,s,l=Yn(n),o;try{for(l.s();!(o=l.n()).done;){var c=o.value,h=i[c];if(!a&&h.isNode()&&(a=h),!s&&h.isEdge()&&(s=h),a&&s)break}}catch(d){l.e(d)}finally{l.f()}return[a,s].filter(Boolean)}function Wb(t,e,r){var n=t.drawing;e+=1,r.isNode()?(n.drawNode(r,e,"node-underlay"),n.drawNode(r,e,"node-body"),n.drawTexture(r,e,"label"),n.drawNode(r,e,"node-overlay")):(n.drawEdgeLine(r,e),n.drawEdgeArrow(r,e,"source"),n.drawEdgeArrow(r,e,"target"),n.drawTexture(r,e,"label"),n.drawTexture(r,e,"edge-source-label"),n.drawTexture(r,e,"edge-target-label"))}function Jj(t,e,r){var n;t.webglDebug&&(n=performance.now());var i=t.drawing,a=0;if(r.screen&&t.data.canvasNeedsRedraw[t.SELECT_BOX]&&OZ(t,e),t.data.canvasNeedsRedraw[t.NODE]||r.picking){var s=t.data.contexts[t.WEBGL];r.screen?(s.clearColor(0,0,0,0),s.enable(s.BLEND),s.blendFunc(s.ONE,s.ONE_MINUS_SRC_ALPHA)):s.disable(s.BLEND),s.clear(s.COLOR_BUFFER_BIT|s.DEPTH_BUFFER_BIT),s.viewport(0,0,s.canvas.width,s.canvas.height);var l=AZ(t),o=t.getCachedZSortedEles();if(a=o.length,i.startFrame(l,r),r.screen){for(var c=0;c<o.nondrag.length;c++)Wb(t,c,o.nondrag[c]);for(var h=0;h<o.drag.length;h++)Wb(t,h,o.drag[h])}else if(r.picking)for(var d=0;d<o.length;d++)Wb(t,d,o[d]);i.endFrame(),r.screen&&t.webglDebugShowAtlases&&(MZ(t),RZ(t)),t.data.canvasNeedsRedraw[t.NODE]=!1,t.data.canvasNeedsRedraw[t.DRAG]=!1}if(t.webglDebug){var g=performance.now(),m=!1,y=Math.ceil(g-n),b=i.getDebugInfo(),x=["".concat(a," elements"),"".concat(b.totalInstances," instances"),"".concat(b.batchCount," batches"),"".concat(b.totalAtlases," atlases"),"".concat(b.wrappedCount," wrapped textures"),"".concat(b.simpleCount," simple shapes")].join(", ");if(m)console.log("WebGL (".concat(r.name,") - time ").concat(y,"ms, ").concat(x));else{console.log("WebGL (".concat(r.name,") - frame time ").concat(y,"ms")),console.log("Totals:"),console.log(" ".concat(x)),console.log("Texture Atlases Used:");var w=b.atlasInfo,S=Yn(w),k;try{for(S.s();!(k=S.n()).done;){var E=k.value;console.log(" ".concat(E.type,": ").concat(E.keyCount," keys, ").concat(E.atlasCount," atlases"))}}catch(M){S.e(M)}finally{S.f()}console.log("")}}t.data.gc&&(console.log("Garbage Collect!"),t.data.gc=!1,i.gc())}var cl={};cl.drawPolygonPath=function(t,e,r,n,i,a){var s=n/2,l=i/2;t.beginPath&&t.beginPath(),t.moveTo(e+s*a[0],r+l*a[1]);for(var o=1;o<a.length/2;o++)t.lineTo(e+s*a[o*2],r+l*a[o*2+1]);t.closePath()};cl.drawRoundPolygonPath=function(t,e,r,n,i,a,s){s.forEach(function(l){return Bj(t,l)}),t.closePath()};cl.drawRoundRectanglePath=function(t,e,r,n,i,a){var s=n/2,l=i/2,o=a==="auto"?Ws(n,i):Math.min(a,l,s);t.beginPath&&t.beginPath(),t.moveTo(e,r-l),t.arcTo(e+s,r-l,e+s,r,o),t.arcTo(e+s,r+l,e,r+l,o),t.arcTo(e-s,r+l,e-s,r,o),t.arcTo(e-s,r-l,e,r-l,o),t.lineTo(e,r-l),t.closePath()};cl.drawBottomRoundRectanglePath=function(t,e,r,n,i,a){var s=n/2,l=i/2,o=a==="auto"?Ws(n,i):a;t.beginPath&&t.beginPath(),t.moveTo(e,r-l),t.lineTo(e+s,r-l),t.lineTo(e+s,r),t.arcTo(e+s,r+l,e,r+l,o),t.arcTo(e-s,r+l,e-s,r,o),t.lineTo(e-s,r-l),t.lineTo(e,r-l),t.closePath()};cl.drawCutRectanglePath=function(t,e,r,n,i,a,s){var l=n/2,o=i/2,c=s==="auto"?FT():s;t.beginPath&&t.beginPath(),t.moveTo(e-l+c,r-o),t.lineTo(e+l-c,r-o),t.lineTo(e+l,r-o+c),t.lineTo(e+l,r+o-c),t.lineTo(e+l-c,r+o),t.lineTo(e-l+c,r+o),t.lineTo(e-l,r+o-c),t.lineTo(e-l,r-o+c),t.closePath()};cl.drawBarrelPath=function(t,e,r,n,i){var a=n/2,s=i/2,l=e-a,o=e+a,c=r-s,h=r+s,d=ik(n,i),g=d.widthOffset,m=d.heightOffset,y=d.ctrlPtOffsetPct*g;t.beginPath&&t.beginPath(),t.moveTo(l,c+m),t.lineTo(l,h-m),t.quadraticCurveTo(l+y,h,l+g,h),t.lineTo(o-g,h),t.quadraticCurveTo(o-y,h,o,h-m),t.lineTo(o,c+m),t.quadraticCurveTo(o-y,c,o-g,c),t.lineTo(l+g,c),t.quadraticCurveTo(l+y,c,l,c+m),t.closePath()};var XN=Math.sin(0),WN=Math.cos(0),bk={},xk={},e8=Math.PI/40;for(var au=0*Math.PI;au<2*Math.PI;au+=e8)bk[au]=Math.sin(au),xk[au]=Math.cos(au);cl.drawEllipsePath=function(t,e,r,n,i){if(t.beginPath&&t.beginPath(),t.ellipse)t.ellipse(e,r,n/2,i/2,0,0,2*Math.PI);else for(var a,s,l=n/2,o=i/2,c=0*Math.PI;c<2*Math.PI;c+=e8)a=e-l*bk[c]*XN+l*xk[c]*WN,s=r+o*xk[c]*XN+o*bk[c]*WN,c===0?t.moveTo(a,s):t.lineTo(a,s);t.closePath()};var Sh={};Sh.createBuffer=function(t,e){var r=document.createElement("canvas");return r.width=t,r.height=e,[r,r.getContext("2d")]};Sh.bufferCanvasImage=function(t){var e=this.cy,r=e.mutableElements(),n=r.boundingBox(),i=this.findContainerClientCoords(),a=t.full?Math.ceil(n.w):i[2],s=t.full?Math.ceil(n.h):i[3],l=qe(t.maxWidth)||qe(t.maxHeight),o=this.getPixelRatio(),c=1;if(t.scale!==void 0)a*=t.scale,s*=t.scale,c=t.scale;else if(l){var h=1/0,d=1/0;qe(t.maxWidth)&&(h=c*t.maxWidth/a),qe(t.maxHeight)&&(d=c*t.maxHeight/s),c=Math.min(h,d),a*=c,s*=c}l||(a*=o,s*=o,c*=o);var g=document.createElement("canvas");g.width=a,g.height=s,g.style.width=a+"px",g.style.height=s+"px";var m=g.getContext("2d");if(a>0&&s>0){m.clearRect(0,0,a,s),m.globalCompositeOperation="source-over";var y=this.getCachedZSortedEles();if(t.full)m.translate(-n.x1*c,-n.y1*c),m.scale(c,c),this.drawElements(m,y),m.scale(1/c,1/c),m.translate(n.x1*c,n.y1*c);else{var b=e.pan(),x={x:b.x*c,y:b.y*c};c*=e.zoom(),m.translate(x.x,x.y),m.scale(c,c),this.drawElements(m,y),m.scale(1/c,1/c),m.translate(-x.x,-x.y)}t.bg&&(m.globalCompositeOperation="destination-over",m.fillStyle=t.bg,m.rect(0,0,a,s),m.fill())}return g};function NZ(t,e){for(var r=atob(t),n=new ArrayBuffer(r.length),i=new Uint8Array(n),a=0;a<r.length;a++)i[a]=r.charCodeAt(a);return new Blob([n],{type:e})}function QN(t){var e=t.indexOf(",");return t.substr(e+1)}function t8(t,e,r){var n=function(){return e.toDataURL(r,t.quality)};switch(t.output){case"blob-promise":return new Gu(function(i,a){try{e.toBlob(function(s){s!=null?i(s):a(new Error("`canvas.toBlob()` sent a null value in its callback"))},r,t.quality)}catch(s){a(s)}});case"blob":return NZ(QN(n()),r);case"base64":return QN(n());default:return n()}}Sh.png=function(t){return t8(t,this.bufferCanvasImage(t),"image/png")};Sh.jpg=function(t){return t8(t,this.bufferCanvasImage(t),"image/jpeg")};var r8={};r8.nodeShapeImpl=function(t,e,r,n,i,a,s,l){switch(t){case"ellipse":return this.drawEllipsePath(e,r,n,i,a);case"polygon":return this.drawPolygonPath(e,r,n,i,a,s);case"round-polygon":return this.drawRoundPolygonPath(e,r,n,i,a,s,l);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(e,r,n,i,a,l);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(e,r,n,i,a,s,l);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(e,r,n,i,a,l);case"barrel":return this.drawBarrelPath(e,r,n,i,a)}};var BZ=n8,St=n8.prototype;St.CANVAS_LAYERS=3;St.SELECT_BOX=0;St.DRAG=1;St.NODE=2;St.WEBGL=3;St.CANVAS_TYPES=["2d","2d","2d","webgl2"];St.BUFFER_COUNT=3;St.TEXTURE_BUFFER=0;St.MOTIONBLUR_BUFFER_NODE=1;St.MOTIONBLUR_BUFFER_DRAG=2;function n8(t){var e=this,r=e.cy.window(),n=r.document;t.webgl&&(St.CANVAS_LAYERS=e.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),e.data={canvases:new Array(St.CANVAS_LAYERS),contexts:new Array(St.CANVAS_LAYERS),canvasNeedsRedraw:new Array(St.CANVAS_LAYERS),bufferCanvases:new Array(St.BUFFER_COUNT),bufferContexts:new Array(St.CANVAS_LAYERS)};var i="-webkit-tap-highlight-color",a="rgba(0,0,0,0)";e.data.canvasContainer=n.createElement("div");var s=e.data.canvasContainer.style;e.data.canvasContainer.style[i]=a,s.position="relative",s.zIndex="0",s.overflow="hidden";var l=t.cy.container();l.appendChild(e.data.canvasContainer),l.style[i]=a;var o={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};OG()&&(o["-ms-touch-action"]="none",o["touch-action"]="none");for(var c=0;c<St.CANVAS_LAYERS;c++){var h=e.data.canvases[c]=n.createElement("canvas"),d=St.CANVAS_TYPES[c];e.data.contexts[c]=h.getContext(d),e.data.contexts[c]||ur("Could not create canvas of type "+d),Object.keys(o).forEach(function(de){h.style[de]=o[de]}),h.style.position="absolute",h.setAttribute("data-id","layer"+c),h.style.zIndex=String(St.CANVAS_LAYERS-c),e.data.canvasContainer.appendChild(h),e.data.canvasNeedsRedraw[c]=!1}e.data.topCanvas=e.data.canvases[0],e.data.canvases[St.NODE].setAttribute("data-id","layer"+St.NODE+"-node"),e.data.canvases[St.SELECT_BOX].setAttribute("data-id","layer"+St.SELECT_BOX+"-selectbox"),e.data.canvases[St.DRAG].setAttribute("data-id","layer"+St.DRAG+"-drag"),e.data.canvases[St.WEBGL]&&e.data.canvases[St.WEBGL].setAttribute("data-id","layer"+St.WEBGL+"-webgl");for(var c=0;c<St.BUFFER_COUNT;c++)e.data.bufferCanvases[c]=n.createElement("canvas"),e.data.bufferContexts[c]=e.data.bufferCanvases[c].getContext("2d"),e.data.bufferCanvases[c].style.position="absolute",e.data.bufferCanvases[c].setAttribute("data-id","buffer"+c),e.data.bufferCanvases[c].style.zIndex=String(-c-1),e.data.bufferCanvases[c].style.visibility="hidden";e.pathsEnabled=!0;var g=Rn(),m=function(se){return{x:(se.x1+se.x2)/2,y:(se.y1+se.y2)/2}},y=function(se){return{x:-se.w/2,y:-se.h/2}},b=function(se){var j=se[0]._private,Q=j.oldBackgroundTimestamp===j.backgroundTimestamp;return!Q},x=function(se){return se[0]._private.nodeKey},w=function(se){return se[0]._private.labelStyleKey},S=function(se){return se[0]._private.sourceLabelStyleKey},k=function(se){return se[0]._private.targetLabelStyleKey},E=function(se,j,Q,K,ue){return e.drawElement(se,j,Q,!1,!1,ue)},M=function(se,j,Q,K,ue){return e.drawElementText(se,j,Q,K,"main",ue)},R=function(se,j,Q,K,ue){return e.drawElementText(se,j,Q,K,"source",ue)},O=function(se,j,Q,K,ue){return e.drawElementText(se,j,Q,K,"target",ue)},N=function(se){return se.boundingBox(),se[0]._private.bodyBounds},B=function(se){return se.boundingBox(),se[0]._private.labelBounds.main||g},D=function(se){return se.boundingBox(),se[0]._private.labelBounds.source||g},_=function(se){return se.boundingBox(),se[0]._private.labelBounds.target||g},P=function(se,j){return j},z=function(se){return m(N(se))},H=function(se,j,Q){var K=se?se+"-":"";return{x:j.x+Q.pstyle(K+"text-margin-x").pfValue,y:j.y+Q.pstyle(K+"text-margin-y").pfValue}},$=function(se,j,Q){var K=se[0]._private.rscratch;return{x:K[j],y:K[Q]}},q=function(se){return H("",$(se,"labelX","labelY"),se)},V=function(se){return H("source",$(se,"sourceLabelX","sourceLabelY"),se)},X=function(se){return H("target",$(se,"targetLabelX","targetLabelY"),se)},ee=function(se){return y(N(se))},te=function(se){return y(D(se))},I=function(se){return y(_(se))},G=function(se){var j=B(se),Q=y(B(se));if(se.isNode()){switch(se.pstyle("text-halign").value){case"left":Q.x=-j.w-(j.leftPad||0);break;case"right":Q.x=-(j.rightPad||0);break}switch(se.pstyle("text-valign").value){case"top":Q.y=-j.h-(j.topPad||0);break;case"bottom":Q.y=-(j.botPad||0);break}}return Q},re=e.data.eleTxrCache=new df(e,{getKey:x,doesEleInvalidateKey:b,drawElement:E,getBoundingBox:N,getRotationPoint:z,getRotationOffset:ee,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),Y=e.data.lblTxrCache=new df(e,{getKey:w,drawElement:M,getBoundingBox:B,getRotationPoint:q,getRotationOffset:G,isVisible:P}),W=e.data.slbTxrCache=new df(e,{getKey:S,drawElement:R,getBoundingBox:D,getRotationPoint:V,getRotationOffset:te,isVisible:P}),Z=e.data.tlbTxrCache=new df(e,{getKey:k,drawElement:O,getBoundingBox:_,getRotationPoint:X,getRotationOffset:I,isVisible:P}),ie=e.data.lyrTxrCache=new Uj(e);e.onUpdateEleCalcs(function(se,j){re.invalidateElements(j),Y.invalidateElements(j),W.invalidateElements(j),Z.invalidateElements(j),ie.invalidateElements(j);for(var Q=0;Q<j.length;Q++){var K=j[Q]._private;K.oldBackgroundTimestamp=K.backgroundTimestamp}});var we=function(se){for(var j=0;j<se.length;j++)ie.enqueueElementRefinement(se[j].ele)};re.onDequeue(we),Y.onDequeue(we),W.onDequeue(we),Z.onDequeue(we),t.webgl&&e.initWebgl(t,{getStyleKey:x,getLabelKey:w,getSourceLabelKey:S,getTargetLabelKey:k,drawElement:E,drawLabel:M,drawSourceLabel:R,drawTargetLabel:O,getElementBox:N,getLabelBox:B,getSourceLabelBox:D,getTargetLabelBox:_,getElementRotationPoint:z,getElementRotationOffset:ee,getLabelRotationPoint:q,getSourceLabelRotationPoint:V,getTargetLabelRotationPoint:X,getLabelRotationOffset:G,getSourceLabelRotationOffset:te,getTargetLabelRotationOffset:I})}St.redrawHint=function(t,e){var r=this;switch(t){case"eles":r.data.canvasNeedsRedraw[St.NODE]=e;break;case"drag":r.data.canvasNeedsRedraw[St.DRAG]=e;break;case"select":r.data.canvasNeedsRedraw[St.SELECT_BOX]=e;break;case"gc":r.data.gc=!0;break}};var LZ=typeof Path2D<"u";St.path2dEnabled=function(t){if(t===void 0)return this.pathsEnabled;this.pathsEnabled=!!t};St.usePaths=function(){return LZ&&this.pathsEnabled};St.setImgSmoothing=function(t,e){t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled=e:(t.webkitImageSmoothingEnabled=e,t.mozImageSmoothingEnabled=e,t.msImageSmoothingEnabled=e)};St.getImgSmoothing=function(t){return t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled:t.webkitImageSmoothingEnabled||t.mozImageSmoothingEnabled||t.msImageSmoothingEnabled};St.makeOffscreenCanvas=function(t,e){var r;if((typeof OffscreenCanvas>"u"?"undefined":qr(OffscreenCanvas))!=="undefined")r=new OffscreenCanvas(t,e);else{var n=this.cy.window(),i=n.document;r=i.createElement("canvas"),r.width=t,r.height=e}return r};[$j,ga,es,eE,oo,ul,Dn,Qj,cl,Sh,r8].forEach(function(t){ft(St,t)});var PZ=[{name:"null",impl:Dj},{name:"base",impl:Fj},{name:"canvas",impl:BZ}],zZ=[{type:"layout",extensions:oK},{type:"renderer",extensions:PZ}],i8={},a8={};function s8(t,e,r){var n=r,i=function(N){jt("Can not register `"+e+"` for `"+t+"` since `"+N+"` already exists in the prototype and can not be overridden")};if(t==="core"){if(Uf.prototype[e])return i(e);Uf.prototype[e]=r}else if(t==="collection"){if(on.prototype[e])return i(e);on.prototype[e]=r}else if(t==="layout"){for(var a=function(N){this.options=N,r.call(this,N),Bt(this._private)||(this._private={}),this._private.cy=N.cy,this._private.listeners=[],this.createEmitter()},s=a.prototype=Object.create(r.prototype),l=[],o=0;o<l.length;o++){var c=l[o];s[c]=s[c]||function(){return this}}s.start&&!s.run?s.run=function(){return this.start(),this}:!s.start&&s.run&&(s.start=function(){return this.run(),this});var h=r.prototype.stop;s.stop=function(){var O=this.options;if(O&&O.animate){var N=this.animations;if(N)for(var B=0;B<N.length;B++)N[B].stop()}return h?h.call(this):this.emit("layoutstop"),this},s.destroy||(s.destroy=function(){return this}),s.cy=function(){return this._private.cy};var d=function(N){return N._private.cy},g={addEventFields:function(N,B){B.layout=N,B.cy=d(N),B.target=N},bubble:function(){return!0},parent:function(N){return d(N)}};ft(s,{createEmitter:function(){return this._private.emitter=new pv(g,this),this},emitter:function(){return this._private.emitter},on:function(N,B){return this.emitter().on(N,B),this},one:function(N,B){return this.emitter().one(N,B),this},once:function(N,B){return this.emitter().one(N,B),this},removeListener:function(N,B){return this.emitter().removeListener(N,B),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(N,B){return this.emitter().emit(N,B),this}}),qt.eventAliasesOn(s),n=a}else if(t==="renderer"&&e!=="null"&&e!=="base"){var m=l8("renderer","base"),y=m.prototype,b=r,x=r.prototype,w=function(){m.apply(this,arguments),b.apply(this,arguments)},S=w.prototype;for(var k in y){var E=y[k],M=x[k]!=null;if(M)return i(k);S[k]=E}for(var R in x)S[R]=x[R];y.clientFunctions.forEach(function(O){S[O]=S[O]||function(){ur("Renderer does not implement `renderer."+O+"()` on its prototype")}}),n=w}else if(t==="__proto__"||t==="constructor"||t==="prototype")return ur(t+" is an illegal type to be registered, possibly lead to prototype pollutions");return Tq({map:i8,keys:[t,e],value:n})}function l8(t,e){return Eq({map:i8,keys:[t,e]})}function IZ(t,e,r,n,i){return Tq({map:a8,keys:[t,e,r,n],value:i})}function qZ(t,e,r,n){return Eq({map:a8,keys:[t,e,r,n]})}var wk=function(){if(arguments.length===2)return l8.apply(null,arguments);if(arguments.length===3)return s8.apply(null,arguments);if(arguments.length===4)return qZ.apply(null,arguments);if(arguments.length===5)return IZ.apply(null,arguments);ur("Invalid extension access syntax")};Uf.prototype.extension=wk;zZ.forEach(function(t){t.extensions.forEach(function(e){s8(t.type,e.name,e.impl)})});var kg=function(){if(!(this instanceof kg))return new kg;this.length=0},eo=kg.prototype;eo.instanceString=function(){return"stylesheet"};eo.selector=function(t){var e=this.length++;return this[e]={selector:t,properties:[]},this};eo.css=function(t,e){var r=this.length-1;if(lt(t))this[r].properties.push({name:t,value:e});else if(Bt(t))for(var n=t,i=Object.keys(n),a=0;a<i.length;a++){var s=i[a],l=n[s];if(l!=null){var o=Qr.properties[s]||Qr.properties[iv(s)];if(o!=null){var c=o.name,h=l;this[r].properties.push({name:c,value:h})}}}return this};eo.style=eo.css;eo.generateStyle=function(t){var e=new Qr(t);return this.appendToStyle(e)};eo.appendToStyle=function(t){for(var e=0;e<this.length;e++){var r=this[e],n=r.selector,i=r.properties;t.selector(n);for(var a=0;a<i.length;a++){var s=i[a];t.css(s.name,s.value)}}return t};var jZ="3.33.1",to=function(e){if(e===void 0&&(e={}),Bt(e))return new Uf(e);if(lt(e))return wk.apply(wk,arguments)};to.use=function(t){var e=Array.prototype.slice.call(arguments,1);return e.unshift(to),t.apply(null,e),this};to.warnings=function(t){return Nq(t)};to.version=jZ;to.stylesheet=to.Stylesheet=kg;var Yp={exports:{}};function rE(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Qb,KN;function FZ(){if(KN)return Qb;KN=1;function t(){this.__data__=[],this.size=0}return Qb=t,Qb}var Kb,ZN;function Ku(){if(ZN)return Kb;ZN=1;function t(e,r){return e===r||e!==e&&r!==r}return Kb=t,Kb}var Zb,JN;function Sv(){if(JN)return Zb;JN=1;var t=Ku();function e(r,n){for(var i=r.length;i--;)if(t(r[i][0],n))return i;return-1}return Zb=e,Zb}var Jb,eB;function HZ(){if(eB)return Jb;eB=1;var t=Sv(),e=Array.prototype,r=e.splice;function n(i){var a=this.__data__,s=t(a,i);if(s<0)return!1;var l=a.length-1;return s==l?a.pop():r.call(a,s,1),--this.size,!0}return Jb=n,Jb}var e1,tB;function VZ(){if(tB)return e1;tB=1;var t=Sv();function e(r){var n=this.__data__,i=t(n,r);return i<0?void 0:n[i][1]}return e1=e,e1}var t1,rB;function UZ(){if(rB)return t1;rB=1;var t=Sv();function e(r){return t(this.__data__,r)>-1}return t1=e,t1}var r1,nB;function $Z(){if(nB)return r1;nB=1;var t=Sv();function e(r,n){var i=this.__data__,a=t(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return r1=e,r1}var n1,iB;function Cv(){if(iB)return n1;iB=1;var t=FZ(),e=HZ(),r=VZ(),n=UZ(),i=$Z();function a(s){var l=-1,o=s==null?0:s.length;for(this.clear();++l<o;){var c=s[l];this.set(c[0],c[1])}}return a.prototype.clear=t,a.prototype.delete=e,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,n1=a,n1}var i1,aB;function GZ(){if(aB)return i1;aB=1;var t=Cv();function e(){this.__data__=new t,this.size=0}return i1=e,i1}var a1,sB;function YZ(){if(sB)return a1;sB=1;function t(e){var r=this.__data__,n=r.delete(e);return this.size=r.size,n}return a1=t,a1}var s1,lB;function XZ(){if(lB)return s1;lB=1;function t(e){return this.__data__.get(e)}return s1=t,s1}var l1,oB;function WZ(){if(oB)return l1;oB=1;function t(e){return this.__data__.has(e)}return l1=t,l1}var o1,uB;function o8(){if(uB)return o1;uB=1;var t=typeof Kd=="object"&&Kd&&Kd.Object===Object&&Kd;return o1=t,o1}var u1,cB;function Vi(){if(cB)return u1;cB=1;var t=o8(),e=typeof self=="object"&&self&&self.Object===Object&&self,r=t||e||Function("return this")();return u1=r,u1}var c1,fB;function Zu(){if(fB)return c1;fB=1;var t=Vi(),e=t.Symbol;return c1=e,c1}var f1,hB;function QZ(){if(hB)return f1;hB=1;var t=Zu(),e=Object.prototype,r=e.hasOwnProperty,n=e.toString,i=t?t.toStringTag:void 0;function a(s){var l=r.call(s,i),o=s[i];try{s[i]=void 0;var c=!0}catch{}var h=n.call(s);return c&&(l?s[i]=o:delete s[i]),h}return f1=a,f1}var h1,dB;function KZ(){if(dB)return h1;dB=1;var t=Object.prototype,e=t.toString;function r(n){return e.call(n)}return h1=r,h1}var d1,pB;function uo(){if(pB)return d1;pB=1;var t=Zu(),e=QZ(),r=KZ(),n="[object Null]",i="[object Undefined]",a=t?t.toStringTag:void 0;function s(l){return l==null?l===void 0?i:n:a&&a in Object(l)?e(l):r(l)}return d1=s,d1}var p1,gB;function Mi(){if(gB)return p1;gB=1;function t(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}return p1=t,p1}var g1,vB;function Ch(){if(vB)return g1;vB=1;var t=uo(),e=Mi(),r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function s(l){if(!e(l))return!1;var o=t(l);return o==n||o==i||o==r||o==a}return g1=s,g1}var v1,mB;function ZZ(){if(mB)return v1;mB=1;var t=Vi(),e=t["__core-js_shared__"];return v1=e,v1}var m1,yB;function JZ(){if(yB)return m1;yB=1;var t=ZZ(),e=(function(){var n=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!e&&e in n}return m1=r,m1}var y1,bB;function u8(){if(bB)return y1;bB=1;var t=Function.prototype,e=t.toString;function r(n){if(n!=null){try{return e.call(n)}catch{}try{return n+""}catch{}}return""}return y1=r,y1}var b1,xB;function eJ(){if(xB)return b1;xB=1;var t=Ch(),e=JZ(),r=Mi(),n=u8(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,s=Function.prototype,l=Object.prototype,o=s.toString,c=l.hasOwnProperty,h=RegExp("^"+o.call(c).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function d(g){if(!r(g)||e(g))return!1;var m=t(g)?h:a;return m.test(n(g))}return b1=d,b1}var x1,wB;function tJ(){if(wB)return x1;wB=1;function t(e,r){return e?.[r]}return x1=t,x1}var w1,SB;function co(){if(SB)return w1;SB=1;var t=eJ(),e=tJ();function r(n,i){var a=e(n,i);return t(a)?a:void 0}return w1=r,w1}var S1,CB;function nE(){if(CB)return S1;CB=1;var t=co(),e=Vi(),r=t(e,"Map");return S1=r,S1}var C1,kB;function kv(){if(kB)return C1;kB=1;var t=co(),e=t(Object,"create");return C1=e,C1}var k1,TB;function rJ(){if(TB)return k1;TB=1;var t=kv();function e(){this.__data__=t?t(null):{},this.size=0}return k1=e,k1}var T1,EB;function nJ(){if(EB)return T1;EB=1;function t(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}return T1=t,T1}var E1,AB;function iJ(){if(AB)return E1;AB=1;var t=kv(),e="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function i(a){var s=this.__data__;if(t){var l=s[a];return l===e?void 0:l}return n.call(s,a)?s[a]:void 0}return E1=i,E1}var A1,OB;function aJ(){if(OB)return A1;OB=1;var t=kv(),e=Object.prototype,r=e.hasOwnProperty;function n(i){var a=this.__data__;return t?a[i]!==void 0:r.call(a,i)}return A1=n,A1}var O1,MB;function sJ(){if(MB)return O1;MB=1;var t=kv(),e="__lodash_hash_undefined__";function r(n,i){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=t&&i===void 0?e:i,this}return O1=r,O1}var M1,RB;function lJ(){if(RB)return M1;RB=1;var t=rJ(),e=nJ(),r=iJ(),n=aJ(),i=sJ();function a(s){var l=-1,o=s==null?0:s.length;for(this.clear();++l<o;){var c=s[l];this.set(c[0],c[1])}}return a.prototype.clear=t,a.prototype.delete=e,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,M1=a,M1}var R1,DB;function oJ(){if(DB)return R1;DB=1;var t=lJ(),e=Cv(),r=nE();function n(){this.size=0,this.__data__={hash:new t,map:new(r||e),string:new t}}return R1=n,R1}var D1,_B;function uJ(){if(_B)return D1;_B=1;function t(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}return D1=t,D1}var _1,NB;function Tv(){if(NB)return _1;NB=1;var t=uJ();function e(r,n){var i=r.__data__;return t(n)?i[typeof n=="string"?"string":"hash"]:i.map}return _1=e,_1}var N1,BB;function cJ(){if(BB)return N1;BB=1;var t=Tv();function e(r){var n=t(this,r).delete(r);return this.size-=n?1:0,n}return N1=e,N1}var B1,LB;function fJ(){if(LB)return B1;LB=1;var t=Tv();function e(r){return t(this,r).get(r)}return B1=e,B1}var L1,PB;function hJ(){if(PB)return L1;PB=1;var t=Tv();function e(r){return t(this,r).has(r)}return L1=e,L1}var P1,zB;function dJ(){if(zB)return P1;zB=1;var t=Tv();function e(r,n){var i=t(this,r),a=i.size;return i.set(r,n),this.size+=i.size==a?0:1,this}return P1=e,P1}var z1,IB;function iE(){if(IB)return z1;IB=1;var t=oJ(),e=cJ(),r=fJ(),n=hJ(),i=dJ();function a(s){var l=-1,o=s==null?0:s.length;for(this.clear();++l<o;){var c=s[l];this.set(c[0],c[1])}}return a.prototype.clear=t,a.prototype.delete=e,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,z1=a,z1}var I1,qB;function pJ(){if(qB)return I1;qB=1;var t=Cv(),e=nE(),r=iE(),n=200;function i(a,s){var l=this.__data__;if(l instanceof t){var o=l.__data__;if(!e||o.length<n-1)return o.push([a,s]),this.size=++l.size,this;l=this.__data__=new r(o)}return l.set(a,s),this.size=l.size,this}return I1=i,I1}var q1,jB;function Ev(){if(jB)return q1;jB=1;var t=Cv(),e=GZ(),r=YZ(),n=XZ(),i=WZ(),a=pJ();function s(l){var o=this.__data__=new t(l);this.size=o.size}return s.prototype.clear=e,s.prototype.delete=r,s.prototype.get=n,s.prototype.has=i,s.prototype.set=a,q1=s,q1}var j1,FB;function aE(){if(FB)return j1;FB=1;function t(e,r){for(var n=-1,i=e==null?0:e.length;++n<i&&r(e[n],n,e)!==!1;);return e}return j1=t,j1}var F1,HB;function c8(){if(HB)return F1;HB=1;var t=co(),e=(function(){try{var r=t(Object,"defineProperty");return r({},"",{}),r}catch{}})();return F1=e,F1}var H1,VB;function Av(){if(VB)return H1;VB=1;var t=c8();function e(r,n,i){n=="__proto__"&&t?t(r,n,{configurable:!0,enumerable:!0,value:i,writable:!0}):r[n]=i}return H1=e,H1}var V1,UB;function Ov(){if(UB)return V1;UB=1;var t=Av(),e=Ku(),r=Object.prototype,n=r.hasOwnProperty;function i(a,s,l){var o=a[s];(!(n.call(a,s)&&e(o,l))||l===void 0&&!(s in a))&&t(a,s,l)}return V1=i,V1}var U1,$B;function kh(){if($B)return U1;$B=1;var t=Ov(),e=Av();function r(n,i,a,s){var l=!a;a||(a={});for(var o=-1,c=i.length;++o<c;){var h=i[o],d=s?s(a[h],n[h],h,a,n):void 0;d===void 0&&(d=n[h]),l?e(a,h,d):t(a,h,d)}return a}return U1=r,U1}var $1,GB;function gJ(){if(GB)return $1;GB=1;function t(e,r){for(var n=-1,i=Array(e);++n<e;)i[n]=r(n);return i}return $1=t,$1}var G1,YB;function va(){if(YB)return G1;YB=1;function t(e){return e!=null&&typeof e=="object"}return G1=t,G1}var Y1,XB;function vJ(){if(XB)return Y1;XB=1;var t=uo(),e=va(),r="[object Arguments]";function n(i){return e(i)&&t(i)==r}return Y1=n,Y1}var X1,WB;function Th(){if(WB)return X1;WB=1;var t=vJ(),e=va(),r=Object.prototype,n=r.hasOwnProperty,i=r.propertyIsEnumerable,a=t((function(){return arguments})())?t:function(s){return e(s)&&n.call(s,"callee")&&!i.call(s,"callee")};return X1=a,X1}var W1,QB;function _r(){if(QB)return W1;QB=1;var t=Array.isArray;return W1=t,W1}var pf={exports:{}},Q1,KB;function mJ(){if(KB)return Q1;KB=1;function t(){return!1}return Q1=t,Q1}pf.exports;var ZB;function Ju(){return ZB||(ZB=1,(function(t,e){var r=Vi(),n=mJ(),i=e&&!e.nodeType&&e,a=i&&!0&&t&&!t.nodeType&&t,s=a&&a.exports===i,l=s?r.Buffer:void 0,o=l?l.isBuffer:void 0,c=o||n;t.exports=c})(pf,pf.exports)),pf.exports}var K1,JB;function Mv(){if(JB)return K1;JB=1;var t=9007199254740991,e=/^(?:0|[1-9]\d*)$/;function r(n,i){var a=typeof n;return i=i??t,!!i&&(a=="number"||a!="symbol"&&e.test(n))&&n>-1&&n%1==0&&n<i}return K1=r,K1}var Z1,eL;function sE(){if(eL)return Z1;eL=1;var t=9007199254740991;function e(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=t}return Z1=e,Z1}var J1,tL;function yJ(){if(tL)return J1;tL=1;var t=uo(),e=sE(),r=va(),n="[object Arguments]",i="[object Array]",a="[object Boolean]",s="[object Date]",l="[object Error]",o="[object Function]",c="[object Map]",h="[object Number]",d="[object Object]",g="[object RegExp]",m="[object Set]",y="[object String]",b="[object WeakMap]",x="[object ArrayBuffer]",w="[object DataView]",S="[object Float32Array]",k="[object Float64Array]",E="[object Int8Array]",M="[object Int16Array]",R="[object Int32Array]",O="[object Uint8Array]",N="[object Uint8ClampedArray]",B="[object Uint16Array]",D="[object Uint32Array]",_={};_[S]=_[k]=_[E]=_[M]=_[R]=_[O]=_[N]=_[B]=_[D]=!0,_[n]=_[i]=_[x]=_[a]=_[w]=_[s]=_[l]=_[o]=_[c]=_[h]=_[d]=_[g]=_[m]=_[y]=_[b]=!1;function P(z){return r(z)&&e(z.length)&&!!_[t(z)]}return J1=P,J1}var ex,rL;function Rv(){if(rL)return ex;rL=1;function t(e){return function(r){return e(r)}}return ex=t,ex}var gf={exports:{}};gf.exports;var nL;function lE(){return nL||(nL=1,(function(t,e){var r=o8(),n=e&&!e.nodeType&&e,i=n&&!0&&t&&!t.nodeType&&t,a=i&&i.exports===n,s=a&&r.process,l=(function(){try{var o=i&&i.require&&i.require("util").types;return o||s&&s.binding&&s.binding("util")}catch{}})();t.exports=l})(gf,gf.exports)),gf.exports}var tx,iL;function Eh(){if(iL)return tx;iL=1;var t=yJ(),e=Rv(),r=lE(),n=r&&r.isTypedArray,i=n?e(n):t;return tx=i,tx}var rx,aL;function f8(){if(aL)return rx;aL=1;var t=gJ(),e=Th(),r=_r(),n=Ju(),i=Mv(),a=Eh(),s=Object.prototype,l=s.hasOwnProperty;function o(c,h){var d=r(c),g=!d&&e(c),m=!d&&!g&&n(c),y=!d&&!g&&!m&&a(c),b=d||g||m||y,x=b?t(c.length,String):[],w=x.length;for(var S in c)(h||l.call(c,S))&&!(b&&(S=="length"||m&&(S=="offset"||S=="parent")||y&&(S=="buffer"||S=="byteLength"||S=="byteOffset")||i(S,w)))&&x.push(S);return x}return rx=o,rx}var nx,sL;function Dv(){if(sL)return nx;sL=1;var t=Object.prototype;function e(r){var n=r&&r.constructor,i=typeof n=="function"&&n.prototype||t;return r===i}return nx=e,nx}var ix,lL;function h8(){if(lL)return ix;lL=1;function t(e,r){return function(n){return e(r(n))}}return ix=t,ix}var ax,oL;function bJ(){if(oL)return ax;oL=1;var t=h8(),e=t(Object.keys,Object);return ax=e,ax}var sx,uL;function oE(){if(uL)return sx;uL=1;var t=Dv(),e=bJ(),r=Object.prototype,n=r.hasOwnProperty;function i(a){if(!t(a))return e(a);var s=[];for(var l in Object(a))n.call(a,l)&&l!="constructor"&&s.push(l);return s}return sx=i,sx}var lx,cL;function ts(){if(cL)return lx;cL=1;var t=Ch(),e=sE();function r(n){return n!=null&&e(n.length)&&!t(n)}return lx=r,lx}var ox,fL;function fl(){if(fL)return ox;fL=1;var t=f8(),e=oE(),r=ts();function n(i){return r(i)?t(i):e(i)}return ox=n,ox}var ux,hL;function xJ(){if(hL)return ux;hL=1;var t=kh(),e=fl();function r(n,i){return n&&t(i,e(i),n)}return ux=r,ux}var cx,dL;function wJ(){if(dL)return cx;dL=1;function t(e){var r=[];if(e!=null)for(var n in Object(e))r.push(n);return r}return cx=t,cx}var fx,pL;function SJ(){if(pL)return fx;pL=1;var t=Mi(),e=Dv(),r=wJ(),n=Object.prototype,i=n.hasOwnProperty;function a(s){if(!t(s))return r(s);var l=e(s),o=[];for(var c in s)c=="constructor"&&(l||!i.call(s,c))||o.push(c);return o}return fx=a,fx}var hx,gL;function fo(){if(gL)return hx;gL=1;var t=f8(),e=SJ(),r=ts();function n(i){return r(i)?t(i,!0):e(i)}return hx=n,hx}var dx,vL;function CJ(){if(vL)return dx;vL=1;var t=kh(),e=fo();function r(n,i){return n&&t(i,e(i),n)}return dx=r,dx}var vf={exports:{}};vf.exports;var mL;function d8(){return mL||(mL=1,(function(t,e){var r=Vi(),n=e&&!e.nodeType&&e,i=n&&!0&&t&&!t.nodeType&&t,a=i&&i.exports===n,s=a?r.Buffer:void 0,l=s?s.allocUnsafe:void 0;function o(c,h){if(h)return c.slice();var d=c.length,g=l?l(d):new c.constructor(d);return c.copy(g),g}t.exports=o})(vf,vf.exports)),vf.exports}var px,yL;function p8(){if(yL)return px;yL=1;function t(e,r){var n=-1,i=e.length;for(r||(r=Array(i));++n<i;)r[n]=e[n];return r}return px=t,px}var gx,bL;function g8(){if(bL)return gx;bL=1;function t(e,r){for(var n=-1,i=e==null?0:e.length,a=0,s=[];++n<i;){var l=e[n];r(l,n,e)&&(s[a++]=l)}return s}return gx=t,gx}var vx,xL;function v8(){if(xL)return vx;xL=1;function t(){return[]}return vx=t,vx}var mx,wL;function uE(){if(wL)return mx;wL=1;var t=g8(),e=v8(),r=Object.prototype,n=r.propertyIsEnumerable,i=Object.getOwnPropertySymbols,a=i?function(s){return s==null?[]:(s=Object(s),t(i(s),function(l){return n.call(s,l)}))}:e;return mx=a,mx}var yx,SL;function kJ(){if(SL)return yx;SL=1;var t=kh(),e=uE();function r(n,i){return t(n,e(n),i)}return yx=r,yx}var bx,CL;function cE(){if(CL)return bx;CL=1;function t(e,r){for(var n=-1,i=r.length,a=e.length;++n<i;)e[a+n]=r[n];return e}return bx=t,bx}var xx,kL;function _v(){if(kL)return xx;kL=1;var t=h8(),e=t(Object.getPrototypeOf,Object);return xx=e,xx}var wx,TL;function m8(){if(TL)return wx;TL=1;var t=cE(),e=_v(),r=uE(),n=v8(),i=Object.getOwnPropertySymbols,a=i?function(s){for(var l=[];s;)t(l,r(s)),s=e(s);return l}:n;return wx=a,wx}var Sx,EL;function TJ(){if(EL)return Sx;EL=1;var t=kh(),e=m8();function r(n,i){return t(n,e(n),i)}return Sx=r,Sx}var Cx,AL;function y8(){if(AL)return Cx;AL=1;var t=cE(),e=_r();function r(n,i,a){var s=i(n);return e(n)?s:t(s,a(n))}return Cx=r,Cx}var kx,OL;function b8(){if(OL)return kx;OL=1;var t=y8(),e=uE(),r=fl();function n(i){return t(i,r,e)}return kx=n,kx}var Tx,ML;function EJ(){if(ML)return Tx;ML=1;var t=y8(),e=m8(),r=fo();function n(i){return t(i,r,e)}return Tx=n,Tx}var Ex,RL;function AJ(){if(RL)return Ex;RL=1;var t=co(),e=Vi(),r=t(e,"DataView");return Ex=r,Ex}var Ax,DL;function OJ(){if(DL)return Ax;DL=1;var t=co(),e=Vi(),r=t(e,"Promise");return Ax=r,Ax}var Ox,_L;function x8(){if(_L)return Ox;_L=1;var t=co(),e=Vi(),r=t(e,"Set");return Ox=r,Ox}var Mx,NL;function MJ(){if(NL)return Mx;NL=1;var t=co(),e=Vi(),r=t(e,"WeakMap");return Mx=r,Mx}var Rx,BL;function ec(){if(BL)return Rx;BL=1;var t=AJ(),e=nE(),r=OJ(),n=x8(),i=MJ(),a=uo(),s=u8(),l="[object Map]",o="[object Object]",c="[object Promise]",h="[object Set]",d="[object WeakMap]",g="[object DataView]",m=s(t),y=s(e),b=s(r),x=s(n),w=s(i),S=a;return(t&&S(new t(new ArrayBuffer(1)))!=g||e&&S(new e)!=l||r&&S(r.resolve())!=c||n&&S(new n)!=h||i&&S(new i)!=d)&&(S=function(k){var E=a(k),M=E==o?k.constructor:void 0,R=M?s(M):"";if(R)switch(R){case m:return g;case y:return l;case b:return c;case x:return h;case w:return d}return E}),Rx=S,Rx}var Dx,LL;function RJ(){if(LL)return Dx;LL=1;var t=Object.prototype,e=t.hasOwnProperty;function r(n){var i=n.length,a=new n.constructor(i);return i&&typeof n[0]=="string"&&e.call(n,"index")&&(a.index=n.index,a.input=n.input),a}return Dx=r,Dx}var _x,PL;function w8(){if(PL)return _x;PL=1;var t=Vi(),e=t.Uint8Array;return _x=e,_x}var Nx,zL;function fE(){if(zL)return Nx;zL=1;var t=w8();function e(r){var n=new r.constructor(r.byteLength);return new t(n).set(new t(r)),n}return Nx=e,Nx}var Bx,IL;function DJ(){if(IL)return Bx;IL=1;var t=fE();function e(r,n){var i=n?t(r.buffer):r.buffer;return new r.constructor(i,r.byteOffset,r.byteLength)}return Bx=e,Bx}var Lx,qL;function _J(){if(qL)return Lx;qL=1;var t=/\w*$/;function e(r){var n=new r.constructor(r.source,t.exec(r));return n.lastIndex=r.lastIndex,n}return Lx=e,Lx}var Px,jL;function NJ(){if(jL)return Px;jL=1;var t=Zu(),e=t?t.prototype:void 0,r=e?e.valueOf:void 0;function n(i){return r?Object(r.call(i)):{}}return Px=n,Px}var zx,FL;function S8(){if(FL)return zx;FL=1;var t=fE();function e(r,n){var i=n?t(r.buffer):r.buffer;return new r.constructor(i,r.byteOffset,r.length)}return zx=e,zx}var Ix,HL;function BJ(){if(HL)return Ix;HL=1;var t=fE(),e=DJ(),r=_J(),n=NJ(),i=S8(),a="[object Boolean]",s="[object Date]",l="[object Map]",o="[object Number]",c="[object RegExp]",h="[object Set]",d="[object String]",g="[object Symbol]",m="[object ArrayBuffer]",y="[object DataView]",b="[object Float32Array]",x="[object Float64Array]",w="[object Int8Array]",S="[object Int16Array]",k="[object Int32Array]",E="[object Uint8Array]",M="[object Uint8ClampedArray]",R="[object Uint16Array]",O="[object Uint32Array]";function N(B,D,_){var P=B.constructor;switch(D){case m:return t(B);case a:case s:return new P(+B);case y:return e(B,_);case b:case x:case w:case S:case k:case E:case M:case R:case O:return i(B,_);case l:return new P;case o:case d:return new P(B);case c:return r(B);case h:return new P;case g:return n(B)}}return Ix=N,Ix}var qx,VL;function C8(){if(VL)return qx;VL=1;var t=Mi(),e=Object.create,r=(function(){function n(){}return function(i){if(!t(i))return{};if(e)return e(i);n.prototype=i;var a=new n;return n.prototype=void 0,a}})();return qx=r,qx}var jx,UL;function k8(){if(UL)return jx;UL=1;var t=C8(),e=_v(),r=Dv();function n(i){return typeof i.constructor=="function"&&!r(i)?t(e(i)):{}}return jx=n,jx}var Fx,$L;function LJ(){if($L)return Fx;$L=1;var t=ec(),e=va(),r="[object Map]";function n(i){return e(i)&&t(i)==r}return Fx=n,Fx}var Hx,GL;function PJ(){if(GL)return Hx;GL=1;var t=LJ(),e=Rv(),r=lE(),n=r&&r.isMap,i=n?e(n):t;return Hx=i,Hx}var Vx,YL;function zJ(){if(YL)return Vx;YL=1;var t=ec(),e=va(),r="[object Set]";function n(i){return e(i)&&t(i)==r}return Vx=n,Vx}var Ux,XL;function IJ(){if(XL)return Ux;XL=1;var t=zJ(),e=Rv(),r=lE(),n=r&&r.isSet,i=n?e(n):t;return Ux=i,Ux}var $x,WL;function T8(){if(WL)return $x;WL=1;var t=Ev(),e=aE(),r=Ov(),n=xJ(),i=CJ(),a=d8(),s=p8(),l=kJ(),o=TJ(),c=b8(),h=EJ(),d=ec(),g=RJ(),m=BJ(),y=k8(),b=_r(),x=Ju(),w=PJ(),S=Mi(),k=IJ(),E=fl(),M=fo(),R=1,O=2,N=4,B="[object Arguments]",D="[object Array]",_="[object Boolean]",P="[object Date]",z="[object Error]",H="[object Function]",$="[object GeneratorFunction]",q="[object Map]",V="[object Number]",X="[object Object]",ee="[object RegExp]",te="[object Set]",I="[object String]",G="[object Symbol]",re="[object WeakMap]",Y="[object ArrayBuffer]",W="[object DataView]",Z="[object Float32Array]",ie="[object Float64Array]",we="[object Int8Array]",de="[object Int16Array]",se="[object Int32Array]",j="[object Uint8Array]",Q="[object Uint8ClampedArray]",K="[object Uint16Array]",ue="[object Uint32Array]",Se={};Se[B]=Se[D]=Se[Y]=Se[W]=Se[_]=Se[P]=Se[Z]=Se[ie]=Se[we]=Se[de]=Se[se]=Se[q]=Se[V]=Se[X]=Se[ee]=Se[te]=Se[I]=Se[G]=Se[j]=Se[Q]=Se[K]=Se[ue]=!0,Se[z]=Se[H]=Se[re]=!1;function at(Me,He,$e,Ne,Ge,Ve){var Qe,je=He&R,dt=He&O,ke=He&N;if($e&&(Qe=Ge?$e(Me,Ne,Ge,Ve):$e(Me)),Qe!==void 0)return Qe;if(!S(Me))return Me;var De=b(Me);if(De){if(Qe=g(Me),!je)return s(Me,Qe)}else{var Be=d(Me),Ke=Be==H||Be==$;if(x(Me))return a(Me,je);if(Be==X||Be==B||Ke&&!Ge){if(Qe=dt||Ke?{}:y(Me),!je)return dt?o(Me,i(Qe,Me)):l(Me,n(Qe,Me))}else{if(!Se[Be])return Ge?Me:{};Qe=m(Me,Be,je)}}Ve||(Ve=new t);var Oe=Ve.get(Me);if(Oe)return Oe;Ve.set(Me,Qe),k(Me)?Me.forEach(function(F){Qe.add(at(F,He,$e,F,Me,Ve))}):w(Me)&&Me.forEach(function(F,J){Qe.set(J,at(F,He,$e,J,Me,Ve))});var Re=ke?dt?h:c:dt?M:E,ce=De?void 0:Re(Me);return e(ce||Me,function(F,J){ce&&(J=F,F=Me[J]),r(Qe,J,at(F,He,$e,J,Me,Ve))}),Qe}return $x=at,$x}var Gx,QL;function qJ(){if(QL)return Gx;QL=1;var t=T8(),e=4;function r(n){return t(n,e)}return Gx=r,Gx}var Yx,KL;function hE(){if(KL)return Yx;KL=1;function t(e){return function(){return e}}return Yx=t,Yx}var Xx,ZL;function jJ(){if(ZL)return Xx;ZL=1;function t(e){return function(r,n,i){for(var a=-1,s=Object(r),l=i(r),o=l.length;o--;){var c=l[e?o:++a];if(n(s[c],c,s)===!1)break}return r}}return Xx=t,Xx}var Wx,JL;function dE(){if(JL)return Wx;JL=1;var t=jJ(),e=t();return Wx=e,Wx}var Qx,e5;function pE(){if(e5)return Qx;e5=1;var t=dE(),e=fl();function r(n,i){return n&&t(n,i,e)}return Qx=r,Qx}var Kx,t5;function FJ(){if(t5)return Kx;t5=1;var t=ts();function e(r,n){return function(i,a){if(i==null)return i;if(!t(i))return r(i,a);for(var s=i.length,l=n?s:-1,o=Object(i);(n?l--:++l<s)&&a(o[l],l,o)!==!1;);return i}}return Kx=e,Kx}var Zx,r5;function Nv(){if(r5)return Zx;r5=1;var t=pE(),e=FJ(),r=e(t);return Zx=r,Zx}var Jx,n5;function ho(){if(n5)return Jx;n5=1;function t(e){return e}return Jx=t,Jx}var ew,i5;function E8(){if(i5)return ew;i5=1;var t=ho();function e(r){return typeof r=="function"?r:t}return ew=e,ew}var tw,a5;function A8(){if(a5)return tw;a5=1;var t=aE(),e=Nv(),r=E8(),n=_r();function i(a,s){var l=n(a)?t:e;return l(a,r(s))}return tw=i,tw}var rw,s5;function O8(){return s5||(s5=1,rw=A8()),rw}var nw,l5;function HJ(){if(l5)return nw;l5=1;var t=Nv();function e(r,n){var i=[];return t(r,function(a,s,l){n(a,s,l)&&i.push(a)}),i}return nw=e,nw}var iw,o5;function VJ(){if(o5)return iw;o5=1;var t="__lodash_hash_undefined__";function e(r){return this.__data__.set(r,t),this}return iw=e,iw}var aw,u5;function UJ(){if(u5)return aw;u5=1;function t(e){return this.__data__.has(e)}return aw=t,aw}var sw,c5;function M8(){if(c5)return sw;c5=1;var t=iE(),e=VJ(),r=UJ();function n(i){var a=-1,s=i==null?0:i.length;for(this.__data__=new t;++a<s;)this.add(i[a])}return n.prototype.add=n.prototype.push=e,n.prototype.has=r,sw=n,sw}var lw,f5;function $J(){if(f5)return lw;f5=1;function t(e,r){for(var n=-1,i=e==null?0:e.length;++n<i;)if(r(e[n],n,e))return!0;return!1}return lw=t,lw}var ow,h5;function R8(){if(h5)return ow;h5=1;function t(e,r){return e.has(r)}return ow=t,ow}var uw,d5;function D8(){if(d5)return uw;d5=1;var t=M8(),e=$J(),r=R8(),n=1,i=2;function a(s,l,o,c,h,d){var g=o&n,m=s.length,y=l.length;if(m!=y&&!(g&&y>m))return!1;var b=d.get(s),x=d.get(l);if(b&&x)return b==l&&x==s;var w=-1,S=!0,k=o&i?new t:void 0;for(d.set(s,l),d.set(l,s);++w<m;){var E=s[w],M=l[w];if(c)var R=g?c(M,E,w,l,s,d):c(E,M,w,s,l,d);if(R!==void 0){if(R)continue;S=!1;break}if(k){if(!e(l,function(O,N){if(!r(k,N)&&(E===O||h(E,O,o,c,d)))return k.push(N)})){S=!1;break}}else if(!(E===M||h(E,M,o,c,d))){S=!1;break}}return d.delete(s),d.delete(l),S}return uw=a,uw}var cw,p5;function GJ(){if(p5)return cw;p5=1;function t(e){var r=-1,n=Array(e.size);return e.forEach(function(i,a){n[++r]=[a,i]}),n}return cw=t,cw}var fw,g5;function gE(){if(g5)return fw;g5=1;function t(e){var r=-1,n=Array(e.size);return e.forEach(function(i){n[++r]=i}),n}return fw=t,fw}var hw,v5;function YJ(){if(v5)return hw;v5=1;var t=Zu(),e=w8(),r=Ku(),n=D8(),i=GJ(),a=gE(),s=1,l=2,o="[object Boolean]",c="[object Date]",h="[object Error]",d="[object Map]",g="[object Number]",m="[object RegExp]",y="[object Set]",b="[object String]",x="[object Symbol]",w="[object ArrayBuffer]",S="[object DataView]",k=t?t.prototype:void 0,E=k?k.valueOf:void 0;function M(R,O,N,B,D,_,P){switch(N){case S:if(R.byteLength!=O.byteLength||R.byteOffset!=O.byteOffset)return!1;R=R.buffer,O=O.buffer;case w:return!(R.byteLength!=O.byteLength||!_(new e(R),new e(O)));case o:case c:case g:return r(+R,+O);case h:return R.name==O.name&&R.message==O.message;case m:case b:return R==O+"";case d:var z=i;case y:var H=B&s;if(z||(z=a),R.size!=O.size&&!H)return!1;var $=P.get(R);if($)return $==O;B|=l,P.set(R,O);var q=n(z(R),z(O),B,D,_,P);return P.delete(R),q;case x:if(E)return E.call(R)==E.call(O)}return!1}return hw=M,hw}var dw,m5;function XJ(){if(m5)return dw;m5=1;var t=b8(),e=1,r=Object.prototype,n=r.hasOwnProperty;function i(a,s,l,o,c,h){var d=l&e,g=t(a),m=g.length,y=t(s),b=y.length;if(m!=b&&!d)return!1;for(var x=m;x--;){var w=g[x];if(!(d?w in s:n.call(s,w)))return!1}var S=h.get(a),k=h.get(s);if(S&&k)return S==s&&k==a;var E=!0;h.set(a,s),h.set(s,a);for(var M=d;++x<m;){w=g[x];var R=a[w],O=s[w];if(o)var N=d?o(O,R,w,s,a,h):o(R,O,w,a,s,h);if(!(N===void 0?R===O||c(R,O,l,o,h):N)){E=!1;break}M||(M=w=="constructor")}if(E&&!M){var B=a.constructor,D=s.constructor;B!=D&&"constructor"in a&&"constructor"in s&&!(typeof B=="function"&&B instanceof B&&typeof D=="function"&&D instanceof D)&&(E=!1)}return h.delete(a),h.delete(s),E}return dw=i,dw}var pw,y5;function WJ(){if(y5)return pw;y5=1;var t=Ev(),e=D8(),r=YJ(),n=XJ(),i=ec(),a=_r(),s=Ju(),l=Eh(),o=1,c="[object Arguments]",h="[object Array]",d="[object Object]",g=Object.prototype,m=g.hasOwnProperty;function y(b,x,w,S,k,E){var M=a(b),R=a(x),O=M?h:i(b),N=R?h:i(x);O=O==c?d:O,N=N==c?d:N;var B=O==d,D=N==d,_=O==N;if(_&&s(b)){if(!s(x))return!1;M=!0,B=!1}if(_&&!B)return E||(E=new t),M||l(b)?e(b,x,w,S,k,E):r(b,x,O,w,S,k,E);if(!(w&o)){var P=B&&m.call(b,"__wrapped__"),z=D&&m.call(x,"__wrapped__");if(P||z){var H=P?b.value():b,$=z?x.value():x;return E||(E=new t),k(H,$,w,S,E)}}return _?(E||(E=new t),n(b,x,w,S,k,E)):!1}return pw=y,pw}var gw,b5;function _8(){if(b5)return gw;b5=1;var t=WJ(),e=va();function r(n,i,a,s,l){return n===i?!0:n==null||i==null||!e(n)&&!e(i)?n!==n&&i!==i:t(n,i,a,s,r,l)}return gw=r,gw}var vw,x5;function QJ(){if(x5)return vw;x5=1;var t=Ev(),e=_8(),r=1,n=2;function i(a,s,l,o){var c=l.length,h=c,d=!o;if(a==null)return!h;for(a=Object(a);c--;){var g=l[c];if(d&&g[2]?g[1]!==a[g[0]]:!(g[0]in a))return!1}for(;++c<h;){g=l[c];var m=g[0],y=a[m],b=g[1];if(d&&g[2]){if(y===void 0&&!(m in a))return!1}else{var x=new t;if(o)var w=o(y,b,m,a,s,x);if(!(w===void 0?e(b,y,r|n,o,x):w))return!1}}return!0}return vw=i,vw}var mw,w5;function N8(){if(w5)return mw;w5=1;var t=Mi();function e(r){return r===r&&!t(r)}return mw=e,mw}var yw,S5;function KJ(){if(S5)return yw;S5=1;var t=N8(),e=fl();function r(n){for(var i=e(n),a=i.length;a--;){var s=i[a],l=n[s];i[a]=[s,l,t(l)]}return i}return yw=r,yw}var bw,C5;function B8(){if(C5)return bw;C5=1;function t(e,r){return function(n){return n==null?!1:n[e]===r&&(r!==void 0||e in Object(n))}}return bw=t,bw}var xw,k5;function ZJ(){if(k5)return xw;k5=1;var t=QJ(),e=KJ(),r=B8();function n(i){var a=e(i);return a.length==1&&a[0][2]?r(a[0][0],a[0][1]):function(s){return s===i||t(s,i,a)}}return xw=n,xw}var ww,T5;function tc(){if(T5)return ww;T5=1;var t=uo(),e=va(),r="[object Symbol]";function n(i){return typeof i=="symbol"||e(i)&&t(i)==r}return ww=n,ww}var Sw,E5;function vE(){if(E5)return Sw;E5=1;var t=_r(),e=tc(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,s){if(t(a))return!1;var l=typeof a;return l=="number"||l=="symbol"||l=="boolean"||a==null||e(a)?!0:n.test(a)||!r.test(a)||s!=null&&a in Object(s)}return Sw=i,Sw}var Cw,A5;function JJ(){if(A5)return Cw;A5=1;var t=iE(),e="Expected a function";function r(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(e);var a=function(){var s=arguments,l=i?i.apply(this,s):s[0],o=a.cache;if(o.has(l))return o.get(l);var c=n.apply(this,s);return a.cache=o.set(l,c)||o,c};return a.cache=new(r.Cache||t),a}return r.Cache=t,Cw=r,Cw}var kw,O5;function eee(){if(O5)return kw;O5=1;var t=JJ(),e=500;function r(n){var i=t(n,function(s){return a.size===e&&a.clear(),s}),a=i.cache;return i}return kw=r,kw}var Tw,M5;function tee(){if(M5)return Tw;M5=1;var t=eee(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=t(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(e,function(s,l,o,c){a.push(o?c.replace(r,"$1"):l||s)}),a});return Tw=n,Tw}var Ew,R5;function Bv(){if(R5)return Ew;R5=1;function t(e,r){for(var n=-1,i=e==null?0:e.length,a=Array(i);++n<i;)a[n]=r(e[n],n,e);return a}return Ew=t,Ew}var Aw,D5;function ree(){if(D5)return Aw;D5=1;var t=Zu(),e=Bv(),r=_r(),n=tc(),i=t?t.prototype:void 0,a=i?i.toString:void 0;function s(l){if(typeof l=="string")return l;if(r(l))return e(l,s)+"";if(n(l))return a?a.call(l):"";var o=l+"";return o=="0"&&1/l==-1/0?"-0":o}return Aw=s,Aw}var Ow,_5;function L8(){if(_5)return Ow;_5=1;var t=ree();function e(r){return r==null?"":t(r)}return Ow=e,Ow}var Mw,N5;function Lv(){if(N5)return Mw;N5=1;var t=_r(),e=vE(),r=tee(),n=L8();function i(a,s){return t(a)?a:e(a,s)?[a]:r(n(a))}return Mw=i,Mw}var Rw,B5;function Ah(){if(B5)return Rw;B5=1;var t=tc();function e(r){if(typeof r=="string"||t(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return Rw=e,Rw}var Dw,L5;function Pv(){if(L5)return Dw;L5=1;var t=Lv(),e=Ah();function r(n,i){i=t(i,n);for(var a=0,s=i.length;n!=null&&a<s;)n=n[e(i[a++])];return a&&a==s?n:void 0}return Dw=r,Dw}var _w,P5;function nee(){if(P5)return _w;P5=1;var t=Pv();function e(r,n,i){var a=r==null?void 0:t(r,n);return a===void 0?i:a}return _w=e,_w}var Nw,z5;function iee(){if(z5)return Nw;z5=1;function t(e,r){return e!=null&&r in Object(e)}return Nw=t,Nw}var Bw,I5;function P8(){if(I5)return Bw;I5=1;var t=Lv(),e=Th(),r=_r(),n=Mv(),i=sE(),a=Ah();function s(l,o,c){o=t(o,l);for(var h=-1,d=o.length,g=!1;++h<d;){var m=a(o[h]);if(!(g=l!=null&&c(l,m)))break;l=l[m]}return g||++h!=d?g:(d=l==null?0:l.length,!!d&&i(d)&&n(m,d)&&(r(l)||e(l)))}return Bw=s,Bw}var Lw,q5;function z8(){if(q5)return Lw;q5=1;var t=iee(),e=P8();function r(n,i){return n!=null&&e(n,i,t)}return Lw=r,Lw}var Pw,j5;function aee(){if(j5)return Pw;j5=1;var t=_8(),e=nee(),r=z8(),n=vE(),i=N8(),a=B8(),s=Ah(),l=1,o=2;function c(h,d){return n(h)&&i(d)?a(s(h),d):function(g){var m=e(g,h);return m===void 0&&m===d?r(g,h):t(d,m,l|o)}}return Pw=c,Pw}var zw,F5;function I8(){if(F5)return zw;F5=1;function t(e){return function(r){return r?.[e]}}return zw=t,zw}var Iw,H5;function see(){if(H5)return Iw;H5=1;var t=Pv();function e(r){return function(n){return t(n,r)}}return Iw=e,Iw}var qw,V5;function lee(){if(V5)return qw;V5=1;var t=I8(),e=see(),r=vE(),n=Ah();function i(a){return r(a)?t(n(a)):e(a)}return qw=i,qw}var jw,U5;function rs(){if(U5)return jw;U5=1;var t=ZJ(),e=aee(),r=ho(),n=_r(),i=lee();function a(s){return typeof s=="function"?s:s==null?r:typeof s=="object"?n(s)?e(s[0],s[1]):t(s):i(s)}return jw=a,jw}var Fw,$5;function q8(){if($5)return Fw;$5=1;var t=g8(),e=HJ(),r=rs(),n=_r();function i(a,s){var l=n(a)?t:e;return l(a,r(s,3))}return Fw=i,Fw}var Hw,G5;function oee(){if(G5)return Hw;G5=1;var t=Object.prototype,e=t.hasOwnProperty;function r(n,i){return n!=null&&e.call(n,i)}return Hw=r,Hw}var Vw,Y5;function j8(){if(Y5)return Vw;Y5=1;var t=oee(),e=P8();function r(n,i){return n!=null&&e(n,i,t)}return Vw=r,Vw}var Uw,X5;function uee(){if(X5)return Uw;X5=1;var t=oE(),e=ec(),r=Th(),n=_r(),i=ts(),a=Ju(),s=Dv(),l=Eh(),o="[object Map]",c="[object Set]",h=Object.prototype,d=h.hasOwnProperty;function g(m){if(m==null)return!0;if(i(m)&&(n(m)||typeof m=="string"||typeof m.splice=="function"||a(m)||l(m)||r(m)))return!m.length;var y=e(m);if(y==o||y==c)return!m.size;if(s(m))return!t(m).length;for(var b in m)if(d.call(m,b))return!1;return!0}return Uw=g,Uw}var $w,W5;function F8(){if(W5)return $w;W5=1;function t(e){return e===void 0}return $w=t,$w}var Gw,Q5;function H8(){if(Q5)return Gw;Q5=1;var t=Nv(),e=ts();function r(n,i){var a=-1,s=e(n)?Array(n.length):[];return t(n,function(l,o,c){s[++a]=i(l,o,c)}),s}return Gw=r,Gw}var Yw,K5;function V8(){if(K5)return Yw;K5=1;var t=Bv(),e=rs(),r=H8(),n=_r();function i(a,s){var l=n(a)?t:r;return l(a,e(s,3))}return Yw=i,Yw}var Xw,Z5;function cee(){if(Z5)return Xw;Z5=1;function t(e,r,n,i){var a=-1,s=e==null?0:e.length;for(i&&s&&(n=e[++a]);++a<s;)n=r(n,e[a],a,e);return n}return Xw=t,Xw}var Ww,J5;function fee(){if(J5)return Ww;J5=1;function t(e,r,n,i,a){return a(e,function(s,l,o){n=i?(i=!1,s):r(n,s,l,o)}),n}return Ww=t,Ww}var Qw,eP;function U8(){if(eP)return Qw;eP=1;var t=cee(),e=Nv(),r=rs(),n=fee(),i=_r();function a(s,l,o){var c=i(s)?t:n,h=arguments.length<3;return c(s,r(l,4),o,h,e)}return Qw=a,Qw}var Kw,tP;function hee(){if(tP)return Kw;tP=1;var t=uo(),e=_r(),r=va(),n="[object String]";function i(a){return typeof a=="string"||!e(a)&&r(a)&&t(a)==n}return Kw=i,Kw}var Zw,rP;function dee(){if(rP)return Zw;rP=1;var t=I8(),e=t("length");return Zw=e,Zw}var Jw,nP;function pee(){if(nP)return Jw;nP=1;var t="\\ud800-\\udfff",e="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=e+r+n,a="\\ufe0e\\ufe0f",s="\\u200d",l=RegExp("["+s+t+i+a+"]");function o(c){return l.test(c)}return Jw=o,Jw}var eS,iP;function gee(){if(iP)return eS;iP=1;var t="\\ud800-\\udfff",e="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=e+r+n,a="\\ufe0e\\ufe0f",s="["+t+"]",l="["+i+"]",o="\\ud83c[\\udffb-\\udfff]",c="(?:"+l+"|"+o+")",h="[^"+t+"]",d="(?:\\ud83c[\\udde6-\\uddff]){2}",g="[\\ud800-\\udbff][\\udc00-\\udfff]",m="\\u200d",y=c+"?",b="["+a+"]?",x="(?:"+m+"(?:"+[h,d,g].join("|")+")"+b+y+")*",w=b+y+x,S="(?:"+[h+l+"?",l,d,g,s].join("|")+")",k=RegExp(o+"(?="+o+")|"+S+w,"g");function E(M){for(var R=k.lastIndex=0;k.test(M);)++R;return R}return eS=E,eS}var tS,aP;function vee(){if(aP)return tS;aP=1;var t=dee(),e=pee(),r=gee();function n(i){return e(i)?r(i):t(i)}return tS=n,tS}var rS,sP;function mee(){if(sP)return rS;sP=1;var t=oE(),e=ec(),r=ts(),n=hee(),i=vee(),a="[object Map]",s="[object Set]";function l(o){if(o==null)return 0;if(r(o))return n(o)?i(o):o.length;var c=e(o);return c==a||c==s?o.size:t(o).length}return rS=l,rS}var nS,lP;function yee(){if(lP)return nS;lP=1;var t=aE(),e=C8(),r=pE(),n=rs(),i=_v(),a=_r(),s=Ju(),l=Ch(),o=Mi(),c=Eh();function h(d,g,m){var y=a(d),b=y||s(d)||c(d);if(g=n(g,4),m==null){var x=d&&d.constructor;b?m=y?new x:[]:o(d)?m=l(x)?e(i(d)):{}:m={}}return(b?t:r)(d,function(w,S,k){return g(m,w,S,k)}),m}return nS=h,nS}var iS,oP;function bee(){if(oP)return iS;oP=1;var t=Zu(),e=Th(),r=_r(),n=t?t.isConcatSpreadable:void 0;function i(a){return r(a)||e(a)||!!(n&&a&&a[n])}return iS=i,iS}var aS,uP;function mE(){if(uP)return aS;uP=1;var t=cE(),e=bee();function r(n,i,a,s,l){var o=-1,c=n.length;for(a||(a=e),l||(l=[]);++o<c;){var h=n[o];i>0&&a(h)?i>1?r(h,i-1,a,s,l):t(l,h):s||(l[l.length]=h)}return l}return aS=r,aS}var sS,cP;function xee(){if(cP)return sS;cP=1;function t(e,r,n){switch(n.length){case 0:return e.call(r);case 1:return e.call(r,n[0]);case 2:return e.call(r,n[0],n[1]);case 3:return e.call(r,n[0],n[1],n[2])}return e.apply(r,n)}return sS=t,sS}var lS,fP;function $8(){if(fP)return lS;fP=1;var t=xee(),e=Math.max;function r(n,i,a){return i=e(i===void 0?n.length-1:i,0),function(){for(var s=arguments,l=-1,o=e(s.length-i,0),c=Array(o);++l<o;)c[l]=s[i+l];l=-1;for(var h=Array(i+1);++l<i;)h[l]=s[l];return h[i]=a(c),t(n,this,h)}}return lS=r,lS}var oS,hP;function wee(){if(hP)return oS;hP=1;var t=hE(),e=c8(),r=ho(),n=e?function(i,a){return e(i,"toString",{configurable:!0,enumerable:!1,value:t(a),writable:!0})}:r;return oS=n,oS}var uS,dP;function See(){if(dP)return uS;dP=1;var t=800,e=16,r=Date.now;function n(i){var a=0,s=0;return function(){var l=r(),o=e-(l-s);if(s=l,o>0){if(++a>=t)return arguments[0]}else a=0;return i.apply(void 0,arguments)}}return uS=n,uS}var cS,pP;function G8(){if(pP)return cS;pP=1;var t=wee(),e=See(),r=e(t);return cS=r,cS}var fS,gP;function zv(){if(gP)return fS;gP=1;var t=ho(),e=$8(),r=G8();function n(i,a){return r(e(i,a,t),i+"")}return fS=n,fS}var hS,vP;function Y8(){if(vP)return hS;vP=1;function t(e,r,n,i){for(var a=e.length,s=n+(i?1:-1);i?s--:++s<a;)if(r(e[s],s,e))return s;return-1}return hS=t,hS}var dS,mP;function Cee(){if(mP)return dS;mP=1;function t(e){return e!==e}return dS=t,dS}var pS,yP;function kee(){if(yP)return pS;yP=1;function t(e,r,n){for(var i=n-1,a=e.length;++i<a;)if(e[i]===r)return i;return-1}return pS=t,pS}var gS,bP;function Tee(){if(bP)return gS;bP=1;var t=Y8(),e=Cee(),r=kee();function n(i,a,s){return a===a?r(i,a,s):t(i,e,s)}return gS=n,gS}var vS,xP;function Eee(){if(xP)return vS;xP=1;var t=Tee();function e(r,n){var i=r==null?0:r.length;return!!i&&t(r,n,0)>-1}return vS=e,vS}var mS,wP;function Aee(){if(wP)return mS;wP=1;function t(e,r,n){for(var i=-1,a=e==null?0:e.length;++i<a;)if(n(r,e[i]))return!0;return!1}return mS=t,mS}var yS,SP;function Oee(){if(SP)return yS;SP=1;function t(){}return yS=t,yS}var bS,CP;function Mee(){if(CP)return bS;CP=1;var t=x8(),e=Oee(),r=gE(),n=1/0,i=t&&1/r(new t([,-0]))[1]==n?function(a){return new t(a)}:e;return bS=i,bS}var xS,kP;function Ree(){if(kP)return xS;kP=1;var t=M8(),e=Eee(),r=Aee(),n=R8(),i=Mee(),a=gE(),s=200;function l(o,c,h){var d=-1,g=e,m=o.length,y=!0,b=[],x=b;if(h)y=!1,g=r;else if(m>=s){var w=c?null:i(o);if(w)return a(w);y=!1,g=n,x=new t}else x=c?[]:b;e:for(;++d<m;){var S=o[d],k=c?c(S):S;if(S=h||S!==0?S:0,y&&k===k){for(var E=x.length;E--;)if(x[E]===k)continue e;c&&x.push(k),b.push(S)}else g(x,k,h)||(x!==b&&x.push(k),b.push(S))}return b}return xS=l,xS}var wS,TP;function X8(){if(TP)return wS;TP=1;var t=ts(),e=va();function r(n){return e(n)&&t(n)}return wS=r,wS}var SS,EP;function Dee(){if(EP)return SS;EP=1;var t=mE(),e=zv(),r=Ree(),n=X8(),i=e(function(a){return r(t(a,1,n,!0))});return SS=i,SS}var CS,AP;function _ee(){if(AP)return CS;AP=1;var t=Bv();function e(r,n){return t(n,function(i){return r[i]})}return CS=e,CS}var kS,OP;function W8(){if(OP)return kS;OP=1;var t=_ee(),e=fl();function r(n){return n==null?[]:t(n,e(n))}return kS=r,kS}var TS,MP;function Ri(){if(MP)return TS;MP=1;var t;if(typeof rE=="function")try{t={clone:qJ(),constant:hE(),each:O8(),filter:q8(),has:j8(),isArray:_r(),isEmpty:uee(),isFunction:Ch(),isUndefined:F8(),keys:fl(),map:V8(),reduce:U8(),size:mee(),transform:yee(),union:Dee(),values:W8()}}catch{}return t||(t=window._),TS=t,TS}var ES,RP;function yE(){if(RP)return ES;RP=1;var t=Ri();ES=i;var e="\0",r="\0",n="";function i(h){this._isDirected=t.has(h,"directed")?h.directed:!0,this._isMultigraph=t.has(h,"multigraph")?h.multigraph:!1,this._isCompound=t.has(h,"compound")?h.compound:!1,this._label=void 0,this._defaultNodeLabelFn=t.constant(void 0),this._defaultEdgeLabelFn=t.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[r]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(h){return this._label=h,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(h){return t.isFunction(h)||(h=t.constant(h)),this._defaultNodeLabelFn=h,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return t.keys(this._nodes)},i.prototype.sources=function(){var h=this;return t.filter(this.nodes(),function(d){return t.isEmpty(h._in[d])})},i.prototype.sinks=function(){var h=this;return t.filter(this.nodes(),function(d){return t.isEmpty(h._out[d])})},i.prototype.setNodes=function(h,d){var g=arguments,m=this;return t.each(h,function(y){g.length>1?m.setNode(y,d):m.setNode(y)}),this},i.prototype.setNode=function(h,d){return t.has(this._nodes,h)?(arguments.length>1&&(this._nodes[h]=d),this):(this._nodes[h]=arguments.length>1?d:this._defaultNodeLabelFn(h),this._isCompound&&(this._parent[h]=r,this._children[h]={},this._children[r][h]=!0),this._in[h]={},this._preds[h]={},this._out[h]={},this._sucs[h]={},++this._nodeCount,this)},i.prototype.node=function(h){return this._nodes[h]},i.prototype.hasNode=function(h){return t.has(this._nodes,h)},i.prototype.removeNode=function(h){var d=this;if(t.has(this._nodes,h)){var g=function(m){d.removeEdge(d._edgeObjs[m])};delete this._nodes[h],this._isCompound&&(this._removeFromParentsChildList(h),delete this._parent[h],t.each(this.children(h),function(m){d.setParent(m)}),delete this._children[h]),t.each(t.keys(this._in[h]),g),delete this._in[h],delete this._preds[h],t.each(t.keys(this._out[h]),g),delete this._out[h],delete this._sucs[h],--this._nodeCount}return this},i.prototype.setParent=function(h,d){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(t.isUndefined(d))d=r;else{d+="";for(var g=d;!t.isUndefined(g);g=this.parent(g))if(g===h)throw new Error("Setting "+d+" as parent of "+h+" would create a cycle");this.setNode(d)}return this.setNode(h),this._removeFromParentsChildList(h),this._parent[h]=d,this._children[d][h]=!0,this},i.prototype._removeFromParentsChildList=function(h){delete this._children[this._parent[h]][h]},i.prototype.parent=function(h){if(this._isCompound){var d=this._parent[h];if(d!==r)return d}},i.prototype.children=function(h){if(t.isUndefined(h)&&(h=r),this._isCompound){var d=this._children[h];if(d)return t.keys(d)}else{if(h===r)return this.nodes();if(this.hasNode(h))return[]}},i.prototype.predecessors=function(h){var d=this._preds[h];if(d)return t.keys(d)},i.prototype.successors=function(h){var d=this._sucs[h];if(d)return t.keys(d)},i.prototype.neighbors=function(h){var d=this.predecessors(h);if(d)return t.union(d,this.successors(h))},i.prototype.isLeaf=function(h){var d;return this.isDirected()?d=this.successors(h):d=this.neighbors(h),d.length===0},i.prototype.filterNodes=function(h){var d=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});d.setGraph(this.graph());var g=this;t.each(this._nodes,function(b,x){h(x)&&d.setNode(x,b)}),t.each(this._edgeObjs,function(b){d.hasNode(b.v)&&d.hasNode(b.w)&&d.setEdge(b,g.edge(b))});var m={};function y(b){var x=g.parent(b);return x===void 0||d.hasNode(x)?(m[b]=x,x):x in m?m[x]:y(x)}return this._isCompound&&t.each(d.nodes(),function(b){d.setParent(b,y(b))}),d},i.prototype.setDefaultEdgeLabel=function(h){return t.isFunction(h)||(h=t.constant(h)),this._defaultEdgeLabelFn=h,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return t.values(this._edgeObjs)},i.prototype.setPath=function(h,d){var g=this,m=arguments;return t.reduce(h,function(y,b){return m.length>1?g.setEdge(y,b,d):g.setEdge(y,b),b}),this},i.prototype.setEdge=function(){var h,d,g,m,y=!1,b=arguments[0];typeof b=="object"&&b!==null&&"v"in b?(h=b.v,d=b.w,g=b.name,arguments.length===2&&(m=arguments[1],y=!0)):(h=b,d=arguments[1],g=arguments[3],arguments.length>2&&(m=arguments[2],y=!0)),h=""+h,d=""+d,t.isUndefined(g)||(g=""+g);var x=l(this._isDirected,h,d,g);if(t.has(this._edgeLabels,x))return y&&(this._edgeLabels[x]=m),this;if(!t.isUndefined(g)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(h),this.setNode(d),this._edgeLabels[x]=y?m:this._defaultEdgeLabelFn(h,d,g);var w=o(this._isDirected,h,d,g);return h=w.v,d=w.w,Object.freeze(w),this._edgeObjs[x]=w,a(this._preds[d],h),a(this._sucs[h],d),this._in[d][x]=w,this._out[h][x]=w,this._edgeCount++,this},i.prototype.edge=function(h,d,g){var m=arguments.length===1?c(this._isDirected,arguments[0]):l(this._isDirected,h,d,g);return this._edgeLabels[m]},i.prototype.hasEdge=function(h,d,g){var m=arguments.length===1?c(this._isDirected,arguments[0]):l(this._isDirected,h,d,g);return t.has(this._edgeLabels,m)},i.prototype.removeEdge=function(h,d,g){var m=arguments.length===1?c(this._isDirected,arguments[0]):l(this._isDirected,h,d,g),y=this._edgeObjs[m];return y&&(h=y.v,d=y.w,delete this._edgeLabels[m],delete this._edgeObjs[m],s(this._preds[d],h),s(this._sucs[h],d),delete this._in[d][m],delete this._out[h][m],this._edgeCount--),this},i.prototype.inEdges=function(h,d){var g=this._in[h];if(g){var m=t.values(g);return d?t.filter(m,function(y){return y.v===d}):m}},i.prototype.outEdges=function(h,d){var g=this._out[h];if(g){var m=t.values(g);return d?t.filter(m,function(y){return y.w===d}):m}},i.prototype.nodeEdges=function(h,d){var g=this.inEdges(h,d);if(g)return g.concat(this.outEdges(h,d))};function a(h,d){h[d]?h[d]++:h[d]=1}function s(h,d){--h[d]||delete h[d]}function l(h,d,g,m){var y=""+d,b=""+g;if(!h&&y>b){var x=y;y=b,b=x}return y+n+b+n+(t.isUndefined(m)?e:m)}function o(h,d,g,m){var y=""+d,b=""+g;if(!h&&y>b){var x=y;y=b,b=x}var w={v:y,w:b};return m&&(w.name=m),w}function c(h,d){return l(h,d.v,d.w,d.name)}return ES}var AS,DP;function Nee(){return DP||(DP=1,AS="2.1.8"),AS}var OS,_P;function Bee(){return _P||(_P=1,OS={Graph:yE(),version:Nee()}),OS}var MS,NP;function Lee(){if(NP)return MS;NP=1;var t=Ri(),e=yE();MS={write:r,read:a};function r(s){var l={options:{directed:s.isDirected(),multigraph:s.isMultigraph(),compound:s.isCompound()},nodes:n(s),edges:i(s)};return t.isUndefined(s.graph())||(l.value=t.clone(s.graph())),l}function n(s){return t.map(s.nodes(),function(l){var o=s.node(l),c=s.parent(l),h={v:l};return t.isUndefined(o)||(h.value=o),t.isUndefined(c)||(h.parent=c),h})}function i(s){return t.map(s.edges(),function(l){var o=s.edge(l),c={v:l.v,w:l.w};return t.isUndefined(l.name)||(c.name=l.name),t.isUndefined(o)||(c.value=o),c})}function a(s){var l=new e(s.options).setGraph(s.value);return t.each(s.nodes,function(o){l.setNode(o.v,o.value),o.parent&&l.setParent(o.v,o.parent)}),t.each(s.edges,function(o){l.setEdge({v:o.v,w:o.w,name:o.name},o.value)}),l}return MS}var RS,BP;function Pee(){if(BP)return RS;BP=1;var t=Ri();RS=e;function e(r){var n={},i=[],a;function s(l){t.has(n,l)||(n[l]=!0,a.push(l),t.each(r.successors(l),s),t.each(r.predecessors(l),s))}return t.each(r.nodes(),function(l){a=[],s(l),a.length&&i.push(a)}),i}return RS}var DS,LP;function Q8(){if(LP)return DS;LP=1;var t=Ri();DS=e;function e(){this._arr=[],this._keyIndices={}}return e.prototype.size=function(){return this._arr.length},e.prototype.keys=function(){return this._arr.map(function(r){return r.key})},e.prototype.has=function(r){return t.has(this._keyIndices,r)},e.prototype.priority=function(r){var n=this._keyIndices[r];if(n!==void 0)return this._arr[n].priority},e.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},e.prototype.add=function(r,n){var i=this._keyIndices;if(r=String(r),!t.has(i,r)){var a=this._arr,s=a.length;return i[r]=s,a.push({key:r,priority:n}),this._decrease(s),!0}return!1},e.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var r=this._arr.pop();return delete this._keyIndices[r.key],this._heapify(0),r.key},e.prototype.decrease=function(r,n){var i=this._keyIndices[r];if(n>this._arr[i].priority)throw new Error("New priority is greater than current priority. Key: "+r+" Old: "+this._arr[i].priority+" New: "+n);this._arr[i].priority=n,this._decrease(i)},e.prototype._heapify=function(r){var n=this._arr,i=2*r,a=i+1,s=r;i<n.length&&(s=n[i].priority<n[s].priority?i:s,a<n.length&&(s=n[a].priority<n[s].priority?a:s),s!==r&&(this._swap(r,s),this._heapify(s)))},e.prototype._decrease=function(r){for(var n=this._arr,i=n[r].priority,a;r!==0&&(a=r>>1,!(n[a].priority<i));)this._swap(r,a),r=a},e.prototype._swap=function(r,n){var i=this._arr,a=this._keyIndices,s=i[r],l=i[n];i[r]=l,i[n]=s,a[l.key]=r,a[s.key]=n},DS}var _S,PP;function K8(){if(PP)return _S;PP=1;var t=Ri(),e=Q8();_S=n;var r=t.constant(1);function n(a,s,l,o){return i(a,String(s),l||r,o||function(c){return a.outEdges(c)})}function i(a,s,l,o){var c={},h=new e,d,g,m=function(y){var b=y.v!==d?y.v:y.w,x=c[b],w=l(y),S=g.distance+w;if(w<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+y+" Weight: "+w);S<x.distance&&(x.distance=S,x.predecessor=d,h.decrease(b,S))};for(a.nodes().forEach(function(y){var b=y===s?0:Number.POSITIVE_INFINITY;c[y]={distance:b},h.add(y,b)});h.size()>0&&(d=h.removeMin(),g=c[d],g.distance!==Number.POSITIVE_INFINITY);)o(d).forEach(m);return c}return _S}var NS,zP;function zee(){if(zP)return NS;zP=1;var t=K8(),e=Ri();NS=r;function r(n,i,a){return e.transform(n.nodes(),function(s,l){s[l]=t(n,l,i,a)},{})}return NS}var BS,IP;function Z8(){if(IP)return BS;IP=1;var t=Ri();BS=e;function e(r){var n=0,i=[],a={},s=[];function l(o){var c=a[o]={onStack:!0,lowlink:n,index:n++};if(i.push(o),r.successors(o).forEach(function(g){t.has(a,g)?a[g].onStack&&(c.lowlink=Math.min(c.lowlink,a[g].index)):(l(g),c.lowlink=Math.min(c.lowlink,a[g].lowlink))}),c.lowlink===c.index){var h=[],d;do d=i.pop(),a[d].onStack=!1,h.push(d);while(o!==d);s.push(h)}}return r.nodes().forEach(function(o){t.has(a,o)||l(o)}),s}return BS}var LS,qP;function Iee(){if(qP)return LS;qP=1;var t=Ri(),e=Z8();LS=r;function r(n){return t.filter(e(n),function(i){return i.length>1||i.length===1&&n.hasEdge(i[0],i[0])})}return LS}var PS,jP;function qee(){if(jP)return PS;jP=1;var t=Ri();PS=r;var e=t.constant(1);function r(i,a,s){return n(i,a||e,s||function(l){return i.outEdges(l)})}function n(i,a,s){var l={},o=i.nodes();return o.forEach(function(c){l[c]={},l[c][c]={distance:0},o.forEach(function(h){c!==h&&(l[c][h]={distance:Number.POSITIVE_INFINITY})}),s(c).forEach(function(h){var d=h.v===c?h.w:h.v,g=a(h);l[c][d]={distance:g,predecessor:c}})}),o.forEach(function(c){var h=l[c];o.forEach(function(d){var g=l[d];o.forEach(function(m){var y=g[c],b=h[m],x=g[m],w=y.distance+b.distance;w<x.distance&&(x.distance=w,x.predecessor=b.predecessor)})})}),l}return PS}var zS,FP;function J8(){if(FP)return zS;FP=1;var t=Ri();zS=e,e.CycleException=r;function e(n){var i={},a={},s=[];function l(o){if(t.has(a,o))throw new r;t.has(i,o)||(a[o]=!0,i[o]=!0,t.each(n.predecessors(o),l),delete a[o],s.push(o))}if(t.each(n.sinks(),l),t.size(i)!==n.nodeCount())throw new r;return s}function r(){}return r.prototype=new Error,zS}var IS,HP;function jee(){if(HP)return IS;HP=1;var t=J8();IS=e;function e(r){try{t(r)}catch(n){if(n instanceof t.CycleException)return!1;throw n}return!0}return IS}var qS,VP;function e6(){if(VP)return qS;VP=1;var t=Ri();qS=e;function e(n,i,a){t.isArray(i)||(i=[i]);var s=(n.isDirected()?n.successors:n.neighbors).bind(n),l=[],o={};return t.each(i,function(c){if(!n.hasNode(c))throw new Error("Graph does not have node: "+c);r(n,c,a==="post",o,s,l)}),l}function r(n,i,a,s,l,o){t.has(s,i)||(s[i]=!0,a||o.push(i),t.each(l(i),function(c){r(n,c,a,s,l,o)}),a&&o.push(i))}return qS}var jS,UP;function Fee(){if(UP)return jS;UP=1;var t=e6();jS=e;function e(r,n){return t(r,n,"post")}return jS}var FS,$P;function Hee(){if($P)return FS;$P=1;var t=e6();FS=e;function e(r,n){return t(r,n,"pre")}return FS}var HS,GP;function Vee(){if(GP)return HS;GP=1;var t=Ri(),e=yE(),r=Q8();HS=n;function n(i,a){var s=new e,l={},o=new r,c;function h(g){var m=g.v===c?g.w:g.v,y=o.priority(m);if(y!==void 0){var b=a(g);b<y&&(l[m]=c,o.decrease(m,b))}}if(i.nodeCount()===0)return s;t.each(i.nodes(),function(g){o.add(g,Number.POSITIVE_INFINITY),s.setNode(g)}),o.decrease(i.nodes()[0],0);for(var d=!1;o.size()>0;){if(c=o.removeMin(),t.has(l,c))s.setEdge(c,l[c]);else{if(d)throw new Error("Input graph is not connected: "+i);d=!0}i.nodeEdges(c).forEach(h)}return s}return HS}var VS,YP;function Uee(){return YP||(YP=1,VS={components:Pee(),dijkstra:K8(),dijkstraAll:zee(),findCycles:Iee(),floydWarshall:qee(),isAcyclic:jee(),postorder:Fee(),preorder:Hee(),prim:Vee(),tarjan:Z8(),topsort:J8()}),VS}var US,XP;function $ee(){if(XP)return US;XP=1;var t=Bee();return US={Graph:t.Graph,json:Lee(),alg:Uee(),version:t.version},US}var $S,WP;function Fi(){if(WP)return $S;WP=1;var t;if(typeof rE=="function")try{t=$ee()}catch{}return t||(t=window.graphlib),$S=t,$S}var GS,QP;function Gee(){if(QP)return GS;QP=1;var t=T8(),e=1,r=4;function n(i){return t(i,e|r)}return GS=n,GS}var YS,KP;function Iv(){if(KP)return YS;KP=1;var t=Ku(),e=ts(),r=Mv(),n=Mi();function i(a,s,l){if(!n(l))return!1;var o=typeof s;return(o=="number"?e(l)&&r(s,l.length):o=="string"&&s in l)?t(l[s],a):!1}return YS=i,YS}var XS,ZP;function Yee(){if(ZP)return XS;ZP=1;var t=zv(),e=Ku(),r=Iv(),n=fo(),i=Object.prototype,a=i.hasOwnProperty,s=t(function(l,o){l=Object(l);var c=-1,h=o.length,d=h>2?o[2]:void 0;for(d&&r(o[0],o[1],d)&&(h=1);++c<h;)for(var g=o[c],m=n(g),y=-1,b=m.length;++y<b;){var x=m[y],w=l[x];(w===void 0||e(w,i[x])&&!a.call(l,x))&&(l[x]=g[x])}return l});return XS=s,XS}var WS,JP;function Xee(){if(JP)return WS;JP=1;var t=rs(),e=ts(),r=fl();function n(i){return function(a,s,l){var o=Object(a);if(!e(a)){var c=t(s,3);a=r(a),s=function(d){return c(o[d],d,o)}}var h=i(a,s,l);return h>-1?o[c?a[h]:h]:void 0}}return WS=n,WS}var QS,e3;function Wee(){if(e3)return QS;e3=1;var t=/\s/;function e(r){for(var n=r.length;n--&&t.test(r.charAt(n)););return n}return QS=e,QS}var KS,t3;function Qee(){if(t3)return KS;t3=1;var t=Wee(),e=/^\s+/;function r(n){return n&&n.slice(0,t(n)+1).replace(e,"")}return KS=r,KS}var ZS,r3;function Kee(){if(r3)return ZS;r3=1;var t=Qee(),e=Mi(),r=tc(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,s=/^0o[0-7]+$/i,l=parseInt;function o(c){if(typeof c=="number")return c;if(r(c))return n;if(e(c)){var h=typeof c.valueOf=="function"?c.valueOf():c;c=e(h)?h+"":h}if(typeof c!="string")return c===0?c:+c;c=t(c);var d=a.test(c);return d||s.test(c)?l(c.slice(2),d?2:8):i.test(c)?n:+c}return ZS=o,ZS}var JS,n3;function t6(){if(n3)return JS;n3=1;var t=Kee(),e=1/0,r=17976931348623157e292;function n(i){if(!i)return i===0?i:0;if(i=t(i),i===e||i===-e){var a=i<0?-1:1;return a*r}return i===i?i:0}return JS=n,JS}var e2,i3;function Zee(){if(i3)return e2;i3=1;var t=t6();function e(r){var n=t(r),i=n%1;return n===n?i?n-i:n:0}return e2=e,e2}var t2,a3;function Jee(){if(a3)return t2;a3=1;var t=Y8(),e=rs(),r=Zee(),n=Math.max;function i(a,s,l){var o=a==null?0:a.length;if(!o)return-1;var c=l==null?0:r(l);return c<0&&(c=n(o+c,0)),t(a,e(s,3),c)}return t2=i,t2}var r2,s3;function ete(){if(s3)return r2;s3=1;var t=Xee(),e=Jee(),r=t(e);return r2=r,r2}var n2,l3;function r6(){if(l3)return n2;l3=1;var t=mE();function e(r){var n=r==null?0:r.length;return n?t(r,1):[]}return n2=e,n2}var i2,o3;function tte(){if(o3)return i2;o3=1;var t=dE(),e=E8(),r=fo();function n(i,a){return i==null?i:t(i,e(a),r)}return i2=n,i2}var a2,u3;function rte(){if(u3)return a2;u3=1;function t(e){var r=e==null?0:e.length;return r?e[r-1]:void 0}return a2=t,a2}var s2,c3;function nte(){if(c3)return s2;c3=1;var t=Av(),e=pE(),r=rs();function n(i,a){var s={};return a=r(a,3),e(i,function(l,o,c){t(s,o,a(l,o,c))}),s}return s2=n,s2}var l2,f3;function bE(){if(f3)return l2;f3=1;var t=tc();function e(r,n,i){for(var a=-1,s=r.length;++a<s;){var l=r[a],o=n(l);if(o!=null&&(c===void 0?o===o&&!t(o):i(o,c)))var c=o,h=l}return h}return l2=e,l2}var o2,h3;function ite(){if(h3)return o2;h3=1;function t(e,r){return e>r}return o2=t,o2}var u2,d3;function ate(){if(d3)return u2;d3=1;var t=bE(),e=ite(),r=ho();function n(i){return i&&i.length?t(i,r,e):void 0}return u2=n,u2}var c2,p3;function n6(){if(p3)return c2;p3=1;var t=Av(),e=Ku();function r(n,i,a){(a!==void 0&&!e(n[i],a)||a===void 0&&!(i in n))&&t(n,i,a)}return c2=r,c2}var f2,g3;function ste(){if(g3)return f2;g3=1;var t=uo(),e=_v(),r=va(),n="[object Object]",i=Function.prototype,a=Object.prototype,s=i.toString,l=a.hasOwnProperty,o=s.call(Object);function c(h){if(!r(h)||t(h)!=n)return!1;var d=e(h);if(d===null)return!0;var g=l.call(d,"constructor")&&d.constructor;return typeof g=="function"&&g instanceof g&&s.call(g)==o}return f2=c,f2}var h2,v3;function i6(){if(v3)return h2;v3=1;function t(e,r){if(!(r==="constructor"&&typeof e[r]=="function")&&r!="__proto__")return e[r]}return h2=t,h2}var d2,m3;function lte(){if(m3)return d2;m3=1;var t=kh(),e=fo();function r(n){return t(n,e(n))}return d2=r,d2}var p2,y3;function ote(){if(y3)return p2;y3=1;var t=n6(),e=d8(),r=S8(),n=p8(),i=k8(),a=Th(),s=_r(),l=X8(),o=Ju(),c=Ch(),h=Mi(),d=ste(),g=Eh(),m=i6(),y=lte();function b(x,w,S,k,E,M,R){var O=m(x,S),N=m(w,S),B=R.get(N);if(B){t(x,S,B);return}var D=M?M(O,N,S+"",x,w,R):void 0,_=D===void 0;if(_){var P=s(N),z=!P&&o(N),H=!P&&!z&&g(N);D=N,P||z||H?s(O)?D=O:l(O)?D=n(O):z?(_=!1,D=e(N,!0)):H?(_=!1,D=r(N,!0)):D=[]:d(N)||a(N)?(D=O,a(O)?D=y(O):(!h(O)||c(O))&&(D=i(N))):_=!1}_&&(R.set(N,D),E(D,N,k,M,R),R.delete(N)),t(x,S,D)}return p2=b,p2}var g2,b3;function ute(){if(b3)return g2;b3=1;var t=Ev(),e=n6(),r=dE(),n=ote(),i=Mi(),a=fo(),s=i6();function l(o,c,h,d,g){o!==c&&r(c,function(m,y){if(g||(g=new t),i(m))n(o,c,y,h,l,d,g);else{var b=d?d(s(o,y),m,y+"",o,c,g):void 0;b===void 0&&(b=m),e(o,y,b)}},a)}return g2=l,g2}var v2,x3;function cte(){if(x3)return v2;x3=1;var t=zv(),e=Iv();function r(n){return t(function(i,a){var s=-1,l=a.length,o=l>1?a[l-1]:void 0,c=l>2?a[2]:void 0;for(o=n.length>3&&typeof o=="function"?(l--,o):void 0,c&&e(a[0],a[1],c)&&(o=l<3?void 0:o,l=1),i=Object(i);++s<l;){var h=a[s];h&&n(i,h,s,o)}return i})}return v2=r,v2}var m2,w3;function fte(){if(w3)return m2;w3=1;var t=ute(),e=cte(),r=e(function(n,i,a){t(n,i,a)});return m2=r,m2}var y2,S3;function a6(){if(S3)return y2;S3=1;function t(e,r){return e<r}return y2=t,y2}var b2,C3;function hte(){if(C3)return b2;C3=1;var t=bE(),e=a6(),r=ho();function n(i){return i&&i.length?t(i,r,e):void 0}return b2=n,b2}var x2,k3;function dte(){if(k3)return x2;k3=1;var t=bE(),e=rs(),r=a6();function n(i,a){return i&&i.length?t(i,e(a,2),r):void 0}return x2=n,x2}var w2,T3;function pte(){if(T3)return w2;T3=1;var t=Vi(),e=function(){return t.Date.now()};return w2=e,w2}var S2,E3;function gte(){if(E3)return S2;E3=1;var t=Ov(),e=Lv(),r=Mv(),n=Mi(),i=Ah();function a(s,l,o,c){if(!n(s))return s;l=e(l,s);for(var h=-1,d=l.length,g=d-1,m=s;m!=null&&++h<d;){var y=i(l[h]),b=o;if(y==="__proto__"||y==="constructor"||y==="prototype")return s;if(h!=g){var x=m[y];b=c?c(x,y,m):void 0,b===void 0&&(b=n(x)?x:r(l[h+1])?[]:{})}t(m,y,b),m=m[y]}return s}return S2=a,S2}var C2,A3;function vte(){if(A3)return C2;A3=1;var t=Pv(),e=gte(),r=Lv();function n(i,a,s){for(var l=-1,o=a.length,c={};++l<o;){var h=a[l],d=t(i,h);s(d,h)&&e(c,r(h,i),d)}return c}return C2=n,C2}var k2,O3;function mte(){if(O3)return k2;O3=1;var t=vte(),e=z8();function r(n,i){return t(n,i,function(a,s){return e(n,s)})}return k2=r,k2}var T2,M3;function yte(){if(M3)return T2;M3=1;var t=r6(),e=$8(),r=G8();function n(i){return r(e(i,void 0,t),i+"")}return T2=n,T2}var E2,R3;function bte(){if(R3)return E2;R3=1;var t=mte(),e=yte(),r=e(function(n,i){return n==null?{}:t(n,i)});return E2=r,E2}var A2,D3;function xte(){if(D3)return A2;D3=1;var t=Math.ceil,e=Math.max;function r(n,i,a,s){for(var l=-1,o=e(t((i-n)/(a||1)),0),c=Array(o);o--;)c[s?o:++l]=n,n+=a;return c}return A2=r,A2}var O2,_3;function wte(){if(_3)return O2;_3=1;var t=xte(),e=Iv(),r=t6();function n(i){return function(a,s,l){return l&&typeof l!="number"&&e(a,s,l)&&(s=l=void 0),a=r(a),s===void 0?(s=a,a=0):s=r(s),l=l===void 0?a<s?1:-1:r(l),t(a,s,l,i)}}return O2=n,O2}var M2,N3;function Ste(){if(N3)return M2;N3=1;var t=wte(),e=t();return M2=e,M2}var R2,B3;function Cte(){if(B3)return R2;B3=1;function t(e,r){var n=e.length;for(e.sort(r);n--;)e[n]=e[n].value;return e}return R2=t,R2}var D2,L3;function kte(){if(L3)return D2;L3=1;var t=tc();function e(r,n){if(r!==n){var i=r!==void 0,a=r===null,s=r===r,l=t(r),o=n!==void 0,c=n===null,h=n===n,d=t(n);if(!c&&!d&&!l&&r>n||l&&o&&h&&!c&&!d||a&&o&&h||!i&&h||!s)return 1;if(!a&&!l&&!d&&r<n||d&&i&&s&&!a&&!l||c&&i&&s||!o&&s||!h)return-1}return 0}return D2=e,D2}var _2,P3;function Tte(){if(P3)return _2;P3=1;var t=kte();function e(r,n,i){for(var a=-1,s=r.criteria,l=n.criteria,o=s.length,c=i.length;++a<o;){var h=t(s[a],l[a]);if(h){if(a>=c)return h;var d=i[a];return h*(d=="desc"?-1:1)}}return r.index-n.index}return _2=e,_2}var N2,z3;function Ete(){if(z3)return N2;z3=1;var t=Bv(),e=Pv(),r=rs(),n=H8(),i=Cte(),a=Rv(),s=Tte(),l=ho(),o=_r();function c(h,d,g){d.length?d=t(d,function(b){return o(b)?function(x){return e(x,b.length===1?b[0]:b)}:b}):d=[l];var m=-1;d=t(d,a(r));var y=n(h,function(b,x,w){var S=t(d,function(k){return k(b)});return{criteria:S,index:++m,value:b}});return i(y,function(b,x){return s(b,x,g)})}return N2=c,N2}var B2,I3;function Ate(){if(I3)return B2;I3=1;var t=mE(),e=Ete(),r=zv(),n=Iv(),i=r(function(a,s){if(a==null)return[];var l=s.length;return l>1&&n(a,s[0],s[1])?s=[]:l>2&&n(s[0],s[1],s[2])&&(s=[s[0]]),e(a,t(s,1),[])});return B2=i,B2}var L2,q3;function Ote(){if(q3)return L2;q3=1;var t=L8(),e=0;function r(n){var i=++e;return t(n)+i}return L2=r,L2}var P2,j3;function Mte(){if(j3)return P2;j3=1;function t(e,r,n){for(var i=-1,a=e.length,s=r.length,l={};++i<a;){var o=i<s?r[i]:void 0;n(l,e[i],o)}return l}return P2=t,P2}var z2,F3;function Rte(){if(F3)return z2;F3=1;var t=Ov(),e=Mte();function r(n,i){return e(n||[],i||[],t)}return z2=r,z2}var I2,H3;function fr(){if(H3)return I2;H3=1;var t;if(typeof rE=="function")try{t={cloneDeep:Gee(),constant:hE(),defaults:Yee(),each:O8(),filter:q8(),find:ete(),flatten:r6(),forEach:A8(),forIn:tte(),has:j8(),isUndefined:F8(),last:rte(),map:V8(),mapValues:nte(),max:ate(),merge:fte(),min:hte(),minBy:dte(),now:pte(),pick:bte(),range:Ste(),reduce:U8(),sortBy:Ate(),uniqueId:Ote(),values:W8(),zipObject:Rte()}}catch{}return t||(t=window._),I2=t,I2}var q2,V3;function Dte(){if(V3)return q2;V3=1,q2=t;function t(){var n={};n._next=n._prev=n,this._sentinel=n}t.prototype.dequeue=function(){var n=this._sentinel,i=n._prev;if(i!==n)return e(i),i},t.prototype.enqueue=function(n){var i=this._sentinel;n._prev&&n._next&&e(n),n._next=i._next,i._next._prev=n,i._next=n,n._prev=i},t.prototype.toString=function(){for(var n=[],i=this._sentinel,a=i._prev;a!==i;)n.push(JSON.stringify(a,r)),a=a._prev;return"["+n.join(", ")+"]"};function e(n){n._prev._next=n._next,n._next._prev=n._prev,delete n._next,delete n._prev}function r(n,i){if(n!=="_next"&&n!=="_prev")return i}return q2}var j2,U3;function _te(){if(U3)return j2;U3=1;var t=fr(),e=Fi().Graph,r=Dte();j2=i;var n=t.constant(1);function i(c,h){if(c.nodeCount()<=1)return[];var d=l(c,h||n),g=a(d.graph,d.buckets,d.zeroIdx);return t.flatten(t.map(g,function(m){return c.outEdges(m.v,m.w)}),!0)}function a(c,h,d){for(var g=[],m=h[h.length-1],y=h[0],b;c.nodeCount();){for(;b=y.dequeue();)s(c,h,d,b);for(;b=m.dequeue();)s(c,h,d,b);if(c.nodeCount()){for(var x=h.length-2;x>0;--x)if(b=h[x].dequeue(),b){g=g.concat(s(c,h,d,b,!0));break}}}return g}function s(c,h,d,g,m){var y=m?[]:void 0;return t.forEach(c.inEdges(g.v),function(b){var x=c.edge(b),w=c.node(b.v);m&&y.push({v:b.v,w:b.w}),w.out-=x,o(h,d,w)}),t.forEach(c.outEdges(g.v),function(b){var x=c.edge(b),w=b.w,S=c.node(w);S.in-=x,o(h,d,S)}),c.removeNode(g.v),y}function l(c,h){var d=new e,g=0,m=0;t.forEach(c.nodes(),function(x){d.setNode(x,{v:x,in:0,out:0})}),t.forEach(c.edges(),function(x){var w=d.edge(x.v,x.w)||0,S=h(x),k=w+S;d.setEdge(x.v,x.w,k),m=Math.max(m,d.node(x.v).out+=S),g=Math.max(g,d.node(x.w).in+=S)});var y=t.range(m+g+3).map(function(){return new r}),b=g+1;return t.forEach(d.nodes(),function(x){o(y,b,d.node(x))}),{graph:d,buckets:y,zeroIdx:b}}function o(c,h,d){d.out?d.in?c[d.out-d.in+h].enqueue(d):c[c.length-1].enqueue(d):c[0].enqueue(d)}return j2}var F2,$3;function Nte(){if($3)return F2;$3=1;var t=fr(),e=_te();F2={run:r,undo:i};function r(a){var s=a.graph().acyclicer==="greedy"?e(a,l(a)):n(a);t.forEach(s,function(o){var c=a.edge(o);a.removeEdge(o),c.forwardName=o.name,c.reversed=!0,a.setEdge(o.w,o.v,c,t.uniqueId("rev"))});function l(o){return function(c){return o.edge(c).weight}}}function n(a){var s=[],l={},o={};function c(h){t.has(o,h)||(o[h]=!0,l[h]=!0,t.forEach(a.outEdges(h),function(d){t.has(l,d.w)?s.push(d):c(d.w)}),delete l[h])}return t.forEach(a.nodes(),c),s}function i(a){t.forEach(a.edges(),function(s){var l=a.edge(s);if(l.reversed){a.removeEdge(s);var o=l.forwardName;delete l.reversed,delete l.forwardName,a.setEdge(s.w,s.v,l,o)}})}return F2}var H2,G3;function Qn(){if(G3)return H2;G3=1;var t=fr(),e=Fi().Graph;H2={addDummyNode:r,simplify:n,asNonCompoundGraph:i,successorWeights:a,predecessorWeights:s,intersectRect:l,buildLayerMatrix:o,normalizeRanks:c,removeEmptyRanks:h,addBorderNode:d,maxRank:g,partition:m,time:y,notime:b};function r(x,w,S,k){var E;do E=t.uniqueId(k);while(x.hasNode(E));return S.dummy=w,x.setNode(E,S),E}function n(x){var w=new e().setGraph(x.graph());return t.forEach(x.nodes(),function(S){w.setNode(S,x.node(S))}),t.forEach(x.edges(),function(S){var k=w.edge(S.v,S.w)||{weight:0,minlen:1},E=x.edge(S);w.setEdge(S.v,S.w,{weight:k.weight+E.weight,minlen:Math.max(k.minlen,E.minlen)})}),w}function i(x){var w=new e({multigraph:x.isMultigraph()}).setGraph(x.graph());return t.forEach(x.nodes(),function(S){x.children(S).length||w.setNode(S,x.node(S))}),t.forEach(x.edges(),function(S){w.setEdge(S,x.edge(S))}),w}function a(x){var w=t.map(x.nodes(),function(S){var k={};return t.forEach(x.outEdges(S),function(E){k[E.w]=(k[E.w]||0)+x.edge(E).weight}),k});return t.zipObject(x.nodes(),w)}function s(x){var w=t.map(x.nodes(),function(S){var k={};return t.forEach(x.inEdges(S),function(E){k[E.v]=(k[E.v]||0)+x.edge(E).weight}),k});return t.zipObject(x.nodes(),w)}function l(x,w){var S=x.x,k=x.y,E=w.x-S,M=w.y-k,R=x.width/2,O=x.height/2;if(!E&&!M)throw new Error("Not possible to find intersection inside of the rectangle");var N,B;return Math.abs(M)*R>Math.abs(E)*O?(M<0&&(O=-O),N=O*E/M,B=O):(E<0&&(R=-R),N=R,B=R*M/E),{x:S+N,y:k+B}}function o(x){var w=t.map(t.range(g(x)+1),function(){return[]});return t.forEach(x.nodes(),function(S){var k=x.node(S),E=k.rank;t.isUndefined(E)||(w[E][k.order]=S)}),w}function c(x){var w=t.min(t.map(x.nodes(),function(S){return x.node(S).rank}));t.forEach(x.nodes(),function(S){var k=x.node(S);t.has(k,"rank")&&(k.rank-=w)})}function h(x){var w=t.min(t.map(x.nodes(),function(M){return x.node(M).rank})),S=[];t.forEach(x.nodes(),function(M){var R=x.node(M).rank-w;S[R]||(S[R]=[]),S[R].push(M)});var k=0,E=x.graph().nodeRankFactor;t.forEach(S,function(M,R){t.isUndefined(M)&&R%E!==0?--k:k&&t.forEach(M,function(O){x.node(O).rank+=k})})}function d(x,w,S,k){var E={width:0,height:0};return arguments.length>=4&&(E.rank=S,E.order=k),r(x,"border",E,w)}function g(x){return t.max(t.map(x.nodes(),function(w){var S=x.node(w).rank;if(!t.isUndefined(S))return S}))}function m(x,w){var S={lhs:[],rhs:[]};return t.forEach(x,function(k){w(k)?S.lhs.push(k):S.rhs.push(k)}),S}function y(x,w){var S=t.now();try{return w()}finally{console.log(x+" time: "+(t.now()-S)+"ms")}}function b(x,w){return w()}return H2}var V2,Y3;function Bte(){if(Y3)return V2;Y3=1;var t=fr(),e=Qn();V2={run:r,undo:i};function r(a){a.graph().dummyChains=[],t.forEach(a.edges(),function(s){n(a,s)})}function n(a,s){var l=s.v,o=a.node(l).rank,c=s.w,h=a.node(c).rank,d=s.name,g=a.edge(s),m=g.labelRank;if(h!==o+1){a.removeEdge(s);var y,b,x;for(x=0,++o;o<h;++x,++o)g.points=[],b={width:0,height:0,edgeLabel:g,edgeObj:s,rank:o},y=e.addDummyNode(a,"edge",b,"_d"),o===m&&(b.width=g.width,b.height=g.height,b.dummy="edge-label",b.labelpos=g.labelpos),a.setEdge(l,y,{weight:g.weight},d),x===0&&a.graph().dummyChains.push(y),l=y;a.setEdge(l,c,{weight:g.weight},d)}}function i(a){t.forEach(a.graph().dummyChains,function(s){var l=a.node(s),o=l.edgeLabel,c;for(a.setEdge(l.edgeObj,o);l.dummy;)c=a.successors(s)[0],a.removeNode(s),o.points.push({x:l.x,y:l.y}),l.dummy==="edge-label"&&(o.x=l.x,o.y=l.y,o.width=l.width,o.height=l.height),s=c,l=a.node(s)})}return V2}var U2,X3;function Tg(){if(X3)return U2;X3=1;var t=fr();U2={longestPath:e,slack:r};function e(n){var i={};function a(s){var l=n.node(s);if(t.has(i,s))return l.rank;i[s]=!0;var o=t.min(t.map(n.outEdges(s),function(c){return a(c.w)-n.edge(c).minlen}));return(o===Number.POSITIVE_INFINITY||o===void 0||o===null)&&(o=0),l.rank=o}t.forEach(n.sources(),a)}function r(n,i){return n.node(i.w).rank-n.node(i.v).rank-n.edge(i).minlen}return U2}var $2,W3;function s6(){if(W3)return $2;W3=1;var t=fr(),e=Fi().Graph,r=Tg().slack;$2=n;function n(l){var o=new e({directed:!1}),c=l.nodes()[0],h=l.nodeCount();o.setNode(c,{});for(var d,g;i(o,l)<h;)d=a(o,l),g=o.hasNode(d.v)?r(l,d):-r(l,d),s(o,l,g);return o}function i(l,o){function c(h){t.forEach(o.nodeEdges(h),function(d){var g=d.v,m=h===g?d.w:g;!l.hasNode(m)&&!r(o,d)&&(l.setNode(m,{}),l.setEdge(h,m,{}),c(m))})}return t.forEach(l.nodes(),c),l.nodeCount()}function a(l,o){return t.minBy(o.edges(),function(c){if(l.hasNode(c.v)!==l.hasNode(c.w))return r(o,c)})}function s(l,o,c){t.forEach(l.nodes(),function(h){o.node(h).rank+=c})}return $2}var G2,Q3;function Lte(){if(Q3)return G2;Q3=1;var t=fr(),e=s6(),r=Tg().slack,n=Tg().longestPath,i=Fi().alg.preorder,a=Fi().alg.postorder,s=Qn().simplify;G2=l,l.initLowLimValues=d,l.initCutValues=o,l.calcCutValue=h,l.leaveEdge=m,l.enterEdge=y,l.exchangeEdges=b;function l(k){k=s(k),n(k);var E=e(k);d(E),o(E,k);for(var M,R;M=m(E);)R=y(E,k,M),b(E,k,M,R)}function o(k,E){var M=a(k,k.nodes());M=M.slice(0,M.length-1),t.forEach(M,function(R){c(k,E,R)})}function c(k,E,M){var R=k.node(M),O=R.parent;k.edge(M,O).cutvalue=h(k,E,M)}function h(k,E,M){var R=k.node(M),O=R.parent,N=!0,B=E.edge(M,O),D=0;return B||(N=!1,B=E.edge(O,M)),D=B.weight,t.forEach(E.nodeEdges(M),function(_){var P=_.v===M,z=P?_.w:_.v;if(z!==O){var H=P===N,$=E.edge(_).weight;if(D+=H?$:-$,w(k,M,z)){var q=k.edge(M,z).cutvalue;D+=H?-q:q}}}),D}function d(k,E){arguments.length<2&&(E=k.nodes()[0]),g(k,{},1,E)}function g(k,E,M,R,O){var N=M,B=k.node(R);return E[R]=!0,t.forEach(k.neighbors(R),function(D){t.has(E,D)||(M=g(k,E,M,D,R))}),B.low=N,B.lim=M++,O?B.parent=O:delete B.parent,M}function m(k){return t.find(k.edges(),function(E){return k.edge(E).cutvalue<0})}function y(k,E,M){var R=M.v,O=M.w;E.hasEdge(R,O)||(R=M.w,O=M.v);var N=k.node(R),B=k.node(O),D=N,_=!1;N.lim>B.lim&&(D=B,_=!0);var P=t.filter(E.edges(),function(z){return _===S(k,k.node(z.v),D)&&_!==S(k,k.node(z.w),D)});return t.minBy(P,function(z){return r(E,z)})}function b(k,E,M,R){var O=M.v,N=M.w;k.removeEdge(O,N),k.setEdge(R.v,R.w,{}),d(k),o(k,E),x(k,E)}function x(k,E){var M=t.find(k.nodes(),function(O){return!E.node(O).parent}),R=i(k,M);R=R.slice(1),t.forEach(R,function(O){var N=k.node(O).parent,B=E.edge(O,N),D=!1;B||(B=E.edge(N,O),D=!0),E.node(O).rank=E.node(N).rank+(D?B.minlen:-B.minlen)})}function w(k,E,M){return k.hasEdge(E,M)}function S(k,E,M){return M.low<=E.lim&&E.lim<=M.lim}return G2}var Y2,K3;function Pte(){if(K3)return Y2;K3=1;var t=Tg(),e=t.longestPath,r=s6(),n=Lte();Y2=i;function i(o){switch(o.graph().ranker){case"network-simplex":l(o);break;case"tight-tree":s(o);break;case"longest-path":a(o);break;default:l(o)}}var a=e;function s(o){e(o),r(o)}function l(o){n(o)}return Y2}var X2,Z3;function zte(){if(Z3)return X2;Z3=1;var t=fr();X2=e;function e(i){var a=n(i);t.forEach(i.graph().dummyChains,function(s){for(var l=i.node(s),o=l.edgeObj,c=r(i,a,o.v,o.w),h=c.path,d=c.lca,g=0,m=h[g],y=!0;s!==o.w;){if(l=i.node(s),y){for(;(m=h[g])!==d&&i.node(m).maxRank<l.rank;)g++;m===d&&(y=!1)}if(!y){for(;g<h.length-1&&i.node(m=h[g+1]).minRank<=l.rank;)g++;m=h[g]}i.setParent(s,m),s=i.successors(s)[0]}})}function r(i,a,s,l){var o=[],c=[],h=Math.min(a[s].low,a[l].low),d=Math.max(a[s].lim,a[l].lim),g,m;g=s;do g=i.parent(g),o.push(g);while(g&&(a[g].low>h||d>a[g].lim));for(m=g,g=l;(g=i.parent(g))!==m;)c.push(g);return{path:o.concat(c.reverse()),lca:m}}function n(i){var a={},s=0;function l(o){var c=s;t.forEach(i.children(o),l),a[o]={low:c,lim:s++}}return t.forEach(i.children(),l),a}return X2}var W2,J3;function Ite(){if(J3)return W2;J3=1;var t=fr(),e=Qn();W2={run:r,cleanup:s};function r(l){var o=e.addDummyNode(l,"root",{},"_root"),c=i(l),h=t.max(t.values(c))-1,d=2*h+1;l.graph().nestingRoot=o,t.forEach(l.edges(),function(m){l.edge(m).minlen*=d});var g=a(l)+1;t.forEach(l.children(),function(m){n(l,o,d,g,h,c,m)}),l.graph().nodeRankFactor=d}function n(l,o,c,h,d,g,m){var y=l.children(m);if(!y.length){m!==o&&l.setEdge(o,m,{weight:0,minlen:c});return}var b=e.addBorderNode(l,"_bt"),x=e.addBorderNode(l,"_bb"),w=l.node(m);l.setParent(b,m),w.borderTop=b,l.setParent(x,m),w.borderBottom=x,t.forEach(y,function(S){n(l,o,c,h,d,g,S);var k=l.node(S),E=k.borderTop?k.borderTop:S,M=k.borderBottom?k.borderBottom:S,R=k.borderTop?h:2*h,O=E!==M?1:d-g[m]+1;l.setEdge(b,E,{weight:R,minlen:O,nestingEdge:!0}),l.setEdge(M,x,{weight:R,minlen:O,nestingEdge:!0})}),l.parent(m)||l.setEdge(o,b,{weight:0,minlen:d+g[m]})}function i(l){var o={};function c(h,d){var g=l.children(h);g&&g.length&&t.forEach(g,function(m){c(m,d+1)}),o[h]=d}return t.forEach(l.children(),function(h){c(h,1)}),o}function a(l){return t.reduce(l.edges(),function(o,c){return o+l.edge(c).weight},0)}function s(l){var o=l.graph();l.removeNode(o.nestingRoot),delete o.nestingRoot,t.forEach(l.edges(),function(c){var h=l.edge(c);h.nestingEdge&&l.removeEdge(c)})}return W2}var Q2,e4;function qte(){if(e4)return Q2;e4=1;var t=fr(),e=Qn();Q2=r;function r(i){function a(s){var l=i.children(s),o=i.node(s);if(l.length&&t.forEach(l,a),t.has(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(var c=o.minRank,h=o.maxRank+1;c<h;++c)n(i,"borderLeft","_bl",s,o,c),n(i,"borderRight","_br",s,o,c)}}t.forEach(i.children(),a)}function n(i,a,s,l,o,c){var h={width:0,height:0,rank:c,borderType:a},d=o[a][c-1],g=e.addDummyNode(i,"border",h,s);o[a][c]=g,i.setParent(g,l),d&&i.setEdge(d,g,{weight:1})}return Q2}var K2,t4;function jte(){if(t4)return K2;t4=1;var t=fr();K2={adjust:e,undo:r};function e(c){var h=c.graph().rankdir.toLowerCase();(h==="lr"||h==="rl")&&n(c)}function r(c){var h=c.graph().rankdir.toLowerCase();(h==="bt"||h==="rl")&&a(c),(h==="lr"||h==="rl")&&(l(c),n(c))}function n(c){t.forEach(c.nodes(),function(h){i(c.node(h))}),t.forEach(c.edges(),function(h){i(c.edge(h))})}function i(c){var h=c.width;c.width=c.height,c.height=h}function a(c){t.forEach(c.nodes(),function(h){s(c.node(h))}),t.forEach(c.edges(),function(h){var d=c.edge(h);t.forEach(d.points,s),t.has(d,"y")&&s(d)})}function s(c){c.y=-c.y}function l(c){t.forEach(c.nodes(),function(h){o(c.node(h))}),t.forEach(c.edges(),function(h){var d=c.edge(h);t.forEach(d.points,o),t.has(d,"x")&&o(d)})}function o(c){var h=c.x;c.x=c.y,c.y=h}return K2}var Z2,r4;function Fte(){if(r4)return Z2;r4=1;var t=fr();Z2=e;function e(r){var n={},i=t.filter(r.nodes(),function(c){return!r.children(c).length}),a=t.max(t.map(i,function(c){return r.node(c).rank})),s=t.map(t.range(a+1),function(){return[]});function l(c){if(!t.has(n,c)){n[c]=!0;var h=r.node(c);s[h.rank].push(c),t.forEach(r.successors(c),l)}}var o=t.sortBy(i,function(c){return r.node(c).rank});return t.forEach(o,l),s}return Z2}var J2,n4;function Hte(){if(n4)return J2;n4=1;var t=fr();J2=e;function e(n,i){for(var a=0,s=1;s<i.length;++s)a+=r(n,i[s-1],i[s]);return a}function r(n,i,a){for(var s=t.zipObject(a,t.map(a,function(g,m){return m})),l=t.flatten(t.map(i,function(g){return t.sortBy(t.map(n.outEdges(g),function(m){return{pos:s[m.w],weight:n.edge(m).weight}}),"pos")}),!0),o=1;o<a.length;)o<<=1;var c=2*o-1;o-=1;var h=t.map(new Array(c),function(){return 0}),d=0;return t.forEach(l.forEach(function(g){var m=g.pos+o;h[m]+=g.weight;for(var y=0;m>0;)m%2&&(y+=h[m+1]),m=m-1>>1,h[m]+=g.weight;d+=g.weight*y})),d}return J2}var eC,i4;function Vte(){if(i4)return eC;i4=1;var t=fr();eC=e;function e(r,n){return t.map(n,function(i){var a=r.inEdges(i);if(a.length){var s=t.reduce(a,function(l,o){var c=r.edge(o),h=r.node(o.v);return{sum:l.sum+c.weight*h.order,weight:l.weight+c.weight}},{sum:0,weight:0});return{v:i,barycenter:s.sum/s.weight,weight:s.weight}}else return{v:i}})}return eC}var tC,a4;function Ute(){if(a4)return tC;a4=1;var t=fr();tC=e;function e(i,a){var s={};t.forEach(i,function(o,c){var h=s[o.v]={indegree:0,in:[],out:[],vs:[o.v],i:c};t.isUndefined(o.barycenter)||(h.barycenter=o.barycenter,h.weight=o.weight)}),t.forEach(a.edges(),function(o){var c=s[o.v],h=s[o.w];!t.isUndefined(c)&&!t.isUndefined(h)&&(h.indegree++,c.out.push(s[o.w]))});var l=t.filter(s,function(o){return!o.indegree});return r(l)}function r(i){var a=[];function s(c){return function(h){h.merged||(t.isUndefined(h.barycenter)||t.isUndefined(c.barycenter)||h.barycenter>=c.barycenter)&&n(c,h)}}function l(c){return function(h){h.in.push(c),--h.indegree===0&&i.push(h)}}for(;i.length;){var o=i.pop();a.push(o),t.forEach(o.in.reverse(),s(o)),t.forEach(o.out,l(o))}return t.map(t.filter(a,function(c){return!c.merged}),function(c){return t.pick(c,["vs","i","barycenter","weight"])})}function n(i,a){var s=0,l=0;i.weight&&(s+=i.barycenter*i.weight,l+=i.weight),a.weight&&(s+=a.barycenter*a.weight,l+=a.weight),i.vs=a.vs.concat(i.vs),i.barycenter=s/l,i.weight=l,i.i=Math.min(a.i,i.i),a.merged=!0}return tC}var rC,s4;function $te(){if(s4)return rC;s4=1;var t=fr(),e=Qn();rC=r;function r(a,s){var l=e.partition(a,function(b){return t.has(b,"barycenter")}),o=l.lhs,c=t.sortBy(l.rhs,function(b){return-b.i}),h=[],d=0,g=0,m=0;o.sort(i(!!s)),m=n(h,c,m),t.forEach(o,function(b){m+=b.vs.length,h.push(b.vs),d+=b.barycenter*b.weight,g+=b.weight,m=n(h,c,m)});var y={vs:t.flatten(h,!0)};return g&&(y.barycenter=d/g,y.weight=g),y}function n(a,s,l){for(var o;s.length&&(o=t.last(s)).i<=l;)s.pop(),a.push(o.vs),l++;return l}function i(a){return function(s,l){return s.barycenter<l.barycenter?-1:s.barycenter>l.barycenter?1:a?l.i-s.i:s.i-l.i}}return rC}var nC,l4;function Gte(){if(l4)return nC;l4=1;var t=fr(),e=Vte(),r=Ute(),n=$te();nC=i;function i(l,o,c,h){var d=l.children(o),g=l.node(o),m=g?g.borderLeft:void 0,y=g?g.borderRight:void 0,b={};m&&(d=t.filter(d,function(M){return M!==m&&M!==y}));var x=e(l,d);t.forEach(x,function(M){if(l.children(M.v).length){var R=i(l,M.v,c,h);b[M.v]=R,t.has(R,"barycenter")&&s(M,R)}});var w=r(x,c);a(w,b);var S=n(w,h);if(m&&(S.vs=t.flatten([m,S.vs,y],!0),l.predecessors(m).length)){var k=l.node(l.predecessors(m)[0]),E=l.node(l.predecessors(y)[0]);t.has(S,"barycenter")||(S.barycenter=0,S.weight=0),S.barycenter=(S.barycenter*S.weight+k.order+E.order)/(S.weight+2),S.weight+=2}return S}function a(l,o){t.forEach(l,function(c){c.vs=t.flatten(c.vs.map(function(h){return o[h]?o[h].vs:h}),!0)})}function s(l,o){t.isUndefined(l.barycenter)?(l.barycenter=o.barycenter,l.weight=o.weight):(l.barycenter=(l.barycenter*l.weight+o.barycenter*o.weight)/(l.weight+o.weight),l.weight+=o.weight)}return nC}var iC,o4;function Yte(){if(o4)return iC;o4=1;var t=fr(),e=Fi().Graph;iC=r;function r(i,a,s){var l=n(i),o=new e({compound:!0}).setGraph({root:l}).setDefaultNodeLabel(function(c){return i.node(c)});return t.forEach(i.nodes(),function(c){var h=i.node(c),d=i.parent(c);(h.rank===a||h.minRank<=a&&a<=h.maxRank)&&(o.setNode(c),o.setParent(c,d||l),t.forEach(i[s](c),function(g){var m=g.v===c?g.w:g.v,y=o.edge(m,c),b=t.isUndefined(y)?0:y.weight;o.setEdge(m,c,{weight:i.edge(g).weight+b})}),t.has(h,"minRank")&&o.setNode(c,{borderLeft:h.borderLeft[a],borderRight:h.borderRight[a]}))}),o}function n(i){for(var a;i.hasNode(a=t.uniqueId("_root")););return a}return iC}var aC,u4;function Xte(){if(u4)return aC;u4=1;var t=fr();aC=e;function e(r,n,i){var a={},s;t.forEach(i,function(l){for(var o=r.parent(l),c,h;o;){if(c=r.parent(o),c?(h=a[c],a[c]=o):(h=s,s=o),h&&h!==o){n.setEdge(h,o);return}o=c}})}return aC}var sC,c4;function Wte(){if(c4)return sC;c4=1;var t=fr(),e=Fte(),r=Hte(),n=Gte(),i=Yte(),a=Xte(),s=Fi().Graph,l=Qn();sC=o;function o(g){var m=l.maxRank(g),y=c(g,t.range(1,m+1),"inEdges"),b=c(g,t.range(m-1,-1,-1),"outEdges"),x=e(g);d(g,x);for(var w=Number.POSITIVE_INFINITY,S,k=0,E=0;E<4;++k,++E){h(k%2?y:b,k%4>=2),x=l.buildLayerMatrix(g);var M=r(g,x);M<w&&(E=0,S=t.cloneDeep(x),w=M)}d(g,S)}function c(g,m,y){return t.map(m,function(b){return i(g,b,y)})}function h(g,m){var y=new s;t.forEach(g,function(b){var x=b.graph().root,w=n(b,x,y,m);t.forEach(w.vs,function(S,k){b.node(S).order=k}),a(b,y,w.vs)})}function d(g,m){t.forEach(m,function(y){t.forEach(y,function(b,x){g.node(b).order=x})})}return sC}var lC,f4;function Qte(){if(f4)return lC;f4=1;var t=fr(),e=Fi().Graph,r=Qn();lC={positionX:y,findType1Conflicts:n,findType2Conflicts:i,addConflict:s,hasConflict:l,verticalAlignment:o,horizontalCompaction:c,alignCoordinates:g,findSmallestWidthAlignment:d,balance:m};function n(w,S){var k={};function E(M,R){var O=0,N=0,B=M.length,D=t.last(R);return t.forEach(R,function(_,P){var z=a(w,_),H=z?w.node(z).order:B;(z||_===D)&&(t.forEach(R.slice(N,P+1),function($){t.forEach(w.predecessors($),function(q){var V=w.node(q),X=V.order;(X<O||H<X)&&!(V.dummy&&w.node($).dummy)&&s(k,q,$)})}),N=P+1,O=H)}),R}return t.reduce(S,E),k}function i(w,S){var k={};function E(R,O,N,B,D){var _;t.forEach(t.range(O,N),function(P){_=R[P],w.node(_).dummy&&t.forEach(w.predecessors(_),function(z){var H=w.node(z);H.dummy&&(H.order<B||H.order>D)&&s(k,z,_)})})}function M(R,O){var N=-1,B,D=0;return t.forEach(O,function(_,P){if(w.node(_).dummy==="border"){var z=w.predecessors(_);z.length&&(B=w.node(z[0]).order,E(O,D,P,N,B),D=P,N=B)}E(O,D,O.length,B,R.length)}),O}return t.reduce(S,M),k}function a(w,S){if(w.node(S).dummy)return t.find(w.predecessors(S),function(k){return w.node(k).dummy})}function s(w,S,k){if(S>k){var E=S;S=k,k=E}var M=w[S];M||(w[S]=M={}),M[k]=!0}function l(w,S,k){if(S>k){var E=S;S=k,k=E}return t.has(w[S],k)}function o(w,S,k,E){var M={},R={},O={};return t.forEach(S,function(N){t.forEach(N,function(B,D){M[B]=B,R[B]=B,O[B]=D})}),t.forEach(S,function(N){var B=-1;t.forEach(N,function(D){var _=E(D);if(_.length){_=t.sortBy(_,function(q){return O[q]});for(var P=(_.length-1)/2,z=Math.floor(P),H=Math.ceil(P);z<=H;++z){var $=_[z];R[D]===D&&B<O[$]&&!l(k,D,$)&&(R[$]=D,R[D]=M[D]=M[$],B=O[$])}}})}),{root:M,align:R}}function c(w,S,k,E,M){var R={},O=h(w,S,k,M),N=M?"borderLeft":"borderRight";function B(P,z){for(var H=O.nodes(),$=H.pop(),q={};$;)q[$]?P($):(q[$]=!0,H.push($),H=H.concat(z($))),$=H.pop()}function D(P){R[P]=O.inEdges(P).reduce(function(z,H){return Math.max(z,R[H.v]+O.edge(H))},0)}function _(P){var z=O.outEdges(P).reduce(function($,q){return Math.min($,R[q.w]-O.edge(q))},Number.POSITIVE_INFINITY),H=w.node(P);z!==Number.POSITIVE_INFINITY&&H.borderType!==N&&(R[P]=Math.max(R[P],z))}return B(D,O.predecessors.bind(O)),B(_,O.successors.bind(O)),t.forEach(E,function(P){R[P]=R[k[P]]}),R}function h(w,S,k,E){var M=new e,R=w.graph(),O=b(R.nodesep,R.edgesep,E);return t.forEach(S,function(N){var B;t.forEach(N,function(D){var _=k[D];if(M.setNode(_),B){var P=k[B],z=M.edge(P,_);M.setEdge(P,_,Math.max(O(w,D,B),z||0))}B=D})}),M}function d(w,S){return t.minBy(t.values(S),function(k){var E=Number.NEGATIVE_INFINITY,M=Number.POSITIVE_INFINITY;return t.forIn(k,function(R,O){var N=x(w,O)/2;E=Math.max(R+N,E),M=Math.min(R-N,M)}),E-M})}function g(w,S){var k=t.values(S),E=t.min(k),M=t.max(k);t.forEach(["u","d"],function(R){t.forEach(["l","r"],function(O){var N=R+O,B=w[N],D;if(B!==S){var _=t.values(B);D=O==="l"?E-t.min(_):M-t.max(_),D&&(w[N]=t.mapValues(B,function(P){return P+D}))}})})}function m(w,S){return t.mapValues(w.ul,function(k,E){if(S)return w[S.toLowerCase()][E];var M=t.sortBy(t.map(w,E));return(M[1]+M[2])/2})}function y(w){var S=r.buildLayerMatrix(w),k=t.merge(n(w,S),i(w,S)),E={},M;t.forEach(["u","d"],function(O){M=O==="u"?S:t.values(S).reverse(),t.forEach(["l","r"],function(N){N==="r"&&(M=t.map(M,function(P){return t.values(P).reverse()}));var B=(O==="u"?w.predecessors:w.successors).bind(w),D=o(w,M,k,B),_=c(w,M,D.root,D.align,N==="r");N==="r"&&(_=t.mapValues(_,function(P){return-P})),E[O+N]=_})});var R=d(w,E);return g(E,R),m(E,w.graph().align)}function b(w,S,k){return function(E,M,R){var O=E.node(M),N=E.node(R),B=0,D;if(B+=O.width/2,t.has(O,"labelpos"))switch(O.labelpos.toLowerCase()){case"l":D=-O.width/2;break;case"r":D=O.width/2;break}if(D&&(B+=k?D:-D),D=0,B+=(O.dummy?S:w)/2,B+=(N.dummy?S:w)/2,B+=N.width/2,t.has(N,"labelpos"))switch(N.labelpos.toLowerCase()){case"l":D=N.width/2;break;case"r":D=-N.width/2;break}return D&&(B+=k?D:-D),D=0,B}}function x(w,S){return w.node(S).width}return lC}var oC,h4;function Kte(){if(h4)return oC;h4=1;var t=fr(),e=Qn(),r=Qte().positionX;oC=n;function n(a){a=e.asNonCompoundGraph(a),i(a),t.forEach(r(a),function(s,l){a.node(l).x=s})}function i(a){var s=e.buildLayerMatrix(a),l=a.graph().ranksep,o=0;t.forEach(s,function(c){var h=t.max(t.map(c,function(d){return a.node(d).height}));t.forEach(c,function(d){a.node(d).y=o+h/2}),o+=h+l})}return oC}var uC,d4;function Zte(){if(d4)return uC;d4=1;var t=fr(),e=Nte(),r=Bte(),n=Pte(),i=Qn().normalizeRanks,a=zte(),s=Qn().removeEmptyRanks,l=Ite(),o=qte(),c=jte(),h=Wte(),d=Kte(),g=Qn(),m=Fi().Graph;uC=y;function y(Y,W){var Z=W&&W.debugTiming?g.time:g.notime;Z("layout",function(){var ie=Z(" buildLayoutGraph",function(){return B(Y)});Z(" runLayout",function(){b(ie,Z)}),Z(" updateInputGraph",function(){x(Y,ie)})})}function b(Y,W){W(" makeSpaceForEdgeLabels",function(){D(Y)}),W(" removeSelfEdges",function(){ee(Y)}),W(" acyclic",function(){e.run(Y)}),W(" nestingGraph.run",function(){l.run(Y)}),W(" rank",function(){n(g.asNonCompoundGraph(Y))}),W(" injectEdgeLabelProxies",function(){_(Y)}),W(" removeEmptyRanks",function(){s(Y)}),W(" nestingGraph.cleanup",function(){l.cleanup(Y)}),W(" normalizeRanks",function(){i(Y)}),W(" assignRankMinMax",function(){P(Y)}),W(" removeEdgeLabelProxies",function(){z(Y)}),W(" normalize.run",function(){r.run(Y)}),W(" parentDummyChains",function(){a(Y)}),W(" addBorderSegments",function(){o(Y)}),W(" order",function(){h(Y)}),W(" insertSelfEdges",function(){te(Y)}),W(" adjustCoordinateSystem",function(){c.adjust(Y)}),W(" position",function(){d(Y)}),W(" positionSelfEdges",function(){I(Y)}),W(" removeBorderNodes",function(){X(Y)}),W(" normalize.undo",function(){r.undo(Y)}),W(" fixupEdgeLabelCoords",function(){q(Y)}),W(" undoCoordinateSystem",function(){c.undo(Y)}),W(" translateGraph",function(){H(Y)}),W(" assignNodeIntersects",function(){$(Y)}),W(" reversePoints",function(){V(Y)}),W(" acyclic.undo",function(){e.undo(Y)})}function x(Y,W){t.forEach(Y.nodes(),function(Z){var ie=Y.node(Z),we=W.node(Z);ie&&(ie.x=we.x,ie.y=we.y,W.children(Z).length&&(ie.width=we.width,ie.height=we.height))}),t.forEach(Y.edges(),function(Z){var ie=Y.edge(Z),we=W.edge(Z);ie.points=we.points,t.has(we,"x")&&(ie.x=we.x,ie.y=we.y)}),Y.graph().width=W.graph().width,Y.graph().height=W.graph().height}var w=["nodesep","edgesep","ranksep","marginx","marginy"],S={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},k=["acyclicer","ranker","rankdir","align"],E=["width","height"],M={width:0,height:0},R=["minlen","weight","width","height","labeloffset"],O={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},N=["labelpos"];function B(Y){var W=new m({multigraph:!0,compound:!0}),Z=re(Y.graph());return W.setGraph(t.merge({},S,G(Z,w),t.pick(Z,k))),t.forEach(Y.nodes(),function(ie){var we=re(Y.node(ie));W.setNode(ie,t.defaults(G(we,E),M)),W.setParent(ie,Y.parent(ie))}),t.forEach(Y.edges(),function(ie){var we=re(Y.edge(ie));W.setEdge(ie,t.merge({},O,G(we,R),t.pick(we,N)))}),W}function D(Y){var W=Y.graph();W.ranksep/=2,t.forEach(Y.edges(),function(Z){var ie=Y.edge(Z);ie.minlen*=2,ie.labelpos.toLowerCase()!=="c"&&(W.rankdir==="TB"||W.rankdir==="BT"?ie.width+=ie.labeloffset:ie.height+=ie.labeloffset)})}function _(Y){t.forEach(Y.edges(),function(W){var Z=Y.edge(W);if(Z.width&&Z.height){var ie=Y.node(W.v),we=Y.node(W.w),de={rank:(we.rank-ie.rank)/2+ie.rank,e:W};g.addDummyNode(Y,"edge-proxy",de,"_ep")}})}function P(Y){var W=0;t.forEach(Y.nodes(),function(Z){var ie=Y.node(Z);ie.borderTop&&(ie.minRank=Y.node(ie.borderTop).rank,ie.maxRank=Y.node(ie.borderBottom).rank,W=t.max(W,ie.maxRank))}),Y.graph().maxRank=W}function z(Y){t.forEach(Y.nodes(),function(W){var Z=Y.node(W);Z.dummy==="edge-proxy"&&(Y.edge(Z.e).labelRank=Z.rank,Y.removeNode(W))})}function H(Y){var W=Number.POSITIVE_INFINITY,Z=0,ie=Number.POSITIVE_INFINITY,we=0,de=Y.graph(),se=de.marginx||0,j=de.marginy||0;function Q(K){var ue=K.x,Se=K.y,at=K.width,Me=K.height;W=Math.min(W,ue-at/2),Z=Math.max(Z,ue+at/2),ie=Math.min(ie,Se-Me/2),we=Math.max(we,Se+Me/2)}t.forEach(Y.nodes(),function(K){Q(Y.node(K))}),t.forEach(Y.edges(),function(K){var ue=Y.edge(K);t.has(ue,"x")&&Q(ue)}),W-=se,ie-=j,t.forEach(Y.nodes(),function(K){var ue=Y.node(K);ue.x-=W,ue.y-=ie}),t.forEach(Y.edges(),function(K){var ue=Y.edge(K);t.forEach(ue.points,function(Se){Se.x-=W,Se.y-=ie}),t.has(ue,"x")&&(ue.x-=W),t.has(ue,"y")&&(ue.y-=ie)}),de.width=Z-W+se,de.height=we-ie+j}function $(Y){t.forEach(Y.edges(),function(W){var Z=Y.edge(W),ie=Y.node(W.v),we=Y.node(W.w),de,se;Z.points?(de=Z.points[0],se=Z.points[Z.points.length-1]):(Z.points=[],de=we,se=ie),Z.points.unshift(g.intersectRect(ie,de)),Z.points.push(g.intersectRect(we,se))})}function q(Y){t.forEach(Y.edges(),function(W){var Z=Y.edge(W);if(t.has(Z,"x"))switch((Z.labelpos==="l"||Z.labelpos==="r")&&(Z.width-=Z.labeloffset),Z.labelpos){case"l":Z.x-=Z.width/2+Z.labeloffset;break;case"r":Z.x+=Z.width/2+Z.labeloffset;break}})}function V(Y){t.forEach(Y.edges(),function(W){var Z=Y.edge(W);Z.reversed&&Z.points.reverse()})}function X(Y){t.forEach(Y.nodes(),function(W){if(Y.children(W).length){var Z=Y.node(W),ie=Y.node(Z.borderTop),we=Y.node(Z.borderBottom),de=Y.node(t.last(Z.borderLeft)),se=Y.node(t.last(Z.borderRight));Z.width=Math.abs(se.x-de.x),Z.height=Math.abs(we.y-ie.y),Z.x=de.x+Z.width/2,Z.y=ie.y+Z.height/2}}),t.forEach(Y.nodes(),function(W){Y.node(W).dummy==="border"&&Y.removeNode(W)})}function ee(Y){t.forEach(Y.edges(),function(W){if(W.v===W.w){var Z=Y.node(W.v);Z.selfEdges||(Z.selfEdges=[]),Z.selfEdges.push({e:W,label:Y.edge(W)}),Y.removeEdge(W)}})}function te(Y){var W=g.buildLayerMatrix(Y);t.forEach(W,function(Z){var ie=0;t.forEach(Z,function(we,de){var se=Y.node(we);se.order=de+ie,t.forEach(se.selfEdges,function(j){g.addDummyNode(Y,"selfedge",{width:j.label.width,height:j.label.height,rank:se.rank,order:de+ ++ie,e:j.e,label:j.label},"_se")}),delete se.selfEdges})})}function I(Y){t.forEach(Y.nodes(),function(W){var Z=Y.node(W);if(Z.dummy==="selfedge"){var ie=Y.node(Z.e.v),we=ie.x+ie.width/2,de=ie.y,se=Z.x-we,j=ie.height/2;Y.setEdge(Z.e,Z.label),Y.removeNode(W),Z.label.points=[{x:we+2*se/3,y:de-j},{x:we+5*se/6,y:de-j},{x:we+se,y:de},{x:we+5*se/6,y:de+j},{x:we+2*se/3,y:de+j}],Z.label.x=Z.x,Z.label.y=Z.y}})}function G(Y,W){return t.mapValues(t.pick(Y,W),Number)}function re(Y){var W={};return t.forEach(Y,function(Z,ie){W[ie.toLowerCase()]=Z}),W}return uC}var cC,p4;function Jte(){if(p4)return cC;p4=1;var t=fr(),e=Qn(),r=Fi().Graph;cC={debugOrdering:n};function n(i){var a=e.buildLayerMatrix(i),s=new r({compound:!0,multigraph:!0}).setGraph({});return t.forEach(i.nodes(),function(l){s.setNode(l,{label:l}),s.setParent(l,"layer"+i.node(l).rank)}),t.forEach(i.edges(),function(l){s.setEdge(l.v,l.w,{},l.name)}),t.forEach(a,function(l,o){var c="layer"+o;s.setNode(c,{rank:"same"}),t.reduce(l,function(h,d){return s.setEdge(h,d,{style:"invis"}),d})}),s}return cC}var fC,g4;function ere(){return g4||(g4=1,fC="0.8.5"),fC}var hC,v4;function tre(){return v4||(v4=1,hC={graphlib:Fi(),layout:Zte(),debug:Jte(),util:{time:Qn().time,notime:Qn().notime},version:ere()}),hC}var rre=Yp.exports,m4;function nre(){return m4||(m4=1,(function(t,e){(function(n,i){t.exports=i(tre())})(rre,function(r){return(function(n){var i={};function a(s){if(i[s])return i[s].exports;var l=i[s]={i:s,l:!1,exports:{}};return n[s].call(l.exports,l,l.exports,a),l.l=!0,l.exports}return a.m=n,a.c=i,a.d=function(s,l,o){a.o(s,l)||Object.defineProperty(s,l,{enumerable:!0,get:o})},a.r=function(s){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},a.t=function(s,l){if(l&1&&(s=a(s)),l&8||l&4&&typeof s=="object"&&s&&s.__esModule)return s;var o=Object.create(null);if(a.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:s}),l&2&&typeof s!="string")for(var c in s)a.d(o,c,(function(h){return s[h]}).bind(null,c));return o},a.n=function(s){var l=s&&s.__esModule?function(){return s.default}:function(){return s};return a.d(l,"a",l),l},a.o=function(s,l){return Object.prototype.hasOwnProperty.call(s,l)},a.p="",a(a.s=0)})([(function(n,i,a){var s=a(1),l=function(c){c&&c("layout","dagre",s)};typeof cytoscape<"u"&&l(cytoscape),n.exports=l}),(function(n,i,a){function s(g){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?s=function(y){return typeof y}:s=function(y){return y&&typeof Symbol=="function"&&y.constructor===Symbol&&y!==Symbol.prototype?"symbol":typeof y},s(g)}var l=function(m){return typeof m=="function"},o=a(2),c=a(3),h=a(4);function d(g){this.options=c({},o,g)}d.prototype.run=function(){var g=this.options,m=this,y=g.cy,b=g.eles,x=function(I,G){return l(G)?G.apply(I,[I]):G},w=g.boundingBox||{x1:0,y1:0,w:y.width(),h:y.height()};w.x2===void 0&&(w.x2=w.x1+w.w),w.w===void 0&&(w.w=w.x2-w.x1),w.y2===void 0&&(w.y2=w.y1+w.h),w.h===void 0&&(w.h=w.y2-w.y1);var S=new h.graphlib.Graph({multigraph:!0,compound:!0}),k={},E=function(I,G){G!=null&&(k[I]=G)};E("nodesep",g.nodeSep),E("edgesep",g.edgeSep),E("ranksep",g.rankSep),E("rankdir",g.rankDir),E("align",g.align),E("ranker",g.ranker),E("acyclicer",g.acyclicer),S.setGraph(k),S.setDefaultEdgeLabel(function(){return{}}),S.setDefaultNodeLabel(function(){return{}});var M=b.nodes();l(g.sort)&&(M=M.sort(g.sort));for(var R=0;R<M.length;R++){var O=M[R],N=O.layoutDimensions(g);S.setNode(O.id(),{width:N.w,height:N.h,name:O.id()})}for(var B=0;B<M.length;B++){var D=M[B];D.isChild()&&S.setParent(D.id(),D.parent().id())}var _=b.edges().stdFilter(function(te){return!te.source().isParent()&&!te.target().isParent()});l(g.sort)&&(_=_.sort(g.sort));for(var P=0;P<_.length;P++){var z=_[P];S.setEdge(z.source().id(),z.target().id(),{minlen:x(z,g.minLen),weight:x(z,g.edgeWeight),name:z.id()},z.id())}h.layout(S);for(var H=S.nodes(),$=0;$<H.length;$++){var q=H[$],V=S.node(q);y.getElementById(q).scratch().dagre=V}var X;g.boundingBox?(X={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0},M.forEach(function(te){var I=te.scratch().dagre;X.x1=Math.min(X.x1,I.x),X.x2=Math.max(X.x2,I.x),X.y1=Math.min(X.y1,I.y),X.y2=Math.max(X.y2,I.y)}),X.w=X.x2-X.x1,X.h=X.y2-X.y1):X=w;var ee=function(I){if(g.boundingBox){var G=X.w===0?0:(I.x-X.x1)/X.w,re=X.h===0?0:(I.y-X.y1)/X.h;return{x:w.x1+G*w.w,y:w.y1+re*w.h}}else return I};return M.layoutPositions(m,g,function(te){te=s(te)==="object"?te:this;var I=te.scratch().dagre;return ee({x:I.x,y:I.y})}),this},n.exports=d}),(function(n,i){var a={nodeSep:void 0,edgeSep:void 0,rankSep:void 0,rankDir:void 0,align:void 0,acyclicer:void 0,ranker:void 0,minLen:function(l){return 1},edgeWeight:function(l){return 1},fit:!0,padding:30,spacingFactor:void 0,nodeDimensionsIncludeLabels:!1,animate:!1,animateFilter:function(l,o){return!0},animationDuration:500,animationEasing:void 0,boundingBox:void 0,transform:function(l,o){return o},ready:function(){},sort:void 0,stop:function(){}};n.exports=a}),(function(n,i){n.exports=Object.assign!=null?Object.assign.bind(Object):function(a){for(var s=arguments.length,l=new Array(s>1?s-1:0),o=1;o<s;o++)l[o-1]=arguments[o];return l.forEach(function(c){Object.keys(c).forEach(function(h){return a[h]=c[h]})}),a}}),(function(n,i){n.exports=r})])})})(Yp)),Yp.exports}var ire=nre();const are=ST(ire);var dC,y4;function sre(){if(y4)return dC;y4=1;class t{constructor(n,i={}){this._cy=n,this._params=i,this._node_dom={};let a=n.container();if(i.dom_container)this._nodes_dom_container=i.dom_container;else{let s=document.createElement("div");s.style.position="absolute",s.style.zIndex=10,a.querySelector("canvas").parentNode.appendChild(s),this._nodes_dom_container=s}this._resize_observer=new ResizeObserver(s=>{for(let l of s){let o=l.target,c=o.__cy_id;n.getElementById(c).style({width:o.offsetWidth,height:o.offsetHeight,shape:"rectangle"})}}),n.on("add","node",s=>{this._add_node(s.target)});for(let s of n.nodes())this._add_node(s);n.on("pan zoom",s=>{let l=n.pan(),o=n.zoom(),c="translate("+l.x+"px,"+l.y+"px) scale("+o+")";this._nodes_dom_container.style.msTransform=c,this._nodes_dom_container.style.transform=c}),n.on("position bounds","node",s=>{let l=s.target,o=l.id();if(!this._node_dom[o])return;let c=this._node_dom[o],h=`translate(-50%, -50%) translate(${l.position("x").toFixed(2)}px, ${l.position("y").toFixed(2)}px)`;c.style.webkitTransform=h,c.style.msTransform=h,c.style.transform=h,c.style.display="inline",c.style.position="absolute",c.style["z-index"]=10})}_add_node(n){let i=n.data();i.dom&&(i.skip_node_append!==!0&&this._nodes_dom_container.appendChild(i.dom),i.dom.__cy_id=n.id(),this._node_dom[n.id()]=i.dom,this._resize_observer.observe(i.dom))}node_dom(n){return this._node_dom[n]}}function e(r){r&&r("core","domNode",function(n,i){return new t(this,n,i)})}return typeof cytoscape<"u"&&e(cytoscape),dC=e,dC}var lre=sre();const ore=ST(lre),xE=to;xE.use(are);xE.use(ore);const b4=.12,jn=24;function x4(t,e,r,n,i,a,s){const l=s.left+n.x*i+a.x,o=s.top+n.y*i+a.y,c=r.offsetWidth>0?r.offsetWidth/2:140,h=r.offsetHeight>0?r.offsetHeight/2:80;return t>=l-c*i&&t<=l+c*i&&e>=o-h*i&&e<=o+h*i}function pC(t,e=!1){const r=t==="dark"?"#94a3b8":"#64748b";return[{selector:"node",style:{shape:"rectangle","background-opacity":e?.85:0,"background-color":e?"data(typeColor)":"#000","border-width":e?1:0,"border-color":e?t==="dark"?"#ffffff33":"#00000022":"#000",width:280,height:160}},{selector:"edge.er-edge",style:{"curve-style":"round-taxi","line-color":r,"target-arrow-shape":"none","source-arrow-shape":"none",width:2,label:"data(label)","font-size":10,"font-weight":600,color:r,"text-background-color":t==="dark"?"#1e293b":"#ffffff","text-background-opacity":.9,"text-background-padding":"2px"}},{selector:"edge.er-edge.highlighted",style:{"line-color":"#84cc16",width:3,"overlay-color":"#84cc16","overlay-opacity":.15,"overlay-padding":4}},{selector:"edge.er-edge:selected",style:{"line-color":"#84cc16",width:4,"overlay-color":"#84cc16","overlay-opacity":.25,"overlay-padding":6}},{selector:"edge.er-edge.path-highlighted",style:{"line-color":"#3b82f6",width:6}},{selector:"edge.lineage-edge",style:{"curve-style":"bezier","line-style":"dashed","line-color":"#3b82f6","target-arrow-color":"#3b82f6","target-arrow-shape":"triangle","arrow-scale":1.2,width:2}},{selector:"edge.lineage-edge.highlighted",style:{"line-color":"#f97316","target-arrow-color":"#f97316",width:3,"overlay-color":"#f97316","overlay-opacity":.15,"overlay-padding":4}},{selector:"edge.lineage-edge:selected",style:{"line-color":"#f97316","target-arrow-color":"#f97316",width:4,"overlay-color":"#f97316","overlay-opacity":.2,"overlay-padding":6}},{selector:"edge.lineage-edge.path-highlighted",style:{width:6,"line-color":"#f97316","target-arrow-color":"#f97316"}},{selector:"edge.dimmed",style:{opacity:.1}}]}function l6(t,e,r){if(t.length===0)return{x1:0,y1:0,x2:0,y2:0,w:0,h:0};let n=1/0,i=1/0,a=-1/0,s=-1/0;return t.forEach(l=>{const o=l.position(),c=l.data("dom"),h=l.id(),d=r.layout?.[h],g=c&&c.offsetWidth>0?c.offsetWidth:d?.width??280,m=c&&c.offsetHeight>0?c.offsetHeight:d?.height??160,y=g/2,b=m/2;o.x-y<n&&(n=o.x-y),o.x+y>a&&(a=o.x+y),o.y-b<i&&(i=o.y-b),o.y+b>s&&(s=o.y+b)}),{x1:n,y1:i,x2:a,y2:s,w:a-n,h:s-i}}function Xp(t,e,r){if(!e.domains?.length){r.innerHTML="";return}const n=t.zoom(),i=t.pan(),a=new Map;r.querySelectorAll("[data-domain-bg]").forEach(l=>{a.set(l.dataset.domainBg,l)});const s=new Set;e.domains.forEach(l=>{s.add(l.id);const o=t.nodes().filter(O=>l.tables.includes(O.id())),c=e.layout?.[l.id],h=Math.max(24,32*n),d=jn+h/n;let g,m,y,b;if(o.length===0){const O=c?.x??0,N=c?.y??0,B=c?.width??300,D=c?.height??120;g=(O-jn)*n+i.x,m=(N-d)*n+i.y,y=(B+jn*2)*n,b=(D+jn+d)*n}else{const O=l6(o,n,e),N=c?.width??0,B=c?.height??0,D=Math.max(O.w,N),_=Math.max(O.h,B),P=O.x1+O.w/2,z=O.y1+O.h/2;g=(P-D/2-jn)*n+i.x,m=(z-_/2-d)*n+i.y,y=(D+jn*2)*n,b=(_+jn+d)*n}const x=o.length===0?`${l.name} (empty)`:l.name,w=`${Math.max(10,12*n)}px`,S=l.color??"rgba(99,102,241,0.07)",k=l.color||"rgba(99,102,241,1)",E=k.replace(/[\d.]+\)$/,"0.8)"),M=k.replace(/[\d.]+\)$/,"0.4)"),R=a.get(l.id);if(R){R.style.left=`${g}px`,R.style.top=`${m}px`,R.style.width=`${y}px`,R.style.height=`${b}px`,R.style.background=S,R.style.border=`2px solid ${M}`;const O=R.firstElementChild;O&&(O.textContent=x,O.style.fontSize=w,O.style.height=`${h}px`,O.style.background=E)}else{const O=document.createElement("div");O.dataset.domainBg=l.id,O.style.cssText=`
361
+ position: absolute;
362
+ left: ${g}px;
363
+ top: ${m}px;
364
+ width: ${y}px;
365
+ height: ${b}px;
366
+ background: ${S};
367
+ border: 2px solid ${M};
368
+ border-radius: 12px;
369
+ pointer-events: none;
370
+ `;const N=document.createElement("div");N.textContent=x,N.style.cssText=`
371
+ position: absolute;
372
+ top: 0;
373
+ left: 0;
374
+ width: 100%;
375
+ height: ${h}px;
376
+ background: ${E};
377
+ color: white;
378
+ border-radius: 10px 10px 0 0;
379
+ padding: 0 12px;
380
+ font-size: ${w};
381
+ font-weight: 800;
382
+ display: flex;
383
+ align-items: center;
384
+ text-shadow: 0 1px 2px rgba(0,0,0,0.2);
385
+ pointer-events: none;
386
+ white-space: nowrap;
387
+ overflow: hidden;
388
+ `,O.appendChild(N),r.appendChild(O)}}),a.forEach((l,o)=>{s.has(o)||l.remove()})}function gC(t,e,r,n,i,a,s){if(!e.domains?.length){r.innerHTML="";return}const l=t.zoom(),o=t.pan(),c=new Map;r.querySelectorAll("[data-domain-handle]").forEach(d=>{c.set(d.dataset.domainHandle,d)});const h=new Set;e.domains.forEach(d=>{h.add(d.id);const g=t.nodes().filter(M=>d.tables.includes(M.id())),m=e.layout?.[d.id],y=Math.max(24,32*l),b=jn+y/l;let x,w,S;if(g.length===0){const M=m?.x??0,R=m?.y??0,O=m?.width??300;x=(M-jn)*l+o.x,w=(R-b)*l+o.y,S=(O+jn*2)*l}else{const M=l6(g,l,e),R=m?.width??0,O=Math.max(M.w,R),N=M.x1+M.w/2,B=M.y1+M.h/2,D=Math.max(M.h,m?.height??0);x=(N-O/2-jn)*l+o.x,w=(B-D/2-b)*l+o.y,S=(O+jn*2)*l}const k=c.get(d.id);if(k){k.style.left=`${x}px`,k.style.top=`${w}px`,k.style.width=`${S}px`,k.style.height=`${y}px`;return}const E=document.createElement("div");E.dataset.domainHandle=d.id,E.style.cssText=`
389
+ position: absolute;
390
+ left: ${x}px;
391
+ top: ${w}px;
392
+ width: ${S}px;
393
+ height: ${y}px;
394
+ cursor: grab;
395
+ user-select: none;
396
+ pointer-events: auto;
397
+ border-radius: 12px 12px 0 0;
398
+ `,E.addEventListener("mousedown",M=>{M.preventDefault(),M.stopPropagation();const R=M.clientX,O=M.clientY,N=parseFloat(E.style.left),B=parseFloat(E.style.top),_=pt.getState().schema?.domains?.find(te=>te.id===d.id);if(!_)return;const P=t.nodes().filter(te=>_.tables.includes(te.id())),z=new Map;P.forEach(te=>{const I=te.position();z.set(te.id(),{x:I.x,y:I.y})});const H=n.querySelector(`[data-domain-bg="${d.id}"]`);let $=0,q=0,V=!1;const X=te=>{const I=te.clientX-R,G=te.clientY-O;if((Math.abs(I)>2||Math.abs(G)>2)&&(V=!0,E.style.cursor="grabbing"),!V)return;const re=t.zoom();$=I/re,q=G/re,P.forEach(Z=>{const ie=z.get(Z.id());Z.position({x:ie.x+$,y:ie.y+q})});const Y=N+I,W=B+G;E.style.left=`${Y}px`,E.style.top=`${W}px`,H&&(H.style.left=`${Y}px`,H.style.top=`${W}px`),P.length>0&&Xp(t,pt.getState().schema,n)},ee=()=>{E.style.cursor="grab",window.removeEventListener("mousemove",X),window.removeEventListener("mouseup",ee),V?a(d.id,$,q,N,B):s(d.id)};window.addEventListener("mousemove",X),window.addEventListener("mouseup",ee)}),r.appendChild(E)}),c.forEach((d,g)=>{h.has(g)||d.remove()})}function fp(t,e,r,n,i,a,s){if(r.innerHTML="",!e.annotations?.length)return;const l=t.zoom(),o=t.pan();e.annotations.forEach(c=>{let h,d;if(c.targetId){const b=t.getElementById(c.targetId);if(b.length===0)return;const x=b.position();h=(x.x+c.offset.x)*l+o.x,d=(x.y+c.offset.y)*l+o.y}else h=c.offset.x*l+o.x,d=c.offset.y*l+o.y;const g=s===c.id,m=c.color??(n==="dark"?"#1e293b":"#fef9c3"),y=document.createElement("div");y.style.cssText=`
399
+ position: absolute;
400
+ left: ${h}px;
401
+ top: ${d}px;
402
+ min-width: ${120*l}px;
403
+ max-width: ${240*l}px;
404
+ padding: ${8*l}px ${12*l}px;
405
+ background: ${m};
406
+ border: ${g?"2px solid #3b82f6":"1px solid rgba(0,0,0,0.1)"};
407
+ border-radius: ${8*l}px;
408
+ font-size: ${12*l}px;
409
+ line-height: 1.4;
410
+ cursor: grab;
411
+ box-shadow: ${g?"0 0 0 3px rgba(59,130,246,0.3)":"0 2px 8px rgba(0,0,0,0.12)"};
412
+ white-space: pre-wrap;
413
+ user-select: none;
414
+ pointer-events: auto;
415
+ `,y.textContent=c.text,y.addEventListener("mousedown",b=>{b.preventDefault(),b.stopPropagation();const x=b.clientX,w=b.clientY,S=c.offset.x,k=c.offset.y;let E=!1;const M=O=>{const N=O.clientX-x,B=O.clientY-w;(Math.abs(N)>3||Math.abs(B)>3)&&(E=!0,y.style.cursor="grabbing"),E&&(y.style.left=h+N+"px",y.style.top=d+B+"px")},R=O=>{if(y.style.cursor="grab",window.removeEventListener("mousemove",M),window.removeEventListener("mouseup",R),!E)a(c.id);else{const N=t.zoom(),B=(O.clientX-x)/N,D=(O.clientY-w)/N;i(c.id,{x:S+B,y:k+D})}};window.addEventListener("mousemove",M),window.addEventListener("mouseup",R)}),r.appendChild(y)})}function ure({onNodeClick:t,onEdgeClick:e,onPaneClick:r,onAnnotationClick:n,onDomainClick:i,onAddTableAt:a,onAddDomainAt:s,onAddAnnotationAt:l,onFitView:o,onFocusNode:c,onEdgeCreated:h,onAutoLayout:d}){const{schema:g,selectedTableId:m,selectedTableIds:y,selectedAnnotationId:b,highlightedNodeIds:x,pathFinderResult:w,isPresentationMode:S,showER:k,showLineage:E,showAnnotations:M,isCompactMode:R,theme:O,hoveredColumnId:N,updateNodePosition:B,updateAnnotation:D,connectMode:_}=pt(so(ke=>({schema:ke.schema,selectedTableId:ke.selectedTableId,selectedTableIds:ke.selectedTableIds,selectedAnnotationId:ke.selectedAnnotationId,highlightedNodeIds:ke.highlightedNodeIds,pathFinderResult:ke.pathFinderResult,isPresentationMode:ke.isPresentationMode,showER:ke.showER,showLineage:ke.showLineage,showAnnotations:ke.showAnnotations,isCompactMode:ke.isCompactMode,theme:ke.theme,hoveredColumnId:ke.hoveredColumnId,updateNodePosition:ke.updateNodePosition,updateAnnotation:ke.updateAnnotation,connectMode:ke.connectMode}))),P=ve.useRef(null),z=ve.useRef(null),H=ve.useRef(null),$=ve.useRef(null),q=ve.useRef(null),V=ve.useRef(null),X=ve.useRef(new Map),ee=ve.useRef(new Map),te=ve.useRef(1),I=ve.useRef(!1),G=ve.useRef(null),re=ve.useRef(null),Y=ve.useRef([]),W=ve.useRef([]),Z=ve.useRef(null),ie=ve.useRef(null),we=ve.useRef(!1),de=ve.useRef(O),se=ve.useRef(null),j=ve.useRef(R),Q=ve.useRef(null),K=ve.useRef(M),ue=ve.useRef(null),Se=ve.useRef(t),at=ve.useRef(h);ve.useEffect(()=>{K.current=M},[M]),ve.useEffect(()=>{Se.current=t},[t]),ve.useEffect(()=>{at.current=h},[h]);const Me=ve.useCallback(()=>{G.current!==null&&cancelAnimationFrame(G.current),G.current=requestAnimationFrame(()=>{G.current=null;const ke=H.current;if(!ke||I.current)return;const De=te.current,Be=ke.extent(),Ke=400;ke.nodes().forEach(Oe=>{const Re=Oe.data("table");if(!Re)return;const ce=Oe.id(),F=X.current.get(ce);if(!F)return;const J=Oe.position();if(J.x<Be.x1-Ke||J.x>Be.x2+Ke||J.y<Be.y1-Ke||J.y>Be.y2+Ke)return;const oe=re.current===ce||Y.current.includes(ce),le=Z.current===ce,he=W.current.includes(ce),be=(W.current.length>0||we.current)&&!oe&&!he&&!le,ze=pt.getState().connectMode,Le=ie.current===ce,Pe=!!ze;F.render(A.jsx(cG,{table:Re,isSelected:oe,isDimmed:be,isHighlighted:he,isHovered:le,isPendingSource:Le,isConnectMode:Pe,zoom:De,theme:de.current,hoveredColumnId:se.current,isCompact:j.current}))})})},[]),He=ve.useCallback((ke,De,Be,Ke,Oe)=>{const{schema:Re,updateNodesPosition:ce}=pt.getState();if(!Re)return;const F=Re.domains?.find(Pe=>Pe.id===ke);if(!F)return;const J=H.current;if(!J)return;const oe=[],le=J.zoom(),he=J.pan(),_e=(Ke+De*le-he.x)/le,be=(Oe+Be*le-he.y)/le,ze=Math.max(24,32*le),Le=jn+ze/le;oe.push({id:ke,x:Math.round(_e+jn),y:Math.round(be+Le)}),F.tables.forEach(Pe=>{const Ye=J.getElementById(Pe);if(Ye&&Ye.length>0){const et=Ye.position();oe.push({id:Pe,x:Math.round(et.x),y:Math.round(et.y)})}}),ce(oe)},[]),$e=ve.useRef(He);ve.useEffect(()=>{$e.current=He},[He]);const Ne=ve.useRef(i);ve.useEffect(()=>{Ne.current=i},[i]);const Ge=ve.useCallback((ke,De)=>{D(ke,{offset:De})},[D]),Ve=ve.useRef(Ge);ve.useEffect(()=>{Ve.current=Ge},[Ge]);const Qe=ve.useRef(n);ve.useEffect(()=>{Qe.current=n},[n]);const je=ve.useRef(b);ve.useEffect(()=>{je.current=b;const ke=H.current;!ke||!q.current||!Q.current||!M||fp(ke,Q.current,q.current,de.current,Ve.current,Qe.current,b)},[b,M]),ve.useEffect(()=>{if(!P.current||H.current)return;const ke=P.current;ke.style.position="relative";const De=document.createElement("div");De.style.cssText="position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;overflow:hidden;z-index:0;",ke.insertBefore(De,ke.firstChild),$.current=De;const Be=document.createElement("div");Be.style.cssText="position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;overflow:hidden;z-index:20;";const Ke=document.createElement("div");Ke.style.cssText="position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;overflow:hidden;z-index:25;",ke.appendChild(Be),q.current=Be,ke.appendChild(Ke),V.current=Ke;const Oe=xE({container:ke,elements:[],style:pC(de.current),minZoom:.05,maxZoom:3,wheelSensitivity:1,boxSelectionEnabled:!0,userZoomingEnabled:!0,userPanningEnabled:!0});H.current=Oe,te.current=Oe.zoom(),window.__modscapeCy=Oe,Oe.domNode(),Oe.on("tap","node",J=>{const oe=J.target.id(),le=pt.getState().connectMode;if(le){const he=ie.current;he?he===oe?(ie.current=null,Me()):(h(le,he,oe),ie.current=null):(ie.current=oe,Me());return}t(oe)}),Oe.on("tap","edge",J=>{const oe=J.target.data();e({id:J.target.id(),kind:oe.kind,source:oe.source,target:oe.target,fromColumn:oe.fromColumn,toColumn:oe.toColumn,relType:oe.relType})}),Oe.on("tap",J=>{J.target===Oe&&r()}),Oe.on("dragfree","node",J=>{const oe=J.target.position();B(J.target.id(),oe.x,oe.y)}),Oe.on("mouseover","node",J=>{if(pt.getState().connectMode)return;const oe=J.target;Z.current=oe.id();const _e=oe.connectedEdges().connectedNodes().not(oe).map(be=>be.id());pt.getState().setHighlightedNodeIds(_e)}),Oe.on("mouseout","node",()=>{pt.getState().connectMode||(Z.current=null,pt.getState().setHighlightedNodeIds([]))});let Re=null;Oe.on("boxselect","node",()=>{Re&&clearTimeout(Re),Re=setTimeout(()=>{Re=null;const J=Oe.nodes(":selected").map(oe=>oe.id());pt.getState().setSelectedTableIds(J)},50)});const ce=()=>{$.current&&Q.current&&Xp(Oe,Q.current,$.current),V.current&&$.current&&Q.current&&gC(Oe,Q.current,V.current,$.current,de.current,$e.current,Ne.current),q.current&&Q.current&&K.current&&fp(Oe,Q.current,q.current,de.current,Ve.current,Qe.current,je.current)};Oe.on("pan zoom",ce),Oe.on("drag","node",ce),Oe.on("zoom",()=>{const J=Oe.zoom(),oe=I.current,le=J<b4;te.current=J,I.current=le,oe!==le&&Oe.style(pC(de.current,le)),le||Me()}),Oe.on("pan",Me);const F=J=>{if(!J.shiftKey||J.button!==0)return;J.stopPropagation(),J.preventDefault();const oe=J.clientX,le=J.clientY,he=ke.getBoundingClientRect();let _e=!1,be=null;const ze=Pe=>{const Ye=Pe.clientX-oe,et=Pe.clientY-le;if(!_e&&Math.abs(Ye)+Math.abs(et)<4)return;_e=!0,be||(be=document.createElement("div"),be.style.cssText="position:absolute;border:2px dashed #3b82f6;background:rgba(59,130,246,0.1);pointer-events:none;z-index:100;",ke.appendChild(be));const Ie=Math.min(oe,Pe.clientX)-he.left,nt=Math.min(le,Pe.clientY)-he.top,rt=Math.abs(Pe.clientX-oe),ct=Math.abs(Pe.clientY-le);be.style.left=`${Ie}px`,be.style.top=`${nt}px`,be.style.width=`${rt}px`,be.style.height=`${ct}px`},Le=Pe=>{document.removeEventListener("mousemove",ze),document.removeEventListener("mouseup",Le),be&&be.parentNode&&be.parentNode.removeChild(be);const Ye=H.current;if(Ye)if(_e){const et=Math.min(oe,Pe.clientX)-he.left,Ie=Math.min(le,Pe.clientY)-he.top,nt=Math.max(oe,Pe.clientX)-he.left,rt=Math.max(le,Pe.clientY)-he.top,ct=Ye.zoom(),Ze=Ye.pan(),vt=[];Ye.nodes().forEach(wt=>{const Mt=wt.position(),Ft=Mt.x*ct+Ze.x,Ut=Mt.y*ct+Ze.y;Ft>=et&&Ft<=nt&&Ut>=Ie&&Ut<=rt&&vt.push(wt.id())}),pt.getState().setSelectedTableIds(vt)}else{const et=Ye.zoom(),Ie=Ye.pan();let nt=null;if(ee.current.forEach((rt,ct)=>{if(nt)return;const Ze=Ye.getElementById(ct);!Ze||Ze.length===0||x4(oe,le,rt,Ze.position(),et,Ie,he)&&(nt=ct)}),nt){const{selectedTableIds:rt,setSelectedTableIds:ct}=pt.getState(),Ze=rt.includes(nt)?rt.filter(vt=>vt!==nt):[...rt,nt];ct(Ze)}}};document.addEventListener("mousemove",ze),document.addEventListener("mouseup",Le)};return ke.addEventListener("mousedown",F,!0),()=>{ke.removeEventListener("mousedown",F,!0),X.current.forEach(J=>J.unmount()),X.current.clear(),Oe.destroy(),H.current=null}},[]),ve.useEffect(()=>{const ke=H.current;if(!ke||!g)return;Q.current=g;const De=ue.current,Be=De!==null&&g.tables===De.tables&&(g.lineage??null)===(De.lineage??null)&&(g.relationships??null)===(De.relationships??null)&&(g.domains??null)===(De.domains??null)&&(g.annotations??null)===(De.annotations??null);if(ue.current={tables:g.tables,lineage:g.lineage,relationships:g.relationships,domains:g.domains,annotations:g.annotations},Be){g.tables.forEach(ce=>{const F=g.layout?.[ce.id];if(F){const J=ke.getElementById(ce.id);J.length>0&&J.position({x:F.x,y:F.y})}}),ke.edges(".er-edge").style("display",k?"element":"none"),ke.edges(".lineage-edge").style("display",E?"element":"none"),$.current&&Xp(ke,g,$.current),V.current&&$.current&&gC(ke,g,V.current,$.current,O,$e.current,Ne.current),q.current&&(M?fp(ke,g,q.current,O,Ve.current,Qe.current,je.current):q.current.innerHTML=""),Me();return}const Ke=oG(g),Oe=new Set(ke.elements().map(ce=>ce.id())),Re=new Set(Ke.map(ce=>ce.data.id));ke.elements().forEach(ce=>{if(!Re.has(ce.id())){if(ce.isNode()){const F=X.current.get(ce.id());F&&(F.unmount(),X.current.delete(ce.id()));const J=ee.current.get(ce.id());J&&J.parentNode&&J.parentNode.removeChild(J),ee.current.delete(ce.id())}ce.remove()}}),Ke.forEach(ce=>{const F=ce.data.id;if(Oe.has(F)){const J=ke.getElementById(F);J.data(ce.data),ce.position&&J.position(ce.position)}else{const J=!!ce.data.table;let oe=null,le=ce;if(J&&(oe=document.createElement("div"),oe.style.cssText="position:absolute;box-sizing:border-box;min-width:220px;",oe.addEventListener("mousedown",he=>{if(he.button!==0)return;const _e=H.current,be=_e?.getElementById(F);if(!be||be.length===0)return;const ze=P.current?.getBoundingClientRect();if(!ze||!x4(he.clientX,he.clientY,oe,be.position(),_e.zoom(),_e.pan(),ze)||he.shiftKey)return;he.stopPropagation(),he.preventDefault();const Le=he.clientX,Pe=he.clientY;let Ye=!1;const et=pt.getState().selectedTableIds,Ie=et.length>1&&et.includes(F),nt=new Map;Ie?et.forEach(Ze=>{const vt=_e?.getElementById(Ze);vt&&vt.length>0&&nt.set(Ze,{...vt.position()})}):nt.set(F,{...be.position()});const rt=Ze=>{const vt=Ze.clientX-Le,wt=Ze.clientY-Pe;(Math.abs(vt)>4||Math.abs(wt)>4)&&(Ye=!0);const Mt=H.current?.zoom()??1,Ft=vt/Mt,Ut=wt/Mt;nt.forEach((Zr,nr)=>{const hn=H.current?.getElementById(nr);hn&&hn.length>0&&hn.position({x:Zr.x+Ft,y:Zr.y+Ut})})},ct=()=>{if(window.removeEventListener("mousemove",rt),window.removeEventListener("mouseup",ct),Ye)if(Ie){const Ze=Array.from(nt.keys()).map(vt=>{const Mt=(H.current?.getElementById(vt)).position();return{id:vt,x:Mt.x,y:Mt.y}});pt.getState().updateNodesPosition(Ze)}else{const Ze=be.position();pt.getState().updateNodePosition(F,Ze.x,Ze.y)}else{const{connectMode:Ze}=pt.getState();if(Ze){const vt=ie.current;vt?vt===F?(ie.current=null,Me()):(at.current(Ze,vt,F),ie.current=null,Me()):(ie.current=F,Me())}else Se.current(F)}};window.addEventListener("mousemove",rt),window.addEventListener("mouseup",ct)}),le={...ce,data:{...ce.data,dom:oe}}),ke.add(le),J&&oe){const he=AI.createRoot(oe);X.current.set(F,he),ee.current.set(F,oe)}}}),ke.edges(".er-edge").style("display",k?"element":"none"),ke.edges(".lineage-edge").style("display",E?"element":"none"),$.current&&Xp(ke,g,$.current),V.current&&$.current&&gC(ke,g,V.current,$.current,O,$e.current,Ne.current),q.current&&(M?fp(ke,g,q.current,O,Ve.current,Qe.current,je.current):q.current.innerHTML=""),Me()},[g,k,E,M,O,Me]),ve.useEffect(()=>{j.current=R,Me()},[R,Me]),ve.useEffect(()=>{re.current=m,Y.current=y,W.current=x,we.current=S,de.current=O,se.current=N;const ke=H.current;if(ke){if(w){const De=new Set(w.edgeIds);ke.edges().forEach(Be=>{De.has(Be.id())?(Be.addClass("path-highlighted"),Be.removeClass("dimmed highlighted")):(Be.addClass("dimmed"),Be.removeClass("path-highlighted highlighted"))})}else ke.edges().forEach(De=>{De.removeClass("path-highlighted dimmed"),m&&(De.source().id()===m||De.target().id()===m)?De.addClass("highlighted"):De.removeClass("highlighted")});Me()}},[m,y,x,S,w,O,N,Me]),ve.useEffect(()=>{const ke=H.current;ke&&ke.style(pC(O,te.current<b4))},[O]),ve.useEffect(()=>{_?(Z.current=null,W.current=[]):ie.current=null,Me()},[_,Me]),ve.useEffect(()=>{const ke=()=>{const De=H.current;if(!De)return;De.fit(void 0,40);const Be=.3;De.zoom()<Be&&(De.zoom(Be),De.center(De.elements()))};o(ke),window.__modscapeFitView=ke},[o]),ve.useEffect(()=>{d(()=>{const ke=H.current;if(!ke)return;const De=Q.current;if(!De)return;ke.nodes().forEach(Ke=>{const Oe=Ke.data("dom");Oe&&Oe.offsetHeight>0&&Ke.style("height",Oe.offsetHeight)});const Be=ke.layout({name:"dagre",rankDir:"LR",nodeSep:80,rankSep:200,padding:80,fit:!1});Be.on("layoutstop",()=>{ke.nodes().forEach(le=>le.removeStyle("height"));const Ke=new Map;ke.nodes().forEach(le=>{const he=le.id();De.tables.some(_e=>_e.id===he)&&Ke.set(he,{...le.position()})});const Oe={},Re=48,ce=280,F=40,J=le=>ke.getElementById(le).data("dom")?.offsetHeight??220;De.domains?.forEach(le=>{const he=le.tables.filter(ct=>Ke.has(ct));if(he.length===0)return;he.sort((ct,Ze)=>Ke.get(ct).x-Ke.get(Ze).x);const _e=Math.min(3,Math.ceil(Math.sqrt(he.length))),be=Math.ceil(he.length/_e),ze=Array.from({length:be},(ct,Ze)=>{let vt=0;for(let wt=0;wt<_e;wt++){const Mt=he[Ze*_e+wt];Mt&&(vt=Math.max(vt,J(Mt)))}return vt}),Le=_e*(ce+F)-F,Pe=ze.reduce((ct,Ze)=>ct+Ze+F,0)-F,Ye=he.reduce((ct,Ze)=>ct+Ke.get(Ze).x,0)/he.length,et=he.reduce((ct,Ze)=>ct+Ke.get(Ze).y,0)/he.length,Ie=Ye-Le/2,nt=et-Pe/2;he.forEach((ct,Ze)=>{const vt=Ze%_e,wt=Math.floor(Ze/_e),Mt=vt*(ce+F)+ce/2,Ft=ze.slice(0,wt).reduce((Ut,Zr)=>Ut+Zr+F,0)+ze[wt]/2;Oe[ct]={x:Math.round(Ie+Mt),y:Math.round(nt+Ft),parentId:le.id}});const rt=28;Oe[le.id]={x:Math.round(Ie-Re),y:Math.round(nt-Re-rt),width:Math.round(Le+Re*2),height:Math.round(Pe+Re*2+rt),isLocked:De.layout?.[le.id]?.isLocked}});const oe=new Set(De.domains?.flatMap(le=>le.tables)??[]);De.tables.forEach(le=>{if(!oe.has(le.id)&&Ke.has(le.id)){const he=Ke.get(le.id);Oe[le.id]={x:Math.round(he.x),y:Math.round(he.y)}}}),pt.getState().applyLayout(Oe),setTimeout(()=>{const le=H.current;if(!le)return;le.fit(void 0,40);const he=.3;le.zoom()<he&&(le.zoom(he),le.center(le.elements()))},300)}),Be.run()})},[d]),ve.useEffect(()=>{c(ke=>{const De=H.current;if(!De)return;const Be=De.getElementById(ke);Be.length!==0&&De.animate({fit:{eles:Be,padding:120},duration:800,easing:"ease-in-out"})})},[c]),ve.useEffect(()=>{const ke=z.current,De=H.current;if(!ke||!De)return;const Be=ke.width,Ke=ke.height,Oe=6,Re=()=>{const ce=ke.getContext("2d");if(!ce)return;ce.clearRect(0,0,Be,Ke);const F=De.nodes();if(F.length===0)return;const J=F.boundingBox({});if(J.w===0||J.h===0)return;const oe=Math.min((Be-Oe*2)/J.w,(Ke-Oe*2)/J.h),le=Oe+(Be-Oe*2-J.w*oe)/2,he=Oe+(Ke-Oe*2-J.h*oe)/2,_e=rt=>(rt-J.x1)*oe+le,be=rt=>(rt-J.y1)*oe+he;F.forEach(rt=>{const ct=rt.position(),Ze=rt.data("typeColor")||"#64748b",vt=280*oe,wt=160*oe;ce.fillStyle=Ze,ce.globalAlpha=.85,ce.beginPath(),ce.roundRect(_e(ct.x)-vt/2,be(ct.y)-wt/2,vt,wt,2),ce.fill()}),ce.globalAlpha=1;const ze=De.zoom(),Le=De.pan(),Pe=De.container(),Ye=_e(-Le.x/ze),et=be(-Le.y/ze),Ie=_e((Pe.offsetWidth-Le.x)/ze),nt=be((Pe.offsetHeight-Le.y)/ze);ce.strokeStyle="#3b82f6",ce.lineWidth=1.5,ce.globalAlpha=.9,ce.strokeRect(Ye,et,Ie-Ye,nt-et),ce.fillStyle="#3b82f6",ce.globalAlpha=.1,ce.fillRect(Ye,et,Ie-Ye,nt-et),ce.globalAlpha=1};return De.on("pan zoom add remove move data",Re),Re(),()=>{De.removeListener("pan zoom add remove move data",Re)}},[g]);const dt=ve.useCallback((ke,De)=>{const Be=H.current;if(!Be)return{x:0,y:0};const Ke=Be.pan(),Oe=Be.zoom();return{x:(ke-Ke.x)/Oe,y:(De-Ke.y)/Oe}},[]);return ve.useEffect(()=>{const ke=De=>{const Be=document.activeElement;if(Be?.tagName==="INPUT"||Be?.tagName==="TEXTAREA"||Be?.isContentEditable||Be?.closest(".cm-editor")||Be?.closest(".sidebar-content")||De.repeat)return;const Oe=De.key.toLowerCase();if(Oe==="c"){De.preventDefault();const{connectMode:Re,setConnectMode:ce}=pt.getState();ce(Re==="lineage"?null:"lineage");return}if(Oe==="t"||Oe==="d"||Oe==="s"){De.preventDefault();const Re=dt(window.innerWidth/2,window.innerHeight/2);Oe==="t"?a(Re.x-160,Re.y-125):Oe==="d"?s(Re.x-300,Re.y-200):l(Re.x-60,Re.y-40);return}if(De.key.startsWith("Arrow")){const Re=H.current;if(!Re)return;const ce=100,F=Re.pan();De.key==="ArrowUp"?Re.pan({x:F.x,y:F.y+ce}):De.key==="ArrowDown"?Re.pan({x:F.x,y:F.y-ce}):De.key==="ArrowLeft"?Re.pan({x:F.x+ce,y:F.y}):De.key==="ArrowRight"&&Re.pan({x:F.x-ce,y:F.y})}};return window.addEventListener("keydown",ke),()=>window.removeEventListener("keydown",ke)},[dt,a,s,l]),A.jsxs("div",{style:{width:"100%",height:"100%",position:"relative"},children:[A.jsx("div",{ref:P,style:{width:"100%",height:"100%"}}),A.jsx("canvas",{ref:z,width:140,height:90,style:{position:"absolute",bottom:48,right:16,width:140,height:90,borderRadius:6,border:`1px solid ${O==="dark"?"#334155":"#e2e8f0"}`,background:O==="dark"?"#0f172a":"#f8fafc",boxShadow:"0 2px 8px rgba(0,0,0,0.2)",zIndex:20,pointerEvents:"none"}})]})}const o6=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim();const cre=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const fre=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,r,n)=>n?n.toUpperCase():r.toLowerCase());const w4=t=>{const e=fre(t);return e.charAt(0).toUpperCase()+e.slice(1)};var hre={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const dre=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1};const pre=ve.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:i="",children:a,iconNode:s,...l},o)=>ve.createElement("svg",{ref:o,...hre,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:o6("lucide",i),...!a&&!dre(l)&&{"aria-hidden":"true"},...l},[...s.map(([c,h])=>ve.createElement(c,h)),...Array.isArray(a)?a:[a]]));const gt=(t,e)=>{const r=ve.forwardRef(({className:n,...i},a)=>ve.createElement(pre,{ref:a,iconNode:e,className:o6(`lucide-${cre(w4(t))}`,`lucide-${t}`,n),...i}));return r.displayName=w4(t),r};const gre=[["rect",{width:"6",height:"14",x:"2",y:"5",rx:"2",key:"dy24zr"}],["rect",{width:"6",height:"10",x:"16",y:"7",rx:"2",key:"13zkjt"}],["path",{d:"M12 2v20",key:"t6zp3m"}]],vre=gt("align-horizontal-justify-center",gre);const mre=[["rect",{width:"14",height:"6",x:"5",y:"16",rx:"2",key:"1i8z2d"}],["rect",{width:"10",height:"6",x:"7",y:"2",rx:"2",key:"ypihtt"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],yre=gt("align-vertical-justify-center",mre);const bre=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],xre=gt("arrow-right",bre);const wre=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],Wp=gt("arrow-up-right",wre);const Sre=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],u6=gt("check",Sre);const Cre=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ha=gt("chevron-down",Cre);const kre=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],c6=gt("chevron-left",kre);const Tre=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Eg=gt("chevron-right",Tre);const Ere=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Are=gt("chevron-up",Ere);const Ore=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Qp=gt("circle-alert",Ore);const Mre=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Rre=gt("circle-check",Mre);const Dre=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],f6=gt("circle-question-mark",Dre);const _re=[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]],h6=gt("command",_re);const Nre=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],Bre=gt("cpu",Nre);const Lre=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],Hl=gt("database",Lre);const Pre=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],zre=gt("file-text",Pre);const Ire=[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v6",key:"158jrl"}],["circle",{cx:"5",cy:"18",r:"3",key:"104gr9"}],["path",{d:"M12 3v18",key:"108xh3"}],["circle",{cx:"19",cy:"6",r:"3",key:"108a5v"}],["path",{d:"M16 15.7A9 9 0 0 0 19 9",key:"1e3vqb"}]],wE=gt("git-graph",Ire);const qre=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],jre=gt("grid-3x3",qre);const Fre=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],SE=gt("info",Fre);const Hre=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],Vre=gt("layers",Hre);const Ure=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],S4=gt("link",Ure);const $re=[["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"M3 10a2 2 0 0 0 2 2h3",key:"1npucw"}],["path",{d:"M3 5v12a2 2 0 0 0 2 2h3",key:"x1gjn2"}]],Gre=gt("list-tree",$re);const Yre=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Xre=gt("loader-circle",Yre);const Wre=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],Qre=gt("maximize",Wre);const Kre=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],d6=gt("message-square",Kre);const Zre=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],Jre=gt("moon",Zre);const ene=[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",key:"edeuup"}]],tne=gt("mouse-pointer-2",ene);const rne=[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]],nne=gt("move",rne);const ine=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],Sk=gt("network",ine);const ane=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]],p6=gt("panels-top-left",ane);const sne=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],lne=gt("play",sne);const one=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Gf=gt("plus",one);const une=[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]],cne=gt("redo-2",une);const fne=[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]],hne=gt("route",fne);const dne=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Tu=gt("search",dne);const pne=[["circle",{cx:"19",cy:"5",r:"2",key:"mhkx31"}],["circle",{cx:"5",cy:"19",r:"2",key:"v8kfzx"}],["path",{d:"M5 17A12 12 0 0 1 17 5",key:"1okkup"}]],C4=gt("spline",pne);const gne=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],Ck=gt("sun",gne);const vne=[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]],k4=gt("table",vne);const mne=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],zu=gt("tag",mne);const yne=[["path",{d:"M3 5h18",key:"1u36vt"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 19h18",key:"awlh7x"}]],bne=gt("text-align-justify",yne);const xne=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],T4=gt("trash-2",xne);const wne=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],Sne=gt("undo-2",wne);const Cne=[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]],kne=gt("unlink",Cne);const Tne=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],Ene=gt("workflow",Tne);const Ane=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Oh=gt("x",Ane);const One=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],CE=gt("zap",One),E4={fact:{color:"#f87171",icon:"📊",label:"FACT"},dimension:{color:"#60a5fa",icon:"🏷️",label:"DIM"},hub:{color:"#fbbf24",icon:"🌐",label:"HUB"},link:{color:"#34d399",icon:"🔗",label:"LINK"},satellite:{color:"#a78bfa",icon:"🛰️",label:"SAT"},mart:{color:"#f5700b",icon:"📈",label:"MART"},table:{color:"#64748b",icon:"📋",label:"TABLE"}},Mne=ve.memo(()=>{const{schema:t,getSelectedTable:e,getSelectedDomain:r,getSelectedRelationship:n,getSelectedAnnotation:i,updateTable:a,updateDomain:s,updateRelationship:l,updateAnnotation:o,assignTableToDomain:c,theme:h,isDetailPanelSuppressed:d,isDetailPanelMinimized:g,setIsDetailPanelMinimized:m}=pt(so(j=>({schema:j.schema,getSelectedTable:j.getSelectedTable,getSelectedDomain:j.getSelectedDomain,getSelectedRelationship:j.getSelectedRelationship,getSelectedAnnotation:j.getSelectedAnnotation,updateTable:j.updateTable,updateDomain:j.updateDomain,updateRelationship:j.updateRelationship,updateAnnotation:j.updateAnnotation,assignTableToDomain:j.assignTableToDomain,theme:j.theme,isDetailPanelSuppressed:j.isDetailPanelSuppressed,isDetailPanelMinimized:j.isDetailPanelMinimized,setIsDetailPanelMinimized:j.setIsDetailPanelMinimized,selectedTableId:j.selectedTableId,selectedEdgeId:j.selectedEdgeId,selectedAnnotationId:j.selectedAnnotationId}))),y=e(),b=r(),x=n(),w=i(),[S,k]=ve.useState("conceptual"),[E,M]=ve.useState(""),[R,O]=ve.useState(400),[N,B]=ve.useState(!1);if(ve.useEffect(()=>{if(!N)return;const j=K=>{const ue=window.innerHeight-K.clientY;O(Math.max(150,Math.min(ue,window.innerHeight*.9)))},Q=()=>{B(!1),document.body.style.cursor="default"};return window.addEventListener("mousemove",j),window.addEventListener("mouseup",Q),()=>{window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",Q)}},[N]),d)return null;const D=j=>{j.preventDefault(),B(!0),document.body.style.cursor="ns-resize"},_=j=>{j.stopPropagation()},P={height:`${R}px`,maxHeight:"90vh",minHeight:"150px",backgroundColor:"var(--node-bg)",borderTop:`2px solid ${h==="dark"?"#3b82f6":"#60a5fa"}`,display:"flex",flexDirection:"column",color:"var(--text-primary)",boxShadow:h==="dark"?"0 -10px 25px -5px rgba(0, 0, 0, 0.4)":"0 -4px 12px rgba(0, 0, 0, 0.05)",fontFamily:"sans-serif",position:"relative",transition:"background-color 0.3s, color 0.3s"};if(g){const j=y?.name||b?.name||(x?`${x.relationship.from.table} → ${x.relationship.to.table}`:null)||w?.text?.substring(0,20),Q=!!j;let K=h==="dark"?"#334155":"#e2e8f0";if(y){const ue=y.appearance?.type?E4[y.appearance.type]:null;K=y.appearance?.color||ue?.color||K}else b?K=b.color||K:w&&(K=w.color||"#f59e0b");return A.jsxs("div",{className:`shadow-2xl z-50 flex items-center justify-between px-6 transition-all border-t-2 ${Q?"cursor-pointer hover:bg-slate-50 dark:hover:bg-slate-900":"cursor-default opacity-80"}`,onClick:ue=>{Q&&(ue.stopPropagation(),m(!1))},onMouseDown:_,onPointerDown:_,style:{height:"40px",backgroundColor:"var(--node-bg)",borderColor:K,color:"var(--text-primary)"},children:[A.jsx("div",{className:"flex items-center gap-3 overflow-hidden flex-1",children:A.jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-slate-500 whitespace-nowrap",children:Q?`Selected: ${j}`:"Select an object on the canvas to view its details"})}),A.jsx("div",{className:"flex items-center gap-4",children:Q&&A.jsxs(A.Fragment,{children:[A.jsx("div",{className:"text-[10px] font-medium text-slate-400 italic hidden sm:block",children:"Click to expand"}),A.jsx("button",{className:`p-1 rounded-full transition-colors ${h==="dark"?"hover:bg-slate-800 text-slate-500":"hover:bg-slate-200 text-slate-400"}`,children:A.jsx(Are,{size:18,style:{color:K}})})]})})]})}const z=j=>{a(y.id,j)};if(w)return A.jsxs("div",{className:"shadow-2xl z-50 flex flex-col sidebar-content",onClick:_,onMouseDown:_,onPointerDown:_,style:{...P,borderTopColor:w.color||"#f59e0b"},children:[A.jsx("div",{onMouseDown:D,style:{position:"absolute",top:"-4px",left:0,right:0,height:"8px",cursor:"ns-resize",zIndex:60}}),A.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 20px",borderBottom:"1px solid var(--border-main)",backgroundColor:"var(--header-bg)"},children:[A.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:1},children:[A.jsx(zu,{size:18,style:{color:w.color||"#f59e0b"}}),A.jsxs("div",{style:{flex:1},children:[A.jsx("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:A.jsx("span",{style:{fontSize:"14px",fontWeight:"bold"},children:"Annotation"})}),A.jsx("p",{style:{fontSize:"11px",color:"var(--text-secondary)",textTransform:"uppercase",margin:0},children:w.targetId?`Sticky to ${w.targetId} (${w.targetType})`:"Floating Note"})]})]}),A.jsx("div",{className:"flex items-center gap-1",children:A.jsx("button",{onClick:()=>m(!0),className:`p-1.5 rounded-full transition-colors ${h==="dark"?"hover:bg-slate-800 text-slate-500":"hover:bg-slate-200 text-slate-400"}`,title:"Minimize Details",children:A.jsx(Ha,{size:18})})})]}),A.jsx("div",{style:{flex:1,overflowY:"auto",padding:"20px"},children:A.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"24px"},children:[A.jsxs("section",{children:[A.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Note Content"}),A.jsx("textarea",{value:w.text||"",onChange:j=>o(w.id,{text:j.target.value}),style:{width:"100%",minHeight:"100px",backgroundColor:h==="dark"?"#0f172a":"#ffffff",border:"1px solid var(--border-main)",borderRadius:"6px",padding:"12px",color:"var(--text-primary)",fontSize:"13px",lineHeight:"1.6",resize:"none",outline:"none"}})]}),A.jsxs("div",{className:"grid grid-cols-2 gap-8",children:[A.jsxs("section",{children:[A.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Target Binding"}),A.jsxs("div",{className:"flex flex-col gap-2",children:[A.jsxs("div",{className:"flex gap-2",children:[A.jsxs("select",{value:w.targetId||"",onChange:j=>{const Q=j.target.value;if(Q){const K=t?.tables.some(ue=>ue.id===Q);o(w.id,{targetId:Q,targetType:K?"table":"domain",offset:{x:50,y:-50}})}else{const K=t?.layout?.[w.targetId],ue=K?.parentId?t?.layout?.[K.parentId]:null,Se=(ue?.x??0)+(K?.x??0)+w.offset.x,at=(ue?.y??0)+(K?.y??0)+w.offset.y;o(w.id,{targetId:void 0,targetType:void 0,offset:{x:Se,y:at}})}},className:`flex-1 border rounded text-xs p-2 outline-none ${h==="dark"?"bg-slate-800 border-slate-700 text-slate-300":"bg-white border-slate-200 text-slate-900"}`,children:[A.jsx("option",{value:"",children:"- Floating (No Target) -"}),A.jsx("optgroup",{label:"Tables",children:t?.tables.map(j=>A.jsxs("option",{value:j.id,children:[j.name," (",j.id,")"]},j.id))}),A.jsx("optgroup",{label:"Domains",children:t?.domains?.map(j=>A.jsxs("option",{value:j.id,children:[j.name," (",j.id,")"]},j.id))})]}),w.targetId?A.jsx("button",{onClick:()=>{const j=t?.layout?.[w.targetId],Q=j?.parentId?t?.layout?.[j.parentId]:null,K=(Q?.x??0)+(j?.x??0)+w.offset.x,ue=(Q?.y??0)+(j?.y??0)+w.offset.y;o(w.id,{targetId:void 0,targetType:void 0,offset:{x:K,y:ue}})},className:"p-2 text-red-500 hover:bg-red-50 rounded border border-red-100",title:"Unbind Target",children:A.jsx(kne,{size:14})}):A.jsx("div",{className:"p-2 text-slate-300 border border-slate-100 rounded",children:A.jsx(S4,{size:14})})]}),A.jsx("p",{className:"text-[10px] text-slate-400 italic",children:'Bind to a table to make the note "stick" when moving.'})]})]}),A.jsxs("section",{children:[A.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Note Color"}),A.jsx("div",{className:"flex flex-col gap-3",children:A.jsxs("div",{className:"flex items-center gap-2",children:[A.jsx("input",{type:"color",value:w.color||(h==="dark"?"#334155":"#fef3c7"),onChange:j=>o(w.id,{color:j.target.value}),className:"w-8 h-8 p-0 border-none rounded cursor-pointer bg-transparent"}),A.jsx("input",{value:w.color||"",onChange:j=>o(w.id,{color:j.target.value}),placeholder:"e.g. #fef3c7",className:`flex-1 border rounded text-[10px] p-1.5 outline-none font-mono ${h==="dark"?"bg-slate-800 border-slate-700 text-slate-300":"bg-white border-slate-200 text-slate-900"}`})]})})]})]})]})})]});if(x&&x.kind==="lineage"){const{relationship:j}=x;return A.jsxs("div",{className:"shadow-2xl z-50 flex flex-col sidebar-content",onClick:_,onMouseDown:_,onPointerDown:_,style:P,children:[A.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 20px",borderBottom:"1px solid var(--border-main)",backgroundColor:"var(--header-bg)"},children:[A.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:1},children:[A.jsx(S4,{size:18,style:{color:"#3b82f6"}}),A.jsxs("div",{style:{flex:1},children:[A.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[A.jsx("span",{style:{fontSize:"14px",fontWeight:"bold"},children:"Lineage"}),A.jsx("span",{style:{fontSize:"9px",fontWeight:800,padding:"1px 5px",borderRadius:"3px",backgroundColor:"rgba(59, 130, 246, 0.1)",color:"#60a5fa",border:"1px solid rgba(59, 130, 246, 0.2)",textTransform:"uppercase"},children:"UPSTREAM"})]}),A.jsxs("p",{style:{fontSize:"11px",color:"var(--text-secondary)",margin:0},children:[j.from.table," → ",j.to.table]})]})]}),A.jsx("button",{onClick:()=>m(!0),className:`p-1.5 rounded-full transition-colors ${h==="dark"?"hover:bg-slate-800 text-slate-500":"hover:bg-slate-200 text-slate-400"}`,children:A.jsx(Ha,{size:18})})]}),A.jsxs("div",{style:{flex:1,padding:"20px",color:"var(--text-secondary)",fontSize:"13px"},children:[A.jsxs("p",{children:["This edge represents a ",A.jsx("strong",{children:"lineage dependency"}),"."]}),A.jsxs("p",{style:{marginTop:"8px"},children:[A.jsx("strong",{children:j.to.table})," depends on ",A.jsx("strong",{children:j.from.table})," as an upstream source."]}),A.jsxs("p",{style:{marginTop:"8px",fontSize:"11px",opacity:.6},children:["To edit lineage, update the ",A.jsx("code",{children:"lineage.upstream"})," field in the table definition."]})]})]})}if(x){const{relationship:j,index:Q}=x;return A.jsxs("div",{className:"shadow-2xl z-50 flex flex-col sidebar-content",onClick:_,onMouseDown:_,onPointerDown:_,style:P,children:[A.jsx("div",{onMouseDown:D,style:{position:"absolute",top:"-4px",left:0,right:0,height:"8px",cursor:"ns-resize",zIndex:60}}),A.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 20px",borderBottom:"1px solid var(--border-main)",backgroundColor:"var(--header-bg)"},children:[A.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:1},children:[A.jsx(Hl,{size:18,style:{color:"#3b82f6"}}),A.jsxs("div",{style:{flex:1},children:[A.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[A.jsx("span",{style:{fontSize:"14px",fontWeight:"bold"},children:"Relationship"}),A.jsx("span",{style:{fontSize:"9px",fontWeight:800,padding:"1px 5px",borderRadius:"3px",backgroundColor:"rgba(59, 130, 246, 0.1)",color:"#60a5fa",border:"1px solid rgba(59, 130, 246, 0.2)",textTransform:"uppercase"},children:"EDGE"})]}),A.jsxs("p",{style:{fontSize:"11px",color:"var(--text-secondary)",textTransform:"uppercase",margin:0},children:[j.from.table,j.from.column?`.${j.from.column}`:""," → ",j.to.table,j.to.column?`.${j.to.column}`:""]})]})]}),A.jsx("div",{className:"flex items-center gap-1",children:A.jsx("button",{onClick:()=>m(!0),className:`p-1.5 rounded-full transition-colors ${h==="dark"?"hover:bg-slate-800 text-slate-500":"hover:bg-slate-200 text-slate-400"}`,title:"Minimize Details",children:A.jsx(Ha,{size:18})})})]}),A.jsx("div",{style:{flex:1,overflowY:"auto",padding:"20px"},children:A.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"24px"},children:[A.jsxs("div",{className:"grid grid-cols-2 gap-8",children:[A.jsxs("section",{children:[A.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Relationship Type"}),A.jsxs("select",{value:j.type||"one-to-many",onChange:K=>l(Q,{type:K.target.value}),className:`w-full border rounded text-sm p-2.5 outline-none transition-colors ${h==="dark"?"bg-slate-800 border-slate-700 text-slate-200 focus:ring-blue-500":"bg-white border-slate-200 text-slate-900 focus:ring-blue-400 focus:border-blue-400 shadow-sm"}`,children:[A.jsx("option",{value:"one-to-one",children:"1:1 (one-to-one)"}),A.jsx("option",{value:"one-to-many",children:"1:N (one-to-many)"}),A.jsx("option",{value:"many-to-one",children:"N:1 (many-to-one)"}),A.jsx("option",{value:"many-to-many",children:"N:N (many-to-many)"})]})]}),A.jsxs("section",{children:[A.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Cardinality (Metadata)"}),A.jsxs("div",{className:"text-slate-500 text-sm",children:["Mapping established from ",A.jsx("strong",{children:j.from.table})," to ",A.jsx("strong",{children:j.to.table}),"."]})]})]}),A.jsxs("section",{children:[A.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Source/Target Details"}),A.jsxs("div",{className:`flex gap-4 items-center p-3 rounded border ${h==="dark"?"bg-slate-800/50 border-slate-800":"bg-slate-50 border-slate-100"}`,children:[A.jsxs("div",{className:"flex-1",children:[A.jsx("div",{className:"text-[10px] text-slate-500 uppercase",children:"From Table"}),A.jsx("div",{className:`text-sm font-bold ${h==="dark"?"text-blue-400":"text-blue-600"}`,children:j.from.table}),A.jsxs("div",{className:"text-[10px] text-slate-500",children:["Column: ",j.from.column||"(Table level)"]})]}),A.jsx("div",{className:"text-slate-400 dark:text-slate-600",children:"→"}),A.jsxs("div",{className:"flex-1",children:[A.jsx("div",{className:"text-[10px] text-slate-500 uppercase",children:"To Table"}),A.jsx("div",{className:`text-sm font-bold ${h==="dark"?"text-blue-400":"text-blue-600"}`,children:j.to.table}),A.jsxs("div",{className:"text-[10px] text-slate-500",children:["Column: ",j.to.column||"(Table level)"]})]})]})]})]})})]})}if(b)return A.jsxs("div",{className:"shadow-2xl z-50 flex flex-col sidebar-content",onClick:_,onMouseDown:_,onPointerDown:_,style:{...P,borderTopColor:b.color||"#3b82f6"},children:[A.jsx("div",{onMouseDown:D,style:{position:"absolute",top:"-4px",left:0,right:0,height:"8px",cursor:"ns-resize",zIndex:60}}),A.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 20px",borderBottom:"1px solid var(--border-main)",backgroundColor:"var(--header-bg)"},children:[A.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:1},children:[A.jsx(Hl,{size:18,style:{color:b.color||"#3b82f6"}}),A.jsxs("div",{style:{flex:1},children:[A.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[A.jsx("input",{value:b.name??"",onChange:j=>s(b.id,{name:j.target.value}),onBlur:j=>{j.target.value||s(b.id,{name:"UNNAMED_DOMAIN"})},style:{fontSize:"16px",fontWeight:"bold",color:"var(--text-primary)",backgroundColor:"transparent",border:"none",borderBottom:"1px solid transparent",padding:"2px 0",outline:"none",width:"fit-content",minWidth:"200px"},onFocus:j=>j.target.style.borderBottom="1px solid #3b82f6"}),A.jsx("span",{style:{fontSize:"9px",fontWeight:800,padding:"1px 5px",borderRadius:"3px",backgroundColor:"rgba(59, 130, 246, 0.1)",color:"#60a5fa",border:"1px solid rgba(59, 130, 246, 0.2)",textTransform:"uppercase"},children:"DOMAIN"})]}),A.jsx("p",{style:{fontSize:"11px",color:"var(--text-secondary)",textTransform:"uppercase",margin:0},children:b.id})]})]}),A.jsx("div",{className:"flex items-center gap-1",children:A.jsx("button",{onClick:()=>m(!0),className:`p-1.5 rounded-full transition-colors ${h==="dark"?"hover:bg-slate-800 text-slate-500":"hover:bg-slate-200 text-slate-400"}`,title:"Minimize Details",children:A.jsx(Ha,{size:18})})})]}),A.jsx("div",{style:{flex:1,overflowY:"auto",padding:"20px"},children:A.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[A.jsxs("section",{children:[A.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Domain Description"}),A.jsx("textarea",{value:b.description||"",onChange:j=>s(b.id,{description:j.target.value}),placeholder:"What is the purpose of this domain?",style:{width:"100%",minHeight:"80px",backgroundColor:h==="dark"?"#0f172a":"#ffffff",border:"1px solid var(--border-main)",borderRadius:"6px",padding:"12px",color:"var(--text-primary)",fontSize:"13px",lineHeight:"1.6",resize:"none",outline:"none",transition:"background-color 0.3s"}})]}),A.jsxs("section",{children:[A.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Domain Theme Color"}),A.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[A.jsx("input",{type:"color",value:(()=>{const j=b.color;if(!j)return"#3b82f6";const Q=j.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);return Q?"#"+[Q[1],Q[2],Q[3]].map(K=>parseInt(K).toString(16).padStart(2,"0")).join(""):j.startsWith("#")?j:"#3b82f6"})(),onChange:j=>{const Q=j.target.value,K=parseInt(Q.slice(1,3),16),ue=parseInt(Q.slice(3,5),16),Se=parseInt(Q.slice(5,7),16);s(b.id,{color:`rgba(${K}, ${ue}, ${Se}, 0.12)`})},style:{width:"40px",height:"40px",padding:0,border:"none",borderRadius:"4px",cursor:"pointer",backgroundColor:"transparent"}}),A.jsx("input",{value:b.color||"",onChange:j=>s(b.id,{color:j.target.value}),placeholder:"e.g. #3b82f6 or rgba(...)",className:`border rounded font-mono text-sm p-2 outline-none flex-1 transition-colors ${h==="dark"?"bg-slate-800 border-slate-700 text-slate-300 focus:ring-blue-500":"bg-white border-slate-200 text-slate-900 focus:ring-blue-400 focus:border-blue-400 shadow-sm"}`})]})]})]})})]});if(!y)return null;const H=[{id:"conceptual",label:"Conceptual",icon:A.jsx(zu,{size:14})},{id:"logical",label:"Logical",icon:A.jsx(Hl,{size:14})},{id:"physical",label:"Physical",icon:A.jsx(Hl,{size:14})},{id:"implementation",label:"Implementation",icon:A.jsx(Bre,{size:14})},{id:"sample",label:"Sample Data",icon:A.jsx(k4,{size:14})}],$=y.appearance?.type?E4[y.appearance.type]:null,q=y.appearance?.color||$?.color||"#334155",V=y.appearance?.icon||$?.icon||"";let X=$?.label||"";const ee=y.appearance?.sub_type,te=y.appearance?.scd;if(y.appearance?.type==="fact"&&ee?X=`FACT (${{transaction:"Trans.",periodic:"Periodic",accumulating:"Accum.",factless:"Factless"}[ee]||ee})`:y.appearance?.type&&ee?X=`${y.appearance.type.toUpperCase()} (${ee})`:y.appearance?.type&&(X=y.appearance.type.toUpperCase()),te){const j=`SCD ${te.replace("type","T")}`;X=X?`${X} / ${j}`:j}const I=j=>{j.stopPropagation();const Q={id:`col_${Date.now()}`,logical:{name:"New Column",type:"String",description:""},physical:{name:"",type:"VARCHAR(255)",constraints:[]}};z({columns:[...y.columns||[],Q]})},G=(j,Q)=>{j.stopPropagation();const K=y.columns?.filter(ue=>ue.id!==Q)||[];z({columns:K})},re=(j,Q)=>{const K=y.columns?.map(ue=>ue.id===j?{...ue,logical:{name:ue.logical?.name||ue.id,type:ue.logical?.type||"String",...ue.logical,...Q}}:ue)||[];z({columns:K})},Y=(j,Q)=>{const K=y.columns?.map(ue=>ue.id===j?{...ue,physical:{...ue.physical,...Q}}:ue)||[];z({columns:K})},W=j=>{if(j.key==="Enter"&&E.trim()){const Q=y.conceptual?.tags||[];Q.includes(E.trim())||z({conceptual:{...y.conceptual,tags:[...Q,E.trim()]}}),M("")}},Z=(j,Q)=>{j.stopPropagation();const K=y.conceptual?.tags||[];z({conceptual:{...y.conceptual,tags:K.filter(ue=>ue!==Q)}})},ie=j=>{z({sampleData:j})},we=j=>{j.stopPropagation();const Q=y.sampleData||[],K=y.columns?.length||0,ue=new Array(K).fill("");ie([...Q,ue])},de=(j,Q)=>{j.stopPropagation();const ue=(y.sampleData||[]).filter((Se,at)=>at!==Q);ie(ue)},se=(j,Q,K)=>{const ue=[...y.sampleData||[]];if(!ue[j])return;const Se=[...ue[j]];Se[Q]=K,ue[j]=Se,ie(ue)};return A.jsxs("div",{className:"shadow-2xl z-50 flex flex-col sidebar-content",onClick:_,onMouseDown:_,onPointerDown:_,style:{...P,borderTopColor:q},children:[A.jsx("div",{onMouseDown:D,style:{position:"absolute",top:"-4px",left:0,right:0,height:"8px",cursor:"ns-resize",zIndex:60}}),A.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 20px",borderBottom:"1px solid var(--border-main)",backgroundColor:"var(--header-bg)"},children:[A.jsxs("div",{style:{flex:1},children:[A.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"4px"},children:[V&&A.jsx("span",{style:{fontSize:"16px"},children:V}),A.jsx("span",{style:{fontSize:"11px",color:"var(--text-secondary)",textTransform:"uppercase",fontFamily:"monospace",letterSpacing:"0.05em"},children:y.id}),X&&A.jsx("span",{style:{fontSize:"9px",fontWeight:800,padding:"1px 5px",borderRadius:"3px",backgroundColor:`${q}30`,color:q,border:`1px solid ${q}50`,textTransform:"uppercase"},children:X})]}),A.jsx("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:A.jsx("input",{value:y.name??"",onChange:j=>z({name:j.target.value}),onBlur:j=>{j.target.value||z({name:"UNNAMED_TABLE"})},title:"Conceptual Table Name",style:{fontSize:"18px",fontWeight:"bold",color:"var(--text-primary)",backgroundColor:"transparent",border:"none",borderBottom:"1px solid transparent",padding:"2px 0",outline:"none",width:"100%",maxWidth:"500px"},onFocus:j=>j.target.style.borderBottom="1px solid #3b82f6"})})]}),A.jsxs("div",{style:{display:"flex",gap:"8px",marginRight:"16px"},children:[A.jsxs("select",{value:y.appearance?.type||"fact",onChange:j=>z({appearance:{...y.appearance,type:j.target.value}}),className:`border rounded text-[10px] px-2 py-1 outline-none transition-colors ${h==="dark"?"bg-slate-800 border-slate-700 text-slate-300 focus:ring-blue-500":"bg-white border-slate-200 text-slate-900 focus:ring-blue-400 focus:border-blue-400"}`,title:"Table Type",children:[A.jsx("option",{value:"fact",children:"Fact"}),A.jsx("option",{value:"dimension",children:"Dimension"}),A.jsx("option",{value:"mart",children:"Mart"}),A.jsx("option",{value:"table",children:"Table"}),A.jsx("option",{value:"hub",children:"Hub"}),A.jsx("option",{value:"link",children:"Link"}),A.jsx("option",{value:"satellite",children:"Satellite"})]}),A.jsxs("select",{value:y.appearance?.sub_type||"",onChange:j=>z({appearance:{...y.appearance,sub_type:j.target.value||void 0}}),className:`border rounded text-[10px] px-2 py-1 outline-none transition-colors ${h==="dark"?"bg-slate-800 border-slate-700 text-slate-300 focus:ring-blue-500":"bg-white border-slate-200 text-slate-900 focus:ring-blue-400 focus:border-blue-400"}`,title:"Table Sub-type",children:[A.jsx("option",{value:"",children:"- Sub-type -"}),A.jsx("option",{value:"transaction",children:"Transaction"}),A.jsx("option",{value:"periodic",children:"Periodic Snapshot"}),A.jsx("option",{value:"accumulating",children:"Accumulating Snapshot"}),A.jsx("option",{value:"factless",children:"Factless"}),A.jsx("option",{value:"conformed",children:"Conformed"}),A.jsx("option",{value:"junk",children:"Junk"}),A.jsx("option",{value:"degenerate",children:"Degenerate"})]}),A.jsxs("select",{value:y.appearance?.scd||"",onChange:j=>z({appearance:{...y.appearance,scd:j.target.value||void 0}}),className:`border rounded text-[10px] px-2 py-1 outline-none transition-colors ${h==="dark"?"bg-slate-800 border-slate-700 text-slate-300 focus:ring-blue-500":"bg-white border-slate-200 text-slate-900 focus:ring-blue-400 focus:border-blue-400"}`,title:"SCD Type",children:[A.jsx("option",{value:"",children:"- SCD Type -"}),A.jsx("option",{value:"type0",children:"SCD Type 0"}),A.jsx("option",{value:"type1",children:"SCD Type 1"}),A.jsx("option",{value:"type2",children:"SCD Type 2"}),A.jsx("option",{value:"type3",children:"SCD Type 3"}),A.jsx("option",{value:"type4",children:"SCD Type 4"}),A.jsx("option",{value:"type5",children:"SCD Type 5"}),A.jsx("option",{value:"type6",children:"SCD Type 6"}),A.jsx("option",{value:"type7",children:"SCD Type 7"})]})]}),A.jsx("div",{className:"flex items-center gap-1",children:A.jsx("button",{onClick:()=>m(!0),className:`p-1.5 rounded-full transition-colors ${h==="dark"?"hover:bg-slate-800 text-slate-500":"hover:bg-slate-200 text-slate-400"}`,title:"Minimize Details",children:A.jsx(Ha,{size:18})})})]}),A.jsx("div",{style:{display:"flex",gap:"24px",padding:"0 20px",borderBottom:"1px solid var(--border-main)",backgroundColor:"var(--header-bg)"},children:H.map(j=>A.jsxs("button",{onClick:Q=>{Q.stopPropagation(),k(j.id)},style:{padding:"12px 0",backgroundColor:"transparent",border:"none",borderBottom:S===j.id?"2px solid #3b82f6":"2px solid transparent",color:S===j.id?h==="dark"?"#60a5fa":"#2563eb":"var(--text-secondary)",fontSize:"13px",fontWeight:500,cursor:"pointer",display:"flex",alignItems:"center",gap:"6px",transition:"all 0.2s"},children:[j.icon," ",j.label]},j.id))}),A.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"15px 20px"},children:[S==="conceptual"&&A.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[A.jsxs("section",{children:[A.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Description"}),A.jsx("textarea",{value:y.conceptual?.description||"",onChange:j=>z({conceptual:{...y.conceptual,description:j.target.value}}),placeholder:"Enter business description...",style:{width:"100%",minHeight:"100px",backgroundColor:h==="dark"?"#0f172a":"#ffffff",border:"1px solid var(--border-main)",borderRadius:"6px",padding:"12px",color:"var(--text-primary)",fontSize:"13px",lineHeight:"1.6",resize:"none",outline:"none",transition:"background-color 0.3s"}})]}),A.jsxs("section",{children:[A.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Domain Assignment"}),A.jsxs("select",{value:t?.domains?.find(j=>j.tables.includes(y.id))?.id||"",onChange:j=>c(y.id,j.target.value||null),className:`w-full border rounded text-sm p-2 outline-none transition-colors ${h==="dark"?"bg-slate-800 border-slate-700 text-slate-200 focus:ring-blue-500":"bg-white border-slate-200 text-slate-900 focus:ring-blue-400 focus:border-blue-400 shadow-sm"}`,children:[A.jsx("option",{value:"",children:"- No Domain -"}),t?.domains?.map(j=>A.jsxs("option",{value:j.id,children:[j.name," (",j.id,")"]},j.id))]})]}),A.jsxs("section",{children:[A.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Tags"}),A.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center"},children:[y.conceptual?.tags?.map(j=>A.jsxs("span",{className:`flex items-center gap-2 px-3 py-1 border rounded-full text-xs font-medium transition-colors ${h==="dark"?"bg-blue-500/10 text-blue-400 border-blue-500/20":"bg-blue-50 text-blue-600 border-blue-100"}`,children:[j,A.jsx("button",{onClick:Q=>Z(Q,j),className:"hover:text-red-500 transition-colors",children:A.jsx(Oh,{size:12})})]},j)),A.jsx("div",{style:{position:"relative"},children:A.jsx("input",{type:"text",value:E,onChange:j=>M(j.target.value),onKeyDown:W,placeholder:"+ New Tag",style:{backgroundColor:"transparent",border:"1px dashed var(--border-main)",borderRadius:"16px",padding:"4px 12px",fontSize:"11px",color:"var(--text-primary)",outline:"none",width:"100px"}})})]})]})]}),S==="logical"&&A.jsxs("div",{children:[A.jsxs("div",{className:"flex flex-col gap-4 mb-6",children:[A.jsxs("section",{children:[A.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Logical Table Name"}),A.jsx("input",{value:y.logical_name||"",onChange:j=>z({logical_name:j.target.value}),placeholder:y.name,className:`w-full border rounded text-sm p-2 outline-none transition-colors ${h==="dark"?"bg-slate-800 border-slate-700 text-slate-200 focus:ring-blue-500":"bg-white border-slate-200 text-slate-900 focus:ring-blue-400 focus:border-blue-400 shadow-sm"}`})]}),A.jsxs("div",{className:"flex justify-between items-center",children:[A.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500",children:"Logical Schema (Columns)"}),A.jsxs("button",{onClick:I,className:"flex items-center gap-2 px-3 py-1.5 bg-blue-600 hover:bg-blue-700 text-white rounded text-xs transition-colors shadow-md shadow-blue-500/20 font-medium",children:[A.jsx(Gf,{size:14})," Add Column"]})]})]}),A.jsx("div",{style:{border:"1px solid var(--border-main)",borderRadius:"8px",overflow:"hidden"},children:A.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"12px"},children:[A.jsx("thead",{style:{backgroundColor:"var(--header-bg)",borderBottom:"1px solid var(--border-main)",textAlign:"left"},children:A.jsxs("tr",{children:[A.jsx("th",{style:{padding:"10px 16px",color:"var(--text-secondary)",width:"35%"},children:"Logical Name"}),A.jsx("th",{style:{padding:"10px 16px",color:"var(--text-secondary)",width:"15%"},children:"Role"}),A.jsx("th",{style:{padding:"10px 16px",color:"var(--text-secondary)",width:"15%"},children:"Type"}),A.jsx("th",{style:{padding:"10px 16px",color:"var(--text-secondary)",width:"30%"},children:"Description"}),A.jsx("th",{style:{padding:"10px 16px",width:"50px"}})]})}),A.jsx("tbody",{children:(y.columns||[]).map(j=>A.jsxs("tr",{style:{borderBottom:"1px solid var(--border-main)",backgroundColor:"var(--node-bg)"},children:[A.jsx("td",{style:{padding:"6px 16px"},children:A.jsxs("div",{className:"flex items-center gap-2",children:[A.jsx("button",{onClick:()=>re(j.id,{isPrimaryKey:!j.logical?.isPrimaryKey}),title:"Primary Key",className:`transition-opacity ${j.logical?.isPrimaryKey?"opacity-100":"opacity-20 hover:opacity-50"}`,children:"🔑"}),A.jsx("input",{value:j.logical?.name??"",onChange:Q=>re(j.id,{name:Q.target.value}),onBlur:Q=>{Q.target.value||re(j.id,{name:j.id})},className:`bg-transparent border-none w-full outline-none p-1 rounded font-medium transition-colors ${h==="dark"?"text-white focus:bg-slate-800":"text-slate-900 focus:bg-slate-50"}`})]})}),A.jsx("td",{style:{padding:"6px 16px"},children:A.jsxs("div",{className:"flex items-center gap-2",children:[A.jsx("button",{onClick:()=>re(j.id,{isMetadata:!j.logical?.isMetadata}),title:"Metadata/Audit",className:`transition-opacity text-sm ${j.logical?.isMetadata?"opacity-100":"opacity-20 hover:opacity-50"}`,children:"🕒"}),A.jsxs("select",{value:j.logical?.additivity||"",onChange:Q=>re(j.id,{additivity:Q.target.value||void 0}),title:"Additivity (for Measures)",style:{fontSize:"10px"},className:`border rounded outline-none transition-colors ${h==="dark"?"bg-slate-800 border-slate-700 text-slate-400":"bg-white border-slate-200 text-slate-600"}`,children:[A.jsx("option",{value:"",children:"-"}),A.jsx("option",{value:"fully",children:"Σ (Full)"}),A.jsx("option",{value:"semi",children:"Σ~ (Semi)"}),A.jsx("option",{value:"non",children:"⊘ (Non)"})]})]})}),A.jsx("td",{style:{padding:"6px 16px"},children:A.jsx("input",{value:j.logical?.type??"",onChange:Q=>re(j.id,{type:Q.target.value}),onBlur:Q=>{Q.target.value||re(j.id,{type:"String"})},placeholder:"Type...",className:`bg-transparent border-none font-mono text-[11px] w-full outline-none p-1 rounded transition-colors ${h==="dark"?"text-slate-400 focus:bg-slate-800":"text-slate-500 focus:bg-slate-50"}`})}),A.jsx("td",{style:{padding:"6px 16px"},children:A.jsx("input",{value:j.logical?.description||"",onChange:Q=>re(j.id,{description:Q.target.value}),placeholder:"Description...",className:`bg-transparent border-none text-[11px] w-full outline-none p-1 rounded transition-colors ${h==="dark"?"text-slate-500 focus:bg-slate-800":"text-slate-400 focus:bg-slate-50"}`})}),A.jsx("td",{style:{padding:"6px 16px",textAlign:"right"},children:A.jsx("button",{onClick:Q=>G(Q,j.id),className:"text-red-500/50 hover:text-red-500 p-1 transition-colors",children:A.jsx(T4,{size:14})})})]},j.id))})]})})]}),S==="physical"&&A.jsxs("div",{children:[A.jsxs("div",{className:"flex flex-col gap-4 mb-6",children:[A.jsxs("section",{children:[A.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Physical Table Name"}),A.jsx("input",{value:y.physical_name||"",onChange:j=>z({physical_name:j.target.value}),placeholder:y.id,className:`w-full border rounded font-mono text-sm p-2 outline-none transition-colors ${h==="dark"?"bg-slate-800 border-slate-700 text-slate-300 focus:ring-blue-500":"bg-white border-slate-200 text-slate-900 focus:ring-blue-400 focus:border-blue-400 shadow-sm"}`})]}),A.jsx("div",{className:"flex justify-between items-center",children:A.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500",children:"Physical Mappings"})})]}),A.jsx("div",{style:{border:"1px solid var(--border-main)",borderRadius:"8px",overflow:"hidden"},children:A.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"12px"},children:[A.jsx("thead",{style:{backgroundColor:"var(--header-bg)",borderBottom:"1px solid var(--border-main)",textAlign:"left"},children:A.jsxs("tr",{children:[A.jsx("th",{style:{padding:"10px 16px",color:"var(--text-secondary)",width:"25%"},children:"Logical Column"}),A.jsx("th",{style:{padding:"10px 16px",color:"var(--text-secondary)",width:"30%"},children:"DB Column Name"}),A.jsx("th",{style:{padding:"10px 16px",color:"var(--text-secondary)",width:"20%"},children:"DB Type"}),A.jsx("th",{style:{padding:"10px 16px",color:"var(--text-secondary)",width:"25%"},children:"Constraints"})]})}),A.jsx("tbody",{children:(y.columns||[]).map(j=>A.jsxs("tr",{style:{borderBottom:"1px solid var(--border-main)",backgroundColor:"var(--node-bg)"},children:[A.jsx("td",{style:{padding:"6px 16px",color:"var(--text-secondary)",borderRight:"1px solid var(--border-main)"},children:A.jsx("div",{className:"text-[11px] font-medium truncate",title:j.logical?.name||j.id,children:j.logical?.name||j.id})}),A.jsx("td",{style:{padding:"6px 16px"},children:A.jsx("input",{value:j.physical?.name??"",onChange:Q=>Y(j.id,{name:Q.target.value}),placeholder:j.logical?.name.toLowerCase().replace(/ /g,"_"),className:`bg-transparent border-none font-mono text-[11px] w-full outline-none p-1 rounded transition-colors ${h==="dark"?"text-blue-400 focus:bg-slate-800":"text-blue-600 focus:bg-slate-50"}`})}),A.jsx("td",{style:{padding:"6px 16px"},children:A.jsx("input",{value:j.physical?.type??"",onChange:Q=>Y(j.id,{type:Q.target.value}),placeholder:j.logical?.type.toUpperCase(),className:`bg-transparent border-none font-mono text-[11px] w-full outline-none p-1 rounded transition-colors ${h==="dark"?"text-slate-400 focus:bg-slate-800":"text-slate-500 focus:bg-slate-50"}`})}),A.jsx("td",{style:{padding:"6px 16px"},children:A.jsx("input",{value:j.physical?.constraints?.join(", ")||"",onChange:Q=>Y(j.id,{constraints:Q.target.value.split(",").map(K=>K.trim()).filter(Boolean)}),placeholder:"e.g. NOT NULL",className:`bg-transparent border-none text-[11px] w-full outline-none p-1 rounded transition-colors ${h==="dark"?"text-slate-500 focus:bg-slate-800":"text-slate-400 focus:bg-slate-50"}`})})]},j.id))})]})})]}),S==="implementation"&&A.jsxs("div",{className:"flex flex-col gap-5",children:[A.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500",children:"Implementation Hints"}),A.jsx("p",{className:"text-[10px] text-slate-400 -mt-3",children:"Code generation hints for AI agents (dbt, Spark, SQLMesh, etc.)."}),A.jsxs("div",{className:"flex flex-col gap-1.5",children:[A.jsx("label",{className:"text-[11px] font-semibold text-slate-500 uppercase tracking-wider",children:"Materialization"}),A.jsxs("select",{value:y.implementation?.materialization||"",onChange:j=>{const Q=j.target.value,K=Q==="incremental",ue=Q==="table"||Q==="incremental";z({implementation:{...y.implementation,materialization:Q||void 0,incremental_strategy:K?y.implementation?.incremental_strategy:void 0,unique_key:K?y.implementation?.unique_key:void 0,partition_by:ue?y.implementation?.partition_by:void 0}})},className:`w-full px-3 py-2 rounded border text-sm transition-colors ${h==="dark"?"bg-slate-800 border-slate-700 text-slate-100":"bg-white border-slate-300 text-slate-800"}`,children:[A.jsx("option",{value:""}),A.jsx("option",{value:"table",children:"📋 table"}),A.jsx("option",{value:"view",children:"👁 view"}),A.jsx("option",{value:"incremental",children:"⚡ incremental"}),A.jsx("option",{value:"ephemeral",children:"👻 ephemeral"})]})]}),y.implementation?.materialization==="incremental"&&A.jsxs("div",{className:`flex flex-col gap-3 p-3 rounded-lg border ${h==="dark"?"bg-slate-800/50 border-slate-700":"bg-slate-50 border-slate-200"}`,children:[A.jsx("div",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:"Incremental Settings"}),A.jsxs("div",{className:"flex flex-col gap-1.5",children:[A.jsx("label",{className:"text-[11px] font-semibold text-slate-500",children:"Strategy"}),A.jsxs("select",{value:y.implementation?.incremental_strategy||"",onChange:j=>{const Q=j.target.value;z({implementation:{...y.implementation,incremental_strategy:Q||void 0}})},className:`w-full px-3 py-2 rounded border text-sm transition-colors ${h==="dark"?"bg-slate-700 border-slate-600 text-slate-100":"bg-white border-slate-300 text-slate-800"}`,children:[A.jsx("option",{value:""}),A.jsx("option",{value:"merge",children:"merge"}),A.jsx("option",{value:"append",children:"append"}),A.jsx("option",{value:"delete+insert",children:"delete+insert"})]})]}),A.jsxs("div",{className:"flex flex-col gap-1.5",children:[A.jsx("label",{className:"text-[11px] font-semibold text-slate-500",children:"Unique Key"}),A.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1",children:(Array.isArray(y.implementation?.unique_key)?y.implementation.unique_key:[]).map(j=>A.jsxs("span",{className:`flex items-center gap-1 px-2 py-0.5 rounded text-[11px] font-mono ${h==="dark"?"bg-slate-600 text-slate-200":"bg-slate-100 text-slate-700"}`,children:[j,A.jsx("button",{onClick:()=>{const Q=(y.implementation?.unique_key||[]).filter(K=>K!==j);z({implementation:{...y.implementation,unique_key:Q.length?Q:void 0}})},className:"text-slate-400 hover:text-red-400 ml-0.5",children:"×"})]},j))}),A.jsxs("select",{value:"",onChange:j=>{const Q=j.target.value;if(!Q)return;const K=Array.isArray(y.implementation?.unique_key)?y.implementation.unique_key:[];K.includes(Q)||z({implementation:{...y.implementation,unique_key:[...K,Q]}})},className:`w-full px-3 py-2 rounded border text-sm font-mono transition-colors ${h==="dark"?"bg-slate-700 border-slate-600 text-slate-100":"bg-white border-slate-300 text-slate-800"}`,children:[A.jsx("option",{value:"",children:"+ Add column"}),(y.columns||[]).filter(j=>!(y.implementation?.unique_key||[]).includes(j.physical?.name||j.id)).map(j=>{const Q=j.physical?.name||j.id;return A.jsx("option",{value:Q,children:Q},j.id)})]})]})]}),!["view","ephemeral"].includes(y.implementation?.materialization||"")&&A.jsxs("div",{className:"flex flex-col gap-2",children:[A.jsxs("div",{className:"flex items-center justify-between",children:[A.jsx("label",{className:"text-[11px] font-semibold text-slate-500 uppercase tracking-wider",children:"Partition By"}),A.jsx("button",{onClick:()=>{const j=Array.isArray(y.implementation?.partition_by)?y.implementation.partition_by:[];z({implementation:{...y.implementation,partition_by:[...j,{field:""}]}})},className:"text-[11px] text-blue-500 hover:text-blue-400",children:"+ Add field"})]}),(Array.isArray(y.implementation?.partition_by)?y.implementation.partition_by:[]).map((j,Q)=>A.jsxs("div",{className:"flex gap-2 items-center",children:[A.jsxs("select",{value:j.field,onChange:K=>{const ue=[...y.implementation?.partition_by||[]];ue[Q]={...ue[Q],field:K.target.value},z({implementation:{...y.implementation,partition_by:ue}})},className:`flex-1 px-3 py-2 rounded border text-sm font-mono transition-colors ${h==="dark"?"bg-slate-800 border-slate-700 text-slate-100":"bg-white border-slate-300 text-slate-800"}`,children:[A.jsx("option",{value:""}),(y.columns||[]).map(K=>{const ue=K.physical?.name||K.id;return A.jsx("option",{value:ue,children:ue},K.id)})]}),A.jsxs("select",{value:j.granularity||"",onChange:K=>{const ue=[...y.implementation?.partition_by||[]];ue[Q]={...ue[Q],granularity:K.target.value||void 0},z({implementation:{...y.implementation,partition_by:ue}})},className:`px-2 py-2 rounded border text-sm transition-colors ${h==="dark"?"bg-slate-800 border-slate-700 text-slate-100":"bg-white border-slate-300 text-slate-800"}`,children:[A.jsx("option",{value:""}),A.jsx("option",{value:"day",children:"day"}),A.jsx("option",{value:"month",children:"month"}),A.jsx("option",{value:"year",children:"year"}),A.jsx("option",{value:"hour",children:"hour"})]}),A.jsx("button",{onClick:()=>{const K=(Array.isArray(y.implementation?.partition_by)?y.implementation.partition_by:[]).filter((ue,Se)=>Se!==Q);z({implementation:{...y.implementation,partition_by:K.length?K:void 0}})},className:"text-slate-400 hover:text-red-400 text-sm px-1",children:"×"})]},Q))]})]}),S==="sample"&&A.jsxs("div",{className:"flex flex-col h-full",children:[A.jsxs("div",{className:"flex justify-between items-center mb-4",children:[A.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500",children:"Sample Data Editor"}),A.jsx("div",{className:"flex gap-2",children:A.jsxs("button",{onClick:we,disabled:!y.columns||y.columns.length===0,className:`flex items-center gap-2 px-3 py-1.5 text-white rounded text-xs transition-colors font-medium shadow-md ${!y.columns||y.columns.length===0?"bg-slate-300 dark:bg-slate-700 cursor-not-allowed opacity-50":"bg-emerald-600 hover:bg-emerald-700 shadow-emerald-500/20"}`,children:[A.jsx(Gf,{size:14})," Add Row"]})})]}),!y.columns||y.columns.length===0?A.jsxs("div",{className:`flex-1 flex flex-col items-center justify-center p-8 rounded-lg border border-dashed transition-colors ${h==="dark"?"bg-slate-900/50 border-slate-800":"bg-slate-50 border-slate-200"}`,children:[A.jsx(k4,{size:32,className:`${h==="dark"?"text-slate-700":"text-slate-300"} mb-4`}),A.jsx("p",{className:"text-sm text-slate-500 mb-1",children:"No columns defined yet."}),A.jsx("p",{className:"text-xs text-slate-400 italic",children:'Add columns in the "Logical" tab first to enable sample data.'})]}):A.jsx("div",{className:`flex-1 overflow-auto border rounded-lg shadow-inner transition-colors ${h==="dark"?"border-slate-800 bg-slate-950/20":"border-slate-200 bg-white"}`,children:A.jsxs("table",{className:"w-full border-collapse text-xs",children:[A.jsx("thead",{className:`sticky top-0 z-10 border-b transition-colors ${h==="dark"?"bg-slate-950 border-slate-800":"bg-slate-100 border-slate-200"}`,children:A.jsxs("tr",{children:[(y.columns||[]).map(j=>A.jsx("th",{className:`p-3 text-left border-r min-w-[140px] transition-colors ${h==="dark"?"border-slate-800":"border-slate-200"}`,children:A.jsxs("div",{className:"flex flex-col gap-0.5",children:[A.jsx("span",{className:`font-bold ${h==="dark"?"text-slate-200":"text-slate-700"}`,children:j?.logical?.name||j.id}),A.jsx("span",{className:`text-[10px] font-mono italic ${h==="dark"?"text-blue-400":"text-blue-600"}`,children:j?.physical?.name||j?.logical?.name?.toLowerCase().replace(/ /g,"_")||j.id})]})},j.id)),A.jsx("th",{className:`w-10 transition-colors ${h==="dark"?"bg-slate-950":"bg-slate-100"}`})]})}),A.jsxs("tbody",{children:[(y.sampleData||[]).map((j,Q)=>A.jsxs("tr",{className:`border-b transition-colors ${h==="dark"?"border-slate-800 hover:bg-slate-800/30":"border-slate-100 hover:bg-slate-50"}`,children:[(y.columns||[]).map((K,ue)=>A.jsx("td",{className:`p-0 border-r transition-colors ${h==="dark"?"border-slate-800":"border-slate-200"}`,children:A.jsx("input",{value:String(j[ue]??""),onChange:Se=>se(Q,ue,Se.target.value),className:`w-full bg-transparent border-none p-3 outline-none font-mono transition-colors ${h==="dark"?"focus:bg-slate-800 text-slate-300":"focus:bg-blue-50 text-slate-700"}`})},K.id)),A.jsx("td",{className:"p-2 text-center",children:A.jsx("button",{onClick:K=>de(K,Q),className:"text-slate-400 hover:text-red-500 transition-colors",children:A.jsx(T4,{size:12})})})]},Q)),(!y.sampleData||y.sampleData.length===0)&&A.jsx("tr",{children:A.jsx("td",{colSpan:(y.columns?.length||0)+1,className:`p-8 text-center text-slate-400 italic transition-colors ${h==="dark"?"bg-slate-900/20":"bg-slate-50"}`,children:'No rows defined. Click "Add Row" to start.'})})]})]})})]})]})]})});function kk(){return kk=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},kk.apply(null,arguments)}function Rne(t,e){if(t==null)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.indexOf(n)!==-1)continue;r[n]=t[n]}return r}let Tk=[],g6=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,r=0;e<t.length;e++)(e%2?g6:Tk).push(r=r+t[e])})();function Dne(t){if(t<768)return!1;for(let e=0,r=Tk.length;;){let n=e+r>>1;if(t<Tk[n])r=n;else if(t>=g6[n])e=n+1;else return!0;if(e==r)return!1}}function A4(t){return t>=127462&&t<=127487}const O4=8205;function _ne(t,e,r=!0,n=!0){return(r?v6:Nne)(t,e,n)}function v6(t,e,r){if(e==t.length)return e;e&&m6(t.charCodeAt(e))&&y6(t.charCodeAt(e-1))&&e--;let n=vC(t,e);for(e+=M4(n);e<t.length;){let i=vC(t,e);if(n==O4||i==O4||r&&Dne(i))e+=M4(i),n=i;else if(A4(i)){let a=0,s=e-2;for(;s>=0&&A4(vC(t,s));)a++,s-=2;if(a%2==0)break;e+=2}else break}return e}function Nne(t,e,r){for(;e>0;){let n=v6(t,e-2,r);if(n<e)return n;e--}return 0}function vC(t,e){let r=t.charCodeAt(e);if(!y6(r)||e+1==t.length)return r;let n=t.charCodeAt(e+1);return m6(n)?(r-55296<<10)+(n-56320)+65536:r}function m6(t){return t>=56320&&t<57344}function y6(t){return t>=55296&&t<56320}function M4(t){return t<65536?1:2}class Nt{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,r,n){[e,r]=Iu(this,e,r);let i=[];return this.decompose(0,e,i,2),n.length&&n.decompose(0,n.length,i,3),this.decompose(r,this.length,i,1),ia.from(i,this.length-(r-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,r=this.length){[e,r]=Iu(this,e,r);let n=[];return this.decompose(e,r,n,0),ia.from(n,r-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let r=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),i=new Cf(this),a=new Cf(e);for(let s=r,l=r;;){if(i.next(s),a.next(s),s=0,i.lineBreak!=a.lineBreak||i.done!=a.done||i.value!=a.value)return!1;if(l+=i.value.length,i.done||l>=n)return!0}}iter(e=1){return new Cf(this,e)}iterRange(e,r=this.length){return new b6(this,e,r)}iterLines(e,r){let n;if(e==null)n=this.iter();else{r==null&&(r=this.lines+1);let i=this.line(e).from;n=this.iterRange(i,Math.max(i,r==this.lines+1?this.length:r<=1?0:this.line(r-1).to))}return new x6(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Nt.empty:e.length<=32?new wr(e):ia.from(wr.split(e,[]))}}class wr extends Nt{constructor(e,r=Bne(e)){super(),this.text=e,this.length=r}get lines(){return this.text.length}get children(){return null}lineInner(e,r,n,i){for(let a=0;;a++){let s=this.text[a],l=i+s.length;if((r?n:l)>=e)return new Lne(i,l,n,s);i=l+1,n++}}decompose(e,r,n,i){let a=e<=0&&r>=this.length?this:new wr(R4(this.text,e,r),Math.min(r,this.length)-Math.max(0,e));if(i&1){let s=n.pop(),l=Kp(a.text,s.text.slice(),0,a.length);if(l.length<=32)n.push(new wr(l,s.length+a.length));else{let o=l.length>>1;n.push(new wr(l.slice(0,o)),new wr(l.slice(o)))}}else n.push(a)}replace(e,r,n){if(!(n instanceof wr))return super.replace(e,r,n);[e,r]=Iu(this,e,r);let i=Kp(this.text,Kp(n.text,R4(this.text,0,e)),r),a=this.length+n.length-(r-e);return i.length<=32?new wr(i,a):ia.from(wr.split(i,[]),a)}sliceString(e,r=this.length,n=`
416
+ `){[e,r]=Iu(this,e,r);let i="";for(let a=0,s=0;a<=r&&s<this.text.length;s++){let l=this.text[s],o=a+l.length;a>e&&s&&(i+=n),e<o&&r>a&&(i+=l.slice(Math.max(0,e-a),r-a)),a=o+1}return i}flatten(e){for(let r of this.text)e.push(r)}scanIdentical(){return 0}static split(e,r){let n=[],i=-1;for(let a of e)n.push(a),i+=a.length+1,n.length==32&&(r.push(new wr(n,i)),n=[],i=-1);return i>-1&&r.push(new wr(n,i)),r}}class ia extends Nt{constructor(e,r){super(),this.children=e,this.length=r,this.lines=0;for(let n of e)this.lines+=n.lines}lineInner(e,r,n,i){for(let a=0;;a++){let s=this.children[a],l=i+s.length,o=n+s.lines-1;if((r?o:l)>=e)return s.lineInner(e,r,n,i);i=l+1,n=o+1}}decompose(e,r,n,i){for(let a=0,s=0;s<=r&&a<this.children.length;a++){let l=this.children[a],o=s+l.length;if(e<=o&&r>=s){let c=i&((s<=e?1:0)|(o>=r?2:0));s>=e&&o<=r&&!c?n.push(l):l.decompose(e-s,r-s,n,c)}s=o+1}}replace(e,r,n){if([e,r]=Iu(this,e,r),n.lines<this.lines)for(let i=0,a=0;i<this.children.length;i++){let s=this.children[i],l=a+s.length;if(e>=a&&r<=l){let o=s.replace(e-a,r-a,n),c=this.lines-s.lines+o.lines;if(o.lines<c>>4&&o.lines>c>>6){let h=this.children.slice();return h[i]=o,new ia(h,this.length-(r-e)+n.length)}return super.replace(a,l,o)}a=l+1}return super.replace(e,r,n)}sliceString(e,r=this.length,n=`
417
+ `){[e,r]=Iu(this,e,r);let i="";for(let a=0,s=0;a<this.children.length&&s<=r;a++){let l=this.children[a],o=s+l.length;s>e&&a&&(i+=n),e<o&&r>s&&(i+=l.sliceString(e-s,r-s,n)),s=o+1}return i}flatten(e){for(let r of this.children)r.flatten(e)}scanIdentical(e,r){if(!(e instanceof ia))return 0;let n=0,[i,a,s,l]=r>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=r,a+=r){if(i==s||a==l)return n;let o=this.children[i],c=e.children[a];if(o!=c)return n+o.scanIdentical(c,r);n+=o.length+1}}static from(e,r=e.reduce((n,i)=>n+i.length+1,-1)){let n=0;for(let m of e)n+=m.lines;if(n<32){let m=[];for(let y of e)y.flatten(m);return new wr(m,r)}let i=Math.max(32,n>>5),a=i<<1,s=i>>1,l=[],o=0,c=-1,h=[];function d(m){let y;if(m.lines>a&&m instanceof ia)for(let b of m.children)d(b);else m.lines>s&&(o>s||!o)?(g(),l.push(m)):m instanceof wr&&o&&(y=h[h.length-1])instanceof wr&&m.lines+y.lines<=32?(o+=m.lines,c+=m.length+1,h[h.length-1]=new wr(y.text.concat(m.text),y.length+1+m.length)):(o+m.lines>i&&g(),o+=m.lines,c+=m.length+1,h.push(m))}function g(){o!=0&&(l.push(h.length==1?h[0]:ia.from(h,c)),c=-1,o=h.length=0)}for(let m of e)d(m);return g(),l.length==1?l[0]:new ia(l,r)}}Nt.empty=new wr([""],0);function Bne(t){let e=-1;for(let r of t)e+=r.length+1;return e}function Kp(t,e,r=0,n=1e9){for(let i=0,a=0,s=!0;a<t.length&&i<=n;a++){let l=t[a],o=i+l.length;o>=r&&(o>n&&(l=l.slice(0,n-i)),i<r&&(l=l.slice(r-i)),s?(e[e.length-1]+=l,s=!1):e.push(l)),i=o+1}return e}function R4(t,e,r){return Kp(t,[""],e,r)}class Cf{constructor(e,r=1){this.dir=r,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[r>0?1:(e instanceof wr?e.text.length:e.children.length)<<1]}nextInner(e,r){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,i=this.nodes[n],a=this.offsets[n],s=a>>1,l=i instanceof wr?i.text.length:i.children.length;if(s==(r>0?l:0)){if(n==0)return this.done=!0,this.value="",this;r>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((a&1)==(r>0?0:1)){if(this.offsets[n]+=r,e==0)return this.lineBreak=!0,this.value=`
418
+ `,this;e--}else if(i instanceof wr){let o=i.text[s+(r<0?-1:0)];if(this.offsets[n]+=r,o.length>Math.max(0,e))return this.value=e==0?o:r>0?o.slice(e):o.slice(0,o.length-e),this;e-=o.length}else{let o=i.children[s+(r<0?-1:0)];e>o.length?(e-=o.length,this.offsets[n]+=r):(r<0&&this.offsets[n]--,this.nodes.push(o),this.offsets.push(r>0?1:(o instanceof wr?o.text.length:o.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class b6{constructor(e,r,n){this.value="",this.done=!1,this.cursor=new Cf(e,r>n?-1:1),this.pos=r>n?e.length:0,this.from=Math.min(r,n),this.to=Math.max(r,n)}nextInner(e,r){if(r<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,r<0?this.pos-this.to:this.from-this.pos);let n=r<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*r,this.value=i.length<=n?i:r<0?i.slice(i.length-n):i.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class x6{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:r,lineBreak:n,value:i}=this.inner.next(e);return r&&this.afterBreak?(this.value="",this.afterBreak=!1):r?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Nt.prototype[Symbol.iterator]=function(){return this.iter()},Cf.prototype[Symbol.iterator]=b6.prototype[Symbol.iterator]=x6.prototype[Symbol.iterator]=function(){return this});class Lne{constructor(e,r,n,i){this.from=e,this.to=r,this.number=n,this.text=i}get length(){return this.to-this.from}}function Iu(t,e,r){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,r))]}function Wr(t,e,r=!0,n=!0){return _ne(t,e,r,n)}function Pne(t){return t>=56320&&t<57344}function zne(t){return t>=55296&&t<56320}function Vn(t,e){let r=t.charCodeAt(e);if(!zne(r)||e+1==t.length)return r;let n=t.charCodeAt(e+1);return Pne(n)?(r-55296<<10)+(n-56320)+65536:r}function kE(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function aa(t){return t<65536?1:2}const Ek=/\r\n?|\n/;var On=(function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t})(On||(On={}));class ha{constructor(e){this.sections=e}get length(){let e=0;for(let r=0;r<this.sections.length;r+=2)e+=this.sections[r];return e}get newLength(){let e=0;for(let r=0;r<this.sections.length;r+=2){let n=this.sections[r+1];e+=n<0?this.sections[r]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let r=0,n=0,i=0;r<this.sections.length;){let a=this.sections[r++],s=this.sections[r++];s<0?(e(n,i,a),i+=a):i+=s,n+=a}}iterChangedRanges(e,r=!1){Ak(this,e,r)}get invertedDesc(){let e=[];for(let r=0;r<this.sections.length;){let n=this.sections[r++],i=this.sections[r++];i<0?e.push(n,i):e.push(i,n)}return new ha(e)}composeDesc(e){return this.empty?e:e.empty?this:w6(this,e)}mapDesc(e,r=!1){return e.empty?this:Ok(this,e,r)}mapPos(e,r=-1,n=On.Simple){let i=0,a=0;for(let s=0;s<this.sections.length;){let l=this.sections[s++],o=this.sections[s++],c=i+l;if(o<0){if(c>e)return a+(e-i);a+=l}else{if(n!=On.Simple&&c>=e&&(n==On.TrackDel&&i<e&&c>e||n==On.TrackBefore&&i<e||n==On.TrackAfter&&c>e))return null;if(c>e||c==e&&r<0&&!l)return e==i||r<0?a:a+o;a+=o}i=c}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return a}touchesRange(e,r=e){for(let n=0,i=0;n<this.sections.length&&i<=r;){let a=this.sections[n++],s=this.sections[n++],l=i+a;if(s>=0&&i<=r&&l>=e)return i<e&&l>r?"cover":!0;i=l}return!1}toString(){let e="";for(let r=0;r<this.sections.length;){let n=this.sections[r++],i=this.sections[r++];e+=(e?" ":"")+n+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(r=>typeof r!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new ha(e)}static create(e){return new ha(e)}}class Pr extends ha{constructor(e,r){super(e),this.inserted=r}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Ak(this,(r,n,i,a,s)=>e=e.replace(i,i+(n-r),s),!1),e}mapDesc(e,r=!1){return Ok(this,e,r,!0)}invert(e){let r=this.sections.slice(),n=[];for(let i=0,a=0;i<r.length;i+=2){let s=r[i],l=r[i+1];if(l>=0){r[i]=l,r[i+1]=s;let o=i>>1;for(;n.length<o;)n.push(Nt.empty);n.push(s?e.slice(a,a+s):Nt.empty)}a+=s}return new Pr(r,n)}compose(e){return this.empty?e:e.empty?this:w6(this,e,!0)}map(e,r=!1){return e.empty?this:Ok(this,e,r,!0)}iterChanges(e,r=!1){Ak(this,e,r)}get desc(){return ha.create(this.sections)}filter(e){let r=[],n=[],i=[],a=new Yf(this);e:for(let s=0,l=0;;){let o=s==e.length?1e9:e[s++];for(;l<o||l==o&&a.len==0;){if(a.done)break e;let h=Math.min(a.len,o-l);vn(i,h,-1);let d=a.ins==-1?-1:a.off==0?a.ins:0;vn(r,h,d),d>0&&js(n,r,a.text),a.forward(h),l+=h}let c=e[s++];for(;l<c;){if(a.done)break e;let h=Math.min(a.len,c-l);vn(r,h,-1),vn(i,h,a.ins==-1?-1:a.off==0?a.ins:0),a.forward(h),l+=h}}return{changes:new Pr(r,n),filtered:ha.create(i)}}toJSON(){let e=[];for(let r=0;r<this.sections.length;r+=2){let n=this.sections[r],i=this.sections[r+1];i<0?e.push(n):i==0?e.push([n]):e.push([n].concat(this.inserted[r>>1].toJSON()))}return e}static of(e,r,n){let i=[],a=[],s=0,l=null;function o(h=!1){if(!h&&!i.length)return;s<r&&vn(i,r-s,-1);let d=new Pr(i,a);l=l?l.compose(d.map(l)):d,i=[],a=[],s=0}function c(h){if(Array.isArray(h))for(let d of h)c(d);else if(h instanceof Pr){if(h.length!=r)throw new RangeError(`Mismatched change set length (got ${h.length}, expected ${r})`);o(),l=l?l.compose(h.map(l)):h}else{let{from:d,to:g=d,insert:m}=h;if(d>g||d<0||g>r)throw new RangeError(`Invalid change range ${d} to ${g} (in doc of length ${r})`);let y=m?typeof m=="string"?Nt.of(m.split(n||Ek)):m:Nt.empty,b=y.length;if(d==g&&b==0)return;d<s&&o(),d>s&&vn(i,d-s,-1),vn(i,g-d,b),js(a,i,y),s=g}}return c(e),o(!l),l}static empty(e){return new Pr(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let r=[],n=[];for(let i=0;i<e.length;i++){let a=e[i];if(typeof a=="number")r.push(a,-1);else{if(!Array.isArray(a)||typeof a[0]!="number"||a.some((s,l)=>l&&typeof s!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(a.length==1)r.push(a[0],0);else{for(;n.length<i;)n.push(Nt.empty);n[i]=Nt.of(a.slice(1)),r.push(a[0],n[i].length)}}}return new Pr(r,n)}static createSet(e,r){return new Pr(e,r)}}function vn(t,e,r,n=!1){if(e==0&&r<=0)return;let i=t.length-2;i>=0&&r<=0&&r==t[i+1]?t[i]+=e:i>=0&&e==0&&t[i]==0?t[i+1]+=r:n?(t[i]+=e,t[i+1]+=r):t.push(e,r)}function js(t,e,r){if(r.length==0)return;let n=e.length-2>>1;if(n<t.length)t[t.length-1]=t[t.length-1].append(r);else{for(;t.length<n;)t.push(Nt.empty);t.push(r)}}function Ak(t,e,r){let n=t.inserted;for(let i=0,a=0,s=0;s<t.sections.length;){let l=t.sections[s++],o=t.sections[s++];if(o<0)i+=l,a+=l;else{let c=i,h=a,d=Nt.empty;for(;c+=l,h+=o,o&&n&&(d=d.append(n[s-2>>1])),!(r||s==t.sections.length||t.sections[s+1]<0);)l=t.sections[s++],o=t.sections[s++];e(i,c,a,h,d),i=c,a=h}}}function Ok(t,e,r,n=!1){let i=[],a=n?[]:null,s=new Yf(t),l=new Yf(e);for(let o=-1;;){if(s.done&&l.len||l.done&&s.len)throw new Error("Mismatched change set lengths");if(s.ins==-1&&l.ins==-1){let c=Math.min(s.len,l.len);vn(i,c,-1),s.forward(c),l.forward(c)}else if(l.ins>=0&&(s.ins<0||o==s.i||s.off==0&&(l.len<s.len||l.len==s.len&&!r))){let c=l.len;for(vn(i,l.ins,-1);c;){let h=Math.min(s.len,c);s.ins>=0&&o<s.i&&s.len<=h&&(vn(i,0,s.ins),a&&js(a,i,s.text),o=s.i),s.forward(h),c-=h}l.next()}else if(s.ins>=0){let c=0,h=s.len;for(;h;)if(l.ins==-1){let d=Math.min(h,l.len);c+=d,h-=d,l.forward(d)}else if(l.ins==0&&l.len<h)h-=l.len,l.next();else break;vn(i,c,o<s.i?s.ins:0),a&&o<s.i&&js(a,i,s.text),o=s.i,s.forward(s.len-h)}else{if(s.done&&l.done)return a?Pr.createSet(i,a):ha.create(i);throw new Error("Mismatched change set lengths")}}}function w6(t,e,r=!1){let n=[],i=r?[]:null,a=new Yf(t),s=new Yf(e);for(let l=!1;;){if(a.done&&s.done)return i?Pr.createSet(n,i):ha.create(n);if(a.ins==0)vn(n,a.len,0,l),a.next();else if(s.len==0&&!s.done)vn(n,0,s.ins,l),i&&js(i,n,s.text),s.next();else{if(a.done||s.done)throw new Error("Mismatched change set lengths");{let o=Math.min(a.len2,s.len),c=n.length;if(a.ins==-1){let h=s.ins==-1?-1:s.off?0:s.ins;vn(n,o,h,l),i&&h&&js(i,n,s.text)}else s.ins==-1?(vn(n,a.off?0:a.len,o,l),i&&js(i,n,a.textBit(o))):(vn(n,a.off?0:a.len,s.off?0:s.ins,l),i&&!s.off&&js(i,n,s.text));l=(a.ins>o||s.ins>=0&&s.len>o)&&(l||n.length>c),a.forward2(o),s.forward(o)}}}}class Yf{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,r=this.i-2>>1;return r>=e.length?Nt.empty:e[r]}textBit(e){let{inserted:r}=this.set,n=this.i-2>>1;return n>=r.length&&!e?Nt.empty:r[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Vl{constructor(e,r,n){this.from=e,this.to=r,this.flags=n}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,r=-1){let n,i;return this.empty?n=i=e.mapPos(this.from,r):(n=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),n==this.from&&i==this.to?this:new Vl(n,i,this.flags)}extend(e,r=e){if(e<=this.anchor&&r>=this.anchor)return Ae.range(e,r);let n=Math.abs(e-this.anchor)>Math.abs(r-this.anchor)?e:r;return Ae.range(this.anchor,n)}eq(e,r=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!r||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return Ae.range(e.anchor,e.head)}static create(e,r,n){return new Vl(e,r,n)}}class Ae{constructor(e,r){this.ranges=e,this.mainIndex=r}map(e,r=-1){return e.empty?this:Ae.create(this.ranges.map(n=>n.map(e,r)),this.mainIndex)}eq(e,r=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],r))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new Ae([this.main],0)}addRange(e,r=!0){return Ae.create([e].concat(this.ranges),r?0:this.mainIndex+1)}replaceRange(e,r=this.mainIndex){let n=this.ranges.slice();return n[r]=e,Ae.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Ae(e.ranges.map(r=>Vl.fromJSON(r)),e.main)}static single(e,r=e){return new Ae([Ae.range(e,r)],0)}static create(e,r=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let n=0,i=0;i<e.length;i++){let a=e[i];if(a.empty?a.from<=n:a.from<n)return Ae.normalized(e.slice(),r);n=a.to}return new Ae(e,r)}static cursor(e,r=0,n,i){return Vl.create(e,e,(r==0?0:r<0?8:16)|(n==null?7:Math.min(6,n))|(i??16777215)<<6)}static range(e,r,n,i){let a=(n??16777215)<<6|(i==null?7:Math.min(6,i));return r<e?Vl.create(r,e,48|a):Vl.create(e,r,(r>e?8:0)|a)}static normalized(e,r=0){let n=e[r];e.sort((i,a)=>i.from-a.from),r=e.indexOf(n);for(let i=1;i<e.length;i++){let a=e[i],s=e[i-1];if(a.empty?a.from<=s.to:a.from<s.to){let l=s.from,o=Math.max(a.to,s.to);i<=r&&r--,e.splice(--i,2,a.anchor>a.head?Ae.range(o,l):Ae.range(l,o))}}return new Ae(e,r)}}function S6(t,e){for(let r of t.ranges)if(r.to>e)throw new RangeError("Selection points outside of document")}let TE=0;class We{constructor(e,r,n,i,a){this.combine=e,this.compareInput=r,this.compare=n,this.isStatic=i,this.id=TE++,this.default=e([]),this.extensions=typeof a=="function"?a(this):a}get reader(){return this}static define(e={}){return new We(e.combine||(r=>r),e.compareInput||((r,n)=>r===n),e.compare||(e.combine?(r,n)=>r===n:EE),!!e.static,e.enables)}of(e){return new Zp([],this,0,e)}compute(e,r){if(this.isStatic)throw new Error("Can't compute a static facet");return new Zp(e,this,1,r)}computeN(e,r){if(this.isStatic)throw new Error("Can't compute a static facet");return new Zp(e,this,2,r)}from(e,r){return r||(r=n=>n),this.compute([e],n=>r(n.field(e)))}}function EE(t,e){return t==e||t.length==e.length&&t.every((r,n)=>r===e[n])}class Zp{constructor(e,r,n,i){this.dependencies=e,this.facet=r,this.type=n,this.value=i,this.id=TE++}dynamicSlot(e){var r;let n=this.value,i=this.facet.compareInput,a=this.id,s=e[a]>>1,l=this.type==2,o=!1,c=!1,h=[];for(let d of this.dependencies)d=="doc"?o=!0:d=="selection"?c=!0:(((r=e[d.id])!==null&&r!==void 0?r:1)&1)==0&&h.push(e[d.id]);return{create(d){return d.values[s]=n(d),1},update(d,g){if(o&&g.docChanged||c&&(g.docChanged||g.selection)||Mk(d,h)){let m=n(d);if(l?!D4(m,d.values[s],i):!i(m,d.values[s]))return d.values[s]=m,1}return 0},reconfigure:(d,g)=>{let m,y=g.config.address[a];if(y!=null){let b=Og(g,y);if(this.dependencies.every(x=>x instanceof We?g.facet(x)===d.facet(x):x instanceof Sn?g.field(x,!1)==d.field(x,!1):!0)||(l?D4(m=n(d),b,i):i(m=n(d),b)))return d.values[s]=b,0}else m=n(d);return d.values[s]=m,1}}}}function D4(t,e,r){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!r(t[n],e[n]))return!1;return!0}function Mk(t,e){let r=!1;for(let n of e)kf(t,n)&1&&(r=!0);return r}function Ine(t,e,r){let n=r.map(o=>t[o.id]),i=r.map(o=>o.type),a=n.filter(o=>!(o&1)),s=t[e.id]>>1;function l(o){let c=[];for(let h=0;h<n.length;h++){let d=Og(o,n[h]);if(i[h]==2)for(let g of d)c.push(g);else c.push(d)}return e.combine(c)}return{create(o){for(let c of n)kf(o,c);return o.values[s]=l(o),1},update(o,c){if(!Mk(o,a))return 0;let h=l(o);return e.compare(h,o.values[s])?0:(o.values[s]=h,1)},reconfigure(o,c){let h=Mk(o,n),d=c.config.facets[e.id],g=c.facet(e);if(d&&!h&&EE(r,d))return o.values[s]=g,0;let m=l(o);return e.compare(m,g)?(o.values[s]=g,0):(o.values[s]=m,1)}}}const hp=We.define({static:!0});class Sn{constructor(e,r,n,i,a){this.id=e,this.createF=r,this.updateF=n,this.compareF=i,this.spec=a,this.provides=void 0}static define(e){let r=new Sn(TE++,e.create,e.update,e.compare||((n,i)=>n===i),e);return e.provide&&(r.provides=e.provide(r)),r}create(e){let r=e.facet(hp).find(n=>n.field==this);return(r?.create||this.createF)(e)}slot(e){let r=e[this.id]>>1;return{create:n=>(n.values[r]=this.create(n),1),update:(n,i)=>{let a=n.values[r],s=this.updateF(a,i);return this.compareF(a,s)?0:(n.values[r]=s,1)},reconfigure:(n,i)=>{let a=n.facet(hp),s=i.facet(hp),l;return(l=a.find(o=>o.field==this))&&l!=s.find(o=>o.field==this)?(n.values[r]=l.create(n),1):i.config.address[this.id]!=null?(n.values[r]=i.field(this),0):(n.values[r]=this.create(n),1)}}}init(e){return[this,hp.of({field:this,create:e})]}get extension(){return this}}const Il={lowest:4,low:3,default:2,high:1,highest:0};function nf(t){return e=>new C6(e,t)}const po={highest:nf(Il.highest),high:nf(Il.high),default:nf(Il.default),low:nf(Il.low),lowest:nf(Il.lowest)};class C6{constructor(e,r){this.inner=e,this.prec=r}}class qv{of(e){return new Rk(this,e)}reconfigure(e){return qv.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Rk{constructor(e,r){this.compartment=e,this.inner=r}}class Ag{constructor(e,r,n,i,a,s){for(this.base=e,this.compartments=r,this.dynamicSlots=n,this.address=i,this.staticValues=a,this.facets=s,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let r=this.address[e.id];return r==null?e.default:this.staticValues[r>>1]}static resolve(e,r,n){let i=[],a=Object.create(null),s=new Map;for(let g of qne(e,r,s))g instanceof Sn?i.push(g):(a[g.facet.id]||(a[g.facet.id]=[])).push(g);let l=Object.create(null),o=[],c=[];for(let g of i)l[g.id]=c.length<<1,c.push(m=>g.slot(m));let h=n?.config.facets;for(let g in a){let m=a[g],y=m[0].facet,b=h&&h[g]||[];if(m.every(x=>x.type==0))if(l[y.id]=o.length<<1|1,EE(b,m))o.push(n.facet(y));else{let x=y.combine(m.map(w=>w.value));o.push(n&&y.compare(x,n.facet(y))?n.facet(y):x)}else{for(let x of m)x.type==0?(l[x.id]=o.length<<1|1,o.push(x.value)):(l[x.id]=c.length<<1,c.push(w=>x.dynamicSlot(w)));l[y.id]=c.length<<1,c.push(x=>Ine(x,y,m))}}let d=c.map(g=>g(l));return new Ag(e,s,d,l,o,a)}}function qne(t,e,r){let n=[[],[],[],[],[]],i=new Map;function a(s,l){let o=i.get(s);if(o!=null){if(o<=l)return;let c=n[o].indexOf(s);c>-1&&n[o].splice(c,1),s instanceof Rk&&r.delete(s.compartment)}if(i.set(s,l),Array.isArray(s))for(let c of s)a(c,l);else if(s instanceof Rk){if(r.has(s.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(s.compartment)||s.inner;r.set(s.compartment,c),a(c,l)}else if(s instanceof C6)a(s.inner,s.prec);else if(s instanceof Sn)n[l].push(s),s.provides&&a(s.provides,l);else if(s instanceof Zp)n[l].push(s),s.facet.extensions&&a(s.facet.extensions,Il.default);else{let c=s.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${s}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);a(c,l)}}return a(t,Il.default),n.reduce((s,l)=>s.concat(l))}function kf(t,e){if(e&1)return 2;let r=e>>1,n=t.status[r];if(n==4)throw new Error("Cyclic dependency between fields and/or facets");if(n&2)return n;t.status[r]=4;let i=t.computeSlot(t,t.config.dynamicSlots[r]);return t.status[r]=2|i}function Og(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const k6=We.define(),Dk=We.define({combine:t=>t.some(e=>e),static:!0}),T6=We.define({combine:t=>t.length?t[0]:void 0,static:!0}),E6=We.define(),A6=We.define(),O6=We.define(),M6=We.define({combine:t=>t.length?t[0]:!1});class ma{constructor(e,r){this.type=e,this.value=r}static define(){return new jne}}class jne{of(e){return new ma(this,e)}}class Fne{constructor(e){this.map=e}of(e){return new yt(this,e)}}class yt{constructor(e,r){this.type=e,this.value=r}map(e){let r=this.type.map(this.value,e);return r===void 0?void 0:r==this.value?this:new yt(this.type,r)}is(e){return this.type==e}static define(e={}){return new Fne(e.map||(r=>r))}static mapEffects(e,r){if(!e.length)return e;let n=[];for(let i of e){let a=i.map(r);a&&n.push(a)}return n}}yt.reconfigure=yt.define();yt.appendConfig=yt.define();class Sr{constructor(e,r,n,i,a,s){this.startState=e,this.changes=r,this.selection=n,this.effects=i,this.annotations=a,this.scrollIntoView=s,this._doc=null,this._state=null,n&&S6(n,r.newLength),a.some(l=>l.type==Sr.time)||(this.annotations=a.concat(Sr.time.of(Date.now())))}static create(e,r,n,i,a,s){return new Sr(e,r,n,i,a,s)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let r of this.annotations)if(r.type==e)return r.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let r=this.annotation(Sr.userEvent);return!!(r&&(r==e||r.length>e.length&&r.slice(0,e.length)==e&&r[e.length]=="."))}}Sr.time=ma.define();Sr.userEvent=ma.define();Sr.addToHistory=ma.define();Sr.remote=ma.define();function Hne(t,e){let r=[];for(let n=0,i=0;;){let a,s;if(n<t.length&&(i==e.length||e[i]>=t[n]))a=t[n++],s=t[n++];else if(i<e.length)a=e[i++],s=e[i++];else return r;!r.length||r[r.length-1]<a?r.push(a,s):r[r.length-1]<s&&(r[r.length-1]=s)}}function R6(t,e,r){var n;let i,a,s;return r?(i=e.changes,a=Pr.empty(e.changes.length),s=t.changes.compose(e.changes)):(i=e.changes.map(t.changes),a=t.changes.mapDesc(e.changes,!0),s=t.changes.compose(i)),{changes:s,selection:e.selection?e.selection.map(a):(n=t.selection)===null||n===void 0?void 0:n.map(i),effects:yt.mapEffects(t.effects,i).concat(yt.mapEffects(e.effects,a)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function _k(t,e,r){let n=e.selection,i=Eu(e.annotations);return e.userEvent&&(i=i.concat(Sr.userEvent.of(e.userEvent))),{changes:e.changes instanceof Pr?e.changes:Pr.of(e.changes||[],r,t.facet(T6)),selection:n&&(n instanceof Ae?n:Ae.single(n.anchor,n.head)),effects:Eu(e.effects),annotations:i,scrollIntoView:!!e.scrollIntoView}}function D6(t,e,r){let n=_k(t,e.length?e[0]:{},t.doc.length);e.length&&e[0].filter===!1&&(r=!1);for(let a=1;a<e.length;a++){e[a].filter===!1&&(r=!1);let s=!!e[a].sequential;n=R6(n,_k(t,e[a],s?n.changes.newLength:t.doc.length),s)}let i=Sr.create(t,n.changes,n.selection,n.effects,n.annotations,n.scrollIntoView);return Une(r?Vne(i):i)}function Vne(t){let e=t.startState,r=!0;for(let i of e.facet(E6)){let a=i(t);if(a===!1){r=!1;break}Array.isArray(a)&&(r=r===!0?a:Hne(r,a))}if(r!==!0){let i,a;if(r===!1)a=t.changes.invertedDesc,i=Pr.empty(e.doc.length);else{let s=t.changes.filter(r);i=s.changes,a=s.filtered.mapDesc(s.changes).invertedDesc}t=Sr.create(e,i,t.selection&&t.selection.map(a),yt.mapEffects(t.effects,a),t.annotations,t.scrollIntoView)}let n=e.facet(A6);for(let i=n.length-1;i>=0;i--){let a=n[i](t);a instanceof Sr?t=a:Array.isArray(a)&&a.length==1&&a[0]instanceof Sr?t=a[0]:t=D6(e,Eu(a),!1)}return t}function Une(t){let e=t.startState,r=e.facet(O6),n=t;for(let i=r.length-1;i>=0;i--){let a=r[i](t);a&&Object.keys(a).length&&(n=R6(n,_k(e,a,t.changes.newLength),!0))}return n==t?t:Sr.create(e,t.changes,t.selection,n.effects,n.annotations,n.scrollIntoView)}const $ne=[];function Eu(t){return t==null?$ne:Array.isArray(t)?t:[t]}var cr=(function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t})(cr||(cr={}));const Gne=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Nk;try{Nk=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Yne(t){if(Nk)return Nk.test(t);for(let e=0;e<t.length;e++){let r=t[e];if(/\w/.test(r)||r>"€"&&(r.toUpperCase()!=r.toLowerCase()||Gne.test(r)))return!0}return!1}function Xne(t){return e=>{if(!/\S/.test(e))return cr.Space;if(Yne(e))return cr.Word;for(let r=0;r<t.length;r++)if(e.indexOf(t[r])>-1)return cr.Word;return cr.Other}}class Dt{constructor(e,r,n,i,a,s){this.config=e,this.doc=r,this.selection=n,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=a,s&&(s._state=this);for(let l=0;l<this.config.dynamicSlots.length;l++)kf(this,l<<1);this.computeSlot=null}field(e,r=!0){let n=this.config.address[e.id];if(n==null){if(r)throw new RangeError("Field is not present in this state");return}return kf(this,n),Og(this,n)}update(...e){return D6(this,e,!0)}applyTransaction(e){let r=this.config,{base:n,compartments:i}=r;for(let l of e.effects)l.is(qv.reconfigure)?(r&&(i=new Map,r.compartments.forEach((o,c)=>i.set(c,o)),r=null),i.set(l.value.compartment,l.value.extension)):l.is(yt.reconfigure)?(r=null,n=l.value):l.is(yt.appendConfig)&&(r=null,n=Eu(n).concat(l.value));let a;r?a=e.startState.values.slice():(r=Ag.resolve(n,i,this),a=new Dt(r,this.doc,this.selection,r.dynamicSlots.map(()=>null),(o,c)=>c.reconfigure(o,this),null).values);let s=e.startState.facet(Dk)?e.newSelection:e.newSelection.asSingle();new Dt(r,e.newDoc,s,a,(l,o)=>o.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:e},range:Ae.cursor(r.from+e.length)}))}changeByRange(e){let r=this.selection,n=e(r.ranges[0]),i=this.changes(n.changes),a=[n.range],s=Eu(n.effects);for(let l=1;l<r.ranges.length;l++){let o=e(r.ranges[l]),c=this.changes(o.changes),h=c.map(i);for(let g=0;g<l;g++)a[g]=a[g].map(h);let d=i.mapDesc(c,!0);a.push(o.range.map(d)),i=i.compose(h),s=yt.mapEffects(s,h).concat(yt.mapEffects(Eu(o.effects),d))}return{changes:i,selection:Ae.create(a,r.mainIndex),effects:s}}changes(e=[]){return e instanceof Pr?e:Pr.of(e,this.doc.length,this.facet(Dt.lineSeparator))}toText(e){return Nt.of(e.split(this.facet(Dt.lineSeparator)||Ek))}sliceDoc(e=0,r=this.doc.length){return this.doc.sliceString(e,r,this.lineBreak)}facet(e){let r=this.config.address[e.id];return r==null?e.default:(kf(this,r),Og(this,r))}toJSON(e){let r={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let i=e[n];i instanceof Sn&&this.config.address[i.id]!=null&&(r[n]=i.spec.toJSON(this.field(e[n]),this))}return r}static fromJSON(e,r={},n){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(n){for(let a in n)if(Object.prototype.hasOwnProperty.call(e,a)){let s=n[a],l=e[a];i.push(s.init(o=>s.spec.fromJSON(l,o)))}}return Dt.create({doc:e.doc,selection:Ae.fromJSON(e.selection),extensions:r.extensions?i.concat([r.extensions]):i})}static create(e={}){let r=Ag.resolve(e.extensions||[],new Map),n=e.doc instanceof Nt?e.doc:Nt.of((e.doc||"").split(r.staticFacet(Dt.lineSeparator)||Ek)),i=e.selection?e.selection instanceof Ae?e.selection:Ae.single(e.selection.anchor,e.selection.head):Ae.single(0);return S6(i,n.length),r.staticFacet(Dk)||(i=i.asSingle()),new Dt(r,n,i,r.dynamicSlots.map(()=>null),(a,s)=>s.create(a),null)}get tabSize(){return this.facet(Dt.tabSize)}get lineBreak(){return this.facet(Dt.lineSeparator)||`
419
+ `}get readOnly(){return this.facet(M6)}phrase(e,...r){for(let n of this.facet(Dt.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}return r.length&&(e=e.replace(/\$(\$|\d*)/g,(n,i)=>{if(i=="$")return"$";let a=+(i||1);return!a||a>r.length?n:r[a-1]})),e}languageDataAt(e,r,n=-1){let i=[];for(let a of this.facet(k6))for(let s of a(this,r,n))Object.prototype.hasOwnProperty.call(s,e)&&i.push(s[e]);return i}charCategorizer(e){let r=this.languageDataAt("wordChars",e);return Xne(r.length?r[0]:"")}wordAt(e){let{text:r,from:n,length:i}=this.doc.lineAt(e),a=this.charCategorizer(e),s=e-n,l=e-n;for(;s>0;){let o=Wr(r,s,!1);if(a(r.slice(o,s))!=cr.Word)break;s=o}for(;l<i;){let o=Wr(r,l);if(a(r.slice(l,o))!=cr.Word)break;l=o}return s==l?null:Ae.range(s+n,l+n)}}Dt.allowMultipleSelections=Dk;Dt.tabSize=We.define({combine:t=>t.length?t[0]:4});Dt.lineSeparator=T6;Dt.readOnly=M6;Dt.phrases=We.define({compare(t,e){let r=Object.keys(t),n=Object.keys(e);return r.length==n.length&&r.every(i=>t[i]==e[i])}});Dt.languageData=k6;Dt.changeFilter=E6;Dt.transactionFilter=A6;Dt.transactionExtender=O6;qv.reconfigure=yt.define();function ya(t,e,r={}){let n={};for(let i of t)for(let a of Object.keys(i)){let s=i[a],l=n[a];if(l===void 0)n[a]=s;else if(!(l===s||s===void 0))if(Object.hasOwnProperty.call(r,a))n[a]=r[a](l,s);else throw new Error("Config merge conflict for field "+a)}for(let i in e)n[i]===void 0&&(n[i]=e[i]);return n}class Js{eq(e){return this==e}range(e,r=e){return Bk.create(e,r,this)}}Js.prototype.startSide=Js.prototype.endSide=0;Js.prototype.point=!1;Js.prototype.mapMode=On.TrackDel;function AE(t,e){return t==e||t.constructor==e.constructor&&t.eq(e)}let Bk=class _6{constructor(e,r,n){this.from=e,this.to=r,this.value=n}static create(e,r,n){return new _6(e,r,n)}};function Lk(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class OE{constructor(e,r,n,i){this.from=e,this.to=r,this.value=n,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,r,n,i=0){let a=n?this.to:this.from;for(let s=i,l=a.length;;){if(s==l)return s;let o=s+l>>1,c=a[o]-e||(n?this.value[o].endSide:this.value[o].startSide)-r;if(o==s)return c>=0?s:l;c>=0?l=o:s=o+1}}between(e,r,n,i){for(let a=this.findIndex(r,-1e9,!0),s=this.findIndex(n,1e9,!1,a);a<s;a++)if(i(this.from[a]+e,this.to[a]+e,this.value[a])===!1)return!1}map(e,r){let n=[],i=[],a=[],s=-1,l=-1;for(let o=0;o<this.value.length;o++){let c=this.value[o],h=this.from[o]+e,d=this.to[o]+e,g,m;if(h==d){let y=r.mapPos(h,c.startSide,c.mapMode);if(y==null||(g=m=y,c.startSide!=c.endSide&&(m=r.mapPos(h,c.endSide),m<g)))continue}else if(g=r.mapPos(h,c.startSide),m=r.mapPos(d,c.endSide),g>m||g==m&&c.startSide>0&&c.endSide<=0)continue;(m-g||c.endSide-c.startSide)<0||(s<0&&(s=g),c.point&&(l=Math.max(l,m-g)),n.push(c),i.push(g-s),a.push(m-s))}return{mapped:n.length?new OE(i,a,n,l):null,pos:s}}}class Et{constructor(e,r,n,i){this.chunkPos=e,this.chunk=r,this.nextLayer=n,this.maxPoint=i}static create(e,r,n,i){return new Et(e,r,n,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let r of this.chunk)e+=r.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:r=[],sort:n=!1,filterFrom:i=0,filterTo:a=this.length}=e,s=e.filter;if(r.length==0&&!s)return this;if(n&&(r=r.slice().sort(Lk)),this.isEmpty)return r.length?Et.of(r):this;let l=new N6(this,null,-1).goto(0),o=0,c=[],h=new Wa;for(;l.value||o<r.length;)if(o<r.length&&(l.from-r[o].from||l.startSide-r[o].value.startSide)>=0){let d=r[o++];h.addInner(d.from,d.to,d.value)||c.push(d)}else l.rangeIndex==1&&l.chunkIndex<this.chunk.length&&(o==r.length||this.chunkEnd(l.chunkIndex)<r[o].from)&&(!s||i>this.chunkEnd(l.chunkIndex)||a<this.chunkPos[l.chunkIndex])&&h.addChunk(this.chunkPos[l.chunkIndex],this.chunk[l.chunkIndex])?l.nextChunk():((!s||i>l.to||a<l.from||s(l.from,l.to,l.value))&&(h.addInner(l.from,l.to,l.value)||c.push(Bk.create(l.from,l.to,l.value))),l.next());return h.finishInner(this.nextLayer.isEmpty&&!c.length?Et.empty:this.nextLayer.update({add:c,filter:s,filterFrom:i,filterTo:a}))}map(e){if(e.empty||this.isEmpty)return this;let r=[],n=[],i=-1;for(let s=0;s<this.chunk.length;s++){let l=this.chunkPos[s],o=this.chunk[s],c=e.touchesRange(l,l+o.length);if(c===!1)i=Math.max(i,o.maxPoint),r.push(o),n.push(e.mapPos(l));else if(c===!0){let{mapped:h,pos:d}=o.map(l,e);h&&(i=Math.max(i,h.maxPoint),r.push(h),n.push(d))}}let a=this.nextLayer.map(e);return r.length==0?a:new Et(n,r,a||Et.empty,i)}between(e,r,n){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let a=this.chunkPos[i],s=this.chunk[i];if(r>=a&&e<=a+s.length&&s.between(a,e-a,r-a,n)===!1)return}this.nextLayer.between(e,r,n)}}iter(e=0){return Xf.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,r=0){return Xf.from(e).goto(r)}static compare(e,r,n,i,a=-1){let s=e.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=a),l=r.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=a),o=_4(s,l,n),c=new af(s,o,a),h=new af(l,o,a);n.iterGaps((d,g,m)=>N4(c,d,h,g,m,i)),n.empty&&n.length==0&&N4(c,0,h,0,0,i)}static eq(e,r,n=0,i){i==null&&(i=999999999);let a=e.filter(h=>!h.isEmpty&&r.indexOf(h)<0),s=r.filter(h=>!h.isEmpty&&e.indexOf(h)<0);if(a.length!=s.length)return!1;if(!a.length)return!0;let l=_4(a,s),o=new af(a,l,0).goto(n),c=new af(s,l,0).goto(n);for(;;){if(o.to!=c.to||!Pk(o.active,c.active)||o.point&&(!c.point||!AE(o.point,c.point)))return!1;if(o.to>i)return!0;o.next(),c.next()}}static spans(e,r,n,i,a=-1){let s=new af(e,null,a).goto(r),l=r,o=s.openStart;for(;;){let c=Math.min(s.to,n);if(s.point){let h=s.activeForPoint(s.to),d=s.pointFrom<r?h.length+1:s.point.startSide<0?h.length:Math.min(h.length,o);i.point(l,c,s.point,h,d,s.pointRank),o=Math.min(s.openEnd(c),h.length)}else c>l&&(i.span(l,c,s.active,o),o=s.openEnd(c));if(s.to>n)return o+(s.point&&s.to>n?1:0);l=s.to,s.next()}}static of(e,r=!1){let n=new Wa;for(let i of e instanceof Bk?[e]:r?Wne(e):e)n.add(i.from,i.to,i.value);return n.finish()}static join(e){if(!e.length)return Et.empty;let r=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let i=e[n];i!=Et.empty;i=i.nextLayer)r=new Et(i.chunkPos,i.chunk,r,Math.max(i.maxPoint,r.maxPoint));return r}}Et.empty=new Et([],[],null,-1);function Wne(t){if(t.length>1)for(let e=t[0],r=1;r<t.length;r++){let n=t[r];if(Lk(e,n)>0)return t.slice().sort(Lk);e=n}return t}Et.empty.nextLayer=Et.empty;class Wa{finishChunk(e){this.chunks.push(new OE(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,r,n){this.addInner(e,r,n)||(this.nextLayer||(this.nextLayer=new Wa)).add(e,r,n)}addInner(e,r,n){let i=e-this.lastTo||n.startSide-this.last.endSide;if(i<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return i<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(r-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=r,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,r-e)),!0)}addChunk(e,r){if((e-this.lastTo||r.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,r.maxPoint),this.chunks.push(r),this.chunkPos.push(e);let n=r.value.length-1;return this.last=r.value[n],this.lastFrom=r.from[n]+e,this.lastTo=r.to[n]+e,!0}finish(){return this.finishInner(Et.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let r=Et.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,r}}function _4(t,e,r){let n=new Map;for(let a of t)for(let s=0;s<a.chunk.length;s++)a.chunk[s].maxPoint<=0&&n.set(a.chunk[s],a.chunkPos[s]);let i=new Set;for(let a of e)for(let s=0;s<a.chunk.length;s++){let l=n.get(a.chunk[s]);l!=null&&(r?r.mapPos(l):l)==a.chunkPos[s]&&!r?.touchesRange(l,l+a.chunk[s].length)&&i.add(a.chunk[s])}return i}class N6{constructor(e,r,n,i=0){this.layer=e,this.skip=r,this.minPoint=n,this.rank=i}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,r=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,r,!1),this}gotoInner(e,r,n){for(;this.chunkIndex<this.layer.chunk.length;){let i=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(i)||this.layer.chunkEnd(this.chunkIndex)<e||i.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let i=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],r,!0);(!n||this.rangeIndex<i)&&this.setRangeIndex(i)}this.next()}forward(e,r){(this.to-e||this.endSide-r)<0&&this.gotoInner(e,r,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],r=this.layer.chunk[this.chunkIndex],n=e+r.from[this.rangeIndex];if(this.from=n,this.to=e+r.to[this.rangeIndex],this.value=r.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class Xf{constructor(e){this.heap=e}static from(e,r=null,n=-1){let i=[];for(let a=0;a<e.length;a++)for(let s=e[a];!s.isEmpty;s=s.nextLayer)s.maxPoint>=n&&i.push(new N6(s,r,n,a));return i.length==1?i[0]:new Xf(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,r=-1e9){for(let n of this.heap)n.goto(e,r);for(let n=this.heap.length>>1;n>=0;n--)mC(this.heap,n);return this.next(),this}forward(e,r){for(let n of this.heap)n.forward(e,r);for(let n=this.heap.length>>1;n>=0;n--)mC(this.heap,n);(this.to-e||this.value.endSide-r)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),mC(this.heap,0)}}}function mC(t,e){for(let r=t[e];;){let n=(e<<1)+1;if(n>=t.length)break;let i=t[n];if(n+1<t.length&&i.compare(t[n+1])>=0&&(i=t[n+1],n++),r.compare(i)<0)break;t[n]=r,t[e]=i,e=n}}class af{constructor(e,r,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Xf.from(e,r,n)}goto(e,r=-1e9){return this.cursor.goto(e,r),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=r,this.openStart=-1,this.next(),this}forward(e,r){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-r)<0;)this.removeActive(this.minActive);this.cursor.forward(e,r)}removeActive(e){dp(this.active,e),dp(this.activeTo,e),dp(this.activeRank,e),this.minActive=B4(this.active,this.activeTo)}addActive(e){let r=0,{value:n,to:i,rank:a}=this.cursor;for(;r<this.activeRank.length&&(a-this.activeRank[r]||i-this.activeTo[r])>0;)r++;pp(this.active,r,n),pp(this.activeTo,r,i),pp(this.activeRank,r,a),e&&pp(e,r,this.cursor.from),this.minActive=B4(this.active,this.activeTo)}next(){let e=this.to,r=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),n&&dp(n,i)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let a=this.cursor.value;if(!a.point)this.addActive(n),this.cursor.next();else if(r&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=a,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=a.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(n){this.openStart=0;for(let i=n.length-1;i>=0&&n[i]<e;i--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let r=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&r.push(this.active[n]);return r.reverse()}openEnd(e){let r=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)r++;return r}}function N4(t,e,r,n,i,a){t.goto(e),r.goto(n);let s=n+i,l=n,o=n-e,c=!!a.boundChange;for(let h=!1;;){let d=t.to+o-r.to,g=d||t.endSide-r.endSide,m=g<0?t.to+o:r.to,y=Math.min(m,s);if(t.point||r.point?(t.point&&r.point&&AE(t.point,r.point)&&Pk(t.activeForPoint(t.to),r.activeForPoint(r.to))||a.comparePoint(l,y,t.point,r.point),h=!1):(h&&a.boundChange(l),y>l&&!Pk(t.active,r.active)&&a.compareRange(l,y,t.active,r.active),c&&y<s&&(d||t.openEnd(m)!=r.openEnd(m))&&(h=!0)),m>s)break;l=m,g<=0&&t.next(),g>=0&&r.next()}}function Pk(t,e){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!=e[r]&&!AE(t[r],e[r]))return!1;return!0}function dp(t,e){for(let r=e,n=t.length-1;r<n;r++)t[r]=t[r+1];t.pop()}function pp(t,e,r){for(let n=t.length-1;n>=e;n--)t[n+1]=t[n];t[e]=r}function B4(t,e){let r=-1,n=1e9;for(let i=0;i<e.length;i++)(e[i]-n||t[i].endSide-t[r].endSide)<0&&(r=i,n=e[i]);return r}function rc(t,e,r=t.length){let n=0;for(let i=0;i<r&&i<t.length;)t.charCodeAt(i)==9?(n+=e-n%e,i++):(n++,i=Wr(t,i));return n}function zk(t,e,r,n){for(let i=0,a=0;;){if(a>=e)return i;if(i==t.length)break;a+=t.charCodeAt(i)==9?r-a%r:1,i=Wr(t,i)}return n===!0?-1:t.length}const Ik="ͼ",L4=typeof Symbol>"u"?"__"+Ik:Symbol.for(Ik),qk=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),P4=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class el{constructor(e,r){this.rules=[];let{finish:n}=r||{};function i(s){return/^@/.test(s)?[s]:s.split(/,\s*/)}function a(s,l,o,c){let h=[],d=/^@(\w+)\b/.exec(s[0]),g=d&&d[1]=="keyframes";if(d&&l==null)return o.push(s[0]+";");for(let m in l){let y=l[m];if(/&/.test(m))a(m.split(/,\s*/).map(b=>s.map(x=>b.replace(/&/,x))).reduce((b,x)=>b.concat(x)),y,o);else if(y&&typeof y=="object"){if(!d)throw new RangeError("The value of a property ("+m+") should be a primitive value.");a(i(m),y,h,g)}else y!=null&&h.push(m.replace(/_.*/,"").replace(/[A-Z]/g,b=>"-"+b.toLowerCase())+": "+y+";")}(h.length||g)&&o.push((n&&!d&&!c?s.map(n):s).join(", ")+" {"+h.join(" ")+"}")}for(let s in e)a(i(s),e[s],this.rules)}getRules(){return this.rules.join(`
420
+ `)}static newName(){let e=P4[L4]||1;return P4[L4]=e+1,Ik+e.toString(36)}static mount(e,r,n){let i=e[qk],a=n&&n.nonce;i?a&&i.setNonce(a):i=new Qne(e,a),i.mount(Array.isArray(r)?r:[r],e)}}let z4=new Map;class Qne{constructor(e,r){let n=e.ownerDocument||e,i=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let a=z4.get(n);if(a)return e[qk]=a;this.sheet=new i.CSSStyleSheet,z4.set(n,this)}else this.styleTag=n.createElement("style"),r&&this.styleTag.setAttribute("nonce",r);this.modules=[],e[qk]=this}mount(e,r){let n=this.sheet,i=0,a=0;for(let s=0;s<e.length;s++){let l=e[s],o=this.modules.indexOf(l);if(o<a&&o>-1&&(this.modules.splice(o,1),a--,o=-1),o==-1){if(this.modules.splice(a++,0,l),n)for(let c=0;c<l.rules.length;c++)n.insertRule(l.rules[c],i++)}else{for(;a<o;)i+=this.modules[a++].rules.length;i+=l.rules.length,a++}}if(n)r.adoptedStyleSheets.indexOf(this.sheet)<0&&(r.adoptedStyleSheets=[this.sheet,...r.adoptedStyleSheets]);else{let s="";for(let o=0;o<this.modules.length;o++)s+=this.modules[o].getRules()+`
421
+ `;this.styleTag.textContent=s;let l=r.head||r;this.styleTag.parentNode!=l&&l.insertBefore(this.styleTag,l.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var tl={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Wf={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Kne=typeof navigator<"u"&&/Mac/.test(navigator.platform),Zne=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var an=0;an<10;an++)tl[48+an]=tl[96+an]=String(an);for(var an=1;an<=24;an++)tl[an+111]="F"+an;for(var an=65;an<=90;an++)tl[an]=String.fromCharCode(an+32),Wf[an]=String.fromCharCode(an);for(var yC in tl)Wf.hasOwnProperty(yC)||(Wf[yC]=tl[yC]);function Jne(t){var e=Kne&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Zne&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",r=!e&&t.key||(t.shiftKey?Wf:tl)[t.keyCode]||t.key||"Unidentified";return r=="Esc"&&(r="Escape"),r=="Del"&&(r="Delete"),r=="Left"&&(r="ArrowLeft"),r=="Up"&&(r="ArrowUp"),r=="Right"&&(r="ArrowRight"),r=="Down"&&(r="ArrowDown"),r}function Wt(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,r=arguments[1];if(r&&typeof r=="object"&&r.nodeType==null&&!Array.isArray(r)){for(var n in r)if(Object.prototype.hasOwnProperty.call(r,n)){var i=r[n];typeof i=="string"?t.setAttribute(n,i):i!=null&&(t[n]=i)}e++}for(;e<arguments.length;e++)B6(t,arguments[e]);return t}function B6(t,e){if(typeof e=="string")t.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)t.appendChild(e);else if(Array.isArray(e))for(var r=0;r<e.length;r++)B6(t,e[r]);else throw new RangeError("Unsupported child node: "+e)}let En=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},jk=typeof document<"u"?document:{documentElement:{style:{}}};const Fk=/Edge\/(\d+)/.exec(En.userAgent),L6=/MSIE \d/.test(En.userAgent),Hk=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(En.userAgent),jv=!!(L6||Hk||Fk),I4=!jv&&/gecko\/(\d+)/i.test(En.userAgent),bC=!jv&&/Chrome\/(\d+)/.exec(En.userAgent),eie="webkitFontSmoothing"in jk.documentElement.style,Vk=!jv&&/Apple Computer/.test(En.vendor),q4=Vk&&(/Mobile\/\w+/.test(En.userAgent)||En.maxTouchPoints>2);var Xe={mac:q4||/Mac/.test(En.platform),windows:/Win/.test(En.platform),linux:/Linux|X11/.test(En.platform),ie:jv,ie_version:L6?jk.documentMode||6:Hk?+Hk[1]:Fk?+Fk[1]:0,gecko:I4,gecko_version:I4?+(/Firefox\/(\d+)/.exec(En.userAgent)||[0,0])[1]:0,chrome:!!bC,chrome_version:bC?+bC[1]:0,ios:q4,android:/Android\b/.test(En.userAgent),webkit_version:eie?+(/\bAppleWebKit\/(\d+)/.exec(En.userAgent)||[0,0])[1]:0,safari:Vk,safari_version:Vk?+(/\bVersion\/(\d+(\.\d+)?)/.exec(En.userAgent)||[0,0])[1]:0,tabSize:jk.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function ME(t,e){for(let r in t)r=="class"&&e.class?e.class+=" "+t.class:r=="style"&&e.style?e.style+=";"+t.style:e[r]=t[r];return e}const Mg=Object.create(null);function RE(t,e,r){if(t==e)return!0;t||(t=Mg),e||(e=Mg);let n=Object.keys(t),i=Object.keys(e);if(n.length-0!=i.length-0)return!1;for(let a of n)if(a!=r&&(i.indexOf(a)==-1||t[a]!==e[a]))return!1;return!0}function tie(t,e){for(let r=t.attributes.length-1;r>=0;r--){let n=t.attributes[r].name;e[n]==null&&t.removeAttribute(n)}for(let r in e){let n=e[r];r=="style"?t.style.cssText=n:t.getAttribute(r)!=n&&t.setAttribute(r,n)}}function j4(t,e,r){let n=!1;if(e)for(let i in e)r&&i in r||(n=!0,i=="style"?t.style.cssText="":t.removeAttribute(i));if(r)for(let i in r)e&&e[i]==r[i]||(n=!0,i=="style"?t.style.cssText=r[i]:t.setAttribute(i,r[i]));return n}function rie(t){let e=Object.create(null);for(let r=0;r<t.attributes.length;r++){let n=t.attributes[r];e[n.name]=n.value}return e}class ba{eq(e){return!1}updateDOM(e,r){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,r,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var un=(function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t})(un||(un={}));class ut extends Js{constructor(e,r,n,i){super(),this.startSide=e,this.endSide=r,this.widget=n,this.spec=i}get heightRelevant(){return!1}static mark(e){return new Mh(e)}static widget(e){let r=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return r+=n&&!e.inlineOrder?r>0?3e8:-4e8:r>0?1e8:-1e8,new ro(e,r,r,n,e.widget||null,!1)}static replace(e){let r=!!e.block,n,i;if(e.isBlockGap)n=-5e8,i=4e8;else{let{start:a,end:s}=P6(e,r);n=(a?r?-3e8:-1:5e8)-1,i=(s?r?2e8:1:-6e8)+1}return new ro(e,n,i,r,e.widget||null,!0)}static line(e){return new Rh(e)}static set(e,r=!1){return Et.of(e,r)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}ut.none=Et.empty;class Mh extends ut{constructor(e){let{start:r,end:n}=P6(e);super(r?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?ME(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||Mg}eq(e){return this==e||e instanceof Mh&&this.tagName==e.tagName&&RE(this.attrs,e.attrs)}range(e,r=e){if(e>=r)throw new RangeError("Mark decorations may not be empty");return super.range(e,r)}}Mh.prototype.point=!1;class Rh extends ut{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Rh&&this.spec.class==e.spec.class&&RE(this.spec.attributes,e.spec.attributes)}range(e,r=e){if(r!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,r)}}Rh.prototype.mapMode=On.TrackBefore;Rh.prototype.point=!0;class ro extends ut{constructor(e,r,n,i,a,s){super(r,n,a,e),this.block=i,this.isReplace=s,this.mapMode=i?r<=0?On.TrackBefore:On.TrackAfter:On.TrackDel}get type(){return this.startSide!=this.endSide?un.WidgetRange:this.startSide<=0?un.WidgetBefore:un.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof ro&&nie(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,r=e){if(this.isReplace&&(e>r||e==r&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&r!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,r)}}ro.prototype.point=!0;function P6(t,e=!1){let{inclusiveStart:r,inclusiveEnd:n}=t;return r==null&&(r=t.inclusive),n==null&&(n=t.inclusive),{start:r??e,end:n??e}}function nie(t,e){return t==e||!!(t&&e&&t.compare(e))}function Au(t,e,r,n=0){let i=r.length-1;i>=0&&r[i]+n>=t?r[i]=Math.max(r[i],e):r.push(t,e)}class Qf extends Js{constructor(e,r){super(),this.tagName=e,this.attributes=r}eq(e){return e==this||e instanceof Qf&&this.tagName==e.tagName&&RE(this.attributes,e.attributes)}static create(e){return new Qf(e.tagName,e.attributes||Mg)}static set(e,r=!1){return Et.of(e,r)}}Qf.prototype.startSide=Qf.prototype.endSide=-1;function Kf(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function Uk(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function Tf(t,e){if(!e.anchorNode)return!1;try{return Uk(t,e.anchorNode)}catch{return!1}}function Ef(t){return t.nodeType==3?Jf(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function Af(t,e,r,n){return r?F4(t,e,r,n,-1)||F4(t,e,r,n,1):!1}function rl(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function Rg(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function F4(t,e,r,n,i){for(;;){if(t==r&&e==n)return!0;if(e==(i<0?0:Qa(t))){if(t.nodeName=="DIV")return!1;let a=t.parentNode;if(!a||a.nodeType!=1)return!1;e=rl(t)+(i<0?0:1),t=a}else if(t.nodeType==1){if(t=t.childNodes[e+(i<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=i<0?Qa(t):0}else return!1}}function Qa(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Zf(t,e){let r=e?t.left:t.right;return{left:r,right:r,top:t.top,bottom:t.bottom}}function iie(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function z6(t,e){let r=e.width/t.offsetWidth,n=e.height/t.offsetHeight;return(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.width-t.offsetWidth)<1)&&(r=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.height-t.offsetHeight)<1)&&(n=1),{scaleX:r,scaleY:n}}function aie(t,e,r,n,i,a,s,l){let o=t.ownerDocument,c=o.defaultView||window;for(let h=t,d=!1;h&&!d;)if(h.nodeType==1){let g,m=h==o.body,y=1,b=1;if(m)g=iie(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(d=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let S=h.getBoundingClientRect();({scaleX:y,scaleY:b}=z6(h,S)),g={left:S.left,right:S.left+h.clientWidth*y,top:S.top,bottom:S.top+h.clientHeight*b}}let x=0,w=0;if(i=="nearest")e.top<g.top?(w=e.top-(g.top+s),r>0&&e.bottom>g.bottom+w&&(w=e.bottom-g.bottom+s)):e.bottom>g.bottom&&(w=e.bottom-g.bottom+s,r<0&&e.top-w<g.top&&(w=e.top-(g.top+s)));else{let S=e.bottom-e.top,k=g.bottom-g.top;w=(i=="center"&&S<=k?e.top+S/2-k/2:i=="start"||i=="center"&&r<0?e.top-s:e.bottom-k+s)-g.top}if(n=="nearest"?e.left<g.left?(x=e.left-(g.left+a),r>0&&e.right>g.right+x&&(x=e.right-g.right+a)):e.right>g.right&&(x=e.right-g.right+a,r<0&&e.left<g.left+x&&(x=e.left-(g.left+a))):x=(n=="center"?e.left+(e.right-e.left)/2-(g.right-g.left)/2:n=="start"==l?e.left-a:e.right-(g.right-g.left)+a)-g.left,x||w)if(m)c.scrollBy(x,w);else{let S=0,k=0;if(w){let E=h.scrollTop;h.scrollTop+=w/b,k=(h.scrollTop-E)*b}if(x){let E=h.scrollLeft;h.scrollLeft+=x/y,S=(h.scrollLeft-E)*y}e={left:e.left-S,top:e.top-k,right:e.right-S,bottom:e.bottom-k},S&&Math.abs(S-x)<1&&(n="nearest"),k&&Math.abs(k-w)<1&&(i="nearest")}if(m)break;(e.top<g.top||e.bottom>g.bottom||e.left<g.left||e.right>g.right)&&(e={left:Math.max(e.left,g.left),right:Math.min(e.right,g.right),top:Math.max(e.top,g.top),bottom:Math.min(e.bottom,g.bottom)}),h=h.assignedSlot||h.parentNode}else if(h.nodeType==11)h=h.host;else break}function I6(t,e=!0){let r=t.ownerDocument,n=null,i=null;for(let a=t.parentNode;a&&!(a==r.body||(!e||n)&&i);)if(a.nodeType==1)!i&&a.scrollHeight>a.clientHeight&&(i=a),e&&!n&&a.scrollWidth>a.clientWidth&&(n=a),a=a.assignedSlot||a.parentNode;else if(a.nodeType==11)a=a.host;else break;return{x:n,y:i}}class sie{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:r,focusNode:n}=e;this.set(r,Math.min(e.anchorOffset,r?Qa(r):0),n,Math.min(e.focusOffset,n?Qa(n):0))}set(e,r,n,i){this.anchorNode=e,this.anchorOffset=r,this.focusNode=n,this.focusOffset=i}}let Ll=null;Xe.safari&&Xe.safari_version>=26&&(Ll=!1);function q6(t){if(t.setActive)return t.setActive();if(Ll)return t.focus(Ll);let e=[];for(let r=t;r&&(e.push(r,r.scrollTop,r.scrollLeft),r!=r.ownerDocument);r=r.parentNode);if(t.focus(Ll==null?{get preventScroll(){return Ll={preventScroll:!0},!0}}:void 0),!Ll){Ll=!1;for(let r=0;r<e.length;){let n=e[r++],i=e[r++],a=e[r++];n.scrollTop!=i&&(n.scrollTop=i),n.scrollLeft!=a&&(n.scrollLeft=a)}}}let H4;function Jf(t,e,r=e){let n=H4||(H4=document.createRange());return n.setEnd(t,r),n.setStart(t,e),n}function Ou(t,e,r,n){let i={key:e,code:e,keyCode:r,which:r,cancelable:!0};n&&({altKey:i.altKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,metaKey:i.metaKey}=n);let a=new KeyboardEvent("keydown",i);a.synthetic=!0,t.dispatchEvent(a);let s=new KeyboardEvent("keyup",i);return s.synthetic=!0,t.dispatchEvent(s),a.defaultPrevented||s.defaultPrevented}function lie(t){for(;t;){if(t&&(t.nodeType==9||t.nodeType==11&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function oie(t,e){let r=e.focusNode,n=e.focusOffset;if(!r||e.anchorNode!=r||e.anchorOffset!=n)return!1;for(n=Math.min(n,Qa(r));;)if(n){if(r.nodeType!=1)return!1;let i=r.childNodes[n-1];i.contentEditable=="false"?n--:(r=i,n=Qa(r))}else{if(r==t)return!0;n=rl(r),r=r.parentNode}}function j6(t){return t instanceof Window?t.pageYOffset>Math.max(0,t.document.documentElement.scrollHeight-t.innerHeight-4):t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}function F6(t,e){for(let r=t,n=e;;){if(r.nodeType==3&&n>0)return{node:r,offset:n};if(r.nodeType==1&&n>0){if(r.contentEditable=="false")return null;r=r.childNodes[n-1],n=Qa(r)}else if(r.parentNode&&!Rg(r))n=rl(r),r=r.parentNode;else return null}}function H6(t,e){for(let r=t,n=e;;){if(r.nodeType==3&&n<r.nodeValue.length)return{node:r,offset:n};if(r.nodeType==1&&n<r.childNodes.length){if(r.contentEditable=="false")return null;r=r.childNodes[n],n=0}else if(r.parentNode&&!Rg(r))n=rl(r)+1,r=r.parentNode;else return null}}class zi{constructor(e,r,n=!0){this.node=e,this.offset=r,this.precise=n}static before(e,r){return new zi(e.parentNode,rl(e),r)}static after(e,r){return new zi(e.parentNode,rl(e)+1,r)}}var Jt=(function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t})(Jt||(Jt={}));const no=Jt.LTR,DE=Jt.RTL;function V6(t){let e=[];for(let r=0;r<t.length;r++)e.push(1<<+t[r]);return e}const uie=V6("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),cie=V6("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),$k=Object.create(null),Ji=[];for(let t of["()","[]","{}"]){let e=t.charCodeAt(0),r=t.charCodeAt(1);$k[e]=r,$k[r]=-e}function U6(t){return t<=247?uie[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?cie[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8204?256:64336<=t&&t<=65023?4:1}const fie=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class oa{get dir(){return this.level%2?DE:no}constructor(e,r,n){this.from=e,this.to=r,this.level=n}side(e,r){return this.dir==r==e?this.to:this.from}forward(e,r){return e==(this.dir==r)}static find(e,r,n,i){let a=-1;for(let s=0;s<e.length;s++){let l=e[s];if(l.from<=r&&l.to>=r){if(l.level==n)return s;(a<0||(i!=0?i<0?l.from<r:l.to>r:e[a].level>l.level))&&(a=s)}}if(a<0)throw new RangeError("Index out of range");return a}}function $6(t,e){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++){let n=t[r],i=e[r];if(n.from!=i.from||n.to!=i.to||n.direction!=i.direction||!$6(n.inner,i.inner))return!1}return!0}const Kt=[];function hie(t,e,r,n,i){for(let a=0;a<=n.length;a++){let s=a?n[a-1].to:e,l=a<n.length?n[a].from:r,o=a?256:i;for(let c=s,h=o,d=o;c<l;c++){let g=U6(t.charCodeAt(c));g==512?g=h:g==8&&d==4&&(g=16),Kt[c]=g==4?2:g,g&7&&(d=g),h=g}for(let c=s,h=o,d=o;c<l;c++){let g=Kt[c];if(g==128)c<l-1&&h==Kt[c+1]&&h&24?g=Kt[c]=h:Kt[c]=256;else if(g==64){let m=c+1;for(;m<l&&Kt[m]==64;)m++;let y=c&&h==8||m<r&&Kt[m]==8?d==1?1:8:256;for(let b=c;b<m;b++)Kt[b]=y;c=m-1}else g==8&&d==1&&(Kt[c]=1);h=g,g&7&&(d=g)}}}function die(t,e,r,n,i){let a=i==1?2:1;for(let s=0,l=0,o=0;s<=n.length;s++){let c=s?n[s-1].to:e,h=s<n.length?n[s].from:r;for(let d=c,g,m,y;d<h;d++)if(m=$k[g=t.charCodeAt(d)])if(m<0){for(let b=l-3;b>=0;b-=3)if(Ji[b+1]==-m){let x=Ji[b+2],w=x&2?i:x&4?x&1?a:i:0;w&&(Kt[d]=Kt[Ji[b]]=w),l=b;break}}else{if(Ji.length==189)break;Ji[l++]=d,Ji[l++]=g,Ji[l++]=o}else if((y=Kt[d])==2||y==1){let b=y==i;o=b?0:1;for(let x=l-3;x>=0;x-=3){let w=Ji[x+2];if(w&2)break;if(b)Ji[x+2]|=2;else{if(w&4)break;Ji[x+2]|=4}}}}}function pie(t,e,r,n){for(let i=0,a=n;i<=r.length;i++){let s=i?r[i-1].to:t,l=i<r.length?r[i].from:e;for(let o=s;o<l;){let c=Kt[o];if(c==256){let h=o+1;for(;;)if(h==l){if(i==r.length)break;h=r[i++].to,l=i<r.length?r[i].from:e}else if(Kt[h]==256)h++;else break;let d=a==1,g=(h<e?Kt[h]:n)==1,m=d==g?d?1:2:n;for(let y=h,b=i,x=b?r[b-1].to:t;y>o;)y==x&&(y=r[--b].from,x=b?r[b-1].to:t),Kt[--y]=m;o=h}else a=c,o++}}}function Gk(t,e,r,n,i,a,s){let l=n%2?2:1;if(n%2==i%2)for(let o=e,c=0;o<r;){let h=!0,d=!1;if(c==a.length||o<a[c].from){let b=Kt[o];b!=l&&(h=!1,d=b==16)}let g=!h&&l==1?[]:null,m=h?n:n+1,y=o;e:for(;;)if(c<a.length&&y==a[c].from){if(d)break e;let b=a[c];if(!h)for(let x=b.to,w=c+1;;){if(x==r)break e;if(w<a.length&&a[w].from==x)x=a[w++].to;else{if(Kt[x]==l)break e;break}}if(c++,g)g.push(b);else{b.from>o&&s.push(new oa(o,b.from,m));let x=b.direction==no!=!(m%2);Yk(t,x?n+1:n,i,b.inner,b.from,b.to,s),o=b.to}y=b.to}else{if(y==r||(h?Kt[y]!=l:Kt[y]==l))break;y++}g?Gk(t,o,y,n+1,i,g,s):o<y&&s.push(new oa(o,y,m)),o=y}else for(let o=r,c=a.length;o>e;){let h=!0,d=!1;if(!c||o>a[c-1].to){let b=Kt[o-1];b!=l&&(h=!1,d=b==16)}let g=!h&&l==1?[]:null,m=h?n:n+1,y=o;e:for(;;)if(c&&y==a[c-1].to){if(d)break e;let b=a[--c];if(!h)for(let x=b.from,w=c;;){if(x==e)break e;if(w&&a[w-1].to==x)x=a[--w].from;else{if(Kt[x-1]==l)break e;break}}if(g)g.push(b);else{b.to<o&&s.push(new oa(b.to,o,m));let x=b.direction==no!=!(m%2);Yk(t,x?n+1:n,i,b.inner,b.from,b.to,s),o=b.from}y=b.from}else{if(y==e||(h?Kt[y-1]!=l:Kt[y-1]==l))break;y--}g?Gk(t,y,o,n+1,i,g,s):y<o&&s.push(new oa(y,o,m)),o=y}}function Yk(t,e,r,n,i,a,s){let l=e%2?2:1;hie(t,i,a,n,l),die(t,i,a,n,l),pie(i,a,n,l),Gk(t,i,a,e,r,n,s)}function gie(t,e,r){if(!t)return[new oa(0,0,e==DE?1:0)];if(e==no&&!r.length&&!fie.test(t))return G6(t.length);if(r.length)for(;t.length>Kt.length;)Kt[Kt.length]=256;let n=[],i=e==no?0:1;return Yk(t,i,i,r,0,t.length,n),n}function G6(t){return[new oa(0,t,0)]}let Y6="";function vie(t,e,r,n,i){var a;let s=n.head-t.from,l=oa.find(e,s,(a=n.bidiLevel)!==null&&a!==void 0?a:-1,n.assoc),o=e[l],c=o.side(i,r);if(s==c){let g=l+=i?1:-1;if(g<0||g>=e.length)return null;o=e[l=g],s=o.side(!i,r),c=o.side(i,r)}let h=Wr(t.text,s,o.forward(i,r));(h<o.from||h>o.to)&&(h=c),Y6=t.text.slice(Math.min(s,h),Math.max(s,h));let d=l==(i?e.length-1:0)?null:e[l+(i?1:-1)];return d&&h==c&&d.level+(i?0:1)<o.level?Ae.cursor(d.side(!i,r)+t.from,d.forward(i,r)?1:-1,d.level):Ae.cursor(h+t.from,o.forward(i,r)?-1:1,o.level)}function mie(t,e,r){for(let n=e;n<r;n++){let i=U6(t.charCodeAt(n));if(i==1)return no;if(i==2||i==4)return DE}return no}const X6=We.define(),W6=We.define(),Q6=We.define(),K6=We.define(),Xk=We.define(),Z6=We.define(),J6=We.define(),_E=We.define(),NE=We.define(),e9=We.define({combine:t=>t.some(e=>e)}),t9=We.define({combine:t=>t.some(e=>e)}),r9=We.define();class Mu{constructor(e,r="nearest",n="nearest",i=5,a=5,s=!1){this.range=e,this.y=r,this.x=n,this.yMargin=i,this.xMargin=a,this.isSnapshot=s}map(e){return e.empty?this:new Mu(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Mu(Ae.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const gp=yt.define({map:(t,e)=>t.map(e)}),n9=yt.define();function Xn(t,e,r){let n=t.facet(K6);n.length?n[0](e):window.onerror&&window.onerror(String(e),r,void 0,void 0,e)||(r?console.error(r+":",e):console.error(e))}const Va=We.define({combine:t=>t.length?t[0]:!0});let yie=0;const mu=We.define({combine(t){return t.filter((e,r)=>{for(let n=0;n<r;n++)if(t[n].plugin==e.plugin)return!1;return!0})}});class mr{constructor(e,r,n,i,a){this.id=e,this.create=r,this.domEventHandlers=n,this.domEventObservers=i,this.baseExtensions=a(this),this.extension=this.baseExtensions.concat(mu.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(mu.of({plugin:this,arg:e}))}static define(e,r){const{eventHandlers:n,eventObservers:i,provide:a,decorations:s}=r||{};return new mr(yie++,e,n,i,l=>{let o=[];return s&&o.push(Fv.of(c=>{let h=c.plugin(l);return h?s(h):ut.none})),a&&o.push(a(l)),o})}static fromClass(e,r){return mr.define((n,i)=>new e(n,i),r)}}class xC{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let r=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(r)}catch(n){if(Xn(r.state,n,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(r){Xn(e.state,r,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var r;if(!((r=this.value)===null||r===void 0)&&r.destroy)try{this.value.destroy()}catch(n){Xn(e.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const i9=We.define(),BE=We.define(),Fv=We.define(),a9=We.define(),LE=We.define(),Dh=We.define(),s9=We.define();function V4(t,e){let r=t.state.facet(s9);if(!r.length)return r;let n=r.map(a=>a instanceof Function?a(t):a),i=[];return Et.spans(n,e.from,e.to,{point(){},span(a,s,l,o){let c=a-e.from,h=s-e.from,d=i;for(let g=l.length-1;g>=0;g--,o--){let m=l[g].spec.bidiIsolate,y;if(m==null&&(m=mie(e.text,c,h)),o>0&&d.length&&(y=d[d.length-1]).to==c&&y.direction==m)y.to=h,d=y.inner;else{let b={from:c,to:h,direction:m,inner:[]};d.push(b),d=b.inner}}}}),i}const l9=We.define();function PE(t){let e=0,r=0,n=0,i=0;for(let a of t.state.facet(l9)){let s=a(t);s&&(s.left!=null&&(e=Math.max(e,s.left)),s.right!=null&&(r=Math.max(r,s.right)),s.top!=null&&(n=Math.max(n,s.top)),s.bottom!=null&&(i=Math.max(i,s.bottom)))}return{left:e,right:r,top:n,bottom:i}}const mf=We.define();class Ti{constructor(e,r,n,i){this.fromA=e,this.toA=r,this.fromB=n,this.toB=i}join(e){return new Ti(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let r=e.length,n=this;for(;r>0;r--){let i=e[r-1];if(!(i.fromA>n.toA)){if(i.toA<n.fromA)break;n=n.join(i),e.splice(r-1,1)}}return e.splice(r,0,n),e}static extendWithRanges(e,r){if(r.length==0)return e;let n=[];for(let i=0,a=0,s=0;;){let l=i<e.length?e[i].fromB:1e9,o=a<r.length?r[a]:1e9,c=Math.min(l,o);if(c==1e9)break;let h=c+s,d=c,g=h;for(;;)if(a<r.length&&r[a]<=d){let m=r[a+1];a+=2,d=Math.max(d,m);for(let y=i;y<e.length&&e[y].fromB<=d;y++)s=e[y].toA-e[y].toB;g=Math.max(g,m+s)}else if(i<e.length&&e[i].fromB<=d){let m=e[i++];d=Math.max(d,m.toB),g=Math.max(g,m.toA),s=m.toA-m.toB}else break;n.push(new Ti(h,g,c,d))}return n}}class Dg{constructor(e,r,n){this.view=e,this.state=r,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=Pr.empty(this.startState.doc.length);for(let a of n)this.changes=this.changes.compose(a.changes);let i=[];this.changes.iterChangedRanges((a,s,l,o)=>i.push(new Ti(a,s,l,o))),this.changedRanges=i}static create(e,r,n){return new Dg(e,r,n)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const bie=[];class vr{constructor(e,r,n=0){this.dom=e,this.length=r,this.flags=n,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return bie}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let r=this.domAttrs;r&&tie(this.dom,r)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,r=this.posAtStart){let n=r;for(let i of this.children){if(i==e)return n;n+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,r){return null}domPosFor(e,r){let n=rl(this.dom),i=this.length?e>0:r>0;return new zi(this.parent.dom,n+(i?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof Vv)return e;return null}static get(e){return e.cmTile}}class Hv extends vr{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let r=this.dom,n=null,i,a=e?.node==r?e:null,s=0;for(let l of this.children){if(l.sync(e),s+=l.length+l.breakAfter,i=n?n.nextSibling:r.firstChild,a&&i!=l.dom&&(a.written=!0),l.dom.parentNode==r)for(;i&&i!=l.dom;)i=U4(i);else r.insertBefore(l.dom,i);n=l.dom}for(i=n?n.nextSibling:r.firstChild,a&&i&&(a.written=!0);i;)i=U4(i);this.length=s}}function U4(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Vv extends Hv{constructor(e,r){super(r),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let r=vr.get(e);if(r&&this.owns(r))return r;e=e.parentNode}}blockTiles(e){for(let r=[],n=this,i=0,a=0;;)if(i==n.children.length){if(!r.length)return;n=n.parent,n.breakAfter&&a++,i=r.pop()}else{let s=n.children[i++];if(s instanceof $a)r.push(i),n=s,i=0;else{let l=a+s.length,o=e(s,a);if(o!==void 0)return o;a=l+s.breakAfter}}}resolveBlock(e,r){let n,i=-1,a,s=-1;if(this.blockTiles((l,o)=>{let c=o+l.length;if(e>=o&&e<=c){if(l.isWidget()&&r>=-1&&r<=1){if(l.flags&32)return!0;l.flags&16&&(n=void 0)}(o<e||e==c&&(r<-1?l.length:l.covers(1)))&&(!n||!l.isWidget()&&n.isWidget())&&(n=l,i=e-o),(c>e||e==o&&(r>1?l.length:l.covers(-1)))&&(!a||!l.isWidget()&&a.isWidget())&&(a=l,s=e-o)}}),!n&&!a)throw new Error("No tile at position "+e);return n&&r<0||!a?{tile:n,offset:i}:{tile:a,offset:s}}}class $a extends Hv{constructor(e,r){super(e),this.wrapper=r}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(e,r){let n=new $a(r||document.createElement(e.tagName),e);return r||(n.flags|=4),n}}class qu extends Hv{constructor(e,r){super(e),this.attrs=r}isLine(){return!0}static start(e,r,n){let i=new qu(r||document.createElement("div"),e);return(!r||!n)&&(i.flags|=4),i}get domAttrs(){return this.attrs}resolveInline(e,r,n){let i=null,a=-1,s=null,l=-1;function o(h,d){for(let g=0,m=0;g<h.children.length&&m<=d;g++){let y=h.children[g],b=m+y.length;b>=d&&(y.isComposite()?o(y,d-m):(!s||s.isHidden&&(r>0||n&&wie(s,y)))&&(b>d||y.flags&32)?(s=y,l=d-m):(m<d||y.flags&16&&!y.isHidden)&&(i=y,a=d-m)),m=b}}o(this,e);let c=(r<0?i:s)||i||s;return c?{tile:c,offset:c==i?a:l}:null}coordsIn(e,r){let n=this.resolveInline(e,r,!0);return n?n.tile.coordsIn(Math.max(0,n.offset),r):xie(this)}domIn(e,r){let n=this.resolveInline(e,r);if(n){let{tile:i,offset:a}=n;if(this.dom.contains(i.dom))return i.isText()?new zi(i.dom,Math.min(i.dom.nodeValue.length,a)):i.domPosFor(a,i.flags&16?1:i.flags&32?-1:r);let s=n.tile.parent,l=!1;for(let o of s.children){if(l)return new zi(o.dom,0);o==n.tile&&(l=!0)}}return new zi(this.dom,0)}}function xie(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let r=Ef(e);return r[r.length-1]||null}function wie(t,e){let r=t.coordsIn(0,1),n=e.coordsIn(0,1);return r&&n&&n.top<r.bottom}class $n extends Hv{constructor(e,r){super(e),this.mark=r}get domAttrs(){return this.mark.attrs}static of(e,r){let n=new $n(r||document.createElement(e.tagName),e);return r||(n.flags|=4),n}}class Ul extends vr{constructor(e,r){super(e,r.length),this.text=r}sync(e){this.flags&2||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,r){let n=this.dom.nodeValue.length;e>n&&(e=n);let i=e,a=e,s=0;e==0&&r<0||e==n&&r>=0?Xe.chrome||Xe.gecko||(e?(i--,s=1):a<n&&(a++,s=-1)):r<0?i--:a<n&&a++;let l=Jf(this.dom,i,a).getClientRects();if(!l.length)return null;let o=l[(s?s<0:r>=0)?0:l.length-1];return Xe.safari&&!s&&o.width==0&&(o=Array.prototype.find.call(l,c=>c.width)||o),s?Zf(o,s<0):o||null}static of(e,r){let n=new Ul(r||document.createTextNode(e),e);return r||(n.flags|=2),n}}class io extends vr{constructor(e,r,n,i){super(e,r,i),this.widget=n}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,r){return this.coordsInWidget(e,r,!1)}coordsInWidget(e,r,n){let i=this.widget.coordsAt(this.dom,e,r);if(i)return i;if(n)return Zf(this.dom.getBoundingClientRect(),this.length?e==0:r<=0);{let a=this.dom.getClientRects(),s=null;if(!a.length)return null;let l=this.flags&16?!0:this.flags&32?!1:e>0;for(let o=l?a.length-1:0;s=a[o],!(e>0?o==0:o==a.length-1||s.top<s.bottom);o+=l?-1:1);return Zf(s,!l)}}get overrideDOMText(){if(!this.length)return Nt.empty;let{root:e}=this;if(!e)return Nt.empty;let r=this.posAtStart;return e.view.state.doc.slice(r,r+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,r,n,i,a){return a||(a=e.toDOM(r),e.editable||(a.contentEditable="false")),new io(a,n,e,i)}}class _g extends vr{constructor(e){let r=document.createElement("img");r.className="cm-widgetBuffer",r.setAttribute("aria-hidden","true"),super(r,0,e)}get isHidden(){return!0}get overrideDOMText(){return Nt.empty}coordsIn(e){return this.dom.getBoundingClientRect()}}class Sie{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,r,n){let{tile:i,index:a,beforeBreak:s,parents:l}=this;for(;e||r>0;)if(i.isComposite())if(s){if(!e)break;n&&n.break(),e--,s=!1}else if(a==i.children.length){if(!e&&!l.length)break;n&&n.leave(i),s=!!i.breakAfter,{tile:i,index:a}=l.pop(),a++}else{let o=i.children[a],c=o.breakAfter;(r>0?o.length<=e:o.length<e)&&(!n||n.skip(o,0,o.length)!==!1||!o.isComposite)?(s=!!c,a++,e-=o.length):(l.push({tile:i,index:a}),i=o,a=0,n&&o.isComposite()&&n.enter(o))}else if(a==i.length)s=!!i.breakAfter,{tile:i,index:a}=l.pop(),a++;else if(e){let o=Math.min(e,i.length-a);n&&n.skip(i,a,a+o),e-=o,a+=o}else break;return this.tile=i,this.index=a,this.beforeBreak=s,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class Cie{constructor(e,r,n,i){this.from=e,this.to=r,this.wrapper=n,this.rank=i}}class kie{constructor(e,r,n){this.cache=e,this.root=r,this.blockWrappers=n,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,r,n,i){var a;this.flushBuffer();let s=this.ensureMarks(r,n),l=s.lastChild;if(l&&l.isText()&&!(l.flags&8)&&l.length+e.length<512){this.cache.reused.set(l,2);let o=s.children[s.children.length-1]=new Ul(l.dom,l.text+e);o.parent=s}else s.append(i||Ul.of(e,(a=this.cache.find(Ul))===null||a===void 0?void 0:a.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,r){let n=this.curLine;n.dom!=r.line.dom&&(n.setDOM(this.cache.reused.has(r.line)?wC(r.line.dom):r.line.dom),this.cache.reused.set(r.line,2));let i=n;for(let l=r.marks.length-1;l>=0;l--){let o=r.marks[l],c=i.lastChild;if(c instanceof $n&&c.mark.eq(o.mark))c.dom!=o.dom&&c.setDOM(wC(o.dom)),i=c;else{if(this.cache.reused.get(o)){let d=vr.get(o.dom);d&&d.setDOM(wC(o.dom))}let h=$n.of(o.mark,o.dom);i.append(h),i=h}this.cache.reused.set(o,2)}let a=vr.get(e.text);a&&this.cache.reused.set(a,2);let s=new Ul(e.text,e.text.nodeValue);s.flags|=8,i.append(s)}addInlineWidget(e,r,n){let i=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);i||this.flushBuffer();let a=this.ensureMarks(r,n);!i&&!(e.flags&16)&&a.append(this.getBuffer(1)),a.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,r,n){this.flushBuffer(),this.ensureMarks(r,n).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let r=this.afterWidget||this.lastBlock;r.length+=e,this.pos+=e}addLineStart(e,r){var n;e||(e=o9);let i=qu.start(e,r||((n=this.cache.find(qu))===null||n===void 0?void 0:n.dom),!!r);this.getBlockPos().append(this.lastBlock=this.curLine=i)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,r){var n;let i=this.curLine;for(let a=e.length-1;a>=0;a--){let s=e[a],l;if(r>0&&(l=i.lastChild)&&l instanceof $n&&l.mark.eq(s))i=l,r--;else{let o=$n.of(s,(n=this.cache.find($n,c=>c.mark.eq(s)))===null||n===void 0?void 0:n.dom);i.append(o),i=o,r=0}}return i}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!$4(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(Xe.ios&&$4(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(SC,0,32)||new io(SC.toDOM(),0,SC,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let r=new Cie(e.from,e.to,e.value,e.rank),n=this.wrappers.length;for(;n>0&&(this.wrappers[n-1].rank-r.rank||this.wrappers[n-1].to-r.to)<0;)n--;this.wrappers.splice(n,0,r)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let r=this.root;for(let n of this.wrappers){let i=r.lastChild;if(n.from<this.pos&&i instanceof $a&&i.wrapper.eq(n.wrapper))r=i;else{let a=$a.of(n.wrapper,(e=this.cache.find($a,s=>s.wrapper.eq(n.wrapper)))===null||e===void 0?void 0:e.dom);r.append(a),r=a}}return r}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let r=2|(e<0?16:32),n=this.cache.find(_g,void 0,1);return n&&(n.flags=r),n||new _g(r)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class Tie{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:i,lineBreak:a,done:s}=this.cursor.next(this.skipCount);if(this.skipCount=0,s)throw new Error("Ran out of text content when drawing inline views");this.text=i;let l=this.textOff=Math.min(e,i.length);return a?null:i.slice(0,l)}let r=Math.min(this.text.length,this.textOff+e),n=this.text.slice(this.textOff,r);return this.textOff=r,n}}const Ng=[io,qu,Ul,$n,_g,$a,Vv];for(let t=0;t<Ng.length;t++)Ng[t].bucket=t;class Eie{constructor(e){this.view=e,this.buckets=Ng.map(()=>[]),this.index=Ng.map(()=>0),this.reused=new Map}add(e){let r=e.constructor.bucket,n=this.buckets[r];n.length<6?n.push(e):n[this.index[r]=(this.index[r]+1)%6]=e}find(e,r,n=2){let i=e.bucket,a=this.buckets[i],s=this.index[i];for(let l=a.length-1;l>=0;l--){let o=(l+s)%a.length,c=a[o];if((!r||r(c))&&!this.reused.has(c))return a.splice(o,1),o<s&&this.index[i]--,this.reused.set(c,n),c}return null}findWidget(e,r,n){let i=this.buckets[0];if(i.length)for(let a=0,s=0;;a++){if(a==i.length){if(s)return null;s=1,a=0}let l=i[a];if(!this.reused.has(l)&&(s==0?l.widget.compare(e):l.widget.constructor==e.constructor&&e.updateDOM(l.dom,this.view)))return i.splice(a,1),a<this.index[0]&&this.index[0]--,l.widget==e&&l.length==r&&(l.flags&497)==n?(this.reused.set(l,1),l):(this.reused.set(l,2),new io(l.dom,r,e,l.flags&-498|n))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,r=2){if(!this.reused.has(e))return this.reused.set(e,r),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}}class Aie{constructor(e,r,n,i,a){this.view=e,this.decorations=i,this.disallowBlockEffectsFor=a,this.openWidget=!1,this.openMarks=0,this.cache=new Eie(e),this.text=new Tie(e.state.doc),this.builder=new kie(this.cache,new Vv(e,e.contentDOM),Et.iter(n)),this.cache.reused.set(r,2),this.old=new Sie(r),this.reuseWalker={skip:(s,l,o)=>{if(this.cache.add(s),s.isComposite())return!1},enter:s=>this.cache.add(s),leave:()=>{},break:()=>{}}}run(e,r){let n=r&&this.getCompositionContext(r.text);for(let i=0,a=0,s=0;;){let l=s<e.length?e[s++]:null,o=l?l.fromA:this.old.root.length;if(o>i){let c=o-i;this.preserve(c,!s,!l),i=o,a+=c}if(!l)break;r&&l.fromA<=r.range.fromA&&l.toA>=r.range.toA?(this.forward(l.fromA,r.range.fromA,r.range.fromA<r.range.toA?1:-1),this.emit(a,r.range.fromB),this.cache.clear(),this.builder.addComposition(r,n),this.text.skip(r.range.toB-r.range.fromB),this.forward(r.range.fromA,l.toA),this.emit(r.range.toB,l.toB)):(this.forward(l.fromA,l.toA),this.emit(a,l.toB)),a=l.toB,i=l.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,r,n){let i=Rie(this.old),a=this.openMarks;this.old.advance(e,n?1:-1,{skip:(s,l,o)=>{if(s.isWidget())if(this.openWidget)this.builder.continueWidget(o-l);else{let c=o>0||l<s.length?io.of(s.widget,this.view,o-l,s.flags&496,this.cache.maybeReuse(s)):this.cache.reuse(s);c.flags&256?(c.flags&=-2,this.builder.addBlockWidget(c)):(this.builder.ensureLine(null),this.builder.addInlineWidget(c,i,a),a=i.length)}else if(s.isText())this.builder.ensureLine(null),!l&&o==s.length&&!this.cache.reused.has(s)?this.builder.addText(s.text,i,a,this.cache.reuse(s)):(this.cache.add(s),this.builder.addText(s.text.slice(l,o),i,a)),a=i.length;else if(s.isLine())s.flags&=-2,this.cache.reused.set(s,1),this.builder.addLine(s);else if(s instanceof _g)this.cache.add(s);else if(s instanceof $n)this.builder.ensureLine(null),this.builder.addMark(s,i,a),this.cache.reused.set(s,1),a=i.length;else return!1;this.openWidget=!1},enter:s=>{s.isLine()?this.builder.addLineStart(s.attrs,this.cache.maybeReuse(s)):(this.cache.add(s),s instanceof $n&&i.unshift(s.mark)),this.openWidget=!1},leave:s=>{s.isLine()?i.length&&(i.length=a=0):s instanceof $n&&(i.shift(),a=Math.min(a,i.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,r){let n=null,i=this.builder,a=0,s=Et.spans(this.decorations,e,r,{point:(l,o,c,h,d,g)=>{if(c instanceof ro){if(this.disallowBlockEffectsFor[g]){if(c.block)throw new RangeError("Block decorations may not be specified via plugins");if(o>this.view.state.doc.lineAt(l).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(a=h.length,d>h.length)i.continueWidget(o-l);else{let m=c.widget||(c.block?ju.block:ju.inline),y=Oie(c),b=this.cache.findWidget(m,o-l,y)||io.of(m,this.view,o-l,y);c.block?(c.startSide>0&&i.addLineStartIfNotCovered(n),i.addBlockWidget(b)):(i.ensureLine(n),i.addInlineWidget(b,h,d))}n=null}else n=Mie(n,c);o>l&&this.text.skip(o-l)},span:(l,o,c,h)=>{for(let d=l;d<o;){let g=this.text.next(Math.min(512,o-d));g==null?(i.addLineStartIfNotCovered(n),i.addBreak(),d++):(i.ensureLine(n),i.addText(g,c,d==l?h:c.length),d+=g.length),n=null}}});i.addLineStartIfNotCovered(n),this.openWidget=s>a,this.openMarks=s}forward(e,r,n=1){r-e<=10?this.old.advance(r-e,n,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(r-e-10,-1),this.old.advance(5,n,this.reuseWalker))}getCompositionContext(e){let r=[],n=null;for(let i=e.parentNode;;i=i.parentNode){let a=vr.get(i);if(i==this.view.contentDOM)break;a instanceof $n?r.push(a):a?.isLine()?n=a:a instanceof $a||(i.nodeName=="DIV"&&!n&&i!=this.view.contentDOM?n=new qu(i,o9):n||r.push($n.of(new Mh({tagName:i.nodeName.toLowerCase(),attributes:rie(i)}),i)))}return{line:n,marks:r}}}function $4(t,e){let r=n=>{for(let i of n.children)if((e?i.isText():i.length)||r(i))return!0;return!1};return r(t)}function Oie(t){let e=t.isReplace?(t.startSide<0?64:0)|(t.endSide>0?128:0):t.startSide>0?32:16;return t.block&&(e|=256),e}const o9={class:"cm-line"};function Mie(t,e){let r=e.spec.attributes,n=e.spec.class;return!r&&!n||(t||(t={class:"cm-line"}),r&&ME(r,t),n&&(t.class+=" "+n)),t}function Rie(t){let e=[];for(let r=t.parents.length;r>1;r--){let n=r==t.parents.length?t.tile:t.parents[r].tile;n instanceof $n&&e.push(n.mark)}return e}function wC(t){let e=vr.get(t);return e&&e.setDOM(t.cloneNode()),t}class ju extends ba{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}ju.inline=new ju("span");ju.block=new ju("div");const SC=new class extends ba{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class G4{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=ut.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new Vv(e,e.contentDOM),this.updateInner([new Ti(0,0,0,e.state.doc.length)],null)}update(e){var r;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:h,toA:d})=>d<this.minWidthFrom||h>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let i=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((r=this.domChanged)===null||r===void 0)&&r.newSel?i=this.domChanged.newSel.head:!qie(e.changes,this.hasComposition)&&!e.selectionSet&&(i=e.state.selection.main.head));let a=i>-1?_ie(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){let{from:h,to:d}=this.hasComposition;n=new Ti(h,d,e.changes.mapPos(h,-1),e.changes.mapPos(d,1)).addToSet(n.slice())}this.hasComposition=a?{from:a.range.fromB,to:a.range.toB}:null,(Xe.ie||Xe.chrome)&&!a&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let s=this.decorations,l=this.blockWrappers;this.updateDeco();let o=Lie(s,this.decorations,e.changes);o.length&&(n=Ti.extendWithRanges(n,o));let c=zie(l,this.blockWrappers,e.changes);return c.length&&(n=Ti.extendWithRanges(n,c)),a&&!n.some(h=>h.fromA<=a.range.fromA&&h.toA>=a.range.toA)&&(n=a.range.addToSet(n.slice())),this.tile.flags&2&&n.length==0?!1:(this.updateInner(n,a),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,r){this.view.viewState.mustMeasureContent=!0;let{observer:n}=this.view;n.ignore(()=>{if(r||e.length){let s=this.tile,l=new Aie(this.view,s,this.blockWrappers,this.decorations,this.dynamicDecorationMap);r&&vr.get(r.text)&&l.cache.reused.set(vr.get(r.text),2),this.tile=l.run(e,r),Wk(s,l.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let a=Xe.chrome||Xe.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(a),a&&(a.written||n.selectionRange.focusNode!=a.node||!this.tile.dom.contains(a.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let i=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let a of this.tile.children)a.isWidget()&&a.widget instanceof CC&&i.push(a.dom);n.updateGaps(i)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let r of e.transactions)for(let n of r.effects)n.is(n9)&&(this.editContextFormatting=n.value)}updateSelection(e=!1,r=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:n}=this.tile,i=this.view.root.activeElement,a=i==n,s=!a&&!(this.view.state.facet(Va)||n.tabIndex>-1)&&Tf(n,this.view.observer.selectionRange)&&!(i&&n.contains(i));if(!(a||r||s))return;let l=this.forceSelection;this.forceSelection=!1;let o=this.view.state.selection.main,c,h;if(o.empty?h=c=this.inlineDOMNearPos(o.anchor,o.assoc||1):(h=this.inlineDOMNearPos(o.head,o.head==o.from?1:-1),c=this.inlineDOMNearPos(o.anchor,o.anchor==o.from?1:-1)),Xe.gecko&&o.empty&&!this.hasComposition&&Die(c)){let g=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(g,c.node.childNodes[c.offset]||null)),c=h=new zi(g,0),l=!0}let d=this.view.observer.selectionRange;(l||!d.focusNode||(!Af(c.node,c.offset,d.anchorNode,d.anchorOffset)||!Af(h.node,h.offset,d.focusNode,d.focusOffset))&&!this.suppressWidgetCursorChange(d,o))&&(this.view.observer.ignore(()=>{Xe.android&&Xe.chrome&&n.contains(d.focusNode)&&Iie(d.focusNode,n)&&(n.blur(),n.focus({preventScroll:!0}));let g=Kf(this.view.root);if(g)if(o.empty){if(Xe.gecko){let m=Nie(c.node,c.offset);if(m&&m!=3){let y=(m==1?F6:H6)(c.node,c.offset);y&&(c=new zi(y.node,y.offset))}}g.collapse(c.node,c.offset),o.bidiLevel!=null&&g.caretBidiLevel!==void 0&&(g.caretBidiLevel=o.bidiLevel)}else if(g.extend){g.collapse(c.node,c.offset);try{g.extend(h.node,h.offset)}catch{}}else{let m=document.createRange();o.anchor>o.head&&([c,h]=[h,c]),m.setEnd(h.node,h.offset),m.setStart(c.node,c.offset),g.removeAllRanges(),g.addRange(m)}s&&this.view.root.activeElement==n&&(n.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(c,h)),this.impreciseAnchor=c.precise?null:new zi(d.anchorNode,d.anchorOffset),this.impreciseHead=h.precise?null:new zi(d.focusNode,d.focusOffset)}suppressWidgetCursorChange(e,r){return this.hasComposition&&r.empty&&Af(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==r.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,r=e.state.selection.main,n=Kf(e.root),{anchorNode:i,anchorOffset:a}=e.observer.selectionRange;if(!n||!r.empty||!r.assoc||!n.modify)return;let s=this.lineAt(r.head,r.assoc);if(!s)return;let l=s.posAtStart;if(r.head==l||r.head==l+s.length)return;let o=this.coordsAt(r.head,-1),c=this.coordsAt(r.head,1);if(!o||!c||o.bottom>c.top)return;let h=this.domAtPos(r.head+r.assoc,r.assoc);n.collapse(h.node,h.offset),n.modify("move",r.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let d=e.observer.selectionRange;e.docView.posFromDOM(d.anchorNode,d.anchorOffset)!=r.from&&n.collapse(i,a)}posFromDOM(e,r){let n=this.tile.nearest(e);if(!n)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let i=n.posAtStart;if(n.isComposite()){let a;if(e==n.dom)a=n.dom.childNodes[r];else{let s=Qa(e)==0?0:r==0?-1:1;for(;;){let l=e.parentNode;if(l==n.dom)break;s==0&&l.firstChild!=l.lastChild&&(e==l.firstChild?s=-1:s=1),e=l}s<0?a=e:a=e.nextSibling}if(a==n.dom.firstChild)return i;for(;a&&!vr.get(a);)a=a.nextSibling;if(!a)return i+n.length;for(let s=0,l=i;;s++){let o=n.children[s];if(o.dom==a)return l;l+=o.length+o.breakAfter}}else return n.isText()?e==n.dom?i+r:i+(r?n.length:0):i}domAtPos(e,r){let{tile:n,offset:i}=this.tile.resolveBlock(e,r);return n.isWidget()?n.domPosFor(e,r):n.domIn(i,r)}inlineDOMNearPos(e,r){let n,i=-1,a=!1,s,l=-1,o=!1;return this.tile.blockTiles((c,h)=>{if(c.isWidget()){if(c.flags&32&&h>=e)return!0;c.flags&16&&(a=!0)}else{let d=h+c.length;if(h<=e&&(n=c,i=e-h,a=d<e),d>=e&&!s&&(s=c,l=e-h,o=h>e),h>e&&s)return!0}}),!n&&!s?this.domAtPos(e,r):(a&&s?n=null:o&&n&&(s=null),n&&r<0||!s?n.domIn(i,r):s.domIn(l,r))}coordsAt(e,r){let{tile:n,offset:i}=this.tile.resolveBlock(e,r);return n.isWidget()?n.widget instanceof CC?null:n.coordsInWidget(i,r,!0):n.coordsIn(i,r)}lineAt(e,r){let{tile:n}=this.tile.resolveBlock(e,r);return n.isLine()?n:null}coordsForChar(e){let{tile:r,offset:n}=this.tile.resolveBlock(e,1);if(!r.isLine())return null;function i(a,s){if(a.isComposite())for(let l of a.children){if(l.length>=s){let o=i(l,s);if(o)return o}if(s-=l.length,s<0)break}else if(a.isText()&&s<a.length){let l=Wr(a.text,s);if(l==s)return null;let o=Jf(a.dom,s,l).getClientRects();for(let c=0;c<o.length;c++){let h=o[c];if(c==o.length-1||h.top<h.bottom&&h.left<h.right)return h}}return null}return i(r,n)}measureVisibleLineHeights(e){let r=[],{from:n,to:i}=e,a=this.view.contentDOM.clientWidth,s=a>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,o=this.view.textDirection==Jt.LTR,c=0,h=(d,g,m)=>{for(let y=0;y<d.children.length&&!(g>i);y++){let b=d.children[y],x=g+b.length,w=b.dom.getBoundingClientRect(),{height:S}=w;if(m&&!y&&(c+=w.top-m.top),b instanceof $a)x>n&&h(b,g,w);else if(g>=n&&(c>0&&r.push(-c),r.push(S+c),c=0,s)){let k=b.dom.lastChild,E=k?Ef(k):[];if(E.length){let M=E[E.length-1],R=o?M.right-w.left:w.right-M.left;R>l&&(l=R,this.minWidth=a,this.minWidthFrom=g,this.minWidthTo=x)}}m&&y==d.children.length-1&&(c+=m.bottom-w.bottom),g=x+b.breakAfter}};return h(this.tile,0,null),r}textDirectionAt(e){let{tile:r}=this.tile.resolveBlock(e,1);return getComputedStyle(r.dom).direction=="rtl"?Jt.RTL:Jt.LTR}measureTextSize(){let e=this.tile.blockTiles(s=>{if(s.isLine()&&s.children.length&&s.length<=20){let l=0,o;for(let c of s.children){if(!c.isText()||/[^ -~]/.test(c.text))return;let h=Ef(c.dom);if(h.length!=1)return;l+=h[0].width,o=h[0].height}if(l)return{lineHeight:s.dom.getBoundingClientRect().height,charWidth:l/s.length,textHeight:o}}});if(e)return e;let r=document.createElement("div"),n,i,a;return r.className="cm-line",r.style.width="99999px",r.style.position="absolute",r.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(r);let s=Ef(r.firstChild)[0];n=r.getBoundingClientRect().height,i=s&&s.width?s.width/27:7,a=s&&s.height?s.height:n,r.remove()}),{lineHeight:n,charWidth:i,textHeight:a}}computeBlockGapDeco(){let e=[],r=this.view.viewState;for(let n=0,i=0;;i++){let a=i==r.viewports.length?null:r.viewports[i],s=a?a.from-1:this.view.state.doc.length;if(s>n){let l=(r.lineBlockAt(s).bottom-r.lineBlockAt(n).top)/this.view.scaleY;e.push(ut.replace({widget:new CC(l),block:!0,inclusive:!0,isBlockGap:!0}).range(n,s))}if(!a)break;n=a.to+1}return ut.set(e)}updateDeco(){let e=1,r=this.view.state.facet(Fv).map(a=>(this.dynamicDecorationMap[e++]=typeof a=="function")?a(this.view):a),n=!1,i=this.view.state.facet(LE).map((a,s)=>{let l=typeof a=="function";return l&&(n=!0),l?a(this.view):a});for(i.length&&(this.dynamicDecorationMap[e++]=n,r.push(Et.join(i))),this.decorations=[this.editContextFormatting,...r,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(a9).map(a=>typeof a=="function"?a(this.view):a)}scrollIntoView(e){if(e.isSnapshot){let c=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=c.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let c of this.view.state.facet(r9))try{if(c(this.view,e.range,e))return!0}catch(h){Xn(this.view.state,h,"scroll handler")}let{range:r}=e,n=this.coordsAt(r.head,r.empty?r.assoc:r.head>r.anchor?-1:1),i;if(!n)return;!r.empty&&(i=this.coordsAt(r.anchor,r.anchor>r.head?-1:1))&&(n={left:Math.min(n.left,i.left),top:Math.min(n.top,i.top),right:Math.max(n.right,i.right),bottom:Math.max(n.bottom,i.bottom)});let a=PE(this.view),s={left:n.left-a.left,top:n.top-a.top,right:n.right+a.right,bottom:n.bottom+a.bottom},{offsetWidth:l,offsetHeight:o}=this.view.scrollDOM;if(aie(this.view.scrollDOM,s,r.head<r.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,l),-l),Math.max(Math.min(e.yMargin,o),-o),this.view.textDirection==Jt.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(n.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||n.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let c=this.view.docView.lineAt(r.head,1);c&&c.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(e){let r=n=>n.isWidget()||n.children.some(r);return r(this.tile.resolveBlock(e,1).tile)}destroy(){Wk(this.tile)}}function Wk(t,e){let r=e?.get(t);if(r!=1){r==null&&t.destroy();for(let n of t.children)Wk(n,e)}}function Die(t){return t.node.nodeType==1&&t.node.firstChild&&(t.offset==0||t.node.childNodes[t.offset-1].contentEditable=="false")&&(t.offset==t.node.childNodes.length||t.node.childNodes[t.offset].contentEditable=="false")}function u9(t,e){let r=t.observer.selectionRange;if(!r.focusNode)return null;let n=F6(r.focusNode,r.focusOffset),i=H6(r.focusNode,r.focusOffset),a=n||i;if(i&&n&&i.node!=n.node){let l=vr.get(i.node);if(!l||l.isText()&&l.text!=i.node.nodeValue)a=i;else if(t.docView.lastCompositionAfterCursor){let o=vr.get(n.node);!o||o.isText()&&o.text!=n.node.nodeValue||(a=i)}}if(t.docView.lastCompositionAfterCursor=a!=n,!a)return null;let s=e-a.offset;return{from:s,to:s+a.node.nodeValue.length,node:a.node}}function _ie(t,e,r){let n=u9(t,r);if(!n)return null;let{node:i,from:a,to:s}=n,l=i.nodeValue;if(/[\n\r]/.test(l)||t.state.doc.sliceString(n.from,n.to)!=l)return null;let o=e.invertedDesc;return{range:new Ti(o.mapPos(a),o.mapPos(s),a,s),text:i}}function Nie(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e<t.childNodes.length&&t.childNodes[e].contentEditable=="false"?2:0)}let Bie=class{constructor(){this.changes=[]}compareRange(e,r){Au(e,r,this.changes)}comparePoint(e,r){Au(e,r,this.changes)}boundChange(e){Au(e,e,this.changes)}};function Lie(t,e,r){let n=new Bie;return Et.compare(t,e,r,n),n.changes}class Pie{constructor(){this.changes=[]}compareRange(e,r){Au(e,r,this.changes)}comparePoint(){}boundChange(e){Au(e,e,this.changes)}}function zie(t,e,r){let n=new Pie;return Et.compare(t,e,r,n),n.changes}function Iie(t,e){for(let r=t;r&&r!=e;r=r.assignedSlot||r.parentNode)if(r.nodeType==1&&r.contentEditable=="false")return!0;return!1}function qie(t,e){let r=!1;return e&&t.iterChangedRanges((n,i)=>{n<e.to&&i>e.from&&(r=!0)}),r}class CC extends ba{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function jie(t,e,r=1){let n=t.charCategorizer(e),i=t.doc.lineAt(e),a=e-i.from;if(i.length==0)return Ae.cursor(e);a==0?r=1:a==i.length&&(r=-1);let s=a,l=a;r<0?s=Wr(i.text,a,!1):l=Wr(i.text,a);let o=n(i.text.slice(s,l));for(;s>0;){let c=Wr(i.text,s,!1);if(n(i.text.slice(c,s))!=o)break;s=c}for(;l<i.length;){let c=Wr(i.text,l);if(n(i.text.slice(l,c))!=o)break;l=c}return Ae.range(s+i.from,l+i.from)}function Fie(t,e,r,n,i){let a=Math.round((n-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&r.height>t.defaultLineHeight*1.5){let l=t.viewState.heightOracle.textHeight,o=Math.floor((i-r.top-(t.defaultLineHeight-l)*.5)/l);a+=o*t.viewState.heightOracle.lineLength}let s=t.state.sliceDoc(r.from,r.to);return r.from+zk(s,a,t.state.tabSize)}function Qk(t,e,r){let n=t.lineBlockAt(e);if(Array.isArray(n.type)){let i;for(let a of n.type){if(a.from>e)break;if(!(a.to<e)){if(a.from<e&&a.to>e)return a;(!i||a.type==un.Text&&(i.type!=a.type||(r<0?a.from<e:a.to>e)))&&(i=a)}}return i||n}return n}function Hie(t,e,r,n){let i=Qk(t,e.head,e.assoc||-1),a=!n||i.type!=un.Text||!(t.lineWrapping||i.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>i.from?e.head-1:e.head);if(a){let s=t.dom.getBoundingClientRect(),l=t.textDirectionAt(i.from),o=t.posAtCoords({x:r==(l==Jt.LTR)?s.right-1:s.left+1,y:(a.top+a.bottom)/2});if(o!=null)return Ae.cursor(o,r?-1:1)}return Ae.cursor(r?i.to:i.from,r?-1:1)}function Y4(t,e,r,n){let i=t.state.doc.lineAt(e.head),a=t.bidiSpans(i),s=t.textDirectionAt(i.from);for(let l=e,o=null;;){let c=vie(i,a,s,l,r),h=Y6;if(!c){if(i.number==(r?t.state.doc.lines:1))return l;h=`
422
+ `,i=t.state.doc.line(i.number+(r?1:-1)),a=t.bidiSpans(i),c=t.visualLineSide(i,!r)}if(o){if(!o(h))return l}else{if(!n)return c;o=n(h)}l=c}}function Vie(t,e,r){let n=t.state.charCategorizer(e),i=n(r);return a=>{let s=n(a);return i==cr.Space&&(i=s),i==s}}function Uie(t,e,r,n){let i=e.head,a=r?1:-1;if(i==(r?t.state.doc.length:0))return Ae.cursor(i,e.assoc);let s=e.goalColumn,l,o=t.contentDOM.getBoundingClientRect(),c=t.coordsAtPos(i,(e.empty?e.assoc:0)||(r?1:-1)),h=t.documentTop;if(c)s==null&&(s=c.left-o.left),l=a<0?c.top:c.bottom;else{let y=t.viewState.lineBlockAt(i);s==null&&(s=Math.min(o.right-o.left,t.defaultCharacterWidth*(i-y.from))),l=(a<0?y.top:y.bottom)+h}let d=o.left+s,g=n??t.viewState.heightOracle.textHeight>>1,m=Kk(t,{x:d,y:l+g*a},!1,a);return Ae.cursor(m.pos,m.assoc,void 0,s)}function Of(t,e,r){for(;;){let n=0;for(let i of t)i.between(e-1,e+1,(a,s,l)=>{if(e>a&&e<s){let o=n||r||(e-a<s-e?-1:1);e=o<0?a:s,n=o}});if(!n)return e}}function c9(t,e){let r=null;for(let n=0;n<e.ranges.length;n++){let i=e.ranges[n],a=null;if(i.empty){let s=Of(t,i.from,0);s!=i.from&&(a=Ae.cursor(s,-1))}else{let s=Of(t,i.from,-1),l=Of(t,i.to,1);(s!=i.from||l!=i.to)&&(a=Ae.range(i.from==i.anchor?s:l,i.from==i.head?s:l))}a&&(r||(r=e.ranges.slice()),r[n]=a)}return r?Ae.create(r,e.mainIndex):e}function kC(t,e,r){let n=Of(t.state.facet(Dh).map(i=>i(t)),r.from,e.head>r.from?-1:1);return n==r.from?r:Ae.cursor(n,n<r.from?1:-1)}class sa{constructor(e,r){this.pos=e,this.assoc=r}}function Kk(t,e,r,n){let i=t.contentDOM.getBoundingClientRect(),a=i.top+t.viewState.paddingTop,{x:s,y:l}=e,o=l-a,c;for(;;){if(o<0)return new sa(0,1);if(o>t.viewState.docHeight)return new sa(t.state.doc.length,-1);if(c=t.elementAtHeight(o),n==null)break;if(c.type==un.Text){if(n<0?c.to<t.viewport.from:c.from>t.viewport.to)break;let g=t.docView.coordsAt(n<0?c.from:c.to,n>0?-1:1);if(g&&(n<0?g.top<=o+a:g.bottom>=o+a))break}let d=t.viewState.heightOracle.textHeight/2;o=n>0?c.bottom+d:c.top-d}if(t.viewport.from>=c.to||t.viewport.to<=c.from){if(r)return null;if(c.type==un.Text){let d=Fie(t,i,c,s,l);return new sa(d,d==c.from?1:-1)}}if(c.type!=un.Text)return o<(c.top+c.bottom)/2?new sa(c.from,1):new sa(c.to,-1);let h=t.docView.lineAt(c.from,2);return(!h||h.length!=c.length)&&(h=t.docView.lineAt(c.from,-2)),new $ie(t,s,l,t.textDirectionAt(c.from)).scanTile(h,c.from)}class $ie{constructor(e,r,n,i){this.view=e,this.x=r,this.y=n,this.baseDir=i,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,r){let{line:n,spans:i}=this.bidiSpansAt(e);return i[oa.find(i,e-n.from,-1,r)].level==this.baseDir}dirAt(e,r){let{line:n,spans:i}=this.bidiSpansAt(e);return i[oa.find(i,e-n.from,-1,r)].dir}bidiIn(e,r){let{spans:n,line:i}=this.bidiSpansAt(e);return n.length>1||n.length&&(n[0].level!=this.baseDir||n[0].to+i.from<r)}scan(e,r){let n=0,i=e.length-1,a=new Set,s=this.bidiIn(e[0],e[i]),l,o,c=-1,h=1e9,d;e:for(;n<i;){let m=i-n,y=n+i>>1;t:if(a.has(y)){let x=n+Math.floor(Math.random()*m);for(let w=0;w<m;w++){if(!a.has(x)){y=x;break t}x++,x==i&&(x=n)}break e}a.add(y);let b=r(y);if(b)for(let x=0;x<b.length;x++){let w=b[x],S=0;if(w.bottom<this.y)(!l||l.bottom<w.bottom)&&(l=w),S=1;else if(w.top>this.y)(!o||o.top>w.top)&&(o=w),S=-1;else{let k=w.left>this.x?this.x-w.left:w.right<this.x?this.x-w.right:0,E=Math.abs(k);E<h&&(c=y,h=E,d=w),k&&(S=k<0==(this.baseDir==Jt.LTR)?-1:1)}S==-1&&(!s||this.baseDirAt(e[y],1))?i=y:S==1&&(!s||this.baseDirAt(e[y+1],-1))&&(n=y+1)}}if(!d){let m=l&&(!o||this.y-l.bottom<o.top-this.y)?l:o;return this.y=(m.top+m.bottom)/2,this.scan(e,r)}let g=(s?this.dirAt(e[c],1):this.baseDir)==Jt.LTR;return{i:c,after:this.x>(d.left+d.right)/2==g}}scanText(e,r){let n=[];for(let a=0;a<e.length;a=Wr(e.text,a))n.push(r+a);n.push(r+e.length);let i=this.scan(n,a=>{let s=n[a]-r,l=n[a+1]-r;return Jf(e.dom,s,l).getClientRects()});return i.after?new sa(n[i.i+1],-1):new sa(n[i.i],1)}scanTile(e,r){if(!e.length)return new sa(r,1);if(e.children.length==1){let l=e.children[0];if(l.isText())return this.scanText(l,r);if(l.isComposite())return this.scanTile(l,r)}let n=[r];for(let l=0,o=r;l<e.children.length;l++)n.push(o+=e.children[l].length);let i=this.scan(n,l=>{let o=e.children[l];return o.flags&48?null:(o.dom.nodeType==1?o.dom:Jf(o.dom,0,o.length)).getClientRects()}),a=e.children[i.i],s=n[i.i];return a.isText()?this.scanText(a,s):a.isComposite()?this.scanTile(a,s):i.after?new sa(n[i.i+1],-1):new sa(s,1)}}const ou="￿";class Gie{constructor(e,r){this.points=e,this.view=r,this.text="",this.lineSeparator=r.state.facet(Dt.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=ou}readRange(e,r){if(!e)return this;let n=e.parentNode;for(let i=e;;){this.findPointBefore(n,i);let a=this.text.length;this.readNode(i);let s=vr.get(i),l=i.nextSibling;if(l==r){s?.breakAfter&&!l&&n!=this.view.contentDOM&&this.lineBreak();break}let o=vr.get(l);(s&&o?s.breakAfter:(s?s.breakAfter:Rg(i))||Rg(l)&&(i.nodeName!="BR"||s?.isWidget())&&this.text.length>a)&&!Xie(l,r)&&this.lineBreak(),i=l}return this.findPointBefore(n,r),this}readTextNode(e){let r=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,r.length));for(let n=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let a=-1,s=1,l;if(this.lineSeparator?(a=r.indexOf(this.lineSeparator,n),s=this.lineSeparator.length):(l=i.exec(r))&&(a=l.index,s=l[0].length),this.append(r.slice(n,a<0?r.length:a)),a<0)break;if(this.lineBreak(),s>1)for(let o of this.points)o.node==e&&o.pos>this.text.length&&(o.pos-=s-1);n=a+s}}readNode(e){let r=vr.get(e),n=r&&r.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let i=n.iter();!i.next().done;)i.lineBreak?this.lineBreak():this.append(i.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,r){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==r&&(n.pos=this.text.length)}findPointInside(e,r){for(let n of this.points)(e.nodeType==3?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(Yie(e,n.node,n.offset)?r:0))}}function Yie(t,e,r){for(;;){if(!e||r<Qa(e))return!1;if(e==t)return!0;r=rl(e)+1,e=e.parentNode}}function Xie(t,e){let r;for(;!(t==e||!t);t=t.nextSibling){let n=vr.get(t);if(!n?.isWidget())return!1;n&&(r||(r=[])).push(n)}if(r)for(let n of r){let i=n.overrideDOMText;if(i?.length)return!1}return!0}class X4{constructor(e,r){this.node=e,this.offset=r,this.pos=-1}}class Wie{constructor(e,r,n,i){this.typeOver=i,this.bounds=null,this.text="",this.domChanged=r>-1;let{impreciseHead:a,impreciseAnchor:s}=e.docView;if(e.state.readOnly&&r>-1)this.newSel=null;else if(r>-1&&(this.bounds=f9(e.docView.tile,r,n,0))){let l=a||s?[]:Kie(e),o=new Gie(l,e);o.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=o.text,this.newSel=Zie(l,this.bounds.from)}else{let l=e.observer.selectionRange,o=a&&a.node==l.focusNode&&a.offset==l.focusOffset||!Uk(e.contentDOM,l.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),c=s&&s.node==l.anchorNode&&s.offset==l.anchorOffset||!Uk(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),h=e.viewport;if((Xe.ios||Xe.chrome)&&e.state.selection.main.empty&&o!=c&&(h.from>0||h.to<e.state.doc.length)){let d=Math.min(o,c),g=Math.max(o,c),m=h.from-d,y=h.to-g;(m==0||m==1||d==0)&&(y==0||y==-1||g==e.state.doc.length)&&(o=0,c=e.state.doc.length)}e.inputState.composing>-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(Ae.range(c,o)):this.newSel=Ae.single(c,o)}}}function f9(t,e,r,n){if(t.isComposite()){let i=-1,a=-1,s=-1,l=-1;for(let o=0,c=n,h=n;o<t.children.length;o++){let d=t.children[o],g=c+d.length;if(c<e&&g>r)return f9(d,e,r,c);if(g>=e&&i==-1&&(i=o,a=c),c>r&&d.dom.parentNode==t.dom){s=o,l=h;break}h=g,c=g+d.breakAfter}return{from:a,to:l<0?n+t.length:l,startDOM:(i?t.children[i-1].dom.nextSibling:null)||t.dom.firstChild,endDOM:s<t.children.length&&s>=0?t.children[s].dom:null}}else return t.isText()?{from:n,to:n+t.length,startDOM:t.dom,endDOM:t.dom.nextSibling}:null}function h9(t,e){let r,{newSel:n}=e,{state:i}=t,a=i.selection.main,s=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:l,to:o}=e.bounds,c=a.from,h=null;(s===8||Xe.android&&e.text.length<o-l)&&(c=a.to,h="end");let d=i.doc.sliceString(l,o,ou),g,m;!a.empty&&a.from>=l&&a.to<=o&&(e.typeOver||d!=e.text)&&d.slice(0,a.from-l)==e.text.slice(0,a.from-l)&&d.slice(a.to-l)==e.text.slice(g=e.text.length-(d.length-(a.to-l)))?r={from:a.from,to:a.to,insert:Nt.of(e.text.slice(a.from-l,g).split(ou))}:(m=d9(d,e.text,c-l,h))&&(Xe.chrome&&s==13&&m.toB==m.from+2&&e.text.slice(m.from,m.toB)==ou+ou&&m.toB--,r={from:l+m.from,to:l+m.toA,insert:Nt.of(e.text.slice(m.from,m.toB).split(ou))})}else n&&(!t.hasFocus&&i.facet(Va)||Bg(n,a))&&(n=null);if(!r&&!n)return!1;if((Xe.mac||Xe.android)&&r&&r.from==r.to&&r.from==a.head-1&&/^\. ?$/.test(r.insert.toString())&&t.contentDOM.getAttribute("autocorrect")=="off"?(n&&r.insert.length==2&&(n=Ae.single(n.main.anchor-1,n.main.head-1)),r={from:r.from,to:r.to,insert:Nt.of([r.insert.toString().replace("."," ")])}):i.doc.lineAt(a.from).to<a.to&&t.docView.lineHasWidget(a.to)&&t.inputState.insertingTextAt>Date.now()-50?r={from:a.from,to:a.to,insert:i.toText(t.inputState.insertingText)}:Xe.chrome&&r&&r.from==r.to&&r.from==a.head&&r.insert.toString()==`
423
+ `&&t.lineWrapping&&(n&&(n=Ae.single(n.main.anchor-1,n.main.head-1)),r={from:a.from,to:a.to,insert:Nt.of([" "])}),r)return zE(t,r,n,s);if(n&&!Bg(n,a)){let l=!1,o="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(l=!0),o=t.inputState.lastSelectionOrigin,o=="select.pointer"&&(n=c9(i.facet(Dh).map(c=>c(t)),n))),t.dispatch({selection:n,scrollIntoView:l,userEvent:o}),!0}else return!1}function zE(t,e,r,n=-1){if(Xe.ios&&t.inputState.flushIOSKey(e))return!0;let i=t.state.selection.main;if(Xe.android&&(e.to==i.to&&(e.from==i.from||e.from==i.from-1&&t.state.sliceDoc(e.from,i.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Ou(t.contentDOM,"Enter",13)||(e.from==i.from-1&&e.to==i.to&&e.insert.length==0||n==8&&e.insert.length<e.to-e.from&&e.to>i.head)&&Ou(t.contentDOM,"Backspace",8)||e.from==i.from&&e.to==i.to+1&&e.insert.length==0&&Ou(t.contentDOM,"Delete",46)))return!0;let a=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let s,l=()=>s||(s=Qie(t,e,r));return t.state.facet(Z6).some(o=>o(t,e.from,e.to,a,l))||t.dispatch(l()),!0}function Qie(t,e,r){let n,i=t.state,a=i.selection.main,s=-1;if(e.from==e.to&&e.from<a.from||e.from>a.to){let o=e.from<a.from?-1:1,c=o<0?a.from:a.to,h=Of(i.facet(Dh).map(d=>d(t)),c,o);e.from==h&&(s=h)}if(s>-1)n={changes:e,selection:Ae.cursor(e.from+e.insert.length,-1)};else if(e.from>=a.from&&e.to<=a.to&&e.to-e.from>=(a.to-a.from)/3&&(!r||r.main.empty&&r.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let o=a.from<e.from?i.sliceDoc(a.from,e.from):"",c=a.to>e.to?i.sliceDoc(e.to,a.to):"";n=i.replaceSelection(t.state.toText(o+e.insert.sliceString(0,void 0,t.state.lineBreak)+c))}else{let o=i.changes(e),c=r&&r.main.to<=o.newLength?r.main:void 0;if(i.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=a.to+10&&e.to>=a.to-10){let h=t.state.sliceDoc(e.from,e.to),d,g=r&&u9(t,r.main.head);if(g){let y=e.insert.length-(e.to-e.from);d={from:g.from,to:g.to-y}}else d=t.state.doc.lineAt(a.head);let m=a.to-e.to;n=i.changeByRange(y=>{if(y.from==a.from&&y.to==a.to)return{changes:o,range:c||y.map(o)};let b=y.to-m,x=b-h.length;if(t.state.sliceDoc(x,b)!=h||b>=d.from&&x<=d.to)return{range:y};let w=i.changes({from:x,to:b,insert:e.insert}),S=y.to-a.to;return{changes:w,range:c?Ae.range(Math.max(0,c.anchor+S),Math.max(0,c.head+S)):y.map(w)}})}else n={changes:o,selection:c&&i.selection.replaceRange(c)}}let l="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,l+=".compose",t.inputState.compositionFirstChange&&(l+=".start",t.inputState.compositionFirstChange=!1)),i.update(n,{userEvent:l,scrollIntoView:!0})}function d9(t,e,r,n){let i=Math.min(t.length,e.length),a=0;for(;a<i&&t.charCodeAt(a)==e.charCodeAt(a);)a++;if(a==i&&t.length==e.length)return null;let s=t.length,l=e.length;for(;s>0&&l>0&&t.charCodeAt(s-1)==e.charCodeAt(l-1);)s--,l--;if(n=="end"){let o=Math.max(0,a-Math.min(s,l));r-=s+o-a}if(s<a&&t.length<e.length){let o=r<=a&&r>=s?a-r:0;a-=o,l=a+(l-s),s=a}else if(l<a){let o=r<=a&&r>=l?a-r:0;a-=o,s=a+(s-l),l=a}return{from:a,toA:s,toB:l}}function Kie(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:r,anchorOffset:n,focusNode:i,focusOffset:a}=t.observer.selectionRange;return r&&(e.push(new X4(r,n)),(i!=r||a!=n)&&e.push(new X4(i,a))),e}function Zie(t,e){if(t.length==0)return null;let r=t[0].pos,n=t.length==2?t[1].pos:r;return r>-1&&n>-1?Ae.single(r+e,n+e):null}function Bg(t,e){return e.head==t.main.head&&e.anchor==t.main.anchor}class Jie{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,Xe.safari&&e.contentDOM.addEventListener("input",()=>null),Xe.gecko&&pae(e.contentDOM.ownerDocument)}handleEvent(e){!lae(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,r){let n=this.handlers[e];if(n){for(let i of n.observers)i(this.view,r);for(let i of n.handlers){if(r.defaultPrevented)break;if(i(this.view,r)){r.preventDefault();break}}}}ensureHandlers(e){let r=eae(e),n=this.handlers,i=this.view.contentDOM;for(let a in r)if(a!="scroll"){let s=!r[a].handlers.length,l=n[a];l&&s!=!l.handlers.length&&(i.removeEventListener(a,this.handleEvent),l=null),l||i.addEventListener(a,this.handleEvent,{passive:s})}for(let a in n)a!="scroll"&&!r[a]&&i.removeEventListener(a,this.handleEvent);this.handlers=r}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&g9.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Xe.android&&Xe.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let r;return Xe.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((r=p9.find(n=>n.keyCode==e.keyCode))&&!e.ctrlKey||tae.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=r||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let r=this.pendingIOSKey;return!r||r.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,Ou(this.view.contentDOM,r.key,r.keyCode,r instanceof KeyboardEvent?r:void 0))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:Xe.safari&&!Xe.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function W4(t,e){return(r,n)=>{try{return e.call(t,n,r)}catch(i){Xn(r.state,i)}}}function eae(t){let e=Object.create(null);function r(n){return e[n]||(e[n]={observers:[],handlers:[]})}for(let n of t){let i=n.spec,a=i&&i.plugin.domEventHandlers,s=i&&i.plugin.domEventObservers;if(a)for(let l in a){let o=a[l];o&&r(l).handlers.push(W4(n.value,o))}if(s)for(let l in s){let o=s[l];o&&r(l).observers.push(W4(n.value,o))}}for(let n in Hi)r(n).handlers.push(Hi[n]);for(let n in Kn)r(n).observers.push(Kn[n]);return e}const p9=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],tae="dthko",g9=[16,17,18,20,91,92,224,225],vp=6;function mp(t){return Math.max(0,t)*.7+8}function rae(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class nae{constructor(e,r,n,i){this.view=e,this.startEvent=r,this.style=n,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=r,this.scrollParents=I6(e.contentDOM),this.atoms=e.state.facet(Dh).map(s=>s(e));let a=e.contentDOM.ownerDocument;a.addEventListener("mousemove",this.move=this.move.bind(this)),a.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=r.shiftKey,this.multiple=e.state.facet(Dt.allowMultipleSelections)&&iae(e,r),this.dragging=sae(e,r)&&y9(r)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&rae(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let r=0,n=0,i=0,a=0,s=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:i,right:s}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:a,bottom:l}=this.scrollParents.y.getBoundingClientRect());let o=PE(this.view);e.clientX-o.left<=i+vp?r=-mp(i-e.clientX):e.clientX+o.right>=s-vp&&(r=mp(e.clientX-s)),e.clientY-o.top<=a+vp?n=-mp(a-e.clientY):e.clientY+o.bottom>=l-vp&&(n=mp(e.clientY-l)),this.setScrollSpeed(r,n)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,r){this.scrollSpeed={x:e,y:r},e||r?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:r}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),r&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=r,r=0),(e||r)&&this.view.win.scrollBy(e,r),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:r}=this,n=c9(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!n.eq(r.state.selection,this.dragging===!1))&&this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(r=>r.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function iae(t,e){let r=t.state.facet(X6);return r.length?r[0](e):Xe.mac?e.metaKey:e.ctrlKey}function aae(t,e){let r=t.state.facet(W6);return r.length?r[0](e):Xe.mac?!e.altKey:!e.ctrlKey}function sae(t,e){let{main:r}=t.state.selection;if(r.empty)return!1;let n=Kf(t.root);if(!n||n.rangeCount==0)return!0;let i=n.getRangeAt(0).getClientRects();for(let a=0;a<i.length;a++){let s=i[a];if(s.left<=e.clientX&&s.right>=e.clientX&&s.top<=e.clientY&&s.bottom>=e.clientY)return!0}return!1}function lae(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let r=e.target,n;r!=t.contentDOM;r=r.parentNode)if(!r||r.nodeType==11||(n=vr.get(r))&&n.isWidget()&&!n.isHidden&&n.widget.ignoreEvent(e))return!1;return!0}const Hi=Object.create(null),Kn=Object.create(null),v9=Xe.ie&&Xe.ie_version<15||Xe.ios&&Xe.webkit_version<604;function oae(t){let e=t.dom.parentNode;if(!e)return;let r=e.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout(()=>{t.focus(),r.remove(),m9(t,r.value)},50)}function Uv(t,e,r){for(let n of t.facet(e))r=n(r,t);return r}function m9(t,e){e=Uv(t.state,_E,e);let{state:r}=t,n,i=1,a=r.toText(e),s=a.lines==r.selection.ranges.length;if(Zk!=null&&r.selection.ranges.every(o=>o.empty)&&Zk==a.toString()){let o=-1;n=r.changeByRange(c=>{let h=r.doc.lineAt(c.from);if(h.from==o)return{range:c};o=h.from;let d=r.toText((s?a.line(i++).text:e)+r.lineBreak);return{changes:{from:h.from,insert:d},range:Ae.cursor(c.from+d.length)}})}else s?n=r.changeByRange(o=>{let c=a.line(i++);return{changes:{from:o.from,to:o.to,insert:c.text},range:Ae.cursor(o.from+c.length)}}):n=r.replaceSelection(a);t.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}Kn.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};Kn.wheel=Kn.mousewheel=t=>{t.inputState.lastWheelEvent=Date.now()};Hi.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);Kn.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};Kn.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};Hi.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let r=null;for(let n of t.state.facet(Q6))if(r=n(t,e),r)break;if(!r&&e.button==0&&(r=cae(t,e)),r){let n=!t.hasFocus;t.inputState.startMouseSelection(new nae(t,e,r,n)),n&&t.observer.ignore(()=>{q6(t.contentDOM);let a=t.root.activeElement;a&&!a.contains(t.contentDOM)&&a.blur()});let i=t.inputState.mouseSelection;if(i)return i.start(e),i.dragging===!1}else t.inputState.setSelectionOrigin("select.pointer");return!1};function Q4(t,e,r,n){if(n==1)return Ae.cursor(e,r);if(n==2)return jie(t.state,e,r);{let i=t.docView.lineAt(e,r),a=t.state.doc.lineAt(i?i.posAtEnd:e),s=i?i.posAtStart:a.from,l=i?i.posAtEnd:a.to;return l<t.state.doc.length&&l==a.to&&l++,Ae.range(s,l)}}const uae=Xe.ie&&Xe.ie_version<=11;let K4=null,Z4=0,J4=0;function y9(t){if(!uae)return t.detail;let e=K4,r=J4;return K4=t,J4=Date.now(),Z4=!e||r>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Z4+1)%3:1}function cae(t,e){let r=t.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),n=y9(e),i=t.state.selection;return{update(a){a.docChanged&&(r.pos=a.changes.mapPos(r.pos),i=i.map(a.changes))},get(a,s,l){let o=t.posAndSideAtCoords({x:a.clientX,y:a.clientY},!1),c,h=Q4(t,o.pos,o.assoc,n);if(r.pos!=o.pos&&!s){let d=Q4(t,r.pos,r.assoc,n),g=Math.min(d.from,h.from),m=Math.max(d.to,h.to);h=g<h.from?Ae.range(g,m):Ae.range(m,g)}return s?i.replaceRange(i.main.extend(h.from,h.to)):l&&n==1&&i.ranges.length>1&&(c=fae(i,o.pos))?c:l?i.addRange(h):Ae.create([h])}}}function fae(t,e){for(let r=0;r<t.ranges.length;r++){let{from:n,to:i}=t.ranges[r];if(n<=e&&i>=e)return Ae.create(t.ranges.slice(0,r).concat(t.ranges.slice(r+1)),t.mainIndex==r?0:t.mainIndex-(t.mainIndex>r?1:0))}return null}Hi.dragstart=(t,e)=>{let{selection:{main:r}}=t.state;if(e.target.draggable){let i=t.docView.tile.nearest(e.target);if(i&&i.isWidget()){let a=i.posAtStart,s=a+i.length;(a>=r.to||s<=r.from)&&(r=Ae.range(a,s))}}let{inputState:n}=t;return n.mouseSelection&&(n.mouseSelection.dragging=!0),n.draggedContent=r,e.dataTransfer&&(e.dataTransfer.setData("Text",Uv(t.state,NE,t.state.sliceDoc(r.from,r.to))),e.dataTransfer.effectAllowed="copyMove"),!1};Hi.dragend=t=>(t.inputState.draggedContent=null,!1);function ez(t,e,r,n){if(r=Uv(t.state,_E,r),!r)return;let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:a}=t.inputState,s=n&&a&&aae(t,e)?{from:a.from,to:a.to}:null,l={from:i,insert:r},o=t.state.changes(s?[s,l]:l);t.focus(),t.dispatch({changes:o,selection:{anchor:o.mapPos(i,-1),head:o.mapPos(i,1)},userEvent:s?"move.drop":"input.drop"}),t.inputState.draggedContent=null}Hi.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let r=e.dataTransfer.files;if(r&&r.length){let n=Array(r.length),i=0,a=()=>{++i==r.length&&ez(t,e,n.filter(s=>s!=null).join(t.state.lineBreak),!1)};for(let s=0;s<r.length;s++){let l=new FileReader;l.onerror=a,l.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(n[s]=l.result),a()},l.readAsText(r[s])}return!0}else{let n=e.dataTransfer.getData("Text");if(n)return ez(t,e,n,!0),!0}return!1};Hi.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let r=v9?null:e.clipboardData;return r?(m9(t,r.getData("text/plain")||r.getData("text/uri-list")),!0):(oae(t),!1)};function hae(t,e){let r=t.dom.parentNode;if(!r)return;let n=r.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=e,n.focus(),n.selectionEnd=e.length,n.selectionStart=0,setTimeout(()=>{n.remove(),t.focus()},50)}function dae(t){let e=[],r=[],n=!1;for(let i of t.selection.ranges)i.empty||(e.push(t.sliceDoc(i.from,i.to)),r.push(i));if(!e.length){let i=-1;for(let{from:a}of t.selection.ranges){let s=t.doc.lineAt(a);s.number>i&&(e.push(s.text),r.push({from:s.from,to:Math.min(t.doc.length,s.to+1)})),i=s.number}n=!0}return{text:Uv(t,NE,e.join(t.lineBreak)),ranges:r,linewise:n}}let Zk=null;Hi.copy=Hi.cut=(t,e)=>{if(!Tf(t.contentDOM,t.observer.selectionRange))return!1;let{text:r,ranges:n,linewise:i}=dae(t.state);if(!r&&!i)return!1;Zk=i?r:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let a=v9?null:e.clipboardData;return a?(a.clearData(),a.setData("text/plain",r),!0):(hae(t,r),!1)};const b9=ma.define();function x9(t,e){let r=[];for(let n of t.facet(J6)){let i=n(t,e);i&&r.push(i)}return r.length?t.update({effects:r,annotations:b9.of(!0)}):null}function w9(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let r=x9(t.state,e);r?t.dispatch(r):t.update([])}},10)}Kn.focus=t=>{t.inputState.lastFocusTime=Date.now(),!t.scrollDOM.scrollTop&&(t.inputState.lastScrollTop||t.inputState.lastScrollLeft)&&(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),w9(t)};Kn.blur=t=>{t.observer.clearSelectionRange(),w9(t)};Kn.compositionstart=Kn.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};Kn.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,Xe.chrome&&Xe.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};Kn.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};Hi.beforeinput=(t,e)=>{var r,n;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&t.observer.editContext){let a=(r=e.dataTransfer)===null||r===void 0?void 0:r.getData("text/plain"),s=e.getTargetRanges();if(a&&s.length){let l=s[0],o=t.posAtDOM(l.startContainer,l.startOffset),c=t.posAtDOM(l.endContainer,l.endOffset);return zE(t,{from:o,to:c,insert:t.state.toText(a)},null),!0}}let i;if(Xe.chrome&&Xe.android&&(i=p9.find(a=>a.inputType==e.inputType))&&(t.observer.delayAndroidKey(i.key,i.keyCode),i.key=="Backspace"||i.key=="Delete")){let a=((n=window.visualViewport)===null||n===void 0?void 0:n.height)||0;setTimeout(()=>{var s;(((s=window.visualViewport)===null||s===void 0?void 0:s.height)||0)>a+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return Xe.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),Xe.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>Kn.compositionend(t,e),20),!1};const tz=new Set;function pae(t){tz.has(t)||(tz.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const rz=["pre-wrap","normal","pre-line","break-spaces"];let Fu=!1;function nz(){Fu=!1}class gae{constructor(e){this.lineWrapping=e,this.doc=Nt.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,r){let n=this.doc.lineAt(r).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((r-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return rz.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let r=!1;for(let n=0;n<e.length;n++){let i=e[n];i<0?n++:this.heightSamples[Math.floor(i*10)]||(r=!0,this.heightSamples[Math.floor(i*10)]=!0)}return r}refresh(e,r,n,i,a,s){let l=rz.indexOf(e)>-1,o=Math.abs(r-this.lineHeight)>.3||this.lineWrapping!=l||Math.abs(n-this.charWidth)>.1;if(this.lineWrapping=l,this.lineHeight=r,this.charWidth=n,this.textHeight=i,this.lineLength=a,o){this.heightSamples={};for(let c=0;c<s.length;c++){let h=s[c];h<0?c++:this.heightSamples[Math.floor(h*10)]=!0}}return o}}class vae{constructor(e,r){this.from=e,this.heights=r,this.index=0}get more(){return this.index<this.heights.length}}class Pi{constructor(e,r,n,i,a){this.from=e,this.length=r,this.top=n,this.height=i,this._content=a}get type(){return typeof this._content=="number"?un.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof ro?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let r=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new Pi(this.from,this.length+e.length,this.top,this.height+e.height,r)}}var tr=(function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t})(tr||(tr={}));const Jp=.001;class Mn{constructor(e,r,n=2){this.length=e,this.height=r,this.flags=n}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Jp&&(Fu=!0),this.height=e)}replace(e,r,n){return Mn.of(n)}decomposeLeft(e,r){r.push(this)}decomposeRight(e,r){r.push(this)}applyChanges(e,r,n,i){let a=this,s=n.doc;for(let l=i.length-1;l>=0;l--){let{fromA:o,toA:c,fromB:h,toB:d}=i[l],g=a.lineAt(o,tr.ByPosNoHeight,n.setDoc(r),0,0),m=g.to>=c?g:a.lineAt(c,tr.ByPosNoHeight,n,0,0);for(d+=m.to-c,c=m.to;l>0&&g.from<=i[l-1].toA;)o=i[l-1].fromA,h=i[l-1].fromB,l--,o<g.from&&(g=a.lineAt(o,tr.ByPosNoHeight,n,0,0));h+=g.from-o,o=g.from;let y=IE.build(n.setDoc(s),e,h,d);a=Lg(a,a.replace(o,c,y))}return a.updateHeight(n,0)}static empty(){return new ui(0,0,0)}static of(e){if(e.length==1)return e[0];let r=0,n=e.length,i=0,a=0;for(;;)if(r==n)if(i>a*2){let l=e[r-1];l.break?e.splice(--r,1,l.left,null,l.right):e.splice(--r,1,l.left,l.right),n+=1+l.break,i-=l.size}else if(a>i*2){let l=e[n];l.break?e.splice(n,1,l.left,null,l.right):e.splice(n,1,l.left,l.right),n+=2+l.break,a-=l.size}else break;else if(i<a){let l=e[r++];l&&(i+=l.size)}else{let l=e[--n];l&&(a+=l.size)}let s=0;return e[r-1]==null?(s=1,r--):e[r]==null&&(s=1,n++),new yae(Mn.of(e.slice(0,r)),s,Mn.of(e.slice(n)))}}function Lg(t,e){return t==e?t:(t.constructor!=e.constructor&&(Fu=!0),e)}Mn.prototype.size=1;const mae=ut.replace({});class S9 extends Mn{constructor(e,r,n){super(e,r),this.deco=n,this.spaceAbove=0}mainBlock(e,r){return new Pi(r,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,r,n,i){return this.spaceAbove&&e<n+this.spaceAbove?new Pi(i,0,n,this.spaceAbove,mae):this.mainBlock(n,i)}lineAt(e,r,n,i,a){let s=this.mainBlock(i,a);return this.spaceAbove?this.blockAt(0,n,i,a).join(s):s}forEachLine(e,r,n,i,a,s){e<=a+this.length&&r>=a&&s(this.lineAt(0,tr.ByPos,n,i,a))}setMeasuredHeight(e){let r=e.heights[e.index++];r<0?(this.spaceAbove=-r,r=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(r)}updateHeight(e,r=0,n=!1,i){return i&&i.from<=r&&i.more&&this.setMeasuredHeight(i),this.outdated=!1,this}toString(){return`block(${this.length})`}}class ui extends S9{constructor(e,r,n){super(e,r,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=n}mainBlock(e,r){return new Pi(r,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,r,n){let i=n[0];return n.length==1&&(i instanceof ui||i instanceof nn&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof nn?i=new ui(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):Mn.of(n)}updateHeight(e,r=0,n=!1,i){return i&&i.from<=r&&i.more?this.setMeasuredHeight(i):(n||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class nn extends Mn{constructor(e){super(e,0)}heightMetrics(e,r){let n=e.doc.lineAt(r).number,i=e.doc.lineAt(r+this.length).number,a=i-n+1,s,l=0;if(e.lineWrapping){let o=Math.min(this.height,e.lineHeight*a);s=o/a,this.length>a+1&&(l=(this.height-o)/(this.length-a-1))}else s=this.height/a;return{firstLine:n,lastLine:i,perLine:s,perChar:l}}blockAt(e,r,n,i){let{firstLine:a,lastLine:s,perLine:l,perChar:o}=this.heightMetrics(r,i);if(r.lineWrapping){let c=i+(e<r.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),h=r.doc.lineAt(c),d=l+h.length*o,g=Math.max(n,e-d/2);return new Pi(h.from,h.length,g,d,0)}else{let c=Math.max(0,Math.min(s-a,Math.floor((e-n)/l))),{from:h,length:d}=r.doc.line(a+c);return new Pi(h,d,n+l*c,l,0)}}lineAt(e,r,n,i,a){if(r==tr.ByHeight)return this.blockAt(e,n,i,a);if(r==tr.ByPosNoHeight){let{from:m,to:y}=n.doc.lineAt(e);return new Pi(m,y-m,0,0,0)}let{firstLine:s,perLine:l,perChar:o}=this.heightMetrics(n,a),c=n.doc.lineAt(e),h=l+c.length*o,d=c.number-s,g=i+l*d+o*(c.from-a-d);return new Pi(c.from,c.length,Math.max(i,Math.min(g,i+this.height-h)),h,0)}forEachLine(e,r,n,i,a,s){e=Math.max(e,a),r=Math.min(r,a+this.length);let{firstLine:l,perLine:o,perChar:c}=this.heightMetrics(n,a);for(let h=e,d=i;h<=r;){let g=n.doc.lineAt(h);if(h==e){let y=g.number-l;d+=o*y+c*(e-a-y)}let m=o+c*g.length;s(new Pi(g.from,g.length,d,m,0)),d+=m,h=g.to+1}}replace(e,r,n){let i=this.length-r;if(i>0){let a=n[n.length-1];a instanceof nn?n[n.length-1]=new nn(a.length+i):n.push(null,new nn(i-1))}if(e>0){let a=n[0];a instanceof nn?n[0]=new nn(e+a.length):n.unshift(new nn(e-1),null)}return Mn.of(n)}decomposeLeft(e,r){r.push(new nn(e-1),null)}decomposeRight(e,r){r.push(null,new nn(this.length-e-1))}updateHeight(e,r=0,n=!1,i){let a=r+this.length;if(i&&i.from<=r+this.length&&i.more){let s=[],l=Math.max(r,i.from),o=-1;for(i.from>r&&s.push(new nn(i.from-r-1).updateHeight(e,r));l<=a&&i.more;){let h=e.doc.lineAt(l).length;s.length&&s.push(null);let d=i.heights[i.index++],g=0;d<0&&(g=-d,d=i.heights[i.index++]),o==-1?o=d:Math.abs(d-o)>=Jp&&(o=-2);let m=new ui(h,d,g);m.outdated=!1,s.push(m),l+=h+1}l<=a&&s.push(null,new nn(a-l).updateHeight(e,l));let c=Mn.of(s);return(o<0||Math.abs(c.height-this.height)>=Jp||Math.abs(o-this.heightMetrics(e,r).perLine)>=Jp)&&(Fu=!0),Lg(this,c)}else(n||this.outdated)&&(this.setHeight(e.heightForGap(r,r+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class yae extends Mn{constructor(e,r,n){super(e.length+r+n.length,e.height+n.height,r|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return this.flags&1}blockAt(e,r,n,i){let a=n+this.left.height;return e<a?this.left.blockAt(e,r,n,i):this.right.blockAt(e,r,a,i+this.left.length+this.break)}lineAt(e,r,n,i,a){let s=i+this.left.height,l=a+this.left.length+this.break,o=r==tr.ByHeight?e<s:e<l,c=o?this.left.lineAt(e,r,n,i,a):this.right.lineAt(e,r,n,s,l);if(this.break||(o?c.to<l:c.from>l))return c;let h=r==tr.ByPosNoHeight?tr.ByPosNoHeight:tr.ByPos;return o?c.join(this.right.lineAt(l,h,n,s,l)):this.left.lineAt(l,h,n,i,a).join(c)}forEachLine(e,r,n,i,a,s){let l=i+this.left.height,o=a+this.left.length+this.break;if(this.break)e<o&&this.left.forEachLine(e,r,n,i,a,s),r>=o&&this.right.forEachLine(e,r,n,l,o,s);else{let c=this.lineAt(o,tr.ByPos,n,i,a);e<c.from&&this.left.forEachLine(e,c.from-1,n,i,a,s),c.to>=e&&c.from<=r&&s(c),r>c.to&&this.right.forEachLine(c.to+1,r,n,l,o,s)}}replace(e,r,n){let i=this.left.length+this.break;if(r<i)return this.balanced(this.left.replace(e,r,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-i,r-i,n));let a=[];e>0&&this.decomposeLeft(e,a);let s=a.length;for(let l of n)a.push(l);if(e>0&&iz(a,s-1),r<this.length){let l=a.length;this.decomposeRight(r,a),iz(a,l)}return Mn.of(a)}decomposeLeft(e,r){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,r);r.push(this.left),this.break&&(n++,e>=n&&r.push(null)),e>n&&this.right.decomposeLeft(e-n,r)}decomposeRight(e,r){let n=this.left.length,i=n+this.break;if(e>=i)return this.right.decomposeRight(e-i,r);e<n&&this.left.decomposeRight(e,r),this.break&&e<i&&r.push(null),r.push(this.right)}balanced(e,r){return e.size>2*r.size||r.size>2*e.size?Mn.of(this.break?[e,null,r]:[e,r]):(this.left=Lg(this.left,e),this.right=Lg(this.right,r),this.setHeight(e.height+r.height),this.outdated=e.outdated||r.outdated,this.size=e.size+r.size,this.length=e.length+this.break+r.length,this)}updateHeight(e,r=0,n=!1,i){let{left:a,right:s}=this,l=r+a.length+this.break,o=null;return i&&i.from<=r+a.length&&i.more?o=a=a.updateHeight(e,r,n,i):a.updateHeight(e,r,n),i&&i.from<=l+s.length&&i.more?o=s=s.updateHeight(e,l,n,i):s.updateHeight(e,l,n),o?this.balanced(a,s):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function iz(t,e){let r,n;t[e]==null&&(r=t[e-1])instanceof nn&&(n=t[e+1])instanceof nn&&t.splice(e-1,3,new nn(r.length+1+n.length))}const bae=5;class IE{constructor(e,r){this.pos=e,this.oracle=r,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,r){if(this.lineStart>-1){let n=Math.min(r,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof ui?i.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new ui(n-this.pos,-1,0)),this.writtenTo=n,r>n&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=r}point(e,r,n){if(e<r||n.heightRelevant){let i=n.widget?n.widget.estimatedHeight:0,a=n.widget?n.widget.lineBreaks:0;i<0&&(i=this.oracle.lineHeight);let s=r-e;n.block?this.addBlock(new S9(s,i,n)):(s||a||i>=bae)&&this.addLineDeco(i,a,s)}else r>e&&this.span(e,r);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:r}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=r,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new ui(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,r){let n=new nn(r-e);return this.oracle.doc.lineAt(e).to==r&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof ui)return e;let r=new ui(0,-1,0);return this.nodes.push(r),r}addBlock(e){this.enterLine();let r=e.deco;r&&r.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,r&&r.endSide>0&&(this.covering=e)}addLineDeco(e,r,n){let i=this.ensureLine();i.length+=n,i.collapsed+=n,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=r,this.writtenTo=this.pos=this.pos+n}finish(e){let r=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(r instanceof ui)&&!this.isCovered?this.nodes.push(new ui(0,-1,0)):(this.writtenTo<this.pos||r==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let n=e;for(let i of this.nodes)i instanceof ui&&i.updateHeight(this.oracle,n),n+=i?i.length:1;return this.nodes}static build(e,r,n,i){let a=new IE(n,e);return Et.spans(r,n,i,a,0),a.finish(n)}}function xae(t,e,r){let n=new wae;return Et.compare(t,e,r,n,0),n.changes}class wae{constructor(){this.changes=[]}compareRange(){}comparePoint(e,r,n,i){(e<r||n&&n.heightRelevant||i&&i.heightRelevant)&&Au(e,r,this.changes,5)}}function Sae(t,e){let r=t.getBoundingClientRect(),n=t.ownerDocument,i=n.defaultView||window,a=Math.max(0,r.left),s=Math.min(i.innerWidth,r.right),l=Math.max(0,r.top),o=Math.min(i.innerHeight,r.bottom);for(let c=t.parentNode;c&&c!=n.body;)if(c.nodeType==1){let h=c,d=window.getComputedStyle(h);if((h.scrollHeight>h.clientHeight||h.scrollWidth>h.clientWidth)&&d.overflow!="visible"){let g=h.getBoundingClientRect();a=Math.max(a,g.left),s=Math.min(s,g.right),l=Math.max(l,g.top),o=Math.min(c==t.parentNode?i.innerHeight:o,g.bottom)}c=d.position=="absolute"||d.position=="fixed"?h.offsetParent:h.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:a-r.left,right:Math.max(a,s)-r.left,top:l-(r.top+e),bottom:Math.max(l,o)-(r.top+e)}}function Cae(t){let e=t.getBoundingClientRect(),r=t.ownerDocument.defaultView||window;return e.left<r.innerWidth&&e.right>0&&e.top<r.innerHeight&&e.bottom>0}function kae(t,e){let r=t.getBoundingClientRect();return{left:0,right:r.right-r.left,top:e,bottom:r.bottom-(r.top+e)}}class TC{constructor(e,r,n,i){this.from=e,this.to=r,this.size=n,this.displaySize=i}static same(e,r){if(e.length!=r.length)return!1;for(let n=0;n<e.length;n++){let i=e[n],a=r[n];if(i.from!=a.from||i.to!=a.to||i.size!=a.size)return!1}return!0}draw(e,r){return ut.replace({widget:new Tae(this.displaySize*(r?e.scaleY:e.scaleX),r)}).range(this.from,this.to)}}class Tae extends ba{constructor(e,r){super(),this.size=e,this.vertical=r}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class az{constructor(e,r){this.view=e,this.state=r,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=sz,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Jt.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=r.facet(BE).some(i=>typeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new gae(n),this.stateDeco=lz(r),this.heightMap=Mn.empty().applyChanges(this.stateDeco,Nt.empty,this.heightOracle.setDoc(r.doc),[new Ti(0,0,0,r.doc.length)]);for(let i=0;i<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());i++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ut.set(this.lineGaps.map(i=>i.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:r}=this.state.selection;for(let n=0;n<=1;n++){let i=n?r.head:r.anchor;if(!e.some(({from:a,to:s})=>i>=a&&i<=s)){let{from:a,to:s}=this.lineBlockAt(i);e.push(new yp(a,s))}}return this.viewports=e.sort((n,i)=>n.from-i.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?sz:new qE(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(yf(e,this.scaler))})}update(e,r=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=lz(this.state);let i=e.changedRanges,a=Ti.extendWithRanges(i,xae(n,this.stateDeco,e?e.changes:Pr.empty(this.state.doc.length))),s=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);nz(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),a),(this.heightMap.height!=s||Fu)&&(e.flags|=2),l?(this.scrollAnchorPos=e.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=s);let o=a.length?this.mapViewport(this.viewport,e.changes):this.viewport;(r&&(r.range.head<o.from||r.range.head>o.to)||!this.viewportIsAppropriate(o))&&(o=this.getViewport(0,r));let c=o.from!=this.viewport.from||o.to!=this.viewport.to;this.viewport=o,e.flags|=this.updateForViewport(),(c||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),r&&(this.scrollTarget=r),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(t9)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,r=e.contentDOM,n=window.getComputedStyle(r),i=this.heightOracle,a=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?Jt.RTL:Jt.LTR;let s=this.heightOracle.mustRefreshForWrapping(a)||this.mustMeasureContent==="refresh",l=r.getBoundingClientRect(),o=s||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let c=0,h=0;if(l.width&&l.height){let{scaleX:M,scaleY:R}=z6(r,l);(M>.005&&Math.abs(this.scaleX-M)>.005||R>.005&&Math.abs(this.scaleY-R)>.005)&&(this.scaleX=M,this.scaleY=R,c|=16,s=o=!0)}let d=(parseInt(n.paddingTop)||0)*this.scaleY,g=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=d||this.paddingBottom!=g)&&(this.paddingTop=d,this.paddingBottom=g,c|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(o=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=16);let m=I6(this.view.contentDOM,!1).y;m!=this.scrollParent&&(this.scrollParent=m,this.scrollAnchorHeight=-1,this.scrollOffset=0);let y=this.getScrollOffset();this.scrollOffset!=y&&(this.scrollAnchorHeight=-1,this.scrollOffset=y),this.scrolledToBottom=j6(this.scrollParent||e.win);let b=(this.printing?kae:Sae)(r,this.paddingTop),x=b.top-this.pixelViewport.top,w=b.bottom-this.pixelViewport.bottom;this.pixelViewport=b;let S=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(S!=this.inView&&(this.inView=S,S&&(o=!0)),!this.inView&&!this.scrollTarget&&!Cae(e.dom))return 0;let k=l.width;if((this.contentDOMWidth!=k||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,c|=16),o){let M=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(M)&&(s=!0),s||i.lineWrapping&&Math.abs(k-this.contentDOMWidth)>i.charWidth){let{lineHeight:R,charWidth:O,textHeight:N}=e.docView.measureTextSize();s=R>0&&i.refresh(a,R,O,N,Math.max(5,k/O),M),s&&(e.docView.minWidth=0,c|=16)}x>0&&w>0?h=Math.max(x,w):x<0&&w<0&&(h=Math.min(x,w)),nz();for(let R of this.viewports){let O=R.from==this.viewport.from?M:e.docView.measureVisibleLineHeights(R);this.heightMap=(s?Mn.empty().applyChanges(this.stateDeco,Nt.empty,this.heightOracle,[new Ti(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,s,new vae(R.from,O))}Fu&&(c|=2)}let E=!this.viewportIsAppropriate(this.viewport,h)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return E&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(h,this.scrollTarget),c|=this.updateForViewport()),(c&2||E)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(s?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,r){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,a=this.heightOracle,{visibleTop:s,visibleBottom:l}=this,o=new yp(i.lineAt(s-n*1e3,tr.ByHeight,a,0,0).from,i.lineAt(l+(1-n)*1e3,tr.ByHeight,a,0,0).to);if(r){let{head:c}=r.range;if(c<o.from||c>o.to){let h=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),d=i.lineAt(c,tr.ByPos,a,0,0),g;r.y=="center"?g=(d.top+d.bottom)/2-h/2:r.y=="start"||r.y=="nearest"&&c<o.from?g=d.top:g=d.bottom-h,o=new yp(i.lineAt(g-1e3/2,tr.ByHeight,a,0,0).from,i.lineAt(g+h+1e3/2,tr.ByHeight,a,0,0).to)}}return o}mapViewport(e,r){let n=r.mapPos(e.from,-1),i=r.mapPos(e.to,1);return new yp(this.heightMap.lineAt(n,tr.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,tr.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:r},n=0){if(!this.inView)return!0;let{top:i}=this.heightMap.lineAt(e,tr.ByPos,this.heightOracle,0,0),{bottom:a}=this.heightMap.lineAt(r,tr.ByPos,this.heightOracle,0,0),{visibleTop:s,visibleBottom:l}=this;return(e==0||i<=s-Math.max(10,Math.min(-n,250)))&&(r==this.state.doc.length||a>=l+Math.max(10,Math.min(n,250)))&&i>s-2*1e3&&a<l+2*1e3}mapLineGaps(e,r){if(!e.length||r.empty)return e;let n=[];for(let i of e)r.touchesRange(i.from,i.to)||n.push(new TC(r.mapPos(i.from),r.mapPos(i.to),i.size,i.displaySize));return n}ensureLineGaps(e,r){let n=this.heightOracle.lineWrapping,i=n?1e4:2e3,a=i>>1,s=i<<1;if(this.defaultTextDirection!=Jt.LTR&&!n)return[];let l=[],o=(h,d,g,m)=>{if(d-h<a)return;let y=this.state.selection.main,b=[y.from];y.empty||b.push(y.to);for(let w of b)if(w>h&&w<d){o(h,w-10,g,m),o(w+10,d,g,m);return}let x=Aae(e,w=>w.from>=g.from&&w.to<=g.to&&Math.abs(w.from-h)<a&&Math.abs(w.to-d)<a&&!b.some(S=>w.from<S&&w.to>S));if(!x){if(d<g.to&&r&&n&&r.visibleRanges.some(k=>k.from<=d&&k.to>=d)){let k=r.moveToLineBoundary(Ae.cursor(d),!1,!0).head;k>h&&(d=k)}let w=this.gapSize(g,h,d,m),S=n||w<2e6?w:2e6;x=new TC(h,d,w,S)}l.push(x)},c=h=>{if(h.length<s||h.type!=un.Text)return;let d=Eae(h.from,h.to,this.stateDeco);if(d.total<s)return;let g=this.scrollTarget?this.scrollTarget.range.head:null,m,y;if(n){let b=i/this.heightOracle.lineLength*this.heightOracle.lineHeight,x,w;if(g!=null){let S=xp(d,g),k=((this.visibleBottom-this.visibleTop)/2+b)/h.height;x=S-k,w=S+k}else x=(this.visibleTop-h.top-b)/h.height,w=(this.visibleBottom-h.top+b)/h.height;m=bp(d,x),y=bp(d,w)}else{let b=d.total*this.heightOracle.charWidth,x=i*this.heightOracle.charWidth,w=0;if(b>2e6)for(let R of e)R.from>=h.from&&R.from<h.to&&R.size!=R.displaySize&&R.from*this.heightOracle.charWidth+w<this.pixelViewport.left&&(w=R.size-R.displaySize);let S=this.pixelViewport.left+w,k=this.pixelViewport.right+w,E,M;if(g!=null){let R=xp(d,g),O=((k-S)/2+x)/b;E=R-O,M=R+O}else E=(S-x)/b,M=(k+x)/b;m=bp(d,E),y=bp(d,M)}m>h.from&&o(h.from,m,h,d),y<h.to&&o(y,h.to,h,d)};for(let h of this.viewportLines)Array.isArray(h.type)?h.type.forEach(c):c(h);return l}gapSize(e,r,n,i){let a=xp(i,n)-xp(i,r);return this.heightOracle.lineWrapping?e.height*a:i.total*this.heightOracle.charWidth*a}updateLineGaps(e){TC.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=ut.set(e.map(r=>r.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let r=this.stateDeco;this.lineGaps.length&&(r=r.concat(this.lineGapDeco));let n=[];Et.spans(r,this.viewport.from,this.viewport.to,{span(a,s){n.push({from:a,to:s})},point(){}},20);let i=0;if(n.length!=this.visibleRanges.length)i=12;else for(let a=0;a<n.length&&!(i&8);a++){let s=this.visibleRanges[a],l=n[a];(s.from!=l.from||s.to!=l.to)&&(i|=4,e&&e.mapPos(s.from,-1)==l.from&&e.mapPos(s.to,1)==l.to||(i|=8))}return this.visibleRanges=n,i}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(r=>r.from<=e&&r.to>=e)||yf(this.heightMap.lineAt(e,tr.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(r=>r.top<=e&&r.bottom>=e)||yf(this.heightMap.lineAt(this.scaler.fromDOM(e),tr.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(e){let r=this.lineBlockAtHeight(e+8);return r.from>=this.viewport.from||this.viewportLines[0].top-e>200?r:this.viewportLines[0]}elementAtHeight(e){return yf(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class yp{constructor(e,r){this.from=e,this.to=r}}function Eae(t,e,r){let n=[],i=t,a=0;return Et.spans(r,t,e,{span(){},point(s,l){s>i&&(n.push({from:i,to:s}),a+=s-i),i=l}},20),i<e&&(n.push({from:i,to:e}),a+=e-i),{total:a,ranges:n}}function bp({total:t,ranges:e},r){if(r<=0)return e[0].from;if(r>=1)return e[e.length-1].to;let n=Math.floor(t*r);for(let i=0;;i++){let{from:a,to:s}=e[i],l=s-a;if(n<=l)return a+n;n-=l}}function xp(t,e){let r=0;for(let{from:n,to:i}of t.ranges){if(e<=i){r+=e-n;break}r+=i-n}return r/t.total}function Aae(t,e){for(let r of t)if(e(r))return r}const sz={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};function lz(t){let e=t.facet(Fv).filter(n=>typeof n!="function"),r=t.facet(LE).filter(n=>typeof n!="function");return r.length&&e.push(Et.join(r)),e}class qE{constructor(e,r,n){let i=0,a=0,s=0;this.viewports=n.map(({from:l,to:o})=>{let c=r.lineAt(l,tr.ByPos,e,0,0).top,h=r.lineAt(o,tr.ByPos,e,0,0).bottom;return i+=h-c,{from:l,to:o,top:c,bottom:h,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(r.height-i);for(let l of this.viewports)l.domTop=s+(l.top-a)*this.scale,s=l.domBottom=l.domTop+(l.bottom-l.top),a=l.bottom}toDOM(e){for(let r=0,n=0,i=0;;r++){let a=r<this.viewports.length?this.viewports[r]:null;if(!a||e<a.top)return i+(e-n)*this.scale;if(e<=a.bottom)return a.domTop+(e-a.top);n=a.bottom,i=a.domBottom}}fromDOM(e){for(let r=0,n=0,i=0;;r++){let a=r<this.viewports.length?this.viewports[r]:null;if(!a||e<a.domTop)return n+(e-i)/this.scale;if(e<=a.domBottom)return a.top+(e-a.domTop);n=a.bottom,i=a.domBottom}}eq(e){return e instanceof qE?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((r,n)=>r.from==e.viewports[n].from&&r.to==e.viewports[n].to):!1}}function yf(t,e){if(e.scale==1)return t;let r=e.toDOM(t.top),n=e.toDOM(t.bottom);return new Pi(t.from,t.length,r,n-r,Array.isArray(t._content)?t._content.map(i=>yf(i,e)):t._content)}const wp=We.define({combine:t=>t.join(" ")}),Jk=We.define({combine:t=>t.indexOf(!0)>-1}),eT=el.newName(),C9=el.newName(),k9=el.newName(),T9={"&light":"."+C9,"&dark":"."+k9};function tT(t,e,r){return new el(e,{finish(n){return/&/.test(n)?n.replace(/&\w*/,i=>{if(i=="&")return t;if(!r||!r[i])throw new RangeError(`Unsupported selector: ${i}`);return r[i]}):t+" "+n}})}const Oae=tT("."+eT,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},T9),Mae={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},EC=Xe.ie&&Xe.ie_version<=11;class Rae{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new sie,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(r=>{for(let n of r)this.queue.push(n);(Xe.ie&&Xe.ie_version<=11||Xe.ios&&e.composing)&&r.some(n=>n.type=="childList"&&n.removedNodes.length||n.type=="characterData"&&n.oldValue.length>n.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Xe.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Xe.chrome&&Xe.chrome_version<126)&&(this.editContext=new _ae(e),e.state.facet(Va)&&(e.contentDOM.editContext=this.editContext.editContext)),EC&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var r;((r=this.view.docView)===null||r===void 0?void 0:r.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(r=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),r.length>0&&r[r.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(r=>{r.length>0&&r[r.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((r,n)=>r!=e[n]))){this.gapIntersection.disconnect();for(let r of e)this.gapIntersection.observe(r);this.gaps=e}}onSelectionChange(e){let r=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,i=this.selectionRange;if(n.state.facet(Va)?n.root.activeElement!=this.dom:!Tf(this.dom,i))return;let a=i.anchorNode&&n.docView.tile.nearest(i.anchorNode);if(a&&a.isWidget()&&a.widget.ignoreEvent(e)){r||(this.selectionChanged=!1);return}(Xe.ie&&Xe.ie_version<=11||Xe.android&&Xe.chrome)&&!n.state.selection.main.empty&&i.focusNode&&Af(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,r=Kf(e.root);if(!r)return!1;let n=Xe.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&Dae(this.view,r)||r;if(!n||this.selectionRange.eq(n))return!1;let i=Tf(this.dom,n);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&oie(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),i&&(this.selectionChanged=!0),!0)}setSelectionRange(e,r){this.selectionRange.set(e.node,e.offset,r.node,r.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,r=null;for(let n=this.dom;n;)if(n.nodeType==1)!r&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:r||(r=this.scrollTargets.slice(0,e)),r&&r.push(n),n=n.assignedSlot||n.parentNode;else if(n.nodeType==11)n=n.host;else break;if(e<this.scrollTargets.length&&!r&&(r=this.scrollTargets.slice(0,e)),r){for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);for(let n of this.scrollTargets=r)n.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,Mae),EC&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),EC&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,r){var n;if(!this.delayedAndroidKey){let i=()=>{let a=this.delayedAndroidKey;a&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=a.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&a.force&&Ou(this.dom,a.key,a.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(i)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:r,force:this.lastChange<Date.now()-50||!!(!((n=this.delayedAndroidKey)===null||n===void 0)&&n.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let r=-1,n=-1,i=!1;for(let a of e){let s=this.readMutation(a);s&&(s.typeOver&&(i=!0),r==-1?{from:r,to:n}=s:(r=Math.min(s.from,r),n=Math.max(s.to,n)))}return{from:r,to:n,typeOver:i}}readChange(){let{from:e,to:r,typeOver:n}=this.processRecords(),i=this.selectionChanged&&Tf(this.dom,this.selectionRange);if(e<0&&!i)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let a=new Wie(this.view,e,r,n);return this.view.docView.domChanged={newSel:a.newSel?a.newSel.main:null},a}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let r=this.readChange();if(!r)return this.view.requestMeasure(),!1;let n=this.view.state,i=h9(this.view,r);return this.view.state==n&&(r.domChanged||r.newSel&&!Bg(this.view.state.selection,r.newSel.main))&&this.view.update([]),i}readMutation(e){let r=this.view.docView.tile.nearest(e.target);if(!r||r.isWidget())return null;if(r.markDirty(e.type=="attributes"),e.type=="childList"){let n=oz(r,e.previousSibling||e.target.previousSibling,-1),i=oz(r,e.nextSibling||e.target.nextSibling,1);return{from:n?r.posAfter(n):r.posAtStart,to:i?r.posBefore(i):r.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(Va)!=e.state.facet(Va)&&(e.view.contentDOM.editContext=e.state.facet(Va)?this.editContext.editContext:null))}destroy(){var e,r,n;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(r=this.gapIntersection)===null||r===void 0||r.disconnect(),(n=this.resizeScroll)===null||n===void 0||n.disconnect();for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function oz(t,e,r){for(;e;){let n=vr.get(e);if(n&&n.parent==t)return n;let i=e.parentNode;e=i!=t.dom?i:r>0?e.nextSibling:e.previousSibling}return null}function uz(t,e){let r=e.startContainer,n=e.startOffset,i=e.endContainer,a=e.endOffset,s=t.docView.domAtPos(t.state.selection.main.anchor,1);return Af(s.node,s.offset,i,a)&&([r,n,i,a]=[i,a,r,n]),{anchorNode:r,anchorOffset:n,focusNode:i,focusOffset:a}}function Dae(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return uz(t,i)}let r=null;function n(i){i.preventDefault(),i.stopImmediatePropagation(),r=i.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",n,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",n,!0),r?uz(t,r):null}class _ae{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let r=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=n=>{let i=e.state.selection.main,{anchor:a,head:s}=i,l=this.toEditorPos(n.updateRangeStart),o=this.toEditorPos(n.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:l,drifted:!1});let c=o-l>n.text.length;l==this.from&&a<this.from?l=a:o==this.to&&a>this.to&&(o=a);let h=d9(e.state.sliceDoc(l,o),n.text,(c?i.from:i.to)-l,c?"end":null);if(!h){let g=Ae.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));Bg(g,i)||e.dispatch({selection:g,userEvent:"select"});return}let d={from:h.from+l,to:h.toA+l,insert:Nt.of(n.text.slice(h.from,h.toB).split(`
424
+ `))};if((Xe.mac||Xe.android)&&d.from==s-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(d={from:l,to:o,insert:Nt.of([n.text.replace("."," ")])}),this.pendingContextChange=d,!e.state.readOnly){let g=this.to-this.from+(d.to-d.from+d.insert.length);zE(e,d,Ae.single(this.toEditorPos(n.selectionStart,g),this.toEditorPos(n.selectionEnd,g)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),d.from<d.to&&!d.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(r.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(r.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let i=[],a=null;for(let s=this.toEditorPos(n.rangeStart),l=this.toEditorPos(n.rangeEnd);s<l;s++){let o=e.coordsForChar(s);a=o&&new DOMRect(o.left,o.top,o.right-o.left,o.bottom-o.top)||a||new DOMRect,i.push(a)}r.updateCharacterBounds(n.rangeStart,i)},this.handlers.textformatupdate=n=>{let i=[];for(let a of n.getTextFormats()){let s=a.underlineStyle,l=a.underlineThickness;if(!/none/i.test(s)&&!/none/i.test(l)){let o=this.toEditorPos(a.rangeStart),c=this.toEditorPos(a.rangeEnd);if(o<c){let h=`text-decoration: underline ${/^[a-z]/.test(s)?s+" ":s=="Dashed"?"dashed ":s=="Squiggle"?"wavy ":""}${/thin/i.test(l)?1:2}px`;i.push(ut.mark({attributes:{style:h}}).range(o,c))}}}e.dispatch({effects:n9.of(ut.set(i))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:n}=this.composing;this.composing=null,n&&this.reset(e.state)}};for(let n in this.handlers)r.addEventListener(n,this.handlers[n]);this.measureReq={read:n=>{this.editContext.updateControlBounds(n.contentDOM.getBoundingClientRect());let i=Kf(n.root);i&&i.rangeCount&&this.editContext.updateSelectionBounds(i.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let r=0,n=!1,i=this.pendingContextChange;return e.changes.iterChanges((a,s,l,o,c)=>{if(n)return;let h=c.length-(s-a);if(i&&s>=i.to)if(i.from==a&&i.to==s&&i.insert.eq(c)){i=this.pendingContextChange=null,r+=h,this.to+=h;return}else i=null,this.revertPending(e.state);if(a+=r,s+=r,s<=this.from)this.from+=h,this.to+=h;else if(a<this.to){if(a<this.from||s>this.to||this.to-this.from+c.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(a),this.toContextPos(s),c.toString()),this.to+=h}r+=h}),i&&!n&&this.revertPending(e.state),!n}update(e){let r=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(i=>!i.isUserEvent("input.type")&&i.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||r)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:r}=e.selection.main;this.from=Math.max(0,r-1e4),this.to=Math.min(e.doc.length,r+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let r=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(r.from),this.toContextPos(r.from+r.insert.length),e.doc.sliceString(r.from,r.to))}setSelection(e){let{main:r}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,r.anchor))),i=this.toContextPos(r.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=i)&&this.editContext.updateSelection(n,i)}rangeIsValid(e){let{head:r}=e.selection.main;return!(this.from>0&&r-this.from<500||this.to<e.doc.length&&this.to-r<500||this.to-this.from>1e4*3)}toEditorPos(e,r=this.to-this.from){e=Math.min(e,r);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let r=this.composing;return r&&r.drifted?r.contextBase+(e-r.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class Ue{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var r;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:n}=e;this.dispatchTransactions=e.dispatchTransactions||n&&(i=>i.forEach(a=>n(a,this)))||(i=>this.update(i)),this.dispatch=this.dispatch.bind(this),this._root=e.root||lie(e.parent)||document,this.viewState=new az(this,e.state||Dt.create(e)),e.scrollTo&&e.scrollTo.is(gp)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(mu).map(i=>new xC(i));for(let i of this.plugins)i.update(this);this.observer=new Rae(this),this.inputState=new Jie(this),this.inputState.ensureHandlers(this.plugins),this.docView=new G4(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((r=document.fonts)===null||r===void 0)&&r.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let r=e.length==1&&e[0]instanceof Sr?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(r,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let r=!1,n=!1,i,a=this.state;for(let g of e){if(g.startState!=a)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");a=g.state}if(this.destroyed){this.viewState.state=a;return}let s=this.hasFocus,l=0,o=null;e.some(g=>g.annotation(b9))?(this.inputState.notifiedFocused=s,l=1):s!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=s,o=x9(a,s),o||(l=1));let c=this.observer.delayedAndroidKey,h=null;if(c?(this.observer.clearDelayedAndroidKey(),h=this.observer.readChange(),(h&&!this.state.doc.eq(a.doc)||!this.state.selection.eq(a.selection))&&(h=null)):this.observer.clear(),a.facet(Dt.phrases)!=this.state.facet(Dt.phrases))return this.setState(a);i=Dg.create(this,a,e),i.flags|=l;let d=this.viewState.scrollTarget;try{this.updateState=2;for(let g of e){if(d&&(d=d.map(g.changes)),g.scrollIntoView){let{main:m}=g.state.selection;d=new Mu(m.empty?m:Ae.cursor(m.head,m.head>m.anchor?-1:1))}for(let m of g.effects)m.is(gp)&&(d=m.value.clip(this.state))}this.viewState.update(i,d),this.bidiCache=Pg.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),r=this.docView.update(i),this.state.facet(mf)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(r,e.some(g=>g.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(wp)!=i.state.facet(wp)&&(this.viewState.mustMeasureContent=!0),(r||n||d||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),r&&this.docViewUpdate(),!i.empty)for(let g of this.state.facet(Xk))try{g(i)}catch(m){Xn(this.state,m,"update listener")}(o||h)&&Promise.resolve().then(()=>{o&&this.state==o.startState&&this.dispatch(o),h&&!h9(this,h)&&c.force&&Ou(this.contentDOM,c.key,c.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let r=this.hasFocus;try{for(let n of this.plugins)n.destroy(this);this.viewState=new az(this,e),this.plugins=e.facet(mu).map(n=>new xC(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView.destroy(),this.docView=new G4(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}r&&this.focus(),this.requestMeasure()}updatePlugins(e){let r=e.startState.facet(mu),n=e.state.facet(mu);if(r!=n){let i=[];for(let a of n){let s=r.indexOf(a);if(s<0)i.push(new xC(a));else{let l=this.plugins[s];l.mustUpdate=e,i.push(l)}}for(let a of this.plugins)a.mustUpdate!=e&&a.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let i of this.plugins)i.mustUpdate=e;for(let i=0;i<this.plugins.length;i++)this.plugins[i].update(this);r!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let r=e.value;if(r&&r.docViewUpdate)try{r.docViewUpdate(this)}catch(n){Xn(this.state,n,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let r=null,n=this.viewState.scrollParent,i=this.viewState.getScrollOffset(),{scrollAnchorPos:a,scrollAnchorHeight:s}=this.viewState;Math.abs(i-this.viewState.scrollOffset)>1&&(s=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(s<0)if(j6(n||this.win))a=-1,s=this.viewState.heightMap.height;else{let m=this.viewState.scrollAnchorAt(i);a=m.from,s=m.top}this.updateState=1;let o=this.viewState.measure();if(!o&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let c=[];o&4||([this.measureRequests,c]=[c,this.measureRequests]);let h=c.map(m=>{try{return m.read(this)}catch(y){return Xn(this.state,y),cz}}),d=Dg.create(this,this.state,[]),g=!1;d.flags|=o,r?r.flags|=o:r=d,this.updateState=2,d.empty||(this.updatePlugins(d),this.inputState.update(d),this.updateAttrs(),g=this.docView.update(d),g&&this.docViewUpdate());for(let m=0;m<c.length;m++)if(h[m]!=cz)try{let y=c[m];y.write&&y.write(h[m],this)}catch(y){Xn(this.state,y)}if(g&&this.docView.updateSelection(!0),!d.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,s=-1;continue}else{let y=((a<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(a).top)-s)/this.scaleY;if((y>1||y<-1)&&(n==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){i=i+y,n?n.scrollTop+=y:this.win.scrollBy(0,y),s=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(r&&!r.empty)for(let l of this.state.facet(Xk))l(r)}get themeClasses(){return eT+" "+(this.state.facet(Jk)?k9:C9)+" "+this.state.facet(wp)}updateAttrs(){let e=fz(this,i9,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),r={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Va)?"true":"false",class:"cm-content",style:`${Xe.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(r["aria-readonly"]="true"),fz(this,BE,r);let n=this.observer.ignore(()=>{let i=j4(this.contentDOM,this.contentAttrs,r),a=j4(this.dom,this.editorAttrs,e);return i||a});return this.editorAttrs=e,this.contentAttrs=r,n}showAnnouncements(e){let r=!0;for(let n of e)for(let i of n.effects)if(i.is(Ue.announce)){r&&(this.announceDOM.textContent=""),r=!1;let a=this.announceDOM.appendChild(document.createElement("div"));a.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(mf);let e=this.state.facet(Ue.cspNonce);el.mount(this.root,this.styleModules.concat(Oae).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let r=0;r<this.measureRequests.length;r++)if(this.measureRequests[r].key===e.key){this.measureRequests[r]=e;return}}this.measureRequests.push(e)}}plugin(e){let r=this.pluginMap.get(e);return(r===void 0||r&&r.plugin!=e)&&this.pluginMap.set(e,r=this.plugins.find(n=>n.plugin==e)||null),r&&r.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,r,n){return kC(this,e,Y4(this,e,r,n))}moveByGroup(e,r){return kC(this,e,Y4(this,e,r,n=>Vie(this,e.head,n)))}visualLineSide(e,r){let n=this.bidiSpans(e),i=this.textDirectionAt(e.from),a=n[r?n.length-1:0];return Ae.cursor(a.side(r,i)+e.from,a.forward(!r,i)?1:-1)}moveToLineBoundary(e,r,n=!0){return Hie(this,e,r,n)}moveVertically(e,r,n){return kC(this,e,Uie(this,e,r,n))}domAtPos(e,r=1){return this.docView.domAtPos(e,r)}posAtDOM(e,r=0){return this.docView.posFromDOM(e,r)}posAtCoords(e,r=!0){this.readMeasured();let n=Kk(this,e,r);return n&&n.pos}posAndSideAtCoords(e,r=!0){return this.readMeasured(),Kk(this,e,r)}coordsAtPos(e,r=1){this.readMeasured();let n=this.docView.coordsAt(e,r);if(!n||n.left==n.right)return n;let i=this.state.doc.lineAt(e),a=this.bidiSpans(i),s=a[oa.find(a,e-i.from,-1,r)];return Zf(n,s.dir==Jt.LTR==r>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(e9)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Nae)return G6(e.length);let r=this.textDirectionAt(e.from),n;for(let a of this.bidiCache)if(a.from==e.from&&a.dir==r&&(a.fresh||$6(a.isolates,n=V4(this,e))))return a.order;n||(n=V4(this,e));let i=gie(e.text,r,n);return this.bidiCache.push(new Pg(e.from,e.to,r,n,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Xe.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{q6(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,r={}){return gp.of(new Mu(typeof e=="number"?Ae.cursor(e):e,r.y,r.x,r.yMargin,r.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:r}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return gp.of(new Mu(Ae.cursor(n.from),"start","start",n.top-e,r,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return mr.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return mr.define(()=>({}),{eventObservers:e})}static theme(e,r){let n=el.newName(),i=[wp.of(n),mf.of(tT(`.${n}`,e))];return r&&r.dark&&i.push(Jk.of(!0)),i}static baseTheme(e){return po.lowest(mf.of(tT("."+eT,e,T9)))}static findFromDOM(e){var r;let n=e.querySelector(".cm-content"),i=n&&vr.get(n)||vr.get(e);return((r=i?.root)===null||r===void 0?void 0:r.view)||null}}Ue.styleModule=mf;Ue.inputHandler=Z6;Ue.clipboardInputFilter=_E;Ue.clipboardOutputFilter=NE;Ue.scrollHandler=r9;Ue.focusChangeEffect=J6;Ue.perLineTextDirection=e9;Ue.exceptionSink=K6;Ue.updateListener=Xk;Ue.editable=Va;Ue.mouseSelectionStyle=Q6;Ue.dragMovesSelection=W6;Ue.clickAddsSelectionRange=X6;Ue.decorations=Fv;Ue.blockWrappers=a9;Ue.outerDecorations=LE;Ue.atomicRanges=Dh;Ue.bidiIsolatedRanges=s9;Ue.scrollMargins=l9;Ue.darkTheme=Jk;Ue.cspNonce=We.define({combine:t=>t.length?t[0]:""});Ue.contentAttributes=BE;Ue.editorAttributes=i9;Ue.lineWrapping=Ue.contentAttributes.of({class:"cm-lineWrapping"});Ue.announce=yt.define();const Nae=4096,cz={};class Pg{constructor(e,r,n,i,a,s){this.from=e,this.to=r,this.dir=n,this.isolates=i,this.fresh=a,this.order=s}static update(e,r){if(r.empty&&!e.some(a=>a.fresh))return e;let n=[],i=e.length?e[e.length-1].dir:Jt.LTR;for(let a=Math.max(0,e.length-10);a<e.length;a++){let s=e[a];s.dir==i&&!r.touchesRange(s.from,s.to)&&n.push(new Pg(r.mapPos(s.from,1),r.mapPos(s.to,-1),s.dir,s.isolates,!1,s.order))}return n}}function fz(t,e,r){for(let n=t.state.facet(e),i=n.length-1;i>=0;i--){let a=n[i],s=typeof a=="function"?a(t):a;s&&ME(s,r)}return r}const Bae=Xe.mac?"mac":Xe.windows?"win":Xe.linux?"linux":"key";function Lae(t,e){const r=t.split(/-(?!$)/);let n=r[r.length-1];n=="Space"&&(n=" ");let i,a,s,l;for(let o=0;o<r.length-1;++o){const c=r[o];if(/^(cmd|meta|m)$/i.test(c))l=!0;else if(/^a(lt)?$/i.test(c))i=!0;else if(/^(c|ctrl|control)$/i.test(c))a=!0;else if(/^s(hift)?$/i.test(c))s=!0;else if(/^mod$/i.test(c))e=="mac"?l=!0:a=!0;else throw new Error("Unrecognized modifier name: "+c)}return i&&(n="Alt-"+n),a&&(n="Ctrl-"+n),l&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function Sp(t,e,r){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),r!==!1&&e.shiftKey&&(t="Shift-"+t),t}const Pae=po.default(Ue.domEventHandlers({keydown(t,e){return A9(E9(e.state),t,e,"editor")}})),$v=We.define({enables:Pae}),hz=new WeakMap;function E9(t){let e=t.facet($v),r=hz.get(e);return r||hz.set(e,r=qae(e.reduce((n,i)=>n.concat(i),[]))),r}function zae(t,e,r){return A9(E9(t.state),e,t,r)}let Ps=null;const Iae=4e3;function qae(t,e=Bae){let r=Object.create(null),n=Object.create(null),i=(s,l)=>{let o=n[s];if(o==null)n[s]=l;else if(o!=l)throw new Error("Key binding "+s+" is used both as a regular binding and as a multi-stroke prefix")},a=(s,l,o,c,h)=>{var d,g;let m=r[s]||(r[s]=Object.create(null)),y=l.split(/ (?!$)/).map(w=>Lae(w,e));for(let w=1;w<y.length;w++){let S=y.slice(0,w).join(" ");i(S,!0),m[S]||(m[S]={preventDefault:!0,stopPropagation:!1,run:[k=>{let E=Ps={view:k,prefix:S,scope:s};return setTimeout(()=>{Ps==E&&(Ps=null)},Iae),!0}]})}let b=y.join(" ");i(b,!1);let x=m[b]||(m[b]={preventDefault:!1,stopPropagation:!1,run:((g=(d=m._any)===null||d===void 0?void 0:d.run)===null||g===void 0?void 0:g.slice())||[]});o&&x.run.push(o),c&&(x.preventDefault=!0),h&&(x.stopPropagation=!0)};for(let s of t){let l=s.scope?s.scope.split(" "):["editor"];if(s.any)for(let c of l){let h=r[c]||(r[c]=Object.create(null));h._any||(h._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:d}=s;for(let g in h)h[g].run.push(m=>d(m,rT))}let o=s[e]||s.key;if(o)for(let c of l)a(c,o,s.run,s.preventDefault,s.stopPropagation),s.shift&&a(c,"Shift-"+o,s.shift,s.preventDefault,s.stopPropagation)}return r}let rT=null;function A9(t,e,r,n){rT=e;let i=Jne(e),a=Vn(i,0),s=aa(a)==i.length&&i!=" ",l="",o=!1,c=!1,h=!1;Ps&&Ps.view==r&&Ps.scope==n&&(l=Ps.prefix+" ",g9.indexOf(e.keyCode)<0&&(c=!0,Ps=null));let d=new Set,g=x=>{if(x){for(let w of x.run)if(!d.has(w)&&(d.add(w),w(r)))return x.stopPropagation&&(h=!0),!0;x.preventDefault&&(x.stopPropagation&&(h=!0),c=!0)}return!1},m=t[n],y,b;return m&&(g(m[l+Sp(i,e,!s)])?o=!0:s&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Xe.windows&&e.ctrlKey&&e.altKey)&&!(Xe.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(y=tl[e.keyCode])&&y!=i?(g(m[l+Sp(y,e,!0)])||e.shiftKey&&(b=Wf[e.keyCode])!=i&&b!=y&&g(m[l+Sp(b,e,!1)]))&&(o=!0):s&&e.shiftKey&&g(m[l+Sp(i,e,!0)])&&(o=!0),!o&&g(m._any)&&(o=!0)),c&&(o=!0),o&&h&&e.stopPropagation(),rT=null,o}class _h{constructor(e,r,n,i,a){this.className=e,this.left=r,this.top=n,this.width=i,this.height=a}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,r){return r.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,r,n){if(n.empty){let i=e.coordsAtPos(n.head,n.assoc||1);if(!i)return[];let a=O9(e);return[new _h(r,i.left-a.left,i.top-a.top,null,i.bottom-i.top)]}else return jae(e,r,n)}}function O9(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Jt.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function dz(t,e,r,n){let i=t.coordsAtPos(e,r*2);if(!i)return n;let a=t.dom.getBoundingClientRect(),s=(i.top+i.bottom)/2,l=t.posAtCoords({x:a.left+1,y:s}),o=t.posAtCoords({x:a.right-1,y:s});return l==null||o==null?n:{from:Math.max(n.from,Math.min(l,o)),to:Math.min(n.to,Math.max(l,o))}}function jae(t,e,r){if(r.to<=t.viewport.from||r.from>=t.viewport.to)return[];let n=Math.max(r.from,t.viewport.from),i=Math.min(r.to,t.viewport.to),a=t.textDirection==Jt.LTR,s=t.contentDOM,l=s.getBoundingClientRect(),o=O9(t),c=s.querySelector(".cm-line"),h=c&&window.getComputedStyle(c),d=l.left+(h?parseInt(h.paddingLeft)+Math.min(0,parseInt(h.textIndent)):0),g=l.right-(h?parseInt(h.paddingRight):0),m=Qk(t,n,1),y=Qk(t,i,-1),b=m.type==un.Text?m:null,x=y.type==un.Text?y:null;if(b&&(t.lineWrapping||m.widgetLineBreaks)&&(b=dz(t,n,1,b)),x&&(t.lineWrapping||y.widgetLineBreaks)&&(x=dz(t,i,-1,x)),b&&x&&b.from==x.from&&b.to==x.to)return S(k(r.from,r.to,b));{let M=b?k(r.from,null,b):E(m,!1),R=x?k(null,r.to,x):E(y,!0),O=[];return(b||m).to<(x||y).from-(b&&x?1:0)||m.widgetLineBreaks>1&&M.bottom+t.defaultLineHeight/2<R.top?O.push(w(d,M.bottom,g,R.top)):M.bottom<R.top&&t.elementAtHeight((M.bottom+R.top)/2).type==un.Text&&(M.bottom=R.top=(M.bottom+R.top)/2),S(M).concat(O).concat(S(R))}function w(M,R,O,N){return new _h(e,M-o.left,R-o.top,Math.max(0,O-M),N-R)}function S({top:M,bottom:R,horizontal:O}){let N=[];for(let B=0;B<O.length;B+=2)N.push(w(O[B],M,O[B+1],R));return N}function k(M,R,O){let N=1e9,B=-1e9,D=[];function _(H,$,q,V,X){let ee=t.coordsAtPos(H,H==O.to?-2:2),te=t.coordsAtPos(q,q==O.from?2:-2);!ee||!te||(N=Math.min(ee.top,te.top,N),B=Math.max(ee.bottom,te.bottom,B),X==Jt.LTR?D.push(a&&$?d:ee.left,a&&V?g:te.right):D.push(!a&&V?d:te.left,!a&&$?g:ee.right))}let P=M??O.from,z=R??O.to;for(let H of t.visibleRanges)if(H.to>P&&H.from<z)for(let $=Math.max(H.from,P),q=Math.min(H.to,z);;){let V=t.state.doc.lineAt($);for(let X of t.bidiSpans(V)){let ee=X.from+V.from,te=X.to+V.from;if(ee>=q)break;te>$&&_(Math.max(ee,$),M==null&&ee<=P,Math.min(te,q),R==null&&te>=z,X.dir)}if($=V.to+1,$>=q)break}return D.length==0&&_(P,M==null,z,R==null,t.textDirection),{top:N,bottom:B,horizontal:D}}function E(M,R){let O=l.top+(R?M.top:M.bottom);return{top:O,bottom:O,horizontal:[]}}}function Fae(t,e){return t.constructor==e.constructor&&t.eq(e)}class Hae{constructor(e,r){this.view=e,this.layer=r,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),r.above&&this.dom.classList.add("cm-layer-above"),r.class&&this.dom.classList.add(r.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),r.mount&&r.mount(this.dom,e)}update(e){e.startState.facet(eg)!=e.state.facet(eg)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let r=0,n=e.facet(eg);for(;r<n.length&&n[r]!=this.layer;)r++;this.dom.style.zIndex=String((this.layer.above?150:-1)-r)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:r}=this.view;(e!=this.scaleX||r!=this.scaleY)&&(this.scaleX=e,this.scaleY=r,this.dom.style.transform=`scale(${1/e}, ${1/r})`)}draw(e){if(e.length!=this.drawn.length||e.some((r,n)=>!Fae(r,this.drawn[n]))){let r=this.dom.firstChild,n=0;for(let i of e)i.update&&r&&i.constructor&&this.drawn[n].constructor&&i.update(r,this.drawn[n])?(r=r.nextSibling,n++):this.dom.insertBefore(i.draw(),r);for(;r;){let i=r.nextSibling;r.remove(),r=i}this.drawn=e,Xe.safari&&Xe.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const eg=We.define();function M9(t){return[mr.define(e=>new Hae(e,t)),eg.of(t)]}const eh=We.define({combine(t){return ya(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,r)=>Math.min(e,r),drawRangeCursor:(e,r)=>e||r})}});function Vae(t={}){return[eh.of(t),Uae,$ae,Gae,t9.of(!0)]}function R9(t){return t.startState.facet(eh)!=t.state.facet(eh)}const Uae=M9({above:!0,markers(t){let{state:e}=t,r=e.facet(eh),n=[];for(let i of e.selection.ranges){let a=i==e.selection.main;if(i.empty||r.drawRangeCursor){let s=a?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=i.empty?i:Ae.cursor(i.head,i.head>i.anchor?-1:1);for(let o of _h.forRange(t,s,l))n.push(o)}}return n},update(t,e){t.transactions.some(n=>n.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let r=R9(t);return r&&pz(t.state,e),t.docChanged||t.selectionSet||r},mount(t,e){pz(e.state,t)},class:"cm-cursorLayer"});function pz(t,e){e.style.animationDuration=t.facet(eh).cursorBlinkRate+"ms"}const $ae=M9({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:_h.forRange(t,"cm-selectionBackground",e)).reduce((e,r)=>e.concat(r))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||R9(t)},class:"cm-selectionLayer"}),Gae=po.highest(Ue.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),D9=yt.define({map(t,e){return t==null?null:e.mapPos(t)}}),bf=Sn.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((r,n)=>n.is(D9)?n.value:r,t)}}),Yae=mr.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let r=t.state.field(bf);r==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(bf)!=r||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(bf),r=e!=null&&t.coordsAtPos(e);if(!r)return null;let n=t.scrollDOM.getBoundingClientRect();return{left:r.left-n.left+t.scrollDOM.scrollLeft*t.scaleX,top:r.top-n.top+t.scrollDOM.scrollTop*t.scaleY,height:r.bottom-r.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:r}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/r+"px",this.cursor.style.height=t.height/r+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(bf)!=t&&this.view.dispatch({effects:D9.of(t)})}},{eventObservers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){(t.target==this.view.contentDOM||!this.view.contentDOM.contains(t.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function Xae(){return[bf,Yae]}function gz(t,e,r,n,i){e.lastIndex=0;for(let a=t.iterRange(r,n),s=r,l;!a.next().done;s+=a.value.length)if(!a.lineBreak)for(;l=e.exec(a.value);)i(s+l.index,l)}function Wae(t,e){let r=t.visibleRanges;if(r.length==1&&r[0].from==t.viewport.from&&r[0].to==t.viewport.to)return r;let n=[];for(let{from:i,to:a}of r)i=Math.max(t.state.doc.lineAt(i).from,i-e),a=Math.min(t.state.doc.lineAt(a).to,a+e),n.length&&n[n.length-1].to>=i?n[n.length-1].to=a:n.push({from:i,to:a});return n}class Qae{constructor(e){const{regexp:r,decoration:n,decorate:i,boundary:a,maxLength:s=1e3}=e;if(!r.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=r,i)this.addMatch=(l,o,c,h)=>i(h,c,c+l[0].length,l,o);else if(typeof n=="function")this.addMatch=(l,o,c,h)=>{let d=n(l,o,c);d&&h(c,c+l[0].length,d)};else if(n)this.addMatch=(l,o,c,h)=>h(c,c+l[0].length,n);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=a,this.maxLength=s}createDeco(e){let r=new Wa,n=r.add.bind(r);for(let{from:i,to:a}of Wae(e,this.maxLength))gz(e.state.doc,this.regexp,i,a,(s,l)=>this.addMatch(l,e,s,n));return r.finish()}updateDeco(e,r){let n=1e9,i=-1;return e.docChanged&&e.changes.iterChanges((a,s,l,o)=>{o>=e.view.viewport.from&&l<=e.view.viewport.to&&(n=Math.min(l,n),i=Math.max(o,i))}),e.viewportMoved||i-n>1e3?this.createDeco(e.view):i>-1?this.updateRange(e.view,r.map(e.changes),n,i):r}updateRange(e,r,n,i){for(let a of e.visibleRanges){let s=Math.max(a.from,n),l=Math.min(a.to,i);if(l>=s){let o=e.state.doc.lineAt(s),c=o.to<l?e.state.doc.lineAt(l):o,h=Math.max(a.from,o.from),d=Math.min(a.to,c.to);if(this.boundary){for(;s>o.from;s--)if(this.boundary.test(o.text[s-1-o.from])){h=s;break}for(;l<c.to;l++)if(this.boundary.test(c.text[l-c.from])){d=l;break}}let g=[],m,y=(b,x,w)=>g.push(w.range(b,x));if(o==c)for(this.regexp.lastIndex=h-o.from;(m=this.regexp.exec(o.text))&&m.index<d-o.from;)this.addMatch(m,e,m.index+o.from,y);else gz(e.state.doc,this.regexp,h,d,(b,x)=>this.addMatch(x,e,b,y));r=r.update({filterFrom:h,filterTo:d,filter:(b,x)=>b<h||x>d,add:g})}}return r}}const nT=/x/.unicode!=null?"gu":"g",Kae=new RegExp(`[\0-\b
425
+ --Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,nT),Zae={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let AC=null;function Jae(){var t;if(AC==null&&typeof document<"u"&&document.body){let e=document.body.style;AC=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return AC||!1}const tg=We.define({combine(t){let e=ya(t,{render:null,specialChars:Kae,addSpecialChars:null});return(e.replaceTabs=!Jae())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,nT)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,nT)),e}});function ese(t={}){return[tg.of(t),tse()]}let vz=null;function tse(){return vz||(vz=mr.fromClass(class{constructor(t){this.view=t,this.decorations=ut.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(tg)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new Qae({regexp:t.specialChars,decoration:(e,r,n)=>{let{doc:i}=r.state,a=Vn(e[0],0);if(a==9){let s=i.lineAt(n),l=r.state.tabSize,o=rc(s.text,l,n-s.from);return ut.replace({widget:new ase((l-o%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[a]||(this.decorationCache[a]=ut.replace({widget:new ise(t,a)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(tg);t.startState.facet(tg)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}const rse="•";function nse(t){return t>=32?rse:t==10?"␤":String.fromCharCode(9216+t)}class ise extends ba{constructor(e,r){super(),this.options=e,this.code=r}eq(e){return e.code==this.code}toDOM(e){let r=nse(this.code),n=e.state.phrase("Control character")+" "+(Zae[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,n,r);if(i)return i;let a=document.createElement("span");return a.textContent=r,a.title=n,a.setAttribute("aria-label",n),a.className="cm-specialChar",a}ignoreEvent(){return!1}}class ase extends ba{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function sse(){return ose}const lse=ut.line({class:"cm-activeLine"}),ose=mr.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,r=[];for(let n of t.state.selection.ranges){let i=t.lineBlockAt(n.head);i.from>e&&(r.push(lse.range(i.from)),e=i.from)}return ut.set(r)}},{decorations:t=>t.decorations});class use extends ba{constructor(e){super(),this.content=e}toDOM(e){let r=document.createElement("span");return r.className="cm-placeholder",r.style.pointerEvents="none",r.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),r.setAttribute("aria-hidden","true"),r}coordsAt(e){let r=e.firstChild?Ef(e.firstChild):[];if(!r.length)return null;let n=window.getComputedStyle(e.parentNode),i=Zf(r[0],n.direction!="rtl"),a=parseInt(n.lineHeight);return i.bottom-i.top>a*1.5?{left:i.left,right:i.right,top:i.top,bottom:i.top+a}:i}ignoreEvent(){return!1}}function cse(t){let e=mr.fromClass(class{constructor(r){this.view=r,this.placeholder=t?ut.set([ut.widget({widget:new use(t),side:1}).range(0)]):ut.none}get decorations(){return this.view.state.doc.length?ut.none:this.placeholder}},{decorations:r=>r.decorations});return typeof t=="string"?[e,Ue.contentAttributes.of({"aria-placeholder":t})]:e}const iT=2e3;function fse(t,e,r){let n=Math.min(e.line,r.line),i=Math.max(e.line,r.line),a=[];if(e.off>iT||r.off>iT||e.col<0||r.col<0){let s=Math.min(e.off,r.off),l=Math.max(e.off,r.off);for(let o=n;o<=i;o++){let c=t.doc.line(o);c.length<=l&&a.push(Ae.range(c.from+s,c.to+l))}}else{let s=Math.min(e.col,r.col),l=Math.max(e.col,r.col);for(let o=n;o<=i;o++){let c=t.doc.line(o),h=zk(c.text,s,t.tabSize,!0);if(h<0)a.push(Ae.cursor(c.to));else{let d=zk(c.text,l,t.tabSize);a.push(Ae.range(c.from+h,c.from+d))}}}return a}function hse(t,e){let r=t.coordsAtPos(t.viewport.from);return r?Math.round(Math.abs((r.left-e)/t.defaultCharacterWidth)):-1}function mz(t,e){let r=t.posAtCoords({x:e.clientX,y:e.clientY},!1),n=t.state.doc.lineAt(r),i=r-n.from,a=i>iT?-1:i==n.length?hse(t,e.clientX):rc(n.text,t.state.tabSize,r-n.from);return{line:n.number,col:a,off:i}}function dse(t,e){let r=mz(t,e),n=t.state.selection;return r?{update(i){if(i.docChanged){let a=i.changes.mapPos(i.startState.doc.line(r.line).from),s=i.state.doc.lineAt(a);r={line:s.number,col:r.col,off:Math.min(r.off,s.length)},n=n.map(i.changes)}},get(i,a,s){let l=mz(t,i);if(!l)return n;let o=fse(t.state,r,l);return o.length?s?Ae.create(o.concat(n.ranges)):Ae.create(o):n}}:null}function pse(t){let e=(r=>r.altKey&&r.button==0);return Ue.mouseSelectionStyle.of((r,n)=>e(n)?dse(r,n):null)}const gse={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},vse={style:"cursor: crosshair"};function mse(t={}){let[e,r]=gse[t.key||"Alt"],n=mr.fromClass(class{constructor(i){this.view=i,this.isDown=!1}set(i){this.isDown!=i&&(this.isDown=i,this.view.update([]))}},{eventObservers:{keydown(i){this.set(i.keyCode==e||r(i))},keyup(i){(i.keyCode==e||!r(i))&&this.set(!1)},mousemove(i){this.set(r(i))}}});return[n,Ue.contentAttributes.of(i=>{var a;return!((a=i.plugin(n))===null||a===void 0)&&a.isDown?vse:null})]}const Cp="-10000px";class _9{constructor(e,r,n,i){this.facet=r,this.createTooltipView=n,this.removeTooltipView=i,this.input=e.state.facet(r),this.tooltips=this.input.filter(s=>s);let a=null;this.tooltipViews=this.tooltips.map(s=>a=n(s,a))}update(e,r){var n;let i=e.state.facet(this.facet),a=i.filter(o=>o);if(i===this.input){for(let o of this.tooltipViews)o.update&&o.update(e);return!1}let s=[],l=r?[]:null;for(let o=0;o<a.length;o++){let c=a[o],h=-1;if(c){for(let d=0;d<this.tooltips.length;d++){let g=this.tooltips[d];g&&g.create==c.create&&(h=d)}if(h<0)s[o]=this.createTooltipView(c,o?s[o-1]:null),l&&(l[o]=!!c.above);else{let d=s[o]=this.tooltipViews[h];l&&(l[o]=r[h]),d.update&&d.update(e)}}}for(let o of this.tooltipViews)s.indexOf(o)<0&&(this.removeTooltipView(o),(n=o.destroy)===null||n===void 0||n.call(o));return r&&(l.forEach((o,c)=>r[c]=o),r.length=l.length),this.input=i,this.tooltips=a,this.tooltipViews=s,!0}}function yse(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const OC=We.define({combine:t=>{var e,r,n;return{position:Xe.ios?"absolute":((e=t.find(i=>i.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((r=t.find(i=>i.parent))===null||r===void 0?void 0:r.parent)||null,tooltipSpace:((n=t.find(i=>i.tooltipSpace))===null||n===void 0?void 0:n.tooltipSpace)||yse}}}),yz=new WeakMap,jE=mr.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(OC);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new _9(t,FE,(r,n)=>this.createTooltip(r,n),r=>{this.resizeObserver&&this.resizeObserver.unobserve(r.dom),r.dom.remove()}),this.above=this.manager.tooltips.map(r=>!!r.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(r=>{Date.now()>this.lastTransaction-50&&r.length>0&&r[r.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let r=e||t.geometryChanged,n=t.state.facet(OC);if(n.position!=this.position&&!this.madeAbsolute){this.position=n.position;for(let i of this.manager.tooltipViews)i.dom.style.position=this.position;r=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let i of this.manager.tooltipViews)this.container.appendChild(i.dom);r=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);r&&this.maybeMeasure()}createTooltip(t,e){let r=t.create(this.view),n=e?e.dom:null;if(r.dom.classList.add("cm-tooltip"),t.arrow&&!r.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let i=document.createElement("div");i.className="cm-tooltip-arrow",r.dom.appendChild(i)}return r.dom.style.position=this.position,r.dom.style.top=Cp,r.dom.style.left="0px",this.container.insertBefore(r.dom,n),r.mount&&r.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(r.dom),r}destroy(){var t,e,r;this.view.win.removeEventListener("resize",this.measureSoon);for(let n of this.manager.tooltipViews)n.dom.remove(),(t=n.destroy)===null||t===void 0||t.call(n);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(r=this.intersectionObserver)===null||r===void 0||r.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,r=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:a}=this.manager.tooltipViews[0];if(Xe.safari){let s=a.getBoundingClientRect();r=Math.abs(s.top+1e4)>1||Math.abs(s.left)>1}else r=!!a.offsetParent&&a.offsetParent!=this.container.ownerDocument.body}if(r||this.position=="absolute")if(this.parent){let a=this.parent.getBoundingClientRect();a.width&&a.height&&(t=a.width/this.parent.offsetWidth,e=a.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let n=this.view.scrollDOM.getBoundingClientRect(),i=PE(this.view);return{visible:{left:n.left+i.left,top:n.top+i.top,right:n.right-i.right,bottom:n.bottom-i.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((a,s)=>{let l=this.manager.tooltipViews[s];return l.getCoords?l.getCoords(a.pos):this.view.coordsAtPos(a.pos)}),size:this.manager.tooltipViews.map(({dom:a})=>a.getBoundingClientRect()),space:this.view.state.facet(OC).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:r}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:r,space:n,scaleX:i,scaleY:a}=t,s=[];for(let l=0;l<this.manager.tooltips.length;l++){let o=this.manager.tooltips[l],c=this.manager.tooltipViews[l],{dom:h}=c,d=t.pos[l],g=t.size[l];if(!d||o.clip!==!1&&(d.bottom<=Math.max(r.top,n.top)||d.top>=Math.min(r.bottom,n.bottom)||d.right<Math.max(r.left,n.left)-.1||d.left>Math.min(r.right,n.right)+.1)){h.style.top=Cp;continue}let m=o.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,y=m?7:0,b=g.right-g.left,x=(e=yz.get(c))!==null&&e!==void 0?e:g.bottom-g.top,w=c.offset||xse,S=this.view.textDirection==Jt.LTR,k=g.width>n.right-n.left?S?n.left:n.right-g.width:S?Math.max(n.left,Math.min(d.left-(m?14:0)+w.x,n.right-b)):Math.min(Math.max(n.left,d.left-b+(m?14:0)-w.x),n.right-b),E=this.above[l];!o.strictSide&&(E?d.top-x-y-w.y<n.top:d.bottom+x+y+w.y>n.bottom)&&E==n.bottom-d.bottom>d.top-n.top&&(E=this.above[l]=!E);let M=(E?d.top-n.top:n.bottom-d.bottom)-y;if(M<x&&c.resize!==!1){if(M<this.view.defaultLineHeight){h.style.top=Cp;continue}yz.set(c,x),h.style.height=(x=M)/a+"px"}else h.style.height&&(h.style.height="");let R=E?d.top-x-y-w.y:d.bottom+y+w.y,O=k+b;if(c.overlap!==!0)for(let N of s)N.left<O&&N.right>k&&N.top<R+x&&N.bottom>R&&(R=E?N.top-x-2-y:N.bottom+y+2);if(this.position=="absolute"?(h.style.top=(R-t.parent.top)/a+"px",bz(h,(k-t.parent.left)/i)):(h.style.top=R/a+"px",bz(h,k/i)),m){let N=d.left+(S?w.x:-w.x)-(k+14-7);m.style.left=N/i+"px"}c.overlap!==!0&&s.push({left:k,top:R,right:O,bottom:R+x}),h.classList.toggle("cm-tooltip-above",E),h.classList.toggle("cm-tooltip-below",!E),c.positioned&&c.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=Cp}},{eventObservers:{scroll(){this.maybeMeasure()}}});function bz(t,e){let r=parseInt(t.style.left,10);(isNaN(r)||Math.abs(e-r)>1)&&(t.style.left=e+"px")}const bse=Ue.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),xse={x:0,y:0},FE=We.define({enables:[jE,bse]}),zg=We.define({combine:t=>t.reduce((e,r)=>e.concat(r),[])});class Gv{static create(e){return new Gv(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new _9(e,zg,(r,n)=>this.createHostedView(r,n),r=>r.dom.remove())}createHostedView(e,r){let n=e.create(this.view);return n.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(n.dom,r?r.dom.nextSibling:this.dom.firstChild),this.mounted&&n.mount&&n.mount(this.view),n}mount(e){for(let r of this.manager.tooltipViews)r.mount&&r.mount(e);this.mounted=!0}positioned(e){for(let r of this.manager.tooltipViews)r.positioned&&r.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let r of this.manager.tooltipViews)(e=r.destroy)===null||e===void 0||e.call(r)}passProp(e){let r;for(let n of this.manager.tooltipViews){let i=n[e];if(i!==void 0){if(r===void 0)r=i;else if(r!==i)return}}return r}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const wse=FE.compute([zg],t=>{let e=t.facet(zg);return e.length===0?null:{pos:Math.min(...e.map(r=>r.pos)),end:Math.max(...e.map(r=>{var n;return(n=r.end)!==null&&n!==void 0?n:r.pos})),create:Gv.create,above:e[0].above,arrow:e.some(r=>r.arrow)}});class Sse{constructor(e,r,n,i,a){this.view=e,this.source=r,this.field=n,this.setHover=i,this.hoverTime=a,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:r}=this,n=e.docView.tile.nearest(r.target);if(!n)return;let i,a=1;if(n.isWidget())i=n.posAtStart;else{if(i=e.posAtCoords(r),i==null)return;let l=e.coordsAtPos(i);if(!l||r.y<l.top||r.y>l.bottom||r.x<l.left-e.defaultCharacterWidth||r.x>l.right+e.defaultCharacterWidth)return;let o=e.bidiSpans(e.state.doc.lineAt(i)).find(h=>h.from<=i&&h.to>=i),c=o&&o.dir==Jt.RTL?-1:1;a=r.x<l.left?-c:c}let s=this.source(e,i,a);if(s?.then){let l=this.pending={pos:i};s.then(o=>{this.pending==l&&(this.pending=null,o&&!(Array.isArray(o)&&!o.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])}))},o=>Xn(e.state,o,"hover tooltip"))}else s&&!(Array.isArray(s)&&!s.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(s)?s:[s])})}get tooltip(){let e=this.view.plugin(jE),r=e?e.manager.tooltips.findIndex(n=>n.create==Gv.create):-1;return r>-1?e.manager.tooltipViews[r]:null}mousemove(e){var r,n;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:i,tooltip:a}=this;if(i.length&&a&&!Cse(a.dom,e)||this.pending){let{pos:s}=i[0]||this.pending,l=(n=(r=i[0])===null||r===void 0?void 0:r.end)!==null&&n!==void 0?n:s;(s==l?this.view.posAtCoords(this.lastMove)!=s:!kse(this.view,s,l,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:r}=this;if(r.length){let{tooltip:n}=this;n&&n.dom.contains(e.relatedTarget)?this.watchTooltipLeave(n.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let r=n=>{e.removeEventListener("mouseleave",r),this.active.length&&!this.view.dom.contains(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",r)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const kp=4;function Cse(t,e){let{left:r,right:n,top:i,bottom:a}=t.getBoundingClientRect(),s;if(s=t.querySelector(".cm-tooltip-arrow")){let l=s.getBoundingClientRect();i=Math.min(l.top,i),a=Math.max(l.bottom,a)}return e.clientX>=r-kp&&e.clientX<=n+kp&&e.clientY>=i-kp&&e.clientY<=a+kp}function kse(t,e,r,n,i,a){let s=t.scrollDOM.getBoundingClientRect(),l=t.documentTop+t.documentPadding.top+t.contentHeight;if(s.left>n||s.right<n||s.top>i||Math.min(s.bottom,l)<i)return!1;let o=t.posAtCoords({x:n,y:i},!1);return o>=e&&o<=r}function Tse(t,e={}){let r=yt.define(),n=Sn.define({create(){return[]},update(i,a){if(i.length&&(e.hideOnChange&&(a.docChanged||a.selection)?i=[]:e.hideOn&&(i=i.filter(s=>!e.hideOn(a,s))),a.docChanged)){let s=[];for(let l of i){let o=a.changes.mapPos(l.pos,-1,On.TrackDel);if(o!=null){let c=Object.assign(Object.create(null),l);c.pos=o,c.end!=null&&(c.end=a.changes.mapPos(c.end)),s.push(c)}}i=s}for(let s of a.effects)s.is(r)&&(i=s.value),s.is(Ese)&&(i=[]);return i},provide:i=>zg.from(i)});return{active:n,extension:[n,mr.define(i=>new Sse(i,t,n,r,e.hoverTime||300)),wse]}}function N9(t,e){let r=t.plugin(jE);if(!r)return null;let n=r.manager.tooltips.indexOf(e);return n<0?null:r.manager.tooltipViews[n]}const Ese=yt.define(),xz=We.define({combine(t){let e,r;for(let n of t)e=e||n.topContainer,r=r||n.bottomContainer;return{topContainer:e,bottomContainer:r}}});function HE(t,e){let r=t.plugin(B9),n=r?r.specs.indexOf(e):-1;return n>-1?r.panels[n]:null}const B9=mr.fromClass(class{constructor(t){this.input=t.state.facet(th),this.specs=this.input.filter(r=>r),this.panels=this.specs.map(r=>r(t));let e=t.state.facet(xz);this.top=new Tp(t,!0,e.topContainer),this.bottom=new Tp(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(r=>r.top)),this.bottom.sync(this.panels.filter(r=>!r.top));for(let r of this.panels)r.dom.classList.add("cm-panel"),r.mount&&r.mount()}update(t){let e=t.state.facet(xz);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Tp(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Tp(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let r=t.state.facet(th);if(r!=this.input){let n=r.filter(o=>o),i=[],a=[],s=[],l=[];for(let o of n){let c=this.specs.indexOf(o),h;c<0?(h=o(t.view),l.push(h)):(h=this.panels[c],h.update&&h.update(t)),i.push(h),(h.top?a:s).push(h)}this.specs=n,this.panels=i,this.top.sync(a),this.bottom.sync(s);for(let o of l)o.dom.classList.add("cm-panel"),o.mount&&o.mount()}else for(let n of this.panels)n.update&&n.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>Ue.scrollMargins.of(e=>{let r=e.plugin(t);return r&&{top:r.top.scrollMargin(),bottom:r.bottom.scrollMargin()}})});class Tp{constructor(e,r,n){this.view=e,this.top=r,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let r of this.panels)r.destroy&&e.indexOf(r)<0&&r.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let r=this.container||this.view.dom;r.insertBefore(this.dom,this.top?r.firstChild:null)}let e=this.dom.firstChild;for(let r of this.panels)if(r.dom.parentNode==this.dom){for(;e!=r.dom;)e=wz(e);e=e.nextSibling}else this.dom.insertBefore(r.dom,e);for(;e;)e=wz(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function wz(t){let e=t.nextSibling;return t.remove(),e}const th=We.define({enables:B9});function Ase(t,e){let r,n=new Promise(s=>r=s),i=s=>Ose(s,e,r);t.state.field(MC,!1)?t.dispatch({effects:L9.of(i)}):t.dispatch({effects:yt.appendConfig.of(MC.init(()=>[i]))});let a=P9.of(i);return{close:a,result:n.then(s=>((t.win.queueMicrotask||(o=>t.win.setTimeout(o,10)))(()=>{t.state.field(MC).indexOf(i)>-1&&t.dispatch({effects:a})}),s))}}const MC=Sn.define({create(){return[]},update(t,e){for(let r of e.effects)r.is(L9)?t=[r.value].concat(t):r.is(P9)&&(t=t.filter(n=>n!=r.value));return t},provide:t=>th.computeN([t],e=>e.field(t))}),L9=yt.define(),P9=yt.define();function Ose(t,e,r){let n=e.content?e.content(t,()=>s(null)):null;if(!n){if(n=Wt("form"),e.input){let l=Wt("input",e.input);/^(text|password|number|email|tel|url)$/.test(l.type)&&l.classList.add("cm-textfield"),l.name||(l.name="input"),n.appendChild(Wt("label",(e.label||"")+": ",l))}else n.appendChild(document.createTextNode(e.label||""));n.appendChild(document.createTextNode(" ")),n.appendChild(Wt("button",{class:"cm-button",type:"submit"},e.submitLabel||"OK"))}let i=n.nodeName=="FORM"?[n]:n.querySelectorAll("form");for(let l=0;l<i.length;l++){let o=i[l];o.addEventListener("keydown",c=>{c.keyCode==27?(c.preventDefault(),s(null)):c.keyCode==13&&(c.preventDefault(),s(o))}),o.addEventListener("submit",c=>{c.preventDefault(),s(o)})}let a=Wt("div",n,Wt("button",{onclick:()=>s(null),"aria-label":t.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));e.class&&(a.className=e.class),a.classList.add("cm-dialog");function s(l){a.contains(a.ownerDocument.activeElement)&&t.focus(),r(l)}return{dom:a,top:e.top,mount:()=>{if(e.focus){let l;typeof e.focus=="string"?l=n.querySelector(e.focus):l=n.querySelector("input")||n.querySelector("button"),l&&"select"in l?l.select():l&&"focus"in l&&l.focus()}}}}class Ka extends Js{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Ka.prototype.elementClass="";Ka.prototype.toDOM=void 0;Ka.prototype.mapMode=On.TrackBefore;Ka.prototype.startSide=Ka.prototype.endSide=-1;Ka.prototype.point=!0;const rg=We.define(),Mse=We.define(),Rse={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Et.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},Mf=We.define();function Dse(t){return[z9(),Mf.of({...Rse,...t})]}const Sz=We.define({combine:t=>t.some(e=>e)});function z9(t){return[_se]}const _se=mr.fromClass(class{constructor(t){this.view=t,this.domAfter=null,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(Mf).map(e=>new kz(t,e)),this.fixed=!t.state.facet(Sz);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(t){if(this.updateGutters(t)){let e=this.prevViewport,r=t.view.viewport,n=Math.min(e.to,r.to)-Math.max(e.from,r.from);this.syncGutters(n<(r.to-r.from)*.8)}if(t.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(Sz)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let r=Et.iter(this.view.state.facet(rg),this.view.viewport.from),n=[],i=this.gutters.map(a=>new Nse(a,this.view.viewport,-this.view.documentPadding.top));for(let a of this.view.viewportLineBlocks)if(n.length&&(n=[]),Array.isArray(a.type)){let s=!0;for(let l of a.type)if(l.type==un.Text&&s){aT(r,n,l.from);for(let o of i)o.line(this.view,l,n);s=!1}else if(l.widget)for(let o of i)o.widget(this.view,l)}else if(a.type==un.Text){aT(r,n,a.from);for(let s of i)s.line(this.view,a,n)}else if(a.widget)for(let s of i)s.widget(this.view,a);for(let a of i)a.finish();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(Mf),r=t.state.facet(Mf),n=t.docChanged||t.heightChanged||t.viewportChanged||!Et.eq(t.startState.facet(rg),t.state.facet(rg),t.view.viewport.from,t.view.viewport.to);if(e==r)for(let i of this.gutters)i.update(t)&&(n=!0);else{n=!0;let i=[];for(let a of r){let s=e.indexOf(a);s<0?i.push(new kz(this.view,a)):(this.gutters[s].update(t),i.push(this.gutters[s]))}for(let a of this.gutters)a.dom.remove(),i.indexOf(a)<0&&a.destroy();for(let a of i)a.config.side=="after"?this.getDOMAfter().appendChild(a.dom):this.dom.appendChild(a.dom);this.gutters=i}return n}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:t=>Ue.scrollMargins.of(e=>{let r=e.plugin(t);if(!r||r.gutters.length==0||!r.fixed)return null;let n=r.dom.offsetWidth*e.scaleX,i=r.domAfter?r.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Jt.LTR?{left:n,right:i}:{right:n,left:i}})});function Cz(t){return Array.isArray(t)?t:[t]}function aT(t,e,r){for(;t.value&&t.from<=r;)t.from==r&&e.push(t.value),t.next()}class Nse{constructor(e,r,n){this.gutter=e,this.height=n,this.i=0,this.cursor=Et.iter(e.markers,r.from)}addElement(e,r,n){let{gutter:i}=this,a=(r.top-this.height)/e.scaleY,s=r.height/e.scaleY;if(this.i==i.elements.length){let l=new I9(e,s,a,n);i.elements.push(l),i.dom.appendChild(l.dom)}else i.elements[this.i].update(e,s,a,n);this.height=r.bottom,this.i++}line(e,r,n){let i=[];aT(this.cursor,i,r.from),n.length&&(i=i.concat(n));let a=this.gutter.config.lineMarker(e,r,i);a&&i.unshift(a);let s=this.gutter;i.length==0&&!s.config.renderEmptyElements||this.addElement(e,r,i)}widget(e,r){let n=this.gutter.config.widgetMarker(e,r.widget,r),i=n?[n]:null;for(let a of e.state.facet(Mse)){let s=a(e,r.widget,r);s&&(i||(i=[])).push(s)}i&&this.addElement(e,r,i)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let r=e.elements.pop();e.dom.removeChild(r.dom),r.destroy()}}}class kz{constructor(e,r){this.view=e,this.config=r,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in r.domEventHandlers)this.dom.addEventListener(n,i=>{let a=i.target,s;if(a!=this.dom&&this.dom.contains(a)){for(;a.parentNode!=this.dom;)a=a.parentNode;let o=a.getBoundingClientRect();s=(o.top+o.bottom)/2}else s=i.clientY;let l=e.lineBlockAtHeight(s-e.documentTop);r.domEventHandlers[n](e,l,i)&&i.preventDefault()});this.markers=Cz(r.markers(e)),r.initialSpacer&&(this.spacer=new I9(e,0,0,[r.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let r=this.markers;if(this.markers=Cz(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let i=this.config.updateSpacer(this.spacer.markers[0],e);i!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[i])}let n=e.view.viewport;return!Et.eq(this.markers,r,n.from,n.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class I9{constructor(e,r,n,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,r,n,i)}update(e,r,n,i){this.height!=r&&(this.height=r,this.dom.style.height=r+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),Bse(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,r){let n="cm-gutterElement",i=this.dom.firstChild;for(let a=0,s=0;;){let l=s,o=a<r.length?r[a++]:null,c=!1;if(o){let h=o.elementClass;h&&(n+=" "+h);for(let d=s;d<this.markers.length;d++)if(this.markers[d].compare(o)){l=d,c=!0;break}}else l=this.markers.length;for(;s<l;){let h=this.markers[s++];if(h.toDOM){h.destroy(i);let d=i.nextSibling;i.remove(),i=d}}if(!o)break;o.toDOM&&(c?i=i.nextSibling:this.dom.insertBefore(o.toDOM(e),i)),c&&s++}this.dom.className=n,this.markers=r}destroy(){this.setMarkers(null,[])}}function Bse(t,e){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!t[r].compare(e[r]))return!1;return!0}const Lse=We.define(),Pse=We.define(),yu=We.define({combine(t){return ya(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,r){let n=Object.assign({},e);for(let i in r){let a=n[i],s=r[i];n[i]=a?(l,o,c)=>a(l,o,c)||s(l,o,c):s}return n}})}});class RC extends Ka{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function DC(t,e){return t.state.facet(yu).formatNumber(e,t.state)}const zse=Mf.compute([yu],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(Lse)},lineMarker(e,r,n){return n.some(i=>i.toDOM)?null:new RC(DC(e,e.state.doc.lineAt(r.from).number))},widgetMarker:(e,r,n)=>{for(let i of e.state.facet(Pse)){let a=i(e,r,n);if(a)return a}return null},lineMarkerChange:e=>e.startState.facet(yu)!=e.state.facet(yu),initialSpacer(e){return new RC(DC(e,Tz(e.state.doc.lines)))},updateSpacer(e,r){let n=DC(r.view,Tz(r.view.state.doc.lines));return n==e.number?e:new RC(n)},domEventHandlers:t.facet(yu).domEventHandlers,side:"before"}));function Ise(t={}){return[yu.of(t),z9(),zse]}function Tz(t){let e=9;for(;e<t;)e=e*10+9;return e}const qse=new class extends Ka{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},jse=rg.compute(["selection"],t=>{let e=[],r=-1;for(let n of t.selection.ranges){let i=t.doc.lineAt(n.head).from;i>r&&(r=i,e.push(qse.range(i)))}return Et.of(e)});function Fse(){return jse}const q9=1024;let Hse=0;class _C{constructor(e,r){this.from=e,this.to=r}}class Ct{constructor(e={}){this.id=Hse++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Zn.match(e)),r=>{let n=e(r);return n===void 0?null:[this,n]}}}Ct.closedBy=new Ct({deserialize:t=>t.split(" ")});Ct.openedBy=new Ct({deserialize:t=>t.split(" ")});Ct.group=new Ct({deserialize:t=>t.split(" ")});Ct.isolate=new Ct({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});Ct.contextHash=new Ct({perNode:!0});Ct.lookAhead=new Ct({perNode:!0});Ct.mounted=new Ct({perNode:!0});class Rf{constructor(e,r,n,i=!1){this.tree=e,this.overlay=r,this.parser=n,this.bracketed=i}static get(e){return e&&e.props&&e.props[Ct.mounted.id]}}const Vse=Object.create(null);class Zn{constructor(e,r,n,i=0){this.name=e,this.props=r,this.id=n,this.flags=i}static define(e){let r=e.props&&e.props.length?Object.create(null):Vse,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new Zn(e.name||"",r,e.id,n);if(e.props){for(let a of e.props)if(Array.isArray(a)||(a=a(i)),a){if(a[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");r[a[0].id]=a[1]}}return i}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let r=this.prop(Ct.group);return r?r.indexOf(e)>-1:!1}return this.id==e}static match(e){let r=Object.create(null);for(let n in e)for(let i of n.split(" "))r[i]=e[n];return n=>{for(let i=n.prop(Ct.group),a=-1;a<(i?i.length:0);a++){let s=r[a<0?n.name:i[a]];if(s)return s}}}}Zn.none=new Zn("",Object.create(null),0,8);class VE{constructor(e){this.types=e;for(let r=0;r<e.length;r++)if(e[r].id!=r)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let r=[];for(let n of this.types){let i=null;for(let a of e){let s=a(n);if(s){i||(i=Object.assign({},n.props));let l=s[1],o=s[0];o.combine&&o.id in i&&(l=o.combine(i[o.id],l)),i[o.id]=l}}r.push(i?new Zn(n.name,i,n.id,n.flags):n)}return new VE(r)}}const Ep=new WeakMap,Ez=new WeakMap;var gr;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays",t[t.EnterBracketed=16]="EnterBracketed"})(gr||(gr={}));class Cr{constructor(e,r,n,i,a){if(this.type=e,this.children=r,this.positions=n,this.length=i,this.props=null,a&&a.length){this.props=Object.create(null);for(let[s,l]of a)this.props[typeof s=="number"?s:s.id]=l}}toString(){let e=Rf.get(this);if(e&&!e.overlay)return e.tree.toString();let r="";for(let n of this.children){let i=n.toString();i&&(r&&(r+=","),r+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(r.length?"("+r+")":""):r}cursor(e=0){return new lT(this.topNode,e)}cursorAt(e,r=0,n=0){let i=Ep.get(this)||this.topNode,a=new lT(i);return a.moveTo(e,r),Ep.set(this,a._tree),a}get topNode(){return new Oi(this,0,0,null)}resolve(e,r=0){let n=rh(Ep.get(this)||this.topNode,e,r,!1);return Ep.set(this,n),n}resolveInner(e,r=0){let n=rh(Ez.get(this)||this.topNode,e,r,!0);return Ez.set(this,n),n}resolveStack(e,r=0){return Gse(this,e,r)}iterate(e){let{enter:r,leave:n,from:i=0,to:a=this.length}=e,s=e.mode||0,l=(s&gr.IncludeAnonymous)>0;for(let o=this.cursor(s|gr.IncludeAnonymous);;){let c=!1;if(o.from<=a&&o.to>=i&&(!l&&o.type.isAnonymous||r(o)!==!1)){if(o.firstChild())continue;c=!0}for(;c&&n&&(l||!o.type.isAnonymous)&&n(o),!o.nextSibling();){if(!o.parent())return;c=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let r in this.props)e.push([+r,this.props[r]]);return e}balance(e={}){return this.children.length<=8?this:GE(Zn.none,this.children,this.positions,0,this.children.length,0,this.length,(r,n,i)=>new Cr(this.type,r,n,i,this.propValues),e.makeTree||((r,n,i)=>new Cr(Zn.none,r,n,i)))}static build(e){return Yse(e)}}Cr.empty=new Cr(Zn.none,[],[],0);class UE{constructor(e,r){this.buffer=e,this.index=r}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new UE(this.buffer,this.index)}}class nl{constructor(e,r,n){this.buffer=e,this.length=r,this.set=n}get type(){return Zn.none}toString(){let e=[];for(let r=0;r<this.buffer.length;)e.push(this.childString(r)),r=this.buffer[r+3];return e.join(",")}childString(e){let r=this.buffer[e],n=this.buffer[e+3],i=this.set.types[r],a=i.name;if(/\W/.test(a)&&!i.isError&&(a=JSON.stringify(a)),e+=4,n==e)return a;let s=[];for(;e<n;)s.push(this.childString(e)),e=this.buffer[e+3];return a+"("+s.join(",")+")"}findChild(e,r,n,i,a){let{buffer:s}=this,l=-1;for(let o=e;o!=r&&!(j9(a,i,s[o+1],s[o+2])&&(l=o,n>0));o=s[o+3]);return l}slice(e,r,n){let i=this.buffer,a=new Uint16Array(r-e),s=0;for(let l=e,o=0;l<r;){a[o++]=i[l++],a[o++]=i[l++]-n;let c=a[o++]=i[l++]-n;a[o++]=i[l++]-e,s=Math.max(s,c)}return new nl(a,s,this.set)}}function j9(t,e,r,n){switch(t){case-2:return r<e;case-1:return n>=e&&r<e;case 0:return r<e&&n>e;case 1:return r<=e&&n>e;case 2:return n>e;case 4:return!0}}function rh(t,e,r,n){for(var i;t.from==t.to||(r<1?t.from>=e:t.from>e)||(r>-1?t.to<=e:t.to<e);){let s=!n&&t instanceof Oi&&t.index<0?null:t.parent;if(!s)return t;t=s}let a=n?0:gr.IgnoreOverlays;if(n)for(let s=t,l=s.parent;l;s=l,l=s.parent)s instanceof Oi&&s.index<0&&((i=l.enter(e,r,a))===null||i===void 0?void 0:i.from)!=s.from&&(t=l);for(;;){let s=t.enter(e,r,a);if(!s)return t;t=s}}class F9{cursor(e=0){return new lT(this,e)}getChild(e,r=null,n=null){let i=Az(this,e,r,n);return i.length?i[0]:null}getChildren(e,r=null,n=null){return Az(this,e,r,n)}resolve(e,r=0){return rh(this,e,r,!1)}resolveInner(e,r=0){return rh(this,e,r,!0)}matchContext(e){return sT(this.parent,e)}enterUnfinishedNodesBefore(e){let r=this.childBefore(e),n=this;for(;r;){let i=r.lastChild;if(!i||i.to!=r.to)break;i.type.isError&&i.from==i.to?(n=r,r=i.prevSibling):r=i}return n}get node(){return this}get next(){return this.parent}}class Oi extends F9{constructor(e,r,n,i){super(),this._tree=e,this.from=r,this.index=n,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,r,n,i,a=0){for(let s=this;;){for(let{children:l,positions:o}=s._tree,c=r>0?l.length:-1;e!=c;e+=r){let h=l[e],d=o[e]+s.from,g;if(!(!(a&gr.EnterBracketed&&h instanceof Cr&&(g=Rf.get(h))&&!g.overlay&&g.bracketed&&n>=d&&n<=d+h.length)&&!j9(i,n,d,d+h.length))){if(h instanceof nl){if(a&gr.ExcludeBuffers)continue;let m=h.findChild(0,h.buffer.length,r,n-d,i);if(m>-1)return new Fs(new Use(s,h,e,d),null,m)}else if(a&gr.IncludeAnonymous||!h.type.isAnonymous||$E(h)){let m;if(!(a&gr.IgnoreMounts)&&(m=Rf.get(h))&&!m.overlay)return new Oi(m.tree,d,e,s);let y=new Oi(h,d,e,s);return a&gr.IncludeAnonymous||!y.type.isAnonymous?y:y.nextChild(r<0?h.children.length-1:0,r,n,i,a)}}}if(a&gr.IncludeAnonymous||!s.type.isAnonymous||(s.index>=0?e=s.index+r:e=r<0?-1:s._parent._tree.children.length,s=s._parent,!s))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,r,n=0){let i;if(!(n&gr.IgnoreOverlays)&&(i=Rf.get(this._tree))&&i.overlay){let a=e-this.from,s=n&gr.EnterBracketed&&i.bracketed;for(let{from:l,to:o}of i.overlay)if((r>0||s?l<=a:l<a)&&(r<0||s?o>=a:o>a))return new Oi(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,r,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Az(t,e,r,n){let i=t.cursor(),a=[];if(!i.firstChild())return a;if(r!=null){for(let s=!1;!s;)if(s=i.type.is(r),!i.nextSibling())return a}for(;;){if(n!=null&&i.type.is(n))return a;if(i.type.is(e)&&a.push(i.node),!i.nextSibling())return n==null?a:[]}}function sT(t,e,r=e.length-1){for(let n=t;r>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[r]&&e[r]!=n.name)return!1;r--}}return!0}class Use{constructor(e,r,n,i){this.parent=e,this.buffer=r,this.index=n,this.start=i}}class Fs extends F9{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,r,n){super(),this.context=e,this._parent=r,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,r,n){let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],e,r-this.context.start,n);return a<0?null:new Fs(this.context,this,a)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,r,n=0){if(n&gr.ExcludeBuffers)return null;let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],r>0?1:-1,e-this.context.start,r);return a<0?null:new Fs(this.context,this,a)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,r=e.buffer[this.index+3];return r<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Fs(this.context,this._parent,r):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,r=this._parent?this._parent.index+4:0;return this.index==r?this.externalSibling(-1):new Fs(this.context,this._parent,e.findChild(r,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],r=[],{buffer:n}=this.context,i=this.index+4,a=n.buffer[this.index+3];if(a>i){let s=n.buffer[this.index+1];e.push(n.slice(i,a,s)),r.push(0)}return new Cr(this.type,e,r,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function H9(t){if(!t.length)return null;let e=0,r=t[0];for(let a=1;a<t.length;a++){let s=t[a];(s.from>r.from||s.to<r.to)&&(r=s,e=a)}let n=r instanceof Oi&&r.index<0?null:r.parent,i=t.slice();return n?i[e]=n:i.splice(e,1),new $se(i,r)}class $se{constructor(e,r){this.heads=e,this.node=r}get next(){return H9(this.heads)}}function Gse(t,e,r){let n=t.resolveInner(e,r),i=null;for(let a=n instanceof Oi?n:n.context.parent;a;a=a.parent)if(a.index<0){let s=a.parent;(i||(i=[n])).push(s.resolve(e,r)),a=s}else{let s=Rf.get(a.tree);if(s&&s.overlay&&s.overlay[0].from<=e&&s.overlay[s.overlay.length-1].to>=e){let l=new Oi(s.tree,s.overlay[0].from+a.from,-1,a);(i||(i=[n])).push(rh(l,e,r,!1))}}return i?H9(i):n}class lT{get name(){return this.type.name}constructor(e,r=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=r&~gr.EnterBracketed,e instanceof Oi)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,r){this.index=e;let{start:n,buffer:i}=this.buffer;return this.type=r||i.set.types[i.buffer[e]],this.from=n+i.buffer[e+1],this.to=n+i.buffer[e+2],!0}yield(e){return e?e instanceof Oi?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,r,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,r,n,this.mode));let{buffer:i}=this.buffer,a=i.findChild(this.index+4,i.buffer[this.index+3],e,r-this.buffer.start,n);return a<0?!1:(this.stack.push(this.index),this.yieldBuf(a))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,r,n=this.mode){return this.buffer?n&gr.ExcludeBuffers?!1:this.enterChild(1,e,r):this.yield(this._tree.enter(e,r,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&gr.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&gr.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:r}=this.buffer,n=this.stack.length-1;if(e<0){let i=n<0?0:this.stack[n]+4;if(this.index!=i)return this.yieldBuf(r.findChild(i,this.index,-1,0,4))}else{let i=r.buffer[this.index+3];if(i<(n<0?r.buffer.length:r.buffer[this.stack[n]+3]))return this.yieldBuf(i)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let r,n,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let a=0;a<this.index;a++)if(i.buffer.buffer[a+3]<this.index)return!1;({index:r,parent:n}=i)}else({index:r,_parent:n}=this._tree);for(;n;{index:r,_parent:n}=n)if(r>-1)for(let a=r+e,s=e<0?-1:n._tree.children.length;a!=s;a+=e){let l=n._tree.children[a];if(this.mode&gr.IncludeAnonymous||l instanceof nl||!l.type.isAnonymous||$E(l))return!1}return!0}move(e,r){if(r&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,r=0){for(;(this.from==this.to||(r<1?this.from>=e:this.from>e)||(r>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,r););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,r=null,n=0;if(e&&e.context==this.buffer)e:for(let i=this.index,a=this.stack.length;a>=0;){for(let s=e;s;s=s._parent)if(s.index==i){if(i==this.index)return s;r=s,n=a+1;break e}i=this.stack[--a]}for(let i=n;i<this.stack.length;i++)r=new Fs(this.buffer,r,this.stack[i]);return this.bufferNode=new Fs(this.buffer,r,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,r){for(let n=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&r&&r(this),i=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,i=!0}}}matchContext(e){if(!this.buffer)return sT(this.node.parent,e);let{buffer:r}=this.buffer,{types:n}=r.set;for(let i=e.length-1,a=this.stack.length-1;i>=0;a--){if(a<0)return sT(this._tree,e,i);let s=n[r.buffer[this.stack[a]]];if(!s.isAnonymous){if(e[i]&&e[i]!=s.name)return!1;i--}}return!0}}function $E(t){return t.children.some(e=>e instanceof nl||!e.type.isAnonymous||$E(e))}function Yse(t){var e;let{buffer:r,nodeSet:n,maxBufferLength:i=q9,reused:a=[],minRepeatType:s=n.types.length}=t,l=Array.isArray(r)?new UE(r,r.length):r,o=n.types,c=0,h=0;function d(M,R,O,N,B,D){let{id:_,start:P,end:z,size:H}=l,$=h,q=c;if(H<0)if(l.next(),H==-1){let I=a[_];O.push(I),N.push(P-M);return}else if(H==-3){c=_;return}else if(H==-4){h=_;return}else throw new RangeError(`Unrecognized record size: ${H}`);let V=o[_],X,ee,te=P-M;if(z-P<=i&&(ee=x(l.pos-R,B))){let I=new Uint16Array(ee.size-ee.skip),G=l.pos-ee.size,re=I.length;for(;l.pos>G;)re=w(ee.start,I,re);X=new nl(I,z-ee.start,n),te=ee.start-M}else{let I=l.pos-H;l.next();let G=[],re=[],Y=_>=s?_:-1,W=0,Z=z;for(;l.pos>I;)Y>=0&&l.id==Y&&l.size>=0?(l.end<=Z-i&&(y(G,re,P,W,l.end,Z,Y,$,q),W=G.length,Z=l.end),l.next()):D>2500?g(P,I,G,re):d(P,I,G,re,Y,D+1);if(Y>=0&&W>0&&W<G.length&&y(G,re,P,W,P,Z,Y,$,q),G.reverse(),re.reverse(),Y>-1&&W>0){let ie=m(V,q);X=GE(V,G,re,0,G.length,0,z-P,ie,ie)}else X=b(V,G,re,z-P,$-z,q)}O.push(X),N.push(te)}function g(M,R,O,N){let B=[],D=0,_=-1;for(;l.pos>R;){let{id:P,start:z,end:H,size:$}=l;if($>4)l.next();else{if(_>-1&&z<_)break;_<0&&(_=H-i),B.push(P,z,H),D++,l.next()}}if(D){let P=new Uint16Array(D*4),z=B[B.length-2];for(let H=B.length-3,$=0;H>=0;H-=3)P[$++]=B[H],P[$++]=B[H+1]-z,P[$++]=B[H+2]-z,P[$++]=$;O.push(new nl(P,B[2]-z,n)),N.push(z-M)}}function m(M,R){return(O,N,B)=>{let D=0,_=O.length-1,P,z;if(_>=0&&(P=O[_])instanceof Cr){if(!_&&P.type==M&&P.length==B)return P;(z=P.prop(Ct.lookAhead))&&(D=N[_]+P.length+z)}return b(M,O,N,B,D,R)}}function y(M,R,O,N,B,D,_,P,z){let H=[],$=[];for(;M.length>N;)H.push(M.pop()),$.push(R.pop()+O-B);M.push(b(n.types[_],H,$,D-B,P-D,z)),R.push(B-O)}function b(M,R,O,N,B,D,_){if(D){let P=[Ct.contextHash,D];_=_?[P].concat(_):[P]}if(B>25){let P=[Ct.lookAhead,B];_=_?[P].concat(_):[P]}return new Cr(M,R,O,N,_)}function x(M,R){let O=l.fork(),N=0,B=0,D=0,_=O.end-i,P={size:0,start:0,skip:0};e:for(let z=O.pos-M;O.pos>z;){let H=O.size;if(O.id==R&&H>=0){P.size=N,P.start=B,P.skip=D,D+=4,N+=4,O.next();continue}let $=O.pos-H;if(H<0||$<z||O.start<_)break;let q=O.id>=s?4:0,V=O.start;for(O.next();O.pos>$;){if(O.size<0)if(O.size==-3||O.size==-4)q+=4;else break e;else O.id>=s&&(q+=4);O.next()}B=V,N+=H,D+=q}return(R<0||N==M)&&(P.size=N,P.start=B,P.skip=D),P.size>4?P:void 0}function w(M,R,O){let{id:N,start:B,end:D,size:_}=l;if(l.next(),_>=0&&N<s){let P=O;if(_>4){let z=l.pos-(_-4);for(;l.pos>z;)O=w(M,R,O)}R[--O]=P,R[--O]=D-M,R[--O]=B-M,R[--O]=N}else _==-3?c=N:_==-4&&(h=N);return O}let S=[],k=[];for(;l.pos>0;)d(t.start||0,t.bufferStart||0,S,k,-1,0);let E=(e=t.length)!==null&&e!==void 0?e:S.length?k[0]+S[0].length:0;return new Cr(o[t.topID],S.reverse(),k.reverse(),E)}const Oz=new WeakMap;function ng(t,e){if(!t.isAnonymous||e instanceof nl||e.type!=t)return 1;let r=Oz.get(e);if(r==null){r=1;for(let n of e.children){if(n.type!=t||!(n instanceof Cr)){r=1;break}r+=ng(t,n)}Oz.set(e,r)}return r}function GE(t,e,r,n,i,a,s,l,o){let c=0;for(let y=n;y<i;y++)c+=ng(t,e[y]);let h=Math.ceil(c*1.5/8),d=[],g=[];function m(y,b,x,w,S){for(let k=x;k<w;){let E=k,M=b[k],R=ng(t,y[k]);for(k++;k<w;k++){let O=ng(t,y[k]);if(R+O>=h)break;R+=O}if(k==E+1){if(R>h){let O=y[E];m(O.children,O.positions,0,O.children.length,b[E]+S);continue}d.push(y[E])}else{let O=b[k-1]+y[k-1].length-M;d.push(GE(t,y,b,E,k,M,O,null,o))}g.push(M+S-a)}}return m(e,r,n,i,0),(l||o)(d,g,s)}class Xl{constructor(e,r,n,i,a=!1,s=!1){this.from=e,this.to=r,this.tree=n,this.offset=i,this.open=(a?1:0)|(s?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,r=[],n=!1){let i=[new Xl(0,e.length,e,0,!1,n)];for(let a of r)a.to>e.length&&i.push(a);return i}static applyChanges(e,r,n=128){if(!r.length)return e;let i=[],a=1,s=e.length?e[0]:null;for(let l=0,o=0,c=0;;l++){let h=l<r.length?r[l]:null,d=h?h.fromA:1e9;if(d-o>=n)for(;s&&s.from<d;){let g=s;if(o>=g.from||d<=g.to||c){let m=Math.max(g.from,o)-c,y=Math.min(g.to,d)-c;g=m>=y?null:new Xl(m,y,g.tree,g.offset+c,l>0,!!h)}if(g&&i.push(g),s.to>d)break;s=a<e.length?e[a++]:null}if(!h)break;o=h.toA,c=h.toA-h.toB}return i}}class V9{startParse(e,r,n){return typeof e=="string"&&(e=new Xse(e)),n=n?n.length?n.map(i=>new _C(i.from,i.to)):[new _C(0,0)]:[new _C(0,e.length)],this.createParse(e,r||[],n)}parse(e,r,n){let i=this.startParse(e,r,n);for(;;){let a=i.advance();if(a)return a}}}class Xse{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,r){return this.string.slice(e,r)}}new Ct({perNode:!0});let Wse=0,ja=class oT{constructor(e,r,n,i){this.name=e,this.set=r,this.base=n,this.modified=i,this.id=Wse++}toString(){let{name:e}=this;for(let r of this.modified)r.name&&(e=`${r.name}(${e})`);return e}static define(e,r){let n=typeof e=="string"?e:"?";if(e instanceof oT&&(r=e),r?.base)throw new Error("Can not derive from a modified tag");let i=new oT(n,[],null,[]);if(i.set.push(i),r)for(let a of r.set)i.set.push(a);return i}static defineModifier(e){let r=new Ig(e);return n=>n.modified.indexOf(r)>-1?n:Ig.get(n.base||n,n.modified.concat(r).sort((i,a)=>i.id-a.id))}},Qse=0;class Ig{constructor(e){this.name=e,this.instances=[],this.id=Qse++}static get(e,r){if(!r.length)return e;let n=r[0].instances.find(l=>l.base==e&&Kse(r,l.modified));if(n)return n;let i=[],a=new ja(e.name,i,e,r);for(let l of r)l.instances.push(a);let s=Zse(r);for(let l of e.set)if(!l.modified.length)for(let o of s)i.push(Ig.get(l,o));return a}}function Kse(t,e){return t.length==e.length&&t.every((r,n)=>r==e[n])}function Zse(t){let e=[[]];for(let r=0;r<t.length;r++)for(let n=0,i=e.length;n<i;n++)e.push(e[n].concat(t[r]));return e.sort((r,n)=>n.length-r.length)}function U9(t){let e=Object.create(null);for(let r in t){let n=t[r];Array.isArray(n)||(n=[n]);for(let i of r.split(" "))if(i){let a=[],s=2,l=i;for(let d=0;;){if(l=="..."&&d>0&&d+3==i.length){s=1;break}let g=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!g)throw new RangeError("Invalid path: "+i);if(a.push(g[0]=="*"?"":g[0][0]=='"'?JSON.parse(g[0]):g[0]),d+=g[0].length,d==i.length)break;let m=i[d++];if(d==i.length&&m=="!"){s=0;break}if(m!="/")throw new RangeError("Invalid path: "+i);l=i.slice(d)}let o=a.length-1,c=a[o];if(!c)throw new RangeError("Invalid path: "+i);let h=new nh(n,s,o>0?a.slice(0,o):null);e[c]=h.sort(e[c])}}return $9.add(e)}const $9=new Ct({combine(t,e){let r,n,i;for(;t||e;){if(!t||e&&t.depth>=e.depth?(i=e,e=e.next):(i=t,t=t.next),r&&r.mode==i.mode&&!i.context&&!r.context)continue;let a=new nh(i.tags,i.mode,i.context);r?r.next=a:n=a,r=a}return n}});class nh{constructor(e,r,n,i){this.tags=e,this.mode=r,this.context=n,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}nh.empty=new nh([],2,null);function G9(t,e){let r=Object.create(null);for(let a of t)if(!Array.isArray(a.tag))r[a.tag.id]=a.class;else for(let s of a.tag)r[s.id]=a.class;let{scope:n,all:i=null}=e||{};return{style:a=>{let s=i;for(let l of a)for(let o of l.set){let c=r[o.id];if(c){s=s?s+" "+c:c;break}}return s},scope:n}}function Jse(t,e){let r=null;for(let n of t){let i=n.style(e);i&&(r=r?r+" "+i:i)}return r}function ele(t,e,r,n=0,i=t.length){let a=new tle(n,Array.isArray(e)?e:[e],r);a.highlightRange(t.cursor(),n,i,"",a.highlighters),a.flush(i)}class tle{constructor(e,r,n){this.at=e,this.highlighters=r,this.span=n,this.class=""}startSpan(e,r){r!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=r)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,r,n,i,a){let{type:s,from:l,to:o}=e;if(l>=n||o<=r)return;s.isTop&&(a=this.highlighters.filter(m=>!m.scope||m.scope(s)));let c=i,h=rle(e)||nh.empty,d=Jse(a,h.tags);if(d&&(c&&(c+=" "),c+=d,h.mode==1&&(i+=(i?" ":"")+d)),this.startSpan(Math.max(r,l),c),h.opaque)return;let g=e.tree&&e.tree.prop(Ct.mounted);if(g&&g.overlay){let m=e.node.enter(g.overlay[0].from+l,1),y=this.highlighters.filter(x=>!x.scope||x.scope(g.tree.type)),b=e.firstChild();for(let x=0,w=l;;x++){let S=x<g.overlay.length?g.overlay[x]:null,k=S?S.from+l:o,E=Math.max(r,w),M=Math.min(n,k);if(E<M&&b)for(;e.from<M&&(this.highlightRange(e,E,M,i,a),this.startSpan(Math.min(M,e.to),c),!(e.to>=k||!e.nextSibling())););if(!S||k>n)break;w=S.to+l,w>r&&(this.highlightRange(m.cursor(),Math.max(r,S.from+l),Math.min(n,w),"",y),this.startSpan(Math.min(n,w),c))}b&&e.parent()}else if(e.firstChild()){g&&(i="");do if(!(e.to<=r)){if(e.from>=n)break;this.highlightRange(e,r,n,i,a),this.startSpan(Math.min(n,e.to),c)}while(e.nextSibling());e.parent()}}}function rle(t){let e=t.type.prop($9);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const Fe=ja.define,Ap=Fe(),Bs=Fe(),Mz=Fe(Bs),Rz=Fe(Bs),Ls=Fe(),Op=Fe(Ls),NC=Fe(Ls),na=Fe(),_l=Fe(na),ea=Fe(),ta=Fe(),uT=Fe(),sf=Fe(uT),Mp=Fe(),xe={comment:Ap,lineComment:Fe(Ap),blockComment:Fe(Ap),docComment:Fe(Ap),name:Bs,variableName:Fe(Bs),typeName:Mz,tagName:Fe(Mz),propertyName:Rz,attributeName:Fe(Rz),className:Fe(Bs),labelName:Fe(Bs),namespace:Fe(Bs),macroName:Fe(Bs),literal:Ls,string:Op,docString:Fe(Op),character:Fe(Op),attributeValue:Fe(Op),number:NC,integer:Fe(NC),float:Fe(NC),bool:Fe(Ls),regexp:Fe(Ls),escape:Fe(Ls),color:Fe(Ls),url:Fe(Ls),keyword:ea,self:Fe(ea),null:Fe(ea),atom:Fe(ea),unit:Fe(ea),modifier:Fe(ea),operatorKeyword:Fe(ea),controlKeyword:Fe(ea),definitionKeyword:Fe(ea),moduleKeyword:Fe(ea),operator:ta,derefOperator:Fe(ta),arithmeticOperator:Fe(ta),logicOperator:Fe(ta),bitwiseOperator:Fe(ta),compareOperator:Fe(ta),updateOperator:Fe(ta),definitionOperator:Fe(ta),typeOperator:Fe(ta),controlOperator:Fe(ta),punctuation:uT,separator:Fe(uT),bracket:sf,angleBracket:Fe(sf),squareBracket:Fe(sf),paren:Fe(sf),brace:Fe(sf),content:na,heading:_l,heading1:Fe(_l),heading2:Fe(_l),heading3:Fe(_l),heading4:Fe(_l),heading5:Fe(_l),heading6:Fe(_l),contentSeparator:Fe(na),list:Fe(na),quote:Fe(na),emphasis:Fe(na),strong:Fe(na),link:Fe(na),monospace:Fe(na),strikethrough:Fe(na),inserted:Fe(),deleted:Fe(),changed:Fe(),invalid:Fe(),meta:Mp,documentMeta:Fe(Mp),annotation:Fe(Mp),processingInstruction:Fe(Mp),definition:ja.defineModifier("definition"),constant:ja.defineModifier("constant"),function:ja.defineModifier("function"),standard:ja.defineModifier("standard"),local:ja.defineModifier("local"),special:ja.defineModifier("special")};for(let t in xe){let e=xe[t];e instanceof ja&&(e.name=t)}G9([{tag:xe.link,class:"tok-link"},{tag:xe.heading,class:"tok-heading"},{tag:xe.emphasis,class:"tok-emphasis"},{tag:xe.strong,class:"tok-strong"},{tag:xe.keyword,class:"tok-keyword"},{tag:xe.atom,class:"tok-atom"},{tag:xe.bool,class:"tok-bool"},{tag:xe.url,class:"tok-url"},{tag:xe.labelName,class:"tok-labelName"},{tag:xe.inserted,class:"tok-inserted"},{tag:xe.deleted,class:"tok-deleted"},{tag:xe.literal,class:"tok-literal"},{tag:xe.string,class:"tok-string"},{tag:xe.number,class:"tok-number"},{tag:[xe.regexp,xe.escape,xe.special(xe.string)],class:"tok-string2"},{tag:xe.variableName,class:"tok-variableName"},{tag:xe.local(xe.variableName),class:"tok-variableName tok-local"},{tag:xe.definition(xe.variableName),class:"tok-variableName tok-definition"},{tag:xe.special(xe.variableName),class:"tok-variableName2"},{tag:xe.definition(xe.propertyName),class:"tok-propertyName tok-definition"},{tag:xe.typeName,class:"tok-typeName"},{tag:xe.namespace,class:"tok-namespace"},{tag:xe.className,class:"tok-className"},{tag:xe.macroName,class:"tok-macroName"},{tag:xe.propertyName,class:"tok-propertyName"},{tag:xe.operator,class:"tok-operator"},{tag:xe.comment,class:"tok-comment"},{tag:xe.meta,class:"tok-meta"},{tag:xe.invalid,class:"tok-invalid"},{tag:xe.punctuation,class:"tok-punctuation"}]);var BC;const bu=new Ct;function nle(t){return We.define({combine:t?e=>e.concat(t):void 0})}const ile=new Ct;class Ii{constructor(e,r,n=[],i=""){this.data=e,this.name=i,Dt.prototype.hasOwnProperty("tree")||Object.defineProperty(Dt.prototype,"tree",{get(){return bn(this)}}),this.parser=r,this.extension=[il.of(this),Dt.languageData.of((a,s,l)=>{let o=Dz(a,s,l),c=o.type.prop(bu);if(!c)return[];let h=a.facet(c),d=o.type.prop(ile);if(d){let g=o.resolve(s-o.from,l);for(let m of d)if(m.test(g,a)){let y=a.facet(m.facet);return m.type=="replace"?y:y.concat(h)}}return h})].concat(n)}isActiveAt(e,r,n=-1){return Dz(e,r,n).type.prop(bu)==this.data}findRegions(e){let r=e.facet(il);if(r?.data==this.data)return[{from:0,to:e.doc.length}];if(!r||!r.allowsNesting)return[];let n=[],i=(a,s)=>{if(a.prop(bu)==this.data){n.push({from:s,to:s+a.length});return}let l=a.prop(Ct.mounted);if(l){if(l.tree.prop(bu)==this.data){if(l.overlay)for(let o of l.overlay)n.push({from:o.from+s,to:o.to+s});else n.push({from:s,to:s+a.length});return}else if(l.overlay){let o=n.length;if(i(l.tree,l.overlay[0].from+s),n.length>o)return}}for(let o=0;o<a.children.length;o++){let c=a.children[o];c instanceof Cr&&i(c,a.positions[o]+s)}};return i(bn(e),0),n}get allowsNesting(){return!0}}Ii.setState=yt.define();function Dz(t,e,r){let n=t.facet(il),i=bn(t).topNode;if(!n||n.allowsNesting)for(let a=i;a;a=a.enter(e,r,gr.ExcludeBuffers|gr.EnterBracketed))a.type.isTop&&(i=a);return i}class qg extends Ii{constructor(e,r,n){super(e,r,[],n),this.parser=r}static define(e){let r=nle(e.languageData);return new qg(r,e.parser.configure({props:[bu.add(n=>n.isTop?r:void 0)]}),e.name)}configure(e,r){return new qg(this.data,this.parser.configure(e),r||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function bn(t){let e=t.field(Ii.state,!1);return e?e.tree:Cr.empty}class ale{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,r){let n=this.cursorPos-this.string.length;return e<n||r>=this.cursorPos?this.doc.sliceString(e,r):this.string.slice(e-n,r-n)}}let lf=null;class jg{constructor(e,r,n=[],i,a,s,l,o){this.parser=e,this.state=r,this.fragments=n,this.tree=i,this.treeLen=a,this.viewport=s,this.skipped=l,this.scheduleOn=o,this.parse=null,this.tempSkipped=[]}static create(e,r,n){return new jg(e,r,[],Cr.empty,0,n,[],null)}startParse(){return this.parser.startParse(new ale(this.state.doc),this.fragments)}work(e,r){return r!=null&&r>=this.state.doc.length&&(r=void 0),this.tree!=Cr.empty&&this.isDone(r??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if(typeof e=="number"){let i=Date.now()+e;e=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),r!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>r)&&r<this.state.doc.length&&this.parse.stopAt(r);;){let i=this.parse.advance();if(i)if(this.fragments=this.withoutTempSkipped(Xl.addTree(i,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(n=this.parse.stoppedAt)!==null&&n!==void 0?n:this.state.doc.length,this.tree=i,this.parse=null,this.treeLen<(r??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,r;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(r=this.parse.advance()););}),this.treeLen=e,this.tree=r,this.fragments=this.withoutTempSkipped(Xl.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let r=lf;lf=this;try{return e()}finally{lf=r}}withoutTempSkipped(e){for(let r;r=this.tempSkipped.pop();)e=_z(e,r.from,r.to);return e}changes(e,r){let{fragments:n,tree:i,treeLen:a,viewport:s,skipped:l}=this;if(this.takeTree(),!e.empty){let o=[];if(e.iterChangedRanges((c,h,d,g)=>o.push({fromA:c,toA:h,fromB:d,toB:g})),n=Xl.applyChanges(n,o),i=Cr.empty,a=0,s={from:e.mapPos(s.from,-1),to:e.mapPos(s.to,1)},this.skipped.length){l=[];for(let c of this.skipped){let h=e.mapPos(c.from,1),d=e.mapPos(c.to,-1);h<d&&l.push({from:h,to:d})}}}return new jg(this.parser,r,n,i,a,s,l,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let r=this.skipped.length;for(let n=0;n<this.skipped.length;n++){let{from:i,to:a}=this.skipped[n];i<e.to&&a>e.from&&(this.fragments=_z(this.fragments,i,a),this.skipped.splice(n--,1))}return this.skipped.length>=r?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,r){this.skipped.push({from:e,to:r})}static getSkippingParser(e){return new class extends V9{createParse(r,n,i){let a=i[0].from,s=i[i.length-1].to;return{parsedPos:a,advance(){let o=lf;if(o){for(let c of i)o.tempSkipped.push(c);e&&(o.scheduleOn=o.scheduleOn?Promise.all([o.scheduleOn,e]):e)}return this.parsedPos=s,new Cr(Zn.none,[],[],s-a)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let r=this.fragments;return this.treeLen>=e&&r.length&&r[0].from==0&&r[0].to>=e}static get(){return lf}}function _z(t,e,r){return Xl.applyChanges(t,[{fromA:e,toA:r,fromB:e,toB:r}])}class Hu{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let r=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),r.viewport.to);return r.work(20,n)||r.takeTree(),new Hu(r)}static init(e){let r=Math.min(3e3,e.doc.length),n=jg.create(e.facet(il).parser,e,{from:0,to:r});return n.work(20,r)||n.takeTree(),new Hu(n)}}Ii.state=Sn.define({create:Hu.init,update(t,e){for(let r of e.effects)if(r.is(Ii.setState))return r.value;return e.startState.facet(il)!=e.state.facet(il)?Hu.init(e.state):t.apply(e)}});let Y9=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Y9=t=>{let e=-1,r=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(r):cancelIdleCallback(e)});const LC=typeof navigator<"u"&&(!((BC=navigator.scheduling)===null||BC===void 0)&&BC.isInputPending)?()=>navigator.scheduling.isInputPending():null,sle=mr.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let r=this.view.state.field(Ii.state).context;(r.updateViewport(e.view.viewport)||this.view.viewport.to>r.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(r)}scheduleWork(){if(this.working)return;let{state:e}=this.view,r=e.field(Ii.state);(r.tree!=r.context.tree||!r.context.isDone(e.doc.length))&&(this.working=Y9(this.work))}work(e){this.working=null;let r=Date.now();if(this.chunkEnd<r&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=r+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:i}}=this.view,a=n.field(Ii.state);if(a.tree==a.context.tree&&a.context.isDone(i+1e5))return;let s=Date.now()+Math.min(this.chunkBudget,100,e&&!LC?Math.max(25,e.timeRemaining()-5):1e9),l=a.context.treeLen<i&&n.doc.length>i+1e3,o=a.context.work(()=>LC&&LC()||Date.now()>s,i+(l?0:1e5));this.chunkBudget-=Date.now()-r,(o||this.chunkBudget<=0)&&(a.context.takeTree(),this.view.dispatch({effects:Ii.setState.of(new Hu(a.context))})),this.chunkBudget>0&&!(o&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(a.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(r=>Xn(this.view.state,r)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),il=We.define({combine(t){return t.length?t[0]:null},enables:t=>[Ii.state,sle,Ue.contentAttributes.compute([t],e=>{let r=e.facet(t);return r&&r.name?{"data-language":r.name}:{}})]});class lle{constructor(e,r=[]){this.language=e,this.support=r,this.extension=[e,r]}}const ole=We.define(),Yv=We.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(r=>r!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function Fg(t){let e=t.facet(Yv);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function ih(t,e){let r="",n=t.tabSize,i=t.facet(Yv)[0];if(i==" "){for(;e>=n;)r+=" ",e-=n;i=" "}for(let a=0;a<e;a++)r+=i;return r}function YE(t,e){t instanceof Dt&&(t=new Xv(t));for(let n of t.state.facet(ole)){let i=n(t,e);if(i!==void 0)return i}let r=bn(t.state);return r.length>=e?ule(t,r,e):null}class Xv{constructor(e,r={}){this.state=e,this.options=r,this.unit=Fg(e)}lineAt(e,r=1){let n=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:a}=this.options;return i!=null&&i>=n.from&&i<=n.to?a&&i==e?{text:"",from:e}:(r<0?i<e:i<=e)?{text:n.text.slice(i-n.from),from:i}:{text:n.text.slice(0,i-n.from),from:n.from}:n}textAfterPos(e,r=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:i}=this.lineAt(e,r);return n.slice(e-i,Math.min(n.length,e+100-i))}column(e,r=1){let{text:n,from:i}=this.lineAt(e,r),a=this.countColumn(n,e-i),s=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return s>-1&&(a+=s-this.countColumn(n,n.search(/\S|$/))),a}countColumn(e,r=e.length){return rc(e,this.state.tabSize,r)}lineIndent(e,r=1){let{text:n,from:i}=this.lineAt(e,r),a=this.options.overrideIndentation;if(a){let s=a(i);if(s>-1)return s}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const X9=new Ct;function ule(t,e,r){let n=e.resolveStack(r),i=e.resolveInner(r,-1).resolve(r,0).enterUnfinishedNodesBefore(r);if(i!=n.node){let a=[];for(let s=i;s&&!(s.from<n.node.from||s.to>n.node.to||s.from==n.node.from&&s.type==n.node.type);s=s.parent)a.push(s);for(let s=a.length-1;s>=0;s--)n={node:a[s],next:n}}return W9(n,t,r)}function W9(t,e,r){for(let n=t;n;n=n.next){let i=fle(n.node);if(i)return i(XE.create(e,r,n))}return 0}function cle(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function fle(t){let e=t.type.prop(X9);if(e)return e;let r=t.firstChild,n;if(r&&(n=r.type.prop(Ct.closedBy))){let i=t.lastChild,a=i&&n.indexOf(i.name)>-1;return s=>Q9(s,!0,1,void 0,a&&!cle(s)?i.from:void 0)}return t.parent==null?hle:null}function hle(){return 0}class XE extends Xv{constructor(e,r,n){super(e.state,e.options),this.base=e,this.pos=r,this.context=n}get node(){return this.context.node}static create(e,r,n){return new XE(e,r,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let r=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(r.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(dle(n,e))break;r=this.state.doc.lineAt(n.from)}return this.lineIndent(r.from)}continue(){return W9(this.context.next,this.base,this.pos)}}function dle(t,e){for(let r=e;r;r=r.parent)if(t==r)return!0;return!1}function ple(t){let e=t.node,r=e.childAfter(e.from),n=e.lastChild;if(!r)return null;let i=t.options.simulateBreak,a=t.state.doc.lineAt(r.from),s=i==null||i<=a.from?a.to:Math.min(a.to,i);for(let l=r.to;;){let o=e.childAfter(l);if(!o||o==n)return null;if(!o.type.isSkipped){if(o.from>=s)return null;let c=/^ */.exec(a.text.slice(r.to-a.from))[0].length;return{from:r.from,to:r.to+c}}l=o.to}}function Nz({closing:t,align:e=!0,units:r=1}){return n=>Q9(n,e,r,t)}function Q9(t,e,r,n,i){let a=t.textAfter,s=a.match(/^\s*/)[0].length,l=n&&a.slice(s,s+n.length)==n||i==t.pos+s,o=e?ple(t):null;return o?l?t.column(o.from):t.column(o.to):t.baseIndent+(l?0:t.unit*r)}const gle=200;function vle(){return Dt.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let r=t.newDoc,{head:n}=t.newSelection.main,i=r.lineAt(n);if(n>i.from+gle)return t;let a=r.sliceString(i.from,n);if(!e.some(c=>c.test(a)))return t;let{state:s}=t,l=-1,o=[];for(let{head:c}of s.selection.ranges){let h=s.doc.lineAt(c);if(h.from==l)continue;l=h.from;let d=YE(s,h.from);if(d==null)continue;let g=/^\s*/.exec(h.text)[0],m=ih(s,d);g!=m&&o.push({from:h.from,to:h.from+g.length,insert:m})}return o.length?[t,{changes:o,sequential:!0}]:t})}const mle=We.define(),K9=new Ct;function yle(t){let e=t.firstChild,r=t.lastChild;return e&&e.to<r.from?{from:e.to,to:r.type.isError?t.to:r.from}:null}function ble(t,e,r){let n=bn(t);if(n.length<r)return null;let i=n.resolveStack(r,1),a=null;for(let s=i;s;s=s.next){let l=s.node;if(l.to<=r||l.from>r)continue;if(a&&l.from<e)break;let o=l.type.prop(K9);if(o&&(l.to<n.length-50||n.length==t.doc.length||!xle(l))){let c=o(l,t);c&&c.from<=r&&c.from>=e&&c.to>r&&(a=c)}}return a}function xle(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function Hg(t,e,r){for(let n of t.facet(mle)){let i=n(t,e,r);if(i)return i}return ble(t,e,r)}function Z9(t,e){let r=e.mapPos(t.from,1),n=e.mapPos(t.to,-1);return r>=n?void 0:{from:r,to:n}}const Wv=yt.define({map:Z9}),Nh=yt.define({map:Z9});function J9(t){let e=[];for(let{head:r}of t.state.selection.ranges)e.some(n=>n.from<=r&&n.to>=r)||e.push(t.lineBlockAt(r));return e}const ao=Sn.define({create(){return ut.none},update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((r,n)=>t=Bz(t,r,n)),t=t.map(e.changes);for(let r of e.effects)if(r.is(Wv)&&!wle(t,r.value.from,r.value.to)){let{preparePlaceholder:n}=e.state.facet(rF),i=n?ut.replace({widget:new Ole(n(e.state,r.value))}):Lz;t=t.update({add:[i.range(r.value.from,r.value.to)]})}else r.is(Nh)&&(t=t.update({filter:(n,i)=>r.value.from!=n||r.value.to!=i,filterFrom:r.value.from,filterTo:r.value.to}));return e.selection&&(t=Bz(t,e.selection.main.head)),t},provide:t=>Ue.decorations.from(t),toJSON(t,e){let r=[];return t.between(0,e.doc.length,(n,i)=>{r.push(n,i)}),r},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let r=0;r<t.length;){let n=t[r++],i=t[r++];if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid JSON for fold state");e.push(Lz.range(n,i))}return ut.set(e,!0)}});function Bz(t,e,r=e){let n=!1;return t.between(e,r,(i,a)=>{i<r&&a>e&&(n=!0)}),n?t.update({filterFrom:e,filterTo:r,filter:(i,a)=>i>=r||a<=e}):t}function Vg(t,e,r){var n;let i=null;return(n=t.field(ao,!1))===null||n===void 0||n.between(e,r,(a,s)=>{(!i||i.from>a)&&(i={from:a,to:s})}),i}function wle(t,e,r){let n=!1;return t.between(e,e,(i,a)=>{i==e&&a==r&&(n=!0)}),n}function eF(t,e){return t.field(ao,!1)?e:e.concat(yt.appendConfig.of(nF()))}const Sle=t=>{for(let e of J9(t)){let r=Hg(t.state,e.from,e.to);if(r)return t.dispatch({effects:eF(t.state,[Wv.of(r),tF(t,r)])}),!0}return!1},Cle=t=>{if(!t.state.field(ao,!1))return!1;let e=[];for(let r of J9(t)){let n=Vg(t.state,r.from,r.to);n&&e.push(Nh.of(n),tF(t,n,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function tF(t,e,r=!0){let n=t.state.doc.lineAt(e.from).number,i=t.state.doc.lineAt(e.to).number;return Ue.announce.of(`${t.state.phrase(r?"Folded lines":"Unfolded lines")} ${n} ${t.state.phrase("to")} ${i}.`)}const kle=t=>{let{state:e}=t,r=[];for(let n=0;n<e.doc.length;){let i=t.lineBlockAt(n),a=Hg(e,i.from,i.to);a&&r.push(Wv.of(a)),n=(a?t.lineBlockAt(a.to):i).to+1}return r.length&&t.dispatch({effects:eF(t.state,r)}),!!r.length},Tle=t=>{let e=t.state.field(ao,!1);if(!e||!e.size)return!1;let r=[];return e.between(0,t.state.doc.length,(n,i)=>{r.push(Nh.of({from:n,to:i}))}),t.dispatch({effects:r}),!0},Ele=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:Sle},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:Cle},{key:"Ctrl-Alt-[",run:kle},{key:"Ctrl-Alt-]",run:Tle}],Ale={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},rF=We.define({combine(t){return ya(t,Ale)}});function nF(t){return[ao,Dle]}function iF(t,e){let{state:r}=t,n=r.facet(rF),i=s=>{let l=t.lineBlockAt(t.posAtDOM(s.target)),o=Vg(t.state,l.from,l.to);o&&t.dispatch({effects:Nh.of(o)}),s.preventDefault()};if(n.placeholderDOM)return n.placeholderDOM(t,i,e);let a=document.createElement("span");return a.textContent=n.placeholderText,a.setAttribute("aria-label",r.phrase("folded code")),a.title=r.phrase("unfold"),a.className="cm-foldPlaceholder",a.onclick=i,a}const Lz=ut.replace({widget:new class extends ba{toDOM(t){return iF(t,null)}}});class Ole extends ba{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return iF(e,this.value)}}const Mle={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class PC extends Ka{constructor(e,r){super(),this.config=e,this.open=r}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let r=document.createElement("span");return r.textContent=this.open?this.config.openText:this.config.closedText,r.title=e.state.phrase(this.open?"Fold line":"Unfold line"),r}}function Rle(t={}){let e={...Mle,...t},r=new PC(e,!0),n=new PC(e,!1),i=mr.fromClass(class{constructor(s){this.from=s.viewport.from,this.markers=this.buildMarkers(s)}update(s){(s.docChanged||s.viewportChanged||s.startState.facet(il)!=s.state.facet(il)||s.startState.field(ao,!1)!=s.state.field(ao,!1)||bn(s.startState)!=bn(s.state)||e.foldingChanged(s))&&(this.markers=this.buildMarkers(s.view))}buildMarkers(s){let l=new Wa;for(let o of s.viewportLineBlocks){let c=Vg(s.state,o.from,o.to)?n:Hg(s.state,o.from,o.to)?r:null;c&&l.add(o.from,o.from,c)}return l.finish()}}),{domEventHandlers:a}=e;return[i,Dse({class:"cm-foldGutter",markers(s){var l;return((l=s.plugin(i))===null||l===void 0?void 0:l.markers)||Et.empty},initialSpacer(){return new PC(e,!1)},domEventHandlers:{...a,click:(s,l,o)=>{if(a.click&&a.click(s,l,o))return!0;let c=Vg(s.state,l.from,l.to);if(c)return s.dispatch({effects:Nh.of(c)}),!0;let h=Hg(s.state,l.from,l.to);return h?(s.dispatch({effects:Wv.of(h)}),!0):!1}}}),nF()]}const Dle=Ue.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Bh{constructor(e,r){this.specs=e;let n;function i(l){let o=el.newName();return(n||(n=Object.create(null)))["."+o]=l,o}const a=typeof r.all=="string"?r.all:r.all?i(r.all):void 0,s=r.scope;this.scope=s instanceof Ii?l=>l.prop(bu)==s.data:s?l=>l==s:void 0,this.style=G9(e.map(l=>({tag:l.tag,class:l.class||i(Object.assign({},l,{tag:null}))})),{all:a}).style,this.module=n?new el(n):null,this.themeType=r.themeType}static define(e,r){return new Bh(e,r||{})}}const cT=We.define(),aF=We.define({combine(t){return t.length?[t[0]]:null}});function zC(t){let e=t.facet(cT);return e.length?e:t.facet(aF)}function sF(t,e){let r=[Nle],n;return t instanceof Bh&&(t.module&&r.push(Ue.styleModule.of(t.module)),n=t.themeType),e?.fallback?r.push(aF.of(t)):n?r.push(cT.computeN([Ue.darkTheme],i=>i.facet(Ue.darkTheme)==(n=="dark")?[t]:[])):r.push(cT.of(t)),r}class _le{constructor(e){this.markCache=Object.create(null),this.tree=bn(e.state),this.decorations=this.buildDeco(e,zC(e.state)),this.decoratedTo=e.viewport.to}update(e){let r=bn(e.state),n=zC(e.state),i=n!=zC(e.startState),{viewport:a}=e.view,s=e.changes.mapPos(this.decoratedTo,1);r.length<a.to&&!i&&r.type==this.tree.type&&s>=a.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=s):(r!=this.tree||e.viewportChanged||i)&&(this.tree=r,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=a.to)}buildDeco(e,r){if(!r||!this.tree.length)return ut.none;let n=new Wa;for(let{from:i,to:a}of e.visibleRanges)ele(this.tree,r,(s,l,o)=>{n.add(s,l,this.markCache[o]||(this.markCache[o]=ut.mark({class:o})))},i,a);return n.finish()}}const Nle=po.high(mr.fromClass(_le,{decorations:t=>t.decorations})),Ble=Bh.define([{tag:xe.meta,color:"#404740"},{tag:xe.link,textDecoration:"underline"},{tag:xe.heading,textDecoration:"underline",fontWeight:"bold"},{tag:xe.emphasis,fontStyle:"italic"},{tag:xe.strong,fontWeight:"bold"},{tag:xe.strikethrough,textDecoration:"line-through"},{tag:xe.keyword,color:"#708"},{tag:[xe.atom,xe.bool,xe.url,xe.contentSeparator,xe.labelName],color:"#219"},{tag:[xe.literal,xe.inserted],color:"#164"},{tag:[xe.string,xe.deleted],color:"#a11"},{tag:[xe.regexp,xe.escape,xe.special(xe.string)],color:"#e40"},{tag:xe.definition(xe.variableName),color:"#00f"},{tag:xe.local(xe.variableName),color:"#30a"},{tag:[xe.typeName,xe.namespace],color:"#085"},{tag:xe.className,color:"#167"},{tag:[xe.special(xe.variableName),xe.macroName],color:"#256"},{tag:xe.definition(xe.propertyName),color:"#00c"},{tag:xe.comment,color:"#940"},{tag:xe.invalid,color:"#f00"}]),Lle=Ue.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),lF=1e4,oF="()[]{}",uF=We.define({combine(t){return ya(t,{afterCursor:!0,brackets:oF,maxScanDistance:lF,renderMatch:Ile})}}),Ple=ut.mark({class:"cm-matchingBracket"}),zle=ut.mark({class:"cm-nonmatchingBracket"});function Ile(t){let e=[],r=t.matched?Ple:zle;return e.push(r.range(t.start.from,t.start.to)),t.end&&e.push(r.range(t.end.from,t.end.to)),e}function Pz(t){let e=[],r=t.facet(uF);for(let n of t.selection.ranges){if(!n.empty)continue;let i=ua(t,n.head,-1,r)||n.head>0&&ua(t,n.head-1,1,r)||r.afterCursor&&(ua(t,n.head,1,r)||n.head<t.doc.length&&ua(t,n.head+1,-1,r));i&&(e=e.concat(r.renderMatch(i,t)))}return ut.set(e,!0)}const qle=mr.fromClass(class{constructor(t){this.paused=!1,this.decorations=Pz(t.state)}update(t){(t.docChanged||t.selectionSet||this.paused)&&(t.view.composing?(this.decorations=this.decorations.map(t.changes),this.paused=!0):(this.decorations=Pz(t.state),this.paused=!1))}},{decorations:t=>t.decorations}),jle=[qle,Lle];function Fle(t={}){return[uF.of(t),jle]}const Hle=new Ct;function fT(t,e,r){let n=t.prop(e<0?Ct.openedBy:Ct.closedBy);if(n)return n;if(t.name.length==1){let i=r.indexOf(t.name);if(i>-1&&i%2==(e<0?1:0))return[r[i+e]]}return null}function hT(t){let e=t.type.prop(Hle);return e?e(t.node):t}function ua(t,e,r,n={}){let i=n.maxScanDistance||lF,a=n.brackets||oF,s=bn(t),l=s.resolveInner(e,r);for(let o=l;o;o=o.parent){let c=fT(o.type,r,a);if(c&&o.from<o.to){let h=hT(o);if(h&&(r>0?e>=h.from&&e<h.to:e>h.from&&e<=h.to))return Vle(t,e,r,o,h,c,a)}}return Ule(t,e,r,s,l.type,i,a)}function Vle(t,e,r,n,i,a,s){let l=n.parent,o={from:i.from,to:i.to},c=0,h=l?.cursor();if(h&&(r<0?h.childBefore(n.from):h.childAfter(n.to)))do if(r<0?h.to<=n.from:h.from>=n.to){if(c==0&&a.indexOf(h.type.name)>-1&&h.from<h.to){let d=hT(h);return{start:o,end:d?{from:d.from,to:d.to}:void 0,matched:!0}}else if(fT(h.type,r,s))c++;else if(fT(h.type,-r,s)){if(c==0){let d=hT(h);return{start:o,end:d&&d.from<d.to?{from:d.from,to:d.to}:void 0,matched:!1}}c--}}while(r<0?h.prevSibling():h.nextSibling());return{start:o,matched:!1}}function Ule(t,e,r,n,i,a,s){let l=r<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),o=s.indexOf(l);if(o<0||o%2==0!=r>0)return null;let c={from:r<0?e-1:e,to:r>0?e+1:e},h=t.doc.iterRange(e,r>0?t.doc.length:0),d=0;for(let g=0;!h.next().done&&g<=a;){let m=h.value;r<0&&(g+=m.length);let y=e+g*r;for(let b=r>0?0:m.length-1,x=r>0?m.length:-1;b!=x;b+=r){let w=s.indexOf(m[b]);if(!(w<0||n.resolveInner(y+b,1).type!=i))if(w%2==0==r>0)d++;else{if(d==1)return{start:c,end:{from:y+b,to:y+b+1},matched:w>>1==o>>1};d--}}r>0&&(g+=m.length)}return h.done?{start:c,matched:!1}:null}const $le=Object.create(null),zz=[Zn.none],Iz=[],qz=Object.create(null),Gle=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])Gle[t]=Yle($le,e);function IC(t,e){Iz.indexOf(t)>-1||(Iz.push(t),console.warn(e))}function Yle(t,e){let r=[];for(let l of e.split(" ")){let o=[];for(let c of l.split(".")){let h=t[c]||xe[c];h?typeof h=="function"?o.length?o=o.map(h):IC(c,`Modifier ${c} used at start of tag`):o.length?IC(c,`Tag ${c} used as modifier`):o=Array.isArray(h)?h:[h]:IC(c,`Unknown highlighting tag ${c}`)}for(let c of o)r.push(c)}if(!r.length)return 0;let n=e.replace(/ /g,"_"),i=n+" "+r.map(l=>l.id),a=qz[i];if(a)return a.id;let s=qz[i]=Zn.define({id:zz.length,name:n,props:[U9({[n]:r})]});return zz.push(s),s.id}Jt.RTL,Jt.LTR;const Xle=t=>{let{state:e}=t,r=e.doc.lineAt(e.selection.main.from),n=QE(t.state,r.from);return n.line?Wle(t):n.block?Kle(t):!1};function WE(t,e){return({state:r,dispatch:n})=>{if(r.readOnly)return!1;let i=t(e,r);return i?(n(r.update(i)),!0):!1}}const Wle=WE(eoe,0),Qle=WE(cF,0),Kle=WE((t,e)=>cF(t,e,Jle(e)),0);function QE(t,e){let r=t.languageDataAt("commentTokens",e,1);return r.length?r[0]:{}}const of=50;function Zle(t,{open:e,close:r},n,i){let a=t.sliceDoc(n-of,n),s=t.sliceDoc(i,i+of),l=/\s*$/.exec(a)[0].length,o=/^\s*/.exec(s)[0].length,c=a.length-l;if(a.slice(c-e.length,c)==e&&s.slice(o,o+r.length)==r)return{open:{pos:n-l,margin:l&&1},close:{pos:i+o,margin:o&&1}};let h,d;i-n<=2*of?h=d=t.sliceDoc(n,i):(h=t.sliceDoc(n,n+of),d=t.sliceDoc(i-of,i));let g=/^\s*/.exec(h)[0].length,m=/\s*$/.exec(d)[0].length,y=d.length-m-r.length;return h.slice(g,g+e.length)==e&&d.slice(y,y+r.length)==r?{open:{pos:n+g+e.length,margin:/\s/.test(h.charAt(g+e.length))?1:0},close:{pos:i-m-r.length,margin:/\s/.test(d.charAt(y-1))?1:0}}:null}function Jle(t){let e=[];for(let r of t.selection.ranges){let n=t.doc.lineAt(r.from),i=r.to<=n.to?n:t.doc.lineAt(r.to);i.from>n.from&&i.from==r.to&&(i=r.to==n.to+1?n:t.doc.lineAt(r.to-1));let a=e.length-1;a>=0&&e[a].to>n.from?e[a].to=i.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:i.to})}return e}function cF(t,e,r=e.selection.ranges){let n=r.map(a=>QE(e,a.from).block);if(!n.every(a=>a))return null;let i=r.map((a,s)=>Zle(e,n[s],a.from,a.to));if(t!=2&&!i.every(a=>a))return{changes:e.changes(r.map((a,s)=>i[s]?[]:[{from:a.from,insert:n[s].open+" "},{from:a.to,insert:" "+n[s].close}]))};if(t!=1&&i.some(a=>a)){let a=[];for(let s=0,l;s<i.length;s++)if(l=i[s]){let o=n[s],{open:c,close:h}=l;a.push({from:c.pos-o.open.length,to:c.pos+c.margin},{from:h.pos-h.margin,to:h.pos+o.close.length})}return{changes:a}}return null}function eoe(t,e,r=e.selection.ranges){let n=[],i=-1;e:for(let{from:a,to:s}of r){let l=n.length,o=1e9,c;for(let h=a;h<=s;){let d=e.doc.lineAt(h);if(c==null&&(c=QE(e,d.from).line,!c))continue e;if(d.from>i&&(a==s||s>d.from)){i=d.from;let g=/^\s*/.exec(d.text)[0].length,m=g==d.length,y=d.text.slice(g,g+c.length)==c?g:-1;g<d.text.length&&g<o&&(o=g),n.push({line:d,comment:y,token:c,indent:g,empty:m,single:!1})}h=d.to+1}if(o<1e9)for(let h=l;h<n.length;h++)n[h].indent<n[h].line.text.length&&(n[h].indent=o);n.length==l+1&&(n[l].single=!0)}if(t!=2&&n.some(a=>a.comment<0&&(!a.empty||a.single))){let a=[];for(let{line:l,token:o,indent:c,empty:h,single:d}of n)(d||!h)&&a.push({from:l.from+c,insert:o+" "});let s=e.changes(a);return{changes:s,selection:e.selection.map(s,1)}}else if(t!=1&&n.some(a=>a.comment>=0)){let a=[];for(let{line:s,comment:l,token:o}of n)if(l>=0){let c=s.from+l,h=c+o.length;s.text[h-s.from]==" "&&h++,a.push({from:c,to:h})}return{changes:a}}return null}const dT=ma.define(),toe=ma.define(),roe=We.define(),fF=We.define({combine(t){return ya(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,r)=>r},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,r)=>(n,i)=>e(n,i)||r(n,i)})}}),hF=Sn.define({create(){return ca.empty},update(t,e){let r=e.state.facet(fF),n=e.annotation(dT);if(n){let o=Wn.fromTransaction(e,n.selection),c=n.side,h=c==0?t.undone:t.done;return o?h=$g(h,h.length,r.minDepth,o):h=pF(h,e.startState.selection),new ca(c==0?n.rest:h,c==0?h:n.rest)}let i=e.annotation(toe);if((i=="full"||i=="before")&&(t=t.isolate()),e.annotation(Sr.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let a=Wn.fromTransaction(e),s=e.annotation(Sr.time),l=e.annotation(Sr.userEvent);return a?t=t.addChanges(a,s,l,r,e):e.selection&&(t=t.addSelection(e.startState.selection,s,l,r.newGroupDelay)),(i=="full"||i=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new ca(t.done.map(Wn.fromJSON),t.undone.map(Wn.fromJSON))}});function noe(t={}){return[hF,fF.of(t),Ue.domEventHandlers({beforeinput(e,r){let n=e.inputType=="historyUndo"?KE:e.inputType=="historyRedo"?Ug:null;return n?(e.preventDefault(),n(r)):!1}})]}function Qv(t,e){return function({state:r,dispatch:n}){if(!e&&r.readOnly)return!1;let i=r.field(hF,!1);if(!i)return!1;let a=i.pop(t,r,e);return a?(n(a),!0):!1}}const KE=Qv(0,!1),Ug=Qv(1,!1),ioe=Qv(0,!0),aoe=Qv(1,!0);class Wn{constructor(e,r,n,i,a){this.changes=e,this.effects=r,this.mapped=n,this.startSelection=i,this.selectionsAfter=a}setSelAfter(e){return new Wn(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,r,n;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(r=this.mapped)===null||r===void 0?void 0:r.toJSON(),startSelection:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(i=>i.toJSON())}}static fromJSON(e){return new Wn(e.changes&&Pr.fromJSON(e.changes),[],e.mapped&&ha.fromJSON(e.mapped),e.startSelection&&Ae.fromJSON(e.startSelection),e.selectionsAfter.map(Ae.fromJSON))}static fromTransaction(e,r){let n=Ei;for(let i of e.startState.facet(roe)){let a=i(e);a.length&&(n=n.concat(a))}return!n.length&&e.changes.empty?null:new Wn(e.changes.invert(e.startState.doc),n,void 0,r||e.startState.selection,Ei)}static selection(e){return new Wn(void 0,Ei,void 0,void 0,e)}}function $g(t,e,r,n){let i=e+1>r+20?e-r-1:0,a=t.slice(i,e);return a.push(n),a}function soe(t,e){let r=[],n=!1;return t.iterChangedRanges((i,a)=>r.push(i,a)),e.iterChangedRanges((i,a,s,l)=>{for(let o=0;o<r.length;){let c=r[o++],h=r[o++];l>=c&&s<=h&&(n=!0)}}),n}function loe(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((r,n)=>r.empty!=e.ranges[n].empty).length===0}function dF(t,e){return t.length?e.length?t.concat(e):t:e}const Ei=[],ooe=200;function pF(t,e){if(t.length){let r=t[t.length-1],n=r.selectionsAfter.slice(Math.max(0,r.selectionsAfter.length-ooe));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),$g(t,t.length-1,1e9,r.setSelAfter(n)))}else return[Wn.selection([e])]}function uoe(t){let e=t[t.length-1],r=t.slice();return r[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),r}function qC(t,e){if(!t.length)return t;let r=t.length,n=Ei;for(;r;){let i=coe(t[r-1],e,n);if(i.changes&&!i.changes.empty||i.effects.length){let a=t.slice(0,r);return a[r-1]=i,a}else e=i.mapped,r--,n=i.selectionsAfter}return n.length?[Wn.selection(n)]:Ei}function coe(t,e,r){let n=dF(t.selectionsAfter.length?t.selectionsAfter.map(l=>l.map(e)):Ei,r);if(!t.changes)return Wn.selection(n);let i=t.changes.map(e),a=e.mapDesc(t.changes,!0),s=t.mapped?t.mapped.composeDesc(a):a;return new Wn(i,yt.mapEffects(t.effects,e),s,t.startSelection.map(a),n)}const foe=/^(input\.type|delete)($|\.)/;class ca{constructor(e,r,n=0,i=void 0){this.done=e,this.undone=r,this.prevTime=n,this.prevUserEvent=i}isolate(){return this.prevTime?new ca(this.done,this.undone):this}addChanges(e,r,n,i,a){let s=this.done,l=s[s.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!n||foe.test(n))&&(!l.selectionsAfter.length&&r-this.prevTime<i.newGroupDelay&&i.joinToEvent(a,soe(l.changes,e.changes))||n=="input.type.compose")?s=$g(s,s.length-1,i.minDepth,new Wn(e.changes.compose(l.changes),dF(yt.mapEffects(e.effects,l.changes),l.effects),l.mapped,l.startSelection,Ei)):s=$g(s,s.length,i.minDepth,e),new ca(s,Ei,r,n)}addSelection(e,r,n,i){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:Ei;return a.length>0&&r-this.prevTime<i&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&loe(a[a.length-1],e)?this:new ca(pF(this.done,e),this.undone,r,n)}addMapping(e){return new ca(qC(this.done,e),qC(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,r,n){let i=e==0?this.done:this.undone;if(i.length==0)return null;let a=i[i.length-1],s=a.selectionsAfter[0]||(a.startSelection?a.startSelection.map(a.changes.invertedDesc,1):r.selection);if(n&&a.selectionsAfter.length)return r.update({selection:a.selectionsAfter[a.selectionsAfter.length-1],annotations:dT.of({side:e,rest:uoe(i),selection:s}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(a.changes){let l=i.length==1?Ei:i.slice(0,i.length-1);return a.mapped&&(l=qC(l,a.mapped)),r.update({changes:a.changes,selection:a.startSelection,effects:a.effects,annotations:dT.of({side:e,rest:l,selection:s}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}ca.empty=new ca(Ei,Ei);const hoe=[{key:"Mod-z",run:KE,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Ug,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Ug,preventDefault:!0},{key:"Mod-u",run:ioe,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:aoe,preventDefault:!0}];function nc(t,e){return Ae.create(t.ranges.map(e),t.mainIndex)}function Ui(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function $i({state:t,dispatch:e},r){let n=nc(t.selection,r);return n.eq(t.selection,!0)?!1:(e(Ui(t,n)),!0)}function Kv(t,e){return Ae.cursor(e?t.to:t.from)}function gF(t,e){return $i(t,r=>r.empty?t.moveByChar(r,e):Kv(r,e))}function Cn(t){return t.textDirectionAt(t.state.selection.main.head)==Jt.LTR}const vF=t=>gF(t,!Cn(t)),mF=t=>gF(t,Cn(t));function yF(t,e){return $i(t,r=>r.empty?t.moveByGroup(r,e):Kv(r,e))}const doe=t=>yF(t,!Cn(t)),poe=t=>yF(t,Cn(t));function goe(t,e,r){if(e.type.prop(r))return!0;let n=e.to-e.from;return n&&(n>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function Zv(t,e,r){let n=bn(t).resolveInner(e.head),i=r?Ct.closedBy:Ct.openedBy;for(let o=e.head;;){let c=r?n.childAfter(o):n.childBefore(o);if(!c)break;goe(t,c,i)?n=c:o=r?c.to:c.from}let a=n.type.prop(i),s,l;return a&&(s=r?ua(t,n.from,1):ua(t,n.to,-1))&&s.matched?l=r?s.end.to:s.end.from:l=r?n.to:n.from,Ae.cursor(l,r?-1:1)}const voe=t=>$i(t,e=>Zv(t.state,e,!Cn(t))),moe=t=>$i(t,e=>Zv(t.state,e,Cn(t)));function bF(t,e){return $i(t,r=>{if(!r.empty)return Kv(r,e);let n=t.moveVertically(r,e);return n.head!=r.head?n:t.moveToLineBoundary(r,e)})}const xF=t=>bF(t,!1),wF=t=>bF(t,!0);function SF(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,r=0,n=0,i;if(e){for(let a of t.state.facet(Ue.scrollMargins)){let s=a(t);s?.top&&(r=Math.max(s?.top,r)),s?.bottom&&(n=Math.max(s?.bottom,n))}i=t.scrollDOM.clientHeight-r-n}else i=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:r,marginBottom:n,selfScroll:e,height:Math.max(t.defaultLineHeight,i-5)}}function CF(t,e){let r=SF(t),{state:n}=t,i=nc(n.selection,s=>s.empty?t.moveVertically(s,e,r.height):Kv(s,e));if(i.eq(n.selection))return!1;let a;if(r.selfScroll){let s=t.coordsAtPos(n.selection.main.head),l=t.scrollDOM.getBoundingClientRect(),o=l.top+r.marginTop,c=l.bottom-r.marginBottom;s&&s.top>o&&s.bottom<c&&(a=Ue.scrollIntoView(i.main.head,{y:"start",yMargin:s.top-o}))}return t.dispatch(Ui(n,i),{effects:a}),!0}const jz=t=>CF(t,!1),pT=t=>CF(t,!0);function hl(t,e,r){let n=t.lineBlockAt(e.head),i=t.moveToLineBoundary(e,r);if(i.head==e.head&&i.head!=(r?n.to:n.from)&&(i=t.moveToLineBoundary(e,r,!1)),!r&&i.head==n.from&&n.length){let a=/^\s*/.exec(t.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;a&&e.head!=n.from+a&&(i=Ae.cursor(n.from+a))}return i}const yoe=t=>$i(t,e=>hl(t,e,!0)),boe=t=>$i(t,e=>hl(t,e,!1)),xoe=t=>$i(t,e=>hl(t,e,!Cn(t))),woe=t=>$i(t,e=>hl(t,e,Cn(t))),Soe=t=>$i(t,e=>Ae.cursor(t.lineBlockAt(e.head).from,1)),Coe=t=>$i(t,e=>Ae.cursor(t.lineBlockAt(e.head).to,-1));function koe(t,e,r){let n=!1,i=nc(t.selection,a=>{let s=ua(t,a.head,-1)||ua(t,a.head,1)||a.head>0&&ua(t,a.head-1,1)||a.head<t.doc.length&&ua(t,a.head+1,-1);if(!s||!s.end)return a;n=!0;let l=s.start.from==a.head?s.end.to:s.end.from;return Ae.cursor(l)});return n?(e(Ui(t,i)),!0):!1}const Toe=({state:t,dispatch:e})=>koe(t,e);function Di(t,e){let r=nc(t.state.selection,n=>{let i=e(n);return Ae.range(n.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)});return r.eq(t.state.selection)?!1:(t.dispatch(Ui(t.state,r)),!0)}function kF(t,e){return Di(t,r=>t.moveByChar(r,e))}const TF=t=>kF(t,!Cn(t)),EF=t=>kF(t,Cn(t));function AF(t,e){return Di(t,r=>t.moveByGroup(r,e))}const Eoe=t=>AF(t,!Cn(t)),Aoe=t=>AF(t,Cn(t)),Ooe=t=>Di(t,e=>Zv(t.state,e,!Cn(t))),Moe=t=>Di(t,e=>Zv(t.state,e,Cn(t)));function OF(t,e){return Di(t,r=>t.moveVertically(r,e))}const MF=t=>OF(t,!1),RF=t=>OF(t,!0);function DF(t,e){return Di(t,r=>t.moveVertically(r,e,SF(t).height))}const Fz=t=>DF(t,!1),Hz=t=>DF(t,!0),Roe=t=>Di(t,e=>hl(t,e,!0)),Doe=t=>Di(t,e=>hl(t,e,!1)),_oe=t=>Di(t,e=>hl(t,e,!Cn(t))),Noe=t=>Di(t,e=>hl(t,e,Cn(t))),Boe=t=>Di(t,e=>Ae.cursor(t.lineBlockAt(e.head).from)),Loe=t=>Di(t,e=>Ae.cursor(t.lineBlockAt(e.head).to)),Vz=({state:t,dispatch:e})=>(e(Ui(t,{anchor:0})),!0),Uz=({state:t,dispatch:e})=>(e(Ui(t,{anchor:t.doc.length})),!0),$z=({state:t,dispatch:e})=>(e(Ui(t,{anchor:t.selection.main.anchor,head:0})),!0),Gz=({state:t,dispatch:e})=>(e(Ui(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),Poe=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),zoe=({state:t,dispatch:e})=>{let r=Jv(t).map(({from:n,to:i})=>Ae.range(n,Math.min(i+1,t.doc.length)));return e(t.update({selection:Ae.create(r),userEvent:"select"})),!0},Ioe=({state:t,dispatch:e})=>{let r=nc(t.selection,n=>{let i=bn(t),a=i.resolveStack(n.from,1);if(n.empty){let s=i.resolveStack(n.from,-1);s.node.from>=a.node.from&&s.node.to<=a.node.to&&(a=s)}for(let s=a;s;s=s.next){let{node:l}=s;if((l.from<n.from&&l.to>=n.to||l.to>n.to&&l.from<=n.from)&&s.next)return Ae.range(l.to,l.from)}return n});return r.eq(t.selection)?!1:(e(Ui(t,r)),!0)};function _F(t,e){let{state:r}=t,n=r.selection,i=r.selection.ranges.slice();for(let a of r.selection.ranges){let s=r.doc.lineAt(a.head);if(e?s.to<t.state.doc.length:s.from>0)for(let l=a;;){let o=t.moveVertically(l,e);if(o.head<s.from||o.head>s.to){i.some(c=>c.head==o.head)||i.push(o);break}else{if(o.head==l.head)break;l=o}}}return i.length==n.ranges.length?!1:(t.dispatch(Ui(r,Ae.create(i,i.length-1))),!0)}const qoe=t=>_F(t,!1),joe=t=>_F(t,!0),Foe=({state:t,dispatch:e})=>{let r=t.selection,n=null;return r.ranges.length>1?n=Ae.create([r.main]):r.main.empty||(n=Ae.create([Ae.cursor(r.main.head)])),n?(e(Ui(t,n)),!0):!1};function Lh(t,e){if(t.state.readOnly)return!1;let r="delete.selection",{state:n}=t,i=n.changeByRange(a=>{let{from:s,to:l}=a;if(s==l){let o=e(a);o<s?(r="delete.backward",o=Rp(t,o,!1)):o>s&&(r="delete.forward",o=Rp(t,o,!0)),s=Math.min(s,o),l=Math.max(l,o)}else s=Rp(t,s,!1),l=Rp(t,l,!0);return s==l?{range:a}:{changes:{from:s,to:l},range:Ae.cursor(s,s<a.head?-1:1)}});return i.changes.empty?!1:(t.dispatch(n.update(i,{scrollIntoView:!0,userEvent:r,effects:r=="delete.selection"?Ue.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function Rp(t,e,r){if(t instanceof Ue)for(let n of t.state.facet(Ue.atomicRanges).map(i=>i(t)))n.between(e,e,(i,a)=>{i<e&&a>e&&(e=r?a:i)});return e}const NF=(t,e,r)=>Lh(t,n=>{let i=n.from,{state:a}=t,s=a.doc.lineAt(i),l,o;if(r&&!e&&i>s.from&&i<s.from+200&&!/[^ \t]/.test(l=s.text.slice(0,i-s.from))){if(l[l.length-1]==" ")return i-1;let c=rc(l,a.tabSize),h=c%Fg(a)||Fg(a);for(let d=0;d<h&&l[l.length-1-d]==" ";d++)i--;o=i}else o=Wr(s.text,i-s.from,e,e)+s.from,o==i&&s.number!=(e?a.doc.lines:1)?o+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(s.text.slice(o-s.from,i-s.from))&&(o=Wr(s.text,o-s.from,!1,!1)+s.from);return o}),gT=t=>NF(t,!1,!0),BF=t=>NF(t,!0,!1),LF=(t,e)=>Lh(t,r=>{let n=r.head,{state:i}=t,a=i.doc.lineAt(n),s=i.charCategorizer(n);for(let l=null;;){if(n==(e?a.to:a.from)){n==r.head&&a.number!=(e?i.doc.lines:1)&&(n+=e?1:-1);break}let o=Wr(a.text,n-a.from,e)+a.from,c=a.text.slice(Math.min(n,o)-a.from,Math.max(n,o)-a.from),h=s(c);if(l!=null&&h!=l)break;(c!=" "||n!=r.head)&&(l=h),n=o}return n}),PF=t=>LF(t,!1),Hoe=t=>LF(t,!0),Voe=t=>Lh(t,e=>{let r=t.lineBlockAt(e.head).to;return e.head<r?r:Math.min(t.state.doc.length,e.head+1)}),Uoe=t=>Lh(t,e=>{let r=t.moveToLineBoundary(e,!1).head;return e.head>r?r:Math.max(0,e.head-1)}),$oe=t=>Lh(t,e=>{let r=t.moveToLineBoundary(e,!0).head;return e.head<r?r:Math.min(t.state.doc.length,e.head+1)}),Goe=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:Nt.of(["",""])},range:Ae.cursor(n.from)}));return e(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0},Yoe=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{if(!n.empty||n.from==0||n.from==t.doc.length)return{range:n};let i=n.from,a=t.doc.lineAt(i),s=i==a.from?i-1:Wr(a.text,i-a.from,!1)+a.from,l=i==a.to?i+1:Wr(a.text,i-a.from,!0)+a.from;return{changes:{from:s,to:l,insert:t.doc.slice(i,l).append(t.doc.slice(s,i))},range:Ae.cursor(l)}});return r.changes.empty?!1:(e(t.update(r,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Jv(t){let e=[],r=-1;for(let n of t.selection.ranges){let i=t.doc.lineAt(n.from),a=t.doc.lineAt(n.to);if(!n.empty&&n.to==a.from&&(a=t.doc.lineAt(n.to-1)),r>=i.number){let s=e[e.length-1];s.to=a.to,s.ranges.push(n)}else e.push({from:i.from,to:a.to,ranges:[n]});r=a.number+1}return e}function zF(t,e,r){if(t.readOnly)return!1;let n=[],i=[];for(let a of Jv(t)){if(r?a.to==t.doc.length:a.from==0)continue;let s=t.doc.lineAt(r?a.to+1:a.from-1),l=s.length+1;if(r){n.push({from:a.to,to:s.to},{from:a.from,insert:s.text+t.lineBreak});for(let o of a.ranges)i.push(Ae.range(Math.min(t.doc.length,o.anchor+l),Math.min(t.doc.length,o.head+l)))}else{n.push({from:s.from,to:a.from},{from:a.to,insert:t.lineBreak+s.text});for(let o of a.ranges)i.push(Ae.range(o.anchor-l,o.head-l))}}return n.length?(e(t.update({changes:n,scrollIntoView:!0,selection:Ae.create(i,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const Xoe=({state:t,dispatch:e})=>zF(t,e,!1),Woe=({state:t,dispatch:e})=>zF(t,e,!0);function IF(t,e,r){if(t.readOnly)return!1;let n=[];for(let a of Jv(t))r?n.push({from:a.from,insert:t.doc.slice(a.from,a.to)+t.lineBreak}):n.push({from:a.to,insert:t.lineBreak+t.doc.slice(a.from,a.to)});let i=t.changes(n);return e(t.update({changes:i,selection:t.selection.map(i,r?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const Qoe=({state:t,dispatch:e})=>IF(t,e,!1),Koe=({state:t,dispatch:e})=>IF(t,e,!0),Zoe=t=>{if(t.state.readOnly)return!1;let{state:e}=t,r=e.changes(Jv(e).map(({from:i,to:a})=>(i>0?i--:a<e.doc.length&&a++,{from:i,to:a}))),n=nc(e.selection,i=>{let a;if(t.lineWrapping){let s=t.lineBlockAt(i.head),l=t.coordsAtPos(i.head,i.assoc||1);l&&(a=s.bottom+t.documentTop-l.bottom+t.defaultLineHeight/2)}return t.moveVertically(i,!0,a)}).map(r);return t.dispatch({changes:r,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0};function Joe(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let r=bn(t).resolveInner(e),n=r.childBefore(e),i=r.childAfter(e),a;return n&&i&&n.to<=e&&i.from>=e&&(a=n.type.prop(Ct.closedBy))&&a.indexOf(i.name)>-1&&t.doc.lineAt(n.to).from==t.doc.lineAt(i.from).from&&!/\S/.test(t.sliceDoc(n.to,i.from))?{from:n.to,to:i.from}:null}const Yz=qF(!1),eue=qF(!0);function qF(t){return({state:e,dispatch:r})=>{if(e.readOnly)return!1;let n=e.changeByRange(i=>{let{from:a,to:s}=i,l=e.doc.lineAt(a),o=!t&&a==s&&Joe(e,a);t&&(a=s=(s<=l.to?l:e.doc.lineAt(s)).to);let c=new Xv(e,{simulateBreak:a,simulateDoubleBreak:!!o}),h=YE(c,a);for(h==null&&(h=rc(/^\s*/.exec(e.doc.lineAt(a).text)[0],e.tabSize));s<l.to&&/\s/.test(l.text[s-l.from]);)s++;o?{from:a,to:s}=o:a>l.from&&a<l.from+100&&!/\S/.test(l.text.slice(0,a))&&(a=l.from);let d=["",ih(e,h)];return o&&d.push(ih(e,c.lineIndent(l.from,-1))),{changes:{from:a,to:s,insert:Nt.of(d)},range:Ae.cursor(a+1+d[1].length)}});return r(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}}function ZE(t,e){let r=-1;return t.changeByRange(n=>{let i=[];for(let s=n.from;s<=n.to;){let l=t.doc.lineAt(s);l.number>r&&(n.empty||n.to>l.from)&&(e(l,i,n),r=l.number),s=l.to+1}let a=t.changes(i);return{changes:i,range:Ae.range(a.mapPos(n.anchor,1),a.mapPos(n.head,1))}})}const tue=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=Object.create(null),n=new Xv(t,{overrideIndentation:a=>{let s=r[a];return s??-1}}),i=ZE(t,(a,s,l)=>{let o=YE(n,a.from);if(o==null)return;/\S/.test(a.text)||(o=0);let c=/^\s*/.exec(a.text)[0],h=ih(t,o);(c!=h||l.from<a.from+c.length)&&(r[a.from]=o,s.push({from:a.from,to:a.from+c.length,insert:h}))});return i.changes.empty||e(t.update(i,{userEvent:"indent"})),!0},jF=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(ZE(t,(r,n)=>{n.push({from:r.from,insert:t.facet(Yv)})}),{userEvent:"input.indent"})),!0),FF=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(ZE(t,(r,n)=>{let i=/^\s*/.exec(r.text)[0];if(!i)return;let a=rc(i,t.tabSize),s=0,l=ih(t,Math.max(0,a-Fg(t)));for(;s<i.length&&s<l.length&&i.charCodeAt(s)==l.charCodeAt(s);)s++;n.push({from:r.from+s,to:r.from+i.length,insert:l.slice(s)})}),{userEvent:"delete.dedent"})),!0),rue=t=>(t.setTabFocusMode(),!0),nue=[{key:"Ctrl-b",run:vF,shift:TF,preventDefault:!0},{key:"Ctrl-f",run:mF,shift:EF},{key:"Ctrl-p",run:xF,shift:MF},{key:"Ctrl-n",run:wF,shift:RF},{key:"Ctrl-a",run:Soe,shift:Boe},{key:"Ctrl-e",run:Coe,shift:Loe},{key:"Ctrl-d",run:BF},{key:"Ctrl-h",run:gT},{key:"Ctrl-k",run:Voe},{key:"Ctrl-Alt-h",run:PF},{key:"Ctrl-o",run:Goe},{key:"Ctrl-t",run:Yoe},{key:"Ctrl-v",run:pT}],iue=[{key:"ArrowLeft",run:vF,shift:TF,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:doe,shift:Eoe,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:xoe,shift:_oe,preventDefault:!0},{key:"ArrowRight",run:mF,shift:EF,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:poe,shift:Aoe,preventDefault:!0},{mac:"Cmd-ArrowRight",run:woe,shift:Noe,preventDefault:!0},{key:"ArrowUp",run:xF,shift:MF,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Vz,shift:$z},{mac:"Ctrl-ArrowUp",run:jz,shift:Fz},{key:"ArrowDown",run:wF,shift:RF,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Uz,shift:Gz},{mac:"Ctrl-ArrowDown",run:pT,shift:Hz},{key:"PageUp",run:jz,shift:Fz},{key:"PageDown",run:pT,shift:Hz},{key:"Home",run:boe,shift:Doe,preventDefault:!0},{key:"Mod-Home",run:Vz,shift:$z},{key:"End",run:yoe,shift:Roe,preventDefault:!0},{key:"Mod-End",run:Uz,shift:Gz},{key:"Enter",run:Yz,shift:Yz},{key:"Mod-a",run:Poe},{key:"Backspace",run:gT,shift:gT,preventDefault:!0},{key:"Delete",run:BF,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:PF,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Hoe,preventDefault:!0},{mac:"Mod-Backspace",run:Uoe,preventDefault:!0},{mac:"Mod-Delete",run:$oe,preventDefault:!0}].concat(nue.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),aue=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:voe,shift:Ooe},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:moe,shift:Moe},{key:"Alt-ArrowUp",run:Xoe},{key:"Shift-Alt-ArrowUp",run:Qoe},{key:"Alt-ArrowDown",run:Woe},{key:"Shift-Alt-ArrowDown",run:Koe},{key:"Mod-Alt-ArrowUp",run:qoe},{key:"Mod-Alt-ArrowDown",run:joe},{key:"Escape",run:Foe},{key:"Mod-Enter",run:eue},{key:"Alt-l",mac:"Ctrl-l",run:zoe},{key:"Mod-i",run:Ioe,preventDefault:!0},{key:"Mod-[",run:FF},{key:"Mod-]",run:jF},{key:"Mod-Alt-\\",run:tue},{key:"Shift-Mod-k",run:Zoe},{key:"Shift-Mod-\\",run:Toe},{key:"Mod-/",run:Xle},{key:"Alt-A",run:Qle},{key:"Ctrl-m",mac:"Shift-Alt-m",run:rue}].concat(iue),sue={key:"Tab",run:jF,shift:FF},Xz=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class Vu{constructor(e,r,n=0,i=e.length,a,s){this.test=s,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,i),this.bufferStart=n,this.normalize=a?l=>a(Xz(l)):Xz,this.query=this.normalize(r)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Vn(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let r=kE(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=aa(e);let i=this.normalize(r);if(i.length)for(let a=0,s=n;;a++){let l=i.charCodeAt(a),o=this.match(l,s,this.bufferPos+this.bufferStart);if(a==i.length-1){if(o)return this.value=o,this;break}s==n&&a<r.length&&r.charCodeAt(a)==l&&s++}}}match(e,r,n){let i=null;for(let a=0;a<this.matches.length;a+=2){let s=this.matches[a],l=!1;this.query.charCodeAt(s)==e&&(s==this.query.length-1?i={from:this.matches[a+1],to:n}:(this.matches[a]++,l=!0)),l||(this.matches.splice(a,2),a-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?i={from:r,to:n}:this.matches.push(1,r)),i&&this.test&&!this.test(i.from,i.to,this.buffer,this.bufferStart)&&(i=null),i}}typeof Symbol<"u"&&(Vu.prototype[Symbol.iterator]=function(){return this});const HF={from:-1,to:-1,match:/.*/.exec("")},JE="gm"+(/x/.unicode==null?"":"u");class VF{constructor(e,r,n,i=0,a=e.length){if(this.text=e,this.to=a,this.curLine="",this.done=!1,this.value=HF,/\\[sWDnr]|\n|\r|\[\^/.test(r))return new UF(e,r,n,i,a);this.re=new RegExp(r,JE+(n?.ignoreCase?"i":"")),this.test=n?.test,this.iter=e.iter();let s=e.lineAt(i);this.curLineStart=s.from,this.matchPos=Gg(e,i),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let r=this.matchPos<=this.to&&this.re.exec(this.curLine);if(r){let n=this.curLineStart+r.index,i=n+r[0].length;if(this.matchPos=Gg(this.text,i+(n==i?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<i||n>this.value.to)&&(!this.test||this.test(n,i,r)))return this.value={from:n,to:i,match:r},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const jC=new WeakMap;class Ru{constructor(e,r){this.from=e,this.text=r}get to(){return this.from+this.text.length}static get(e,r,n){let i=jC.get(e);if(!i||i.from>=n||i.to<=r){let l=new Ru(r,e.sliceString(r,n));return jC.set(e,l),l}if(i.from==r&&i.to==n)return i;let{text:a,from:s}=i;return s>r&&(a=e.sliceString(r,s)+a,s=r),i.to<n&&(a+=e.sliceString(i.to,n)),jC.set(e,new Ru(s,a)),new Ru(r,a.slice(r-s,n-s))}}class UF{constructor(e,r,n,i,a){this.text=e,this.to=a,this.done=!1,this.value=HF,this.matchPos=Gg(e,i),this.re=new RegExp(r,JE+(n?.ignoreCase?"i":"")),this.test=n?.test,this.flat=Ru.get(e,i,this.chunkEnd(i+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,r=this.re.exec(this.flat.text);if(r&&!r[0]&&r.index==e&&(this.re.lastIndex=e+1,r=this.re.exec(this.flat.text)),r){let n=this.flat.from+r.index,i=n+r[0].length;if((this.flat.to>=this.to||r.index+r[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,i,r)))return this.value={from:n,to:i,match:r},this.matchPos=Gg(this.text,i+(n==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ru.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(VF.prototype[Symbol.iterator]=UF.prototype[Symbol.iterator]=function(){return this});function lue(t){try{return new RegExp(t,JE),!0}catch{return!1}}function Gg(t,e){if(e>=t.length)return e;let r=t.lineAt(e),n;for(;e<r.to&&(n=r.text.charCodeAt(e-r.from))>=56320&&n<57344;)e++;return e}const oue=t=>{let{state:e}=t,r=String(e.doc.lineAt(t.state.selection.main.head).number),{close:n,result:i}=Ase(t,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:r},focus:!0,submitLabel:e.phrase("go")});return i.then(a=>{let s=a&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(a.elements.line.value);if(!s){t.dispatch({effects:n});return}let l=e.doc.lineAt(e.selection.main.head),[,o,c,h,d]=s,g=h?+h.slice(1):0,m=c?+c:l.number;if(c&&d){let x=m/100;o&&(x=x*(o=="-"?-1:1)+l.number/e.doc.lines),m=Math.round(e.doc.lines*x)}else c&&o&&(m=m*(o=="-"?-1:1)+l.number);let y=e.doc.line(Math.max(1,Math.min(e.doc.lines,m))),b=Ae.cursor(y.from+Math.max(0,Math.min(g,y.length)));t.dispatch({effects:[n,Ue.scrollIntoView(b.from,{y:"center"})],selection:b})}),!0},uue={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},cue=We.define({combine(t){return ya(t,uue,{highlightWordAroundCursor:(e,r)=>e||r,minSelectionLength:Math.min,maxMatches:Math.min})}});function fue(t){return[vue,gue]}const hue=ut.mark({class:"cm-selectionMatch"}),due=ut.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Wz(t,e,r,n){return(r==0||t(e.sliceDoc(r-1,r))!=cr.Word)&&(n==e.doc.length||t(e.sliceDoc(n,n+1))!=cr.Word)}function pue(t,e,r,n){return t(e.sliceDoc(r,r+1))==cr.Word&&t(e.sliceDoc(n-1,n))==cr.Word}const gue=mr.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(cue),{state:r}=t,n=r.selection;if(n.ranges.length>1)return ut.none;let i=n.main,a,s=null;if(i.empty){if(!e.highlightWordAroundCursor)return ut.none;let o=r.wordAt(i.head);if(!o)return ut.none;s=r.charCategorizer(i.head),a=r.sliceDoc(o.from,o.to)}else{let o=i.to-i.from;if(o<e.minSelectionLength||o>200)return ut.none;if(e.wholeWords){if(a=r.sliceDoc(i.from,i.to),s=r.charCategorizer(i.head),!(Wz(s,r,i.from,i.to)&&pue(s,r,i.from,i.to)))return ut.none}else if(a=r.sliceDoc(i.from,i.to),!a)return ut.none}let l=[];for(let o of t.visibleRanges){let c=new Vu(r.doc,a,o.from,o.to);for(;!c.next().done;){let{from:h,to:d}=c.value;if((!s||Wz(s,r,h,d))&&(i.empty&&h<=i.from&&d>=i.to?l.push(due.range(h,d)):(h>=i.to||d<=i.from)&&l.push(hue.range(h,d)),l.length>e.maxMatches))return ut.none}}return ut.set(l)}},{decorations:t=>t.decorations}),vue=Ue.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),mue=({state:t,dispatch:e})=>{let{selection:r}=t,n=Ae.create(r.ranges.map(i=>t.wordAt(i.head)||Ae.cursor(i.head)),r.mainIndex);return n.eq(r)?!1:(e(t.update({selection:n})),!0)};function yue(t,e){let{main:r,ranges:n}=t.selection,i=t.wordAt(r.head),a=i&&i.from==r.from&&i.to==r.to;for(let s=!1,l=new Vu(t.doc,e,n[n.length-1].to);;)if(l.next(),l.done){if(s)return null;l=new Vu(t.doc,e,0,Math.max(0,n[n.length-1].from-1)),s=!0}else{if(s&&n.some(o=>o.from==l.value.from))continue;if(a){let o=t.wordAt(l.value.from);if(!o||o.from!=l.value.from||o.to!=l.value.to)continue}return l.value}}const bue=({state:t,dispatch:e})=>{let{ranges:r}=t.selection;if(r.some(a=>a.from===a.to))return mue({state:t,dispatch:e});let n=t.sliceDoc(r[0].from,r[0].to);if(t.selection.ranges.some(a=>t.sliceDoc(a.from,a.to)!=n))return!1;let i=yue(t,n);return i?(e(t.update({selection:t.selection.addRange(Ae.range(i.from,i.to),!1),effects:Ue.scrollIntoView(i.to)})),!0):!1},ic=We.define({combine(t){return ya(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Nue(e),scrollToMatch:e=>Ue.scrollIntoView(e)})}});class $F{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||lue(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(r,n)=>n=="n"?`
426
+ `:n=="r"?"\r":n=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new Tue(this):new Sue(this)}getCursor(e,r=0,n){let i=e.doc?e:Dt.create({doc:e});return n==null&&(n=i.doc.length),this.regexp?cu(this,i,r,n):uu(this,i,r,n)}}class GF{constructor(e){this.spec=e}}function xue(t,e,r){return(n,i,a,s)=>{if(r&&!r(n,i,a,s))return!1;let l=n>=s&&i<=s+a.length?a.slice(n-s,i-s):e.doc.sliceString(n,i);return t(l,e,n,i)}}function uu(t,e,r,n){let i;return t.wholeWord&&(i=wue(e.doc,e.charCategorizer(e.selection.main.head))),t.test&&(i=xue(t.test,e,i)),new Vu(e.doc,t.unquoted,r,n,t.caseSensitive?void 0:a=>a.toLowerCase(),i)}function wue(t,e){return(r,n,i,a)=>((a>r||a+i.length<n)&&(a=Math.max(0,r-2),i=t.sliceString(a,Math.min(t.length,n+2))),(e(Yg(i,r-a))!=cr.Word||e(Xg(i,r-a))!=cr.Word)&&(e(Xg(i,n-a))!=cr.Word||e(Yg(i,n-a))!=cr.Word))}class Sue extends GF{constructor(e){super(e)}nextMatch(e,r,n){let i=uu(this.spec,e,n,e.doc.length).nextOverlapping();if(i.done){let a=Math.min(e.doc.length,r+this.spec.unquoted.length);i=uu(this.spec,e,0,a).nextOverlapping()}return i.done||i.value.from==r&&i.value.to==n?null:i.value}prevMatchInRange(e,r,n){for(let i=n;;){let a=Math.max(r,i-1e4-this.spec.unquoted.length),s=uu(this.spec,e,a,i),l=null;for(;!s.nextOverlapping().done;)l=s.value;if(l)return l;if(a==r)return null;i-=1e4}}prevMatch(e,r,n){let i=this.prevMatchInRange(e,0,r);return i||(i=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length)),i&&(i.from!=r||i.to!=n)?i:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,r){let n=uu(this.spec,e,0,e.doc.length),i=[];for(;!n.next().done;){if(i.length>=r)return null;i.push(n.value)}return i}highlight(e,r,n,i){let a=uu(this.spec,e,Math.max(0,r-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!a.next().done;)i(a.value.from,a.value.to)}}function Cue(t,e,r){return(n,i,a)=>(!r||r(n,i,a))&&t(a[0],e,n,i)}function cu(t,e,r,n){let i;return t.wholeWord&&(i=kue(e.charCategorizer(e.selection.main.head))),t.test&&(i=Cue(t.test,e,i)),new VF(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:i},r,n)}function Yg(t,e){return t.slice(Wr(t,e,!1),e)}function Xg(t,e){return t.slice(e,Wr(t,e))}function kue(t){return(e,r,n)=>!n[0].length||(t(Yg(n.input,n.index))!=cr.Word||t(Xg(n.input,n.index))!=cr.Word)&&(t(Xg(n.input,n.index+n[0].length))!=cr.Word||t(Yg(n.input,n.index+n[0].length))!=cr.Word)}class Tue extends GF{nextMatch(e,r,n){let i=cu(this.spec,e,n,e.doc.length).next();return i.done&&(i=cu(this.spec,e,0,r).next()),i.done?null:i.value}prevMatchInRange(e,r,n){for(let i=1;;i++){let a=Math.max(r,n-i*1e4),s=cu(this.spec,e,a,n),l=null;for(;!s.next().done;)l=s.value;if(l&&(a==r||l.from>a+10))return l;if(a==r)return null}}prevMatch(e,r,n){return this.prevMatchInRange(e,0,r)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(r,n)=>{if(n=="&")return e.match[0];if(n=="$")return"$";for(let i=n.length;i>0;i--){let a=+n.slice(0,i);if(a>0&&a<e.match.length)return e.match[a]+n.slice(i)}return r})}matchAll(e,r){let n=cu(this.spec,e,0,e.doc.length),i=[];for(;!n.next().done;){if(i.length>=r)return null;i.push(n.value)}return i}highlight(e,r,n,i){let a=cu(this.spec,e,Math.max(0,r-250),Math.min(n+250,e.doc.length));for(;!a.next().done;)i(a.value.from,a.value.to)}}const ah=yt.define(),eA=yt.define(),$s=Sn.define({create(t){return new FC(vT(t).create(),null)},update(t,e){for(let r of e.effects)r.is(ah)?t=new FC(r.value.create(),t.panel):r.is(eA)&&(t=new FC(t.query,r.value?tA:null));return t},provide:t=>th.from(t,e=>e.panel)});class FC{constructor(e,r){this.query=e,this.panel=r}}const Eue=ut.mark({class:"cm-searchMatch"}),Aue=ut.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Oue=mr.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field($s))}update(t){let e=t.state.field($s);(e!=t.startState.field($s)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ut.none;let{view:r}=this,n=new Wa;for(let i=0,a=r.visibleRanges,s=a.length;i<s;i++){let{from:l,to:o}=a[i];for(;i<s-1&&o>a[i+1].from-500;)o=a[++i].to;t.highlight(r.state,l,o,(c,h)=>{let d=r.state.selection.ranges.some(g=>g.from==c&&g.to==h);n.add(c,h,d?Aue:Eue)})}return n.finish()}},{decorations:t=>t.decorations});function Ph(t){return e=>{let r=e.state.field($s,!1);return r&&r.query.spec.valid?t(e,r):WF(e)}}const Wg=Ph((t,{query:e})=>{let{to:r}=t.state.selection.main,n=e.nextMatch(t.state,r,r);if(!n)return!1;let i=Ae.single(n.from,n.to),a=t.state.facet(ic);return t.dispatch({selection:i,effects:[rA(t,n),a.scrollToMatch(i.main,t)],userEvent:"select.search"}),XF(t),!0}),Qg=Ph((t,{query:e})=>{let{state:r}=t,{from:n}=r.selection.main,i=e.prevMatch(r,n,n);if(!i)return!1;let a=Ae.single(i.from,i.to),s=t.state.facet(ic);return t.dispatch({selection:a,effects:[rA(t,i),s.scrollToMatch(a.main,t)],userEvent:"select.search"}),XF(t),!0}),Mue=Ph((t,{query:e})=>{let r=e.matchAll(t.state,1e3);return!r||!r.length?!1:(t.dispatch({selection:Ae.create(r.map(n=>Ae.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),Rue=({state:t,dispatch:e})=>{let r=t.selection;if(r.ranges.length>1||r.main.empty)return!1;let{from:n,to:i}=r.main,a=[],s=0;for(let l=new Vu(t.doc,t.sliceDoc(n,i));!l.next().done;){if(a.length>1e3)return!1;l.value.from==n&&(s=a.length),a.push(Ae.range(l.value.from,l.value.to))}return e(t.update({selection:Ae.create(a,s),userEvent:"select.search.matches"})),!0},Qz=Ph((t,{query:e})=>{let{state:r}=t,{from:n,to:i}=r.selection.main;if(r.readOnly)return!1;let a=e.nextMatch(r,n,n);if(!a)return!1;let s=a,l=[],o,c,h=[];s.from==n&&s.to==i&&(c=r.toText(e.getReplacement(s)),l.push({from:s.from,to:s.to,insert:c}),s=e.nextMatch(r,s.from,s.to),h.push(Ue.announce.of(r.phrase("replaced match on line $",r.doc.lineAt(n).number)+".")));let d=t.state.changes(l);return s&&(o=Ae.single(s.from,s.to).map(d),h.push(rA(t,s)),h.push(r.facet(ic).scrollToMatch(o.main,t))),t.dispatch({changes:d,selection:o,effects:h,userEvent:"input.replace"}),!0}),Due=Ph((t,{query:e})=>{if(t.state.readOnly)return!1;let r=e.matchAll(t.state,1e9).map(i=>{let{from:a,to:s}=i;return{from:a,to:s,insert:e.getReplacement(i)}});if(!r.length)return!1;let n=t.state.phrase("replaced $ matches",r.length)+".";return t.dispatch({changes:r,effects:Ue.announce.of(n),userEvent:"input.replace.all"}),!0});function tA(t){return t.state.facet(ic).createPanel(t)}function vT(t,e){var r,n,i,a,s;let l=t.selection.main,o=l.empty||l.to>l.from+100?"":t.sliceDoc(l.from,l.to);if(e&&!o)return e;let c=t.facet(ic);return new $F({search:((r=e?.literal)!==null&&r!==void 0?r:c.literal)?o:o.replace(/\n/g,"\\n"),caseSensitive:(n=e?.caseSensitive)!==null&&n!==void 0?n:c.caseSensitive,literal:(i=e?.literal)!==null&&i!==void 0?i:c.literal,regexp:(a=e?.regexp)!==null&&a!==void 0?a:c.regexp,wholeWord:(s=e?.wholeWord)!==null&&s!==void 0?s:c.wholeWord})}function YF(t){let e=HE(t,tA);return e&&e.dom.querySelector("[main-field]")}function XF(t){let e=YF(t);e&&e==t.root.activeElement&&e.select()}const WF=t=>{let e=t.state.field($s,!1);if(e&&e.panel){let r=YF(t);if(r&&r!=t.root.activeElement){let n=vT(t.state,e.query.spec);n.valid&&t.dispatch({effects:ah.of(n)}),r.focus(),r.select()}}else t.dispatch({effects:[eA.of(!0),e?ah.of(vT(t.state,e.query.spec)):yt.appendConfig.of(Lue)]});return!0},QF=t=>{let e=t.state.field($s,!1);if(!e||!e.panel)return!1;let r=HE(t,tA);return r&&r.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:eA.of(!1)}),!0},_ue=[{key:"Mod-f",run:WF,scope:"editor search-panel"},{key:"F3",run:Wg,shift:Qg,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Wg,shift:Qg,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:QF,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Rue},{key:"Mod-Alt-g",run:oue},{key:"Mod-d",run:bue,preventDefault:!0}];class Nue{constructor(e){this.view=e;let r=this.query=e.state.field($s).query.spec;this.commit=this.commit.bind(this),this.searchField=Wt("input",{value:r.search,placeholder:li(e,"Find"),"aria-label":li(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Wt("input",{value:r.replace,placeholder:li(e,"Replace"),"aria-label":li(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Wt("input",{type:"checkbox",name:"case",form:"",checked:r.caseSensitive,onchange:this.commit}),this.reField=Wt("input",{type:"checkbox",name:"re",form:"",checked:r.regexp,onchange:this.commit}),this.wordField=Wt("input",{type:"checkbox",name:"word",form:"",checked:r.wholeWord,onchange:this.commit});function n(i,a,s){return Wt("button",{class:"cm-button",name:i,onclick:a,type:"button"},s)}this.dom=Wt("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,n("next",()=>Wg(e),[li(e,"next")]),n("prev",()=>Qg(e),[li(e,"previous")]),n("select",()=>Mue(e),[li(e,"all")]),Wt("label",null,[this.caseField,li(e,"match case")]),Wt("label",null,[this.reField,li(e,"regexp")]),Wt("label",null,[this.wordField,li(e,"by word")]),...e.state.readOnly?[]:[Wt("br"),this.replaceField,n("replace",()=>Qz(e),[li(e,"replace")]),n("replaceAll",()=>Due(e),[li(e,"replace all")])],Wt("button",{name:"close",onclick:()=>QF(e),"aria-label":li(e,"close"),type:"button"},["×"])])}commit(){let e=new $F({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:ah.of(e)}))}keydown(e){zae(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Qg:Wg)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Qz(this.view))}update(e){for(let r of e.transactions)for(let n of r.effects)n.is(ah)&&!n.value.eq(this.query)&&this.setQuery(n.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(ic).top}}function li(t,e){return t.state.phrase(e)}const Dp=30,_p=/[\s\.,:;?!]/;function rA(t,{from:e,to:r}){let n=t.state.doc.lineAt(e),i=t.state.doc.lineAt(r).to,a=Math.max(n.from,e-Dp),s=Math.min(i,r+Dp),l=t.state.sliceDoc(a,s);if(a!=n.from){for(let o=0;o<Dp;o++)if(!_p.test(l[o+1])&&_p.test(l[o])){l=l.slice(o);break}}if(s!=i){for(let o=l.length-1;o>l.length-Dp;o--)if(!_p.test(l[o-1])&&_p.test(l[o])){l=l.slice(0,o);break}}return Ue.announce.of(`${t.state.phrase("current match")}. ${l} ${t.state.phrase("on line")} ${n.number}.`)}const Bue=Ue.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),Lue=[$s,po.low(Oue),Bue];class KF{constructor(e,r,n,i){this.state=e,this.pos=r,this.explicit=n,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let r=bn(this.state).resolveInner(this.pos,-1);for(;r&&e.indexOf(r.name)<0;)r=r.parent;return r?{from:r.from,to:this.pos,text:this.state.sliceDoc(r.from,this.pos),type:r.type}:null}matchBefore(e){let r=this.state.doc.lineAt(this.pos),n=Math.max(r.from,this.pos-250),i=r.text.slice(n-r.from,this.pos-r.from),a=i.search(ZF(e,!1));return a<0?null:{from:n+a,to:this.pos,text:i.slice(a)}}get aborted(){return this.abortListeners==null}addEventListener(e,r,n){e=="abort"&&this.abortListeners&&(this.abortListeners.push(r),n&&n.onDocChange&&(this.abortOnDocChange=!0))}}function Kz(t){let e=Object.keys(t).join(""),r=/\w/.test(e);return r&&(e=e.replace(/\w/g,"")),`[${r?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function Pue(t){let e=Object.create(null),r=Object.create(null);for(let{label:i}of t){e[i[0]]=!0;for(let a=1;a<i.length;a++)r[i[a]]=!0}let n=Kz(e)+Kz(r)+"*$";return[new RegExp("^"+n),new RegExp(n)]}function zue(t){let e=t.map(i=>typeof i=="string"?{label:i}:i),[r,n]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:Pue(e);return i=>{let a=i.matchBefore(n);return a||i.explicit?{from:a?a.from:i.pos,options:e,validFor:r}:null}}class Zz{constructor(e,r,n,i){this.completion=e,this.source=r,this.match=n,this.score=i}}function Wl(t){return t.selection.main.from}function ZF(t,e){var r;let{source:n}=t,i=e&&n[0]!="^",a=n[n.length-1]!="$";return!i&&!a?t:new RegExp(`${i?"^":""}(?:${n})${a?"$":""}`,(r=t.flags)!==null&&r!==void 0?r:t.ignoreCase?"i":"")}const JF=ma.define();function Iue(t,e,r,n){let{main:i}=t.selection,a=r-i.from,s=n-i.from;return{...t.changeByRange(l=>{if(l!=i&&r!=n&&t.sliceDoc(l.from+a,l.from+s)!=t.sliceDoc(r,n))return{range:l};let o=t.toText(e);return{changes:{from:l.from+a,to:n==i.from?l.to:l.from+s,insert:o},range:Ae.cursor(l.from+a+o.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const Jz=new WeakMap;function que(t){if(!Array.isArray(t))return t;let e=Jz.get(t);return e||Jz.set(t,e=zue(t)),e}const Kg=yt.define(),sh=yt.define();class jue{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let r=0;r<e.length;){let n=Vn(e,r),i=aa(n);this.chars.push(n);let a=e.slice(r,r+i),s=a.toUpperCase();this.folded.push(Vn(s==a?a.toLowerCase():s,0)),r+=i}this.astral=e.length!=this.chars.length}ret(e,r){return this.score=e,this.matched=r,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:r,folded:n,any:i,precise:a,byWord:s}=this;if(r.length==1){let S=Vn(e,0),k=aa(S),E=k==e.length?0:-100;if(S!=r[0])if(S==n[0])E+=-200;else return null;return this.ret(E,[0,k])}let l=e.indexOf(this.pattern);if(l==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let o=r.length,c=0;if(l<0){for(let S=0,k=Math.min(e.length,200);S<k&&c<o;){let E=Vn(e,S);(E==r[c]||E==n[c])&&(i[c++]=S),S+=aa(E)}if(c<o)return null}let h=0,d=0,g=!1,m=0,y=-1,b=-1,x=/[a-z]/.test(e),w=!0;for(let S=0,k=Math.min(e.length,200),E=0;S<k&&d<o;){let M=Vn(e,S);l<0&&(h<o&&M==r[h]&&(a[h++]=S),m<o&&(M==r[m]||M==n[m]?(m==0&&(y=S),b=S+1,m++):m=0));let R,O=M<255?M>=48&&M<=57||M>=97&&M<=122?2:M>=65&&M<=90?1:0:(R=kE(M))!=R.toLowerCase()?1:R!=R.toUpperCase()?2:0;(!S||O==1&&x||E==0&&O!=0)&&(r[d]==M||n[d]==M&&(g=!0)?s[d++]=S:s.length&&(w=!1)),E=O,S+=aa(M)}return d==o&&s[0]==0&&w?this.result(-100+(g?-200:0),s,e):m==o&&y==0?this.ret(-200-e.length+(b==e.length?0:-100),[0,b]):l>-1?this.ret(-700-e.length,[l,l+this.pattern.length]):m==o?this.ret(-900-e.length,[y,b]):d==o?this.result(-100+(g?-200:0)+-700+(w?0:-1100),s,e):r.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,r,n){let i=[],a=0;for(let s of r){let l=s+(this.astral?aa(Vn(n,s)):1);a&&i[a-1]==s?i[a-1]=l:(i[a++]=s,i[a++]=l)}return this.ret(e-n.length,i)}}class Fue{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let r=e.slice(0,this.pattern.length),n=r==this.pattern?0:r.toLowerCase()==this.folded?-200:null;return n==null?null:(this.matched=[0,r.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}}const Xr=We.define({combine(t){return ya(t,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Hue,filterStrict:!1,compareCompletions:(e,r)=>(e.sortText||e.label).localeCompare(r.sortText||r.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,r)=>e&&r,closeOnBlur:(e,r)=>e&&r,icons:(e,r)=>e&&r,tooltipClass:(e,r)=>n=>eI(e(n),r(n)),optionClass:(e,r)=>n=>eI(e(n),r(n)),addToOptions:(e,r)=>e.concat(r),filterStrict:(e,r)=>e||r})}});function eI(t,e){return t?e?t+" "+e:t:e}function Hue(t,e,r,n,i,a){let s=t.textDirection==Jt.RTL,l=s,o=!1,c="top",h,d,g=e.left-i.left,m=i.right-e.right,y=n.right-n.left,b=n.bottom-n.top;if(l&&g<Math.min(y,m)?l=!1:!l&&m<Math.min(y,g)&&(l=!0),y<=(l?g:m))h=Math.max(i.top,Math.min(r.top,i.bottom-b))-e.top,d=Math.min(400,l?g:m);else{o=!0,d=Math.min(400,(s?e.right:i.right-e.left)-30);let S=i.bottom-e.bottom;S>=b||S>e.top?h=r.bottom-e.top:(c="bottom",h=e.bottom-r.top)}let x=(e.bottom-e.top)/a.offsetHeight,w=(e.right-e.left)/a.offsetWidth;return{style:`${c}: ${h/x}px; max-width: ${d/w}px`,class:"cm-completionInfo-"+(o?s?"left-narrow":"right-narrow":l?"left":"right")}}const nA=yt.define();function Vue(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(r){let n=document.createElement("div");return n.classList.add("cm-completionIcon"),r.type&&n.classList.add(...r.type.split(/\s+/g).map(i=>"cm-completionIcon-"+i)),n.setAttribute("aria-hidden","true"),n},position:20}),e.push({render(r,n,i,a){let s=document.createElement("span");s.className="cm-completionLabel";let l=r.displayLabel||r.label,o=0;for(let c=0;c<a.length;){let h=a[c++],d=a[c++];h>o&&s.appendChild(document.createTextNode(l.slice(o,h)));let g=s.appendChild(document.createElement("span"));g.appendChild(document.createTextNode(l.slice(h,d))),g.className="cm-completionMatchedText",o=d}return o<l.length&&s.appendChild(document.createTextNode(l.slice(o))),s},position:50},{render(r){if(!r.detail)return null;let n=document.createElement("span");return n.className="cm-completionDetail",n.textContent=r.detail,n},position:80}),e.sort((r,n)=>r.position-n.position).map(r=>r.render)}function HC(t,e,r){if(t<=r)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let i=Math.floor(e/r);return{from:i*r,to:(i+1)*r}}let n=Math.floor((t-e)/r);return{from:t-(n+1)*r,to:t-n*r}}class Uue{constructor(e,r,n){this.view=e,this.stateField=r,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:o=>this.placeInfo(o),key:this},this.space=null,this.currentClass="";let i=e.state.field(r),{options:a,selected:s}=i.open,l=e.state.facet(Xr);this.optionContent=Vue(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=HC(a.length,s,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",o=>{let{options:c}=e.state.field(r).open;for(let h=o.target,d;h&&h!=this.dom;h=h.parentNode)if(h.nodeName=="LI"&&(d=/-(\d+)$/.exec(h.id))&&+d[1]<c.length){this.applyCompletion(e,c[+d[1]]),o.preventDefault();return}if(o.target==this.list){let h=this.list.classList.contains("cm-completionListIncompleteTop")&&o.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&o.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;h!=null&&(e.dispatch({effects:nA.of(h)}),o.preventDefault())}}),this.dom.addEventListener("focusout",o=>{let c=e.state.field(this.stateField,!1);c&&c.tooltip&&e.state.facet(Xr).closeOnBlur&&o.relatedTarget!=e.contentDOM&&e.dispatch({effects:sh.of(null)})}),this.showOptions(a,i.id)}mount(){this.updateSel()}showOptions(e,r){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,r,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var r;let n=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=i){let{options:a,selected:s,disabled:l}=n.open;(!i.open||i.open.options!=a)&&(this.range=HC(a.length,s,e.state.facet(Xr).maxRenderedOptions),this.showOptions(a,n.id)),this.updateSel(),l!=((r=i.open)===null||r===void 0?void 0:r.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(e){let r=this.tooltipClass(e);if(r!=this.currentClass){for(let n of this.currentClass.split(" "))n&&this.dom.classList.remove(n);for(let n of r.split(" "))n&&this.dom.classList.add(n);this.currentClass=r}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),r=e.open;(r.selected>-1&&r.selected<this.range.from||r.selected>=this.range.to)&&(this.range=HC(r.options.length,r.selected,this.view.state.facet(Xr).maxRenderedOptions),this.showOptions(r.options,e.id));let n=this.updateSelectedOption(r.selected);if(n){this.destroyInfo();let{completion:i}=r.options[r.selected],{info:a}=i;if(!a)return;let s=typeof a=="string"?document.createTextNode(a):a(i);if(!s)return;"then"in s?s.then(l=>{l&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(l,i)}).catch(l=>Xn(this.view.state,l,"completion info")):(this.addInfoPane(s,i),n.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,r){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",n.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:i,destroy:a}=e;n.appendChild(i),this.infoDestroy=a||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let r=null;for(let n=this.list.firstChild,i=this.range.from;n;n=n.nextSibling,i++)n.nodeName!="LI"||!n.id?i--:i==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),r=n):n.hasAttribute("aria-selected")&&(n.removeAttribute("aria-selected"),n.removeAttribute("aria-describedby"));return r&&Gue(this.list,r),r}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let r=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),i=e.getBoundingClientRect(),a=this.space;if(!a){let s=this.dom.ownerDocument.documentElement;a={left:0,top:0,right:s.clientWidth,bottom:s.clientHeight}}return i.top>Math.min(a.bottom,r.bottom)-10||i.bottom<Math.max(a.top,r.top)+10?null:this.view.state.facet(Xr).positionInfo(this.view,r,i,n,a,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,r,n){const i=document.createElement("ul");i.id=r,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions")),i.addEventListener("mousedown",s=>{s.target==i&&s.preventDefault()});let a=null;for(let s=n.from;s<n.to;s++){let{completion:l,match:o}=e[s],{section:c}=l;if(c){let g=typeof c=="string"?c:c.name;if(g!=a&&(s>n.from||n.from==0))if(a=g,typeof c!="string"&&c.header)i.appendChild(c.header(c));else{let m=i.appendChild(document.createElement("completion-section"));m.textContent=g}}const h=i.appendChild(document.createElement("li"));h.id=r+"-"+s,h.setAttribute("role","option");let d=this.optionClass(l);d&&(h.className=d);for(let g of this.optionContent){let m=g(l,this.view.state,this.view,o);m&&h.appendChild(m)}}return n.from&&i.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&i.classList.add("cm-completionListIncompleteBottom"),i}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function $ue(t,e){return r=>new Uue(r,t,e)}function Gue(t,e){let r=t.getBoundingClientRect(),n=e.getBoundingClientRect(),i=r.height/t.offsetHeight;n.top<r.top?t.scrollTop-=(r.top-n.top)/i:n.bottom>r.bottom&&(t.scrollTop+=(n.bottom-r.bottom)/i)}function tI(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function Yue(t,e){let r=[],n=null,i=null,a=h=>{r.push(h);let{section:d}=h.completion;if(d){n||(n=[]);let g=typeof d=="string"?d:d.name;n.some(m=>m.name==g)||n.push(typeof d=="string"?{name:g}:d)}},s=e.facet(Xr);for(let h of t)if(h.hasResult()){let d=h.result.getMatch;if(h.result.filter===!1)for(let g of h.result.options)a(new Zz(g,h.source,d?d(g):[],1e9-r.length));else{let g=e.sliceDoc(h.from,h.to),m,y=s.filterStrict?new Fue(g):new jue(g);for(let b of h.result.options)if(m=y.match(b.label)){let x=b.displayLabel?d?d(b,m.matched):[]:m.matched,w=m.score+(b.boost||0);if(a(new Zz(b,h.source,x,w)),typeof b.section=="object"&&b.section.rank==="dynamic"){let{name:S}=b.section;i||(i=Object.create(null)),i[S]=Math.max(w,i[S]||-1e9)}}}}if(n){let h=Object.create(null),d=0,g=(m,y)=>(m.rank==="dynamic"&&y.rank==="dynamic"?i[y.name]-i[m.name]:0)||(typeof m.rank=="number"?m.rank:1e9)-(typeof y.rank=="number"?y.rank:1e9)||(m.name<y.name?-1:1);for(let m of n.sort(g))d-=1e5,h[m.name]=d;for(let m of r){let{section:y}=m.completion;y&&(m.score+=h[typeof y=="string"?y:y.name])}}let l=[],o=null,c=s.compareCompletions;for(let h of r.sort((d,g)=>g.score-d.score||c(d.completion,g.completion))){let d=h.completion;!o||o.label!=d.label||o.detail!=d.detail||o.type!=null&&d.type!=null&&o.type!=d.type||o.apply!=d.apply||o.boost!=d.boost?l.push(h):tI(h.completion)>tI(o)&&(l[l.length-1]=h),o=h.completion}return l}class xu{constructor(e,r,n,i,a,s){this.options=e,this.attrs=r,this.tooltip=n,this.timestamp=i,this.selected=a,this.disabled=s}setSelected(e,r){return e==this.selected||e>=this.options.length?this:new xu(this.options,rI(r,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,r,n,i,a,s){if(i&&!s&&e.some(c=>c.isPending))return i.setDisabled();let l=Yue(e,r);if(!l.length)return i&&e.some(c=>c.isPending)?i.setDisabled():null;let o=r.facet(Xr).selectOnOpen?0:-1;if(i&&i.selected!=o&&i.selected!=-1){let c=i.options[i.selected].completion;for(let h=0;h<l.length;h++)if(l[h].completion==c){o=h;break}}return new xu(l,rI(n,o),{pos:e.reduce((c,h)=>h.hasResult()?Math.min(c,h.from):c,1e8),create:Jue,above:a.aboveCursor},i?i.timestamp:Date.now(),o,!1)}map(e){return new xu(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new xu(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Zg{constructor(e,r,n){this.active=e,this.id=r,this.open=n}static start(){return new Zg(Kue,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:r}=e,n=r.facet(Xr),a=(n.override||r.languageDataAt("autocomplete",Wl(r)).map(que)).map(o=>(this.active.find(h=>h.source==o)||new Ai(o,this.active.some(h=>h.state!=0)?1:0)).update(e,n));a.length==this.active.length&&a.every((o,c)=>o==this.active[c])&&(a=this.active);let s=this.open,l=e.effects.some(o=>o.is(iA));s&&e.docChanged&&(s=s.map(e.changes)),e.selection||a.some(o=>o.hasResult()&&e.changes.touchesRange(o.from,o.to))||!Xue(a,this.active)||l?s=xu.build(a,r,this.id,s,n,l):s&&s.disabled&&!a.some(o=>o.isPending)&&(s=null),!s&&a.every(o=>!o.isPending)&&a.some(o=>o.hasResult())&&(a=a.map(o=>o.hasResult()?new Ai(o.source,0):o));for(let o of e.effects)o.is(nA)&&(s=s&&s.setSelected(o.value,this.id));return a==this.active&&s==this.open?this:new Zg(a,this.id,s)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?Wue:Que}}function Xue(t,e){if(t==e)return!0;for(let r=0,n=0;;){for(;r<t.length&&!t[r].hasResult();)r++;for(;n<e.length&&!e[n].hasResult();)n++;let i=r==t.length,a=n==e.length;if(i||a)return i==a;if(t[r++].result!=e[n++].result)return!1}}const Wue={"aria-autocomplete":"list"},Que={};function rI(t,e){let r={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(r["aria-activedescendant"]=t+"-"+e),r}const Kue=[];function eH(t,e){if(t.isUserEvent("input.complete")){let n=t.annotation(JF);if(n&&e.activateOnCompletion(n))return 12}let r=t.isUserEvent("input.type");return r&&e.activateOnTyping?5:r?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class Ai{constructor(e,r,n=!1){this.source=e,this.state=r,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(e,r){let n=eH(e,r),i=this;(n&8||n&16&&this.touches(e))&&(i=new Ai(i.source,0)),n&4&&i.state==0&&(i=new Ai(this.source,1)),i=i.updateFor(e,n);for(let a of e.effects)if(a.is(Kg))i=new Ai(i.source,1,a.value);else if(a.is(sh))i=new Ai(i.source,0);else if(a.is(iA))for(let s of a.value)s.source==i.source&&(i=s);return i}updateFor(e,r){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Wl(e.state))}}class Du extends Ai{constructor(e,r,n,i,a,s){super(e,3,r),this.limit=n,this.result=i,this.from=a,this.to=s}hasResult(){return!0}updateFor(e,r){var n;if(!(r&3))return this.map(e.changes);let i=this.result;i.map&&!e.changes.empty&&(i=i.map(i,e.changes));let a=e.changes.mapPos(this.from),s=e.changes.mapPos(this.to,1),l=Wl(e.state);if(l>s||!i||r&2&&(Wl(e.startState)==this.from||l<this.limit))return new Ai(this.source,r&4?1:0);let o=e.changes.mapPos(this.limit);return Zue(i.validFor,e.state,a,s)?new Du(this.source,this.explicit,o,i,a,s):i.update&&(i=i.update(i,a,s,new KF(e.state,l,!1)))?new Du(this.source,this.explicit,o,i,i.from,(n=i.to)!==null&&n!==void 0?n:Wl(e.state)):new Ai(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new Du(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new Ai(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function Zue(t,e,r,n){if(!t)return!1;let i=e.sliceDoc(r,n);return typeof t=="function"?t(i,r,n,e):ZF(t,!0).test(i)}const iA=yt.define({map(t,e){return t.map(r=>r.map(e))}}),Un=Sn.define({create(){return Zg.start()},update(t,e){return t.update(e)},provide:t=>[FE.from(t,e=>e.tooltip),Ue.contentAttributes.from(t,e=>e.attrs)]});function aA(t,e){const r=e.completion.apply||e.completion.label;let n=t.state.field(Un).active.find(i=>i.source==e.source);return n instanceof Du?(typeof r=="string"?t.dispatch({...Iue(t.state,r,n.from,n.to),annotations:JF.of(e.completion)}):r(t,e.completion,n.from,n.to),!0):!1}const Jue=$ue(Un,aA);function Np(t,e="option"){return r=>{let n=r.state.field(Un,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp<r.state.facet(Xr).interactionDelay)return!1;let i=1,a;e=="page"&&(a=N9(r,n.open.tooltip))&&(i=Math.max(2,Math.floor(a.dom.offsetHeight/a.dom.querySelector("li").offsetHeight)-1));let{length:s}=n.open.options,l=n.open.selected>-1?n.open.selected+i*(t?1:-1):t?0:s-1;return l<0?l=e=="page"?0:s-1:l>=s&&(l=e=="page"?s-1:0),r.dispatch({effects:nA.of(l)}),!0}}const ece=t=>{let e=t.state.field(Un,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(Xr).interactionDelay?!1:aA(t,e.open.options[e.open.selected])},VC=t=>t.state.field(Un,!1)?(t.dispatch({effects:Kg.of(!0)}),!0):!1,tce=t=>{let e=t.state.field(Un,!1);return!e||!e.active.some(r=>r.state!=0)?!1:(t.dispatch({effects:sh.of(null)}),!0)};class rce{constructor(e,r){this.active=e,this.context=r,this.time=Date.now(),this.updates=[],this.done=void 0}}const nce=50,ice=1e3,ace=mr.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(Un).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(Un),r=t.state.facet(Xr);if(!t.selectionSet&&!t.docChanged&&t.startState.field(Un)==e)return;let n=t.transactions.some(a=>{let s=eH(a,r);return s&8||(a.selection||a.docChanged)&&!(s&3)});for(let a=0;a<this.running.length;a++){let s=this.running[a];if(n||s.context.abortOnDocChange&&t.docChanged||s.updates.length+t.transactions.length>nce&&Date.now()-s.time>ice){for(let l of s.context.abortListeners)try{l()}catch(o){Xn(this.view.state,o)}s.context.abortListeners=null,this.running.splice(a--,1)}else s.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(a=>a.effects.some(s=>s.is(Kg)))&&(this.pendingStart=!0);let i=this.pendingStart?50:r.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(a=>a.isPending&&!this.running.some(s=>s.active.source==a.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let a of t.transactions)a.isUserEvent("input.type")?this.composing=2:this.composing==2&&a.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(Un);for(let r of e.active)r.isPending&&!this.running.some(n=>n.active.source==r.source)&&this.startQuery(r);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Xr).updateSyncTime))}startQuery(t){let{state:e}=this.view,r=Wl(e),n=new KF(e,r,t.explicit,this.view),i=new rce(t,n);this.running.push(i),Promise.resolve(t.source(n)).then(a=>{i.context.aborted||(i.done=a||null,this.scheduleAccept())},a=>{this.view.dispatch({effects:sh.of(null)}),Xn(this.view.state,a)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Xr).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],r=this.view.state.facet(Xr),n=this.view.state.field(Un);for(let i=0;i<this.running.length;i++){let a=this.running[i];if(a.done===void 0)continue;if(this.running.splice(i--,1),a.done){let l=Wl(a.updates.length?a.updates[0].startState:this.view.state),o=Math.min(l,a.done.from+(a.active.explicit?0:1)),c=new Du(a.active.source,a.active.explicit,o,a.done,a.done.from,(t=a.done.to)!==null&&t!==void 0?t:l);for(let h of a.updates)c=c.update(h,r);if(c.hasResult()){e.push(c);continue}}let s=n.active.find(l=>l.source==a.active.source);if(s&&s.isPending)if(a.done==null){let l=new Ai(a.active.source,0);for(let o of a.updates)l=l.update(o,r);l.isPending||e.push(l)}else this.startQuery(s)}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:iA.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(Un,!1);if(e&&e.tooltip&&this.view.state.facet(Xr).closeOnBlur){let r=e.open&&N9(this.view,e.open.tooltip);(!r||!r.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:sh.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Kg.of(!1)}),20),this.composing=0}}}),sce=typeof navigator=="object"&&/Win/.test(navigator.platform),lce=po.highest(Ue.domEventHandlers({keydown(t,e){let r=e.state.field(Un,!1);if(!r||!r.open||r.open.disabled||r.open.selected<0||t.key.length>1||t.ctrlKey&&!(sce&&t.altKey)||t.metaKey)return!1;let n=r.open.options[r.open.selected],i=r.active.find(s=>s.source==n.source),a=n.completion.commitCharacters||i.result.commitCharacters;return a&&a.indexOf(t.key)>-1&&aA(e,n),!1}})),oce=Ue.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),lh={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},$l=yt.define({map(t,e){let r=e.mapPos(t,-1,On.TrackAfter);return r??void 0}}),sA=new class extends Js{};sA.startSide=1;sA.endSide=-1;const tH=Sn.define({create(){return Et.empty},update(t,e){if(t=t.map(e.changes),e.selection){let r=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:n=>n>=r.from&&n<=r.to})}for(let r of e.effects)r.is($l)&&(t=t.update({add:[sA.range(r.value,r.value+1)]}));return t}});function uce(){return[fce,tH]}const UC="()[]{}<>«»»«[]{}";function rH(t){for(let e=0;e<UC.length;e+=2)if(UC.charCodeAt(e)==t)return UC.charAt(e+1);return kE(t<128?t:t+1)}function nH(t,e){return t.languageDataAt("closeBrackets",e)[0]||lh}const cce=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),fce=Ue.inputHandler.of((t,e,r,n)=>{if((cce?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let i=t.state.selection.main;if(n.length>2||n.length==2&&aa(Vn(n,0))==1||e!=i.from||r!=i.to)return!1;let a=pce(t.state,n);return a?(t.dispatch(a),!0):!1}),hce=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=nH(t,t.selection.main.head).brackets||lh.brackets,i=null,a=t.changeByRange(s=>{if(s.empty){let l=gce(t.doc,s.head);for(let o of n)if(o==l&&em(t.doc,s.head)==rH(Vn(o,0)))return{changes:{from:s.head-o.length,to:s.head+o.length},range:Ae.cursor(s.head-o.length)}}return{range:i=s}});return i||e(t.update(a,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},dce=[{key:"Backspace",run:hce}];function pce(t,e){let r=nH(t,t.selection.main.head),n=r.brackets||lh.brackets;for(let i of n){let a=rH(Vn(i,0));if(e==i)return a==i?yce(t,i,n.indexOf(i+i+i)>-1,r):vce(t,i,a,r.before||lh.before);if(e==a&&iH(t,t.selection.main.from))return mce(t,i,a)}return null}function iH(t,e){let r=!1;return t.field(tH).between(0,t.doc.length,n=>{n==e&&(r=!0)}),r}function em(t,e){let r=t.sliceString(e,e+2);return r.slice(0,aa(Vn(r,0)))}function gce(t,e){let r=t.sliceString(e-2,e);return aa(Vn(r,0))==r.length?r:r.slice(1)}function vce(t,e,r,n){let i=null,a=t.changeByRange(s=>{if(!s.empty)return{changes:[{insert:e,from:s.from},{insert:r,from:s.to}],effects:$l.of(s.to+e.length),range:Ae.range(s.anchor+e.length,s.head+e.length)};let l=em(t.doc,s.head);return!l||/\s/.test(l)||n.indexOf(l)>-1?{changes:{insert:e+r,from:s.head},effects:$l.of(s.head+e.length),range:Ae.cursor(s.head+e.length)}:{range:i=s}});return i?null:t.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function mce(t,e,r){let n=null,i=t.changeByRange(a=>a.empty&&em(t.doc,a.head)==r?{changes:{from:a.head,to:a.head+r.length,insert:r},range:Ae.cursor(a.head+r.length)}:n={range:a});return n?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function yce(t,e,r,n){let i=n.stringPrefixes||lh.stringPrefixes,a=null,s=t.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:$l.of(l.to+e.length),range:Ae.range(l.anchor+e.length,l.head+e.length)};let o=l.head,c=em(t.doc,o),h;if(c==e){if(nI(t,o))return{changes:{insert:e+e,from:o},effects:$l.of(o+e.length),range:Ae.cursor(o+e.length)};if(iH(t,o)){let g=r&&t.sliceDoc(o,o+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:o,to:o+g.length,insert:g},range:Ae.cursor(o+g.length)}}}else{if(r&&t.sliceDoc(o-2*e.length,o)==e+e&&(h=iI(t,o-2*e.length,i))>-1&&nI(t,h))return{changes:{insert:e+e+e+e,from:o},effects:$l.of(o+e.length),range:Ae.cursor(o+e.length)};if(t.charCategorizer(o)(c)!=cr.Word&&iI(t,o,i)>-1&&!bce(t,o,e,i))return{changes:{insert:e+e,from:o},effects:$l.of(o+e.length),range:Ae.cursor(o+e.length)}}return{range:a=l}});return a?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function nI(t,e){let r=bn(t).resolveInner(e+1);return r.parent&&r.from==e}function bce(t,e,r,n){let i=bn(t).resolveInner(e,-1),a=n.reduce((s,l)=>Math.max(s,l.length),0);for(let s=0;s<5;s++){let l=t.sliceDoc(i.from,Math.min(i.to,i.from+r.length+a)),o=l.indexOf(r);if(!o||o>-1&&n.indexOf(l.slice(0,o))>-1){let h=i.firstChild;for(;h&&h.from==i.from&&h.to-h.from>r.length+o;){if(t.sliceDoc(h.to-r.length,h.to)==r)return!1;h=h.firstChild}return!0}let c=i.to==e&&i.parent;if(!c)break;i=c}return!1}function iI(t,e,r){let n=t.charCategorizer(e);if(n(t.sliceDoc(e-1,e))!=cr.Word)return e;for(let i of r){let a=e-i.length;if(t.sliceDoc(a,e)==i&&n(t.sliceDoc(a-1,a))!=cr.Word)return a}return-1}function xce(t={}){return[lce,Un,Xr.of(t),ace,wce,oce]}const aH=[{key:"Ctrl-Space",run:VC},{mac:"Alt-`",run:VC},{mac:"Alt-i",run:VC},{key:"Escape",run:tce},{key:"ArrowDown",run:Np(!0)},{key:"ArrowUp",run:Np(!1)},{key:"PageDown",run:Np(!0,"page")},{key:"PageUp",run:Np(!1,"page")},{key:"Enter",run:ece}],wce=po.highest($v.computeN([Xr],t=>t.facet(Xr).defaultKeymap?[aH]:[]));class aI{constructor(e,r,n){this.from=e,this.to=r,this.diagnostic=n}}class ql{constructor(e,r,n){this.diagnostics=e,this.panel=r,this.selected=n}static init(e,r,n){let i=n.facet(oh).markerFilter;i&&(e=i(e,n));let a=e.slice().sort((m,y)=>m.from-y.from||m.to-y.to),s=new Wa,l=[],o=0,c=n.doc.iter(),h=0,d=n.doc.length;for(let m=0;;){let y=m==a.length?null:a[m];if(!y&&!l.length)break;let b,x;if(l.length)b=o,x=l.reduce((k,E)=>Math.min(k,E.to),y&&y.from>b?y.from:1e8);else{if(b=y.from,b>d)break;x=y.to,l.push(y),m++}for(;m<a.length;){let k=a[m];if(k.from==b&&(k.to>k.from||k.to==b))l.push(k),m++,x=Math.min(k.to,x);else{x=Math.min(k.from,x);break}}x=Math.min(x,d);let w=!1;if(l.some(k=>k.from==b&&(k.to==x||x==d))&&(w=b==x,!w&&x-b<10)){let k=b-(h+c.value.length);k>0&&(c.next(k),h=b);for(let E=b;;){if(E>=x){w=!0;break}if(!c.lineBreak&&h+c.value.length>E)break;E=h+c.value.length,h+=c.value.length,c.next()}}let S=Bce(l);if(w)s.add(b,b,ut.widget({widget:new Rce(S),diagnostics:l.slice()}));else{let k=l.reduce((E,M)=>M.markClass?E+" "+M.markClass:E,"");s.add(b,x,ut.mark({class:"cm-lintRange cm-lintRange-"+S+k,diagnostics:l.slice(),inclusiveEnd:l.some(E=>E.to>x)}))}if(o=x,o==d)break;for(let k=0;k<l.length;k++)l[k].to<=o&&l.splice(k--,1)}let g=s.finish();return new ql(g,r,al(g))}}function al(t,e=null,r=0){let n=null;return t.between(r,1e9,(i,a,{spec:s})=>{if(!(e&&s.diagnostics.indexOf(e)<0))if(!n)n=new aI(i,a,e||s.diagnostics[0]);else{if(s.diagnostics.indexOf(n.diagnostic)<0)return!1;n=new aI(n.from,a,n.diagnostic)}}),n}function Sce(t,e){let r=e.pos,n=e.end||r,i=t.state.facet(oh).hideOn(t,r,n);if(i!=null)return i;let a=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(s=>s.is(sH))||t.changes.touchesRange(a.from,Math.max(a.to,n)))}function Cce(t,e){return t.field(ci,!1)?e:e.concat(yt.appendConfig.of(Lce))}const sH=yt.define(),lA=yt.define(),lH=yt.define(),ci=Sn.define({create(){return new ql(ut.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let r=t.diagnostics.map(e.changes),n=null,i=t.panel;if(t.selected){let a=e.changes.mapPos(t.selected.from,1);n=al(r,t.selected.diagnostic,a)||al(r,null,a)}!r.size&&i&&e.state.facet(oh).autoPanel&&(i=null),t=new ql(r,i,n)}for(let r of e.effects)if(r.is(sH)){let n=e.state.facet(oh).autoPanel?r.value.length?uh.open:null:t.panel;t=ql.init(r.value,n,e.state)}else r.is(lA)?t=new ql(t.diagnostics,r.value?uh.open:null,t.selected):r.is(lH)&&(t=new ql(t.diagnostics,t.panel,r.value));return t},provide:t=>[th.from(t,e=>e.panel),Ue.decorations.from(t,e=>e.diagnostics)]}),kce=ut.mark({class:"cm-lintRange cm-lintRange-active"});function Tce(t,e,r){let{diagnostics:n}=t.state.field(ci),i,a=-1,s=-1;n.between(e-(r<0?1:0),e+(r>0?1:0),(o,c,{spec:h})=>{if(e>=o&&e<=c&&(o==c||(e>o||r>0)&&(e<c||r<0)))return i=h.diagnostics,a=o,s=c,!1});let l=t.state.facet(oh).tooltipFilter;return i&&l&&(i=l(i,t.state)),i?{pos:a,end:s,above:t.state.doc.lineAt(a).to<s,create(){return{dom:Ece(t,i)}}}:null}function Ece(t,e){return Wt("ul",{class:"cm-tooltip-lint"},e.map(r=>uH(t,r,!1)))}const Ace=t=>{let e=t.state.field(ci,!1);(!e||!e.panel)&&t.dispatch({effects:Cce(t.state,[lA.of(!0)])});let r=HE(t,uh.open);return r&&r.dom.querySelector(".cm-panel-lint ul").focus(),!0},sI=t=>{let e=t.state.field(ci,!1);return!e||!e.panel?!1:(t.dispatch({effects:lA.of(!1)}),!0)},Oce=t=>{let e=t.state.field(ci,!1);if(!e)return!1;let r=t.state.selection.main,n=al(e.diagnostics,null,r.to+1);return!n&&(n=al(e.diagnostics,null,0),!n||n.from==r.from&&n.to==r.to)?!1:(t.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0}),!0)},Mce=[{key:"Mod-Shift-m",run:Ace,preventDefault:!0},{key:"F8",run:Oce}],oh=We.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...ya(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:lI,tooltipFilter:lI,needsRefresh:(e,r)=>e?r?n=>e(n)||r(n):e:r,hideOn:(e,r)=>e?r?(n,i,a)=>e(n,i,a)||r(n,i,a):e:r,autoPanel:(e,r)=>e||r})}}});function lI(t,e){return t?e?(r,n)=>e(t(r,n),n):t:e}function oH(t){let e=[];if(t)e:for(let{name:r}of t){for(let n=0;n<r.length;n++){let i=r[n];if(/[a-zA-Z]/.test(i)&&!e.some(a=>a.toLowerCase()==i.toLowerCase())){e.push(i);continue e}}e.push("")}return e}function uH(t,e,r){var n;let i=r?oH(e.actions):[];return Wt("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Wt("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(n=e.actions)===null||n===void 0?void 0:n.map((a,s)=>{let l=!1,o=m=>{if(m.preventDefault(),l)return;l=!0;let y=al(t.state.field(ci).diagnostics,e);y&&a.apply(t,y.from,y.to)},{name:c}=a,h=i[s]?c.indexOf(i[s]):-1,d=h<0?c:[c.slice(0,h),Wt("u",c.slice(h,h+1)),c.slice(h+1)],g=a.markClass?" "+a.markClass:"";return Wt("button",{type:"button",class:"cm-diagnosticAction"+g,onclick:o,onmousedown:o,"aria-label":` Action: ${c}${h<0?"":` (access key "${i[s]})"`}.`},d)}),e.source&&Wt("div",{class:"cm-diagnosticSource"},e.source))}class Rce extends ba{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Wt("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class oI{constructor(e,r){this.diagnostic=r,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=uH(e,r,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class uh{constructor(e){this.view=e,this.items=[];let r=i=>{if(!(i.ctrlKey||i.altKey||i.metaKey)){if(i.keyCode==27)sI(this.view),this.view.focus();else if(i.keyCode==38||i.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(i.keyCode==40||i.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(i.keyCode==36)this.moveSelection(0);else if(i.keyCode==35)this.moveSelection(this.items.length-1);else if(i.keyCode==13)this.view.focus();else if(i.keyCode>=65&&i.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:a}=this.items[this.selectedIndex],s=oH(a.actions);for(let l=0;l<s.length;l++)if(s[l].toUpperCase().charCodeAt(0)==i.keyCode){let o=al(this.view.state.field(ci).diagnostics,a);o&&a.actions[l].apply(e,o.from,o.to)}}else return;i.preventDefault()}},n=i=>{for(let a=0;a<this.items.length;a++)this.items[a].dom.contains(i.target)&&this.moveSelection(a)};this.list=Wt("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:r,onclick:n}),this.dom=Wt("div",{class:"cm-panel-lint"},this.list,Wt("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>sI(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(ci).selected;if(!e)return-1;for(let r=0;r<this.items.length;r++)if(this.items[r].diagnostic==e.diagnostic)return r;return-1}update(){let{diagnostics:e,selected:r}=this.view.state.field(ci),n=0,i=!1,a=null,s=new Set;for(e.between(0,this.view.state.doc.length,(l,o,{spec:c})=>{for(let h of c.diagnostics){if(s.has(h))continue;s.add(h);let d=-1,g;for(let m=n;m<this.items.length;m++)if(this.items[m].diagnostic==h){d=m;break}d<0?(g=new oI(this.view,h),this.items.splice(n,0,g),i=!0):(g=this.items[d],d>n&&(this.items.splice(n,d-n),i=!0)),r&&g.diagnostic==r.diagnostic?g.dom.hasAttribute("aria-selected")||(g.dom.setAttribute("aria-selected","true"),a=g):g.dom.hasAttribute("aria-selected")&&g.dom.removeAttribute("aria-selected"),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)i=!0,this.items.pop();this.items.length==0&&(this.items.push(new oI(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),i=!0),a?(this.list.setAttribute("aria-activedescendant",a.id),this.view.requestMeasure({key:this,read:()=>({sel:a.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:o})=>{let c=o.height/this.list.offsetHeight;l.top<o.top?this.list.scrollTop-=(o.top-l.top)/c:l.bottom>o.bottom&&(this.list.scrollTop+=(l.bottom-o.bottom)/c)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let e=this.list.firstChild;function r(){let n=e;e=n.nextSibling,n.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)r();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)r()}moveSelection(e){if(this.selectedIndex<0)return;let r=this.view.state.field(ci),n=al(r.diagnostics,this.items[e].diagnostic);n&&this.view.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0,effects:lH.of(n)})}static open(e){return new uh(e)}}function Dce(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(t)}</svg>')`}function Bp(t){return Dce(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${t}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const _ce=Ue.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Bp("#d11")},".cm-lintRange-warning":{backgroundImage:Bp("orange")},".cm-lintRange-info":{backgroundImage:Bp("#999")},".cm-lintRange-hint":{backgroundImage:Bp("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function Nce(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function Bce(t){let e="hint",r=1;for(let n of t){let i=Nce(n.severity);i>r&&(r=i,e=n.severity)}return e}const Lce=[ci,Ue.decorations.compute([ci],t=>{let{selected:e,panel:r}=t.field(ci);return!e||!r||e.from==e.to?ut.none:ut.set([kce.range(e.from,e.to)])}),Tse(Tce,{hideOn:Sce}),_ce];var uI=function(e){e===void 0&&(e={});var{crosshairCursor:r=!1}=e,n=[];e.closeBracketsKeymap!==!1&&(n=n.concat(dce)),e.defaultKeymap!==!1&&(n=n.concat(aue)),e.searchKeymap!==!1&&(n=n.concat(_ue)),e.historyKeymap!==!1&&(n=n.concat(hoe)),e.foldKeymap!==!1&&(n=n.concat(Ele)),e.completionKeymap!==!1&&(n=n.concat(aH)),e.lintKeymap!==!1&&(n=n.concat(Mce));var i=[];return e.lineNumbers!==!1&&i.push(Ise()),e.highlightActiveLineGutter!==!1&&i.push(Fse()),e.highlightSpecialChars!==!1&&i.push(ese()),e.history!==!1&&i.push(noe()),e.foldGutter!==!1&&i.push(Rle()),e.drawSelection!==!1&&i.push(Vae()),e.dropCursor!==!1&&i.push(Xae()),e.allowMultipleSelections!==!1&&i.push(Dt.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&i.push(vle()),e.syntaxHighlighting!==!1&&i.push(sF(Ble,{fallback:!0})),e.bracketMatching!==!1&&i.push(Fle()),e.closeBrackets!==!1&&i.push(uce()),e.autocompletion!==!1&&i.push(xce()),e.rectangularSelection!==!1&&i.push(pse()),r!==!1&&i.push(mse()),e.highlightActiveLine!==!1&&i.push(sse()),e.highlightSelectionMatches!==!1&&i.push(fue()),e.tabSize&&typeof e.tabSize=="number"&&i.push(Yv.of(" ".repeat(e.tabSize))),i.concat([$v.of(n.flat())]).filter(Boolean)};const Pce="#e5c07b",cI="#e06c75",zce="#56b6c2",Ice="#ffffff",ig="#abb2bf",mT="#7d8799",qce="#61afef",jce="#98c379",fI="#d19a66",Fce="#c678dd",Hce="#21252b",hI="#2c313a",dI="#282c34",$C="#353a42",Vce="#3E4451",pI="#528bff",Uce=Ue.theme({"&":{color:ig,backgroundColor:dI},".cm-content":{caretColor:pI},".cm-cursor, .cm-dropCursor":{borderLeftColor:pI},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Vce},".cm-panels":{backgroundColor:Hce,color:ig},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:dI,color:mT,border:"none"},".cm-activeLineGutter":{backgroundColor:hI},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:$C},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:$C,borderBottomColor:$C},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:hI,color:ig}}},{dark:!0}),$ce=Bh.define([{tag:xe.keyword,color:Fce},{tag:[xe.name,xe.deleted,xe.character,xe.propertyName,xe.macroName],color:cI},{tag:[xe.function(xe.variableName),xe.labelName],color:qce},{tag:[xe.color,xe.constant(xe.name),xe.standard(xe.name)],color:fI},{tag:[xe.definition(xe.name),xe.separator],color:ig},{tag:[xe.typeName,xe.className,xe.number,xe.changed,xe.annotation,xe.modifier,xe.self,xe.namespace],color:Pce},{tag:[xe.operator,xe.operatorKeyword,xe.url,xe.escape,xe.regexp,xe.link,xe.special(xe.string)],color:zce},{tag:[xe.meta,xe.comment],color:mT},{tag:xe.strong,fontWeight:"bold"},{tag:xe.emphasis,fontStyle:"italic"},{tag:xe.strikethrough,textDecoration:"line-through"},{tag:xe.link,color:mT,textDecoration:"underline"},{tag:xe.heading,fontWeight:"bold",color:cI},{tag:[xe.atom,xe.bool,xe.special(xe.variableName)],color:fI},{tag:[xe.processingInstruction,xe.string,xe.inserted],color:jce},{tag:xe.invalid,color:Ice}]),cH=[Uce,sF($ce)];var Gce=Ue.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),Yce=function(e){e===void 0&&(e={});var{indentWithTab:r=!0,editable:n=!0,readOnly:i=!1,theme:a="light",placeholder:s="",basicSetup:l=!0}=e,o=[];switch(r&&o.unshift($v.of([sue])),l&&(typeof l=="boolean"?o.unshift(uI()):o.unshift(uI(l))),s&&o.unshift(cse(s)),a){case"light":o.push(Gce);break;case"dark":o.push(cH);break;case"none":break;default:o.push(a);break}return n===!1&&o.push(Ue.editable.of(!1)),i&&o.push(Dt.readOnly.of(!0)),[...o]},Xce=t=>({line:t.state.doc.lineAt(t.state.selection.main.from),lineCount:t.state.doc.lines,lineBreak:t.state.lineBreak,length:t.state.doc.length,readOnly:t.state.readOnly,tabSize:t.state.tabSize,selection:t.state.selection,selectionAsSingle:t.state.selection.asSingle().main,ranges:t.state.selection.ranges,selectionCode:t.state.sliceDoc(t.state.selection.main.from,t.state.selection.main.to),selections:t.state.selection.ranges.map(e=>t.state.sliceDoc(e.from,e.to)),selectedText:t.state.selection.ranges.some(e=>!e.empty)});class Wce{constructor(e,r){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=r,this.timeoutMS=r,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(r=>{try{r()}catch(n){console.error("TimeoutLatch callback error:",n)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class gI{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}}var GC=null,Qce=()=>typeof window>"u"?new gI:(GC||(GC=new gI),GC),vI=ma.define(),Kce=200,Zce=[];function Jce(t){var{value:e,selection:r,onChange:n,onStatistics:i,onCreateEditor:a,onUpdate:s,extensions:l=Zce,autoFocus:o,theme:c="light",height:h=null,minHeight:d=null,maxHeight:g=null,width:m=null,minWidth:y=null,maxWidth:b=null,placeholder:x="",editable:w=!0,readOnly:S=!1,indentWithTab:k=!0,basicSetup:E=!0,root:M,initialState:R}=t,[O,N]=ve.useState(),[B,D]=ve.useState(),[_,P]=ve.useState(),z=ve.useState(()=>({current:null}))[0],H=ve.useState(()=>({current:null}))[0],$=Ue.theme({"&":{height:h,minHeight:d,maxHeight:g,width:m,minWidth:y,maxWidth:b},"& .cm-scroller":{height:"100% !important"}}),q=Ue.updateListener.of(ee=>{if(ee.docChanged&&typeof n=="function"&&!ee.transactions.some(G=>G.annotation(vI))){z.current?z.current.reset():(z.current=new Wce(()=>{if(H.current){var G=H.current;H.current=null,G()}z.current=null},Kce),Qce().add(z.current));var te=ee.state.doc,I=te.toString();n(I,ee)}i&&i(Xce(ee))}),V=Yce({theme:c,editable:w,readOnly:S,placeholder:x,indentWithTab:k,basicSetup:E}),X=[q,$,...V];return s&&typeof s=="function"&&X.push(Ue.updateListener.of(s)),X=X.concat(l),ve.useLayoutEffect(()=>{if(O&&!_){var ee={doc:e,selection:r,extensions:X},te=R?Dt.fromJSON(R.json,ee,R.fields):Dt.create(ee);if(P(te),!B){var I=new Ue({state:te,parent:O,root:M});D(I),a&&a(I,te)}}return()=>{B&&(P(void 0),D(void 0))}},[O,_]),ve.useEffect(()=>{t.container&&N(t.container)},[t.container]),ve.useEffect(()=>()=>{B&&(B.destroy(),D(void 0)),z.current&&(z.current.cancel(),z.current=null)},[B]),ve.useEffect(()=>{o&&B&&B.focus()},[o,B]),ve.useEffect(()=>{B&&B.dispatch({effects:yt.reconfigure.of(X)})},[c,l,h,d,g,m,y,b,x,w,S,k,E,n,s]),ve.useEffect(()=>{if(e!==void 0){var ee=B?B.state.doc.toString():"";if(B&&e!==ee){var te=z.current&&!z.current.isDone,I=()=>{B&&e!==B.state.doc.toString()&&B.dispatch({changes:{from:0,to:B.state.doc.toString().length,insert:e||""},annotations:[vI.of(!0)]})};te?H.current=I:I()}}},[e,B]),{state:_,setState:P,view:B,setView:D,container:O,setContainer:N}}var efe=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],fH=ve.forwardRef((t,e)=>{var{className:r,value:n="",selection:i,extensions:a=[],onChange:s,onStatistics:l,onCreateEditor:o,onUpdate:c,autoFocus:h,theme:d="light",height:g,minHeight:m,maxHeight:y,width:b,minWidth:x,maxWidth:w,basicSetup:S,placeholder:k,indentWithTab:E,editable:M,readOnly:R,root:O,initialState:N}=t,B=Rne(t,efe),D=ve.useRef(null),{state:_,view:P,container:z,setContainer:H}=Jce({root:O,value:n,autoFocus:h,theme:d,height:g,minHeight:m,maxHeight:y,width:b,minWidth:x,maxWidth:w,basicSetup:S,placeholder:k,indentWithTab:E,editable:M,readOnly:R,selection:i,onChange:s,onStatistics:l,onCreateEditor:o,onUpdate:c,extensions:a,initialState:N});ve.useImperativeHandle(e,()=>({editor:D.current,state:_,view:P}),[D,z,_,P]);var $=ve.useCallback(V=>{D.current=V,H(V)},[H]);if(typeof n!="string")throw new Error("value must be typeof string but got "+typeof n);var q=typeof d=="string"?"cm-theme-"+d:"cm-theme";return A.jsx("div",kk({ref:$,className:""+q+(r?" "+r:"")},B))});fH.displayName="CodeMirror";var mI={};class Jg{constructor(e,r,n,i,a,s,l,o,c,h=0,d){this.p=e,this.stack=r,this.state=n,this.reducePos=i,this.pos=a,this.score=s,this.buffer=l,this.bufferBase=o,this.curContext=c,this.lookAhead=h,this.parent=d}toString(){return`[${this.stack.filter((e,r)=>r%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,r,n=0){let i=e.parser.context;return new Jg(e,[],r,n,n,0,[],0,i?new yI(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,r){this.stack.push(this.state,r,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var r;let n=e>>19,i=e&65535,{parser:a}=this.p,s=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),l=a.dynamicPrecedence(i);if(l&&(this.score+=l),n==0){this.pushState(a.getGoto(this.state,i,!0),this.reducePos),i<a.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,s?8:4,!0),this.reduceContext(i,this.reducePos);return}let o=this.stack.length-(n-1)*3-(e&262144?6:0),c=o?this.stack[o-2]:this.p.ranges[0].from,h=this.reducePos-c;h>=2e3&&!(!((r=this.p.parser.nodeSet.types[i])===null||r===void 0)&&r.isAnonymous)&&(c==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=h):this.p.lastBigReductionSize<h&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=c,this.p.lastBigReductionSize=h));let d=o?this.stack[o-1]:0,g=this.bufferBase+this.buffer.length-d;if(i<a.minRepeatTerm||e&131072){let m=a.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,c,m,g+4,!0)}if(e&262144)this.state=this.stack[o];else{let m=this.stack[o-3];this.state=a.getGoto(m,i,!0)}for(;this.stack.length>o;)this.stack.pop();this.reduceContext(i,c)}storeNode(e,r,n,i=4,a=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let s=this,l=this.buffer.length;if(l==0&&s.parent&&(l=s.bufferBase-s.parent.bufferBase,s=s.parent),l>0&&s.buffer[l-4]==0&&s.buffer[l-1]>-1){if(r==n)return;if(s.buffer[l-2]>=r){s.buffer[l-2]=n;return}}}if(!a||this.pos==n)this.buffer.push(e,r,n,i);else{let s=this.buffer.length;if(s>0&&(this.buffer[s-4]!=0||this.buffer[s-1]<0)){let l=!1;for(let o=s;o>0&&this.buffer[o-2]>n;o-=4)if(this.buffer[o-1]>=0){l=!0;break}if(l)for(;s>0&&this.buffer[s-2]>n;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,i>4&&(i-=4)}this.buffer[s]=e,this.buffer[s+1]=r,this.buffer[s+2]=n,this.buffer[s+3]=i}}shift(e,r,n,i){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let a=e,{parser:s}=this.p;this.pos=i;let l=s.stateFlag(a,1);!l&&(i>n||r<=s.maxNode)&&(this.reducePos=i),this.pushState(a,l?n:Math.min(n,this.reducePos)),this.shiftContext(r,n),r<=s.maxNode&&this.buffer.push(r,n,i,4)}else this.pos=i,this.shiftContext(r,n),r<=this.p.parser.maxNode&&this.buffer.push(r,n,i,4)}apply(e,r,n,i){e&65536?this.reduce(e):this.shift(e,r,n,i)}useNode(e,r){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(r,i),this.buffer.push(n,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,r=e.buffer.length;for(;r>0&&e.buffer[r-2]>e.reducePos;)r-=4;let n=e.buffer.slice(r),i=e.bufferBase+r;for(;e&&i==e.bufferBase;)e=e.parent;return new Jg(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,r){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,r,4),this.storeNode(0,this.pos,r,n?8:4),this.pos=this.reducePos=r,this.score-=190}canShift(e){for(let r=new tfe(this);;){let n=this.p.parser.stateSlot(r.state,4)||this.p.parser.hasAction(r.state,e);if(n==0)return!1;if((n&65536)==0)return!0;r.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let r=this.p.parser.nextStates(this.state);if(r.length>8||this.stack.length>=120){let i=[];for(let a=0,s;a<r.length;a+=2)(s=r[a+1])!=this.state&&this.p.parser.hasAction(s,e)&&i.push(r[a],s);if(this.stack.length<120)for(let a=0;i.length<8&&a<r.length;a+=2){let s=r[a+1];i.some((l,o)=>o&1&&l==s)||i.push(r[a],s)}r=i}let n=[];for(let i=0;i<r.length&&n.length<4;i+=2){let a=r[i+1];if(a==this.state)continue;let s=this.split();s.pushState(a,this.pos),s.storeNode(0,s.pos,s.pos,4,!0),s.shiftContext(r[i],this.pos),s.reducePos=this.pos,s.score-=200,n.push(s)}return n}forceReduce(){let{parser:e}=this.p,r=e.stateSlot(this.state,5);if((r&65536)==0)return!1;if(!e.validAction(this.state,r)){let n=r>>19,i=r&65535,a=this.stack.length-n*3;if(a<0||e.getGoto(this.stack[a],i,!1)<0){let s=this.findForcedReduction();if(s==null)return!1;r=s}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(r),!0}findForcedReduction(){let{parser:e}=this.p,r=[],n=(i,a)=>{if(!r.includes(i))return r.push(i),e.allActions(i,s=>{if(!(s&393216))if(s&65536){let l=(s>>19)-a;if(l>1){let o=s&65535,c=this.stack.length-l*3;if(c>=0&&e.getGoto(this.stack[c],o,!1)>=0)return l<<19|65536|o}}else{let l=n(s,a+1);if(l!=null)return l}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let r=0;r<this.stack.length;r+=3)if(this.stack[r]!=e.stack[r])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,r){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(r)))}reduceContext(e,r){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(r)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let r=new yI(this.curContext.tracker,e);r.hash!=this.curContext.hash&&this.emitContext(),this.curContext=r}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class yI{constructor(e,r){this.tracker=e,this.context=r,this.hash=e.strict?e.hash(r):0}}class tfe{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let r=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],r,!0);this.state=i}}class ev{constructor(e,r,n){this.stack=e,this.pos=r,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,r=e.bufferBase+e.buffer.length){return new ev(e,r,r-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new ev(this.stack,this.pos,this.index)}}function Lp(t,e=Uint16Array){if(typeof t!="string")return t;let r=null;for(let n=0,i=0;n<t.length;){let a=0;for(;;){let s=t.charCodeAt(n++),l=!1;if(s==126){a=65535;break}s>=92&&s--,s>=34&&s--;let o=s-32;if(o>=46&&(o-=46,l=!0),a+=o,l)break;a*=46}r?r[i++]=a:r=new e(a)}return r}class ag{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const bI=new ag;class rfe{constructor(e,r){this.input=e,this.ranges=r,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=bI,this.rangeIndex=0,this.pos=this.chunkPos=r[0].from,this.range=r[0],this.end=r[r.length-1].to,this.readNext()}resolveOffset(e,r){let n=this.range,i=this.rangeIndex,a=this.pos+e;for(;a<n.from;){if(!i)return null;let s=this.ranges[--i];a-=n.from-s.to,n=s}for(;r<0?a>n.to:a>=n.to;){if(i==this.ranges.length-1)return null;let s=this.ranges[++i];a+=s.from-n.to,n=s}return a}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let r of this.ranges)if(r.to>e)return Math.max(e,r.from);return this.end}peek(e){let r=this.chunkOff+e,n,i;if(r>=0&&r<this.chunk.length)n=this.pos+e,i=this.chunk.charCodeAt(r);else{let a=this.resolveOffset(e,1);if(a==null)return-1;if(n=a,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let s=this.rangeIndex,l=this.range;for(;l.to<=n;)l=this.ranges[++s];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>l.to&&(this.chunk2=this.chunk2.slice(0,l.to-n)),i=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),i}acceptToken(e,r=0){let n=r?this.resolveOffset(r,-1):this.pos;if(n==null||n<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=n}acceptTokenTo(e,r){this.token.value=e,this.token.end=r}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:r}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=r,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),r=this.pos+e.length;this.chunk=r>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,r){if(r?(this.token=r,r.start=e,r.lookAhead=e+1,r.value=r.extended=-1):this.token=bI,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,r){if(e>=this.chunkPos&&r<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,r-this.chunkPos);if(e>=this.chunk2Pos&&r<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,r-this.chunk2Pos);if(e>=this.range.from&&r<=this.range.to)return this.input.read(e,r);let n="";for(let i of this.ranges){if(i.from>=r)break;i.to>e&&(n+=this.input.read(Math.max(i.from,e),Math.min(i.to,r)))}return n}}class _u{constructor(e,r){this.data=e,this.id=r}token(e,r){let{parser:n}=r.p;nfe(this.data,e,r,this.id,n.data,n.tokenPrecTable)}}_u.prototype.contextual=_u.prototype.fallback=_u.prototype.extend=!1;_u.prototype.fallback=_u.prototype.extend=!1;class tm{constructor(e,r={}){this.token=e,this.contextual=!!r.contextual,this.fallback=!!r.fallback,this.extend=!!r.extend}}function nfe(t,e,r,n,i,a){let s=0,l=1<<n,{dialect:o}=r.p.parser;e:for(;(l&t[s])!=0;){let c=t[s+1];for(let m=s+3;m<c;m+=2)if((t[m+1]&l)>0){let y=t[m];if(o.allows(y)&&(e.token.value==-1||e.token.value==y||ife(y,e.token.value,i,a))){e.acceptToken(y);break}}let h=e.next,d=0,g=t[s+2];if(e.next<0&&g>d&&t[c+g*3-3]==65535){s=t[c+g*3-1];continue e}for(;d<g;){let m=d+g>>1,y=c+m+(m<<1),b=t[y],x=t[y+1]||65536;if(h<b)g=m;else if(h>=x)d=m+1;else{s=t[y+2],e.advance();continue e}}break}}function xI(t,e,r){for(let n=e,i;(i=t[n])!=65535;n++)if(i==r)return n-e;return-1}function ife(t,e,r,n){let i=xI(r,n,e);return i<0||xI(r,n,t)<i}const oi=typeof process<"u"&&mI&&/\bparse\b/.test(mI.LOG);let YC=null;function wI(t,e,r){let n=t.cursor(gr.IncludeAnonymous);for(n.moveTo(e);;)if(!(r<0?n.childBefore(e):n.childAfter(e)))for(;;){if((r<0?n.to<e:n.from>e)&&!n.type.isError)return r<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(t.length,Math.max(n.from+1,e+25));if(r<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return r<0?0:t.length}}class afe{constructor(e,r){this.fragments=e,this.nodeSet=r,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?wI(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?wI(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let r=this.trees.length-1;if(r<0)return this.nextFragment(),null;let n=this.trees[r],i=this.index[r];if(i==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let a=n.children[i],s=this.start[r]+n.positions[i];if(s>e)return this.nextStart=s,null;if(a instanceof Cr){if(s==e){if(s<this.safeFrom)return null;let l=s+a.length;if(l<=this.safeTo){let o=a.prop(Ct.lookAhead);if(!o||l+o<this.fragment.to)return a}}this.index[r]++,s+a.length>=Math.max(this.safeFrom,e)&&(this.trees.push(a),this.start.push(s),this.index.push(0))}else this.index[r]++,this.nextStart=s+a.length}}}class sfe{constructor(e,r){this.stream=r,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new ag)}getActions(e){let r=0,n=null,{parser:i}=e.p,{tokenizers:a}=i,s=i.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,o=0;for(let c=0;c<a.length;c++){if((1<<c&s)==0)continue;let h=a[c],d=this.tokens[c];if(!(n&&!h.fallback)&&((h.contextual||d.start!=e.pos||d.mask!=s||d.context!=l)&&(this.updateCachedToken(d,h,e),d.mask=s,d.context=l),d.lookAhead>d.end+25&&(o=Math.max(d.lookAhead,o)),d.value!=0)){let g=r;if(d.extended>-1&&(r=this.addActions(e,d.extended,d.end,r)),r=this.addActions(e,d.value,d.end,r),!h.extend&&(n=d,r>g))break}}for(;this.actions.length>r;)this.actions.pop();return o&&e.setLookAhead(o),!n&&e.pos==this.stream.end&&(n=new ag,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,r=this.addActions(e,n.value,n.end,r)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let r=new ag,{pos:n,p:i}=e;return r.start=n,r.end=Math.min(n+1,i.stream.end),r.value=n==i.stream.end?i.parser.eofTerm:0,r}updateCachedToken(e,r,n){let i=this.stream.clipPos(n.pos);if(r.token(this.stream.reset(i,e),n),e.value>-1){let{parser:a}=n.p;for(let s=0;s<a.specialized.length;s++)if(a.specialized[s]==e.value){let l=a.specializers[s](this.stream.read(e.start,e.end),n);if(l>=0&&n.p.parser.dialect.allows(l>>1)){(l&1)==0?e.value=l>>1:e.extended=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,r,n,i){for(let a=0;a<i;a+=3)if(this.actions[a]==e)return i;return this.actions[i++]=e,this.actions[i++]=r,this.actions[i++]=n,i}addActions(e,r,n,i){let{state:a}=e,{parser:s}=e.p,{data:l}=s;for(let o=0;o<2;o++)for(let c=s.stateSlot(a,o?2:1);;c+=3){if(l[c]==65535)if(l[c+1]==1)c=Fa(l,c+2);else{i==0&&l[c+1]==2&&(i=this.putAction(Fa(l,c+2),r,n,i));break}l[c]==r&&(i=this.putAction(Fa(l,c+1),r,n,i))}return i}}class lfe{constructor(e,r,n,i){this.parser=e,this.input=r,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new rfe(r,i),this.tokens=new sfe(e,this.stream),this.topTerm=e.top[1];let{from:a}=i[0];this.stacks=[Jg.start(this,e.top[0],a)],this.fragments=n.length&&this.stream.end-a>e.bufferLength*4?new afe(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,r=this.minStackPos,n=this.stacks=[],i,a;if(this.bigReductionCount>300&&e.length==1){let[s]=e;for(;s.forceReduce()&&s.stack.length&&s.stack[s.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let s=0;s<e.length;s++){let l=e[s];for(;;){if(this.tokens.mainToken=null,l.pos>r)n.push(l);else{if(this.advanceStack(l,n,e))continue;{i||(i=[],a=[]),i.push(l);let o=this.tokens.getMainToken(l);a.push(o.value,o.end)}}break}}if(!n.length){let s=i&&cfe(i);if(s)return oi&&console.log("Finish with "+this.stackID(s)),this.stackToTree(s);if(this.parser.strict)throw oi&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+r);this.recovering||(this.recovering=5)}if(this.recovering&&i){let s=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,a,n);if(s)return oi&&console.log("Force-finish "+this.stackID(s)),this.stackToTree(s.forceAll())}if(this.recovering){let s=this.recovering==1?1:this.recovering*3;if(n.length>s)for(n.sort((l,o)=>o.score-l.score);n.length>s;)n.pop();n.some(l=>l.reducePos>r)&&this.recovering--}else if(n.length>1){e:for(let s=0;s<n.length-1;s++){let l=n[s];for(let o=s+1;o<n.length;o++){let c=n[o];if(l.sameState(c)||l.buffer.length>500&&c.buffer.length>500)if((l.score-c.score||l.buffer.length-c.buffer.length)>0)n.splice(o--,1);else{n.splice(s--,1);continue e}}}n.length>12&&(n.sort((s,l)=>l.score-s.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let s=1;s<n.length;s++)n[s].pos<this.minStackPos&&(this.minStackPos=n[s].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,r,n){let i=e.pos,{parser:a}=this,s=oi?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,h=c?e.curContext.hash:0;for(let d=this.fragments.nodeAt(i);d;){let g=this.parser.nodeSet.types[d.type.id]==d.type?a.getGoto(e.state,d.type.id):-1;if(g>-1&&d.length&&(!c||(d.prop(Ct.contextHash)||0)==h))return e.useNode(d,g),oi&&console.log(s+this.stackID(e)+` (via reuse of ${a.getName(d.type.id)})`),!0;if(!(d instanceof Cr)||d.children.length==0||d.positions[0]>0)break;let m=d.children[0];if(m instanceof Cr&&d.positions[0]==0)d=m;else break}}let l=a.stateSlot(e.state,4);if(l>0)return e.reduce(l),oi&&console.log(s+this.stackID(e)+` (via always-reduce ${a.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let o=this.tokens.getActions(e);for(let c=0;c<o.length;){let h=o[c++],d=o[c++],g=o[c++],m=c==o.length||!n,y=m?e:e.split(),b=this.tokens.mainToken;if(y.apply(h,d,b?b.start:y.pos,g),oi&&console.log(s+this.stackID(y)+` (via ${(h&65536)==0?"shift":`reduce of ${a.getName(h&65535)}`} for ${a.getName(d)} @ ${i}${y==e?"":", split"})`),m)return!0;y.pos>i?r.push(y):n.push(y)}return!1}advanceFully(e,r){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return SI(e,r),!0}}runRecovery(e,r,n){let i=null,a=!1;for(let s=0;s<e.length;s++){let l=e[s],o=r[s<<1],c=r[(s<<1)+1],h=oi?this.stackID(l)+" -> ":"";if(l.deadEnd&&(a||(a=!0,l.restart(),oi&&console.log(h+this.stackID(l)+" (restarted)"),this.advanceFully(l,n))))continue;let d=l.split(),g=h;for(let m=0;m<10&&d.forceReduce()&&(oi&&console.log(g+this.stackID(d)+" (via force-reduce)"),!this.advanceFully(d,n));m++)oi&&(g=this.stackID(d)+" -> ");for(let m of l.recoverByInsert(o))oi&&console.log(h+this.stackID(m)+" (via recover-insert)"),this.advanceFully(m,n);this.stream.end>l.pos?(c==l.pos&&(c++,o=0),l.recoverByDelete(o,c),oi&&console.log(h+this.stackID(l)+` (via recover-delete ${this.parser.getName(o)})`),SI(l,n)):(!i||i.score<d.score)&&(i=d)}return i}stackToTree(e){return e.close(),Cr.build({buffer:ev.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let r=(YC||(YC=new WeakMap)).get(e);return r||YC.set(e,r=String.fromCodePoint(this.nextStackID++)),r+e}}function SI(t,e){for(let r=0;r<e.length;r++){let n=e[r];if(n.pos==t.pos&&n.sameState(t)){e[r].score<t.score&&(e[r]=t);return}}e.push(t)}class ofe{constructor(e,r,n){this.source=e,this.flags=r,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}}const XC=t=>t;class ufe{constructor(e){this.start=e.start,this.shift=e.shift||XC,this.reduce=e.reduce||XC,this.reuse=e.reuse||XC,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class tv extends V9{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let r=e.nodeNames.split(" ");this.minRepeatTerm=r.length;for(let l=0;l<e.repeatNodeCount;l++)r.push("");let n=Object.keys(e.topRules).map(l=>e.topRules[l][1]),i=[];for(let l=0;l<r.length;l++)i.push([]);function a(l,o,c){i[l].push([o,o.deserialize(String(c))])}if(e.nodeProps)for(let l of e.nodeProps){let o=l[0];typeof o=="string"&&(o=Ct[o]);for(let c=1;c<l.length;){let h=l[c++];if(h>=0)a(h,o,l[c++]);else{let d=l[c+-h];for(let g=-h;g>0;g--)a(l[c++],o,d);c++}}}this.nodeSet=new VE(r.map((l,o)=>Zn.define({name:o>=this.minRepeatTerm?void 0:l,id:o,props:i[o],top:n.indexOf(o)>-1,error:o==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(o)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=q9;let s=Lp(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;l<this.specializerSpecs.length;l++)this.specialized[l]=this.specializerSpecs[l].term;this.specializers=this.specializerSpecs.map(CI),this.states=Lp(e.states,Uint32Array),this.data=Lp(e.stateData),this.goto=Lp(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(l=>typeof l=="number"?new _u(s,l):l),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,r,n){let i=new lfe(this,e,r,n);for(let a of this.wrappers)i=a(i,e,r,n);return i}getGoto(e,r,n=!1){let i=this.goto;if(r>=i[0])return-1;for(let a=i[r+1];;){let s=i[a++],l=s&1,o=i[a++];if(l&&n)return o;for(let c=a+(s>>1);a<c;a++)if(i[a]==e)return o;if(l)return-1}}hasAction(e,r){let n=this.data;for(let i=0;i<2;i++)for(let a=this.stateSlot(e,i?2:1),s;;a+=3){if((s=n[a])==65535)if(n[a+1]==1)s=n[a=Fa(n,a+2)];else{if(n[a+1]==2)return Fa(n,a+2);break}if(s==r||s==0)return Fa(n,a+1)}return 0}stateSlot(e,r){return this.states[e*6+r]}stateFlag(e,r){return(this.stateSlot(e,0)&r)>0}validAction(e,r){return!!this.allActions(e,n=>n==r?!0:null)}allActions(e,r){let n=this.stateSlot(e,4),i=n?r(n):void 0;for(let a=this.stateSlot(e,1);i==null;a+=3){if(this.data[a]==65535)if(this.data[a+1]==1)a=Fa(this.data,a+2);else break;i=r(Fa(this.data,a+1))}return i}nextStates(e){let r=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=Fa(this.data,n+2);else break;if((this.data[n+2]&1)==0){let i=this.data[n+1];r.some((a,s)=>s&1&&a==i)||r.push(this.data[n],i)}}return r}configure(e){let r=Object.assign(Object.create(tv.prototype),this);if(e.props&&(r.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);r.top=n}return e.tokenizers&&(r.tokenizers=this.tokenizers.map(n=>{let i=e.tokenizers.find(a=>a.from==n);return i?i.to:n})),e.specializers&&(r.specializers=this.specializers.slice(),r.specializerSpecs=this.specializerSpecs.map((n,i)=>{let a=e.specializers.find(l=>l.from==n.external);if(!a)return n;let s=Object.assign(Object.assign({},n),{external:a.to});return r.specializers[i]=CI(s),s})),e.contextTracker&&(r.context=e.contextTracker),e.dialect&&(r.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(r.strict=e.strict),e.wrap&&(r.wrappers=r.wrappers.concat(e.wrap)),e.bufferLength!=null&&(r.bufferLength=e.bufferLength),r}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let r=this.dynamicPrecedences;return r==null?0:r[e]||0}parseDialect(e){let r=Object.keys(this.dialects),n=r.map(()=>!1);if(e)for(let a of e.split(" ")){let s=r.indexOf(a);s>=0&&(n[s]=!0)}let i=null;for(let a=0;a<r.length;a++)if(!n[a])for(let s=this.dialects[r[a]],l;(l=this.data[s++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[l]=1;return new ofe(e,n,i)}static deserialize(e){return new tv(e)}}function Fa(t,e){return t[e]|t[e+1]<<16}function cfe(t){let e=null;for(let r of t){let n=r.p.stoppedAt;(r.pos==r.p.stream.end||n!=null&&r.pos>n)&&r.p.parser.stateFlag(r.state,2)&&(!e||e.score<r.score)&&(e=r)}return e}function CI(t){if(t.external){let e=t.extend?1:0;return(r,n)=>t.external(r,n)<<1|e}return t.get}const fu=63,kI=64,ffe=1,hfe=2,hH=3,dfe=4,dH=5,pfe=6,gfe=7,pH=65,vfe=66,mfe=8,yfe=9,bfe=10,xfe=11,wfe=12,gH=13,Sfe=19,Cfe=20,kfe=29,Tfe=33,Efe=34,Afe=47,Ofe=0,oA=1,yT=2,ch=3,bT=4;class jl{constructor(e,r,n){this.parent=e,this.depth=r,this.type=n,this.hash=(e?e.hash+e.hash<<8:0)+r+(r<<4)+n}}jl.top=new jl(null,-1,Ofe);function Df(t,e){for(let r=0,n=e-t.pos-1;;n--,r++){let i=t.peek(n);if(Za(i)||i==-1)return r}}function xT(t){return t==32||t==9}function Za(t){return t==10||t==13}function vH(t){return xT(t)||Za(t)}function Gl(t){return t<0||vH(t)}const Mfe=new ufe({start:jl.top,reduce(t,e){return t.type==ch&&(e==Cfe||e==Efe)?t.parent:t},shift(t,e,r,n){if(e==hH)return new jl(t,Df(n,n.pos),oA);if(e==pH||e==dH)return new jl(t,Df(n,n.pos),yT);if(e==fu)return t.parent;if(e==Sfe||e==Tfe)return new jl(t,0,ch);if(e==gH&&t.type==bT)return t.parent;if(e==Afe){let i=/[1-9]/.exec(n.read(n.pos,r.pos));if(i)return new jl(t,t.depth+ +i[0],bT)}return t},hash(t){return t.hash}});function Uu(t,e,r=0){return t.peek(r)==e&&t.peek(r+1)==e&&t.peek(r+2)==e&&Gl(t.peek(r+3))}const Rfe=new tm((t,e)=>{if(t.next==-1&&e.canShift(kI))return t.acceptToken(kI);let r=t.peek(-1);if((Za(r)||r<0)&&e.context.type!=ch){if(Uu(t,45))if(e.canShift(fu))t.acceptToken(fu);else return t.acceptToken(ffe,3);if(Uu(t,46))if(e.canShift(fu))t.acceptToken(fu);else return t.acceptToken(hfe,3);let n=0;for(;t.next==32;)n++,t.advance();(n<e.context.depth||n==e.context.depth&&e.context.type==oA&&(t.next!=45||!Gl(t.peek(1))))&&t.next!=-1&&!Za(t.next)&&t.next!=35&&t.acceptToken(fu,-n)}},{contextual:!0}),Dfe=new tm((t,e)=>{if(e.context.type==ch){t.next==63&&(t.advance(),Gl(t.next)&&t.acceptToken(gfe));return}if(t.next==45)t.advance(),Gl(t.next)&&t.acceptToken(e.context.type==oA&&e.context.depth==Df(t,t.pos-1)?dfe:hH);else if(t.next==63)t.advance(),Gl(t.next)&&t.acceptToken(e.context.type==yT&&e.context.depth==Df(t,t.pos-1)?pfe:dH);else{let r=t.pos;for(;;)if(xT(t.next)){if(t.pos==r)return;t.advance()}else if(t.next==33)mH(t);else if(t.next==38)wT(t);else if(t.next==42){wT(t);break}else if(t.next==39||t.next==34){if(uA(t,!0))break;return}else if(t.next==91||t.next==123){if(!Nfe(t))return;break}else{yH(t,!0,!1,0);break}for(;xT(t.next);)t.advance();if(t.next==58){if(t.pos==r&&e.canShift(kfe))return;let n=t.peek(1);Gl(n)&&t.acceptTokenTo(e.context.type==yT&&e.context.depth==Df(t,r)?vfe:pH,r)}}},{contextual:!0});function _fe(t){return t>32&&t<127&&t!=34&&t!=37&&t!=44&&t!=60&&t!=62&&t!=92&&t!=94&&t!=96&&t!=123&&t!=124&&t!=125}function TI(t){return t>=48&&t<=57||t>=97&&t<=102||t>=65&&t<=70}function EI(t,e){return t.next==37?(t.advance(),TI(t.next)&&t.advance(),TI(t.next)&&t.advance(),!0):_fe(t.next)||e&&t.next==44?(t.advance(),!0):!1}function mH(t){if(t.advance(),t.next==60){for(t.advance();;)if(!EI(t,!0)){t.next==62&&t.advance();break}}else for(;EI(t,!1););}function wT(t){for(t.advance();!Gl(t.next)&&rv(t.next)!="f";)t.advance()}function uA(t,e){let r=t.next,n=!1,i=t.pos;for(t.advance();;){let a=t.next;if(a<0)break;if(t.advance(),a==r)if(a==39)if(t.next==39)t.advance();else break;else break;else if(a==92&&r==34)t.next>=0&&t.advance();else if(Za(a)){if(e)return!1;n=!0}else if(e&&t.pos>=i+1024)return!1}return!n}function Nfe(t){for(let e=[],r=t.pos+1024;;)if(t.next==91||t.next==123)e.push(t.next),t.advance();else if(t.next==39||t.next==34){if(!uA(t,!0))return!1}else if(t.next==93||t.next==125){if(e[e.length-1]!=t.next-2)return!1;if(e.pop(),t.advance(),!e.length)return!0}else{if(t.next<0||t.pos>r||Za(t.next))return!1;t.advance()}}const Bfe="iiisiiissisfissssssssssssisssiiissssssssssssssssssssssssssfsfssissssssssssssssssssssssssssfif";function rv(t){return t<33?"u":t>125?"s":Bfe[t-33]}function WC(t,e){let r=rv(t);return r!="u"&&!(e&&r=="f")}function yH(t,e,r,n){if(rv(t.next)=="s"||(t.next==63||t.next==58||t.next==45)&&WC(t.peek(1),r))t.advance();else return!1;let i=t.pos;for(;;){let a=t.next,s=0,l=n+1;for(;vH(a);){if(Za(a)){if(e)return!1;l=0}else l++;a=t.peek(++s)}if(!(a>=0&&(a==58?WC(t.peek(s+1),r):a==35?t.peek(s-1)!=32:WC(a,r)))||!r&&l<=n||l==0&&!r&&(Uu(t,45,s)||Uu(t,46,s)))break;if(e&&rv(a)=="f")return!1;for(let c=s;c>=0;c--)t.advance();if(e&&t.pos>i+1024)return!1}return!0}const Lfe=new tm((t,e)=>{if(t.next==33)mH(t),t.acceptToken(wfe);else if(t.next==38||t.next==42){let r=t.next==38?bfe:xfe;wT(t),t.acceptToken(r)}else t.next==39||t.next==34?(uA(t,!1),t.acceptToken(yfe)):yH(t,!1,e.context.type==ch,e.context.depth)&&t.acceptToken(mfe)}),Pfe=new tm((t,e)=>{let r=e.context.type==bT?e.context.depth:-1,n=t.pos;e:for(;;){let i=0,a=t.next;for(;a==32;)a=t.peek(++i);if(!i&&(Uu(t,45,i)||Uu(t,46,i))||!Za(a)&&(r<0&&(r=Math.max(e.context.depth+1,i)),i<r))break;for(;;){if(t.next<0)break e;let s=Za(t.next);if(t.advance(),s)continue e;n=t.pos}}t.acceptTokenTo(gH,n)}),zfe=U9({DirectiveName:xe.keyword,DirectiveContent:xe.attributeValue,"DirectiveEnd DocEnd":xe.meta,QuotedLiteral:xe.string,BlockLiteralHeader:xe.special(xe.string),BlockLiteralContent:xe.content,Literal:xe.content,"Key/Literal Key/QuotedLiteral":xe.definition(xe.propertyName),"Anchor Alias":xe.labelName,Tag:xe.typeName,Comment:xe.lineComment,": , -":xe.separator,"?":xe.punctuation,"[ ]":xe.squareBracket,"{ }":xe.brace}),Ife=tv.deserialize({version:14,states:"5lQ!ZQgOOO#PQfO'#CpO#uQfO'#DOOOQR'#Dv'#DvO$qQgO'#DRO%gQdO'#DUO%nQgO'#DUO&ROaO'#D[OOQR'#Du'#DuO&{QgO'#D^O'rQgO'#D`OOQR'#Dt'#DtO(iOqO'#DbOOQP'#Dj'#DjO(zQaO'#CmO)YQgO'#CmOOQP'#Cm'#CmQ)jQaOOQ)uQgOOQ]QgOOO*PQdO'#CrO*nQdO'#CtOOQO'#Dw'#DwO+]Q`O'#CxO+hQdO'#CwO+rQ`O'#CwOOQO'#Cv'#CvO+wQdO'#CvOOQO'#Cq'#CqO,UQ`O,59[O,^QfO,59[OOQR,59[,59[OOQO'#Cx'#CxO,eQ`O'#DPO,pQdO'#DPOOQO'#Dx'#DxO,zQdO'#DxO-XQ`O,59jO-aQfO,59jOOQR,59j,59jOOQR'#DS'#DSO-hQcO,59mO-sQgO'#DVO.TQ`O'#DVO.YQcO,59pOOQR'#DX'#DXO#|QfO'#DWO.hQcO'#DWOOQR,59v,59vO.yOWO,59vO/OOaO,59vO/WOaO,59vO/cQgO'#D_OOQR,59x,59xO0VQgO'#DaOOQR,59z,59zOOQP,59|,59|O0yOaO,59|O1ROaO,59|O1aOqO,59|OOQP-E7h-E7hO1oQgO,59XOOQP,59X,59XO2PQaO'#DeO2_QgO'#DeO2oQgO'#DkOOQP'#Dk'#DkQ)jQaOOO3PQdO'#CsOOQO,59^,59^O3kQdO'#CuOOQO,59`,59`OOQO,59c,59cO4VQdO,59cO4aQdO'#CzO4kQ`O'#CzOOQO,59b,59bOOQU,5:Q,5:QOOQR1G.v1G.vO4pQ`O1G.vOOQU-E7d-E7dO4xQdO,59kOOQO,59k,59kO5SQdO'#DQO5^Q`O'#DQOOQO,5:d,5:dOOQU,5:R,5:ROOQR1G/U1G/UO5cQ`O1G/UOOQU-E7e-E7eO5kQgO'#DhO5xQcO1G/XOOQR1G/X1G/XOOQR,59q,59qO6TQgO,59qO6eQdO'#DiO6lQgO'#DiO7PQcO1G/[OOQR1G/[1G/[OOQR,59r,59rO#|QfO,59rOOQR1G/b1G/bO7_OWO1G/bO7dOaO1G/bOOQR,59y,59yOOQR,59{,59{OOQP1G/h1G/hO7lOaO1G/hO7tOaO1G/hO8POaO1G/hOOQP1G.s1G.sO8_QgO,5:POOQP,5:P,5:POOQP,5:V,5:VOOQP-E7i-E7iOOQO,59_,59_OOQO,59a,59aOOQO1G.}1G.}OOQO,59f,59fO8oQdO,59fOOQR7+$b7+$bP,XQ`O'#DfOOQO1G/V1G/VOOQO,59l,59lO8yQdO,59lOOQR7+$p7+$pP9TQ`O'#DgOOQR'#DT'#DTOOQR,5:S,5:SOOQR-E7f-E7fOOQR7+$s7+$sOOQR1G/]1G/]O9YQgO'#DYO9jQ`O'#DYOOQR,5:T,5:TO#|QfO'#DZO9oQcO'#DZOOQR-E7g-E7gOOQR7+$v7+$vOOQR1G/^1G/^OOQR7+$|7+$|O:QOWO7+$|OOQP7+%S7+%SO:VOaO7+%SO:_OaO7+%SOOQP1G/k1G/kOOQO1G/Q1G/QOOQO1G/W1G/WOOQR,59t,59tO:jQgO,59tOOQR,59u,59uO#|QfO,59uOOQR<<Hh<<HhOOQP<<Hn<<HnO:zOaO<<HnOOQR1G/`1G/`OOQR1G/a1G/aOOQPAN>YAN>Y",stateData:";S~O!fOS!gOS^OS~OP_OQbORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!V[O!cTO~O`cO~P]OVkOWROXROYeOZfO[dOcPOmhOqQO~OboO~P!bOVtOWROXROYeOZfO[dOcPOmrOqQO~OpwO~P#WORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!cTO~OSvP!avP!bvP~P#|OWROXROYeOZfO[dOcPOqQO~OmzO~P%OOm!OOUzP!azP!bzP!dzP~P#|O^!SO!b!QO!f!TO!g!RO~ORSOTUOWROXROcPOqQO!PVO!cTO~OY!UOP!QXQ!QX!V!QX!`!QXS!QX!a!QX!b!QXU!QXm!QX!d!QX~P&aO[!WOP!SXQ!SX!V!SX!`!SXS!SX!a!SX!b!SXU!SXm!SX!d!SX~P&aO^!ZO!W![O!b!YO!f!]O!g!YO~OP!_O!V[OQaX!`aX~OPaXQaX!VaX!`aX~P#|OP!bOQ!cO!V[O~OP_O!V[O~P#|OWROXROY!fOcPOqQObfXmfXofXpfX~OWROXRO[!hOcPOqQObhXmhXohXphX~ObeXmlXoeX~ObkXokX~P%OOm!kO~Om!lObnPonP~P%OOb!pOo!oO~Ob!pO~P!bOm!sOosXpsX~OosXpsX~P%OOm!uOotPptP~P%OOo!xOp!yO~Op!yO~P#WOS!|O!a#OO!b#OO~OUyX!ayX!byX!dyX~P#|Om#QO~OU#SO!a#UO!b#UO!d#RO~Om#WOUzX!azX!bzX!dzX~O]#XO~O!b#XO!g#YO~O^#ZO!b#XO!g#YO~OP!RXQ!RX!V!RX!`!RXS!RX!a!RX!b!RXU!RXm!RX!d!RX~P&aOP!TXQ!TX!V!TX!`!TXS!TX!a!TX!b!TXU!TXm!TX!d!TX~P&aO!b#^O!g#^O~O^#_O!b#^O!f#`O!g#^O~O^#_O!W#aO!b#^O!g#^O~OPaaQaa!Vaa!`aa~P#|OP#cO!V[OQ!XX!`!XX~OP!XXQ!XX!V!XX!`!XX~P#|OP_O!V[OQ!_X!`!_X~P#|OWROXROcPOqQObgXmgXogXpgX~OWROXROcPOqQObiXmiXoiXpiX~Obkaoka~P%OObnXonX~P%OOm#kO~Ob#lOo!oO~Oosapsa~P%OOotXptX~P%OOm#pO~Oo!xOp#qO~OSwP!awP!bwP~P#|OS!|O!a#vO!b#vO~OUya!aya!bya!dya~P#|Om#xO~P%OOm#{OU}P!a}P!b}P!d}P~P#|OU#SO!a$OO!b$OO!d#RO~O]$QO~O!b$QO!g$RO~O!b$SO!g$SO~O^$TO!b$SO!g$SO~O^$TO!b$SO!f$UO!g$SO~OP!XaQ!Xa!V!Xa!`!Xa~P#|Obnaona~P%OOotapta~P%OOo!xO~OU|X!a|X!b|X!d|X~P#|Om$ZO~Om$]OU}X!a}X!b}X!d}X~O]$^O~O!b$_O!g$_O~O^$`O!b$_O!g$_O~OU|a!a|a!b|a!d|a~P#|O!b$cO!g$cO~O",goto:",]!mPPPPPPPPPPPPPPPPP!nPP!v#v#|$`#|$c$f$j$nP%VPPP!v%Y%^%a%{&O%a&R&U&X&_&b%aP&e&{&e'O'RPP']'a'g'm's'y(XPPPPPPPP(_)e*X+c,VUaObcR#e!c!{ROPQSTUXY_bcdehknrtvz!O!U!W!_!b!c!f!h!k!l!s!u!|#Q#R#S#W#c#k#p#x#{$Z$]QmPR!qnqfPQThknrtv!k!l!s!u#R#k#pR!gdR!ieTlPnTjPnSiPnSqQvQ{TQ!mkQ!trQ!vtR#y#RR!nkTsQvR!wt!RWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]RySR#t!|R|TR|UQ!PUR#|#SR#z#RR#z#SyZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]R!VXR!XYa]O^abc!a!c!eT!da!eQnPR!rnQvQR!{vQ!}yR#u!}Q#T|R#}#TW^Obc!cS!^^!aT!aa!eQ!eaR#f!eW`Obc!cQxSS}U#SQ!`_Q#PzQ#V!OQ#b!_Q#d!bQ#s!|Q#w#QQ$P#WQ$V#cQ$Y#xQ$[#{Q$a$ZR$b$]xZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]Q!VXQ!XYQ#[!UR#]!W!QWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]pfPQThknrtv!k!l!s!u#R#k#pQ!gdQ!ieQ#g!fR#h!hSgPn^pQTkrtv#RQ!jhQ#i!kQ#j!lQ#n!sQ#o!uQ$W#kR$X#pQuQR!zv",nodeNames:"⚠ DirectiveEnd DocEnd - - ? ? ? Literal QuotedLiteral Anchor Alias Tag BlockLiteralContent Comment Stream BOM Document ] [ FlowSequence Item Tagged Anchored Anchored Tagged FlowMapping Pair Key : Pair , } { FlowMapping Pair Pair BlockSequence Item Item BlockMapping Pair Pair Key Pair Pair BlockLiteral BlockLiteralHeader Tagged Anchored Anchored Tagged Directive DirectiveName DirectiveContent Document",maxTerm:74,context:Mfe,nodeProps:[["isolate",-3,8,9,14,""],["openedBy",18,"[",32,"{"],["closedBy",19,"]",33,"}"]],propSources:[zfe],skippedNodes:[0],repeatNodeCount:6,tokenData:"-Y~RnOX#PXY$QYZ$]Z]#P]^$]^p#Ppq$Qqs#Pst$btu#Puv$yv|#P|}&e}![#P![!]'O!]!`#P!`!a'i!a!}#P!}#O*g#O#P#P#P#Q+Q#Q#o#P#o#p+k#p#q'i#q#r,U#r;'S#P;'S;=`#z<%l?HT#P?HT?HU,o?HUO#PQ#UU!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PQ#kTOY#PZs#Pt;'S#P;'S;=`#z<%lO#PQ#}P;=`<%l#P~$VQ!f~XY$Qpq$Q~$bO!g~~$gS^~OY$bZ;'S$b;'S;=`$s<%lO$b~$vP;=`<%l$bR%OX!WQOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR%rX!WQ!VPOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR&bP;=`<%l%kR&lUoP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'VUmP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'p[!PP!WQOY#PZp#Ppq#hq{#P{|(f|}#P}!O(f!O!R#P!R![)p![;'S#P;'S;=`#z<%lO#PR(mW!PP!WQOY#PZp#Ppq#hq!R#P!R![)V![;'S#P;'S;=`#z<%lO#PR)^U!PP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR)wY!PP!WQOY#PZp#Ppq#hq{#P{|)V|}#P}!O)V!O;'S#P;'S;=`#z<%lO#PR*nUcP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+XUbP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+rUqP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,]UpP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,vU`P!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#P",tokenizers:[Rfe,Dfe,Lfe,Pfe,0,1],topRules:{Stream:[0,15]},tokenPrec:0}),qfe=qg.define({name:"yaml",parser:Ife.configure({props:[X9.add({Stream:t=>{for(let e=t.node.resolve(t.pos,-1);e&&e.to>=t.pos;e=e.parent){if(e.name=="BlockLiteralContent"&&e.from<e.to)return t.baseIndentFor(e);if(e.name=="BlockLiteral")return t.baseIndentFor(e)+t.unit;if(e.name=="BlockSequence"||e.name=="BlockMapping")return t.column(e.from,1);if(e.name=="QuotedLiteral")return null;if(e.name=="Literal"){let r=t.column(e.from,1);if(r==t.lineIndent(e.from,1))return r;if(e.to>t.pos)return null}}return null},FlowMapping:Nz({closing:"}"}),FlowSequence:Nz({closing:"]"})}),K9.add({"FlowMapping FlowSequence":yle,"Item Pair BlockLiteral":(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to})})]}),languageData:{commentTokens:{line:"#"},indentOnInput:/^\s*[\]\}]$/}});function jfe(){return new lle(qfe)}const Ffe=()=>{const{error:t,isCliMode:e,yamlInput:r,setYamlInput:n,parseAndSetSchema:i,savingStatus:a,lastUpdateSource:s,theme:l,currentModelSlug:o}=pt(),[c,h]=ve.useState(r),d=ve.useRef(null),g=ve.useRef(null),m=ve.useRef(!0);ve.useEffect(()=>{if(!g.current?.view)return;const w=g.current.view,S=w.state.doc.toString();w.dispatch({changes:{from:0,to:S.length,insert:r},annotations:Sr.addToHistory.of(!1)}),h(r)},[o]),ve.useEffect(()=>{if(!g.current?.view)return;const w=g.current.view,S=w.state.doc.toString();if(m.current&&r){w.dispatch({changes:{from:0,to:S.length,insert:r},annotations:Sr.addToHistory.of(!1)}),h(r),m.current=!1;return}s!=="user"&&S!==r&&(w.dispatch({changes:{from:0,to:S.length,insert:r},userEvent:"remote-edit"}),h(r))},[r,s]);const y=ve.useCallback(w=>{h(w),!(!w||w.trim()==="")&&(d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{n(w),i(w)},300))},[n,i]),b=()=>{g.current?.view&&KE(g.current.view)},x=()=>{g.current?.view&&Ug(g.current.view)};return A.jsxs("div",{className:"flex-1 flex flex-col gap-3 overflow-hidden p-4 pt-2 h-full sidebar-content",children:[A.jsxs("div",{className:"flex items-center justify-between px-1",children:[e?A.jsxs("div",{className:"flex items-center gap-4",children:[A.jsxs("div",{className:"flex items-center gap-2",children:[A.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-blue-500 animate-pulse"}),A.jsx("span",{className:`text-[10px] font-bold uppercase tracking-widest ${l==="dark"?"text-slate-500":"text-slate-400"}`,children:"Auto-sync active"})]}),A.jsxs("div",{className:"flex items-center gap-1.5 min-w-[60px]",children:[a==="saving"&&A.jsxs("div",{className:"flex items-center gap-1 text-slate-400 animate-pulse",children:[A.jsx(Xre,{size:10,className:"animate-spin"}),A.jsx("span",{className:"text-[9px] font-bold uppercase",children:"Saving"})]}),a==="saved"&&A.jsxs("div",{className:"flex items-center gap-1 text-emerald-500",children:[A.jsx(Rre,{size:10}),A.jsx("span",{className:"text-[9px] font-bold uppercase tracking-wider",children:"Saved"})]}),a==="error"&&A.jsxs("div",{className:"flex items-center gap-1 text-red-500",children:[A.jsx(Qp,{size:10}),A.jsx("span",{className:"text-[9px] font-bold uppercase",children:"Error"})]})]})]}):A.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 bg-blue-500/10 border border-blue-500/30 rounded-md",children:[A.jsx(Qp,{size:12,className:"text-blue-400"}),A.jsx("span",{className:"text-[10px] text-blue-300 font-medium uppercase tracking-tight",children:"Sandbox Mode"})]}),A.jsxs("div",{className:"flex items-center gap-3",children:[A.jsxs("div",{className:`flex rounded-lg p-0.5 border ${l==="dark"?"bg-slate-800/50 border-slate-700/50":"bg-slate-100 border-slate-200"}`,children:[A.jsx("button",{onClick:b,className:`p-1.5 rounded-md transition-all active:scale-95 ${l==="dark"?"text-slate-400 hover:bg-slate-700 hover:text-slate-100":"text-slate-500 hover:bg-white hover:text-blue-600 hover:shadow-sm"}`,title:"Undo (Ctrl+Z)",children:A.jsx(Sne,{size:14})}),A.jsx("div",{className:`w-px h-4 self-center mx-0.5 ${l==="dark"?"bg-slate-700/50":"bg-slate-200"}`}),A.jsx("button",{onClick:x,className:`p-1.5 rounded-md transition-all active:scale-95 ${l==="dark"?"text-slate-400 hover:bg-slate-700 hover:text-slate-100":"text-slate-500 hover:bg-white hover:text-blue-600 hover:shadow-sm"}`,title:"Redo (Ctrl+Y)",children:A.jsx(cne,{size:14})})]}),A.jsxs("div",{className:"flex items-center gap-1 text-slate-400 dark:text-slate-600 cursor-help",title:"Pro Tip: Use Ctrl+Z to undo visual changes!",children:[A.jsx(SE,{size:12}),A.jsx("span",{className:"text-[9px] font-bold uppercase tracking-tighter",children:"Undo Active"})]})]})]}),A.jsxs("div",{className:`relative flex-1 flex flex-col min-h-0 border rounded-md overflow-hidden transition-colors ${l==="dark"?"border-slate-700 bg-[#282c34]":"border-slate-200 bg-white"}`,children:[A.jsx(fH,{ref:g,value:c,height:"100%",theme:l==="dark"?cH:"light",extensions:[jfe()],onChange:y,basicSetup:{lineNumbers:!0,foldGutter:!0,highlightActiveLine:!0},className:"flex-1 text-sm overflow-auto"}),t&&c===r&&A.jsxs("div",{className:"absolute bottom-4 left-4 right-4 p-3 bg-red-900/90 border border-red-500/50 rounded-md text-red-100 text-xs flex gap-2 items-start z-10 shadow-2xl backdrop-blur-sm animate-in fade-in slide-in-from-bottom-2",children:[A.jsx(Qp,{size:14,className:"shrink-0 mt-0.5 text-red-400"}),A.jsx("span",{children:t})]})]}),A.jsx("div",{className:"flex justify-between items-center pt-1 shrink-0",children:A.jsx("div",{className:"text-[10px] text-slate-500 italic",children:e?"Changes are automatically reflected and saved to file.":"Changes are reflected instantly but reset on reload."})})]})},Hfe=()=>{const{availableFiles:t,currentModelSlug:e,setCurrentModel:r,isSidebarOpen:n,theme:i}=pt();if(!n||t.length<=0)return null;const a=e||t[0]?.slug;return A.jsxs("div",{className:"px-4 mb-4",children:[A.jsx("div",{className:"flex items-center justify-between mb-1.5 px-1",children:A.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider text-slate-500",children:"Current Model"})}),A.jsxs("div",{className:"relative group",children:[A.jsx("select",{value:a,onChange:s=>r(s.target.value),className:`w-full pl-9 pr-8 py-2 rounded-md text-sm appearance-none focus:outline-none focus:ring-1 focus:ring-blue-500/50 transition-all shadow-sm cursor-pointer ${i==="dark"?"bg-slate-800 border-slate-700 text-slate-100 hover:bg-slate-750":"bg-white border-slate-200 text-slate-900 hover:bg-slate-50 shadow-slate-200/50"}`,children:t.map(s=>A.jsx("option",{value:s.slug,className:i==="light"?"bg-white text-slate-900":"bg-slate-800 text-slate-100",children:s.name},s.slug))}),A.jsx(Hl,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-blue-500 pointer-events-none"}),A.jsx(Ha,{size:14,className:`absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none transition-colors ${i==="dark"?"text-slate-500 group-hover:text-slate-300":"text-slate-400 group-hover:text-slate-600"}`})]})]})},Vfe=()=>{const{schema:t,bulkAddRelationship:e,theme:r}=pt(),[n,i]=ve.useState("er"),[a,s]=ve.useState(""),[l,o]=ve.useState(""),[c,h]=ve.useState("one-to-many"),[d,g]=ve.useState(!1),[m,y]=ve.useState(!1),[b,x]=ve.useState(0),[w,S]=ve.useState(!1),k=ve.useRef(null),E=ve.useRef(null),M=ve.useMemo(()=>{if(!t)return[];const D=[];return t.tables.forEach(_=>{D.push(_.id),n==="er"&&_.columns?.forEach(P=>{D.push(`${_.id}.${P.id}`)})}),D},[t,n]),R=ve.useMemo(()=>a?M.filter(D=>D.toLowerCase().includes(a.toLowerCase())).slice(0,8):[],[a,M]),O=ve.useMemo(()=>{const D=l.toLowerCase(),_=M.filter(P=>P.toLowerCase().includes(D));if(n==="er"&&D.includes(".")){const P=D.split(".")[1]||"";_.unshift(`*.${P}`)}return _.slice(0,8)},[l,M,n]);ve.useEffect(()=>{k.current?.focus()},[]);const N=()=>{if(!a||!l)return;const D=a.split("."),_=D[0],P=D[1];e({table:_,column:P},l,c),S(!0),setTimeout(()=>S(!1),1500),o(""),E.current?.focus()},B=(D,_)=>{D.stopPropagation();const P=_==="source"?R:O;D.key==="ArrowDown"?(D.preventDefault(),x(z=>(z+1)%(P.length||1))):D.key==="ArrowUp"?(D.preventDefault(),x(z=>(z-1+(P.length||1))%(P.length||1))):D.key==="Enter"&&(P[b]?_==="source"?(s(P[b]),g(!1),E.current?.focus()):(o(P[b]),y(!1)):_==="target"&&a&&l&&N())};return A.jsxs("div",{className:"flex-1 flex flex-col gap-6 p-4 overflow-auto sidebar-content",children:[A.jsxs("div",{className:"flex flex-col gap-4",children:[A.jsxs("section",{className:"relative",children:[A.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[A.jsx("label",{className:"text-[9px] font-black uppercase tracking-widest text-slate-500",children:"Source"}),A.jsxs("div",{className:`flex rounded-full p-0.5 border ${r==="dark"?"bg-slate-950/50 border-slate-800":"bg-slate-100 border-slate-200"}`,children:[A.jsxs("button",{onClick:()=>{i("er"),h("one-to-many")},className:`px-2 py-0.5 rounded-full flex items-center gap-1 transition-all ${n==="er"?r==="dark"?"bg-slate-700 text-blue-400 shadow-sm":"bg-white text-blue-600 shadow-sm":"text-[9px] font-bold text-slate-500 hover:text-slate-400 uppercase tracking-tighter"}`,children:[A.jsx(Sk,{size:10}),A.jsx("span",{className:"text-[9px] font-black uppercase tracking-tighter",children:"ER"})]}),A.jsxs("button",{onClick:()=>{i("lineage"),h("lineage")},className:`px-2 py-0.5 rounded-full flex items-center gap-1 transition-all ${n==="lineage"?r==="dark"?"bg-slate-700 text-blue-400 shadow-sm":"bg-white text-blue-600 shadow-sm":"text-[9px] font-bold text-slate-500 hover:text-slate-400 uppercase tracking-tighter"}`,children:[A.jsx(wE,{size:10}),A.jsx("span",{className:"text-[9px] font-black uppercase tracking-tighter",children:"Flow"})]})]})]}),A.jsx("input",{ref:k,type:"text",placeholder:n==="er"?"table.column":"table_id",className:`w-full px-4 py-2.5 rounded-xl text-sm font-bold outline-none transition-all border-2 border-transparent ${r==="dark"?"bg-slate-800 text-white placeholder-slate-600 focus:border-blue-500/50":"bg-slate-50 text-slate-900 focus:border-blue-500/30"}`,value:a,onChange:D=>{s(D.target.value),g(!0),x(0)},onFocus:()=>g(!0),onBlur:()=>setTimeout(()=>g(!1),200),onKeyDown:D=>B(D,"source")}),d&&R.length>0&&A.jsx("div",{className:`absolute top-full left-0 right-0 mt-1 rounded-xl shadow-xl border-2 overflow-hidden z-[110] ${r==="dark"?"bg-slate-800 border-slate-700":"bg-white border-slate-200"}`,children:R.map((D,_)=>A.jsx("div",{className:`px-4 py-2 text-xs font-bold cursor-pointer ${b===_?"bg-blue-600 text-white":r==="dark"?"hover:bg-slate-700 text-slate-300":"hover:bg-slate-100 text-slate-600"}`,onMouseDown:()=>{s(D),E.current?.focus()},children:D},D))})]}),A.jsx("section",{className:"flex justify-center -my-2 relative z-10",children:A.jsxs("div",{className:`flex items-center gap-3 px-3 py-1 rounded-full border shadow-sm ${r==="dark"?"bg-slate-800 border-slate-700":"bg-white border-slate-100"}`,children:[n==="er"?A.jsxs("select",{className:"bg-transparent text-[10px] font-black uppercase tracking-widest outline-none cursor-pointer text-blue-500",value:c,onChange:D=>h(D.target.value),children:[A.jsx("option",{value:"one-to-many",children:"1 : N"}),A.jsx("option",{value:"one-to-one",children:"1 : 1"}),A.jsx("option",{value:"many-to-one",children:"N : 1"}),A.jsx("option",{value:"many-to-many",children:"N : N"})]}):A.jsx(Ha,{size:14,className:"text-blue-500 animate-pulse"}),A.jsx("div",{className:"w-px h-3 bg-slate-700/50"}),A.jsx(xre,{size:12,className:"text-slate-500"})]})}),A.jsxs("section",{className:"relative",children:[A.jsx("label",{className:"text-[9px] font-black uppercase tracking-widest text-slate-500 mb-1.5 block",children:"Target"}),A.jsx("input",{ref:E,type:"text",placeholder:n==="er"?"target.column or *.column":"target_table",className:`w-full px-4 py-2.5 rounded-xl text-sm font-bold outline-none transition-all border-2 border-transparent ${r==="dark"?"bg-slate-800 text-white placeholder-slate-600 focus:border-blue-500/50":"bg-slate-50 text-slate-900 focus:border-blue-500/30"}`,value:l,onChange:D=>{o(D.target.value),y(!0),x(0)},onFocus:()=>y(!0),onBlur:()=>setTimeout(()=>y(!1),200),onKeyDown:D=>B(D,"target")}),m&&O.length>0&&A.jsx("div",{className:`absolute top-full left-0 right-0 mt-1 rounded-xl shadow-xl border-2 overflow-hidden z-[110] ${r==="dark"?"bg-slate-800 border-slate-700":"bg-white border-slate-200"}`,children:O.map((D,_)=>A.jsx("div",{className:`px-4 py-2 text-xs font-bold cursor-pointer ${b===_?"bg-blue-600 text-white":r==="dark"?"hover:bg-slate-700 text-slate-300":"hover:bg-slate-100 text-slate-600"}`,onMouseDown:()=>{o(D)},children:A.jsxs("div",{className:"flex items-center justify-between",children:[A.jsx("span",{children:D}),D.startsWith("*")&&A.jsx("span",{className:"px-1.5 py-0.5 rounded bg-blue-500/20 text-blue-400 text-[8px] font-black uppercase",children:"Bulk"})]})},D))})]})]}),A.jsxs("div",{className:"mt-auto flex flex-col gap-3",children:[A.jsxs("button",{onClick:N,className:`w-full py-3 rounded-xl text-[10px] font-black uppercase tracking-[0.2em] shadow-lg transition-all active:scale-[0.98] flex items-center justify-center gap-2 group ${w?"bg-emerald-600 text-white":"bg-blue-600 hover:bg-blue-700 text-white"}`,children:[w?A.jsx(u6,{size:14}):A.jsx(CE,{size:14,className:"group-hover:animate-bounce"}),w?"Connected!":"Connect Objects"]}),A.jsxs("div",{className:"flex items-center justify-center gap-2 text-[9px] text-slate-500 font-bold uppercase tracking-tight text-center",children:[A.jsx(SE,{size:10,className:"text-blue-500 shrink-0"}),A.jsxs("span",{children:["Tip: Use ",A.jsx("kbd",{className:`px-1.5 py-0.5 rounded font-bold ${r==="dark"?"bg-slate-700 text-blue-400":"bg-slate-200 text-blue-700"}`,children:"*.id"})," for bulk linking"]})]})]})]})},bH=""+new URL("../favicon.svg",import.meta.url).href,Ufe=()=>{const{isSidebarOpen:t,setIsSidebarOpen:e,showAnnotations:r,setShowAnnotations:n,showER:i,setShowER:a,showLineage:s,setShowLineage:l,connectMode:o,setConnectMode:c,isCompactMode:h,setIsCompactMode:d,addTable:g,addDomain:m,addAnnotation:y,theme:b,getSelectedTable:x,getSelectedDomain:w}=pt(),[S,k]=ve.useState(!1),E=()=>{const z=window.__modscapeCy;if(!z)return{x:window.innerWidth/2,y:window.innerHeight/2};const H=z.pan(),$=z.zoom(),q=window.innerWidth/2,V=window.innerHeight/2;return{x:(q-H.x)/$,y:(V-H.y)/$}},M=x(),R=w(),O=()=>{const z=E();m(z.x-300,z.y-200)},N=()=>{const z=E();g(z.x-160,z.y-125)},B=()=>{const z=M||R,H=E();r||n(!0),z?y({x:50,y:-50},z.id,M?"table":"domain"):y({x:H.x-60,y:H.y-40})},D=(z,H="text-blue-500")=>`
427
+ flex items-center justify-center w-10 h-10 rounded-xl transition-all relative group
428
+ ${z?`bg-blue-600/10 ${H} shadow-inner`:b==="dark"?"text-slate-500 hover:text-slate-300 hover:bg-slate-800/30":"text-slate-400 hover:text-slate-600 hover:bg-slate-100"}
429
+ `,_=({text:z})=>A.jsxs("div",{className:"absolute left-14 px-2 py-1 bg-slate-800 text-white text-[10px] font-bold rounded opacity-0 group-hover:opacity-100 pointer-events-none transition-opacity whitespace-nowrap z-[60] border border-slate-700 shadow-xl",children:[z,A.jsx("div",{className:"absolute top-1/2 -left-1 -translate-y-1/2 border-4 border-transparent border-r-slate-800"})]}),P=({keys:z,label:H})=>A.jsxs("div",{className:"flex items-center justify-between py-2 border-b border-slate-100 dark:border-slate-800 last:border-0",children:[A.jsx("span",{className:"text-xs font-medium text-slate-500",children:H}),A.jsx("div",{className:"flex gap-1",children:z.map($=>A.jsx("kbd",{className:"px-1.5 py-0.5 bg-slate-100 dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded text-[10px] font-bold font-mono text-slate-600 dark:text-slate-300 min-w-[20px] text-center shadow-sm",children:$},$))})]});return A.jsxs(A.Fragment,{children:[A.jsxs("div",{className:`w-14 h-full flex flex-col items-center py-4 border-l transition-colors z-50 ${b==="dark"?"bg-slate-950 border-slate-800":"bg-slate-50 border-slate-200"}`,children:[A.jsx("button",{onClick:()=>e(!t),className:`mb-6 p-2 rounded-xl transition-all ${b==="dark"?"hover:bg-slate-800 text-slate-400 hover:text-white":"hover:bg-white hover:shadow-md text-slate-500 hover:text-slate-900"}`,children:t?A.jsx(c6,{size:20}):A.jsx("img",{src:bH,alt:"Logo",className:"w-6 h-6 rounded-md shadow-lg"})}),A.jsxs("div",{className:"flex flex-col items-center mb-4 gap-2",children:[A.jsx("div",{className:"text-[8px] font-bold text-slate-500 uppercase tracking-tighter opacity-80 mb-1",children:"View"}),A.jsxs("div",{className:"flex flex-col gap-2",children:[A.jsxs("button",{onClick:()=>l(!s),className:D(s,"text-blue-400"),children:[A.jsx(C4,{size:20}),A.jsx(_,{text:s?"Hide Lineage Edges":"Show Lineage Edges"})]}),A.jsxs("button",{onClick:()=>a(!i),className:D(i,"text-slate-400"),children:[A.jsx(Sk,{size:20}),A.jsx(_,{text:i?"Hide ER Edges":"Show ER Edges"})]}),A.jsxs("button",{onClick:()=>n(!r),className:D(r,"text-amber-500"),children:[A.jsx(zu,{size:20}),A.jsx(_,{text:r?"Hide Annotations":"Show Annotations"})]}),A.jsxs("button",{onClick:()=>d(!h),className:D(h,"text-slate-400"),children:[A.jsx(bne,{size:20}),A.jsx(_,{text:h?"Show Columns":"Hide Columns"})]})]})]}),A.jsx("div",{className:`w-8 border-t mb-4 ${b==="dark"?"border-slate-800":"border-slate-200"}`}),A.jsxs("div",{className:"flex flex-col items-center mb-4 gap-2",children:[A.jsx("div",{className:"text-[8px] font-bold text-slate-500 uppercase tracking-tighter opacity-80 mb-1",children:"Add"}),A.jsxs("div",{className:"flex flex-col gap-2",children:[A.jsxs("button",{onClick:O,className:D(!1,"text-blue-400"),children:[A.jsx(p6,{size:20}),A.jsx(_,{text:"Add Domain (D)"})]}),A.jsxs("button",{onClick:N,className:D(!1,"text-emerald-400"),children:[A.jsx(jre,{size:20}),A.jsx(_,{text:"Add Table (T)"})]}),A.jsxs("button",{onClick:B,className:D(!1,"text-amber-400"),children:[A.jsxs("div",{className:"relative",children:[A.jsx(zu,{size:20}),A.jsx(Gf,{size:10,className:"absolute -bottom-1 -right-1 text-amber-500 font-bold stroke-[3px]"})]}),A.jsx(_,{text:"Add Sticky Note (S)"})]}),A.jsxs("button",{onClick:()=>c(o==="lineage"?null:"lineage"),className:D(o==="lineage","text-blue-400"),children:[A.jsx(C4,{size:20}),A.jsx(_,{text:o==="lineage"?"Exit Lineage Mode (Esc)":"Draw Lineage Edge (C)"})]}),A.jsxs("button",{onClick:()=>c(o==="er"?null:"er"),className:D(o==="er","text-emerald-400"),children:[A.jsx(Sk,{size:20}),A.jsx(_,{text:o==="er"?"Exit ER Mode (Esc)":"Draw ER Edge"})]})]})]}),A.jsx("div",{className:`w-8 border-t mb-6 ${b==="dark"?"border-slate-800":"border-slate-200"}`}),A.jsxs("div",{className:"mt-auto flex flex-col gap-2",children:[A.jsxs("button",{onClick:()=>window.__modscapeAutoLayout?.(),className:D(!1,"text-orange-400"),children:[A.jsx(Ene,{size:20}),A.jsx(_,{text:"Auto Layout (left → right)"})]}),A.jsxs("button",{onClick:()=>k(!0),className:D(S),children:[A.jsx(f6,{size:20}),A.jsx(_,{text:"Shortcut Guide"})]})]})]}),S&&A.jsxs("div",{className:"fixed inset-0 z-[200] flex items-center justify-center p-4 animate-in fade-in duration-200",children:[A.jsx("div",{className:"absolute inset-0 bg-slate-950/40 backdrop-blur-sm",onClick:()=>k(!1)}),A.jsxs("div",{className:`relative w-full max-w-sm shadow-2xl rounded-2xl border p-6 animate-in zoom-in-95 duration-200 ${b==="dark"?"bg-slate-900 border-slate-700":"bg-white border-slate-200"}`,children:[A.jsxs("div",{className:"flex items-center justify-between mb-6",children:[A.jsxs("div",{className:"flex items-center gap-2",children:[A.jsx("div",{className:"p-2 bg-blue-500/10 rounded-lg",children:A.jsx(h6,{size:18,className:"text-blue-500"})}),A.jsx("h2",{className:"font-bold text-base",children:"Shortcut Guide"})]}),A.jsx("button",{onClick:()=>k(!1),className:"p-1 hover:bg-slate-100 dark:hover:bg-slate-800 rounded-full transition-colors text-slate-400",children:A.jsx(Oh,{size:20})})]}),A.jsxs("div",{className:"space-y-6",children:[A.jsxs("section",{children:[A.jsx("h3",{className:"text-[10px] font-black uppercase tracking-widest text-slate-400 mb-3",children:"General"}),A.jsx(P,{label:"Command Palette",keys:["Ctrl","K"]}),A.jsx(P,{label:"Quick Connect",keys:["L"]}),A.jsx(P,{label:"Find Entities",keys:["/"]}),A.jsx(P,{label:"Switch Theme",keys:["\\"]})]}),A.jsxs("section",{children:[A.jsx("h3",{className:"text-[10px] font-black uppercase tracking-widest text-slate-400 mb-3",children:"Quick Create"}),A.jsx(P,{label:"New Table",keys:["T"]}),A.jsx(P,{label:"New Domain",keys:["D"]}),A.jsx(P,{label:"New Sticky Note",keys:["S"]})]}),A.jsxs("section",{children:[A.jsx("h3",{className:"text-[10px] font-black uppercase tracking-widest text-slate-400 mb-3",children:"Canvas Control"}),A.jsx(P,{label:"Pan / Scroll",keys:["↑","↓","←","→"]}),A.jsx(P,{label:"Clear Selection",keys:["Esc"]}),A.jsx(P,{label:"Delete Selected",keys:["Del","⌫"]})]})]}),A.jsx("div",{className:"mt-8 pt-4 border-t border-slate-100 dark:border-slate-800 flex justify-center",children:A.jsx("p",{className:"text-[10px] text-slate-400 italic",children:"Pro-tip: Focus the canvas to use shortcuts."})})]})]})]})},$fe=ve.memo(()=>{const{isSidebarOpen:t,isCliMode:e,theme:r,savingStatus:n,activeTab:i,setActiveTab:a}=pt(so(s=>({isSidebarOpen:s.isSidebarOpen,isCliMode:s.isCliMode,theme:s.theme,savingStatus:s.savingStatus,activeTab:s.activeTab,setActiveTab:s.setActiveTab})));return A.jsxs("div",{className:`relative h-full flex flex-row border-r transition-all duration-300 ease-in-out shadow-2xl z-50 ${t?"w-[456px]":"w-14"} ${r==="dark"?"bg-slate-900 border-slate-800":"bg-white border-slate-200"}`,children:[A.jsxs("div",{className:`flex-1 flex flex-col min-w-0 overflow-hidden transition-all duration-300 sidebar-content ${r==="dark"?"bg-slate-900":"bg-white"} ${t?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"}`,style:{width:t?"400px":"0px"},children:[A.jsxs("div",{className:`p-4 border-b flex items-center justify-between ${r==="dark"?"border-slate-800":"border-slate-100"}`,children:[A.jsxs("div",{className:"flex items-center gap-2",children:[A.jsx("img",{src:bH,alt:"Modscape Logo",className:"w-5 h-5 rounded-md"}),A.jsx("h1",{className:`text-base font-bold tracking-tight ${r==="dark"?"text-white":"text-slate-900"}`,children:"Modscape"}),e&&A.jsx("span",{className:"px-1.5 py-0.5 bg-emerald-500/10 border border-emerald-500/30 text-emerald-500 text-[10px] font-bold rounded uppercase ml-1 animate-pulse",title:"Connected & Syncing",children:"Live"})]}),n==="saving"&&A.jsx("span",{className:"text-[10px] text-slate-500 animate-pulse uppercase font-bold tracking-widest",children:"Saving..."})]}),A.jsx("div",{className:"mt-4",children:A.jsx(Hfe,{})}),A.jsx("div",{className:"px-4 mt-6",children:A.jsxs("div",{className:`flex p-1 rounded-xl ${r==="dark"?"bg-slate-800/50":"bg-slate-100"}`,children:[A.jsxs("button",{onClick:()=>a("editor"),className:`flex-1 flex items-center justify-center gap-2 py-2 rounded-lg text-[10px] font-black uppercase tracking-widest transition-all ${i==="editor"?r==="dark"?"bg-slate-700 text-blue-400 shadow-lg":"bg-white text-blue-600 shadow-sm":"text-slate-500 hover:text-slate-400"}`,children:[A.jsx(zre,{size:14}),"Editor"]}),A.jsxs("button",{onClick:()=>a("connect"),className:`flex-1 flex items-center justify-center gap-2 py-2 rounded-lg text-[10px] font-black uppercase tracking-widest transition-all ${i==="connect"?r==="dark"?"bg-slate-700 text-blue-400 shadow-lg":"bg-white text-blue-600 shadow-sm":"text-slate-500 hover:text-slate-400"}`,children:[A.jsx(CE,{size:14}),"Connect"]})]})}),A.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden mt-4",children:i==="connect"?A.jsx(Vfe,{}):A.jsx(Ffe,{})}),A.jsx("div",{className:`p-3 border-t flex items-center justify-between ${r==="dark"?"border-slate-800 bg-slate-950/20":"border-slate-100 bg-slate-50/50"}`,children:A.jsx("p",{className:"text-[10px] text-slate-500 font-medium px-1",children:"Modscape v2.0.0"})})]}),A.jsx(Ufe,{})]})}),Gfe=ve.memo(()=>{const{schema:t,theme:e,setSelectedTableId:r,setFocusNodeId:n,isRightPanelOpen:i,activeRightPanelTab:a}=pt(so(y=>({schema:y.schema,theme:y.theme,setSelectedTableId:y.setSelectedTableId,setFocusNodeId:y.setFocusNodeId,isRightPanelOpen:y.isRightPanelOpen,activeRightPanelTab:y.activeRightPanelTab}))),[s,l]=ve.useState(""),[o,c]=ve.useState(new Set),h=ve.useRef(null);ve.useEffect(()=>{if(i&&a==="tables"){const y=setTimeout(()=>h.current?.focus(),300);return()=>clearTimeout(y)}},[i,a]);const d=y=>{const b=new Set(o);b.has(y)?b.delete(y):b.add(y),c(b)},g=y=>{r(y),n(y)},m=ve.useMemo(()=>{if(!t)return{domains:[],unassigned:[]};const y={},b=new Set;t.domains?.forEach(S=>{y[S.id]=[]}),t.tables.forEach(S=>{const k=t.domains?.find(M=>M.tables.includes(S.id));(S.name.toLowerCase().includes(s.toLowerCase())||S.id.toLowerCase().includes(s.toLowerCase()))&&k&&(y[k.id].push(S),b.add(S.id))});const x=(t.domains||[]).filter(S=>{const k=y[S.id].length>0,E=S.name.toLowerCase().includes(s.toLowerCase())||S.id.toLowerCase().includes(s.toLowerCase());return k||E&&s!==""}).map(S=>({...S,tables:y[S.id]})),w=t.tables.filter(S=>(S.name.toLowerCase().includes(s.toLowerCase())||S.id.toLowerCase().includes(s.toLowerCase()))&&!b.has(S.id)&&!t.domains?.some(E=>E.tables.includes(S.id)));return{domains:x,unassigned:w}},[t,s]);return A.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden p-4",children:[A.jsxs("div",{className:"relative mb-4 shrink-0",children:[A.jsx(Tu,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),A.jsx("input",{ref:h,type:"text",value:s,onChange:y=>l(y.target.value),placeholder:"Search tables...",className:`w-full pl-9 pr-4 py-2 rounded-md text-sm transition-all shadow-sm focus:outline-none focus:ring-1 focus:ring-blue-500/50 ${e==="dark"?"bg-slate-800 border-slate-700 text-slate-100":"bg-white border-slate-200 text-slate-900 shadow-slate-200/50"}`})]}),A.jsxs("div",{className:"flex-1 space-y-4 overflow-auto pr-1",children:[m.domains.map(y=>{const b=o.has(y.id);return A.jsxs("section",{className:"flex flex-col",children:[A.jsxs("div",{className:`flex items-center justify-between group px-1 py-1.5 cursor-pointer rounded transition-colors ${e==="dark"?"hover:bg-slate-800/30":"hover:bg-slate-100"}`,onClick:()=>d(y.id),children:[A.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[b?A.jsx(Eg,{size:12,className:"text-slate-500"}):A.jsx(Ha,{size:12,className:"text-slate-500"}),A.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:y.color||"#3b82f6"}}),A.jsx("h3",{className:`text-[10px] font-bold uppercase tracking-wider truncate ${e==="dark"?"text-slate-300":"text-slate-600"}`,children:y.name}),A.jsx("span",{className:`text-[9px] font-medium px-1.5 py-0.5 rounded-full ${e==="dark"?"text-slate-600 bg-slate-800/50":"text-slate-400 bg-slate-100"}`,children:y.tables.length})]}),A.jsx("button",{onClick:x=>{x.stopPropagation(),g(y.id)},className:"opacity-0 group-hover:opacity-100 p-1 hover:text-blue-500 text-slate-500 transition-all",children:A.jsx(Wp,{size:12})})]}),!b&&A.jsxs("div",{className:`ml-4 mt-1 space-y-0.5 border-l pl-2 ${e==="dark"?"border-slate-800":"border-slate-100"}`,children:[y.tables.map(x=>A.jsxs("button",{onClick:()=>g(x.id),className:`w-full flex items-center justify-between group p-1.5 text-xs rounded border border-transparent transition-all text-left ${e==="dark"?"hover:bg-slate-800/50 text-slate-400 hover:text-slate-200":"hover:bg-blue-50 text-slate-500 hover:text-blue-600"}`,children:[A.jsxs("span",{className:"flex flex-col min-w-0",children:[A.jsx("span",{className:"truncate",children:x.name}),x.name!==x.id&&A.jsx("span",{className:"truncate font-mono text-[9px] opacity-50",children:x.id})]}),A.jsx(Wp,{size:10,className:"opacity-0 group-hover:opacity-100 shrink-0"})]},x.id)),y.tables.length===0&&A.jsx("div",{className:"p-2 text-[10px] text-slate-500 italic",children:"No tables"})]})]},y.id)}),m.unassigned.length>0&&A.jsxs("section",{className:"flex flex-col",children:[A.jsx("div",{className:`flex items-center justify-between group px-1 py-1.5 cursor-pointer rounded transition-colors ${e==="dark"?"hover:bg-slate-800/30":"hover:bg-slate-100"}`,onClick:()=>d("unassigned"),children:A.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[o.has("unassigned")?A.jsx(Eg,{size:12,className:"text-slate-500"}):A.jsx(Ha,{size:12,className:"text-slate-500"}),A.jsx(f6,{size:12,className:"text-slate-500 shrink-0"}),A.jsx("h3",{className:`text-[10px] font-bold uppercase tracking-wider truncate ${e==="dark"?"text-slate-500":"text-slate-400"}`,children:"Unassigned"}),A.jsx("span",{className:`text-[9px] font-medium px-1.5 py-0.5 rounded-full ${e==="dark"?"text-slate-600 bg-slate-800/50":"text-slate-400 bg-slate-100"}`,children:m.unassigned.length})]})}),!o.has("unassigned")&&A.jsx("div",{className:`ml-4 mt-1 space-y-0.5 border-l pl-2 ${e==="dark"?"border-slate-800":"border-slate-100"}`,children:m.unassigned.map(y=>A.jsxs("button",{onClick:()=>g(y.id),className:`w-full flex items-center justify-between group p-1.5 text-xs rounded border border-transparent transition-all text-left ${e==="dark"?"hover:bg-slate-800/50 text-slate-400 hover:text-slate-200":"hover:bg-blue-50 text-slate-500 hover:text-blue-600"}`,children:[A.jsxs("span",{className:"flex flex-col min-w-0",children:[A.jsx("span",{className:"truncate",children:y.name}),y.name!==y.id&&A.jsx("span",{className:"truncate font-mono text-[9px] opacity-50",children:y.id})]}),A.jsx(Wp,{size:10,className:"opacity-0 group-hover:opacity-100 shrink-0"})]},y.id))})]})]})]})}),Yfe=t=>{const e={},r=(n,i,a,s,l)=>{e[n]||(e[n]=[]),e[n].push({from:n,to:i,type:a,id:s,metadata:l}),e[i]||(e[i]=[]),e[i].push({from:i,to:n,type:a,id:s,metadata:l})};return t.relationships?.forEach((n,i)=>{r(n.from.table,n.to.table,"er",`er-${i}`,n)}),t.lineage?.forEach((n,i)=>{r(n.from,n.to,"lineage",`lin-${n.from}-${n.to}-${i}`,{direction:"upstream"})}),e},Xfe=(t,e,r)=>{if(e===r)return[];const n=Yfe(t),i=[e],a=new Set([e]),s={};for(;i.length>0;){const l=i.shift();if(l===r){const c=[];let h=r;for(;h!==e;){const d=s[h];c.unshift(d),h=d.from}return c}const o=n[l]||[];for(const c of o)a.has(c.to)||(a.add(c.to),s[c.to]={from:l,to:c.to,edge:c},i.push(c.to))}return null},Wfe=()=>{const{schema:t,theme:e,setPathFinderResult:r,setFocusNodeId:n}=pt(),[i,a]=ve.useState(""),[s,l]=ve.useState(""),[o,c]=ve.useState(null),[h,d]=ve.useState(!1),g=ve.useMemo(()=>t?.tables||[],[t]),m=()=>{if(!t||!i||!s)return;const b=Xfe(t,i,s);if(c(b),d(!0),b){const x=Array.from(new Set([i,...b.map(S=>S.to)])),w=b.map(S=>S.edge.id);r({nodeIds:x,edgeIds:w})}else r(null)},y=()=>{c(null),d(!1),r(null)};return A.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden p-4",children:[A.jsxs("div",{className:"space-y-4 mb-6",children:[A.jsxs("div",{children:[A.jsx("label",{className:"text-[10px] font-bold text-slate-500 uppercase tracking-widest block mb-1.5",children:"From Table"}),A.jsxs("select",{value:i,onChange:b=>a(b.target.value),className:`w-full p-2 rounded-md text-sm border shadow-sm focus:ring-1 focus:ring-blue-500/50 outline-none ${e==="dark"?"bg-slate-800 border-slate-700 text-slate-100":"bg-white border-slate-200 text-slate-900"}`,children:[A.jsx("option",{value:"",children:"Select source..."}),g.map(b=>A.jsx("option",{value:b.id,children:b.name},b.id))]})]}),A.jsxs("div",{children:[A.jsx("label",{className:"text-[10px] font-bold text-slate-500 uppercase tracking-widest block mb-1.5",children:"To Table"}),A.jsxs("select",{value:s,onChange:b=>l(b.target.value),className:`w-full p-2 rounded-md text-sm border shadow-sm focus:ring-1 focus:ring-blue-500/50 outline-none ${e==="dark"?"bg-slate-800 border-slate-700 text-slate-100":"bg-white border-slate-200 text-slate-900"}`,children:[A.jsx("option",{value:"",children:"Select target..."}),g.map(b=>A.jsx("option",{value:b.id,children:b.name},b.id))]})]}),A.jsxs("div",{className:"flex gap-2 pt-2",children:[A.jsxs("button",{onClick:m,disabled:!i||!s,className:`flex-1 flex items-center justify-center gap-2 py-2 rounded-md text-xs font-bold transition-all ${!i||!s?"bg-slate-100 text-slate-400 cursor-not-allowed":"bg-blue-600 text-white hover:bg-blue-500 shadow-lg shadow-blue-500/20 active:scale-95"}`,children:[A.jsx(Tu,{size:14}),"FIND PATH"]}),h&&A.jsx("button",{onClick:y,className:`p-2 rounded-md border transition-all hover:bg-slate-100 dark:hover:bg-slate-800 ${e==="dark"?"border-slate-700 text-slate-400":"border-slate-200 text-slate-500"}`,title:"Clear search results",children:A.jsx(Oh,{size:14})})]})]}),A.jsxs("div",{className:"flex-1 overflow-auto pr-1",children:[h&&!o&&A.jsxs("div",{className:"flex flex-col items-center justify-center py-10 text-center",children:[A.jsx(Qp,{size:32,className:"text-slate-300 mb-2"}),A.jsx("p",{className:"text-sm text-slate-500 italic",children:"No path found between these tables."})]}),o&&A.jsxs("div",{className:"space-y-1",children:[A.jsx("div",{className:`p-3 rounded-lg border border-l-4 border-l-blue-500 mb-4 ${e==="dark"?"bg-slate-800/30 border-slate-700":"bg-blue-50/50 border-blue-100"}`,children:A.jsxs("p",{className:"text-xs font-medium text-slate-500",children:["Path found with ",A.jsx("span",{className:"font-bold text-blue-500",children:o.length})," steps"]})}),A.jsxs("div",{className:"relative pl-4 space-y-0",children:[A.jsx("div",{className:"absolute left-1 top-2 bottom-2 w-0.5 bg-slate-200 dark:bg-slate-800"}),A.jsxs("div",{className:"relative mb-4",children:[A.jsx("div",{className:"absolute -left-[15px] top-1 w-2.5 h-2.5 rounded-full bg-blue-500 border-2 border-white dark:border-slate-900"}),A.jsx("button",{onClick:()=>n(i),className:"text-xs font-bold hover:text-blue-500 transition-colors",children:g.find(b=>b.id===i)?.name})]}),o.map((b,x)=>A.jsxs("div",{className:"mb-4",children:[A.jsxs("div",{className:`flex items-center gap-2 my-2 py-1 px-2 rounded border w-fit transition-colors ${e==="dark"?"bg-slate-800/50 border-slate-700 text-slate-400":b.edge.type==="er"?"bg-emerald-50 border-emerald-100 text-emerald-700":"bg-blue-50 border-blue-100 text-blue-700"}`,children:[b.edge.type==="er"?A.jsx(Hl,{size:10,className:e==="dark"?"text-emerald-500":"text-emerald-600"}):A.jsx(wE,{size:10,className:e==="dark"?"text-blue-400":"text-blue-600"}),A.jsx("span",{className:"text-[9px] font-bold uppercase tracking-tighter",children:b.edge.type==="er"?`ER (${b.edge.metadata.type})`:"Lineage"})]}),A.jsxs("div",{className:"relative",children:[A.jsx("div",{className:"absolute -left-[15px] top-1 w-2.5 h-2.5 rounded-full bg-slate-400 border-2 border-white dark:border-slate-900"}),A.jsx("button",{onClick:()=>n(b.to),className:"text-xs font-bold hover:text-blue-500 transition-colors",children:g.find(w=>w.id===b.to)?.name})]})]},x))]})]})]})]})},Qfe=()=>{const{schema:t,theme:e,setSelectedAnnotationId:r,setFocusNodeId:n}=pt(),[i,a]=ve.useState(""),s=ve.useMemo(()=>t?.annotations?t.annotations.filter(o=>o.text.toLowerCase().includes(i.toLowerCase())):[],[t,i]),l=o=>{r(o),n(o)};return A.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden p-4",children:[A.jsxs("div",{className:"relative mb-4 shrink-0",children:[A.jsx(Tu,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),A.jsx("input",{type:"text",value:i,onChange:o=>a(o.target.value),placeholder:"Search notes...",className:`w-full pl-9 pr-4 py-2 rounded-md text-sm transition-all shadow-sm focus:outline-none focus:ring-1 focus:ring-blue-500/50 ${e==="dark"?"bg-slate-800 border-slate-700 text-slate-100":"bg-white border-slate-200 text-slate-900 shadow-slate-200/50"}`})]}),A.jsxs("div",{className:"flex-1 space-y-2 overflow-auto pr-1",children:[s.length===0&&i&&A.jsxs("div",{className:"text-center py-10 text-slate-500 italic text-sm",children:['No notes matching "',i,'"']}),s.map(o=>A.jsxs("button",{onClick:()=>l(o.id),className:`w-full p-3 text-left rounded-lg border transition-all group relative ${e==="dark"?"bg-slate-800/40 border-slate-700 hover:border-blue-500/50 hover:bg-slate-800/60":"bg-white border-slate-200 hover:border-blue-300 hover:bg-blue-50/30 shadow-sm"}`,children:[A.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[A.jsx(zu,{size:12,className:o.type==="callout"?"text-blue-400":"text-amber-400"}),A.jsx("span",{className:"text-[10px] font-bold uppercase tracking-tighter text-slate-500",children:o.type==="callout"?"Callout":"Sticky Note"}),A.jsx(Wp,{size:12,className:"ml-auto opacity-0 group-hover:opacity-100 transition-opacity text-blue-500"})]}),A.jsx("p",{className:`text-xs line-clamp-3 leading-relaxed ${e==="dark"?"text-slate-300":"text-slate-600"}`,children:o.text}),o.targetId&&A.jsxs("div",{className:"mt-2 flex items-center gap-1.5 opacity-60",children:[A.jsx("div",{className:"w-1 h-1 rounded-full bg-slate-400"}),A.jsxs("span",{className:"text-[9px] font-medium truncate italic",children:["Attached to ",o.targetId]})]})]},o.id)),!i&&s.length===0&&A.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center opacity-40",children:[A.jsx(d6,{size:48,className:"mb-4 text-slate-400"}),A.jsx("p",{className:"text-sm font-medium",children:"No annotations in this model yet."})]})]})]})},Kfe=ve.memo(()=>{const{isRightPanelOpen:t,setIsRightPanelOpen:e,activeRightPanelTab:r,setActiveRightPanelTab:n,theme:i,isPresentationMode:a,setIsPresentationMode:s,toggleTheme:l}=pt(so(h=>({isRightPanelOpen:h.isRightPanelOpen,setIsRightPanelOpen:h.setIsRightPanelOpen,activeRightPanelTab:h.activeRightPanelTab,setActiveRightPanelTab:h.setActiveRightPanelTab,theme:h.theme,isPresentationMode:h.isPresentationMode,setIsPresentationMode:h.setIsPresentationMode,toggleTheme:h.toggleTheme}))),o=h=>`
430
+ flex items-center justify-center w-10 h-10 rounded-xl transition-all relative group
431
+ ${h?"bg-blue-600/10 text-blue-500 shadow-inner":i==="dark"?"text-slate-500 hover:text-slate-300 hover:bg-slate-800/30":"text-slate-400 hover:text-slate-600 hover:bg-slate-100"}
432
+ `,c=({text:h})=>A.jsxs("div",{className:"absolute right-14 px-2 py-1 bg-slate-800 text-white text-[10px] font-bold rounded opacity-0 group-hover:opacity-100 pointer-events-none transition-opacity whitespace-nowrap z-[60] border border-slate-700 shadow-xl",children:[h,A.jsx("div",{className:"absolute top-1/2 -right-1 -translate-y-1/2 border-4 border-transparent border-l-slate-800"})]});return A.jsxs("div",{className:`relative h-full flex flex-row transition-all duration-300 ease-in-out shadow-2xl z-50 ${t?"w-[456px]":"w-14"}`,children:[A.jsxs("div",{className:`w-14 h-full flex flex-col items-center py-4 border-l transition-colors z-50 ${i==="dark"?"bg-slate-950 border-slate-800":"bg-slate-50 border-slate-200"}`,children:[A.jsx("button",{onClick:()=>e(!t),className:`mb-6 p-2 rounded-xl transition-all ${i==="dark"?"hover:bg-slate-800 text-slate-400 hover:text-white":"hover:bg-white hover:shadow-md text-slate-500 hover:text-slate-900"}`,children:t?A.jsx(Eg,{size:20}):A.jsx(c6,{size:20})}),A.jsxs("div",{className:"flex flex-col gap-2 mb-6",children:[A.jsxs("button",{onClick:()=>{n("tables"),e(!0)},className:o(r==="tables"&&t),children:[A.jsx(Gre,{size:20}),A.jsx(c,{text:"Tables & Entities"})]}),A.jsxs("button",{onClick:()=>{n("path"),e(!0)},className:o(r==="path"&&t),children:[A.jsx(hne,{size:20}),A.jsx(c,{text:"Path Finder"})]}),A.jsxs("button",{onClick:()=>{n("notes"),e(!0)},className:o(r==="notes"&&t),children:[A.jsx(d6,{size:20}),A.jsx(c,{text:"Note Search"})]})]}),A.jsxs("div",{className:"mt-auto flex flex-col gap-2 pb-2",children:[A.jsxs("button",{onClick:()=>s(!0),className:o(a),children:[A.jsx(lne,{size:20}),A.jsx(c,{text:"Presentation Mode"})]}),A.jsxs("button",{onClick:l,className:o(!1),children:[i==="dark"?A.jsx(Ck,{size:20}):A.jsx(Jre,{size:20}),A.jsx(c,{text:i==="dark"?"Light Mode":"Dark Mode"})]})]})]}),A.jsxs("div",{className:`flex-1 flex flex-col min-w-0 overflow-hidden transition-all duration-300 sidebar-content ${i==="dark"?"bg-slate-900":"bg-white"} ${t?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"}`,style:{width:t?"400px":"0px"},children:[A.jsx("div",{className:`p-4 border-b flex items-center justify-between ${i==="dark"?"border-slate-800":"border-slate-100"}`,children:A.jsxs("h2",{className:`text-sm font-bold tracking-tight uppercase ${i==="dark"?"text-white":"text-slate-900"}`,children:[r==="tables"&&"Tables",r==="path"&&"Path Finder",r==="notes"&&"Note Search"]})}),r==="tables"&&A.jsx(Gfe,{}),r==="path"&&A.jsx(Wfe,{}),r==="notes"&&A.jsx(Qfe,{})]})]})}),Zfe=ve.memo(()=>{const{schema:t,isCommandPaletteOpen:e,setIsCommandPaletteOpen:r,executePipeline:n,setHighlightedNodeIds:i,setFocusNodeId:a,theme:s}=pt(so(E=>({schema:E.schema,isCommandPaletteOpen:E.isCommandPaletteOpen,setIsCommandPaletteOpen:E.setIsCommandPaletteOpen,executePipeline:E.executePipeline,setHighlightedNodeIds:E.setHighlightedNodeIds,setFocusNodeId:E.setFocusNodeId,theme:E.theme}))),[l,o]=ve.useState(""),[c,h]=ve.useState(0),[d,g]=ve.useState(null),m=ve.useRef(null),y=ve.useRef(null),b=ve.useMemo(()=>l.trim()?n(l,!0):{stages:[],outputIds:[]},[l,n]),x=ve.useMemo(()=>{if(!t)return[];if(!l.trim().toLowerCase())return[{id:"select",label:"Select tables...",icon:A.jsx(tne,{size:14}),desc:"select [pattern] or select *",action:()=>o("select ")},{id:"search",label:"Find table...",icon:A.jsx(Tu,{size:14}),desc:"Jump to entity",action:()=>o("search ")},{id:"add-table",label:"Add table...",icon:A.jsx(Gf,{size:14}),desc:"Create a new table node",action:()=>o("add table ")},{id:"add-domain",label:"Add domain...",icon:A.jsx(Gf,{size:14}),desc:"Create a new domain container",action:()=>o("add domain ")},{id:"fit",label:"Fit View",icon:A.jsx(Qre,{size:14}),desc:"Show entire model",action:()=>w("fit")},{id:"theme",label:"Switch Theme",icon:A.jsx(Ck,{size:14}),desc:"Toggle dark/light mode",action:()=>o("theme ")}];const M=l.split("|"),R=M[M.length-1],O=R.trim().split(/\s+/),N=O[0].toLowerCase(),B=M.slice(0,-1).join("|")+(M.length>1?"|":"");if(N==="select"){const D=O.slice(1).join(" ").toLowerCase();return(t.tables||[]).filter(_=>_.id.toLowerCase().includes(D)||_.name.toLowerCase().includes(D)).slice(0,8).map(_=>({id:_.id,label:_.name,icon:A.jsx(Tu,{size:14}),desc:`Table: ${_.id}`,action:()=>o(`${B} select ${_.id}`)}))}if(N==="mv"){const D=O.findIndex(z=>z.toLowerCase()==="to"),_=D>-1?O.slice(D+1).join(" ").toLowerCase():O.slice(1).join(" ").toLowerCase(),P=D>-1?O.slice(0,D+1).join(" "):"mv";return(t.domains||[]).filter(z=>z.id.toLowerCase().includes(_)||z.name.toLowerCase().includes(_)).slice(0,8).map(z=>({id:z.id,label:z.name,icon:A.jsx(nne,{size:14}),desc:`Domain: ${z.id}`,action:()=>o(`${B} ${P} ${z.id}`)}))}if(N==="theme"){const D=O.slice(1).join(" ").toLowerCase();return["dark","light"].filter(_=>_.includes(D)).map(_=>({id:_,label:_,icon:A.jsx(Ck,{size:14}),desc:"UI Appearance",action:()=>o(`${B} theme ${_}`)}))}if(N==="search"||N==="find"||!["mv","add","select","theme","fit"].includes(N)){const D=N==="search"||N==="find"?O.slice(1).join(" ").toLowerCase():R.trim().toLowerCase();return(t.tables||[]).filter(_=>_.id.toLowerCase().includes(D)||_.name.toLowerCase().includes(D)).slice(0,10).map(_=>({id:_.id,label:`Go to ${_.name}`,icon:A.jsx(Tu,{size:14}),desc:_.id,action:()=>{N==="search"||N==="find"||M.length===1?(a(_.id),r(!1)):o(`${B} select ${_.id}`)}}))}return[]},[t,l,a,r]);ve.useEffect(()=>{i(e?b.outputIds:[])},[e,b.outputIds,i]),ve.useEffect(()=>{if(y.current){const E=y.current.children[c];E&&E.scrollIntoView({block:"nearest",behavior:"smooth"})}},[c]),ve.useEffect(()=>{e&&(o(""),g(null),h(0),setTimeout(()=>m.current?.focus(),10))},[e]);const w=E=>{const M=E||l;if(!M.trim())return;if(M==="fit"){window.__modscapeFitView?.(),S("success","View fitted");return}const R=n(M,!1);if(R.stages.length>0&&R.stages.every(O=>O.status==="success"))S("success","Pipeline executed successfully");else{const O=R.stages.find(N=>N.status==="error");O&&S("info",O.message)}},S=(E,M)=>{g({type:E,msg:M}),setTimeout(()=>{g(null),E==="success"&&o("")},1500)},k=E=>{E.stopPropagation(),E.key==="Escape"?r(!1):E.key==="ArrowDown"?(E.preventDefault(),h(M=>(M+1)%(x.length||1))):E.key==="ArrowUp"?(E.preventDefault(),h(M=>(M-1+(x.length||1))%(x.length||1))):E.key==="Tab"?(E.preventDefault(),x.length>0&&x[c]&&x[c].action()):E.key==="Enter"&&(E.preventDefault(),w())};return e?A.jsxs("div",{className:`fixed inset-0 z-[2000] flex items-start justify-center pt-[15vh] px-4 backdrop-blur-[2px] animate-in fade-in duration-200 ${s==="dark"?"bg-slate-950/20":"bg-white/20"}`,children:[A.jsx("div",{className:"absolute inset-0",onClick:()=>r(!1)}),A.jsxs("div",{className:`relative w-full max-w-2xl rounded-2xl shadow-[0_32px_64px_-12px_rgba(0,0,0,0.5)] border-2 overflow-hidden animate-in slide-in-from-top-4 duration-300 ${s==="dark"?"bg-slate-900 border-slate-700 text-white":"bg-white border-slate-200 text-slate-900"}`,children:[A.jsxs("div",{className:`flex items-center px-4 py-4 gap-3 border-b ${s==="dark"?"border-slate-800/50":"border-slate-100"}`,children:[A.jsx("div",{className:"p-1.5 bg-blue-600 rounded-lg text-white shadow-lg shadow-blue-500/20",children:A.jsx(h6,{size:18})}),A.jsx("input",{ref:m,type:"text",placeholder:"select * | mv Core | stack v",className:`flex-1 bg-transparent border-none outline-none text-lg font-bold tracking-tight ${s==="dark"?"placeholder-slate-600":"placeholder-slate-400"}`,value:l,onChange:E=>{o(E.target.value),h(0)},onKeyDown:k}),A.jsx("kbd",{className:`px-1.5 py-0.5 rounded text-[10px] font-black border ${s==="dark"?"bg-slate-800 text-slate-500 border-slate-700":"bg-slate-100 text-slate-400 border-slate-200"}`,children:"ESC"})]}),d?A.jsxs("div",{className:`px-4 py-6 flex flex-col items-center justify-center gap-3 animate-in zoom-in-95 duration-200 ${d.type==="success"?"text-emerald-500":"text-blue-500"}`,children:[A.jsx("div",{className:`p-3 rounded-full ${d.type==="success"?"bg-emerald-500/10":"bg-blue-500/10"}`,children:d.type==="success"?A.jsx(u6,{size:32}):A.jsx(SE,{size:32})}),A.jsx("span",{className:"text-sm font-black uppercase tracking-widest",children:d.msg})]}):A.jsxs(A.Fragment,{children:[l.trim()&&A.jsxs("div",{className:`px-4 py-4 border-b flex flex-col gap-3 ${s==="dark"?"bg-slate-950/20":"bg-slate-50/50"}`,children:[A.jsxs("div",{className:"flex items-center justify-between",children:[A.jsx("h4",{className:"text-[10px] font-black uppercase tracking-[0.2em] text-slate-500",children:"Execution Plan"}),A.jsx(CE,{size:12,className:"text-blue-500 animate-pulse"})]}),A.jsx("div",{className:"flex flex-col gap-2",children:b.stages.length>0?b.stages.map((E,M)=>A.jsxs("div",{className:"flex items-center gap-3 group",children:[A.jsx("div",{className:`w-5 h-5 rounded-full flex items-center justify-center text-[10px] font-bold ${E.status==="success"?"bg-emerald-500/20 text-emerald-500":E.status==="active"?"bg-blue-500 text-white animate-pulse":"bg-slate-800 text-slate-500"}`,children:M+1}),A.jsx("div",{className:"flex flex-col",children:A.jsxs("div",{className:"flex items-center gap-2",children:[A.jsx("span",{className:"text-xs font-black uppercase tracking-wider",children:E.command}),A.jsx("span",{className:"text-[10px] text-slate-500 font-medium",children:E.message})]})})]},M)):A.jsx("div",{className:"text-[10px] text-slate-500 italic",children:"Parsing command..."})})]}),A.jsxs("div",{className:"flex flex-col",children:[x.length>0&&A.jsx("div",{ref:y,className:"max-h-[300px] overflow-auto py-2 border-b border-slate-800/30",children:x.map((E,M)=>A.jsxs("div",{className:`px-4 py-3 flex items-center justify-between cursor-pointer transition-colors ${c===M?"bg-blue-600 text-white":s==="dark"?"hover:bg-slate-800 text-slate-300":"hover:bg-slate-50 text-slate-600"}`,onClick:()=>E.action(),children:[A.jsxs("div",{className:"flex items-center gap-3",children:[A.jsx("div",{className:c===M?"text-white":"text-slate-500",children:E.icon}),A.jsxs("div",{className:"flex flex-col",children:[A.jsx("span",{className:"text-sm font-bold",children:E.label}),E.desc&&A.jsx("span",{className:`text-[10px] ${c===M?"text-blue-100":"text-slate-500"}`,children:E.desc})]})]}),c===M&&A.jsx(Eg,{size:14,className:"opacity-50"})]},`${E.id}-${M}`))}),l.includes("|")&&A.jsxs("div",{className:"p-4 flex flex-col gap-3",children:[A.jsx("div",{className:"flex items-center justify-between",children:A.jsxs("h4",{className:"text-[10px] font-black uppercase tracking-[0.2em] text-slate-500",children:["Working Set (",b.outputIds.length,")"]})}),A.jsx("div",{className:"flex flex-wrap gap-1.5 max-h-[120px] overflow-auto",children:b.outputIds.length>0?b.outputIds.map(E=>A.jsx("div",{className:`px-2 py-0.5 rounded text-[10px] font-bold border ${s==="dark"?"bg-blue-500/10 border-blue-500/20 text-blue-400":"bg-blue-50 border-blue-100 text-blue-600"}`,children:E},E)):A.jsx("div",{className:"text-[10px] text-slate-500 italic",children:"No tables in current scope"})})]})]})]}),A.jsxs("div",{className:`px-4 py-3 border-t flex items-center justify-between ${s==="dark"?"bg-slate-950/30 border-slate-800/50":"bg-slate-50/50 border-slate-100"}`,children:[A.jsxs("div",{className:"flex items-center gap-4 text-[9px] font-bold text-slate-500 uppercase",children:[A.jsxs("div",{className:"flex items-center gap-1",children:[A.jsx("kbd",{className:`px-1 rounded border ${s==="dark"?"bg-slate-800 border-slate-700":"bg-slate-100 border-slate-200"}`,children:"↑↓"}),A.jsx("span",{children:"Navigate"})]}),A.jsxs("div",{className:"flex items-center gap-1",children:[A.jsx("kbd",{className:`px-1 rounded border ${s==="dark"?"bg-slate-800 border-slate-700":"bg-slate-100 border-slate-200"}`,children:"Tab"}),A.jsx("span",{children:"Select"})]}),A.jsxs("div",{className:"flex items-center gap-1",children:[A.jsx("kbd",{className:`px-1 rounded border ${s==="dark"?"bg-slate-800 border-slate-700":"bg-slate-100 border-slate-200"}`,children:"Enter"}),A.jsx("span",{children:"Execute"})]})]}),A.jsxs("div",{className:"flex items-center gap-2",children:[A.jsx("div",{className:`w-2 h-2 rounded-full ${b.outputIds.length>0?"bg-emerald-500 animate-pulse":"bg-slate-700"}`}),A.jsxs("span",{className:"text-[9px] font-black text-slate-500 uppercase tracking-widest",children:[b.outputIds.length," target entities"]})]})]})]})]}):null}),Jfe=()=>{const{isPresentationMode:t,setIsPresentationMode:e,theme:r}=pt();return t?A.jsx("div",{className:"fixed top-6 right-6 z-[100] flex items-center gap-2 animate-in fade-in slide-in-from-top-4 duration-500",children:A.jsx("button",{onClick:()=>e(!1),className:`p-2.5 rounded-full border shadow-2xl backdrop-blur-md transition-all hover:rotate-90 active:scale-90 ${r==="dark"?"bg-slate-900/80 border-slate-700 text-slate-400 hover:text-white":"bg-white/80 border-slate-200 text-slate-500 hover:text-slate-900"}`,title:"Exit Presentation Mode (Esc)",children:A.jsx(Oh,{size:20})})}):null},ehe=()=>{const{getSelectedTable:t,getSelectedDomain:e,getSelectedRelationship:r,selectedTableIds:n,setSelectedTableIds:i,distributeSelectedTables:a,setSelectedTableId:s,setSelectedEdgeId:l,setSelectedAnnotationId:o,theme:c}=pt(),h=t(),d=e(),g=r(),m=n.length>1;if(!h&&!d&&!g&&!m)return null;const y=()=>{s(null),i([]),l(null),o(null)};return A.jsxs("div",{className:`absolute top-4 right-4 z-10 flex items-center gap-3 border rounded-xl shadow-2xl p-1.5 px-4 animate-in fade-in slide-in-from-top-4 duration-300 ${c==="dark"?"bg-slate-900/90 backdrop-blur-md border-blue-500/30":"bg-white/90 backdrop-blur-md border-blue-200 shadow-blue-500/5"}`,children:[A.jsxs("div",{className:`flex items-center gap-2 border-r pr-4 mr-1 ${c==="dark"?"border-slate-700":"border-slate-100"}`,children:[m?A.jsx(Vre,{size:16,className:"text-blue-500"}):A.jsxs(A.Fragment,{children:[h&&A.jsx(Hl,{size:16,className:"text-emerald-500"}),d&&A.jsx(p6,{size:16,className:"text-blue-500"}),g&&(g.relationship.type==="lineage"?A.jsx(wE,{size:16,className:"text-blue-400"}):A.jsx(zu,{size:16,className:"text-amber-500"}))]}),A.jsxs("div",{className:"flex flex-col leading-tight",children:[A.jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-slate-500",children:m?"Multi-Selection":`Selected ${h?"Table":d?"Domain":g?.relationship.type==="lineage"?"Lineage":"Relation"}`}),A.jsx("span",{className:`text-xs font-semibold truncate max-w-[180px] ${c==="dark"?"text-slate-200":"text-slate-800"}`,children:m?`${n.length} tables selected`:h?h.name:d?d.name:g?`${g.relationship.from.table} → ${g.relationship.to.table}`:""})]})]}),A.jsxs("div",{className:"flex items-center gap-1",children:[m&&A.jsxs("div",{className:"flex items-center gap-1 mr-2 pr-2 border-r border-slate-700/30",children:[A.jsx("button",{onClick:()=>a("vertical"),className:"flex items-center justify-center w-8 h-8 hover:bg-blue-500/20 text-slate-400 hover:text-blue-400 rounded-lg transition-all",title:"Align Vertically (V)",children:A.jsx(yre,{size:16})}),A.jsx("button",{onClick:()=>a("horizontal"),className:"flex items-center justify-center w-8 h-8 hover:bg-blue-500/20 text-slate-400 hover:text-blue-400 rounded-lg transition-all",title:"Align Horizontally (H)",children:A.jsx(vre,{size:16})})]}),A.jsx("button",{onClick:y,className:`flex items-center justify-center w-8 h-8 rounded-lg transition-all ${c==="dark"?"hover:bg-slate-800 text-slate-500 hover:text-slate-300":"hover:bg-slate-100 text-slate-400 hover:text-slate-600"}`,title:"Clear Selection (Esc)",children:A.jsx(Oh,{size:16})})]})]})};function the(){const{schema:t,setSelectedTableId:e,selectedTableId:r,selectedEdgeId:n,setSelectedEdgeId:i,selectedAnnotationId:a,setSelectedAnnotationId:s,focusNodeId:l,setFocusNodeId:o,removeNode:c,bulkRemoveTables:h,removeEdge:d,removeAnnotation:g,showAnnotations:m,addTable:y,addDomain:b,addAnnotation:x,theme:w,isPresentationMode:S,setIsPresentationMode:k,refreshModelData:E,fetchAvailableFiles:M,isModelLoading:R,isCliMode:O,distributeSelectedTables:N,selectedTableIds:B,toggleTableSelection:D,toggleEdgeSelection:_,connectMode:P,setConnectMode:z,currentModelSlug:H}=pt(so(K=>({schema:K.schema,setSelectedTableId:K.setSelectedTableId,selectedTableId:K.selectedTableId,selectedEdgeId:K.selectedEdgeId,setSelectedEdgeId:K.setSelectedEdgeId,selectedAnnotationId:K.selectedAnnotationId,setSelectedAnnotationId:K.setSelectedAnnotationId,focusNodeId:K.focusNodeId,setFocusNodeId:K.setFocusNodeId,removeNode:K.removeNode,bulkRemoveTables:K.bulkRemoveTables,removeEdge:K.removeEdge,removeAnnotation:K.removeAnnotation,showAnnotations:K.showAnnotations,addTable:K.addTable,addDomain:K.addDomain,addAnnotation:K.addAnnotation,theme:K.theme,isPresentationMode:K.isPresentationMode,setIsPresentationMode:K.setIsPresentationMode,refreshModelData:K.refreshModelData,fetchAvailableFiles:K.fetchAvailableFiles,isModelLoading:K.isModelLoading,isCliMode:K.isCliMode,distributeSelectedTables:K.distributeSelectedTables,selectedTableIds:K.selectedTableIds,toggleTableSelection:K.toggleTableSelection,toggleEdgeSelection:K.toggleEdgeSelection,connectMode:K.connectMode,setConnectMode:K.setConnectMode,currentModelSlug:K.currentModelSlug}))),$=ve.useRef(null),q=ve.useRef(null),V=ve.useRef(null),X=ve.useCallback(K=>{$.current=K},[]),ee=ve.useCallback(K=>{q.current=K},[]),te=ve.useCallback(K=>{V.current=K},[]);ve.useEffect(()=>{if(!H)return;const K=setTimeout(()=>$.current?.(),300);return()=>clearTimeout(K)},[H]);const I=ve.useRef(null),G=ve.useRef(null),re=ve.useRef(1e3);ve.useEffect(()=>{if(!O)return;const K=()=>{const ue=window.location.protocol==="https:"?"wss:":"ws:",Se=new WebSocket(`${ue}//${window.location.host}`);Se.onopen=()=>{re.current=1e3},Se.onmessage=at=>{try{const Me=JSON.parse(at.data);Me.type==="update"?E():Me.type==="files_changed"&&M()}catch{}},Se.onclose=()=>{I.current=null,G.current&&window.clearTimeout(G.current),G.current=window.setTimeout(()=>{re.current=Math.min(re.current*1.5,3e4),K()},re.current)},Se.onerror=()=>Se.close(),I.current=Se};return K(),()=>{I.current&&(I.current.onclose=null,I.current.close()),G.current&&window.clearTimeout(G.current)}},[O,E,M]),ve.useEffect(()=>{l&&q.current&&(q.current(l),o(null))},[l,o]),ve.useEffect(()=>{window.__modscapeFitView=()=>$.current?.(),window.__modscapeAutoLayout=()=>V.current?.()},[]),ve.useEffect(()=>{const K=ue=>{if(ue.key==="Escape"){if(S){k(!1);return}if(pt.getState().connectMode){pt.getState().setConnectMode(null);return}e(null),i(null),s(null),pt.getState().setSelectedTableIds([]);return}const Se=document.activeElement;if(Se?.tagName==="INPUT"||Se?.tagName==="TEXTAREA"||Se?.isContentEditable||Se?.closest(".cm-editor")||Se?.closest(".sidebar-content")||ue.repeat)return;const Me=ue.key.toLowerCase();if(Me==="/"){ue.preventDefault(),pt.getState().setIsRightPanelOpen(!0),pt.getState().setActiveRightPanelTab("tables");return}if(Me==="k"&&(ue.ctrlKey||ue.metaKey)){ue.preventDefault(),pt.getState().setIsCommandPaletteOpen(!pt.getState().isCommandPaletteOpen);return}if(Me==="l"){ue.preventDefault();const He=pt.getState().activeTab;pt.getState().setActiveTab(He==="connect"?"editor":"connect"),pt.getState().setIsSidebarOpen(!0);return}if((Me==="v"||Me==="h")&&B.length>1){ue.preventDefault(),N?.(Me==="v"?"vertical":"horizontal");return}if(ue.key==="Backspace"||ue.key==="Delete"){if(B.length>1){h(B),pt.getState().setSelectedTableIds([]);return}if(!r&&!a){if(n){if(n.startsWith("lin-")){const He=n.lastIndexOf("-"),$e=parseInt(n.slice(He+1)),Ne=t?.lineage?.[$e];Ne&&d(Ne.from,Ne.to,"lineage")}else{const He=t?.relationships?.find(($e,Ne)=>`er-${Ne}`===n);He&&d(He.from.table,He.to.table,"er")}i(null)}return}}if((ue.key==="Backspace"||ue.key==="Delete")&&(r||a)){a?(g(a),s(null)):r&&(c(r),e(null));return}};return window.addEventListener("keydown",K),()=>window.removeEventListener("keydown",K)},[S,k,e,i,s,r,n,a,B,N,t,c,h,d,g]);const Y=ve.useCallback(K=>{D(K)},[D]),W=ve.useCallback(K=>{_(K.id)},[_]),Z=ve.useCallback(()=>{e(null),i(null),s(null),pt.getState().setSelectedTableIds([])},[e,i,s]),ie=ve.useCallback(K=>{e(null),i(null),s(K)},[e,i,s]),we=ve.useCallback(K=>{s(null),i(null),D(K)},[s,i,D]),de=ve.useCallback((K,ue,Se)=>{K==="lineage"?pt.getState().addLineage(ue,Se):pt.getState().addRelationship(ue,Se)},[]),se=ve.useCallback((K,ue)=>{y(K,ue)},[y]),j=ve.useCallback((K,ue)=>{b(K,ue)},[b]),Q=ve.useCallback((K,ue)=>{m||pt.getState().setShowAnnotations(!0),x({x:K,y:ue})},[x,m]);return A.jsxs("div",{className:"flex-1 relative h-full flex flex-col overflow-hidden",children:[A.jsxs("div",{className:"flex-1 relative overflow-hidden",children:[!S&&A.jsx(ehe,{}),A.jsx(Jfe,{}),A.jsx(Zfe,{}),P&&A.jsx("div",{className:"absolute top-4 left-1/2 -translate-x-1/2 z-50 pointer-events-none",children:A.jsxs("div",{className:`flex items-center gap-2 px-4 py-1.5 backdrop-blur-md rounded-full shadow-xl border ${w==="dark"?"bg-slate-950/70 border-green-500/50":"bg-white/80 border-green-500/40"}`,children:[A.jsx("div",{className:"w-2 h-2 rounded-full bg-green-500 animate-pulse"}),A.jsxs("span",{className:`text-[10px] font-black uppercase tracking-widest ${w==="dark"?"text-green-400":"text-green-600"}`,children:[P==="lineage"?"Lineage":"ER"," Connect Mode"]}),A.jsx("div",{className:`w-px h-3 ${w==="dark"?"bg-green-500/20":"bg-green-500/30"}`}),A.jsx("span",{className:`text-[10px] font-bold ${w==="dark"?"text-green-400/70":"text-green-600/70"}`,children:"Click source → target · Esc to exit"}),A.jsx("button",{className:"pointer-events-auto ml-1 opacity-60 hover:opacity-100 transition-opacity",onClick:()=>z(null),children:A.jsx("span",{className:`text-[10px] font-bold ${w==="dark"?"text-green-400":"text-green-600"}`,children:"✕"})})]})}),R&&A.jsxs("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:16,zIndex:10,pointerEvents:"none"},children:[A.jsx("div",{style:{width:36,height:36,border:`3px solid ${w==="dark"?"#334155":"#e2e8f0"}`,borderTopColor:w==="dark"?"#60a5fa":"#3b82f6",borderRadius:"50%",animation:"spin 0.8s linear infinite"}}),A.jsx("span",{style:{fontSize:13,color:w==="dark"?"#94a3b8":"#64748b",fontWeight:500},children:"Loading model…"})]}),A.jsx("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"}),t&&A.jsx(ure,{onNodeClick:Y,onEdgeClick:W,onPaneClick:Z,onAnnotationClick:ie,onDomainClick:we,onAddTableAt:se,onAddDomainAt:j,onAddAnnotationAt:Q,onFitView:X,onFocusNode:ee,onEdgeCreated:de,onAutoLayout:te})]}),!S&&A.jsx(Mne,{})]})}function rhe(){const[t,e]=ve.useState(!1),{isCliMode:r,fetchAvailableFiles:n,setCurrentModel:i,setSchema:a,theme:s,isPresentationMode:l}=pt(),o=!!window.__MODSCAPE_DATA__;return ve.useEffect(()=>{if(r){n().then(()=>{const h=new URLSearchParams(window.location.search).get("model");h?i(h):fetch("/api/model").then(d=>d.json()).then(d=>a(d))}),e(!0);return}if(o){const c=window.__MODSCAPE_DATA__;c?.models?.length>0&&n().then(()=>{const d=new URLSearchParams(window.location.search).get("model");d?i(d):(a(c.models[0].schema),c.models[0].slug&&i(c.models[0].slug))})}e(!0)},[r,o,n,i,a]),t?A.jsxs("div",{className:`flex h-screen w-screen overflow-hidden font-sans transition-colors duration-300 ${s==="dark"?"dark bg-slate-950 text-slate-100":"bg-slate-50 text-slate-900"}`,children:[!l&&A.jsx($fe,{}),A.jsx(the,{}),!l&&A.jsx(Kfe,{})]}):null}AI.createRoot(document.getElementById("root")).render(A.jsx(ve.StrictMode,{children:A.jsx(rhe,{})}));